遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点文字识别

图片预处理

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

灰度化

文字矫正(放射变换)

二值化

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

如果没有很好的把每个字符分开,考虑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
复制代码

 

posted on   遗忘海岸  阅读(70)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
历史上的今天:
2012-07-16 NHiberante3.2版注意
2012-07-16 IIS6.0配置注意
点击右上角即可分享
微信分享提示