Open and get color frame in two separate processes


I think that’s not possible but I’d like to know if there is a way to get color frame from the same Orbbec in two seperate processes ? With Astra SDK or OpenNI or Opencv


I know it’s possible with OpenNI to get data from the same Astra in two different threads. I would imagine it’s possible to do from multiple processes, but I haven’t actually tried this.

My advice would be to to make a simple test program and try launching it twice and seeing what happens.

I have already tried to get the data from two processes with openni and astra sdk but with the normal way to do it :

  • With openni : == openni::STATUS_OK is a succes in the first process but fail in the second one
  • With Astra sdk : reader.get_latest_frame() return an empty frame in the second process

When you say in two different thread, did you mean by sharing the device object ?

In my implementation I have a class called OrbbecCamera that encapsulates all of the OpenNI functionality. Each instance of OrbbecCamera has its own OpenNI.Device instance, created with Device.Open(deviceURI).

If I create two instances of OrbbecCamera in different threads, both pointed to the same underlying device URI, they both successfully grab frames from the same camera.

I’m working in C# for .NET 4.5.2, using the NiWrapper.Net wrapper available through NuGet in Visual Studio. It’s possible that the wrapper library has some internal device sharing; I haven’t looked into the code for the wrapper itself.

@chrisib… Its not working. It shows “Failed to set USB interface” error.

How to achieve this ?

Did you copy the Astra OpenNI drivers to the OpenNI2/Drivers directory?

@chrisib. Thanks for your reply.

I have downloaded Orbbec OpenNI SDK from this link : Develop – Orbbec

I need to access color stream from one application and depth stream from another application simultaneously.
When tried to run both applications, it shows “Failed to set USB interface error”.

Is it i can access the device by only one application at a time ?

I just tried running two instances of my OpenNI+OpenCV application (written in C# for .NET 4.5.2) and it appeared to work. The FPS was very low, and the two instances seemed to bounce back and forth as to which was getting data (process A would get a few frames, then process B would get some, then A again, then B, and so on…), but there weren’t any errors like you describe.

Honestly, I’m not sure what else to suggest.

I would maybe look at at a shared memory block approach.

Set up a server application that runs the connection of the ORBBEC.
In that application setup some shared memory blocks that you can map the depth and image data to each frame.
Then in your individual applications subscribe to those memory blocks.
You will need to setup some semaphore / blocking to manage timing of the frames.