C++ (Windows Platform)

Windows SDK supports X86 (32-bit) and X64 (64-bit) hardware platforms, and provides driver files for Windows 7 and above operating systems. Windows SDK includes some executable applications (such as viewing depth maps) and sample programs for some applications.

The following is an example of setting up the development environment for Percipio depth camera on Windows platform, using Windows 10 64-bit system:

  1. Download Camport4 SDK

  2. Install Dependencies

  3. Option: Install USB Driver

  4. Compile Sample Programs

  5. Run Sample Programs

Download Camport4 SDK

Choose any of the following methods to download Camport4 SDK :

  • Access https://github.com/percipioxyz/camport4.git using a browser and download the Camport4 SDK.

  • Use the git command to obtain a local copy: Open the terminal, switch to the working directory where the SDK should be stored, and enter the git clone command to clone the remote repository.

    git clone https://github.com/percipioxyz/camport4.git
    

The directory structure of Camport4 SDK is shown in the following figure:

camport4
├── 📁 Doc/
├── 📁 include/
├── 📁 lib/
├── 📁 sample/
├── 📝 git_version
├── 📄 LICENSE
├── 📘 README.md
├── ⚙️ TYCamConfig.cmake
└── 🗜️ usb_driver.zip

Doc Directory

It stores the SDK API reference documentation. The documentation is generated by Doxygen and includes descriptive information about classes, structures and interfaces.

include Directory

It stores the header files used to call dynamic libraries:

  • TYImageProc.h: the header file for the image post-processing function APIs.

  • TYCoordinateMapper.h: the header file for mapping of image space transformation.

  • TY_API.h: the header file for configuring the depth camera and obtaining image data. Users can develop their own applications based on these APIs.

  • TYVer.h: the header file for retrieving SDK version information.

  • TYParameter.h: the header file for the GenICam standard APIs.

  • TYDefs.h: the header file for Camport SDK data types.

lib/linux Directory

It stores library files which support Linux operating system and are compatible with AArch64, ARMv7hf, RaspberryPi, i686 and x86-64 hardware platforms.

lib/win Directory

It stores library files which support the Windows operating system and are compatible with x64 and x86 hardware platforms. Additionally, it also stores USB driver related files.

sample Directory

It contains subfolders including cloud_viewer, common, sample_v1, sample_v2 and sample_genicam_sfnc, where sample_v1, sample_v2 and sample_genicam_sfnc include sample programs provided for users to refer to when programming. For more details about the sample programs, please refer to Sample Program Descriptions.

Install Dependencies

Install CMake

Note

The recommended CMake versions are 3.17.1, 3.24.0 and 3.24.4. Other versions are untested, and their compatibility cannot be 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
    

Install Visual Studio

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

Install OpenCV (Optional)

Note

  1. If your application doesn’t require OpenCV’s image processing, you can skip its installation. To handle image display, a streamlined approach is to use the CImg library with the native Windows GDI interface.

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

  1. Visit the OpenCV Official Website and download the Windows pre-built library.

  2. Double-click the downloaded .exe file to extract the contents, noting the extraction path.

  3. After extraction, configure the OpenCV library path in the system environment variables.

    Detailed steps: Access the Environment Variables dialog box, select the “Path” entry, and click Edit. In the Edit Environment Variables dialog box, add the OpenCV library path.

    wincompilestep4

    OpenCV Environment Configuration

Install USB Driver (Optional)

To use the USB camera, you need to install the USB driver.

Installation Steps for New USB cameras

  1. Extract the usb_driver.zip archive located in “Camport4/lib/win/driver”.

  2. Double-click install.bat to complete the installation.

Installation Steps for New USB cameras

When you are using a USB camera, installing the USB driver is necessary for compiling and running the Camport SDK.

  1. After connecting the Percipio depth camera to a Windows PC using a USB cable, right-click on the Start in the bottom left corner of the desktop and click on Device Manager in the Start menu. In Device Manager, an unrecognized USB device PERCIPIO DEVICEEE can be found, as shown in the following image:

    Unrecognized USB Device

    Unrecognized USB Device

  2. Right-click on the device and select Update driver. Choose the driver from the “lib/win/driver” directory in the Camport3 SDK according to the Windows version of your PC, and follow the system prompts to complete the driver installation.

    Camport3 Device Driver

    Camport3 Device Driver

After successful installation of the driver, you can find the Percipio Device in the Device Manager.

Percipio Device

Percipio Device

Compile Sample Programs

  1. Create a directory named build in the SDK sample directory.

  2. Start cmake-gui.

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

    sdk4compilestep1
  4. Click on Configure, select your version of Visual Studio, and click on Finish.

    wincompilestep2

    Note

    The following error will appear after clicking Finish .

    sdk4compileerror1.png

    Set TYCam_DIR to the path of TYCamConfig.cmake (usually located in the SDK root directory).

    sdk4compilestep2
  5. Configuring the BUILD_SAMPLE_WITH_GUI option.

    • To enable image display, check the BUILD_SAMPLE_WITH_GUI (this is the default setting). During compilation, the system will proceed in the following order:

      1. It will first search for and use a locally installed OpenCV library for image display.

      2. If OpenCV is not found, it will directly use the more lightweight Windows-native CImg library in conjunction with the GDI interface to achieve image display.

    • To disable image display, uncheck the BUILD_SAMPLE_WITH_GUI.

    wincompilestep3
  6. Check BUILD_SAMPLE_GENICAM_SFNC, BUILD_SAMPLE_V1 and BUILD_SAMPLE_V2, then click Configure.

    To run the application in sample/sample_v2 with OpenCV image display support, check BUILD_SAMPLE_V2_WITH_OPENCV as well.

    sdk4compilestep5
  7. Click on Configure

    sdk4compilestep3
  8. Click on Generate.

    sdk4compilestep5
  9. Click on Open Project to open the project in Visual Studio.

    sdk4compilestep6-en

    Note

    Afterwards, the project can be opened with the Project.sln or ALL_BUILD.vcxproj file in the Camport4/sample/build folder.

  10. Build Project: In Visual Studio Tool Bar, change the solution configuration to “Release” mode. In the Visual Studio menu bar, click on Build> Build Solution.

    sdk4compilestep6-en
    wincompilestep7-en

Run Sample Programs

After connecting the depth camera to the computer, it will begin system initialization. Once the power indicator light stabilizes to a steady 1-second on, 1-second off blinking pattern, you can launch the executable file to retrieve depth maps:

  • For Windows10 X64 OS, run the executable file lib/win/hostapp/x64/sample_trigger.exe in the SDK package, then select “Continuous” mode to obtain depth maps.

  • Copy tycam.dll and tyimgproc.dll from the lib/win/hostapp/x64 directory to the build output folder (sample/build/bin/Release). Run sample_trigger.exe in this folder and select “Continuous” mode to obtain depth maps.