【发布时间】:2011-09-30 07:34:41
【问题描述】:
我的开发环境是 Windows 7 上的 Mingw32 位 CMake。(同样的代码在 Linux 上运行良好)
我使用 cvFindContours() 来使用 OpenCV 检测轮廓。
我使用递归方法遍历生成的 CvSeq 以逐级访问轮廓,如下所示:
void helperParseCurves(CvSeq* contour, int level) {
//Travel same level contours
if(contour->h_next != NULL) {
helperParseCurves(contour->h_next, level);
}
if(contour->v_next != NULL) {
helperParseCurves(contour->v_next, level+1);
}
//Travel child levels
for(int i=0; i<contour->total; i++){
//Try to access Point data -- Crash here when threshold level 114 ?
//Works when uncommented
CvPoint* p = CV_GET_SEQ_ELEM(CvPoint, contour, i);
}
}
但应用程序在 CvPoint* p = CV_GET_SEQ_ELEM(CvPoint, contour, i); 行崩溃; 这发生在一些特定的大图像上,并且在 Linux 中运行良好。
我已经上传了一个示例程序来演示场景
http://dl.dropbox.com/u/17399055/opencv-test.zip
*使用 CMake 下载和编译
*使用示例图像运行代码 - "OCvTest.exe test-img.tif"
*将滑块值更改为 114 左右,应用程序崩溃。
*如果第 27 行被注释可以正常工作。
有什么建议吗?
这可能是 OpenCV 错误吗?
提前致谢。
【问题讨论】: