create_text_model_reader ('manual', [], TextModel)
set_text_model_param (TextModel, 'char_width', 26)
set_text_model_param (TextModel, 'char_height', 51)
set_text_model_param (TextModel, 'stroke_width', 7.6)
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', 12)
set_text_model_param (TextModel, 'eliminate_border_blobs', 'true')
set_text_model_param (TextModel, 'base_line_tolerance', 0.4)
set_text_model_param (TextModel, 'max_line_num', 1)
read_ocr_class_mlp ('D:/20201224-152525bmp.omc', OcrHandle)
read_image (Image, 'C:/Users/Desktop/NEOLD.png')
rgb1_to_gray (Image, GrayImage)
find_text (GrayImage, TextModel, TmpCtrl_ResultHandle_OCR_01_1)
* OCR 01:
* OCR 01: Read text (classification step)
get_text_object (Symbols_OCR_01_0, TmpCtrl_ResultHandle_OCR_01_1, 'all_lines')
clear_text_result (TmpCtrl_ResultHandle_OCR_01_1)
do_ocr_multi_class_mlp (Symbols_OCR_01_0, GrayImage, OcrHandle, Class, Confidence)
* draw_rectangle2 (3600, Row, Column, Phi, Length1, Length2)
* gen_rectangle2 (Rectangle, 294.5, 358.5, 0.0129, 77.0065, 59.0732)
* gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)
* reduce_domain (GrayImage, Rectangle, ImageReduced)
* char_threshold (ImageReduced, Rectangle, Characters, 0, 100, Threshold)
* binary_threshold (ImageReduced, Region, 'max_separability', 'dark', UsedThreshold)
* closing_rectangle1 (Region, RegionClosing, 10, 10)
* connection (Characters, ConnectedRegions)
* sort_region (ConnectedRegions, SortedRegions, 'character', 'true', 'row')
* count_obj (SortedRegions, Number)
调试代码记录1
最新推荐文章于 2023-07-23 09:12:37 发布
该段代码涉及OCR光学字符识别技术,使用特定参数设置text_model,对图像进行灰度处理、文字检测、多类分类、阈值处理和形态学操作,以提高文字识别的准确性。
摘要由CSDN通过智能技术生成