- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这个代码:
#include "opencv2/core.hpp"
#include "opencv2/core/eigen.hpp"
#include <Eigen/Dense>
void CloudCache::DoPcaEigen(int dim){
cv::Mat1f codes;
...
Eigen::MatrixXf X = Eigen::MatrixXf(codes.rows,codes.cols);
cv::cv2eigen(codes, X);
...
}
我编译它包括 -I/home/luca/eigen/
和 icpc
但是我得到这个错误:
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(63): error #303: explicit type is missing ("int" assumed)
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(63): error: expected a ")"
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(81): error #303: explicit type is missing ("int" assumed)
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(81): error: expected a ")"
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(81): error: function template "cv::eigen2cv" has already been defined
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(96): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(96): error: Matrix is not a template
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(96): error: expected a ","
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(124): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(124): error: Matrix is not a template
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(124): error: expected a ","
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(142): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(142): error: Matrix is not a template
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(142): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(142): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(142): error: expected a ","
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(170): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(170): error: Matrix is not a template
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(170): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(170): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(170): error: expected a ","
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(189): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(189): error: Matrix is not a template
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(189): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(189): error: expected a ","
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(188): error: function template "cv::cv2eigen<_Tp>(const cv::Mat &, <error-type>, <error-type> &)" has already been defined
void cv2eigen( const Mat& src,
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(214): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(214): error: Matrix is not a template
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(214): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(214): error: expected a ","
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(235): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(235): error: Matrix is not a template
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(235): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(235): error: expected a ","
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(234): error: function template "cv::cv2eigen<_Tp>(const cv::Mat &, <error-type>, <error-type> &)" has already been defined
void cv2eigen( const Mat& src,
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(259): error: identifier "Eigen" is undefined
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(259): error: Matrix is not a template
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(259): error: name followed by "::" must be a class or namespace name
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
In file included from ../Core/CCCore.cpp(14):
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(259): error: expected a ","
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
^
../Core/CCCore.cpp(244): error: no instance of overloaded function "cv::cv2eigen" matches the argument list
argument types are: (cv::Mat1f, Eigen::MatrixXf)
cv::cv2eigen(codes, X);
^
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(258): note: this candidate was rejected because mismatch in count of arguments
void cv2eigen( const Matx<_Tp, 1, _cols>& src,
^
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(213): note: this candidate was rejected because mismatch in count of arguments
void cv2eigen( const Matx<_Tp, _rows, 1>& src,
^
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(169): note: this candidate was rejected because mismatch in count of arguments
void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
^
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(141): note: this candidate was rejected because mismatch in count of arguments
void cv2eigen( const Mat& src,
^
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(123): note: this candidate was rejected because mismatch in count of arguments
void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
^
/home/luca/ParallelOpenCV/install_icpc/include/opencv2/core/eigen.hpp(95): note: this candidate was rejected because mismatch in count of arguments
void cv2eigen( const Mat& src,
为什么会这样?
最佳答案
好像#include "opencv2/core/eigen.hpp"
不包含Eigen本身,所以需要
#include <Eigen/Core>
在那之前。
关于c++ - 使用 cv2eigen 将 cv::Mat1f 转换为 Eigen::MatrixXf 时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43302131/
有时 ago用户 ggael 给出了答案将 eigen::vectorXf 映射到 eigen::matrixXf 的问题。 现在,我需要做一些类似的事情,但要针对现有矩阵,例如,我知道我可以: fo
我有一个用DLL编写的C++,我需要从Rust程序中调用一个名为print_matrix(Eigen::MatrixXf *m)的函数。 我创建了一个4x3的Mactrix,所讨论的函数将指针作为其输
我正在通过与此类似的代码将相对较大的 MatrixXf 序列化到文件 -- https://github.com/github188/vidy_old/blob/01c0aa4242299f7f105
我只是玩了一下 Eigen,注意到 MatrixXf::Random(3,3) 总是返回相同的矩阵,例如第一个总是这样: 0.680375 0.59688 -0.329554 -0.211234 0.
在 Eigen 中,i need将 MatrixXf 放置到现有数组中。现在,这有效: MatrixXf Um=FFMatBas(xi,CalcMetod); MapUv(Um.dat
我正在尝试创建一个 boost::lockfree::queue 下面的例子:http://www.boost.org/doc/libs/1_54_0/doc/html/lockfree/exampl
我正在尝试返回类型为 Eigen::MatrixXf 的值,但这会导致段错误。尝试调试时,我发现如果返回类型是 float 或 int 之类的,并且函数中有相应的返回值,则函数运行成功。我已经尝试从
为什么下面的代码编译不通过? library(Rcpp) cppFunction(' int rows(const NumericMatrix& X) { using Eige
我正在尝试维护一个引用 Eigen::MatrixXf 跨保守调整大小的第一列的变量。 ColXpr c 看起来在 MatrixXf m 调整大小时无法重新分配时无效。我可以看到这如何保护我免受错误,
我是 Eigen 库的新手。我想计算特征矩阵的 FFT。但是,我这样做的尝试表明不受支持的 Eigen FFT 模块不能与 MatrixXf 一起使用。我想完成类似的事情: #include #in
我正在使用 Eigen在 C++ 程序上。 我想知道是否有办法从 Eigen::MatrixXd 转换至Eigen::MatrixXf . static_cast 似乎不起作用,A.cast (这是
如果x是 float 的非特征向量,我可以将它映射到 eigen::MatrixXf通过: MatrixXf x_cen=Map(*x,*n,*p); 然后,对 x_cen 的修改将被报告给x也因为他
我有这个代码: #include "opencv2/core.hpp" #include "opencv2/core/eigen.hpp" #include void CloudCache::DoP
我是一名优秀的程序员,十分优秀!