halcon代码:
read_image (Audi2, 'audi2') fill_interlace (Audi2, ImageFilled, 'odd') dev_set_color('green') threshold (ImageFilled, Region, 0, 90) connection (Region, ConnectedRegions) select_shape (ConnectedRegions, SelectedRegions, 'width', 'and', 30, 70) select_shape (SelectedRegions, Letters, 'height', 'and', 60, 110) *dev_clear_window () *dev_set_colored (12) *dev_display (ImageFilled) *dev_display (Letters) read_ocr_class_mlp('Industrial_0-9A-Z.omc',OCRHandle) do_ocr_multi_class_mlp(Letters,Audi2,OCRHandle, Class, Confidence) *显示识别的结果 area_center(Letters, Area, Row, Column) for Index := 0 to 6 by 1 disp_message(3600, Class[Index], 'window', Row[Index], Column[Index], 'black', 'true') endfor
初始图片:
处理后的图片,将车牌所在的区域识别出来:
显示输出结果:
*Class[0]--class[6]分别为GAPV329
area_center(Letters, Area, Row, Column) for Index := 0 to 6 by 1 disp_message(3600, Class[Index], 'window', Row[Index], Column[Index], 'black', 'true') endfor