- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does the example program work if you run it without having opened the RealSense Viewer beforehand, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this is a example code included in sdk, i open the program though the shortcut in desktop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure you're using usb3 port AND usb3 cable? Otherwise, you're in for a myriad of issues.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page