I need to capture an RGB color image from a Kinnect camera, but I want to show it in OpenCV, as this is only part of a larger program. I know that OpenCV is compatible with OpenNI, if you set the flag, but although I tried, CMake could not find the path to OpenNI2, so I could not create OpenCV with OpenNI. In any case, I think itβs good to know how to manually convert OpenNI frameworks to openCV frameworks, so I decided to follow this path.
To capture a color frame in OpenNI, I tried the following:
openni::Device device; openni::VideoStream color; openni::VideoFrameRef colorFrame; rc = openni::OpenNI::initialize(); rc = device.open(openni::ANY_DEVICE); rc = color.create(device, openni::SENSOR_COLOR); rc = color.start(); color.readFrame(&colorFrame); const openni::RGB888Pixel* imageBuffer = (const openni::RGB888Pixel*)colorFrame.getData();
But now I do not understand how to do the conversion in cv :: Mat.
Has anyone anyone managed to do this?
opencv rgb kinect simple-openni
vgonisanz
source share