Multi-camera Control using OpenNI and the S/N

Per the request of our customers, Orbbec releases the sample code to control multiple cameras:
https://www.dropbox.com/s/1sg0ownqrch7pz2/MultiDepthViewer_v1.0.zip?dl=0

Features:

  • Loop among multiple cameras based on their S/N;
  • Turn On/Off laser emitter of each camera alternatively to avoid interference;
  • Laser Turn On/Off period: 10ms

Wish you like it!

1 Like

Thanks for sharing, David!

The 10ms delay encourages me to ask the following. Letā€™s say we have two sensors, do you think it is possible turning off sensor A, grabbing one frame on B, turning off sensor B, grabbing one frame on A, etc to effectively get 10-15 FPS on each sensor without any interference at all? For how long should the laser be on in order to be able to grab a frame?

1 Like

Very interesting David but what if I have to do it from java ?
There is no getProperty() method in the java Device class.
Maybe I can try to use reflection to call the NativeMethods.oniDeviceGetā€¦ but there is no String version, just int or bool:
static native int oniDeviceGetIntProperty(long deviceHandle, int propertyId, OutArg property);
static native int oniDeviceGetBoolProperty(long deviceHandle, int propertyId, OutArg property);

Thank you

I can switch the IR sensor on and off from java using usb4java (http://usb4java.org) but Iā€™m still not able to get the S/N.
Any suggestion ?

Hi David,
thanks for the code!
Is there a way to switch the laser emitter off as long as I send ā€œlaser onā€?
Sometimes the laser turns on again after a very short time(<0.5sec), sometimes it takes a while (>5 sec).
I am running your compiled code with 2 ASTRA S(v.1.08).
Thanks for any reply!

@Vale68

you can add getProperty(string) to the Java-Wrapper and compile OpenNI yourselfā€¦

Hi David,
I would like to compile the code on Ubuntu 64 bits.
Do you know have the code with headers and libraries for Linux?

Regards,
Arturo.

I am trying to get the sensor serial number, I have 3 Orbbec Astra sensors and I get the same serial number for all three: 1307100018

Iā€™ve created a cmake file for linux users to compile this:

INCLUDE(FindPkgConfig)

project(MultiDepthViewer)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)

include_directories(src OpenNI2/include)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

pkg_check_modules(PKG REQUIRED libopenni2 libopenni)

include_directories(${PKG_INCLUDE_DIRS})
link_libraries(${PKG_LIBRARIES} -lGL -lglut)
link_directories(${PKG_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/lib)

#for openni to recognize the linux platform
add_definitions(-D__x86_64__)
add_definitions(-Dlinux)


add_executable(${PROJECT_NAME} ${SRC_LIST})

Thank you underdoeg.

I tried to compile it using this cmake, but I found the following issue:

  • libopenni and libopenni2 are not found.

I created FindOpenNI.cmake and FindOpenNI2.cmake but I was not able to locate the openni2 includes.

Finally I compiled it with NetBeans using the XnLib from the OpenNI2 github code.

I had to make some modifications to the code:

  • printf_s ā†’ printf.
  • It was not able to find the Status struct and I had to add it to the main file.

When running it with 1 camera, it works fine.
When running it with 2 cameras, I receive the following error: "Open Device ByPath Error 2bc5/0401@1/70
". I have 2 cameras with the same ID because these are old Orbbec Astra versions. Could it be the reason of the problem received?

Iā€™m on arch linux and had openni installed sytemwide with an aur. Thatā€™s why pkconfig was able to locate the library. I had to change the printf stuff as well.

I donā€™t think your problem is both devices having the same serial. The error refers their bus address and not the serial. But I might be wrong thereā€¦

Individually they work? Just not at the same time?

Updated Linkļ¼š

Is this still possible with SDK 2.0.7? The link seems to be downā€¦ :frowning: