append_ocr_trainf

read_image (Image, 'D:/图像文件/字符识别/1-1.bmp')

access_channel (Image, Image1, 1)

* draw_rectangle2 (3600, Row, Column, Phi, Length1, Length2)

gen_rectangle2 (Rectangle, 96.0436, 715.9526, 0.0173917050943654, 110.186941, 18.041084)

reduce_domain (Image1, Rectangle, ImageReduced)

scale_image_max (ImageReduced, ImageScaleMax)

TmpCtrl_Orientation :=0.0173917050943654

* OCR 02: Build rotation matrix

hom_mat2d_identity (TmpCtrl_MatrixIdentity)

hom_mat2d_rotate (TmpCtrl_MatrixIdentity, -TmpCtrl_Orientation, 0, 0, TmpCtrl_MatrixRotation)

get_domain (ImageReduced, TmpObj_Domain)

get_system ('clip_region', TmpCtrl_ClipRegion)

set_system ('clip_region', 'false')

dilation_circle (TmpObj_Domain, TmpObj_DomainExpanded, 25)

affine_trans_region (TmpObj_DomainExpanded, TmpObj_DomainTransformedRaw, TmpCtrl_MatrixRotation, 'true')

smallest_rectangle1 (TmpObj_DomainTransformedRaw, TmpCtrl_Row1, TmpCtrl_Col1, TmpCtrl_Row2, TmpCtrl_Col2)

hom_mat2d_translate (TmpCtrl_MatrixIdentity, -TmpCtrl_Row1, -TmpCtrl_Col1, TmpCtrl_MatrixTranslation)

hom_mat2d_compose (TmpCtrl_MatrixTranslation, TmpCtrl_MatrixRotation, TmpCtrl_MatrixComposite)

affine_trans_region (TmpObj_Domain, TmpObj_DomainTransformed, TmpCtrl_MatrixComposite, 'true')

affine_trans_image (ImageReduced, TmpObj_ImageTransformed, TmpCtrl_MatrixComposite, 'constant', 'true')

dilation_circle (TmpObj_Domain, TmpObj_DomainExpanded, 25)

affine_trans_pixel (TmpCtrl_MatrixComposite, TmpCtrl_Col1, TmpCtrl_Row1, RowTrans, ColTrans)

expand_domain_gray (TmpObj_ImageTransformed, TmpObj_ImageTransformedExpanded, 25)

reduce_domain (TmpObj_ImageTransformed, TmpObj_DomainTransformed, TmpObj_ImageTransformedReduced)

crop_part (TmpObj_ImageTransformedReduced, TmpObj_MonoReduced_OCR_02_0, 0, 0, TmpCtrl_Col2-TmpCtrl_Col1+1, TmpCtrl_Row2-TmpCtrl_Row1+1)

char_threshold (TmpObj_MonoReduced_OCR_02_0, TmpObj_DomainTransformed, Characters, 1,100, Threshold)

connection (Characters, ConnectedRegions1)

partition_dynamic (Characters, Partitioned, 29, 90)

connection (Partitioned, ConnectedRegions)

select_characters (ConnectedRegions, RegionCharacters, 'false', 'medium', 26, 28, 'false', 'false', 'none', 'false', 'medium', 'false', 0, 'completion')

* select_shape (ConnectedRegions, SelectedRegions, 'width', 'and', 10, 49)

* select_shape (SelectedRegions, SelectedRegions1, 'height', 'and', 10, 47)

sort_region (RegionCharacters, SortedRegions, 'character', 'true', 'column')

count_obj (SortedRegions, Number)

Chars := ['1','2','3']

for i := 1 to Number by 1

select_obj (SortedRegions, TrainSingle, i)

append_ocr_trainf (TrainSingle, TmpObj_MonoReduced_OCR_02_0, Chars[i - 1], 'D:/ocr/WR.trf')

endfor

read_ocr_trainf_names ('D:/ocr/WR.trf', CharacterNames, CharacterCount)

create_ocr_class_mlp (8, 10, 'constant', 'default', ['1','2','3'], 80, 'none', 10, 42, OCRHandle)

trainf_ocr_class_mlp (OCRHandle, 'D:/ocr/WR.trf', 200, 1, 0.01, Error, ErrorLog)

write_ocr_class_mlp (OCRHandle, 'D:/ocr/WR.omc')

clear_ocr_class_mlp (OCRHandle)

相关推荐
Qlittleboy4 小时前
windows如何安装wkhtmltoimage 给PHP使用根据HTML生成图片
开发语言·windows·php
水w5 小时前
【Android Studio】解决报错问题Algorithm HmacPBESHA256 not available
android·开发语言·android studio
冷琅辞5 小时前
Elixir语言的云计算
开发语言·后端·golang
Mryan20056 小时前
解决GraalVM Native Maven Plugin错误:JAVA_HOME未指向GraalVM Distribution
java·开发语言·spring boot·maven
Naomi5216 小时前
自定义汇编语言(Custom Assembly Language) 和 Unix & Git
服务器·开发语言·git·unix
烂蜻蜓6 小时前
C 语言命令行参数:让程序交互更灵活
c语言·开发语言·交互
zm-v-159304339866 小时前
解锁 DeepSeek 与 Matlab:攻克科研难题的技术利刃
开发语言·matlab·信息可视化
ylfhpy6 小时前
Java面试黄金宝典33
java·开发语言·数据结构·面试·职场和发展·排序算法
照书抄代码6 小时前
C++11可变参数模板单例模式
开发语言·c++·单例模式·c++11
No0d1es6 小时前
CCF GESP C++编程 四级认证真题 2025年3月
开发语言·c++·青少年编程·gesp·ccf·四级·202503