C++ 调试断言因打开CV SIFT而失败
我希望有人能帮忙。我一直在尝试使用SIFT,即使像这样最简单的程序也会导致调试断言失败C++ 调试断言因打开CV SIFT而失败,c++,opencv,assertion,C++,Opencv,Assertion,我希望有人能帮忙。我一直在尝试使用SIFT,即使像这样最简单的程序也会导致调试断言失败 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_GRAY
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
}
例外详细信息显示:
**Debug assertion failed.
Program:...
File: f:\dd\vctools\ctr_bld\self_x86\crt\src\dbgheap.c
Line: 1322
Expression: _CrtIsValidHeapPointers(pUserData)**
问题在于visual studio 2012。切换到2010年运行顺利。我相信2012不太喜欢openCV。您调试了吗?行断言什么?它在从函数调用返回时发生。我认为这与释放阵列有关。你正在进行许多函数调用。哪一个?最后一个<代码>cv::imwrite(“sift_result.jpg”,输出)代码>?修改了主要问题以显示错误发生的位置。返回时退出_Success();
**Debug assertion failed.
Program:...
File: f:\dd\vctools\ctr_bld\self_x86\crt\src\dbgheap.c
Line: 1322
Expression: _CrtIsValidHeapPointers(pUserData)**