如何在英特尔实感中保存图像(Visual C++)

Som*_*One 15 c++ visual-studio-2012 realsense

我正在研究英特尔实感SDK(R2).我想从Camera_viewer保存图像.我一直在努力将帧保存到特定缓冲区并从中检索.我想知道如何将这些帧/图像保存到指定的位置/文件夹.

这是我的代码:

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();
}
Run Code Online (Sandbox Code Playgroud)

我能够成功检索帧/图像,但我想保存这些文件以供进一步使用.所以我想知道如何将这些文件保存在文件夹中.

提前致谢

ksp*_*swa 4

这里提出了同样的问题,发布的答案解决了最初的问题。然而,后续问题是如何将图像保存到特定文件夹。

如果您有这个具体问题,那么答案将是相同的SetFileName()。根据此链接pxcCHAR *file is the full path of the file to playback or to be recorded.. 话虽这么说,您可以创建一个自定义文件夹,并将路径指向该文件夹,custom folder后跟有效的文件名来保存图像。