35 #include <opencv2/imgproc/imgproc.hpp>
36 #include <opencv2/highgui/highgui.hpp>
37 #include <opencv2/calib3d/calib3d.hpp>
44 const cv::Mat points2,
45 cv::Mat& fundamental_matrix,
51 std::vector<uint32_t> indices;
62 const cv::Mat points2,
63 cv::Mat& fundamental_matrix,
66 std::vector<uint32_t>& indices,
70 std::vector<uchar> status;
71 fundamental_matrix = cv::findFundamentalMat(
80 for (
unsigned int i = 0; i < status.size(); i++)
88 indices.resize(inliers);
92 inliers1 = cv::Mat(cv::Size(1, inliers), CV_32FC2);
93 inliers2 = cv::Mat(cv::Size(1, inliers), CV_32FC2);
96 for (
unsigned int i = 0; i < status.size(); i++)
100 inliers1.at<cv::Vec2f>(0, index) = points1.at<cv::Vec2f>(0, i);
101 inliers2.at<cv::Vec2f>(0, index) = points2.at<cv::Vec2f>(0, i);
110 const std::vector<cv::KeyPoint>& kp2,
111 const std::vector<cv::DMatch>& matches,
117 kp1_out.create(cv::Size(1, matches.size()), CV_32FC2);
118 kp2_out.create(cv::Size(1, matches.size()), CV_32FC2);
120 for (
unsigned int i = 0; i < matches.size(); i++)
122 kp1_out.at<cv::Vec2f>(0, i) = kp1[matches[i].queryIdx].pt;
123 kp2_out.at<cv::Vec2f>(0, i) = kp2[matches[i].trainIdx].pt;