Thresholding
Thresholding is one of the simplest yet most useful segmentation operations. We can safely say that you will end up using some sort of thresholding in almost any image-processing application. We consider it a segmentation operation since it partitions an image into two regions, typically, an object and its background. In OpenCV, thresholding is performed with the function double threshold(InputArray src, OutputArray dst, double thresh, double maxval, int type)
.
The first two parameters are the input and output images, respectively. The third input parameter is the threshold chosen. The meaning of maxval
is controlled by the type of thresholding we want to perform. The following table shows the operation performed for each type:
Type |
dst(x,y) |
---|---|
|
|
|
|
|
|