78 lines
3.5 KiB
Plaintext
78 lines
3.5 KiB
Plaintext
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<hdevelop file_version="1.1" halcon_version="12.0">
|
||
|
<procedure name="MatchResult">
|
||
|
<interface>
|
||
|
<io>
|
||
|
<par name="INPUT_Image" base_type="iconic" dimension="0"/>
|
||
|
</io>
|
||
|
<oo>
|
||
|
<par name="OUTPUT_PreTreatedImage" base_type="iconic" dimension="0"/>
|
||
|
</oo>
|
||
|
<ic>
|
||
|
<par name="ModelID" base_type="ctrl" dimension="0"/>
|
||
|
</ic>
|
||
|
<oc>
|
||
|
<par name="OUTPUT_Flag" base_type="ctrl" dimension="0"/>
|
||
|
</oc>
|
||
|
</interface>
|
||
|
<body>
|
||
|
<l>try</l>
|
||
|
<l> OUTPUT_Flag:=0</l>
|
||
|
<l> rgb1_to_gray(INPUT_Image, INPUT_Image)</l>
|
||
|
<c> *把图片外围干扰因素剔除</c>
|
||
|
<c> **** draw_spoke(Image, Regions, 3600, 30, 60, 15, ROIRows, ROICols, Direct)</c>
|
||
|
<l> ROIRows:=[1584.25, 1216.88, 661.489, 297.014, 297.014, 649.918, 1130.1, 1497.47, 1584.25]</l>
|
||
|
<l> ROICols:=[1158.75, 800.276, 762.869, 1096.41, 1751.02, 2050.27, 2084.56, 1819.6, 1158.75]</l>
|
||
|
<l> spoke (INPUT_Image, Regions1, 50, 90, 15, 3, 20, 'all', 'first', ROIRows, ROICols, 'inner', ResultRow, ResultColumn, ArcType)</l>
|
||
|
<l> pts_to_best_circle(Circle, ResultRow, ResultColumn, 'circle', 40, OUTPUT_RowCentre, OUTPUT_ColCentre, Radius, StartPhi, EndPhi, PointOrder, ArcAngle)</l>
|
||
|
<l>* dev_display (INPUT_Image)</l>
|
||
|
<l>* dev_display(Circle)</l>
|
||
|
<l> if(|Radius|=1)</l>
|
||
|
<l> gen_circle(Circle1, OUTPUT_RowCentre, OUTPUT_ColCentre, Radius)</l>
|
||
|
<l> reduce_domain (INPUT_Image, Circle1, ImageReduced)</l>
|
||
|
<l> gen_circle(Circle2, OUTPUT_RowCentre, OUTPUT_ColCentre, Radius*0.74)</l>
|
||
|
<l> reduce_domain(ImageReduced, Circle2, ImageReduced1)</l>
|
||
|
<l> difference(ImageReduced, ImageReduced1, RegionDifference)</l>
|
||
|
<c> </c>
|
||
|
<l> reduce_domain (INPUT_Image, RegionDifference, ImageReduced2)</l>
|
||
|
<l> zoom_image_factor(ImageReduced2, ImageZoomed, 0.9, 0.9, 'constant')</l>
|
||
|
<l> get_region_points(ImageZoomed, Rows, Columns)</l>
|
||
|
<l> get_grayval(ImageZoomed, Rows, Columns, Grayval)</l>
|
||
|
<l> gen_image_const(OUTPUT_PreTreatedImage, 'byte', 1440, 1440)</l>
|
||
|
<l> gen_image_proto(OUTPUT_PreTreatedImage, OUTPUT_PreTreatedImage, 255)</l>
|
||
|
<l> set_grayval(OUTPUT_PreTreatedImage, Rows-OUTPUT_RowCentre*0.9+720, Columns-OUTPUT_ColCentre*0.9+720, Grayval)</l>
|
||
|
<c> *查找模板,并对图片进行旋转</c>
|
||
|
<l> find_ncc_model(OUTPUT_PreTreatedImage, ModelID, -3.14, 3.14, 0.3, 1, 0.5, 'true', 0, Row, Column, Angle, Score)</l>
|
||
|
<l>* Angle:=Angle</l>
|
||
|
<l> if(|Angle|=1)</l>
|
||
|
<l> tuple_deg(Angle,Deg ) </l>
|
||
|
<l> rotate_image(OUTPUT_PreTreatedImage, ImageRotate, -Deg, 'constant')</l>
|
||
|
<l> gen_circle(Circle3, 720, 720, Radius*0.95)</l>
|
||
|
<l> reduce_domain(ImageRotate, Circle3, ImageReduced3)</l>
|
||
|
<l> get_region_points(ImageReduced3, Rows, Columns)</l>
|
||
|
<l> get_grayval(ImageReduced3, Rows, Columns, Grayval)</l>
|
||
|
<l> gen_image_const(OUTPUT_PreTreatedImage, 'byte', 1440, 1440)</l>
|
||
|
<l> gen_image_proto(OUTPUT_PreTreatedImage, OUTPUT_PreTreatedImage, 255)</l>
|
||
|
<l> set_grayval(OUTPUT_PreTreatedImage, Rows, Columns, Grayval)</l>
|
||
|
<l> OUTPUT_Flag:=1</l>
|
||
|
<l> else</l>
|
||
|
<l> OUTPUT_Flag:=1</l>
|
||
|
<l> endif</l>
|
||
|
<l> endif</l>
|
||
|
<l>catch (Exception)</l>
|
||
|
<l> OUTPUT_Flag:=0</l>
|
||
|
<l> zoom_image_size(INPUT_Image, OUTPUT_PreTreatedImage, 1440, 1440, 'constant')</l>
|
||
|
<l>endtry</l>
|
||
|
<l>return ()</l>
|
||
|
</body>
|
||
|
<docu id="MatchResult">
|
||
|
<parameters>
|
||
|
<parameter id="INPUT_Image"/>
|
||
|
<parameter id="ModelID"/>
|
||
|
<parameter id="OUTPUT_Flag"/>
|
||
|
<parameter id="OUTPUT_PreTreatedImage"/>
|
||
|
</parameters>
|
||
|
</docu>
|
||
|
</procedure>
|
||
|
</hdevelop>
|