中文识别
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
read_image (Image, '中文.png') binary_threshold (Image, Region, 'max_separability', 'dark', UsedThreshold) dilation_circle (Region, RegionDilation, 1) connection (RegionDilation, ConnectedRegions2) intersection ( ConnectedRegions2,Region, RegionIntersection) sort_region (RegionIntersection, SortedRegions, 'character', 'true', 'row') * Str :='这意味着在进一步的操作中图像矩阵包含所有像素' * Fonts:=['这','意','味','着','在','进','一','步','的','操','作','中','图','像','矩','阵','包','含','所','有','像','素'] * classes:=[] * for Index := 1 to 8 by 1 * classes:=[classes,Fonts] * endfor * write_ocr_trainf (SortedRegions, Image, classes, '中文_ocr') *read_ocr_trainf (Characters, '中文_ocr', CharacterNames) * read_ocr_trainf_names ('中文_ocr', CharacterNames, CharacterCount) * create_ocr_class_mlp (8, 10, 'constant', 'default',CharacterNames, 80, 'none', 10, 42, OCRHandle) * trainf_ocr_class_mlp (OCRHandle, '中文_ocr', 200, 1, 0.01, Error, ErrorLog) * write_ocr_class_mlp (OCRHandle, '中文_ocr') read_ocr_class_mlp ('中文_ocr', OCRHandle) read_image (Image2, '中文目标.png') * vector_angle_to_rigid (200, 200, 0, 200, 200, rad(45), HomMat2D) * affine_trans_image (Image2, ImageAffineTrans, HomMat2D, 'constant', 'false') binary_threshold (Image2, Region2, 'max_separability', 'dark', UsedThreshold) dilation_circle (Region2, RegionDilation2, 1) connection (RegionDilation2, ConnectedRegions3) intersection ( ConnectedRegions3,Region2, RegionIntersection2) sort_region (RegionIntersection2, SortedRegions2, 'character', 'true', 'row') do_ocr_multi_class_mlp (SortedRegions2, Image2, OCRHandle, Class, Confidence) area_center (SortedRegions2, Area, Row, Column) tuple_length (Row, Length) phi:=gen_tuple_const(Length,0.0) L1:=gen_tuple_const(Length,20) L2:=gen_tuple_const(Length,20) smallest_rectangle2 (SortedRegions2, Row1, Column1, Phi2, Length1, Length2) gen_rectangle2_contour_xld (Rectangle1, Row1, Column1, Phi2, Length1 , Length2) set_display_font (200000, 16, 'sans', 'true', 'false') disp_message (200000, Class, 'window', Row-10, Column+2, 'black', 'true') clear_ocr_class_mlp (OCRHandle)
打一些文字,然后做训练
然后识别