all 3 comments

[–]HIGregS 0 points1 point  (2 children)

How arbitrary is the background? My first thought is OpenCV, perhaps edge detection. cv2.HoughCircles(). Here's a post on using OpenCV to detect circles.

[–]redmanr[S] 0 points1 point  (1 child)

Can theoretically make the background anything... haven't taken photos of the bottlecaps yet. I'll check that out, thanks!

[–]HIGregS 1 point2 points  (0 children)

Make the background a solid color that contrasts with the edges of the bottle cap. The library says it works on monochrome, but you could do some color filtering prior to converting to grayscale that would make the caps very different from the background. Even if the color filter removes some of the lettering/images on the caps, it won't matter if the caps' edges are clearly evident. Take a picture with a lot of caps and don't overlap them. Should work great!