Skip to content

Instantly share code, notes, and snippets.

@travis
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save travis/9034011 to your computer and use it in GitHub Desktop.
Save travis/9034011 to your computer and use it in GitHub Desktop.
# this uses openvc's hough circles detection to find circles in the image
# http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=cvhoughcircles#houghcircles
circles = cvHoughCircles(thresholded, storage, CV_HOUGH_GRADIENT, 2, thresholded.height/4, 100, 40, 20, 200)
# find largest circle
maxRadius = 0
x = 0
y = 0
found = False
for i in range(circles.total):
circle = circles[i]
if circle[2] > maxRadius:
found = True
maxRadius = circle[2]
x = circle[0]
y = circle[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment