Python (Windows)

Sample Program Overview

The Python sample programs are located at {VCAMERA_SDK_INSTALLATION_PATH}/Percipio_SDK/API/python/python and include:

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

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

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

  • SoftTrigger.py: Configures the camera to operate in software trigger mode. The camera captures depth images after receiving a software trigger command.

  • version.py: Displays the current SDK version.

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

  • DumpDeviceInfo.py: Lists camera information.

  • ReadWriteFeatures.py: Lists all readable or writable features supported by the camera.

  • SetIpAddress.py: Sets the camera IP address to static.

  • UserSetSelector.py: Selects a camera user set.

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

  • DepthToPointCloud.py: Aligns the depth image and point cloud output by the camera.

  • SaveLoadFeaturesViaFile.py: Saves and loads camera features.

Install Dependencies

Dependency 1 — Python

Note

The recommended Python version is 3.8. Other versions are not tested and the compatibility is not guaranteed.

  1. Download the specified version from the Python Official Website.

  2. Double-click the installer, check the box for “Add Python to PATH”, and click “Install Now”.

    ../_images/python-load.png

    Python Installation

Dependency 2 — CMake

Note

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

  1. Download the Windows installer from the CMake Official Website.

  2. Double-click the downloaded .msi file and follow the wizard to complete the installation. Important: Select the option “Add CMake to PATH” during the installation process.

Configure CMake Environment

CMake Environment Configuration

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

    cmake --version
    

Dependency 3 — 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 .

Dependency 4 — OpenCV

pip install opencv-python

Compile Sample Programs

  1. In the directory {VCAMERA_SDK_INSTALLATION_PATH}/Percipio_SDK/API/python, create a new folder named build.

  2. Launch cmake-gui.

  3. Set the source code directory to “python” and the build output directory to “python/build”.

    Configure Python Source and Build Directories
  4. Click the Configure button, select the appropriate Visual Studio version, then click Finish.

    Configure CMake Generator for Python
  5. Click the Generate button.

    Generate Visual Studio Solution for Python
  6. Click the Open Project button to open the generated project in Visual Studio.

    Open Python Project in Visual Studio
  7. In Visual Studio, select the “Release x64” configuration from the dropdown menu, then navigate to Build > Build Solution.

    Build Python Solution in Visual Studio

Execution

  1. Copy all files from the Percipio_SDK/API/python/build/Release directory to the Percipio_SDK/API/python/python directory.

  2. Copy the dynamic library files (all files except the .exe executables) from the Percipio_SDK/API/cpp/Release/bin directory to the Percipio_SDK/API/python/python/TyLibrary directory.

  3. Open a terminal in the Percipio_SDK/API/python/python directory and run the sample programs.

    Execute Python Sample Program