【问题标题】:Finding rotation angle inside a license plate查找车牌内的旋转角度
【发布时间】:2019-05-20 21:46:51
【问题描述】:

我正在尝试纠正车牌内部的失真,例如:

但是,我找不到检测旋转角度的可靠方法。我试图将特征值用作here,但它失败了。

我也在考虑霍夫线检测,但结果仍然很差。

如何改进旋转检测?

【问题讨论】:

  • 你能成功分割车牌吗?
  • 不超过这里(这是Mask R CNN的结果)
  • 好的。你也可以上传这张图片的分割掩码吗?

标签: image image-processing rotation


【解决方案1】:

找到板的轮廓,然后通过cv2.minAreaRect找到板的角度

#preprocessing steps
...
#find angle
im2, contours, hierarchy = cv2.findContours(preprocessed_sloping_plate,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

#contour with the largest area is possibly the plate
max_area = 0
max_cnt = None
for cnt in contours:
    area = cv2.contourArea(cnt)
    if(area > max_area):
        max_area = area 
        max_cnt = cnt

min_rect = cv2.minAreaRect(max_cnt)
(x,y,w,h,angle) = min_rect

#rotate
M = cv2.getRotationMatrix2D((w/2, h/2), angle, 1.0)
rotated_plate = cv2.warpAffine(preprocessed_sloping_plate, M, (w,h))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-13
    • 2020-12-27
    • 1970-01-01
    • 1970-01-01
    • 2018-06-27
    • 2012-11-03
    • 1970-01-01
    相关资源
    最近更新 更多