C++ (Linux Platform)

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, the developers 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 20.04:

  1. Download Camport4 SDK

  2. Install Dependencies

  3. Compile Sample Programs

  4. 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 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 SDK Directory Structure

Camport4 SDK Directory Structure

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

Install CMake (V3.24.0)

  1. Install Cmake by inputting the following command in the terminal:

    sudo apt-get install cmake
    
  2. Check if the installation is successful by checking the version information.

    cmake --version
    

Install OpenCV (Optional)

sudo apt-get install libopencv-dev

Note

  1. Camport SDK requires users to install OpenCV 4.5.5 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.

Compile Sample Programs

Enter the camport4 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

If you only need to compile the example programs in sample_v2, then add the following parameters for cmake:

cmake .. -DBUILD_SAMPLES=off

If you need to compile the example programs in sample_v1 and sample_genicam_sfnc but not sample_v2, then add the following parameters for cmake:

cmake .. -DBUILD_CPLUSPLUS_SAMPLE=off

If you do not need to compile the example programs in sample_genicam_sfnc, then add the following parameters for cmake:

cmake .. -DBUILD_SAMPLE_GENICAM_SFNC=off

If the example program in sample_v2 does not depend on OpenCV, then add the following parameters for cmake:

cmake .. -DBUILD_SAMPLES=off -DBUILD_SAMPLE_V2_WITH_OPENCV=off

The compiled executable files will be generated in the camport4/sample/build/bin directory.

Run Sample Programs

After connecting to the computer, the depth camera will initiate system initialization. Once the power indicator on the camera begins blinking at a frequency of 1Hz, you can run the following command with root privileges to receive and view real-time depth maps.

sudo ./SimpleView_FetchFrame