点文字识别

图片预处理

目标区域定位(一般固定的方式可以用工具画出大致区域)

灰度化

文字矫正(放射变换)

二值化

膨胀腐蚀等,断开联通区域,

如果没有很好的把每个字符分开,考虑Shape_Trans转换成矩形,再分割矩形

分割后的区域s与二值化后的区域求交, 结果集一般就是一个一个字符了

然后将区域与图片(白底黑字)叫个mlp做识别

read_image (Image, 'dot')

* dots_image (Image, DotImage,15, 'dark', 0)
get_image_size (Image, Width, Height)
gen_rectangle1 (ROI_0, 72.7942, 110.25, 466.877, 852.086)

text_line_orientation (ROI_0, Image, 25, -0.523599, 0.523599, OrientationAngle)
vector_angle_to_rigid (Width/2, Height/2, OrientationAngle, Width/2, Height/2, 0, HomMat2D)
affine_trans_image (Image, ImageAffineTrans, HomMat2D, 'constant', 'false')

dots_image (ImageAffineTrans, DotImage, 7, 'dark', 0)
reduce_domain (DotImage, ROI_0, ImageReduced)
binary_threshold (ImageReduced, Region, 'max_separability', 'light', UsedThreshold)
dilation_rectangle1 (Region, RegionDilation, 10, 10)
connection (RegionDilation, ConnectedRegions)
shape_trans (ConnectedRegions, RegionTrans, 'rectangle1')
select_shape (RegionTrans, SelectedRegions, ['width','height'], 'and', [20.092,18.807], [98.807,100])
partition_rectangle (SelectedRegions, Partitioned, 30, 80)
intersection (Partitioned, Region, RegionIntersection)
sort_region (RegionIntersection, SortedRegions, 'character', 'true', 'row')
read_ocr_class_mlp ('DotPrint_0-9A-Z_Rej.omc', OCRHandle)
invert_image (ImageReduced, ImageInvert)
do_ocr_multi_class_mlp (SortedRegions, ImageInvert, OCRHandle, Class, Confidence)
smallest_rectangle1 (SortedRegions, Row1, Column1, Row2, Column2)
count_obj (SortedRegions, Number)
dev_display (ImageInvert)
for Index := 1 to Number by 1
    disp_message (200000, Class[Index-1], 'image', Row2[Index-1], Column1[Index-1], 'red', 'true')
endfor
* invert_image (Image, ImageInvert)
View Code

 

原文地址:https://www.cnblogs.com/wdfrog/p/15018911.html