Skip to content
zxc000166Public

About

目前是一坨,目的是将工程图转化为三维模型/At present, it is a pile with the purpose of converting engineering drawings into 3D models. I hope there is a great expert to help me improve it, and I hope that everyone can help me more

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

2Dto3D Converter

A low-cost, CPU-based tool for independent developers to convert 2D RGB images into 3D point clouds/meshes using MiDaS depth estimation.

Features

  • Monocular Depth Estimation: Uses MiDaS (Small/Hybrid/Large) models.
  • Point Cloud Generation: Converts depth maps to colored PLY point clouds.
  • CPU Optimized: Designed to run on standard hardware without GPU requirements.
  • CLI Interface: Simple command-line tool for conversion.

Installation

  1. Clone the repository.
  2. Install dependencies:
    pip install -r requirements.txt

Usage

CLI

Convert a single image to a point cloud:

python cli.py -i input.jpg -o output.ply -m MiDaS_small

Options:

  • -i, --input: Path to input image (required).
  • -o, --output: Path to output file (default: output.ply).
  • -m, --model: Model type (default: MiDaS_small). Options: MiDaS_small, DPT_Large, DPT_Hybrid.

Python API

from src.depth_estimation import DepthEstimator
from src.point_cloud_generation import PointCloudGenerator

# Estimate depth
estimator = DepthEstimator(model_type="MiDaS_small")
depth_map = estimator.estimate_depth("input.jpg")

# Generate point cloud
generator = PointCloudGenerator()
generator.depth_to_pointcloud(depth_map, "input.jpg", "output.ply")

Deployment

To deploy using Docker:

  1. Build and run the container:
    docker-compose up -d --build
  2. Access the Web Interface at http://localhost:5000

For detailed instructions, see DEPLOYMENT.md.

Testing

Run unit tests:

pytest tests/

License

MIT License

About

目前是一坨,目的是将工程图转化为三维模型/At present, it is a pile with the purpose of converting engineering drawings into 3D models. I hope there is a great expert to help me improve it, and I hope that everyone can help me more

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages