contour_tools.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Robo-Plot 作者: JackBuck 项目源码 文件源码
def extract_black_contours(img):
    """
    Extract contours for black objects on a white background.

    Args:
        img (np.ndarray): the (black and white?) image

    Returns:
        list[np.ndarray]: the contours
    """
    img_inverted = 255 - img
    _, contours, _ = cv2.findContours(img_inverted, mode=cv2.RETR_TREE, method=cv2.CHAIN_APPROX_SIMPLE)
    return contours


# TODO: A ContourGroups class would make this cleaner
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号