2021SC@SDUSC
在这篇文章里,我将继续对SimpleRecognizePlateByE2E函数的分析,上一篇文章里,我对这个函数的总体思想进行了概括,这个函数调用了detectPlateRough、finemappingVertical和recognizeOne这三个重要函数,上一篇文章里,我已经对detectPlateRough进行了分析,这次,我将会分析finemappingVertical函数
这个函数的代码如下:
def finemappingVertical(self,image,rect):
resized = cv2.resize(image,(66,16))
resized = resized.astype(np.float)/255
res_raw= self.modelFineMapping.predict(np.array([resized]))[0]
res =res_raw*image.shape[1]
res = res.astype(np.int)
H,T = res
H-=3
if H<0:
H=0
T+=2;
if T>= image.shape[1]-1:
T= image.shape[1]-1
rect[2] -= rect[2]*(1-res_raw[1] + res_raw[0])
rect[0]+=res[0]
image = image[:,H:T+2]
image = cv2.resize(image, (int(136), in