Cv2.inRange
Thresholding Operations
Synopsis
Checks if array elements lie between the elements of two other arrays.
The function checks the range as follows:
- For every element of a single-channel input array:
- \(\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0\)
- For two-channel arrays:
- \(\texttt{dst} (I)= \texttt{lowerb} (I)_0 \leq \texttt{src} (I)_0 \leq \texttt{upperb} (I)_0 \land \texttt{lowerb} (I)_1 \leq \texttt{src} (I)_1 \leq \texttt{upperb} (I)_1\)
and so forth.
That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the specified 1D, 2D, 3D, ... box and 0 otherwise.
When the lower and/or upper boundary parameters are scalars, the indexes (I) at lowerb and upperb in the above formulas should be omitted.
Parameters
-
src
- first input array. -
lowerb
- inclusive lower boundary array or a scalar. -
upperb
- inclusive upper boundary array or a scalar. -
dst
- output array of the same size as src and CV_8U type.