我正在为 ios 平台开发一个 opencv 应用程序。我自己为调试和发布方案编译了 opencv,但是当我尝试cv::meanStdDev
使用 Debug 方案运行该函数时,应用程序失败并出现异常(使用 Release 可以正常工作)。测试功能很简单:
float list[] = {1.2,1.2,1.3,0.3,6.5,2.2,0.9,0.8,0.9};
cv::Mat test(1,9,CV_32F, list);
cv::Scalar mean1, stddev1;
cv::meanStdDev(test, mean1, stddev1);
printf("[%f, %f]", mean1.val[0], stddev1.val[0]);
此函数在 Release 方案上正常工作,但在 Debug 上,它会引发如下异常:
OpenCV Error: Assertion failed (dims == 2 && ((sizes[0] == sz.height && sizes[1] == sz.width) || (allowTransposed && sizes[0] == sz.width && sizes[1] == sz.height))) in create, file /Users/jgoenetxea/libraries/OpenCV-2.4.0/trunk/opencv/modules/core/src/matrix.cpp, line 1375
terminate called throwing an exception
此行是矩阵类的“创建”函数。在这一点上,该kind()
函数在同一矩阵的调试和发布方案中给出了不同的值。When Debug scheme is selected, because of the result of this kind()
function, the execution checks some data with a CV_Assert
function invocation, and then fails.
有任何想法吗?有人知道我可以检查什么吗?