image_transformation.py 文件源码

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

项目:Sign-Language-Recognition 作者: Anmol-Singh-Jaggi 项目源码 文件源码
def draw_contours(frame):
    """
    Draws a contour around white color.
    """
    print("Drawing contour around white color...")

    # 'contours' is a list of contours found.
    contours, _ = cv2.findContours(
        frame, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

    # Finding the contour with the greatest area.
    largest_contour_index = find_largest_contour_index(contours)

    # Draw the largest contour in the image.
    cv2.drawContours(frame, contours,
                     largest_contour_index, (255, 255, 255), thickness=-1)

    # Draw a rectangle around the contour perimeter
    contour_dimensions = cv2.boundingRect(contours[largest_contour_index])
    # cv2.rectangle(sign_image,(x,y),(x+w,y+h),(255,255,255),0,8)

    print("Done!")
    return (frame, contour_dimensions)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号