Software Archive
Read-only legacy content
17061 Discussions

Intel RealSense R200 cannot stream raw data properly.

Sofia_G_
Beginner
671 Views

 

Hello, 

I'm trying to access the raw data from my R200 RealSense sensor however it doesn't seem to work properly and sometimes opens my webcam in my computer. I used other codes like the person tracking, the raw data sdk sample in the sdk sample viewer or  even the camera explorer and those work perfectly. However when I try to access the raw data the simple way it doesn't work. Here is the code I use and it doesn't open anything. Before I got the R200 I had the SR300 and it worked perfectly with the code(It's a Intel basic code sample, it should work), I would be really grateful if someone can help me figure out what's going on.

Also I checked the properties of the project just to check if the props file for dynamic properties is in the file and it is. 

Thank you,

Sofia Galan

 

/*******************************************************************************

INTEL CORPORATION PROPRIETARY INFORMATION
This software is supplied under the terms of a license agreement or nondisclosure
agreement with Intel Corporation and may not be copied or disclosed except in
accordance with the terms of that agreement
Copyright(c) 2013-2014 Intel Corporation. All Rights Reserved.

*******************************************************************************/
/* 
Description:
This is the raw streams procedural sample that shows how to capture color and depth synchronized by procedural calls. 

*/

#include <windows.h>
#include <wchar.h>
#include "pxcsensemanager.h"
#include "util_render.h"  //SDK provided utility class used for rendering (packaged in libpxcutils.lib)

// maximum number of frames to process if user did not close the rendering window
#define MAX_FRAMES 5000 

int wmain(int argc, WCHAR* argv[]) {

	// initialize the util render 
	UtilRender *renderColor  = new UtilRender(L"COLOR STREAM");
	UtilRender *renderDepth  = new UtilRender(L"DEPTH STREAM");

	// create the PXCSenseManager
	PXCSenseManager *psm=0;
	psm = PXCSenseManager::CreateInstance();
	if (!psm) {
		wprintf_s(L"Unable to create the PXCSenseManager\n");
		return 1;
	}

	// select the color stream of size 640x480 and depth stream of size 320x240
	psm->EnableStream(PXCCapture::STREAM_TYPE_COLOR, 640, 480);
	psm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 640, 480);

	// initialize the PXCSenseManager
	if(psm->Init() != PXC_STATUS_NO_ERROR) return 2;

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

	// delete the UtilRender instance
	delete renderColor;
	delete renderDepth;

	// close the last opened streams and release any session and processing module instances
	psm->Release();
	
	return 0;
}

 

 

0 Kudos
3 Replies
kfind1
New Contributor I
671 Views

As a quick fix, you may try disabling your computer/laptop's webcam so the only video stream device available is the R200. I did this on my laptop and it works.

The SDK is super vague about how to force connection to a particular device, I looked around and there are ways to do this but you need to know the camera's "friendly name" or device ID which is obscure and not easily enumerated.  I would like to know how to do this as well - both how to find the proper way to force the sense manager to use a particular device name/ID and how to find/set/use the device name/ID in general.

0 Kudos
DKryd
Beginner
671 Views

device manager can show you most of the info you are asking for. right click on the device and select properties and then details. you can select various identifiers using the dropdown selector under  property. how to set the values would be dependent on the app, most likely hard code it.36

0 Kudos
jb455
Valued Contributor II
671 Views

If you want to list available RealSense cameras, then specify which one you want to use if there are multiple, the Raw Streams sample has code you can borrow. I've modified parts of the C# sample in my app for this purpose and it works perfectly. I also added a generic "pick the first RealSense device the SDK can find" method in case the user doesn't want to manually choose.

0 Kudos
Reply