车牌号:粤BW39S5
class变量:['Y', 'O', 'F', '5', '5', '5', 'F', '5', '5', '5', '5', 'Y', '7', 'F', 'Y', 'S', '0', 'E', 'Q', 'H', 'E', '3', 'J', '4', 'I', '6', 'W', 'A', '4', '4', '0', '6', 'Y', 'L', '5', '5', '5', '5', 'N', '4', 'Y', 'A', '3', '3', 'S', '9', '1', '4', 'W', 'S', 'M', '5', '6', '5', '4', '4', '7', 'Q', '9', '9', 'E', 'W', 'B', '4', '9', 'N', 'W', '3', '9', 'I', '9', '9', 'W', 'S', '5', '4', 'O', 'E', 'Y', '6', 'S', 'W', 'W', '3', 'L', 'W', '6', '4', 'P', '4', '4', '6', '9', 'O', 'W', '9', '4', '5', '5', '1', '7', '5', 'B', '5', '5', 'Y', '4', '4', '3', '3', '6', 'S', '5', '4', '5', '5', '4', '9', '4', '4', '5', 'I', '7', 'R']
- *读取图片
- read_image(Image,'C:/Users/ff_pe/Desktop/图片/粤B.png')
- *按三个图像转成三个颜色
- *车牌定位矫正
- decompose3(Image, Red, Green, Blue)
- trans_from_rgb(Red, Green, Blue,Hue, Saturation, Intensity, 'hsv')
- threshold (Saturation, Regions, 0, 190)
- *现在是同一个连通域,需要断开
- connection(Regions, ConnectedRegions)
- *选中车牌号
- select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 0, 458784)
- *膨胀
- dilation_rectangle1(Regions, RegionDilation, 30, 30)
- *填空洞
- fill_up(RegionDilation, RegionFillUp)
- *车牌转正
- orientation_region(RegionFillUp, Phi)
- area_center(RegionFillUp, Area, Row, Column)
- vector_angle_to_rigid(Row, Column, Phi, Row, Column, rad(180), HomMat2D)
- affine_trans_image(Image, ImageAffineTrans, HomMat2D, 'constant', 'false')
- affine_trans_region(RegionFillUp, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
- reduce_domain(ImageAffineTrans, RegionAffineTrans, ImageReduced)
- *字符分割
- rgb1_to_gray(ImageReduced, GrayImage)
- invert_image(GrayImage, ImageInvert)
- threshold (GrayImage, Regions1, 0, 87)
- connection(Regions, ConnectedRegions)
- select_shape (ConnectedRegions, SelectedRegions1, 'area', 'and', 0, 1.07161e+006)
- read_ocr_class_mlp ('Industrial_0-9A-Z_NoRej.omc', OCRHandle1)
- do_ocr_multi_class_mlp(SelectedRegions1, ImageInvert, OCRHandle1, Class, Confidence)
复制代码
|