当前位置:网站首页>Halcon Chinese character recognition
Halcon Chinese character recognition
2022-07-05 08:40:00 【Aii parson】
*1 Read images
read_image (Image, 'C:/Users/Administrator/Desktop/ Character recognition .jpg')
rgb1_to_gray (Image, GrayImage)
*2 Gray linear transformation of image preprocessing
scale_image (GrayImage, ImageScaled, 2.70, -190)# Make the light brighter , Dark is darker
*3 Character segmentation
*3.1 Positioning and geometric affine correction
threshold (ImageScaled, Regions, 0, 56)
connection (Regions, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 310.76, 3761.47)
************
union1 (SelectedRegions, RegionUnion)# Put four Chinese characters ( Huang, Luo Chao ) Connect into one
shape_trans (RegionUnion, RegionTrans, 'rectangle2')# Rectangular transformation with angle
orientation_region (RegionTrans, Phi)
area_center (RegionTrans, Area, Row, Column)
vector_angle_to_rigid (Row, Column, Phi, Row, Column, rad(180), HomMat2D)
affine_trans_image (ImageScaled, ImageAffineTrans, HomMat2D, 'constant', 'false')
affine_trans_region (RegionUnion, RegionAffineTrans, HomMat2D, 'nearest_neighbor')# The first parameter is zero RegionUnion, Not for RegionTrans, You can remove the middle between the original drawing compilation and Luo Chao “:”
reduce_domain (ImageAffineTrans, RegionAffineTrans, ImageReduced)
*3.2 Character segmentation ( Each word has a connected domain )
# For the corrected figure “ Huang, Luo Chao ” Segmentation
rgb1_to_gray (ImageReduced, GrayImage1)# not essential , It's originally a grayscale image
threshold (GrayImage1, Regions1, 0, 28)
connection (Regions1, ConnectedRegions1)
count_obj (SortedRegions, Number)
# Check each word ( Just look at , Same as the back )
for Index := 1 to Number by 1
select_obj (SortedRegions, ObjectSelected, Index)
endfor
*4 formation trf file , Character image and Character Association
words:=[' Ed ',' Writing ',' ROM. ',' super ']
TrainFile:='E:/03 CV( ancient )/Halcon/ Code '
# Added separately , It can also be added at one time write_ocr_trainf()
# Then manually add various deformed words
for i := 1 to Number by 1
select_obj (SortedRegions, SingleWord, i)
append_ocr_trainf (SingleWord, GrayImage1, words[i-1], TrainFile) # Add characters to the training file
endfor
read_ocr_trainf_names (TrainFile, CharacterNames, CharacterCount)
NumHidden:=20# Didn't work
*4.1 Create a neural network classifier
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, 80, 'none', 10, 42, OCRHandle)
*4.2 Training classifier
trainf_ocr_class_mlp (OCRHandle, TrainFile, 200, 1, 0.01, Error, ErrorLog)
*4.3 preservation omc file
write_ocr_class_mlp (OCRHandle, FontFile)
*4.4 Clear handle
clear_ocr_class_mlp (OCRHandle)
*5 Identifying text
read_ocr_class_mlp (FontFile, OCRHandle1)
do_ocr_multi_class_mlp (SortedRegions, GrayImage1, OCRHandle1, Class, Confidence)
边栏推荐
- [formation quotidienne - Tencent Selection 50] 557. Inverser le mot III dans la chaîne
- Example 005: three numbers sorting input three integers x, y, Z, please output these three numbers from small to large.
- Bluebridge cup internet of things basic graphic tutorial - GPIO input key control LD5 on and off
- 319. Bulb switch
- Five design details of linear regulator
- 696. 计数二进制子串
- 猜谜语啦(6)
- L298N module use
- 每日一题——替换空格
- 每日一题——输入一个日期,输出它是该年的第几天
猜你喜欢
Sword finger offer 06 Print linked list from end to end
Business modeling of software model | overview
【三层架构及JDBC总结】
C# LINQ源码分析之Count
整形的分类:short in long longlong
[three tier architecture]
实例007:copy 将一个列表的数据复制到另一个列表中。
MATLAB skills (28) Fuzzy Comprehensive Evaluation
[nas1] (2021cvpr) attentivenas: improving neural architecture search via attentive sampling (unfinished)
STM32---IIC
随机推荐
One dimensional vector transpose point multiplication np dot
Business modeling of software model | object modeling
猜谜语啦(8)
第十八章 使用工作队列管理器(一)
[nas1] (2021cvpr) attentivenas: improving neural architecture search via attentive sampling (unfinished)
[three tier architecture]
【日常训练--腾讯精选50】557. 反转字符串中的单词 III
Esp8266 interrupt configuration
Low code platform | apaas platform construction analysis
[three tier architecture and JDBC summary]
STM32---IIC
C语言标准函数scanf不安全的原因
实例006:斐波那契数列
Search data in geo database
[牛客网刷题 Day4] JZ32 从上往下打印二叉树
Speech recognition learning summary
Stm32--- systick timer
Explore the authentication mechanism of StarUML
剑指 Offer 05. 替换空格
Sword finger offer 09 Implementing queues with two stacks