-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathharris.py
More file actions
38 lines (31 loc) · 749 Bytes
/
harris.py
File metadata and controls
38 lines (31 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import cv2
import numpy as np
from pprint import pprint
filename = 'green.png'
img = cv2.imread(filename)
# pprint( img)
print type(img)
print type(img[0])
print type(img[0][0])
print type(img[0][0][0])
print len(img[0][0])
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)
cv2.imshow('img',dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
# with open('file','w') as f:
# i=0
# for x in dst:
# # if i==100:
# # break
# f.write(', '.join(map(str,x)))
# f.write('\n')
# # dst = cv2.dilate(dst,None)
# # img = [0,0,255]
# # #show image
# # cv2.imshow('img3', dst)
# # #exit at closing of window
# # cv2.waitKey(0)
# # cv2.destroyAllWindows()