Converting 2D Single Image into 3D Model

2D Single Image to 3D Model using the PIFu algorithm.

We utilized the PIFu algorithm(Saito et al. 2019) to create a 3D model of a sagittal mouse brain with a single 2D image as an input. The sagittal mouse brain image and binary masks were obtained from the source from Iqbal et al(2019).


3d_1

3d_2

3d_3

3d_4

Code

git clone https://github.com/shunsukesaito/PIFu.git
cd /content/PIFu
!sh ./scripts/download_trained_model.sh
!sh ./scripts/test.sh
!pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'
from lib.colab_util import *
obj_path = '/content/PIFu/results/pifu_demo/result_mousebrain.obj'
video_path = '/content/PIFu/results/pifu_demo/result_mousebrain.mp4'
video_display_path = '/content/PIFu/results/pifu_demo/result_mousebrain_display.mp4'

renderer = set_renderer()
generate_video_from_obj(obj_path, video_path, renderer)

!ffmpeg -i $video_path -vcodec libx264 $video_display_path -y -loglevel quiet
video(video_display_path)