-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Multiple depth map fusion #9832
Comments
Hi @chinmay5 If you have the budget for a commercial software package, the RealSense-compatible RecFusion Pro 3D scanning software supports multiple camera capture. The standard RecFusion edition for single cameras can build up an image in real-time as the camera is moved around. https://www.recfusion.net/index.php/en/features Another RealSense-compatible commercial software product is Dot3D, which has a Lite edition suited to scanning small objects and a Pro edition for capturing larger scenes. https://www.dotproduct3d.com/dot3dlite.html Another commercial option is ItSeez3D. https://itseez3d.com/itseez3d-sdk-for-intel-realsense-d4xx.html A free alternative to commercial products that can be used with a single camera is the RealSense SDK's rs-kinfu (KinectFusion), which builds up a point-cloud depth image through frame fusion as the camera is moved around. https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv/kinfu |
Dear @MartyG-RealSense thank you for the quick response. I looked at the suggestions you provided and was wondering if there is also a python interface available implementation of RealSense SDK's rs-kinfu . As I said, in my use case, I would rather have multiple fixed sensors rather than having moving parts. Correct me if I am wrong, but can this be done with RealSense SDK's rs-kinfu or going for the commercial software packages the only viable solution? |
There is not an implementation of rs-kinfu for Python, unfortunately. Another free option would be to use ROS and follow Intel's guides for using multiple cameras to capture individual point clouds from each camera and stitch them together into a single large cloud. There are guides for 2 cameras on the same computer and 3 cameras across 2 computers. You may be able to adapt the guides to add a greater number of cameras, but I cannot make guarantees about the results. 1 computer, 2 cameras 2 computers, 3 cameras The CONIX Research Center at Carnegie Mellon developed a system for generating point clouds from up to 20 RealSense cameras and then stitching them together, though it is based on C++ rather than Python. https://github.com/conix-center/pointcloud_stitching If Python is your preference, it should be possible to stitch individual point clouds into a combined cloud using a process called an affine transform. This sets point clouds to a common position and rotation. An SDK instruction that provides an affine transform is rs2_transform_point_to_point, as described for Python in #5583 |
Dear @MartyG-RealSense I was trying to get the python code to work until now but unfortunately, I am still struggling to get a good example with point cloud data being read from two different realsense cameras and then merged together. I tried working with the affine transform idea you gave but I have not managed to get things done till now. It would be great if you can point me to some example code. |
The subject of affine transforms in Python is discussed in detail in #8333 though it does not have a pre-made Python script for stitching point clouds. Below are some alternative approaches to using affine transform.
https://github.com/strawlab/python-pcl |
Dear @MartyG-RealSense I think I was able to get things to work with open3D. The plan would be to use multiple realsense sensors and save the images and depth maps in the same folder. Then, I can use the reconstruction system from open3d to try and reconstruct it. The thing I am struggling with is, how to connect say 10 sensors and read data from them. As of now, I opened the realsense-viewer in order to get the id for each of the devices and then stream from them. However, I do not think this is the best way. Can you please provide me with a clean python code reference to read images from up to 10 or so realsense cameras? I would be really thankful if the same is possible. |
I'm very pleased to hear that you were able to make positive progress! A RealSense user created a multiple camera Python project called multiple_realsense_cameras.py in the link below. https://github.com/ivomarvan/samples_and_experiments/tree/master/Multiple_realsense_cameras |
Hi @MartyG-RealSense thank for the link. It works like a charm. One more question though. As you can see, the object I am trying to scan is rather small while when I tried the open3D examples, the field of view was large and I could not get the model in centre. As you can see, although the construction is not good (maybe it was because I was not very careful during capturing of images), it is looking at a much larger field of view than only the green object in the centre. I was wondering if limiting the depth map to say 30cm can be of use. Can you help in figuring out how to set the maximum depth? Also, any suggestions on improving the reconstruction is really really appreciated. |
@MartyG-RealSense I managed to clip the depth map using
However, I am still struggling with the surface reconstruction. Any inputs from you would be highly appreciated. |
Thanks very much @chinmay5 for sharing your Python depth clamp script with the RealSense community! If you would like to zoom into a small object then reducing the camera's depth unit scale from the default of '0.001' to 0.0001 may help. This principle is illustrated in #8228 where changing the depth unit scale enables zoom-in on a small toothpick and provides improvement in depth image quality. #6230 (comment) has an example of Python code for setting the depth unit scale to 0.0001. |
Dear @MartyG-RealSense thank you so much for the response. I tried making the changes you suggested. Now that I reduced the maximum depth, I get somehwat worse reconstructions. Not exactly sure if this is due to decreasing the max depth value and does the system become unstable at this particular resolution? |
An alternartive way to clamp depth is to use a post-processing Threshold Filter that can define both a minimum and maximum distance. Depth values outside of that defined min-max range are excluded from the depth image. An example of a Python script for implementing a threshold filter is at #8170 (comment) |
Hi @chinmay5 Do you require further assistance with this case, please? Thanks! |
Hi @MartyG-RealSense sorry for not responding quickly. I was trying to run some experiments using the Open3D library you recommended. The library is indeed helpful but I am getting stuck in fusing the depth maps for the entire object. I can reconstruct one view of the object by fusing its depth maps However, as soon as I put all the views (up to 8 depth maps. The above figure used fusion of 3 depth maps), the thing breaks down completely. The object is not closed although I take depth maps from the 8 possible views. If you have any ideas, that would be really really helpful. Thanks :) |
If you have 8 live cameras that are being processed simultaneously on the same computer then that would be a considerable processing burden on the computer's CPU. In the past, Intel have recommended a computer with a minimum of an i7 CPU for simultaneous use of 4 cameras on the same machine. If you are unable to use a more powerful computer or divide the cameras among multiple computers, would it be practical to capture by cycling through the cameras, turning them on and off in sequence until you have captured all of the data that you require? |
I tried your suggestion. The major problem seems to be issues with the reconstruction because not enough depth information is included. When I reduce the depth unit scale from the default of '0.001' to 0.0001, the depth map becomes essentially all 0s ie no depth information. Also, what would be the effect of increasing the depth map resolution to 1280 x 720, would that help me in getting these fine structured information? Thank you for your time and patience :) |
Increasing the resolution would likely increase the minimum distance of the camera, meaning that at close range the depth image would start breaking up sooner as the camera moves towards the observed object / surface (in other words, the camera could not get as close as before to an object). The optimal depth accuracy resolution of the D435i model is 848x480 (it is 1280x720 on the D415 camera model), so depth measurement accuracy may reduce at 1280x720 on the D435i. |
Hi @MartyG-RealSense . Maybe we lost track of things in this long thread. I have a small object 20 cm by 20 cm approx placed at a distance of 40cm from the cameras. What would be the best configuration for achieving this? Thanks |
Setting the Medium Density camera preset should provide a good balance betwen accuracy and the amount of detail in the depth image (the 'fill rate'). To set the preset in your Python project, you could try the script provided by a RealSense team member in #2577 (comment) In the line
|
Hi @chinmay5 Do you require further assistance with this case, please? Thanks! |
Case closed due to no further comments received. |
Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):
All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)
Issue Description
I want to perform 3D reconstruction using Depth Map fusion. For this, I would like to set up 4-8 D435i at the corners of a box and have a toy object in the centre, something like this image
However, I am pretty new to the field and although I could find ColMap doing the reconstruction using images, I would imagine having multiple depth sensors and fusion of depth maps would give better results. I am open to switching to pure image-based reconstruction as well. Any help would be really welcome.
The text was updated successfully, but these errors were encountered: