/zivid-halcon-samples

HALCON code samples for Zivid

Primary LanguageC#BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

HALCON samples

This repository contains code samples for the usage of a Zivid 3D camera in HALCON.

Samples list

There are two main categories of samples: Camera and Applications. The samples in the Camera category focus only on how to use the camera. The samples in the Applications category use the output generated by the camera, such as the 3D point cloud, a 2D image or other data from the camera. These samples shows how the data from the camera can be used.

Samples indicated by (cpp) are written in C++, samples indiced by (csharp) are written in C#, while samples written in HDevelop is indicated by (hdev).

  • Camera

    • Basic
      • Capture (hdev) - Capture point clouds, with color, from the Zivid camera and use it to generate a HALCON ObjectModel3D which is then visualized.
      • CaptureHDR (hdev) - Capture HDR point clouds, with color, from the Zivid camera and use it to generate a HALCON ObjectModel3D which is then visualized.
      • CaptureHDRCompleteSettings (hdev) - Capture point clouds, with color, from the Zivid camera with fully configured settings and use it to generate a HALCON ObjectModel3D which is then visualized.
      • CaptureHDRLoop (hdev) - Capture HDR point clouds, with color, from the zivid camera in a loop (while actively changing some acquisition settings). Each point cloud is used to generate a HALCON ObjectModel3D which is then visualized. Settings are read from .json files from Zivid sample data. However, you may also get settings from Zivid Studio. When you save settings they will be stored in .yaml format. Halcon only support reading JSON files, so in order to convert them to JSON use YAMLSettingsToJSON.
      • ConnectToSerialNumberCamera (hdev) - Connect to a specific Zivid 3D camera based on its serial number. You should modify the sample to include your cameras serial number before running the sample.
      • CaptureSavePLY (hdev) - Capture a point cloud, with colors, from the camera and save it to a .ply file format. The .ply file is saved in the same folder as the sample.
      • CaptureViaGenICam (cpp, csharp) - Capture and save a point cloud, with colors, using GenICam interface and Halcon C++/C# SDK.
      • CaptureViaZivid (cpp, csharp) - Capture a point cloud, with colors, using Zivid SDK, transform it to a Halcon point cloud and save it using Halcon C++/C# SDK.
    • InfoUtilOther
      • QuerySettingsAndParameters (hdev) - Query information about the image acquisition interface and selected specific parameters of Zivid camera.
  • Applications

    • Basic
      • FileFormats
        • ReadPLY (hdev) - Read point cloud from PLY file and visualize it.
    • Advanced
      • ObjectMatching (hdev)
        • SurfaceMatchingCreateModelFromFile (hdev) - Load a model from file for surface-based matching algorithm integrated into HALCON. This example comes with three models created by this program: a Pringles can (190 g), a plastic Coca-Cola bottle (0.5 l) and a Twinings tea box (~15cm x 7cm x 8cm).
        • SurfaceMatchingCreateModel (hdev) - Create your own model for surface-based matching algorithm integrated into HALCON. This example comes with three models created by this program: a Pringles can (190 g), a plastic Coca-Cola bottle (0.5 l) and a Twinings tea box (~15cm x 7cm x 8cm).
        • SurfaceMatchingFindModelFromFile (hdev) - Run surface-based 3D matching algorithm using a model from file. The model used for matching is created from a reference view of the object. That model is then searched for in a newly captured 3D point cloud. This example comes with three existing object models: a Pringles can (190 g), a plastic Coca-Cola bottle (0.5 l) and a Twinings tea box (~15cm x 7cm x 8cm).
        • SurfaceMatchingFindModel (hdev) - Run surface-based 3D matching algorithm on data taken with the Zivid camera. The model used for matching is created from a reference view of the object. That model is then searched for in a newly captured 3D point cloud. This example comes with two existing object models: a Pringles can (190 g), a plastic Coca-Cola bottle (0.5 l) and a Twinings tea box (~15cm x 7cm x 8cm).
  • Procedures

    • get_first_available_zivid_device (hdev) - This procedure returns the first Zivid device from the input tuple of devices. The input tuple 'Devices' is typically returned by info_framegrabber function as follows: 'info_framegrabber ('GenICamTL','device', Information, Devices)'
    • get_zivid_sample_data_dir (hdev) - This procedure returns the path to Zivid sample data. This should be used if you want to use some of the sample data, e.g. settings in .json files.

Instructions

  1. Install Zivid Software. Note: The samples require Zivid SDK v2 (minor version 2.1 or newer).

  2. Download Zivid Sample Data.

  3. Install HALCON Software. Note: The version tested with Zivid cameras is 20.05 Progress for Windows.

  4. Launch HALCON.

  5. Open and run one of the samples. Check out how to run a HALCON sample.

Support

If you need assistance with using Zivid cameras, visit our Knowledge Base at https://help.zivid.com/ or contact us at customersuccess@zivid.com.

Licence

Zivid Samples are distributed under the BSD license.