AStra Pro Color image

Hello
I have been trying to get the color image stream from the Astra pro. According to other posts:

compatibility-astra-pro-and-openni2
problem-with-rgb-camera-on-astra-pro

the RGB image of the Astra pro can not be accessed neither via the SDK nor with OpenNI… has someone been able to do it in some way? or is the camera of the sensor “useless” until we get the support for the Astra SDK? I’m feeling kind of disappointed right now…

Thnx

Hi @JuanDavid25,

You can use OpenCV to retrieve the RGB image.
Here is a straightforward code to retrieve color image from a camera with UVC video class:

#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace std;
using namespace cv;

/**

  • @function main
    */
    using namespace cv;

int main(int argc, const char** argv)
{
CvCapture* capture;
IplImage* frame = 0;

while (true)
{
VideoCapture cap(1); // open the default camera
if (!cap.isOpened()) // check if we succeeded
return -1;
Mat edges;
namedWindow(“Frame”, 1);
for (;:wink:
{
Mat frame;
cap >> frame; // get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);
imshow(“Frame”, frame);
if (waitKey(30) >= 0) break;

  }
  // the camera will be deinitialized automatically in VideoCapture destructor
  return 0;

}

// clean up and release resources
cvReleaseImage(&frame);
return 0;
}

You will need to install and set OpenCV up before which is could be complicated sometimes.

Hope this helps,

Victor

2 Likes

Thanks Victor I will try using opencv then :+1:

If on Linux it’s easy to use the Video4Linux API. The v4l2grab.c example works out of the box: https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/v4l2grab.c.html

By far seems it is good way to capture the rgb image, but I found that the captured rgb image through opencv has a 0.8s ahead of the depth image captured at the same instant.