Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can you please delete your code screenshot and replace it with a text version of your code. What happens if you fill in the circles?

image description

Can you please delete your code screenshot and replace it with a text version of your code. code? What happens if you fill in the circles?

image description

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles?circles? What happens when you change HoughCircle's fourth parameter from 20 to 50?

image description

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles? What happens when you change HoughCircle's fourth parameter minDist from 20 to 50?

image description

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles? What happens when you change HoughCircle's fourth parameter minDist from 20 to 50?

image description

This is the code that I tried:

import cv2
import numpy as np

img = cv2.imread('circles.jpg', 0)
cimg = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 50, param1=50, param2=30, minRadius = 100, maxRadius = 0)

circles = np.uint16(np.around(circles))

for i in circles[0,:]:
    cv2.circle(cimg, (i[0],i[1]), i[2], (0,255,0), 2)
    cv2.circle(cimg, (i[0],i[1]), 2, (0,0,255), 3)

cv2.imshow('detected circles', cimg)
cv2.waitKey(0)

cv2.destroyAllWindows()

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles? What happens when you change HoughCircle's fourth parameter minDist from 20 to 50?

image description

This is the code that I tried:

import cv2
import numpy as np

img = cv2.imread('circles.jpg', 0)
cimg = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 50, param1=50, param2=30, minRadius = 100, maxRadius = 0)

circles = np.uint16(np.around(circles))

for i in circles[0,:]:
    cv2.circle(cimg, (i[0],i[1]), i[2], (0,255,0), 2)
    cv2.circle(cimg, (i[0],i[1]), 2, (0,0,255), 3)

cv2.imshow('detected circles', cimg)
cv2.waitKey(0)

cv2.destroyAllWindows()

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles? What happens when you change HoughCircle's fourth parameter minDist from 20 to 50?

image description

This is the code that I tried:

import cv2
import numpy as np

img = cv2.imread('circles.jpg', 0)
cimg = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 50, 50,
                           param1=50, param2=30, param2=30,
                           minRadius = 100, maxRadius = 0)

for i in circles[0,:]:
    cv2.circle(cimg, (i[0],i[1]), i[2], (0,255,0), 2)
    cv2.circle(cimg, (i[0],i[1]), 2, (0,0,255), 3)

cv2.imshow('detected circles', cimg)
cv2.waitKey(0)

cv2.destroyAllWindows()

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles? What happens when you change HoughCircle's fourth parameter minDist from 20 to 50?

image descriptionimage description

This is the code that I tried:

import cv2
import numpy as np

img = cv2.imread('circles.jpg', 0)
cimg = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 50,
                           param1=50, param2=30,
                           minRadius = 100, maxRadius = 0)

for i in circles[0,:]:
    cv2.circle(cimg, (i[0],i[1]), i[2], (0,255,0), 2)
    cv2.circle(cimg, (i[0],i[1]), 2, (0,0,255), 3)

cv2.imshow('detected circles', cimg)
cv2.waitKey(0)

cv2.destroyAllWindows()

Can you please delete your code screenshot and replace it with a text version of your code? What happens if you fill in the circles? What happens when you change HoughCircle's fourth parameter minDist from 20 to 50?

image description

This The following is the code that I tried:tried. It's based off of your code:

import cv2
import numpy as np

img = cv2.imread('circles.jpg', 0)
cimg = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 50,
                           param1=50, param2=30,
                           minRadius = 100, maxRadius = 0)

for i in circles[0,:]:
    cv2.circle(cimg, (i[0],i[1]), i[2], (0,255,0), 2)
    cv2.circle(cimg, (i[0],i[1]), 2, (0,0,255), 3)

cv2.imshow('detected circles', cimg)
cv2.waitKey(0)

cv2.destroyAllWindows()