Skip to content
Snippets Groups Projects

Update RGBD/FromRGBDToDepth/readme.md

Merged Zecheng Li requested to merge lzc199639-main-patch-14550 into main
1 file
+ 20
45
Compare changes
  • Side-by-side
  • Inline
# Project Title
# Project Title
Simple overview of use/purpose.
Convert the RGB value into depth value using scaling.
## Description
## Description
An in-depth paragraph about your project and overview of use.
If we have a reference for the color, we can get the range of color vs range of meters.
 
Let's say RGB from 0-64 is 1 meter, 65-128 is 2 meter, 129-192 is 3 meters, 192 to 256 is 4 meters.
 
Therefore, for the color that's inside the PLY file, we can refer to the color/depth range, to calculate its depth, like the image we took, we can see there is reference on the image.
## Getting Started
![reference](RGBD/FromRGBDToDepth/colormeterreference.png)
### Dependencies
On a range from 0 to 256, we map the color into distance, and output the depth value by each coordinates into the txt file.
* Describe any prerequisites, libraries, OS version, etc., needed before installing program.
For now, we are not able to prove the coordinates in this txt file completely match with the other file, (Just by the look of it), but the method to generate this is from open3d.
* ex. Windows 10
### Installing
* How/where to download your program
* Any modifications needed to be made to files/folders
### Executing program
* How to run the program
* Step-by-step bullets
```
code blocks for commands
```
```
 
import open3d as o3d
 
import numpy as np
## Help
# Load the color image and convert it to a numpy array
 
color_img = o3d.io.read_image('color_image.jpg')
 
color_arr = np.asarray(color_img)
Any advise for common problems or issues.
# Convert the color image to a point cloud
```
pcd = o3d.geometry.PointCloud.create_from_color_image(color_img, depth_scale=1.0, depth_trunc=4.0)
command to run if program contains helper info
```
## Authors
# Extract the depth image from the point cloud
 
depth_arr = np.asarray(pcd.depth)
Contributors names and contact info
# Save the depth image to a file
o3d.io.write_image('depth_image.png', o3d.geometry.Image(depth_arr))
ex. Dominique Pizzie
```
ex. [@DomPizzie](https://twitter.com/dompizzie)
## Version History
* 0.2
* Various bug fixes and optimizations
* See [commit change]() or See [release history]()
* 0.1
* Initial Release
## License
This project is licensed under the [NAME HERE] License - see the LICENSE.md file for details
This code loads a color image using Open3D, and the depth_scale and depth_trunc arguments are used to set the depth range to 0 to 4 meters.
## Acknowledgments
Inspiration, code snippets, etc.
* [awesome-readme](https://github.com/matiassingers/awesome-readme)
* [PurpleBooth](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2)
* [dbader](https://github.com/dbader/readme-template)
* [zenorocha](https://gist.github.com/zenorocha/4526327)
* [fvcproductions](https://gist.github.com/fvcproductions/1bfc2d4aecb01a834b46)
Loading