Reputation: 1507
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?
Upvotes: 5
Views: 7696
Reputation: 20058
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!
Upvotes: 5