<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.0" halcon_version="10.0.2" cs="714657">
<procedure name="main">
<interface/>
<body>
<c>* This example illustrates how to </c>
<c>* 1. Acquire data from the Gocator (16-bit RGB image)</c>
<c>* 2. Decompose the returned image into three separate image for height map, intensity and stamps. </c>
<c>* 3. Extract some stamp values from the stamp image.</c>
<c></c>
<c>* Connect to the Gocator device. This code is auto generated by the Image Acquisition dialog box. User can manually override the directory path by editing the line below.</c>
<l>open_framegrabber ('GenICamTL', 0, 0, 0, 0, 0, 0, 'progressive', 16, 'rgb', -1, 'false', 'default', '192.168.1.10 producer:C:\\SOFTWARE_Go2_Tools\\GenTL\\x86\\Go2GenTL.cti interface:0:XX::GenTL vendor:LMI model:Gocator', 0, -1, AcqHandle)</l>
<c></c>
<l>grab_image_start (AcqHandle, -1)   </l>
<c></c>
<l>while (true)         </l>
<l>    try</l>
<l>        grab_image_async (Image, AcqHandle, -1)</l>
<l>    catch(Exception)</l>
<l>        continue</l>
<l>    endtry</l>
<l>        Go2GenTL_ParseData(Image, HeightMap, Intensity, frameCount, timestamp, encoderPosition, encoderIndex, inputs, xOffset, xResolution, yOffset, yResolution, zOffset, zResolution, width, height)</l>
<l>        dev_display(HeightMap)    </l>
<c>        </c>
<c>        * Image Acquisition Routines Start</c>
<c>        </c>
<c>        * Image Acquisition Routines End</c>
<l>endwhile</l>
<l as_id="image_acquisition" as_name="Image Acquisition 01" as_grp="[4,1]" as_ord="1">close_framegrabber (AcqHandle)</l>
<c></c>
<c></c>
<c></c>
</body>
<docu id="main">
<parameters/>
</docu>
</procedure>
<procedure name="Go2GenTL_ParseData">
<interface>
<io>
<par name="Image"/>
</io>
<oo>
<par name="HeightMap"/>
<par name="Intensity"/>
</oo>
<oc>
<par name="FrameCount"/>
<par name="Timestamp"/>
<par name="EncoderPosition"/>
<par name="EncoderIndex"/>
<par name="Inputs"/>
<par name="xOffset"/>
<par name="xResolution"/>
<par name="yOffset"/>
<par name="yResolution"/>
<par name="zOffset"/>
<par name="zResolution"/>
<par name="Width"/>
<par name="Length"/>
</oc>
</interface>
<body>
<l>count_channels(Image, ChannelCount)</l>
<l>decompose3(Image, HeightMap, Intensity, Stamps)</l>
<c></c>
<l>Go2GenTL_Stamp(Stamps, 1, FrameCount)</l>
<l>Go2GenTL_Stamp(Stamps, 2, Timestamp)</l>
<l>Go2GenTL_Stamp(Stamps, 3, EncoderPosition)</l>
<l>Go2GenTL_Stamp(Stamps, 4, EncoderIndex)</l>
<l>Go2GenTL_Stamp(Stamps, 5, Inputs)</l>
<l>Go2GenTL_Stamp(Stamps, 6, xOffset)</l>
<l>Go2GenTL_Stamp(Stamps, 7, xResolution)</l>
<l>Go2GenTL_Stamp(Stamps, 8, yOffset)</l>
<l>Go2GenTL_Stamp(Stamps, 9, yResolution)</l>
<l>Go2GenTL_Stamp(Stamps, 10, zOffset)</l>
<l>Go2GenTL_Stamp(Stamps, 11, zResolution)</l>
<l>Go2GenTL_Stamp(Stamps, 12, Width)</l>
<l>Go2GenTL_Stamp(Stamps, 13, Length)</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_ParseData">
<parameters>
<parameter id="EncoderIndex"/>
<parameter id="EncoderPosition"/>
<parameter id="FrameCount"/>
<parameter id="HeightMap"/>
<parameter id="Image"/>
<parameter id="Inputs"/>
<parameter id="Intensity"/>
<parameter id="Length"/>
<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>
<procedure name="Go2GenTL_Stamp">
<interface>
<io>
<par name="Stamps"/>
</io>
<ic>
<par name="Index"/>
</ic>
<oc>
<par name="Value"/>
</oc>
</interface>
<body>
<l> get_grayval(Stamps, 0, (Index * 4), tempvalue0)</l>
<l> get_grayval(Stamps, 0, (Index * 4) + 1, tempvalue1)</l>
<l> get_grayval(Stamps, 0, (Index * 4) + 2, tempvalue2)</l>
<l> get_grayval(Stamps, 0, (Index * 4) + 3, tempvalue3)</l>
<l> tuple_lsh(tempvalue0, 16,tempvalue0)</l>
<l> tuple_lsh(tempvalue1, 0,tempvalue1)</l>
<l> tuple_lsh(tempvalue2, 16,tempvalue2)</l>
<l> tuple_lsh(tempvalue3, 0,tempvalue3)</l>
<l> Value[0] := tempvalue2 + tempvalue3</l>
<l> Value[1] := tempvalue0 + tempvalue1</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_Stamp">
<parameters>
<parameter id="Index"/>
<parameter id="Stamps"/>
<parameter id="Value"/>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_SetResampleMode">
<interface>
<ic>
<par name="AcqHandle"/>
<par name="ResampleMode"/>
</ic>
</interface>
<body>
<l>set_framegrabber_param(AcqHandle, 'ResampleMode', ResampleMode)</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_SetResampleMode">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="ResampleMode">
<default_type>string</default_type>
<default_value>'Yes'</default_value>
<description lang="en_US">'No' - No resample.
'Yes' - Resample such that X and Y resolutions are the same</description>
<mixed_type>false</mixed_type>
<multivalue>false</multivalue>
<sem_type>string</sem_type>
<type_list>
<item>string</item>
</type_list>
<value_list>
<item>'No'</item>
<item>'Yes'</item>
</value_list>
</parameter>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_ResampleMode">
<interface>
<ic>
<par name="AcqHandle"/>
</ic>
<oc>
<par name="ResampleMode"/>
</oc>
</interface>
<body>
<l>get_framegrabber_param(AcqHandle, 'ResampleMode', ResampleMode)</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_ResampleMode">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="ResampleMode"/>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_SetImageSize">
<interface>
<ic>
<par name="AcqHandle"/>
<par name="Width"/>
<par name="Height"/>
</ic>
</interface>
<body>
<c>* This is a little tricky. To reduce the image siez, we reduce the GenTL register drive, then halcon</c>
<c>* To increase, do it the other way</c>
<c></c>
<c>* Configure Image Height</c>
<l>get_framegrabber_param(AcqHandle, 'image_height', imageHeight)</l>
<c></c>
<l>if (imageHeight &lt; Height)</l>
<l>    set_framegrabber_param (AcqHandle, 'HeightReg', Height)</l>
<l>    set_framegrabber_param (AcqHandle, 'image_height', Height)</l>
<l>else</l>
<l>    set_framegrabber_param (AcqHandle, 'image_height', Height)</l>
<l>    set_framegrabber_param (AcqHandle, 'HeightReg', Height)</l>
<l>endif</l>
<c></c>
<c>* Configure Image Width</c>
<l>if (imageHeight &lt; Height)</l>
<l>    set_framegrabber_param(AcqHandle, 'WidthReg', Width)</l>
<l>    set_framegrabber_param(AcqHandle, 'image_width', Width)</l>
<l>else</l>
<l>    set_framegrabber_param(AcqHandle, 'image_width', Width)</l>
<l>    set_framegrabber_param(AcqHandle, 'WidthReg', Width)    </l>
<l>endif</l>
<c></c>
<l>return ()</l>
</body>
<docu id="Go2GenTL_SetImageSize">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="Height"/>
<parameter id="Width"/>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_Encoder">
<interface>
<ic>
<par name="AcqHandle"/>
</ic>
<oc>
<par name="EncoderValue"/>
</oc>
</interface>
<body>
<l>get_framegrabber_param(AcqHandle, 'EncoderValue0', EncoderValue0)</l>
<l>get_framegrabber_param(AcqHandle, 'EncoderValue1', EncoderValue1)</l>
<l>EncoderValue[0] := EncoderValue0</l>
<l>EncoderValue[1] := EncoderValue1</l>
<c></c>
<l>return ()</l>
</body>
<docu id="Go2GenTL_Encoder">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="EncoderValue"/>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_SetConfigFileName">
<interface>
<ic>
<par name="AcqHandle"/>
<par name="ConfigFileName"/>
</ic>
</interface>
<body>
<l>set_framegrabber_param(AcqHandle, 'ConfigFile', ConfigFileName)</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_SetConfigFileName">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="ConfigFileName">
<default_type>string</default_type>
<sem_type>string</sem_type>
<type_list>
<item>string</item>
</type_list>
</parameter>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_ConfigFileName">
<interface>
<ic>
<par name="AcqHandle"/>
</ic>
<oc>
<par name="ConfigFile"/>
</oc>
</interface>
<body>
<l>get_framegrabber_param(AcqHandle, 'ConfigFile', ConfigFile)</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_ConfigFileName">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="ConfigFile"/>
</parameters>
</docu>
</procedure>
<procedure name="Go2GenTL_ImageSize">
<interface>
<ic>
<par name="AcqHandle"/>
</ic>
<oc>
<par name="Width"/>
<par name="Height"/>
</oc>
</interface>
<body>
<l>get_framegrabber_param(AcqHandle, 'image_width', Width)</l>
<l>get_framegrabber_param(AcqHandle, 'image_height', Height)</l>
<l>return ()</l>
</body>
<docu id="Go2GenTL_ImageSize">
<parameters>
<parameter id="AcqHandle"/>
<parameter id="Height"/>
<parameter id="Width"/>
</parameters>
</docu>
</procedure>
</hdevelop>
