Using PyTorch's MiDaS model and Open3D's point cloud to map a scene in 3D.
- Entry point
- Integrates the below 3 functionalities
- Core logic for depth estimation (
depth_estimation/depthmap.py
) DepthMapper
class responsible for setting up and utilizing a depth estimation model.- Loads a pre-trained model (MiDaS model variants) based on the specified accuracy level, performs image transformations, and estimates the depth map from an input image.
- Handles image processing tasks (
image_processing/image_process.py
) ImageProcessor
class loads, validates, and manipulates image data.- It includes functionalities such as loading images from disk, applying color maps, and displaying images.
- This class is utilized to handle the input and output images in the depth mapping process.
- Renders point clouds from the depth data generated by the depth mapping process (
point_cloud/cloudrender.py
). CloudRenderer
class in processes the depth data to generate 3D points and renders them as a point cloud or voxel grid.- This visualization helps in understanding the spatial relationships in the scene represented by the depth map.
pip install -r requirements.txt
When running the model on a chosen image, swap out the PHOTO
placeholder with the complete file path and extension of the target image. For the --accuracy_level
setting, select an integer from 1 to 3 (where 1 delivers the quickest inference speed but with less accuracy, and 3 ensures the highest accuracy, albeit with a slower inference speed).
python3 main.py --accuracy_level [1|2|3] --input_img PHOTO