C++ 奇怪的访问冲突 Visual studio 2015 RC
C++ strange access violation Visual studio 2015 RC
这个错误我真是百思不得其解,不知道是C++的问题,OpenCV的问题,还是IDE的问题,还是知识不够。我正在使用 VS2015 RC,OpenCV 2.4.10。
这是我的代码
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);
}
当我运行这段代码时,每一行都执行得很好,但在函数结束时我得到以下错误
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.
如果我使用默认构造函数初始化SimpleBlobDetector,则不会出现该问题。我检查了检测函数的 return 并且它 return 是正确的值,我什至绘制了它。但是当函数结束时会出现错误。我也尝试增加堆栈大小。我还尝试将它放在主函数中,但它最终导致访问冲突!!
请帮忙!
我认为这可能是 VS2015 RC 的问题,我在 VS2010 上使用完全相同的代码创建了一个新项目,它的效果非常好!
这个错误我真是百思不得其解,不知道是C++的问题,OpenCV的问题,还是IDE的问题,还是知识不够。我正在使用 VS2015 RC,OpenCV 2.4.10。 这是我的代码
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);
}
当我运行这段代码时,每一行都执行得很好,但在函数结束时我得到以下错误
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.
如果我使用默认构造函数初始化SimpleBlobDetector,则不会出现该问题。我检查了检测函数的 return 并且它 return 是正确的值,我什至绘制了它。但是当函数结束时会出现错误。我也尝试增加堆栈大小。我还尝试将它放在主函数中,但它最终导致访问冲突!!
请帮忙!
我认为这可能是 VS2015 RC 的问题,我在 VS2010 上使用完全相同的代码创建了一个新项目,它的效果非常好!