How do I threshold between two values a and b ?

asked 2014-11-07 19:56:32 -0500

huehuehue gravatar image

updated 2014-11-07 19:56:50 -0500

Sure I can create two thresholded Mat, one for each bound a and b, and multiply them component-wise, but how do I do that ?

edit retag flag offensive close merge delete



Can you express your idea in a mathematical equation? (Just ignore for a moment about how to get it working in OpenCV.)

rwong gravatar imagerwong ( 2014-11-07 20:50:26 -0500 )edit

Given the Matrix M, I threshold it (binary) with threshold value a, the ouput is A. Then I threshold M again (binry inverted) with value b, the output is B. Then if I multiply A and B component wise (Hadamard product) I should get what I want.

But I found the "inrange" function which does that automatically.

huehuehue gravatar imagehuehuehue ( 2014-11-08 00:17:21 -0500 )edit

^^ so, can we call it 'solved' ?

berak gravatar imageberak ( 2014-11-08 00:30:20 -0500 )edit