Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box #2016

Closed
DannySauval opened this issue Jul 9, 2018 · 3 comments
Closed

Bounding box #2016

DannySauval opened this issue Jul 9, 2018 · 3 comments
Assignees

Comments

@DannySauval
Copy link

Required Info
Camera Model D415
Firmware Version 05.09.13.00
Operating System & Version Win 10 + Visual Studio 15 (2017)
Platform PC
SDK Version 2.0
Language C++

Issue Description

Hello,

I looked a lot to the source code of the librealsense and checked out a lot of examples, but I couldn't find anything about adding a bounding box to what the camera outputs. I actually just want a scan of my face, I don't want far away info. I would like to do it through intel realsense SDK since when I use PCL I don't get a lot of framerates (because of the function pointsToPCL I think).

Do you know how I can easily do that through the SDK ?

Thank you !

Danny,

@AntoineWefit
Copy link

You can easily tune the "depth of acquisition" (which would be the depth of the bounding box you are talking about) by adjusting the Depth Clamp Min/Max in the Intel RealSense Viewer, and export your ".json".

However, I don't believe there is a way to "crop" the FOV of the camera within the SDK (let me know if i'm wrong because I want to know too).
You can set a ROI, which is used for calculating the exposure I believe, but It doesn't act like a bounding box for the points cloud.

If you actually want to scan a face, I would recommend that you simply put the camera as close as possible to the target by making it fitting tightly in the FOV (use the Viewer to find the best parameters). You won't really need to define a bounding box when being close to the edges of the FOV, and you'll have the max achievable quality (as the error depends of the distance). I believe you can set the camera at around 250-300 mm away from your face to start tuning. The FOV of the camera in the "normal" position ("landscape") is obviously a horizontal rectangle, so you can also try to rotate it by 90° to fit the face better ("portrait" mode ?), and thus focusing almost exclusively on the acquisition of your face.

Keep us updated

@LeoSarog
Copy link

Hey,
I also encountered a similar problem. There wasn't any implementation of a bounding box inside the API so my manual approach was:
-Create a struct BoundingBox with x_min, x_max, y_min, y_max, z_min, z_max
-Get the frames from the RS
-Get the vertices from the rs2::points based on the intrinsics and the depth_frame values
-Iterate through your 3Dpoints doing some filtering based on BoundingBox variables, discarding points outside of the box.
-Store these points on a PCL::pointcloud
-Feed your PCL::pointcloud::Ptr to a PCLViewer

This method is probably slower than tuning the parameters from the start as @AntoineWefit mentions, because of the filtering and the vectors that store the points, but it provides the basic utilities that you are looking for.

@DannySauval
Copy link
Author

DannySauval commented Jul 11, 2018

@AntoineWefit thank you for your answer ! Your solution did the trick. I set up depth clamp Min/Max so that I can only see the face, and when the camera is close enough I indeed don't need to crop the rest ! It would have been better to have a real way to do it, but for now it works so it is okay. I hope developers will add something to efficiently add a bounding box. The SDK seems very powerful but too young yet.

@LeoSarog thank you for your answer. But I don't want to use PCL, I already added a bounding box through it but as I said the frame drop due to converting is too much for me. That is why I want to only use the RealSense SDK.

(the ticket can be closed thanks ^^)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants