0
我希望有人可以提供幫助。我一直在努力與SIFT一起工作,甚至像這樣的最簡單的程序都會導致調試斷言失敗。調試斷言失敗,打開CV 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_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
}
我認爲這是在清理這裏的某個地方:
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();
}
異常的詳細信息說:
**Debug assertion failed.
Program:...
File: f:\dd\vctools\ctr_bld\self_x86\crt\src\dbgheap.c
Line: 1322
Expression: _CrtIsValidHeapPointers(pUserData)**
你調試了嗎?什麼線斷言? –
它從函數調用返回時發生。我認爲它與釋放數組有關係 – CplusLady
您正在進行很多函數調用。哪一個?最後? 'cv :: imwrite(「sift_result.jpg」,輸出);'? –