mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Added small fix when circles are not detected
I noticed that I missed the fact that `cimg` is used in the second `imshow()` call. Changed the scope of the second function call to be within the if-statement. Otherwise in cases where have not been detected the second `imshow()` will attempt to use `cimg` which will be empty leading to an error.
This commit is contained in:
parent
25e2e8aa3c
commit
c5bbc0353c
@ -35,7 +35,8 @@ if __name__ == '__main__':
|
|||||||
for i in range(b):
|
for i in range(b):
|
||||||
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv2.LINE_AA)
|
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv2.LINE_AA)
|
||||||
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv2.LINE_AA) # draw center of circle
|
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv2.LINE_AA) # draw center of circle
|
||||||
|
|
||||||
|
cv2.imshow("detected circles", cimg)
|
||||||
|
|
||||||
cv2.imshow("source", src)
|
cv2.imshow("source", src)
|
||||||
cv2.imshow("detected circles", cimg)
|
|
||||||
cv2.waitKey(0)
|
cv2.waitKey(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user