Thresholding types

The types of thresholding operation are described according to its formulation. Take into account that src is the source (original) image, and dst corresponds to the destination (result) image after thresholding. In this sense, src(x, y) will correspond to the intensity of the pixel (x, y) of the source image, and dst(x, y) will correspond to the intensity of the pixel (x, y) of the destination image.

Here is the formula for cv2.THRESH_BINARY:

So, if the intensity of the pixel src(x, y) is higher than thresh, then the new pixel intensity is set to a maxval parameter. Otherwise, the pixels are set to 0.

Here is the formula ...

Get Mastering OpenCV 4 with Python 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.