我有一个连续的OpenCV (不对称)矩阵cv::Mat m,我想通过Eigen::EigenSolver计算它的特征向量和特征值。
由于m可能很大,因此通过cv2eigen函数制作副本的效率很低。然后,我想使用Eigen::Map。这是我的代码:
Eigen::Map<Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>> mMapped (m.ptr<float>(), m.rows, m.cols);
Eigen::EigenSolver<Eigen::Map<Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>> solver(mMapped,true);//this gives a bunch of errors最后一行给出了一系列错误(参见问题的末尾)。我该如何解决这个问题呢?请注意,我应该避免将mMapped复制到矩阵对象,否则它等同于使用cv2eigen (我认为)。
/usr/local/include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h: In instantiation of ‘class Eigen::EigenSolver<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >’:
../Math.hpp:64:104: required from ‘static void Math::createHashTable(const cv::Mat&, cv::Mat&, cv::Mat&, int, int) [with T = float]’
../CloudCache.cpp:155:58: required from here
/usr/local/include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h:71:10: error: ‘Options’ is not a member of ‘Eigen::EigenSolver<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >::MatrixType {aka Eigen::Map<Eigen::Matrix<float, -1, -1, 1> >}’
enum {
^
In file included from /usr/local/include/eigen3/Eigen/Eigenvalues:29:0,
from ../Math.hpp:16,
from ../CloudCache.cpp:15:
/usr/local/include/eigen3/Eigen/src/Eigenvalues/RealSchur.h: In instantiation of ‘class Eigen::RealSchur<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >’:
/usr/local/include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h:312:27: required from ‘class Eigen::EigenSolver<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >’
../Math.hpp:64:104: required from ‘static void Math::createHashTable(const cv::Mat&, cv::Mat&, cv::Mat&, int, int) [with T = float]’
../CloudCache.cpp:155:58: required from here
/usr/local/include/eigen3/Eigen/src/Eigenvalues/RealSchur.h:58:10: error: ‘Options’ is not a member of ‘Eigen::RealSchur<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >::MatrixType {aka Eigen::Map<Eigen::Matrix<float, -1, -1, 1> >}’
enum {
^
In file included from /usr/local/include/eigen3/Eigen/src/Eigenvalues/RealSchur.h:14:0,
from /usr/local/include/eigen3/Eigen/Eigenvalues:29,
from ../Math.hpp:16,
from ../CloudCache.cpp:15:
/usr/local/include/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h: In instantiation of ‘class Eigen::HessenbergDecomposition<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >’:
/usr/local/include/eigen3/Eigen/src/Eigenvalues/RealSchur.h:228:41: required from ‘class Eigen::RealSchur<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >’
/usr/local/include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h:312:27: required from ‘class Eigen::EigenSolver<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >’
../Math.hpp:64:104: required from ‘static void Math::createHashTable(const cv::Mat&, cv::Mat&, cv::Mat&, int, int) [with T = float]’
../CloudCache.cpp:155:58: required from here
/usr/local/include/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h:64:10: error: ‘Options’ is not a member of ‘Eigen::HessenbergDecomposition<Eigen::Map<Eigen::Matrix<float, -1, -1, 1> > >::MatrixType {aka Eigen::Map<Eigen::Matrix<float, -1, -1, 1> >}’
enum {
^
subdir.mk:30: recipe for target 'CloudCache.o' failed
make: *** [CloudCache.o] Error 1https://stackoverflow.com/questions/38319706
复制相似问题