Ask Your Question
2

what's the meaning of '>' with Mat

asked 2013-12-06 03:19:07 -0600

wscem gravatar image

updated 2017-09-03 06:31:54 -0600

{//code=c++

    Mat m = imread("flow.jpg");
    m = m > 50;
}

what's the mean of '>'?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
6

answered 2013-12-06 03:50:55 -0600

berak gravatar image

updated 2013-12-06 03:53:29 -0600

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;
edit flag offensive delete link more

Comments

4

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.

stereomatching gravatar imagestereomatching ( 2013-12-06 21:52:37 -0600 )edit

@berak as i know '>' use compare() but i did not check it.

sturkmen gravatar imagesturkmen ( 2017-09-03 08:57:03 -0600 )edit

Question Tools

Stats

Asked: 2013-12-06 03:19:07 -0600

Seen: 620 times

Last updated: Sep 03 '17