findFundamentalMat and drawMatches with mask
I want to draw the inlier matches of my Fundamental Matrix to interpretate the results.
I am using opencv 3.2 and C++.
The parameter mask in findFundamentalMat is used if one uses a method like RANSAC to dermine the inliers and is of typevector<uchar>
.
In the documentation it says that in drawMatches the parameter "matchesMask - Mask determining which matches are drawn. If the mask is empty, all matches are drawn."
But here only a vector<char>
is accepted.
Do I have to convert my vector from uchar to char and how do I do that?
Here is my code:
vector<uchar> inliers(matched_points_1.size());
Mat F = findFundamentalMat(matched_points_1, matched_points_2, CV_FM_RANSAC, 3, 0.99, inliers);
Mat matched_points;
drawMatches(img_1, keypoints_1, img_2, keypoints_2, sym_matches, matched_points, Scalar::all(-1), Scalar::all(-1), inliers, 0);
imshow("Matched points", matched_points);
If I try it like that it says: "Wrong argumenttypes."
If I change my inliers vector to vector<char>
I get the error
OpenCV Error: Assertion failed (mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0)) in cv::_OutputArray::create, file C:\opencv\opencv-master\modules\core\src\matrix.cpp, line 2461