new_approach.py 文件源码

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

项目:conta-bolas 作者: ocarneiro 项目源码 文件源码
def draw_contours(self):
        """"""
        # contours all the objects found
        # (findContours changes the source image,
        #  hence copy)
        contours, _ = cv2.findContours(self.mask.copy(),
                                       cv2.RETR_TREE,
                                       cv2.CHAIN_APPROX_SIMPLE)
        # rectangles
        for contour in contours:
            size = cv2.contourArea(contour)
            if size > self.threshold:  # only larger objects
                ret_x, ret_y, ret_w, ret_h = cv2.boundingRect(contour)
                cv2.rectangle(self.display, (ret_x, ret_y),
                              (ret_x+ret_w,
                               ret_y+ret_h),
                              (0, 255, 255), 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号