代码拉取完成,页面将自动刷新
<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.0" halcon_version="10.0" cs="900266522">
<procedure name="main">
<interface/>
<body>
<l>read_image (Image, 'D:/实习/图片/pic/2017.08.25/C1-08251718/C1_1.bmp')</l>
<l>emphasize (Image, ImageEmphasize0, 7, 7, 5)</l>
<l>binomial_filter (ImageEmphasize0, ImageBinomial0, 9, 9)</l>
<l>invert_image (ImageBinomial0, ImageInvert0)</l>
<l>threshold (ImageInvert0, Region0, 135, 255)</l>
<l>closing_circle (Region0, RegionClosing0, 10)</l>
<l>connection (RegionClosing0, ConnectedRegions0)</l>
<l>select_shape (ConnectedRegions0, SelectedRegions0, ['width','height'], 'and', [90,40], [180,140])</l>
<l>select_shape_std (SelectedRegions0, SelectedRegionsStd0, 'max_area', 70)</l>
<l>intersection (SelectedRegionsStd0, Region0, RegionIntersection0)</l>
<c>*旋转图像</c>
<l>smallest_rectangle2 (RegionIntersection0, Row0, Column0, Phi0, Length01, Length02)</l>
<l>tuple_deg (Phi0, Deg0)</l>
<l>rotate_image (Image, rotateImage, -Deg0, 'constant')</l>
<c>*处理旋转后的图像</c>
<l>emphasize (rotateImage, ImageEmphasize01, 7, 7, 5)</l>
<l>binomial_filter (ImageEmphasize01, ImageBinomia0l, 9, 9)</l>
<l>invert_image (ImageBinomia0l, ImageInvert01)</l>
<l>threshold (ImageInvert01, Region01, 135, 255)</l>
<l>closing_circle (Region01, RegionClosing01, 10)</l>
<l>opening_circle (RegionClosing01, RegionOpening01, 5)</l>
<l>connection (RegionOpening01, ConnectedRegions01)</l>
<l>select_shape (ConnectedRegions01, SelectedRegions01, ['width','height'], 'and', [70,30], [160,110])</l>
<l>intersection (SelectedRegions01, Region01, RegionIntersection01)</l>
<l>smallest_rectangle2 (RegionIntersection01, Row01, Column01, Phi01, Length011, Length012)</l>
<l>RegionPriorWidth:=74</l>
<l>RegionPriorHeight:=30</l>
<c>*62,26</c>
<l>gen_rectangle2 (Rectangle01, Row01-1, Column01+Length011/2-RegionPriorWidth/2, 0, RegionPriorWidth, RegionPriorHeight)</l>
<c>*缩小区域</c>
<l>reduce_domain (ImageInvert01, Rectangle01, ImageReduced01)</l>
<l>mean_image (ImageReduced01, ImageMean01, 3, 3)</l>
<l>dyn_threshold (ImageReduced01, ImageMean01, Region02, 8, 'light')</l>
<l>closing_rectangle1 (Region02, RegionClosing02, 30, 1)</l>
<l>opening_rectangle1 (RegionClosing02, RegionOpening02, 5, 1)</l>
<l>connection (RegionOpening02, ConnectedRegions02)</l>
<c>*第一行***********************</c>
<l>select_shape (ConnectedRegions02, SelectedRegions1, ['width','height','row'], 'and', [40,18,Row01-20], [160,35,Row01])</l>
<l>intersection (SelectedRegions1, Region02, RegionIntersection1)</l>
<l>closing_rectangle1 (RegionIntersection1, RegionClosing1, 2, 50)</l>
<l>closing_circle (RegionClosing1, RegionClosing11, 2)</l>
<l>connection (RegionClosing11, ConnectedRegions1)</l>
<l>shape_trans (ConnectedRegions1, RegionTrans1, 'rectangle1')</l>
<l>partition_rectangle (RegionTrans1, Partitioned1, 14, 32)</l>
<l>select_shape (Partitioned1, SelectedRegions1, ['area','width','height'], 'and', [100,6,18], [600,20,40])</l>
<l>intersection (SelectedRegions1, Region02, RegionIntersection11)</l>
<c>*选中字符</c>
<c>*排序</c>
<l>sort_region (RegionIntersection11, SortedRegions1, 'first_point', 'true', 'column')</l>
<l>count_obj (SortedRegions1, Number1)</l>
<l>FontName:='D:/github/CodeRecognition/0825Words.omc'</l>
<l>read_ocr_class_mlp(FontName, OCRHandle)</l>
<l>do_ocr_multi_class_mlp (SortedRegions1, rotateImage, OCRHandle, RecNum1, Confidence1)</l>
<c>*第二行***********************</c>
<l>select_shape (ConnectedRegions02, SelectedRegions2, ['width','height','row'], 'and', [40,18,Row01], [160,35,Row01+16])</l>
<l>intersection (SelectedRegions2, Region02, RegionIntersection2)</l>
<l>closing_rectangle1 (RegionIntersection2, RegionClosing2, 2, 50)</l>
<l>closing_circle (RegionClosing2, RegionClosing21, 2)</l>
<l>connection (RegionClosing21, ConnectedRegions2)</l>
<l>shape_trans (ConnectedRegions2, RegionTrans2, 'rectangle1')</l>
<l>partition_rectangle (RegionTrans2, Partitioned2, 14, 32)</l>
<l>select_shape (Partitioned2, SelectedRegions2, ['area','width','height'], 'and', [100,6,18], [600,20,40])</l>
<l>intersection (SelectedRegions2, Region02, RegionIntersection21)</l>
<c>*选中字符</c>
<c>*排序</c>
<l>sort_region (RegionIntersection21, SortedRegions2, 'first_point', 'true', 'column')</l>
<l>count_obj (SortedRegions2, Number2)</l>
<c>*识别</c>
<l>do_ocr_multi_class_mlp (SortedRegions2, rotateImage, OCRHandle, RecNum2, Confidence2)</l>
<l> T1 := '' </l>
<l> T2 := ''</l>
<l>for i := 0 to |RecNum1| - 1 by 1</l>
<l> T1 := T1 + RecNum1[i]</l>
<l>endfor</l>
<l>for i := 0 to |RecNum2| - 1 by 1</l>
<l> T2 := T2 + RecNum2[i]</l>
<l>endfor</l>
<l>dev_set_draw ('margin')</l>
<l>dev_display (rotateImage)</l>
<l>dev_display (SortedRegions1)</l>
<l>dev_display (SortedRegions2)</l>
<l>dev_set_color ('green')</l>
<l>dev_set_line_width (1)</l>
<l>dev_set_shape ('rectangle1')</l>
<l>dev_display (SortedRegions1)</l>
<l>dev_display (SortedRegions2)</l>
<c></c>
<l>clear_ocr_class_mlp (OCRHandle)</l>
<c></c>
</body>
<docu id="main">
<parameters/>
</docu>
</procedure>
</hdevelop>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。