#para saydırma
import cv2
import numpy as np
image = cv2.imread('images/1404418.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)
cv2.waitKey(0)
ret,thresh = cv2.threshold(gray,160,255,cv2.THRESH_BINARY)
cv2.imshow('thresh', thresh)
cv2.waitKey(0)
blur = cv2.medianBlur(thresh, 21)
cv2.imshow('blur', blur)
cv2.waitKey(0)
circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, 90,minRadius=50,maxRadius=105)
#circles = cv2.HoughCircles(gray, cv.CV_HOUGH_GRADIENT, 2, 50,minRadius=30,maxRadius=70)
#circles = np.uint8(np.around(circles))
for i in circles[0,:]:
# draw the outer circle
cv2.circle(image,(int(i[0]), int(i[1])), int(i[2]), (0, 0, 255), 2)
# draw the center of the circle
cv2.circle(image, (int(i[0]), int(i[1])), 2, (0, 255, 0), -1)
cv2.imshow('detected circles', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
#para saydırma
import cv2
import numpy as np
image = cv2.imread('images/1404418.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)
cv2.waitKey(0)
ret,thresh = cv2.threshold(gray,160,255,cv2.THRESH_BINARY)
cv2.imshow('thresh', thresh)
cv2.waitKey(0)
blur = cv2.medianBlur(thresh, 21)
cv2.imshow('blur', blur)
cv2.waitKey(0)
circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, 90,minRadius=50,maxRadius=105)
#circles = cv2.HoughCircles(gray, cv.CV_HOUGH_GRADIENT, 2, 50,minRadius=30,maxRadius=70)
#circles = np.uint8(np.around(circles))
for i in circles[0,:]:
# draw the outer circle
cv2.circle(image,(int(i[0]), int(i[1])), int(i[2]), (0, 0, 255), 2)
# draw the center of the circle
cv2.circle(image, (int(i[0]), int(i[1])), 2, (0, 255, 0), -1)
cv2.imshow('detected circles', image)
cv2.waitKey(0)
cv2.destroyAllWindows()