main.py 文件源码

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

项目:Automatic-Plate-Number-Recognition-APNR 作者: kagan94 项目源码 文件源码
def verify_sizes(rectangle):
    # print candidate
    # help(cv2.minAreaRect)
    (x, y), (width, height), rect_angle = rectangle

    # Calculate angle and discard rects that has been rotated more than 15 degrees
    angle = 90 - rect_angle if (width < height) else -rect_angle
    if 15 < abs(angle) < 165:  # 180 degrees is maximum
        return False

    # We make basic validations about the regions detected based on its area and aspect ratio.
    # We only consider that a region can be a plate if the aspect ratio is approximately 520/110 = 4.727272
    # (plate width divided by plate height) with an error margin of 40 percent
    # and an area based on a minimum of 15 pixels and maximum of 125 pixels for the height of the plate.
    # These values are calculated depending on the image sizes and camera position:
    area = height * width

    if height == 0 or width == 0:
        return False
    if not satisfy_ratio(area, width, height):
        return False

    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号