How to extract RANSAC's inlier object points from the matrix produced by solvePNPRansac() or findHomography()?
Hi everyone,
I understand that both solvePNPRansac() and findHomography() produce a matrix correlated to the inlier and outlier keypoints.
Once I get the Mask from the findHomography(), is there a trivial way to correlate the position of the rows in the Mask to the list of matches and the keypoints (like a simple for loop shown below)?
for (int nextPosition = 0; nextPosition < Mask.height(); ++nextPosition) {
if(Mask.get(nextPosition,0)[0] > 0.0){
inlierList_good_matches.add(List_good_matches.get(nextPosition));
inlierList_KeyPoints1.add(List_KeyPoints1.get(nextPosition));
inlierList_KeyPoints2.add(List_KeyPoints2.get(nextPosition));
}
}
Thanks in advance!
See: http://answers.opencv.org/question/38... When I tried it with
cv::findFundamentalMat
I had to convert the inliers from avector<uchar>
to avector<char>
in order to use it incv::drawMatches
Thanks for the suggestion. I have elaborated on my question.
It is not clear how to refine my keypoints list. Can I assume that the first keypoint1 and first keypoint2 are aligned with the first position in the mask?