Hello,
I am working with OpenCV and love the cv::Mat. Shared pointers for the win!
With a std::vector<cv::point>() we can simply convert to a cv::Mat.
std::vector<cv::Point> points = std::vector<cv::Point>();
cv::Mat pointsMat = cv::Mat(points);
cv::Point point = pointsMat.at<cv::Point>(0,0);
We can then access the points. Sweet.
There histograms, descriptors all use the cv::Mat, making it ideal for interfaces.
What about these types?
2Df/2Dd/3Df/3Dd Points
std::vector<cv::Point3d> points = std::vector<cv::Point3d>();
This is the same as above for cv::Point.
Keypoints http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html?highlight=keypoint#KeyPoint std::vector<cv::keypoint>(); Has other attributes as well as a Point2f, such as octave, size etc which are of mixed types.
Contours std::vector<std::vector<cv::point>>(); Possibly, std::vector<cv::mat> if treated like a single vector of cv::Point. However we still have a std::vector.
Descriptor Matches http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_descriptor_matchers.html?highlight=dmatch#DMatch std::vector<cv::dmatch>() This contains int, bool, float types.
With contours, it could be done using a std::vector<cv::mat> where a std::vector<cv::mat>(1) is used for single images and matrices. The std::vector is NOT thread safe, so i don't want to be passing too many of them around.
1) Can we convert these types to a cv::Mat? Even if a deconversion step back to their original type is required.
2) What is the overhead for converting std::vector to cv::Mat?
3) Are there any known interfaces for OpenCV primitives?
4) How would the conversion back to a cv::Mat work in each case? Thank you.