[PYTHON] I tried to easily create a high-precision 3D image with one photo [2]. (Try processing depth with numpy)

Overview

** One photo ** ** High-precision 3D image ↓ Easy creation **.

I tried to easily create a high-precision 3D image with one photo [1]. (Depth can now be edited in PNG.) See the article.

here, ** Try processing depth with numpy **

Below are the papers and github.

https://arxiv.org/pdf/2004.04727.pdf Paper "3D Photography using Context-aware Layered Depth Inpainting" Meng-Li Shih1 and others

github is below. https://github.com/vt-vl-lab/3d-photo-inpainting

First, a normal example

Processing source image Use https://pixabay.com/ja/

The original one still image.

result.

The original one still image.

result.

Process depth with numpy

For the time being, set the depth value to about 20 levels? I tried to discretize it. (Excuse me, ** I'm failing as an example. I don't know the action at all ... ** See the next section for the action.)

** I tried 2 lines ** In fact, for example, should we create a meaningful function and make it work? I think there is some consideration as to whether it is better to do it in the processing phase here.

run.py


        # compute
        with torch.no_grad():
            out = model.forward(img_input)
        
        out = out//0.1#######add to
        out = out*0.1#######add to

        depth = utils.resize_depth(out, target_width, target_height)
        img = cv2.resize((img * 255).astype(np.uint8), (target_width, target_height), interpolation=cv2.INTER_AREA)

Process depth with numpy (example of strengthening the action)

From the above, the granularity has been increased to 5 times **.

        out = out//0.5#######add to
        out = out*0.5#######add to

Afterword

I wrote editing png in the previous article, but ** I thought that the default numpy might be easier to handle **, so I gave an example of editing with numpy. (Unfortunately, it didn't lead to meaningful editing ...) If you have any comments, please.

Relation: I tried to easily create a high-precision 3D image with one photo [3]. Only depth without permission feat. Intel-isl.

Recommended Posts

I tried to easily create a high-precision 3D image with one photo [2]. (Try processing depth with numpy)
I tried to easily create a high-precision 3D image with one photo [1]. (Depth can now be edited in PNG.)
I tried to easily create a high-precision 3D image with one photo [3]. MiDaS of feat. Intel-isl only depth without permission.
I tried to easily create a high-precision 3D image with one photo [-1]. (Is the hidden area really visible?)
I tried to easily create a high-precision 3D image with one photo [0]. (Confirmed how to capture the space, put a net)
I tried to easily create a fully automatic attendance system with Selenium + Python
I tried to create a table only with Django
I came up with a way to create a 3D model from a photo Part 02 Image loading and vertex drawing
I tried to automatically create a report with Markov chain
I came up with a way to create a 3D model from a photo Part 04 Polygon generation
I tried using PI Fu to generate a 3D model of a person from one image
I tried to create a list of prime numbers with python
I tried to create Bulls and Cows with a shell program
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
I came up with a way to make a 3D model from a photo.
I tried to create a plug-in with HULFT IoT Edge Streaming [Development] (2/3)
I tried to create a plug-in with HULFT IoT Edge Streaming [Execution] (3/3)
I tried to create CSV upload, data processing, download function with Django
[Outlook] I tried to automatically create a daily report email with Python
I tried to create a plug-in with HULFT IoT Edge Streaming [Setup] (1/3)
How to easily create a CG image like a toy photo "Ubuntu / Linux" ・ Photo realistic rendering with LeoCAD & Blender
I want to easily create a Noise Model
I tried simple image processing with Google Colaboratory.
I tried to create a class that can easily serialize Json in Python
I tried to extract a line art from an image with Deep Learning
I tried to create a button for Slack with Raspberry Pi + Tact Switch
I tried to make a simple image recognition API with Fast API and Tensorflow
I tried to create a model with the sample of Amazon SageMaker Autopilot
100 image processing knocks !! (021-030) I want to take a break ...
Try to dynamically create a Checkbutton with Python's Tkinter
I tried to draw a route map with Python
I tried to create a reinforcement learning environment for Othello with Open AI gym
I came up with a way to make a 3D model from a photo. 0 Projection to 3D space
[Python] I tried to automatically create a daily report of YWT with Outlook mail
I tried to automatically generate a password with Python3
I want to manually create a legend with matplotlib
Image processing with Python (I tried binarizing it into a mosaic art of 0 and 1)
[Python] How to create a 2D histogram with Matplotlib
I tried to create a class to search files with Python's Glob method in VBA
I tried scraping food recall information with Python to create a pandas data frame
I tried to easily create a high-precision 3D image with one photo [1]. (Depth can now be edited in PNG.)
I tried to easily create a high-precision 3D image with one photo [2]. (Try processing depth with numpy)
I tried to easily create a high-precision 3D image with one photo [-1]. (Is the hidden area really visible?)
I tried to easily create a high-precision 3D image with one photo [0]. (Confirmed how to capture the space, put a net)
I tried to easily create a high-precision 3D image with one photo [3]. MiDaS of feat. Intel-isl only depth without permission.
If you guys in the scope kitchen can do it with a margin ~ ♪
You can easily create a GUI with Python
Create a 2D array by adding a row to the end of an empty array with numpy
I tried to implement a volume moving average with Quantx
I tried to find the entropy of the image with python
I tried to solve a combination optimization problem with Qiskit
I tried to get started with Hy ・ Define a class
I tried to sort a random FizzBuzz column with bubble sort.
I tried to create a bot for PES event notification
I tried to divide with a deep learning language model
I tried to create an article in Wiki.js with SQLAlchemy
I tried to create serverless batch processing for the first time with DynamoDB and Step Functions
[5th] I tried to make a certain authenticator-like tool with python
I tried to create a server environment that runs on Windows 10
I made a library to easily read config files with Python
I tried to create a simple credit score by logistic regression.
[2nd] I tried to make a certain authenticator-like tool with python
A memorandum when I tried to get it automatically with selenium
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
[3rd] I tried to make a certain authenticator-like tool with python