Skip to content

Commit 92ceeba

Browse files
simple threading
1 parent cdd9962 commit 92ceeba

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# simple threading
2+
import numpy as np
3+
import cv2
4+
bw=cv2.imread('0.jpeg',0)
5+
cv2.imshow('Original',bw)
6+
7+
'method1'
8+
height,width=bw.shape[0:2]
9+
binary=np.zeros([height,width,3],'uint8')
10+
thresh=85
11+
for row in range(0,height):
12+
for col in range(0,width):
13+
if bw[row][col]>thresh:
14+
binary[row][col]=255
15+
cv2.imshow('binary',binary)
16+
17+
'method2'
18+
ret,thresh=cv2.threshold(bw,thresh,255,cv2.THRESH_BINARY)
19+
cv2.imshow('thresh',thresh)
20+
21+
cv2.waitKey(0)
22+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)