C++ (Windows)

Sample Program Overview

The C++ sample programs are located at {VCAMERA_SDK_INSTALLATION_PATH}/Percipio_SDK/API/cpp/example and include:

  • ConnectByIpAddress.cpp: Opens a network camera using its IP address.

  • DepthToColorRegistration.cpp: Aligns the depth images with color images output by the camera.

  • DepthToPointCloud.cpp: Aligns depth images with point cloud images output by the camera.

  • DumpAllFeatures.cpp: Lists all features supported by the camera.

  • DumpDeviceInfo.cpp: Lists camera information.

  • FetchFrame.cpp: Configures the camera to operate in continuous capture mode and capture depth images.

  • ListDevices.cpp: Lists all cameras connected to the computer.

  • ReadWriteFeatures.cpp: Demonstrates reading and writing of the camera features.

  • SetIpAddress.cpp: Sets camera IP to static.

  • SetUndistortion.cpp: Configures the camera to operate in software trigger mode. Upon receiving a software trigger command, the camera captures and outputs a distortion-corrected left grayscale image and an uncorrected color image. All output images are automatically saved to the same directory as the executable. Simultaneously, the terminal displays and compares their distortion parameters.

  • SoftTrigger.cpp: Configures the camera to operate in software trigger mode; after receiving a software trigger command, the camera captures and outputs a depth image.

  • UserSetSelector.cpp: Selects a camera user set.

  • LogConfig.cpp: Configures the dual logging system for both the Vcamera SDK software and the camera hardware.

  • FullExample1.cpp: Configures the camera to operate in software trigger mode and performs real-time conversion of depth data into 3D point clouds.

Install Dependencies

Dependency 1 — CMake

Note

The recommended OpenCV version is 3.25. Other versions are not tested and the compatibility is not guaranteed.

  1. Download Windows installation package from CMake Official Website .

  2. Double click the downloaded .msi installer file and follow the wizard to complete the installation. Important: Select the option “Add CMake to PATH” during the installation process to configure system environment variables automatically.

Cmake-configuration

CMake Environment Configuration

  1. Open Command Prompt and execute the following command to validate installation success by checking the version information:

    cmake --version
    

Dependency 2 — Visual Studio

Note

The recommended Visual Studio version is 2022. Other versions are not tested and the compatibility is not guaranteed.

Download and install Visual Studio. Important: During installation, select the Desktop development with C++ workload under the Desktop and Mobile Applications category.

vs-install

Install Visual Studio

Compile Sample Programs

  1. Create a folder named build in the directory {VCAMERA_SDK_INSTALLATION_PATH}/Percipio_SDK/API/cpp/example .

  2. Launch cmake-gui.

  3. Specify the source code directory as “example” and the output directory for compilation as “example/build”.

    vcamera-compile-dir
  4. Click Configure, select the Visual Studio version, and click Finish.

    vcamera-compile-configure
  5. Click Generate.

    vcamera-compile-generate
  6. Click Open Project to open the project.

    vcamera-compile-openpro
  7. Select “Release x64”, then click “Build” > “Build Solution”.

    vcamera-compile-end

Execution

After compilation is complete, copy the dynamic library files (all files except the executable .exe) from Percipio_SDK/API/cpp/Release/bin to Percipio_SDK/API/cpp/example/build/Release, then run the programs.

vcamera-compile-end