[eigen] Eigen::Matrix and cv::Mat conversions |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Well, I already have a dependency on OpenCV, so I thought I'd use their convexHull() method. However, to do this I must either reinterpret or copy the contents of the Eigen::Matrix into a cv::Mat_<cv::Vec2f>(7,1). The internal format of this type is straightforward----I can just write floats in rowmajor order using std::transform() and it will be fine.
The tricky part is figuring how what is the best way to get at that data in the Eigen::Matrix. Curiously, upon examining the internals from data() in the debugger, the data appears to be in column-major order even though I didn't specify that (is it the default for some reason?). I know I can use the rowwise() method, but it isn't obvious to me if it's possible to get any kind of iterator from that, or if there's some other way to do the copy cleanly.
Of course I could simply loop over the thing, but I strive for more elegant solutions when possible.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |