简单字符识别

发布时间:2024年01月24日

在这里插入图片描述

框架上的字符简单识别,基于halcon算法,总体思路:
图像预处理—>阈值分割—>去干扰—>设置读码识别字库—>识别
图像预处理—>阈值分割—>去干扰—>创建训练字符库,保存字库,读取设置读码识别字库—>识别,显示.

  • Image Acquisition 01: Code generated by Image Acquisition 01
    read_image (Image, ‘12.bmp’)
    dev_close_window ()
    dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
    dev_display (Image)
    rotate_image (Image, ImageRotate, -5, ‘constant’)
    emphasize (Image, ImageEmphasize, 51, 51, 2)
    //rgb1_to_gray (ImageEmphasize, GrayImage)
    threshold (ImageEmphasize, Regions, 0, 98)
    opening_circle (Regions, RegionOpening, 1)

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

文章来源:https://blog.csdn.net/u011637657/article/details/135817172
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。