0
我目前使用OpenCV的fitLine()
函数。OpenCV:fitLine()的固定大小错误函数
这是我的代码:
float lineParams[16];
Mat lineParamsMat(Size(4,4), CV_32F, lineParams);
Point2f points[6];
//point parameters for line
Mat point_mat(Size(1, 6), CV_32FC2, points);
//The line is stored in a row in the lineParamsMat Matrix
fitLine (point_mat, lineParamsMat.row(i), CV_DIST_L2, 0, 0.01, 0.01);
在最后一行出现的错误。错误消息一如既往地清楚:
OpenCV Error: Assertion failed (!fixedSize() || ((Mat*)obj)->size.operator()() == Size(_cols, _rows)) in create, file /Applications/opencv-3.1.0/modules/core/src/matrix.cpp, line 2232
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Applications/opencv-3.1.0/modules/core/src/matrix.cpp:2232: error: (-215) !fixedSize() || ((Mat*)obj)->size.operator()() == Size(_cols, _rows) in function create
有没有人遇到过此错误?
你可以使用'std :: vector'和'cv :: Vec4f'来代替两个'Mat's吗?这对我有效。这个问题与你如何构建“Mat”之一有关。看到堆栈跟踪将有助于更多地了解它的实际情况。 –
这是个好主意 - 我会试试!我如何查看更详细的堆栈跟踪? –
在调试器中运行它,并在抛出异常时停止。确切的过程取决于您使用的工具。你将需要调试符号才能工作。 –