How to Run a HALCON Sample
Introduction
This tutorial shows how to configure HALCON samples and run them in HDevelop, C++, and C#.
Requirements
Required
zivid-halcon-samples (HDevelop) / zivid-cpp-samples / zivid-csharp-samples
Note
The HALCON version tested with Zivid cameras is 19.05 Progress, 20.05 Progress, 21.11 Progress.
Optional
If you do not currently have a separate ply viewer installed, MeshLab is a straightforward option to see the point clouds generated from the samples provided.
Instructions
Step by step instructions are provided with screenshots below.
Configure environment variables for GenICam/HALCON
Some environment variables needs to be set before you can begin to use Zivid with GenICam. There are two options:
On your PC, navigate to System → Advanced System Settings → Environmental Variables
Under System variables, select Path variable and click Edit… (Do not click New at this stage or you will overwrite the existing value of the Path system variable!) and then add the following value by clicking New:
Variable name |
|
Variable value |
|
Note
Ensure to have the correct path for your Zivid installation.
Click OK to go back to the Environment variables window and then click New to include the following system variable:
Variable name: |
|
Variable value |
|
Press the Win + R keys on your keyboard. Then, type cmd and press Enter.
Type the following commands:
set PATH=%PATH%;C:\Program Files\Zivid\bin
set GENICAM_GENTL64_PATH=C:\Program Files\Zivid\bin
"%HALCONROOT%\bin\x64-win64\hdevelop.exe"
Note
Make sure to have the correct paths for your HALCON and Zivid installations
Now that your environment variables are set, you are ready to run samples. Select your language:
The video below shows you how to run samples using Zivid camera in HALCON.
Open HDevelop, and click on Open Program. Go to the location where you downloaded/cloned the samples.
Open the sample that you would like to run, e.g. CaptureHDR.hdev.
Run the program by pressing the F5 key. The program should now run successfully and display the 3D point cloud of your scene.
To run the samples, follow this tutorial and select Halcon from the optional requirements:
You have two options to capture and save a point cloud, demonstrated with two samples:
Using GenICam Interface and Halcon C++ SDK: CaptureHalconViaGenICam.cpp
Using Zivid SDK by transforming the point cloud to Halcon format using Halcon C++ SDK: CaptureHalconViaZivid.cpp
To run the samples, follow this tutorial and select Halcon from the optional requirements:
You have two options to capture and save a point cloud, demonstrated with two samples:
Using GenICam Interface and Halcon C# SDK: CaptureHalconViaGenICam.cs
Using Zivid SDK by transforming the point cloud to Halcon format using Halcon C# SDK: CaptureHalconViaZivid.cs