框架上的字符简单识别,基于halcon算法,总体思路:
图像预处理—>阈值分割—>去干扰—>设置读码识别字库—>识别
图像预处理—>阈值分割—>去干扰—>创建训练字符库,保存字库,读取设置读码识别字库—>识别,显示.
connection (RegionOpening, ConnectedRegions)
dilation_circle (ConnectedRegions, RegionDilation, 1)
connection (ConnectedRegions, ConnectedRegions1)
select_shape (ConnectedRegions1, SelectedRegions, [‘row’,‘height’], ‘and’, [300.19,100], [450,180])
fill_up (SelectedRegions, RegionFillUp)
sort_region (SelectedRegions, SortedRegions, ‘first_point’, ‘true’, ‘column’)
select_shape (SortedRegions, SelectedRegions1, ‘area’, ‘and’, 197, 8041.07)
read_ocr_class_mlp (‘E:/Program Files/MVTec/HALCON-10.0/ocr/Industrial_0-9A-Z.omc’, OCRHandle)
smallest_rectangle1 (SelectedRegions1, Row1, Column1, Row2, Column2)
do_ocr_multi_class_mlp (SelectedRegions1, Image, OCRHandle, Class, Confidence)
dev_display (Image)
dev_display (SelectedRegions1)
dev_set_line_width(5)
set_display_font (WindowHandle, 56, ‘mono’, ‘true’, ‘false’)
for Index := 0 to |Class|-1 by 1
//disp_message (WindowHandle, Class[Index]+’ ', ‘Image’, Row2[Index], Column1[Index], ‘red’, ‘false’)
dev_disp_text (Class[Index], ‘image’, Row2[Index]+50, Column1[Index],‘blue’, [], [])
endfor