Search code examples
c#intelrealsense3dcamera

Intel Real Sense C# Recording stream to a file


I am trying to use the Intel Real Sense SDK to acquire some guided frames and then I am trying to stitch them using the Intel Stitching algorithm. However, the SetFileName function is not writing the file to the directory. Can you please help?

PXCMSenseManager pp = PXCMSenseManager.CreateInstance();

RaiseMessage("Starting...");

pp.EnableFace()
pp.Enable3DScan()

if (!string.IsNullOrEmpty(StreamOutputFilename))
{
    if (File.Exists(StreamOutputFilename)) throw new Exception("File already exists");

    {
        System.Diagnostics.Debug.WriteLine(StreamOutputFilename);
        pp.QueryCaptureManager().SetFileName(StreamOutputFilename,true);

Solution

  • Please refer to the solution here

    int wmain(int argc, WCHAR* argv[]) {
    // Create a SenseManager instance
        PXCPointF32 *uvmap = 0;
        pxcCHAR *file = L"C:\\new.rssdk";
        PXCSenseManager *sm = PXCSenseManager::CreateInstance();
        // Set file recording or playback
        sm->QueryCaptureManager()->SetFileName(file, 1);
        // Select the color stream
        sm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 640, 480, 0);
        // Initialize and Record 300 frames
        sm->Init();
        for (int i = 0; i<300; i++) {
             // This function blocks until a color sample is ready
            if (sm->AcquireFrame(true)<PXC_STATUS_NO_ERROR) break;
            // Retrieve the sample
            PXCCapture::Sample *sample = sm->QuerySample();
            sm->ReleaseFrame();
        }
        // close down
        sm->Release();
        return 0;
    }