当前位置:网站首页>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)
边栏推荐
- [牛客网刷题 Day4] JZ55 二叉树的深度
- Guess riddles (11)
- Warning: retrying occurs during PIP installation
- 【日常训练】1200. 最小绝对差
- 猜谜语啦(8)
- Example 009: pause output for one second
- An enterprise information integration system
- STM32---IIC
- Bluebridge cup internet of things competition basic graphic tutorial - clock selection
- Example 002: the bonus paid by the "individual income tax calculation" enterprise is based on the profit commission. When the profit (I) is less than or equal to 100000 yuan, the bonus can be increase
猜你喜欢
One question per day - replace spaces
Explore the authentication mechanism of StarUML
[牛客网刷题 Day4] JZ55 二叉树的深度
实例005:三数排序 输入三个整数x,y,z,请把这三个数由小到大输出。
如何写Cover Letter?
leetcode - 445. Add two numbers II
实例002:“个税计算” 企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.
MATLAB skills (28) Fuzzy Comprehensive Evaluation
猜谜语啦(2)
Example 009: pause output for one second
随机推荐
Basic number theory - fast power
Esphone Feixun DC1 soft change access homeassstant
[牛客网刷题 Day4] JZ55 二叉树的深度
如何写Cover Letter?
图解八道经典指针笔试题
实例001:数字组合 有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
MATLAB小技巧(28)模糊綜合評價
Guess riddles (9)
MATLAB小技巧(28)模糊综合评价
Example 003: a complete square is an integer. It is a complete square after adding 100, and it is a complete square after adding 168. What is the number?
【日常訓練--騰訊精選50】557. 反轉字符串中的單詞 III
Several problems to be considered and solved in the design of multi tenant architecture
Xrosstools tool installation for X-Series
STM32---ADC
Search data in geo database
STM32 --- serial port communication
Esp8266 interrupt configuration
UE pixel stream, come to a "diet pill"!
One dimensional vector transpose point multiplication np dot
Cmder of win artifact