what's the meaning of '>' with Mat
{//code=c++
Mat m = imread("flow.jpg");
m = m > 50;
}
what's the mean of '>'?
{//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: 620 times
Last updated: Sep 03 '17
Saving an image with unset pixels
How to calculate distance between camera and image?
Question about polar or radial angle calculation in the image coordinate system
Access multiple channels in Mat
How can I work with pixels of an image directly?
fingerprint orientation map through gradient method - opencv c++