fingers_recog.py 文件源码

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

项目:tbotnav 作者: patilnabhi 项目源码 文件源码
def _find_hull_defects(self, segment):
        # Use cv2 findContours function to find all the contours in segmented img
        contours, hierarchy = cv2.findContours(segment, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

        # assume largest contour is the one of interest
        max_contour = max(contours, key=cv2.contourArea)

        epsilon = 0.01*cv2.arcLength(max_contour, True)
        max_contour = cv2.approxPolyDP(max_contour, epsilon, True)

        # determine convex hull & convexity defects of the hull
        hull = cv2.convexHull(max_contour, returnPoints=False)
        defects = cv2.convexityDefects(max_contour, hull)

        return (max_contour, defects)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号