Skip to content

Repository files navigation

C++ samples

This repository contains cpp code samples for Zivid SDK v2.18.0. For tested compatibility with earlier SDK versions, please check out accompanying releases.

image


Contents: Tutorials | Samples | Installation | Support | License | Development


Tutorials list

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.

Installation

  1. Install Zivid Software
  2. Download Zivid Sample Data

Windows

Launch the Command Prompt by pressing Win + R keys on the keyboard, then type cmd and press Enter.

Navigate to a location where you want to clone the repository, then run the following command:

git clone https://github.com/zivid/zivid-cpp-samples

Configure the sample solution with CMake, open it in Visual Studio, build it, run it. For more information see Configure C++ Samples With CMake and Build Them in Visual Studio in Windows.

Ubuntu

Open the Terminal by pressing Ctrl + Alt + T keys on the keyboard.

Navigate to a location where you want to clone the repository, then run the following command:

git clone https://github.com/zivid/zivid-cpp-samples
cd zivid-cpp-samples

Build the project:

mkdir build
cd build
cmake <options, see below> ../source
cmake --build .

Some of the samples depend on external libraries, in particular Eigen 3, OpenCV, PCL or HALCON. If you don't want to install those, you can disable the samples depending on them by passing the following options, respectively, to cmake: -DUSE_EIGEN3=OFF, -DUSE_OPENCV=OFF, -DUSE_PCL=OFF, -DUSE_HALCON=OFF.

See Configure C++ Samples With Optional Dependencies for instructions on how to install the optional dependencies and configure the samples to use them.

The samples can now be run from the build directory, for instance like this:

./CaptureFromFileCameraVis3D

HALCON

Zivid offers two ways of interfacing with HALCON:

  1. Through the Zivid SDK, utilizing the C++/C# libraries available for HALCON. We provide samples for both C++ and C#. (Recommended)
  2. Directly through a GenICam GenTL producer that comes with the Zivid Software.

Zivid and HALCON are compatible with Windows 10 and 11, and Ubuntu 20.04, 22.04, 24.04, 26.04.


Note:

Support for Ubuntu 18.04 is removed since SDK 2.10.


To set up and use Zivid in one of these operating systems, please follow their respective instructions on the following pages:

The following HALCON versions have been tested and confirmed to work with Zivid cameras:

  • 19.05 Progress, 20.05 Progress, 21.11 Progress, 24.05 Progress, 24.11 Progress-Steady, 25.05 Progress, 25.11 Progress, 26.05 Progress

We recommend using one of the HALCON versions we have tested.

Support

For more information about the Zivid cameras, please visit our Knowledge Base. If you run into any issues please check out Troubleshooting.

License

Zivid Samples are distributed under the BSD license.

Development

To run continuous integration locally, use Docker. With Docker installed, run this command:

docker run -it -v <unix-style-repo-path>:/host -w /host/continuous-integration/linux ubuntu:20.04

Where <unix-style-repo-path> is the unix-style path to the repo on your computer. On Linux, use $PWD for this. On Windows you need to translate the windows-style path to a unix-style one (e.g. /c/Users/alice/Documents/zivid-cpp-samples).

Now run ./setup.sh to install dependencies. Once setup has completed, you can run ./lint.sh && ./build.sh repeatedly to check your code.


Tip:

If your build hangs, try to increase the memory available to Docker.

About

Code samples for the usage of a Zivid 3D camera in C++

Topics

Resources

Stars

27 stars

Watchers

7 watching

Forks

Releases

Used by

Contributors

Languages