嗨,我试图修改lkdemo.cpp
in OpenCV/sample/cpp
。我想得到透视变换,然后warpPerspective
。所以我添加了第 (1) 和 (2) 行来做到这一点。其中图像和输出的声明如下:
Mat gray, prevGray, image, output;
....
calcOpticalFlowPyrLK(prevGray, gray, points[0], points[1], status, err, winSize,
3, termcrit, 0, 0.001);
(1) CvMat H = getPerspectiveTransform(points[0], points[1]);
(2) cvWarpPerspective(&image, &output, &H,CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, cvScalarAll(0));
...
现在,当我尝试使用imshow()
我看到扭曲图像的输出时,我收到了这个错误:
error: (-206) Unrecognized or unsupported array type in function cvGetMat
调试后的回溯如下:
(gdb) bt
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb77741ef in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2 0xb7777835 in __GI_abort () at abort.c:91
#3 0xb79e313d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#4 0xb79e0ed3 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5 0xb79e0f0f in std::terminate() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#6 0xb79e105e in __cxa_throw () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#7 0xb7eb9363 in cv::error(cv::Exception const&) () from /usr/local/lib/libopencv_core.so.2.4
#8 0xb7e40496 in cvGetMat () from /usr/local/lib/libopencv_core.so.2.4
#9 0xb7ceb915 in cvImageWidgetSetImage(_CvImageWidget*, void const*) () from /usr/local/lib/libopencv_highgui.so.2.4
#10 0xb7ced4e0 in cvShowImage () from /usr/local/lib/libopencv_highgui.so.2.4
#11 0xb7cea378 in cv::imshow(std::string const&, cv::_InputArray const&) () from /usr/local/lib/libopencv_highgui.so.2.4
#12 0x0804a1ca in main (argc=2, argv=0xbffff724) at lkdemo-1.cpp:141
(gdb)
请任何人帮我解决这个问题。