Basic Thresholding

Thresholding converts grayscale images into binary images based on a fixed cutoff.

import cv2


def basic_threshold(img):
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_, t = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
return t
← Back to Gallery