Software Archive
Read-only legacy content

SetFileName is not recording depth stream

varsha_h_
Beginner
774 Views

I'm using SetFileName() function for recording the depth stream. I have followed every thing mentioned in the documentation. Still I'm not able to save the depth streams to the specified file location. 

Here's what I have tried so far:

void RecordORPlayback(pxcCHAR *file, bool record){
    // create a sensemanager instance

    //set file record or playback
    sm->QueryCaptureManager()->SetFileName(file,record);

    //Enable the stream

    PXCImage *depthIm;


    //initialize and record 300 frames
    sm->Init();
    for(int i =0; i<300;i++){
        //this function blocks until a depth sample is ready
        if(sm->AcquireFrame(true)<PXC_STATUS_NO_ERROR) break;

        //retrieve the sample
        PXCCapture::Sample *sample=sm->QuerySample();

        //work on the image sample->depth
        depthIm=sample->depth;

        //fetching the next frame/sample
        sm->ReleaseFrame();
    }
    //closing
    sm->Release();
}

In main function I have called the 'RecordORPlayback' like: 

    pxcCHAR *filename=(L"E:\\Output");
    RecordORPlayback(filename,true);

Still I'm not able to save the output(correct me if I'm wrong). Is there any other way to store the frames to a specified location? 

 

 

0 Kudos
2 Replies
Ron_S_Intel
Employee
774 Views

Hi

In order to enable depth stream you should explicitly enable it using PXCSenseManager->EnableStream
I have updated your code below (line 13 under //Enable the stream)

void RecordORPlayback(pxcCHAR *file, bool record){
     // create a sensemanager instance

    //set file record or playback
     sm->QueryCaptureManager()->SetFileName(file,record);

    //Enable the stream
    sm->EnableStream(PXCCapture::StreamType::STREAM_TYPE_DEPTH);
    PXCImage *depthIm;

    //initialize and record 300 frames
     sm->Init();
     for(int i =0; i<300;i++){
         //this function blocks until a depth sample is ready
         if(sm->AcquireFrame(true)<PXC_STATUS_NO_ERROR) break;

        //retrieve the sample
         PXCCapture::Sample *sample=sm->QuerySample();

        //work on the image sample->depth
         depthIm=sample->depth;

        //fetching the next frame/sample
         sm->ReleaseFrame();
     }
     //closing
     sm->Release();
 }

Hope this helps,

Have a nice day,

Ron

0 Kudos
varsha_h_
Beginner
774 Views

Hey Ron,

 I have mentioned it before. I have attached my code, take a look at it, and correct me if I'm wrong.

Have a nice day.

Varsha

0 Kudos
Reply