43std::vector<cv::Point2f>
Points(std::vector<cv::KeyPoint> keypoints)
45 std::vector<cv::Point2f> res;
46 for(
unsigned i = 0; i < keypoints.size(); i++) {
47 res.push_back(keypoints[i].pt);
55 cv::Mat inlier_mask, homography;
56 std::vector<cv::DMatch> inlier_matches;
57 if(pts1.size() >= 4) {
58 homography = findHomography(pts1, pts2,
63 if(pts1.size() < 4 || homography.empty()) {
67 const double det = homography.at<
double>(0, 0) * homography.at<
double>(1, 1) - homography.at<
double>(1, 0) * homography.at<
double>(0, 1);
71 const double N1 = sqrt(homography.at<
double>(0, 0) * homography.at<
double>(0, 0) + homography.at<
double>(1, 0) * homography.at<
double>(1, 0));
72 if (N1 > 4 || N1 < 0.1)
75 const double N2 = sqrt(homography.at<
double>(0, 1) * homography.at<
double>(0, 1) + homography.at<
double>(1, 1) * homography.at<
double>(1, 1));
76 if (N2 > 4 || N2 < 0.1)
79 const double N3 = sqrt(homography.at<
double>(2, 0) * homography.at<
double>(2, 0) + homography.at<
double>(2, 1) * homography.at<
double>(2, 1));
83 std::vector<uchar> status;
85 for(
int i = 0; i < pts1.size(); i++) {
86 if((
int)inlier_mask.at<uchar>(i,0)==1) {
87 status.push_back((uchar)1);
88 inlier_matches.push_back(cv::DMatch(i, i, 0));
92 status.push_back((uchar)0);
const double ransac_thresh
Definition: OCVConfig.cpp:51
HomographyInfo GetHomographyInliers(std::vector< cv::Point2f > pts1, std::vector< cv::Point2f > pts2)
Definition: OCVUtils.h:53
std::vector< cv::Point2f > Points(std::vector< cv::KeyPoint > keypoints)
Definition: OCVUtils.h:43
Definition: HomographyInfo.h:44