Software Archive
Read-only legacy content

Recording rawstreams

Sumit_A_
Beginner
589 Views

I am trying to record the raw stream using the following C++ program from the documentation(C++ Example 17: Record or Playback Color Samples using the SenseManager)

void RecordORPlayback(pxcCHAR *file, bool record) {
   // Create a SenseManager instance
   PXCSenseManager *sm=PXCSenseManager::CreateInstance();
 
   // Set file recording or playback
   sm->QueryCaptureManager()->SetFileName(file,record);
 
   // Select the color stream
   sm->EnableStream(PXCCapture.STREAM_TYPE_COLOR,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();
 
       // Work on the image sample->color
       ...
 
       // Go fetching the next sample
       sm->ReleaseFrame();
   }
 
   // close down
   sm->Release();
}

Could you please tell me how to create the file and assign it to a pxcCHAR pointer variable?

0 Kudos
1 Reply
Arun_D_
Beginner
589 Views

Hello Sumit,

You can record raw streams by directly using the above function by specifying a .rssdk file which can be viewed or edited in the clip editer sample of the sdk.

To assign the file name you simply have to mention the path in the PXCChar variable. The following code will work:

 

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;
}

 

Dont forget to put the 'L' before the location as PXCChar is a whar_t. Type in the name of the new file in the location you want.

0 Kudos
Reply