I'm working on Intel RealSense SDK (R2). I want to save the image from Camera_viewer. I have worked till saving the frame to specific buffers and retrieving from the same. I want to know how to save those frames/images to a specified location/folder.
Here's my code:
PXCImage *colorIm, *depthIm;
for (int i=0; i<MAX_FRAMES; i++) {
// This function blocks until all streams are ready (depth and color)
// if false streams will be unaligned
if (psm->AcquireFrame(true)<PXC_STATUS_NO_ERROR) break;
// retrieve all available image samples
PXCCapture::Sample *sample = psm->QuerySample();
// retrieve the image or frame by type from the sample
colorIm = sample->color;
depthIm = sample->depth;
// render the frame
if (!renderColor->RenderFrame(colorIm)) break;
if (!renderDepth->RenderFrame(depthIm)) break;
// release or unlock the current frame to fetch the next frame
psm->ReleaseFrame();
}
I'm able to retrieve the frames/images successfully, but I want to save those files for further use. So I want to know how to save those files in a folder.
Thanks in advance
Same question was asked here and the answer that was posted solved the initial question. However there was a follow-up question on how to save the images to specific folder.
If you have that specific question, then answer would be the same
SetFileName()
only. According to this link,pxcCHAR *file is the full path of the file to playback or to be recorded.
. That being said, you can create a custom folder and point your path to thatcustom folder
followed by a valid file name to save your image.To save the data I would create a Bitmap from the image data as ThorngardSO said and use the code from http://www.runicsoft.com/bmp.cpp to save it -
This can then be subsequently loaded using more code from the same link -
You can then load those bitmap files at a later date using the code from Intel https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/manuals_image_and_audio_data.html -
Using these three sets of code you should easily be able to save Bitmaps in any specified folder using WriteFile then, once loaded you can convert the bitmap back into ImageData.
Let me know how it goes.