Infrared Stream - Astra PRO

Good morning everyone,

I have already asked this question on another topic but I guess it would be a good idea to open a new Topic on it.

I am using Astra Pro camera on Windows 64 bit OS. I know, currently, only Depth stream is accessible through OpenNi. Color Stream is available through UVC class which might be read with OpenCV for example.

I would like to get access to IR stream. Does anyone have a clue to do that ?

Thanks,
Victor

Hi @Victor,

This will work on Astra - don’t know if it works on Pro version.

Download the OpenNI-2-Window-X86-Orbbec3D from Orbbec website.

Unzip and navigate to \OpenNI2\Tools. Run NiViewer.exe.
I can view RGB& depth straight away. If you like to view infrared, then right click on NiViewer window: Device>Streams>Colour>On/Off. That will turn off colour.

To turn on infrared, right click on NiViewer window: Device>Streams>IR>On/Off. Then right click on NiViewer window: Device>Streams>IR>Video Mode and select any resolution that is 640x480 or 1280x1024.

Let me know if that works.

Cheers

George

Hi @gmast,

Thanks for your help on this.

It works fine, I was able to see the IR stream.
My mistake, I was talking about coding this stream like :

openni::Status state = openni::STATUS_OK;
state = openni::OpenNI::initialize();
if (state == openni::STATUS_ERROR)
std::cout << openni::OpenNI::getExtendedError();

openni::Arrayopenni::DeviceInfo* DeviceList = new openni::Arrayopenni::DeviceInfo;
openni::OpenNI::enumerateDevices(DeviceList);

openni::Device Device;
openni::VideoStream IRStream;

//const char* URI = openni::ANY_DEVICE;
state = Device.open(openni::ANY_DEVICE);
if (state == openni::STATUS_OK)
{
state = IRStream.create(Device, openni::SENSOR_IR);
if (state == openni::STATUS_OK)
{
state = IRStream.start();

  	if (state == openni::STATUS_OK)
  	{
  		openni::VideoFrameRef Frame;
  		state = IRStream.readFrame(&Frame);
  		if (state == openni::STATUS_OK)
  		{
  			std::cout << "Get an Image" << std::endl;
  		}
  	}
  }

}

EDIT: This runs fine but it does not go further than “readFrame(&Frame)”. It is still waiting an image event… I may forget to compute a control there.

1 Like

@josh Do you have any information, clue or chunk of line code which could help me with this.
It should be quite straightforward to read frame from the IR sensor but, seemingly I am not able to do it …

@Victor It should be possible to access IR with Astra Pro. I asked our team to post some sample code for this. They should in a few days.

@Victor I just confirmed that in Astra SDK v0.4, with Astra Pro, if you run the SimpleStreamViewer-SFML sample, it will initially show just a blank window*. But if you then press ‘i’ to switch to infrared view, you should see it. You can look at the SimpleStreamViewer source code to see how it accesses infrared.

When coding this in your app, for both Astra SDK and OpenNI, make sure in your code to set the resolution of the infrared stream to 640x480 or 1280x1024.

  • It is blank because it’s waiting for a matching color frame for the depth frames, and currently Astra Pro color isn’t supported with the SDK. If you run SimpleDepthViewer-SFML it will show Astra Pro depth.

Hi josh,

Thanks for your reply.

I was able to get a frame with OpenNi by modifying the lines below within the “Orbecc.ini” file :

[IR]
; Output format. 200 - RGB888, 203 - Grayscale 16-bit (default)
OutputFormat=203
; 0 - QVGA (default), 1 - VGA, 2 - SXGA(1.3MP)
Resolution=1

But this solution is not really usable since you need to have a specific wrapper to get the data out.
@josh is there any link between this file and OpenNi way of working ? I mean in others examples those lines are commented (with "; ") before …

Then, I used the Astra Pro SDK as in the example and … it works !

My Mistake: The resolution was not set properly i believe.

Thanks

You can also set the IR (and other streams) resolution in code in OpenNI. Check the OpenNI2 samples or dev guide. The orbbec.ini just specifies the default when the app loads.

It was my thought.

Thank you anyway, I am happy to understand. :slightly_smiling: