我正在尝试使用cvLogPolar
方法,但我总是收到以下错误:
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-pcqRHK/opencv-2.4.10.1/modules/core/src/array.cpp, line 2482
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-pcqRHK/opencv-2.4.10.1/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
我的代码:
cv::Mat logpolar_frame(size, CV_8UC3), bgr_frame;
for(;;) {
capture >> bgr_frame;
if( bgr_frame.empty() ) {
break;
}
cv::imshow( "Example2_10", bgr_frame );
cvLogPolar(&bgr_frame, &logpolar_frame, cv::Point2f(bgr_frame.cols / 2, bgr_frame.rows / 2), 40);
}
我已经尝试在循环中复制bgr_frame,但这会导致相同的错误。
答案 0 :(得分:4)
对于神秘的c-api遗留功能,你需要一个血腥的IplImage *。
IplImage ipl_in = bgr_frame;
IplImage ipl_out = logpolar_frame;
cvLogPolar(&ipl_in, &ipl_out, ...)
(对于3.0,避免全部,并使用cv :: logPolar(),遗憾的是在opencv2.4中不可用)