what's the meaning of '>' with Mat
{//code=c++
Mat m = imread("flow.jpg");
m = m > 50;
}
what's the mean of '>'?
it's a shortcut for 'threshold'
// result: binary Mat , where any pixel in the original > 50 is set to 255 (on),
// all others to 0 (off)
m = m > 50;
// same as:
threshold(m,m,50,255,0);
cv::Mat has a lot of 'overloaded' operators, so you can write equations like:
Mat v = a * x + b;
The overloaded operators are good for prototyping, but do remember the temporary objects generated by those operator. Although expression template can eliminate those temporary objects but opencv do not implement them by expression template.
Asked: 2013-12-06 03:19:07 -0600
Seen: 577 times
Last updated: Sep 03 '17