Skip to content

Commit e1236d1

Browse files
adaptive threading
1 parent 92ceeba commit e1236d1

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Linkedin/Opencv/threshold/0.jpeg

173 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# adaptive threading ---> https://www.geeksforgeeks.org/python-thresholding-techniques-using-opencv-set-2-adaptive-thresholding
2+
import cv2
3+
img=cv2.imread('sudoku.png',0)
4+
cv2.imshow('Original',img)
5+
6+
# simaple threading ---> problem ---> uneven binding
7+
ret,frame=cv2.threshold(img,85,255,cv2.THRESH_BINARY)
8+
cv2.imshow('Binary',frame)
9+
10+
# adaptive threading ---> remove uneven binding
11+
adap_thresh=cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,115,1)
12+
cv2.imshow('adaptive thresh',adap_thresh)
13+
14+
cv2.waitKey(0)
15+
cv2.destroyAllWindows()

Linkedin/Opencv/threshold/sudoku.png

245 KB
Loading

0 commit comments

Comments
 (0)