* OCR 01: Code generated by OCR 01
* OCR 01:
* OCR 01: Prepare text model
* OCR 01:
create_text_model_reader ('manual', [], TextModel)
set_text_model_param (TextModel, 'is_dotprint', 'true')
set_text_model_param (TextModel, 'char_width', 42)
set_text_model_param (TextModel, 'char_height', 54)
set_text_model_param (TextModel, 'stroke_width', 18.5)
set_text_model_param (TextModel, 'return_punctuation', 'false')
set_text_model_param (TextModel, 'return_separators', 'false')
set_text_model_param (TextModel, 'uppercase_only', 'true')
set_text_model_param (TextModel, 'fragment_size_min', 84)
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)
* OCR 01:
* OCR 01: Load classifier
* OCR 01:
read_ocr_class_mlp ('Industrial_0-9_NoRej.omc', OcrHandle)
* OCR 01: ***************************************************************
* OCR 01: * The code which follows is to be executed once / image *
* OCR 01: ***************************************************************
* OCR 01:
* OCR 01: Load image
read_image (Image, 'E:/下载/image/OCR识别2/OCR识别222/123456.jpg')
* OCR 01:
* OCR 01: Perform actual processing (once per ROI)
* OCR 01: Generate regions of interest
gen_rectangle2 (ROI_OCR_01_0, 732.34, 3213, rad(3.96009), 415.069, 51.1921)
* OCR 01:
* OCR 01: Extract symbol regions (segmentation step)
* OCR 01: Only consider first channel for color images
access_channel (Image, TmpObj_Mono, 1)
reduce_domain (TmpObj_Mono, ROI_OCR_01_0, TmpObj_MonoReduced_OCR_01_0)
dev_display (TmpObj_MonoReduced_OCR_01_0)
* OCR 01:
* OCR 01: Orientation Correction (for consistent border and domain
* OCR 01: handling, this is always applied, even with no rotation)
* OCR 01:
* OCR 01: Base orientation of ROI
TmpCtrl_Orientation := 0.0691166
* 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 (TmpObj_MonoReduced_OCR_01_0, TmpObj_Domain)
get_system ('clip_region', TmpCtrl_ClipRegion)
set_system ('clip_region', 'false')
dilation_circle (TmpObj_Domain, TmpObj_DomainExpanded, 92)
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 (TmpObj_MonoReduced_OCR_01_0, TmpObj_ImageTransformed, TmpCtrl_MatrixComposite, 'constant', 'true')
dilation_circle (TmpObj_Domain, TmpObj_DomainExpanded, 92)
expand_domain_gray (TmpObj_ImageTransformed, TmpObj_ImageTransformedExpanded, 92)
reduce_domain (TmpObj_ImageTransformed, TmpObj_DomainTransformed, TmpObj_ImageTransformedReduced)
crop_part (TmpObj_ImageTransformedReduced, TmpObj_MonoReduced_OCR_01_0, 0, 0, TmpCtrl_Col2-TmpCtrl_Col1+1, TmpCtrl_Row2-TmpCtrl_Row1+1)
set_system ('clip_region', TmpCtrl_ClipRegion)
find_text (TmpObj_MonoReduced_OCR_01_0, TextModel, TmpCtrl_ResultHandle_OCR_01_0)
* OCR 01:
* OCR 01: Read text (classification step)
get_text_object (Symbols_OCR_01_0, TmpCtrl_ResultHandle_OCR_01_0, 'all_lines')
clear_text_result (TmpCtrl_ResultHandle_OCR_01_0)
dev_display (TmpObj_MonoReduced_OCR_01_0)
dev_set_draw ('fill')
dev_set_colored (3)
dev_display (Symbols_OCR_01_0)
do_ocr_multi_class_mlp (Symbols_OCR_01_0, TmpObj_MonoReduced_OCR_01_0, OcrHandle, SymbolNames_OCR_01_0, Confidences_OCR_01_0)
* OCR 01:
* OCR 01: Do something with the results
* OCR 01:
* OCR 01: Cleanup (global)
clear_text_model (TextModel)
clear_ocr_class_mlp (OcrHandle)文章来源地址https://www.toymoban.com/news/detail-468715.html
文章来源:https://www.toymoban.com/news/detail-468715.html
到了这里,关于OCR 01的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!