I am developing an application in OpenCV, and on Windows the following code is valid, and compiles / works:
/* Calculate the transformation points */
std::vector<cv::Point2f> img1;
std::vector<cv::Point2f> img2;
for( int i = 0; i < good_matches.size(); i++ ) {
img1.push_back( keypoints_imageOne[ good_matches[i].queryIdx ].pt );
img2.push_back( keypoints_imageTwo[ good_matches[i].trainIdx ].pt );
}
/* Generate the homogonous matrix from the transformation points */
cv::Mat H = cv::findHomography(img1, img2, CV_RANSAC);
However, when I switch to either my Mac or Linux box, I get an error saying that there is no function prototype for the arguments (as the function prototype requires cv::Mat
in place of the std::vector< cv::Point2f >
)
So my question is, how can / should I cast from std::vector < cv::Point2f >
to cv::Mat
or how should I go about doing this otherwise?
It seems that you have an older version of OpenCV on Linux. The possibility to use vectors as input to openCV functions is added to ver 2.3, I think.
So, happy update!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With