2020-03-27 04:54:46 -0600 | received badge | ● Popular Question (source) |
2017-01-16 12:22:16 -0600 | received badge | ● Editor (source) |
2017-01-15 21:21:10 -0600 | asked a question | Improving canny+contours image segmentation? I am working on an image segmentation project to identify playing cards on varying backgrounds. For my use case I care most that I accurately extract all the cards in the image; false-positives are inconvenient but not fatal. I also care that I can run the segmentation without user interaction (i.e., an algorithm like grabcut does not work for me). So far I have the following simple algorithm based on Canny edge detection and contour selection: For some (many) inputs it works well enough, or even very well: However for other inputs the contour detection does not successfully disambiguate cards. The contours are grouped in ways that link cards or result in undesirable bounding boxes: I've tried various improvements such as altering all the parameters, adding a thresholding step, etc. but without much success. I would love to hear your suggestions on what else I should try! For reference (or, better yet, if you want to play along at home) I have a set of example inputs and the outputs of my current algorithm: https://goo.gl/photos/HCYeiFqhG5pVNWnY9 EDIT: For the record, a few more things I've tried:
def auto_canny(image, sigma=0.5): v = np.median(image) lower = int(max(0, (1.0 - sigma) * v)) upper = int(min(255, (1.0 + sigma) * v)) return cv2.Canny(image, lower, upper)
|