C++

Sample 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.

  • Camera

  • Applications

    • Basic

      • Visualization

      • FileFormats

        • ConvertZDF - Convert point cloud data from a ZDF file to your preferred format

        • ReadIterateZDF - Read point cloud data from a ZDF file, iterate through it, and extract individual points.

    • Advanced

      • CaptureUndistort2D - Use camera intrinsics to undistort a 2D image.

      • CreateDepthMap - Convert point cloud from a ZDF file to OpenCV format, extract depth map and visualize it.

      • Downsample - Downsample point cloud from a ZDF file.

      • GammaCorrection - Capture 2D image with gamma correction.

      • Visualization

      • Transform

      • Roi

        • ROIBoxViaArucoMarker - Filter the point cloud based on a ROI box given relative to the ArUco marker on a Zivid Calibration Board.

        • ROIBoxViaCheckerboard - Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board.

      • Stitching

      • Barcode

        • BarcodeDetector - Detect and decode linear and matrix barcodes from a 2D capture.

      • HandEyeCalibration

        • HandEyeCalibration - Perform Hand-Eye calibration.

        • PoseConversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector)

        • UtilizeHandEyeCalibration - Transform single data point or entire point cloud from camera to robot base reference frame using Hand-Eye calibration

      • MultiCamera

        • MultiCameraCalibration - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from multiple connected cameras.

        • MultiCameraCalibrationFromZDF - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from a ZDF files.

        • StitchByTransformation - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from connected cameras.

        • StitchByTransformationFromZDF - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from a ZDF files.

      • Projector

        • ProjectAndFindMarker - Show a marker using the projector, capture a set of 2D images to find the marker coordinates (2D and 3D).

        • ReadProjectAndCaptureImage - Read a 2D image from file and project it using the camera projector.

        • ReprojectPoints - Illuminate checkerboard (Zivid Calibration Board) centers by getting the checkerboard feature points

Instructions

  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 to 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 to 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