read_image.py 文件源码

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

项目:image_text_reader 作者: yardstick17 项目源码 文件源码
def get_text_with_location(boxed_image, contours, img):
    image_text_dict = {}
    for contour in contours:
        # get rectangle bounding contour
        [x, y, w, h] = cv2.boundingRect(contour)

        # draw rectangle around contour on original image

        if w < 20 or h < 20:
            continue

        cv2.rectangle(boxed_image, (x, y), (x + w + 10, y + h + 10), thickness=2, color=0)

        box_read = extract_image_from_location(img, x, y, w, h)
        box_read = box_read.strip()
        image_text_dict[(x, y)] = box_read
    return image_text_dict
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号