Adaptive Thresholding:
We used one global value as a threshold. But this might not be good in all cases, e.g. if an image has different lighting conditions in different areas. In that case, adaptive thresholding can help. Here, the algorithm determines the threshold for a pixel based on a small region around it. So we get different thresholds for different regions of the same image which gives better results for images with varying illumination.
In addition to the parameters described above, the method cv2.adaptiveThreshold takes three input parameters:
The adaptiveMethod decides how the threshold value is calculated:
- cv2:ADAPTIV E THRESH MEAN C :The threshold value is the mean of the neighborhood area minus the constant C.
- cv2:ADAPTIV E THRESH GAUSSIAN C: The threshold value is a gaussian-weighted sum of the neighbourhood values minus the constant C.
The blockSize determines the size of the neighborhood area and C is a constant that is subtracted from the mean or weighted sum of the neighbourhood pixels.
0 Comments