Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving the stream using Intel RealSense

I'm new to Intel RealSense. I want to learn how to save the color and depth streams to bitmap. I'm using C++ as my language. I have learned that there is a function ToBitmap(), but it can be used for C#.

So I wanted to know is there any method or any function that will help me in saving the streams.

Thanks in advance.

like image 714
varsha_holla Avatar asked Oct 19 '22 03:10

varsha_holla


1 Answers

I'm also working my way through this, It seems that the only option is to do it manually. We need to get ImageData from PXCImage. The actual data is stored in ImageData.planes but I still don't understand how it's organized.

https://software.intel.com/en-us/articles/dipping-into-the-intel-realsense-raw-data-stream?language=en Here you can find example of getting depth data. But I still have no idea what is pitches and how data inside planes is organized.

Here: https://software.intel.com/en-us/forums/intel-perceptual-computing-sdk/topic/332718 kind of backwards process is described.

I would be glad if you will be able to get some insight from this information. And I obviously would be glad if you've discovered some insight you can share :).

UPD: Here is something that looks like what we need, I haven't worked with it yet, but it sheds some light on internal organization of planes[0] https://software.intel.com/en-us/forums/intel-perceptual-computing-sdk/topic/514663

UPD2: To add some completeness to the answer: You then can create GDI+ image from data in ImageData:

auto colorData = PXCImage::ImageData();

if (image->AcquireAccess(PXCImage::ACCESS_READ, PXCImage::PIXEL_FORMAT_RGB24, &colorData) >= PXC_STATUS_NO_ERROR) {
    auto colorInfo = image->QueryInfo();
    auto colorPitch = colorData.pitches[0] / sizeof(pxcBYTE);
    Gdiplus::Bitmap tBitMap(colorInfo.width, colorInfo.height, colorPitch, PixelFormat24bppRGB, baseColorAddress);
}

And Bitmap is subclass of Image (https://msdn.microsoft.com/en-us/library/windows/desktop/ms534462(v=vs.85).aspx). You can save Image to file in different formats.

like image 138
Stvad Avatar answered Jan 04 '23 07:01

Stvad