ni-hello

Overview

This example shows how to connect to camera and get device info.

Expect Output

Name:TS800
Uri:USB#VID_2DF2&PID_0213&REV_0007&BUS_02&ADR_10
USB Product ID:531
USB Vendor ID:11762
Vendor:LIPS

Tutorial

  • Import openni packages

import org.openni.DeviceInfo;
import org.openni.OpenNI;
  • Initialize SDK

OpenNI.initialize();
  • Scan connected devices

List<DeviceInfo> devices = OpenNI.enumerateDevices();
  • Get info for each device.

for (DeviceInfo d : devices) {
    System.out.println("Name:" + d.getName());
    System.out.println("Uri" + d.getUri());
    System.out.println("USB Product ID:" + d.getUsbProductId());
    System.out.println("USB Vendor ID:" + d.getUsbVendorId());
    System.out.println("Vendor:" + d.getVendor());
}
  • Connect to the first found device

Device device = Device.open();
  • Close camera and deconstruct OpenNI SDK

device.close();
OpenNI.shutdown();

Full code

From GitHub

Last updated