当前位置:   article > 正文

text_model__settextmodelparam

settextmodelparam

create_text_model_reader ('manual', [], TextModel)
set_text_model_param (TextModel, 'polarity', 'light_on_dark')
set_text_model_param (TextModel, 'char_width', 23)
set_text_model_param (TextModel, 'char_height', 42)
set_text_model_param (TextModel, 'return_punctuation', 'false')
set_text_model_param (TextModel, 'uppercase_only', 'true')
set_text_model_param (TextModel, 'fragment_size_min', 11)
set_text_model_param (TextModel, 'eliminate_border_blobs', 'true')
set_text_model_param (TextModel, 'base_line_tolerance', 0.2)
set_text_model_param (TextModel, 'max_line_num', 1)
read_ocr_class_mlp ('D://NEOLD.omc', OcrHandle)
read_image (Image, '微信图片_20230602143216.png')
rgb1_to_gray (Image, GrayImage)
* draw_rectangle2 (3600, Row, Column, Phi, Length1, Length2)
gen_rectangle2 (Rectangle,157.631 , 355.058,0.0137, 127.74, 50.431)
gen_contour_region_xld (Rectangle, Contours, 'border')
orientation_xld (Contours, Phi3)
p0:=deg(Phi3)
p1:=rad(95)
smallest_rectangle2 (Rectangle, Row1, Column1, Phi1, Length11, Length21)
orientation_region (Rectangle, Phi2)
reduce_domain (GrayImage, Rectangle, ImageReduced)
tuple_rad (Phi2, Deg)
TmpCtrl_Orientation := -0.0137
TmpCtrl_Orientation1 := -p1
* OCR 01: Build rotation matrix
hom_mat2d_identity (TmpCtrl_MatrixIdentity)
hom_mat2d_rotate (TmpCtrl_MatrixIdentity, -TmpCtrl_Orientation, 0, 0, TmpCtrl_MatrixRotation)
* OCR 01: Apply transformation to image and domain
get_domain (ImageReduced, TmpObj_Domain)
get_system ('clip_region', TmpCtrl_ClipRegion)
set_system ('clip_region', 'false')
dilation_circle (TmpObj_Domain, TmpObj_DomainExpanded, 19)
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, 19)
expand_domain_gray (TmpObj_ImageTransformed, TmpObj_ImageTransformedExpanded, 19)
reduce_domain (TmpObj_ImageTransformed, TmpObj_DomainTransformed, TmpObj_ImageTransformedReduced)
crop_part (TmpObj_ImageTransformedReduced, ImageReduced, 0, 0, TmpCtrl_Col2-TmpCtrl_Col1+1, TmpCtrl_Row2-TmpCtrl_Row1+1)
set_system ('clip_region', TmpCtrl_ClipRegion)
*  binary_threshold (ImageReduced, Region, 'max_separability', 'light', UsedThreshold)
*  connection (Region, ConnectedRegions)
*  reduce_domain (ImageReduced, Region, ImageReduced1)
*  rgb1_to_gray (ImageReduced1, GrayImage1)
invert_image (ImageReduced, ImageInvert)
find_text (ImageReduced, TextModel, TmpCtrl_ResultHandle_OCR_01_1)
* OCR 01: 
* OCR 01: Read text (classification step)
get_text_object (Characters, TmpCtrl_ResultHandle_OCR_01_1, 'all_lines')
clear_text_result (TmpCtrl_ResultHandle_OCR_01_1)
do_ocr_multi_class_mlp (Characters, ImageInvert, OcrHandle, Class, Confidence)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/644566
推荐阅读
相关标签
  

闽ICP备14008679号