Extract external contour or silhouette of image in Python

后端 未结 3 1717
清歌不尽
清歌不尽 2020-12-31 16:51

I want to extract the silhouette of an image, and I\'m trying to do it using the contour function of MatplotLib. This is my code:

from PIL import Image
from          


        
3条回答
  •  耶瑟儿~
    2020-12-31 17:24

    I would recommand using OpenCV for performance. It has a findContour functions accessible from python using the cv2 binding. This function can be set to return only the external contour.

    You will have to threshold your image as well.

提交回复
热议问题