Adaptive Thresholding

Adaptive thresholding calculates a local threshold for each pixel.

import cv2


def adaptive_threshold(img):
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
return cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY,11,2)
← Back to Gallery