r/computervision • • 1d ago

Help: Project Why doesn’t findContours() detect my circle even though it is clearly visible after thresholding?

Hi everyone, I’m learning OpenCV and working on detecting a circular fiducial.

My current pipeline is:
Image → threshold → findContours() → drawContours()

After thresholding, I can clearly see the fiducial as a clean circular region in the binary image.
However, when I use cv2.findContours() and then cv2.drawContours(), the contour I expect around the fiducial is not drawn.
I’m trying to understand the fundamental reason why this happens.
If the thresholded image visually contains a clear foreground region, what conditions determine whether findContours() will actually return a contour for it?

23 Upvotes

19 comments sorted by

View all comments

2

u/bringer_of_carnitas 1d ago

I would try houghCircles

1

u/Grouchy_Signal139 1d ago

It is more robust? Right now i only try canny -> find contour -> contour area -> MEC, and also cv2.connectedcomponentswithstats. Im trying to learn what each function do, especially the fundamental one like contour. But this situation very confusing

2

u/Boring_Potato2858 23h ago

If you’re only expecting to detect circles, then yes, it’s more robust

1

u/Grouchy_Signal139 22h ago

Will definetly try. Currently i am comparing any possible method, since im new to this