Improve contour detection with OpenCV (Python)

后端 未结 2 1832
孤街浪徒
孤街浪徒 2021-01-31 05:52

I am trying to identify cards from a photo. I managed to do what I wanted on ideal photos, but I am now having hard time applying the same procedure with slightly different ligh

2条回答
  •  天命终不由人
    2021-01-31 06:54

    Except for the image in the bottom right corner, the following steps should generally work:

    1. Dilate and erode the binary masks to bridge any one or two pixels gaps between contour fragments.
    2. Use maximal supression to turn your thick binary masks along the boundary of your shapes into thin edges.
    3. As used earlier in the pipeline, use cvFindcontours to identify closed contours. Each contour identified by the method can be tested for being closed.
    4. As a general solution to such problems, I would advise you to try my algorithm to find closed contours around a given point. Check active segmentation with fixation

提交回复
热议问题