# How do I threshold between two values a and b ?

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 ?

How do I threshold between two values a and b ?

Asked: **
2014-11-07 19:56:32 -0500
**

Seen: **416 times**

Last updated: **Nov 07 '14**

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.

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

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.

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