The link below is used findHomographyto get the conversion between two sets of points. I want to limit the degrees of freedom used in the conversion, so I want to replace findHomographywith estimateRigidTransform.
http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography
Below I use estimateRigidTransformto get the conversion between the object and the points in the scene. objPointsand scePointspresented vector <Point2f>.
Mat H = estimateRigidTransform(objPoints, scePoints, false);
Following the method used in the tutorial above, I want to convert the values of angles using conversion H. The textbook is used perspectiveTransformwith a 3x3 matrix returned findHomography. With hard conversion, it returns a 2x3 matrix, so this method cannot be used.
How would I convert the values of the angles represented as vector <Point2f>with this 2x3 matrix. I just want to perform the same functions as the textbook, but with less degrees of freedom for transformation. I also looked at other methods, such as warpAffineand getPerspectiveTransform, but have not yet found a solution.
EDIT:
I tried David Nilosek's suggestion. Below I add an extra row to the matrix.
Mat row = (Mat_<double>(1,3) << 0, 0, 1);
H.push_back(row);
However, this gives this error when using the Transform perspective.
OpenCV Error: Assertion failed (mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0)) in create, file /Users/cgray/Downloads/opencv-2.4.6/modules/core/src/matrix.cpp, line 1486
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/cgray/Downloads/opencv-2.4.6/modules/core/src/matrix.cpp:1486: error: (-215) mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) in function create
ChronoTrigger warpAffine. warpAffine , 1 x 5 - objCorners sceCorners.
warpAffine(objCorners, sceCorners, H, Size(1,4));
, . objCorners sceCorners vector <Point2f>, 4 . , warpAffine Mat , .
OpenCV Error: Assertion failed ((M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 2 && M0.cols == 3) in warpAffine, file /Users/cgray/Downloads/opencv-2.4.6/modules/imgproc/src/imgwarp.cpp, line 3280