Threshold
Frequently we have done many layers of processing steps and want either to make a final
decision about the pixels in an image or to categorically reject those pixels below or above
some value while keeping the others. The OpenCV function cvThreshold()
accomplishes these tasks (see survey [Sezgin04]). The basic idea
is that an array is given, along with a threshold, and then something happens to every
element of the array depending on whether it is below or above the threshold.
double cvThreshold( CvArr* src, CvArr* dst, double threshold, double max_value, int threshold_type );
As shown in Table 5-5, each threshold type
corresponds to a particular comparison operation between the ith source
pixel (srci) and the threshold
(denoted in the table by T). Depending on the
relationship between the source pixel and the threshold, the destination pixel dsti may be set to 0, the srci, or the max_value
(denoted in the table by M).
Table 5-5. cvThreshold() threshold_type options
Threshold type |
Operation |
---|---|
|
|
|
|
|
|
|
|
|
|
Figure 5-23 should help to clarify the exact implications of each ...
Get Learning OpenCV now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.