Debug assertion failed with Open CV SIFT

I hope someone can help. I have been trying to work with SIFT and even the simplest program like this will cause a debug assertion failed.

int DoSift()
    string image2 ="G:/SIFT Test/Foods/f1.jpg";
    string image1 ="G:/SIFT Test/Foods/f2.jpg";

    Mat input = imread(image1, IMREAD_GRAYSCALE );
    Mat img_2 = imread( image2, IMREAD_GRAYSCALE );

    // const cv::Mat input = cv::imread("input.jpg", 0); //Load as grayscale

    cv::SiftFeatureDetector detector;
    std::vector<cv::KeyPoint> keypoints;
    detector.detect(input, keypoints);

    // Add results to image and save.
    cv::Mat output;
    cv::drawKeypoints(input, keypoints, output);`enter code here`
    cv::imwrite("sift_result.jpg", output);
   return Exit_Success(); //<- it happens here

I think it's in the cleanup somewhere here:

void _Tidy()
        {   // free all storage
        if (this->_Myfirst != pointer())
            {   // something to free, destroy and deallocate it
            _Destroy(this->_Myfirst, this->_Mylast);
                this->_Myend - this->_Myfirst);**//--->......Here.....**
            this->_Myfirst = pointer();
            this->_Mylast = pointer();
            this->_Myend = pointer();

The exception details says:

**Debug assertion failed.
File: f:\dd\vctools\ctr_bld\self_x86\crt\src\dbgheap.c
Line: 1322
Expression: _CrtIsValidHeapPointers(pUserData)**


The problem is with visual studio 2012. Switching to 2010 ran smoothly. I believe that the 2012 doesn't quite like openCV.

Need Your Help

Utilizing perl to manipulate csv/semicolon data

perl csv awk

I am looking for suggestions on how to manipulate data where a 1 line AWK command is no longer sufficient. I am working with data sets of up to 1000+ rows &amp; columns. I am running into problem...

Read Request Body in ASP.NET rest httpwebrequest

How does one read the request body in ASP.NET? I'm using the REST Client add-on for Firefox to form a GET request for a resource on a site I'm hosting locally, and in the Request Body I'm just put...