Third-party platform (Halcon)

Downloading and installing Halcon

Download the Halcon (Windows version) installation package from the Halcon official website (https://www.mvtec.com/downloads) and install Halcon according to the official documentation.

Important

The installation package Image Acquisition Interfaces must be installed. If there are no special requirements, it is recommended to check all installation packages and install them.

Downloading SDK

Note

  • If the Halcon version is 18.11.04.0 or above, please follow the steps below to download the Camport3_Halcon_gentl SDK.

  • If the Halcon version is lower than 18.11.04.0, please go to the official GitHub page of Percipio to download the Camport3_Halcon SDK. This section does not introduce the usage of the SDK. If you have any questions, please contact Percipio technical support.

Choose any of the following methods to download the Camport3_Halcon_gentl SDK:

  • Download from the official GitHub page of Percipio: https://github.com/percipioxyz/.

  • Use the git command to obtain a local copy: Open the terminal, switch to the working directory where the SDK should be stored, and enter the git clone command to clone the remote repository.

    git clone https://github.com/percipioxyz/camport3_halcon_gentl.git
    

Camport3_Halcon_gentl SDK directory structure is shown in the following figure:

Halcon SDK 目录

Camport3_Halcon_gentl SDK directory

Samples directory

It stores sample programs for user programming reference.

  • check_status.hdev: This sample program is used to display the status of the camera connection.

  • fetchframe.hdev: This sample program is used to capture image data from one depth camera.

  • fetchframe_2cameras.hdev: This sample program is used to simultaneously capture images with two depth cameras and output image data.

  • fetchframe_p3d.hdev: This sample program is used to capture 3D point clouds.

  • genicamtl_parameters.hdev: This sample program is used to enumerate the parameters supported by Percipio.

  • triggermode1.hdev: This sample program is used to set the depth camera to work in mode 1. The camera captures images and outputs image data when it receives a software trigger command or a hardware trigger signal.

Others

The samples directory also includes:

  • percipio.cti: The implementation file of GenTL Producer.

  • tycam.dll: The dynamic link library of Percipio SDK, which is a dependency for GenTL Producer.

  • README.md: The README documentation.

Configuring environment variables

Enter the environment variables page and create a new environment variable. The variable name is GENICAM_GENTL64_PATH, and the variable value is the storage path of percipio.cti, which is the Camport3_Halcon_gentl SDK folder path. After rebooting the computer, the configuration will take effect.

配置环境变量

Configure environment variables

Running

Take the camera with serial number 207000144850 as an example to explain how to run the camera in Halcon. The steps are as follows:

  1. To find the camera, enter the following code in the program window and run it.

    info_framegrabber ('GenICamTL', 'info_boards', BoardInfo, BoardInfoValues)
    

    BoardInfoValues will display all discoverable devices.

  2. To open the camera and capture the image, enter the following code in the program window and run it.

    Here ‘PercipioTL_DEV_207000144850’ is provided as an example, please replace it with the target camera before running.

    open_framegrabber ('GenICamTL', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'false', 'default', 'PercipioTL_DEV_207000144850', 0, -1, AcqHandle)
    set_framegrabber_param(AcqHandle, 'SourceSelector', 'Source_Color')
    set_framegrabber_param(AcqHandle, 'SourceMode', 'On')
    set_framegrabber_param(AcqHandle, 'SourceSelector', 'Source_Depth')
    set_framegrabber_param(AcqHandle, 'SourceMode', 'Off')
    grab_data_async(Image, Region, Contours, AcqHandle, -1, Data)
    

    AcqHandle displays the obtained handle. The Image variable and the graphic window display the captured color image.

  3. The sample code of reading and writing parameters according to the camera features is as follows. For more information about camera features, please refer to Viewing camera features.

    get_framegrabber_param(AcqHandle, 'ImageMode_values', ImageModeValues)
    set_framegrabber_param(AcqHandle, 'ImageMode', ImageModeValues[0])
    

Viewing camera features

  1. Double-click on the genicamtl_parameters.hdev file under the samples path.

  2. Modify the serial number of the camera to be opened in the program window, and click on the run button.

    Here, ‘PercipioTL_DEV_207000144850’ is provided as an example, please replace it with the target camera before running.

    open_framegrabber ('GenICamTL', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, 'false', 'default', 'PercipioTL_DEV_207000144850', 0, -1, AcqHandle)
    

    The parameter file parameters_info.dat will be generated in the same directory as the genicamtl_parameters.hdev file.

  3. Open the parameters_info.dat file, and view the list of supported features for the camera.

Tip

parameters_info.dat File Description

Structure: Parameter Name + <Prefix> + Current Value + [Parameter Range]