defimg_Transform(car_contours,oldimg,pic_width,pic_hight):
car_imgs=[]for car_rect incar_contours:if car_rect[2] > -1 and car_rect[2] < 1:
angle= 1
#对于角度为-1 1之间时,默认为1
else:
angle= car_rect[2]
car_rect= (car_rect[0], (car_rect[1][0] + 5, car_rect[1][1] + 5), angle)
box=cv2.boxPoints(car_rect)
heigth_point= right_point =[0, 0]
left_point= low_point =[pic_width, pic_hight]for point inbox:if left_point[0] >point[0]:
left_point=pointif low_point[1] > point[1]:
low_point=pointif heigth_point[1] < point[1]:
heigth_point=pointif right_point[0]
right_point=pointif left_point[1] <= right_point[1]: #正角度
new_right_point = [right_point[0], heigth_point[1]]
pts2= np.float32([left_point, heigth_point, new_right_point]) #字符只是高度需要改变