代码拉取完成,页面将自动刷新
同步操作将从 xiaodelea/CodeRecognition 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.0" halcon_version="10.0" cs="155244216">
<procedure name="main">
<interface/>
<body>
<l>list_files ('D:/实习/图片/珠江啤酒/C1', 'files', FilesList)</l>
<l>tuple_regexp_select (FilesList, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima)$','ignore_case'], FilesList)</l>
<c>*|FilesList|</c>
<l>for Index :=0 to |FilesList| - 1 by 1</l>
<l> parse_filename (FilesList[Index], BaseName, Extension, Directory)</l>
<l> read_image (Image, FilesList[Index])</l>
<l> *read_image (Image, 'D:/实习/图片/珠江啤酒/defect/C1_3.png')</l>
<l> emphasize (Image, ImageEmphasize, 7, 7, 5)</l>
<c> *[7,7,3][7,7,5]</c>
<l> binomial_filter (ImageEmphasize, ImageBinomial, 5, 5)</l>
<l> mean_image (ImageBinomial, ImageMean, 21, 21)</l>
<l> dyn_threshold (ImageBinomial, ImageMean, RegionDynThresh, 20, 'dark')</l>
<l> dilation_circle (RegionDynThresh, RegionDilation, 1)</l>
<l> dilation_rectangle1 (RegionDilation, RegionDilation1, 3, 5)</l>
<c> *[2,3][3,5]</c>
<l> connection (RegionDilation1, ConnectedRegions4)</l>
<l> select_shape (ConnectedRegions4, SelectedRegions5, 'height', 'and', 25, 42)</l>
<l> union1 (SelectedRegions5, RegionUnion2)</l>
<l> closing_rectangle1 (RegionUnion2, RegionClosing, 30, 20)</l>
<l> connection (RegionClosing, ConnectedRegions)</l>
<l> select_shape (ConnectedRegions, SelectedRegions, ['area','height'], 'and', [8000,40], [13000,100])</l>
<l> intersection (RegionDynThresh, SelectedRegions, RegionIntersection)</l>
<c> </c>
<l> smallest_rectangle2 (RegionIntersection, Row, Column, Phi, Length1, Length2)</l>
<l> hom_mat2d_identity (HomMat2DIdentity)</l>
<l> hom_mat2d_rotate (HomMat2DIdentity, -Phi, 0, 0, HomMat2DRotate)</l>
<l> affine_trans_region (RegionIntersection, RegionAffineTrans, HomMat2DRotate, 'false')</l>
<l> area_center (RegionAffineTrans, Area, Row1, Column1)</l>
<l> connection (RegionAffineTrans, ConnectedRegions1)</l>
<c> </c>
<l> select_shape (ConnectedRegions1, SelectedRegions1, 'row', 'and', Row1-40, Row1)</l>
<l> union1 (SelectedRegions1, RegionUnion)</l>
<l> dilation_rectangle1 (RegionUnion, RegionDilation2, 3, 10)</l>
<l> connection (RegionDilation2, ConnectedRegions2)</l>
<l> shape_trans (ConnectedRegions2, RegionTrans, 'convex')</l>
<l> partition_dynamic (RegionTrans, Partitioned, 20, 20)</l>
<l> select_shape (Partitioned, SelectedRegions2, 'height', 'and', 25, 42)</l>
<l> intersection (SelectedRegions2, RegionUnion, RegionIntersection1)</l>
<l> sort_region (RegionIntersection1, SortedRegions, 'first_point', 'true', 'column')</l>
<l> count_obj (SortedRegions, Number1)</l>
<l> if (Number1 # 8)</l>
<l> stop ( )</l>
<l> endif</l>
<c> </c>
<l> skeleton (SortedRegions, Skeleton)</l>
<l> area_center (Skeleton, Area2, Row2, Column2)</l>
<l> KnownStr := ['2','0','1','8','0','9','1','0','1','1','5','1','1','3','E']</l>
<l> orderChar := ['0','1','2','3','4','5','6','7','8','9','E']</l>
<l> AreaMax := [57, 28, 46, 44, 50, 45, 57, 37, 63, 54, 55]</l>
<l> AreaDelta := 0.3</l>
<l> for Index1 := 0 to Number1-1 by 1 </l>
<l> tuple_find (orderChar, KnownStr[Index1], Indices)</l>
<l> if ((Area2[Index1] < AreaMax[Indices]*(1 - AreaDelta)))</l>
<l> stop ()</l>
<l> endif</l>
<l> endfor</l>
<c> </c>
<l> select_shape (ConnectedRegions1, SelectedRegions3, 'row', 'and', Row1, Row1+40)</l>
<l> union1 (SelectedRegions3, RegionUnion1)</l>
<l> dilation_rectangle1 (RegionUnion1, RegionDilation3, 3, 10)</l>
<l> connection (RegionDilation3, ConnectedRegions3)</l>
<l> shape_trans (ConnectedRegions3, RegionTrans1, 'convex')</l>
<l> partition_dynamic (RegionTrans1, Partitioned1, 20, 20)</l>
<l> select_shape (Partitioned1, SelectedRegions4, 'height', 'and', 25, 42)</l>
<l> intersection (SelectedRegions4, RegionUnion1, RegionIntersection2)</l>
<l> sort_region (RegionIntersection2, SortedRegions1, 'first_point', 'true', 'column')</l>
<l> count_obj (SortedRegions1, Number2)</l>
<l> if (Number2 # 7)</l>
<l> stop ( )</l>
<l> endif</l>
<l> skeleton (SortedRegions1, Skeleton1)</l>
<l> area_center (Skeleton1, Area3, Row3, Column3)</l>
<l> for Index2 := 0 to Number2-1 by 1 </l>
<l> tuple_find (orderChar, KnownStr[8+Index2], Indices)</l>
<l> if ((Area3[Index2] < AreaMax[Indices]*(1 - AreaDelta)))</l>
<l> stop ()</l>
<l> endif</l>
<l> endfor</l>
<l> *stop ( )</l>
<l>endfor</l>
</body>
<docu id="main">
<parameters/>
</docu>
</procedure>
</hdevelop>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。