baizp / Mask_RCNN_3D

Utilizing Mask RCNN to generate 3D(look-like) images and videos. 裸眼3d,用Mask-RCNN自动生成视频与图像

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mask-RCNN 3D

Introduction

3d gif 1 3d gif 2 3d gif 3

As shown above, by putting two parallel white lines on a moving image, we can generate a 3D (look-like) image or video. This project puts this idea into use by exploiting object detection and scene segmentation information generated by Mask-RCNN. Instead of manually editing 30 frames per second to achieve this effect, we can use a program to automatically generate a 3D (look-like) video.

Here are some demos:

Original Image 1 New Image 1 Original Image 2 New Image 2
Original Video 1 New Video 1 Original Video 2 New Video 2
Original Video New Video

Usage

Optional: download the pre-trained COCO weights (mask_rcnn_coco.h5) file from the released page and put it in the main folder. (If the weights file can not be found in the main folder, the program will automatically download it from github)

Generating 3D (look-like) image:

  • python 3d_image.py -i images/persons.jpg -o images/persons_3d.jpg

  • python 3d_image.py -i images/persons.jpg -o images/persons_3d.jpg -w 30 -d 20

Generating 3D (look-like) video:

  • python main.py -i images/jetlee.mp4 -o images/output.avi

All possible arguments are:

-i (--input): required, path to the input video file

-o (--output): required, path to the output video file

-w (--width): type=int, default=20, pixel width of the blank bar

-d (--distance): type=int, choices=[10..40], default = 15, percentage distance of the bar from the center

-c (--color): choices=["white", "black"], default="black", color of the blank bar, can be set to either white or black

-t (--thickness): type=int, choices=[0..20], default = 10, thickness of the horizontal bars in the upper and lower parts of the screen

Acknowledgments

This repository is based on Mask-RCNN and Mask-RCNN-Shiny

About

Utilizing Mask RCNN to generate 3D(look-like) images and videos. 裸眼3d,用Mask-RCNN自动生成视频与图像


Languages

Language:Python 99.4%Language:Jupyter Notebook 0.6%