import cv2 as cv

img = cv.imread('opencv-course-master\Resources\Photos\cats.jpg')
cv.imshow('Cats', img)

# Grayscale
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow('Gray', gray)

# Simple Thresholding Limiarização simples
threshold, thresh = cv.threshold(gray, 150, 255, cv.THRESH_BINARY)
cv.imshow('Simple THRESHOLD', thresh)

threshold, thresh_inv = cv.threshold(gray, 150, 255, cv.THRESH_BINARY_INV)
cv.imshow('Simple THRESHOLD Inverse', thresh_inv)

# Adaptive Thresholding Limiar adaptativo         cv.ADAPTIVE_THRESH_GAUSSIAN_C
adaptive_thresh = cv.adaptiveThreshold(gray, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 11, 3)
cv.imshow('Adaptive Thresholding', adaptive_thresh)

cv.waitKey(0)