Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- img = cv2.imread('eye-01.jpg',0)
- img = cv2.medianBlur(img,5)
- cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
- circles = cv2.HoughCircles(img,cv2.HOUGH_GRADIENT,1,20,
- param1=50,param2=85,minRadius=100,maxRadius=200)
- circles = np.uint16(np.around(circles))
- for i in circles[0,:]:
- # draw the outer circle
- cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2)
- # draw the center of the circle
- cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3)
- plt.imshow(cimg)
- plt.title('detected circles')
- plt.show()
- print(circles.shape)
- print(len(circles[0]))
- print(len(img[0]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement