Eigen3数组的逻辑运算

时间:2014-01-22 12:37:56

标签: arrays logical-operators eigen3

我正在尝试将组件逻辑和(&&)应用于两个不同数组的元素。第一个映射已经分配的缓冲区,而第二个缓冲区是从头创建的:

Map<Array<unsigned short, DEPTHMAP_HEIGHT, DEPTHMAP_WIDTH, RowMajor> > hypothesisMat(hypothesis);
Array<short int, DEPTHMAP_HEIGHT, DEPTHMAP_WIDTH, RowMajor> depthmapDiff;

正如http://eigen.tuxfamily.org/dox/classEigen_1_1ArrayBase.html#afce9cebae4c9cbb9883e73d515b5570f中所建议的那样,我应用逻辑和两个布尔数组,在前两个数组中应用了更大和更低的运算符:

Array<bool, DEPTHMAP_HEIGHT, DEPTHMAP_WIDTH, RowMajor> rm1;
rm1 = (hypothesisMat>0) && (depthmapDiff<m_dm);

编译给出了以下错误:

/home/foo/workdir/pso_hand_tracker/palm_problem.cpp:82:50: error: no match for ‘operator&&’ in ‘((Eigen::ArrayBase<Eigen::Array<short int, 480, 640, 1> >*)(& depthmapDiff))->Eigen::ArrayBase<Derived>::operator><Eigen::Array<short int, 480, 640, 1> >((* &(Eigen::ArrayBase<Eigen::Array<short int, 480, 640, 1, 480, 640> >::Scalar)((PalmProblem*)this)->PalmProblem::m_dm)) && ((Eigen::ArrayBase<Eigen::Array<short int, 480, 640, 1> >*)(& depthmapDiff))->Eigen::ArrayBase<Derived>::operator< <Eigen::Array<short int, 480, 640, 1> >((* &(Eigen::ArrayBase<Eigen::Array<short int, 480, 640, 1, 480, 640> >::Scalar)((PalmProblem*)this)->PalmProblem::m_dm))’
/home/foo/workdir/pso_hand_tracker/palm_problem.cpp:82:50: note: candidate is:
/home/foo/workdir/pso_hand_tracker/palm_problem.cpp:82:50: note: operator&&(bool, bool) <built-in>
/home/foo/workdir/pso_hand_tracker/palm_problem.cpp:82:50: note:   no known conversion for argument 2 from ‘const Eigen::CwiseUnaryOp<std::binder2nd<std::less<short int> >, const Eigen::Array<short int, 480, 640, 1> >’ to ‘bool’

0 个答案:

没有答案