【发布时间】:2019-05-20 21:46:51
【问题描述】:
【问题讨论】:
-
你能成功分割车牌吗?
-
不超过这里(这是Mask R CNN的结果)
-
好的。你也可以上传这张图片的分割掩码吗?
标签: image image-processing rotation
【问题讨论】:
标签: image image-processing rotation
找到板的轮廓,然后通过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))
【讨论】: