Skip to content

Create 3D mesh from single photo. Also offers edge detection with tweaking, 3D mesh viewer and more.

License

Notifications You must be signed in to change notification settings

lelandg/EdgeMesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

67 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽจ EdgeMesh - Advanced 3D Mesh Generation from Images

GitHub Python PyQt6 Open3D

Transform 2D images into stunning 3D meshes using AI-powered depth estimation and advanced edge detection โœจ

๐Ÿš€ Quick Start | ๐Ÿ“ธ Features | ๐Ÿ› ๏ธ Installation | ๐Ÿ“– Documentation | ๐ŸŽฏ Examples

EdgeMesh Demo

๐ŸŒŸ Overview

EdgeMesh is a powerful PyQt6-based desktop application that converts 2D images into 3D meshes using state-of-the-art depth estimation models and sophisticated edge detection algorithms. Whether you're a 3D artist, game developer, researcher, or hobbyist, EdgeMesh provides an intuitive interface for creating detailed 3D models from ordinary photographs.

๐ŸŽฏ What Can EdgeMesh Do?

  • ๐Ÿ–ผ๏ธ Convert any image to a 3D mesh in seconds
  • ๐Ÿง  AI-powered depth estimation using multiple models (MiDaS, DPT, ZoeDepth, Depth-Anything)
  • ๐ŸŽจ Advanced edge detection with customizable parameters
  • ๐Ÿ”ง Real-time 3D preview with interactive viewport
  • ๐Ÿ“ Export to standard formats (.obj, .stl) for 3D printing or modeling software
  • ๐ŸŽฎ SpaceMouse support for professional 3D navigation

โœจ Key Features

๐Ÿ–ผ๏ธ Image Processing

  • Smart Background Removal - Automatically detects and removes backgrounds based on corner colors
  • Edge Detection - Advanced Canny edge detection with adjustable thresholds
  • Multiple Smoothing Methods - Gaussian, Bilateral, Median, and Anisotropic Diffusion
  • Grayscale Conversion - Process images in grayscale for enhanced control
  • Dynamic Depth Adjustment - Create front-half meshes perfect for 3D printing

๐Ÿง  Depth Estimation Models

Choose from multiple state-of-the-art models:

  • MiDaS (Small & Large variants) - Fast and reliable
  • DPT (Large & Hybrid) - High accuracy
  • ZoeDepth (K, N, NK, N-indoor) - Specialized for different scenarios
  • Depth-Anything - Latest cutting-edge models

๐ŸŽจ 3D Mesh Generation

  • Depth-to-3D Conversion - Direct conversion from depth maps
  • Edge-based Mesh Creation - Generate meshes from detected edges
  • Surface Partitioning - Intelligent surface segmentation
  • Extrusion Projection - Complex 3D reconstructions from contours
  • Real-time Preview - See your mesh as it's created

๐Ÿ› ๏ธ Professional Tools

  • 3D Text Generator - Create 3D text meshes using the included MeshTools
  • Mesh Manipulation - Scale, rotate, and transform meshes
  • Custom Coloring - Apply gradients and color transitions
  • Measurement Grid - Visualize dimensions and proportions
  • Batch Processing - Process multiple images efficiently

๐Ÿš€ Quick Start

๐Ÿ“‹ Prerequisites

  • Python 3.12 (โš ๏ธ Not compatible with Python 3.13+)
  • Windows (primary support) or Linux/WSL
  • 4GB+ RAM recommended
  • NVIDIA GPU (optional, for faster processing)

๐Ÿ› ๏ธ Installation

Option 1: Automated Installation (Recommended) ๐ŸŽฏ

# Clone the repository
git clone https://github.com/lelandg/EdgeMesh.git
cd EdgeMesh

# Run the automated installer
python install_requirements.py

Option 2: Manual Installation ๐Ÿ“ฆ

# Clone the repository
git clone https://github.com/lelandg/EdgeMesh.git
cd EdgeMesh

# Update pip
python -m pip install --upgrade pip

# Install requirements
pip install -r requirements.txt

# For Open3D compatibility issues
python install_open3d.py

โ–ถ๏ธ Running EdgeMesh

Windows ๐ŸชŸ

python edge_mesh.py
# or simply:
run.bat

Linux/WSL ๐Ÿง

python3 edge_mesh.py

๐Ÿ“– How to Use

Step 1: Load an Image ๐Ÿ“ธ

Click "Load Image" and select any image file (PNG, JPG, etc.)

Step 2: Configure Settings โš™๏ธ

  • Depth Model: Choose your preferred AI model
  • Smoothing: Select smoothing method and intensity
  • Edge Detection: Adjust thresholds for edge sensitivity
  • Resolution: Set mesh resolution (higher = more detail)

Step 3: Process the Image ๐Ÿ”„

Click "Generate 3D Mesh" to create your 3D model

Step 4: Preview and Export ๐Ÿ’พ

  • Use the 3D viewport to inspect your mesh
  • Mouse controls: Rotate, zoom, pan
  • Export as .obj or .stl for 3D printing or further editing

Pro Tips ๐Ÿ’ก

  • Enable "Dynamic Depth" for 3D printing-friendly meshes
  • Use "Remove Background" for cleaner results
  • Try different depth models for various image types
  • Indoor scenes work best with ZoeDepth N-indoor model

๐Ÿ—๏ธ Architecture

EdgeMesh follows a modular pipeline architecture:

๐Ÿ“ท Image Input
    โ†“
๐ŸŽจ Preprocessing (Edge Detection, Smoothing)
    โ†“
๐Ÿง  Depth Estimation (AI Models)
    โ†“
๐Ÿ”จ Mesh Generation (Depth-to-3D or Edge-based)
    โ†“
โœจ 3D Viewport (Interactive Preview)
    โ†“
๐Ÿ’พ Export (.obj, .stl)

For detailed architecture information, see the Code Map.


๐ŸŽฏ Examples

Creating a 3D Portrait

  1. Load a portrait photo
  2. Select MiDaS Large model
  3. Enable Dynamic Depth
  4. Generate and export for 3D printing

Architectural Visualization

  1. Load building photograph
  2. Use DPT Hybrid for accuracy
  3. Enable edge detection for sharp details
  4. Export to modeling software

3D Text Creation

python MeshTools/text_3d.py --text "Hello 3D" --height 100 --depth 20

๐Ÿ”ง Troubleshooting

Python Version Compatibility โš ๏ธ

Important: Open3D 0.19.0 is not compatible with Python 3.13+

Solutions:

  1. Use Python 3.12:

    # Check your version
    python --version
    
    # If 3.13+, install Python 3.12
  2. Create a virtual environment:

    python3.12 -m venv venv
    source venv/bin/activate  # Linux/Mac
    venv\Scripts\activate      # Windows
  3. Run compatibility checker:

    python install_open3d.py

Common Issues

Issue: ImportError with Open3D Solution: Reinstall with specific version

pip install open3d==0.19.0 --force-reinstall --no-cache-dir

Issue: CUDA/GPU not detected Solution: Install PyTorch with CUDA support

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118

๐Ÿ“š Documentation


๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/AmazingFeature)
  3. ๐Ÿ’ป Make your changes
  4. โœ… Test thoroughly
  5. ๐Ÿ“ Commit (git commit -m 'Add AmazingFeature')
  6. ๐Ÿ“ค Push (git push origin feature/AmazingFeature)
  7. ๐ŸŽฏ Open a Pull Request

Development Setup

# Clone with submodules
git clone --recursive https://github.com/lelandg/EdgeMesh.git

# Install in development mode
pip install -e .

# Run tests (when available)
python -m pytest

๐ŸŒ Related Projects

๐ŸŽจ ImageAI by Leland Green

For AI-powered image generation that can serve as input for 3D mesh creation, check out ImageAI - a comprehensive tool supporting multiple AI providers including:

  • Google Gemini
  • OpenAI DALL-E
  • Stability AI
  • Local Stable Diffusion

Perfect for creating unique images to convert into 3D meshes! ๐Ÿš€


๐Ÿ‘จโ€๐Ÿ’ป Author

Leland Green

Also creator of ImageAI - Advanced AI Image & Video Generation Tool


๐Ÿ“„ License

This project is proprietary software. Please see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Open3D Team - For the excellent 3D processing library
  • PyTorch Team - For deep learning framework
  • MiDaS Contributors - For depth estimation models
  • Qt/PyQt6 - For the robust GUI framework
  • Community Contributors - For feedback and improvements

๐Ÿš€ Roadmap

Coming Soon ๐Ÿ”œ

  • ๐Ÿค– More AI models (SAM integration)
  • ๐Ÿ“ฑ Mobile companion app
  • โšก GPU acceleration optimizations
  • ๐Ÿ”ง Plugin system for custom processors

Future Vision ๐Ÿ”ฎ

  • Real-time 3D reconstruction from webcam
  • VR/AR export capabilities
  • Cloud processing for large batches
  • AI-assisted mesh refinement

๐Ÿ’– Support

If you find EdgeMesh useful, please:

  • โญ Star the repository
  • ๐Ÿ› Report bugs via Issues
  • ๐Ÿ’ก Suggest features
  • ๐Ÿ“ฃ Share with others
  • ๐Ÿค Join our Discord Community

Made with โค๏ธ by Leland Green

๐Ÿ” Back to Top

About

Create 3D mesh from single photo. Also offers edge detection with tweaking, 3D mesh viewer and more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages