Linux platform (C++)

Linux SDK supports AArch64, ARMv7hf, RaspberryPi, i686 and x86-64 hardware platforms, and provides corresponding library files for developers to compile programs. Linux SDK does not provide executable applications, you can generate executable applications by compiling sample programs.

The following is an example of setting up the development environment for Percipio depth camera on Linux platform, using Ubuntu 18.04:

  1. Downloading Camport3 SDK

  2. Installing USB driver

  3. Installing dependencies

  4. Setting permissions

  5. Compiling sample programs

  6. Running

Downloading Camport3 SDK

Choose any of the following methods to download Camport3 SDK:

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

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

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

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

Camport3 SDK目录结构

Camport3 SDK directory structure

Doc directory

It stores the SDK API reference documentation. The documentation is a PDF file 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 interfaces.

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

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

lib/linux directory

It stores library files which support the 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.

sample directory

It stores sample programs for user programming reference. For more information about the sample programs, please refer to Sample program instructions.

Installing USB driver

The Camport SDK uses LibUSB as the user-space driver library for the USB depth camera by default. LibUSB software needs to be installed before using the Percipio USB depth camera.

sudo apt-get install libusb-1.0-0-dev

Installing dependencies

CMake

CMake is a powerful, cross-platform tool tailored for software compilation. It streamlines the build process by enabling developers to define the build procedure in a platform-agnostic way through straightforward statements. CMake is capable of producing a range of makefiles or project files, facilitating the testing of C++ features supported by the compiler, akin to automake in UNIX environments. Notably, CMake’s configuration file is distinctively named CMakeLists.txt. Unlike directly assembling the final software, CMake’s primary role is to generate standardized build files, such as Makefiles for UNIX or projects/workspaces for Windows Visual C++, which are subsequently compiled using alternative tools.

The Camport SDK utilizes CMake to build standard projects. By harnessing the native build systems’ capabilities across different platforms, it can seamlessly adapt to a wide range of platform environments.

sudo apt-get install cmake

Note

Camport SDK requires users to install CMake 2.8.0 or higher versions.

OpenCV

The Camport SDK utilizes the OpenCV image processing library to render depth data transmitted from a Percipio depth camera. Prior to compiling the sample program, ensure the OpenCV image processing software library is installed.

sudo apt-get install libopencv-dev

Note

  1. Camport SDK requires users to install OpenCV 2.4.8 or higher versions.

  2. If the target application does not use OpenCV for image display or other image processing calculations, there is no need to install OpenCV.

Setting permissions

According to the permission management mechanism of Linux system, by default, root permission is required to access the Percipio USB depth camera. Non-root users can create a udev rule to modify the device permissions.

In the directory where the etc/udev/rules.d file is located, create a rule file with the extension .rules (such as 88-tyusb.rules), and add the user to the group specified in the file (such as: tofu). After rebooting the PC, you will have access to the USB depth camera. The content of the rule file is as follows:

SUBSYSTEM== "usb",ATTRS{idProduct}=="1003",ATTRS{idVendor}=="04b4",GROUP="tofu",MODE="0666"

Note

The beginning of the rule file name must be a number (0 ~ 99), the larger the number, the higher the priority. Accessing the Percipio network depth camera does not require root permission.

Compiling sample programs

Enter the camport3 directory and execute the following command to compile the sample programs.

sudo cp lib/linux/lib_x64/libtycam.so* /usr/lib/
cd sample
mkdir build
cd build
cmake ..
make

Several compiled executable files will be generated in the camport3/sample/build/bin directory.

Running

After connecting to the computer, the depth camera starts system initialization until the Power light on the back of the camera blinks at a frequency of 1Hz. After initialization, run the following command with root privileges to capture images.

sudo ./SimpleView_FetchFrame