Problem with MatExpr max( abs(A), abs(B) ) (Bug #2545)


Added by Sebastian Krämer over 12 years ago. Updated about 12 years ago.


Status:Cancelled Start date:2012-11-15
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Affected version:2.4.3 Operating System:
Difficulty: HW Platform:
Pull request:

Description

I'm having trouble (compile error) when trying the MatExpr above. From what I read in the documentation, the combination

Mat e, b;
Mat m = max( abs(e), abs(b) );

should be legal. However, I'm getting:
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(604): error C2678: binary '!' : no operator found which takes a left-hand operand of type 'cv::MatExpr' (or there is no acceptable conversion)
1>          P:\CPC_SOFT\WorkDir\All\Libs_Include\x64\OpenCV\OpenCV-2.4.3\include\opencv2/core/operations.hpp(2224): could be 'bool cv::operator !(const cv::Range &)' [found using argument-dependent lookup]
1>          while trying to match the argument list '(cv::MatExpr)'
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(2092) : see reference to function template instantiation 'bool std::_Debug_lt<_Ty,_Ty>(const _Ty1 &,const _Ty2 &,std::_Dbfile_t,std::_Dbline_t)' being compiled
1>          with
1>          [
1>              _Ty=cv::MatExpr,
1>              _Ty1=cv::MatExpr,
1>              _Ty2=cv::MatExpr
1>          ]
1>          filterstrategyMR8.cpp(102) : see reference to function template instantiation 'const _Ty &std::max<cv::MatExpr>(const _Ty &,const _Ty &)' being compiled
1>          with
1>          [
1>              _Ty=cv::MatExpr
1>          ]
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility(606): error C2451: conditional expression of type 'cv::MatExpr' is illegal
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

First using abs in temporary matrices and then max'ing works.
I'm using 2.4.3 release on a 64 Bit Windows7 machine.


History

Updated by Vadim Pisarevsky about 12 years ago

you should explicitly write cv::max(cv::abs(a), cv::abs(b))

  • Affected version set to 2.4.3
  • Status changed from Open to Cancelled

Updated by Sebastian Krämer about 12 years ago

Sorry, my example wasn't clear in that regard. I actually used that syntax (explicitly choosing cv:: namespace).

Also available in: Atom PDF