我写了一个代码来从“左”和“右”两个图像中找到视差图;并将地图保存为“立体”。代码对我来说似乎没问题,但不知何故我遇到了异常:
在终端窗口上:
OpenCV 错误:未知函数中的错误参数(未知数组类型),文件......\src\opencv\modules\core\src\matrix.cpp,第 698 行
代码是
Mat left = imread( "files\\left.jpg" );
Mat right = imread( "files\\right.jpg" );
Size size = left.size();
namedWindow( "left", CV_WINDOW_AUTOSIZE );
imshow("left", left);
cvNamedWindow( "right", CV_WINDOW_AUTOSIZE );
imshow("right", right);
Mat left_C1;
cvtColor(left, left_C1, CV_RGB2GRAY);
Mat right_C1;
cvtColor(right, right_C1, CV_RGB2GRAY);
Mat stereo = Mat(size, CV_16SC1);
CvStereoBMState* state = cvCreateStereoBMState();
state->preFilterSize=5;
state->preFilterCap=1;
state->SADWindowSize=5;
state->minDisparity=0;
state->numberOfDisparities=64;
state->textureThreshold=0;
state->uniquenessRatio=0;
cvFindStereoCorrespondenceBM(&left_C1, &right_C1, &stereo, state);
namedWindow( "stereo", CV_WINDOW_AUTOSIZE );
imshow("stereo",stereo);
waitKey(0);
我正在使用 VS Ultimate 2012、Windows 8、OpenCV 2.4.4。请指导我如何解决此异常。