使用Open CV SIFT调试断言失败 [英] Debug assertion failed with Open CV SIFT
本文介绍了使用Open CV SIFT调试断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望有人可以提供帮助。我一直在尝试使用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
this->_Orphan_all();
_Destroy(this->_Myfirst, this->_Mylast);
this->_Getal().deallocate(this->_Myfirst,
this->_Myend - this->_Myfirst);**//--->......Here.....**
this->_Myfirst = pointer();
this->_Mylast = pointer();
this->_Myend = pointer();
}
}
例外情况说明:
The exception details says:
**Debug assertion failed.
Program:...
File: f:\dd\vctools\ctr_bld\self_x86\crt\src\dbgheap.c
Line: 1322
Expression: _CrtIsValidHeapPointers(pUserData)**</cv::keypoint>
推荐答案
问题在于visual studio 2012。我在2010年运行该程序,运行顺利。
The problem was with visual studio 2012. When I ran the program in 2010 it ran smoothly.
这篇关于使用Open CV SIFT调试断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文