Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 views
in Technique[技术] by (71.8m points)

c++ - What do the values of the mask parameter returned by findHomography represent?

I am using the function findHomography of OpenCV with the RANSAC method in order to find the homography that relates two images linked with a set of keypoints.

The main issue is that I haven't been able to find anywhere yet what are the values of the mask matrix that the function outputs.

The only information that I know is that 0 values are outliers, and non zero values are inliers. But what does it mean the inliers value? Does anyone know?

Piece of code where I call findHomography:

cv::Mat H12;
cv::Mat mask;

H12 = cv::findHomography(FvPointsIm1, FvPointsIm2, mask, CV_RANSAC, 5); 
ui->Debug_Label->setText(Mat2QString(mask));
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The mask returned by findHomography is an 8-bit, single-channel cv::Mat (or std::vector<uchar>, if you prefer) containing either 0 or 1 indicating the outlier status.

EDIT: You access each element of the mask by calling .at<double>, which is leading to the confusing output. You should be using .at<uchar>, which will interpret the matrix value correctly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...