I have a class called “myClass”, which returns “cv::Scalar” type, and I want to do this:
cv::Scalar myValue;
for ( myValue > myClass (i,j) )
....
But the comparison part in the “for” line gives out error, saying “no operator > matches these operands”. Could someone help me? Thank you.
If there’s no operator to compare two
cv::Scalarelements you can define it:Doing this you can define the way two
cv::Scalarare compared without bothering thecv::Scalarclass itself.I’ve put it into the
main.cppjust as an example, but you can define the operator wherever you want as long it is visible where the comparison is performed.