Created
February 24, 2017 16:58
-
-
Save donaldmunro/beb7f226adf9c585c67f2599384e43ab to your computer and use it in GitHub Desktop.
Map OpenCv Mat to Eigen Matrix and calculate Eigenvectors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <eigen3/Eigen/Dense> | |
#include <eigen3/Eigen/Eigenvalues> | |
.. | |
.. | |
using RowMatrixXf = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>; | |
Eigen::Map<RowMatrixXf> mapped(extended_homograpy.ptr<float>(), homography.rows, homography.cols); | |
Eigen::EigenSolver<Eigen::MatrixXf> eigen_solve(mapped, true); | |
auto ev = eigen_solve.eigenvectors(); | |
std::cout << "No of EigenVectors = " << ev.cols() << std::endl; | |
for (auto i=0; i<ev.cols(); i++) | |
{ | |
std::cout << ev.col(i) << std::endl; | |
std::cout << "--------" << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment