0

最近,我将一个项目从 Visual Studios 2010 转移到 2012。我一开始就遇到了由于使用 findContours() 而导致的内存异常。我已经尝试过其他解决方案,但它们似乎都没有奏效。但是,基于这些解决方案,我认为问题出在项目属性上。有什么建议么?

更具体地说,代码因内存堆错误而崩溃。这是代码:

//cameraFeed 是 Mat 类型,并且在前面声明过。

Mat temp;
Mat HSV;
Mat threshold;

Vid_mtx.lock();
//convert frame from BGR to HSV colorspace
cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);
Vid_mtx.unlock();
//track objects based on the HSV slider values.
inRange(HSV,Scalar(H_MIN,S_MIN,V_MIN),Scalar(H_MAX,S_MAX,V_MAX),threshold);
morphOps(threshold);
//if(calibrationMode==true) 
imshow(windowName2,threshold);


threshold.copyTo(temp);
//cvtColor(temp, temp_grey,COLOR_BGR2GRAY);
if(temp.empty()) printf("Whatcha doin?");
//these two vectors needed for output of findContours
vector< vector<Point> > contours;
vector<Vec4i> hierarchy;
//find contours of filtered image using openCV findContours function

findContours(temp,contours,hierarchy, CV_RETR_CCOMP,CV_CHAIN_APPROX_SIMPLE);
4

0 回答 0