Items with no label
3335 Discussions

D435 camera :no depth data received

mzhou1
Beginner
2,362 Views

i connect the D435 camera to PC(windows 7), install the realsense sdk 2.0, open the intel realsense viewer(win 7), it works fine ,i can see both depth and rgb image, the i open the example program; there is a hello-world program:

using namespace rs2;

void main()

{

// Create a Pipeline, which serves as a top-level API for streaming and processing frames

pipeline p;

// Configure and start the pipeline

p.start();

while (true)

{

// Block program until frames arrive

frameset frames = p.wait_for_frames();

// Try to get a frame of a depth image

depth_frame depth = frames.get_depth_frame();

// The frameset might not contain a depth frame, if so continue until it does

if (!depth) continue;

// Get the depth frame's dimensions

float width = depth.get_width();

float height = depth.get_height();

// Query the distance from the camera to the object in the center of the image

float dist_to_center = depth.get_distance(width / 2, height / 2);

// Print the distance

std::cout << "The camera is facing an object " << dist_to_center << " meters away \r";

}

}

the depth is always NULL, the program cannot output the distance value;

then i open the realsense viewer, it show usb cam overflow.

why is that?

Did i miss something, or config the vs studio? i am using vs 2015 community version.

0 Kudos
6 Replies
MartyG
Honored Contributor III
295 Views

Does the example program work if you run it without having opened the RealSense Viewer beforehand, please?

0 Kudos
mzhou1
Beginner
295 Views

no, the example program does not work if the realsense viewer didnot open beforehand.

even i restart my computer, then run the example, no data received.

0 Kudos
idata
Employee
295 Views

Hi Michael,

 

 

Have you tried running any of the C or C++ examples included in the SDK? The code you provided is just a code snippet and isn't meant to be a full program. The rs-distance example uses the code snippet above in a full program.

 

 

Regards,

 

Sahira

 

 

0 Kudos
mzhou1
Beginner
295 Views

this is a example code included in sdk, i open the program though the shortcut in desktop.

0 Kudos
idata
Employee
295 Views

Hi Michael,

 

Just to be clear, only the hello-world example does not work? Have you tried the other examples from the SDK?

 

 

Regards,

 

Sahira
0 Kudos
_xct
Beginner
295 Views

Are you sure you're using usb3 port AND usb3 cable? Otherwise, you're in for a myriad of issues.

0 Kudos
Reply