0

I'm trying to apply a component-wise logical and (&&) to the elements of two different arrays. The first one maps an already allocated buffer while the second one is created from scratch:

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

As suggested in http://eigen.tuxfamily.org/dox/classEigen_1_1ArrayBase.html#afce9cebae4c9cbb9883e73d515b5570f , I apply the logical and on two boolean arrays obtained applying the greater and lower operators on the previous two arrays:

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

The compilation gives me the following error:

/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’
mUogoro
  • 63
  • 1
  • 5
  • 2
    you might be using a old Eigen version make sure your are using Eigen 3.2 – ggael Jan 22 '14 at 22:58
  • That solved the problem, I was using the old version (3.0.7) packaged in my distribution (Fedora 18). Thanks for the hint!!! – mUogoro Jan 23 '14 at 09:37

0 Answers0