So following the opencv-users
link above, I understood you have to do
points1r = points1.reshape((points1.shape[0] * 2, 1))
before entering it in cv2.StereoRectifyUncalibrated
And it should work.
문제
I've used FindFundamentalMat
with a CvMat
I've created from the points generated by FindChessboardCorners
. The documentation specifies that StereoRectifyUncalibrated
can use the same format of corresponding points as FindFundamentalMat
.
However, when I try to use StereoRectifyUncalibrated
, I get the following error:
OpenCV Error: Assertion failed (CV_IS_MAT(_points1) && CV_IS_MAT(_points2) && (_points1->rows == 1 || _points1->cols == 1) && (_points2->rows == 1 || _points2->cols == 1) && CV_ARE_SIZES_EQ(_points1, _points2)) in cvStereoRectifyUncalibrated, file /home/moos/prog/opencv/OpenCV-2.1.0/src/cv/cvcalibration.cpp, line 2539
It seems that the array of points for StereoRectifyUncalibrated
should be 1 dimensional, but how can I then specify x and y coordinates for the corresponding points?
Previously I did:
cv.FindFundamentalMat(points1,points2,F,method=cv.CV_FM_RANSAC,param1=1.,param2=cv.CV_FM_8POINT)
cv.Save("F.xml",F);
cv.StereoRectifyUncalibrated(points1,points2,F,(320,240),H1,H2,threshold=5)
The error occurred at StereoRectifyUncalibrated
(not at FindFundamentalMat
).
Then I tried :
cv.StereoRectifyUncalibrated(points1[1],points2[1],F,(320,240),H1,H2,threshold=5)
No error ocurred! But I am not sure if I am doing it right or not.
해결책
So following the opencv-users
link above, I understood you have to do
points1r = points1.reshape((points1.shape[0] * 2, 1))
before entering it in cv2.StereoRectifyUncalibrated
And it should work.