Git Product home page Git Product logo

depthimg's Introduction

โœจ Depth Map Generator

This Python script uses the MiDaS model from Intel ISL to generate a depth map from a 2D image. Requirements

Python 3.6 or later
The following Python packages, which are listed in requirements.txt:
    torch
    torchvision
    numpy
    opencv-python
    timm

Installation

Clone this repository or download the ZIP file and extract it.

Open a terminal and navigate to the directory containing the project files.

Run the following command to install the necessary Python packages:

bash

pip install -r requirements.txt

Note: Depending on your Python installation, you might need to use pip3 instead of pip.

Usage

Edit the depthimg.py file and replace the path in the last line of the script with the path to your input image:

python

depth_map = predict_depth(model, r"add path to image here (e.g. C:\images\image.jpg)")

Run the script with the following command:

bash

python depthimg.py

Note: Depending on your Python installation, you might need to use python3 instead of python.

The script will print a message when the depth map has been created and saved. The message will include the full path to the depth map image.

Troubleshooting

If you get an error like ModuleNotFoundError: No module named 'torch', make sure you have installed the requirements with the command pip install -r requirements.txt.

If you get an error like ValueError: No file found at "add path to image here (e.g. C:\images\image.jpg)", make sure the path to your image is correct and the image file exists at that location.

If you get an error like RuntimeError: The size of tensor a (20) must match the size of tensor b (19) at non-singleton dimension 2, make sure the width and height of your image are both divisible by 32.

depthimg's People

Contributors

zomby43 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.