领胜LDS 键盘AOI检测项目
patrick.xu
2022-02-24 3322022068ab818912d6f5d9e5eb31f51cc639c2
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.1" halcon_version="12.0">
<procedure name="Go2GenTL_ParseData">
<interface>
<io>
<par name="Image" base_type="iconic" dimension="0"/>
</io>
<oo>
<par name="HeightMap" base_type="iconic" dimension="0"/>
<par name="Intensity" base_type="iconic" dimension="0"/>
</oo>
<ic>
<par name="Index" base_type="ctrl" dimension="0"/>
</ic>
<oc>
<par name="FrameCount" base_type="ctrl" dimension="0"/>
<par name="Timestamp" base_type="ctrl" dimension="0"/>
<par name="EncoderPosition" base_type="ctrl" dimension="0"/>
<par name="EncoderIndex" base_type="ctrl" dimension="0"/>
<par name="Inputs" base_type="ctrl" dimension="0"/>
<par name="xOffset" base_type="ctrl" dimension="0"/>
<par name="xResolution" base_type="ctrl" dimension="0"/>
<par name="yOffset" base_type="ctrl" dimension="0"/>
<par name="yResolution" base_type="ctrl" dimension="0"/>
<par name="zOffset" base_type="ctrl" dimension="0"/>
<par name="zResolution" base_type="ctrl" dimension="0"/>
<par name="Width" base_type="ctrl" dimension="0"/>
<par name="Length" base_type="ctrl" dimension="0"/>
<par name="HasIntensity" base_type="ctrl" dimension="0"/>
<par name="NumScans" base_type="ctrl" dimension="0"/>
</oc>
</interface>
<body>
<l>count_channels (Image, channelCount)</l>
<c>* </c>
<l>if (channelCount = 1)</l>
<c>    * </c>
<l>    get_image_size (Image, monoImageWidth, monoImageHeight)</l>
<l>    crop_rectangle1 (Image, Stamps, monoImageHeight - 1, 0, monoImageHeight-1, monoImageWidth)</l>
<c>    * </c>
<l>    Go2GenTLStamp (Stamps, 1, FrameCount)</l>
<l>    Go2GenTLStamp (Stamps, 2, Timestamp)</l>
<l>    Go2GenTLStamp (Stamps, 3, EncoderPosition)</l>
<l>    Go2GenTLStamp (Stamps, 4, EncoderIndex)</l>
<l>    Go2GenTLStamp (Stamps, 5, Inputs)</l>
<l>    Go2GenTLStamp (Stamps, 6, xOffset)</l>
<l>    Go2GenTLStamp (Stamps, 7, xResolution)</l>
<l>    Go2GenTLStamp (Stamps, 8, yOffset)</l>
<l>    Go2GenTLStamp (Stamps, 9, yResolution)</l>
<l>    Go2GenTLStamp (Stamps, 10, zOffset)</l>
<l>    Go2GenTLStamp (Stamps, 11, zResolution)</l>
<l>    Go2GenTLStamp (Stamps, 12, Width)</l>
<l>    Go2GenTLStamp (Stamps, 13, Length)</l>
<l>    Go2GenTLStamp (Stamps, 14, HasIntensity)</l>
<l>    Go2GenTLStamp (Stamps, 15, NumScans)</l>
<c>    * </c>
<c>    * * Mono output does not support multiple heightmaps, assuming index is 0</c>
<l>    crop_rectangle1 (Image, HeightMap, 0, 0, Length - 1, Width)</l>
<l>    if (HasIntensity = 1)</l>
<l>        IntensityPosition := (monoImageHeight - 1)/2</l>
<l>        crop_rectangle1 (Image, Intensity, IntensityPosition, 0, IntensityPosition + Length - 1, Width)</l>
<l>    else</l>
<l>        gen_image_const (Intensity, 'byte', Width, Length)</l>
<l>    endif</l>
<c>    * </c>
<l>elseif (channelCount = 3)</l>
<c>    * </c>
<l>    decompose3 (Image, HeightMap, Intensity, Stamps)</l>
<c>    * </c>
<l>    Go2GenTLStamp (Stamps, 1, FrameCount)</l>
<l>    Go2GenTLStamp (Stamps, 2, Timestamp)</l>
<l>    Go2GenTLStamp (Stamps, 3, EncoderPosition)</l>
<l>    Go2GenTLStamp (Stamps, 4, EncoderIndex)</l>
<l>    Go2GenTLStamp (Stamps, 5, Inputs)</l>
<l>    Go2GenTLStamp (Stamps, 6, xOffset)</l>
<l>    Go2GenTLStamp (Stamps, 7, xResolution)</l>
<l>    Go2GenTLStamp (Stamps, 8, yOffset)</l>
<l>    Go2GenTLStamp (Stamps, 9, yResolution)</l>
<l>    Go2GenTLStamp (Stamps, 10, zOffset)</l>
<l>    Go2GenTLStamp (Stamps, 11, zResolution)</l>
<l>    Go2GenTLStamp (Stamps, 12, Width)</l>
<l>    Go2GenTLStamp (Stamps, 13, Length)</l>
<l>    Go2GenTLStamp (Stamps, 14, HasIntensity)</l>
<l>    Go2GenTLStamp (Stamps, 15, NumScans)</l>
<c>    * </c>
<c>    * * Split Height Map</c>
<l>    start := Index * (Length)</l>
<l>    end := (Index+1) * (Length)</l>
<c>    * </c>
<l>    if (NumScans &gt; Index)</l>
<l>        crop_rectangle1 (HeightMap, HeightMap, start, 0, end, Width)</l>
<l>        if (HasIntensity = 1)</l>
<l>            crop_rectangle1 (Intensity, Intensity, start, 0, end, Width)</l>
<l>        endif</l>
<l>    endif</l>
<c>    * </c>
<l>endif</l>
<c>* </c>
<c>* * Change Offset and resolution back to floating point and described in mm</c>
<l>xOffset := xOffset / 1000000.0</l>
<l>yOffset := yOffset / 1000000.0</l>
<l>zOffset := zOffset / 1000000.0</l>
<l>xResolution := xResolution / 1000000.0</l>
<l>yResolution := yResolution / 1000000.0</l>
<l>zResolution := zResolution / 1000000.0</l>
<c>* </c>
<l>return ()</l>
</body>
<docu id="Go2GenTL_ParseData">
<parameters>
<parameter id="EncoderIndex"/>
<parameter id="EncoderPosition"/>
<parameter id="FrameCount"/>
<parameter id="HasIntensity"/>
<parameter id="HeightMap"/>
<parameter id="Image"/>
<parameter id="Index"/>
<parameter id="Inputs"/>
<parameter id="Intensity"/>
<parameter id="Length"/>
<parameter id="NumScans"/>
<parameter id="Timestamp"/>
<parameter id="Width"/>
<parameter id="xOffset"/>
<parameter id="xResolution"/>
<parameter id="yOffset"/>
<parameter id="yResolution"/>
<parameter id="zOffset"/>
<parameter id="zResolution"/>
</parameters>
</docu>
</procedure>
</hdevelop>