Halcon¶
Halcon supports GenTL via its GenICamTL interface.
Acquisition of Multiple Components¶
The grab_image operator (as well as the preview in the image acquisition assistant) can only acquire data for a single component. Use the grab_data operator to acquire multiple components.
3D Object Model¶
The range component is acquired as a three channel float image, which probably does not show anything meaningful in the image preview.
Enable the create_objectmodel3d and add_objectmodel3d_overlay_attrib parameters and then use the grab_data operator to create a 3D object model as its Data output.
set_framegrabber_param(AcqHandle, 'create_objectmodel3d', 'enable')
set_framegrabber_param(AcqHandle, 'add_objectmodel3d_overlay_attrib', 'enable')
See the Halcon interface documentation for more information.
Example Program¶
The following example program shows the basic operation of a camera using the Halcon GenICamTL interface.
serial := '<INSERT YOUR CAMERA SERIAL>'
open_framegrabber('GenICamTL', 0, 0, 0, 0, 0, 0, 'progressive', -1, 'default', -1, 'false', 'default', serial, 0, -1, AcqHandle)
* Opening the camera automatically loads any parameters that were stored in the device memory
* by NxView or Engage.
* Example for adjusting parameters directly from Halcon. A list of all parameters is available
* in the Ensenso SDK manual.
* set_framegrabber_param(AcqHandle, 'FlexViewSequenceLength', 16)
* Enable creation of a Halcon 3D object model by the GenICamTL interface.
set_framegrabber_param(AcqHandle, 'create_objectmodel3d', 'enable')
set_framegrabber_param(AcqHandle, 'add_objectmodel3d_overlay_attrib', 'enable')
grab_image_start(AcqHandle, -1)
while(true)
* Point Cloud X, Y, Z channels and texture image are written to the Images variable.
* The 3D object model is written to the Data variable.
grab_data(Images, Regions, Contours, AcqHandle, Data)
* 3D visualization from a fixed position, which might not fit your camera. This code was
* generated and can be adjusted using the "Visualize Object Model 3D" dialog on the object
* model in the Data variable.
CamParam1 := ['area_scan_division',0.06,0,8.5e-06,8.5e-06,469,333,938,667]
Pose1 := [-0.066066,0.0632688,5.41351,320.174,4.44578,303.951,0]
GenParamName1 := ['red_channel_attrib','green_channel_attrib','blue_channel_attrib']
GenParamValue1 := ['&overlay_red','&overlay_green','&overlay_blue']
dev_get_window(WindowHandle1)
disp_object_model_3d(WindowHandle1, Data, CamParam1, Pose1, GenParamName1, GenParamValue1)
endwhile
close_framegrabber(AcqHandle)