import cv2 
import numpy as np

img =cv2.imread('Sudoku3.jpg',0)

 
_,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)

#Adaptive means  this is performing adaptive thresholding the value 
# 

th2  = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY,11,2);
th3  =cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2);



cv2.imshow("Sudoku",img) #original img
cv2.waitKey(0)

cv2.imshow("th1",th1) #thereshold 1 Globally high threshold adapt 127 thresholding 
cv2.waitKey(0)

cv2.imshow("th2",th2) # threshold 2 
cv2.waitKey(0)

cv2.imshow("th3",th3)
cv2.waitKey(0)


cv2.destroyAllWindows()
