I have several feature vectors stored in a cv::Mat where, each row is a feature vector (several rows like this one here: [ x1 y1 x2 y2 x3 y3.... ]). I have to apply SVD on each feature vector and for that I use Eigen library. But, before applying SVD the feature matrix has to be converted to Eigen::Matrix form.
Later, I have to convert the SVD result back to cv::Mat.
Could anyone please suggest a nice way to do this? The reason I need it in cv::Mat form is because I have to input it to a Neural Network in OpenCV and only cv::Mat inputs matrices are allowed.
Thanks!!!
解决方案#include
cv::Mat_ a = Mat_::ones(2,2);
Eigen::Matrix b;
cv2eigen(a,b);
Also, OpenCV CV::Mat and Eigen::Matrix has a solution using an Eigen::Map.