Registered Member
|
Hi,
I'd like to use Eigen for solving the eigenvalue problem of a general matrix. I'll need this for a project using OpenCV (since the OpenCV solver only solves symmetric matrices), so I have to convert my data between both. Are there any best practices how to do so for dynamic sized matrices? I don't have much experience with Eigen (so sorry if I am totally off here), but the first thing, that came to my mind is simply mapping the data of OpenCV's cv::Mat to a MatrixXd, like this:
Which works fine for now, but I am afraid this is totally not best practice. Can anyone point me into the right direction or is it OK to do so? Best regards, Philipp. |
Registered Member
|
Sorry. My wrong. OpenCV already comes with a conversion defined in:
which makes it as easy as:
and is obviously a bit less error-prone than my attempt. If someone is coming here from Google... I've pushed a simple example on how to do a Linear Discriminant Analysis with OpenCV and Eigen into my github repository at https://github.com/bytefish/opencv/tree/master/lda. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]