Poka Yoke
Poka Yoke

Reputation: 403

C++ strange access violation Visual studio 2015 RC

I'm really puzzled by this error I don't know if it's a C++ problem, OpenCV, an IDE problem or lack of knowledge. I'm using VS2015 RC, OpenCV 2.4.10. This is my code

void cluster(cv::Mat &im)
{
cv::Mat thresholded = im.clone();
threshold(im, thresholded, 254, 255, CV_THRESH_BINARY);

// Setup SimpleBlobDetector parameters.
SimpleBlobDetector::Params params;
params.filterByCircularity = false;
params.filterByInertia = false;
params.filterByColor = false;

// Change thresholds
params.minThreshold = 200;
params.maxThreshold = 250;

// Filter by Area.
params.filterByArea = true;
params.minArea = 50;

// Filter by Convexity
params.filterByConvexity = true;
params.minConvexity = 0;
params.maxConvexity = 1;

// Set up the detector with default parameters.
SimpleBlobDetector detector(params);


// Detect blobs.
std::vector<KeyPoint> keypoints;

detector.detect(thresholded, keypoints);
}

When I run this code every line is executed fine, but at the end of the function I get the following error

Exception thrown at 0x00007FFAC07A51EA (ntdll.dll) in OP4.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Unhandled exception at 0x00007FFAC07A51EA (ntdll.dll) in OP4.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

The problem doesn't appear if I initialized SimpleBlobDetector with the default constructor. I checked the return of the detect function and it returns the correct value, I even plotted it. But the error appears when the function ends. I tried increasing the stack size as well. I also tried to have it in the main function, and it eventually gives an access violation !!

Help please!

Upvotes: 2

Views: 2005

Answers (1)

Poka Yoke
Poka Yoke

Reputation: 403

I think it might be a problem with VS2015 RC, I created a new project using exactly the same code on VS2010 and it works like charm !

Upvotes: 1

Related Questions