Internal - LIPS Developer Documentation
  • WELCOME
    • LIPS® Developer Documentation
  • INSTALLATION & SETUP
    • LIPSedge™ AE400 / AE450
      • SDK Release
        • Firmware
        • SDK
        • User Guide
      • Installation
        • Linux
        • Windows
        • ROS Wrapper
        • NVIDIA ISAAC Wrapper
    • LIPSedge™ AE430 / AE470
      • Installation
        • Linux
        • Windows
    • LIPSedge™ DL & M3 Series
      • SDK Release
      • Installation
        • Ubuntu
        • Windows
    • LIPSFace™ HW110/115 On-Device 3D Facial Recognition
      • User Guide & SDK Download
    • LIPSFace™ HW120/125 On-Device 3D Facial Recognition
    • LIPSMetric™ HA110 Handheld Dimensioner
      • User Guide
    • LIPSMetric™ ST115 Static Dimensioner
      • User Manual
  • SDK CODE SAMPLES AND LANGUAGES WRAPPERS
    • LIPSedge™ SDK
      • Sample Applications & Viewer & Utilities
      • C++
        • ni-hello
        • ni-simple-read
      • Python
        • ni-hello
        • ni-simple-read
      • Java
        • ni-hello
      • C#
      • OpenCV
      • ROS
    • LIPSFace™ SDK
      • LIPSFace™ SDK Overview
      • LIPSFace™ SDK Developer Guide
Powered by GitBook
On this page
  • Examples
  • Prerequisite
  • Linux:
  • Windows:
  • Create new CMake Project
  • Build
  • Linux
  • Windows
  • Expect output
  1. SDK CODE SAMPLES AND LANGUAGES WRAPPERS
  2. LIPSedge™ SDK

C++

PreviousSample Applications & Viewer & UtilitiesNextni-hello

Last updated 2 years ago

Examples

Name
Description

Demonstrates the basics of OpenNI2 usage

Read the distance in the center point

Prerequisite

Install cmake and opencv.

Linux:

sudo apt install cmake build-essential
sudo apt install libopencv-dev

Windows:

Install , and (we use VS2019).

Create new CMake Project

Create two files, example.cpp and CMakeLists.txt with following content.

# CMakeLists.txt
cmake_minimum_required(VERSION 3.3)

project( example CXX )

if(MSVC)
    include_directories("C:/Program Files/OpenNI2/Include")
    link_directories("C:/Program Files/OpenNI2/Lib")
endif()


add_executable( ${PROJECT_NAME} project.cpp )

find_package(OpenCV)

target_link_libraries(${PROJECT_NAME} OpenNI2)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
// project_setup.cpp
#include <openni2/OpenNI.h>
#include <opencv2/core/core.hpp>

int main()
{
    auto version = new openni::Version();
    printf("OpenNI Version:%d.%d.%d.%d\n", version->build, version->major, version->minor, version->maintenance);

    printf("OpenCV Version:%s\n", CV_VERSION);
    return 0;
}

Build

Linux

Create a build folder next to CMakeLists.txt. Change directory to build folder. Use cmake to generate build files. Then use make to build.

mkdir build
cd build
cmake ..
make

Windows

1. Open Visual Studio and create a new project

2. Create a new cmake project

3. Modify CMakeLists.txt and project_setup.cpp

Expect output

OpenNI Version:0.0.0.0
OpenCV Version:4.2.0.4.2.0

cmake
OpenCV
Visual Studio
ni-hello
ni-simple-read