neatpun / real-time-background-replacement

Real time background replacement using DeepLabv3 MobileNetv2 model for person segmentation and OpenCV for image processing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Winning project for WittyHacks 2.0 (central India's largest hackathon). Created by Prathamesh Naik, Raghav Mahajan & Mohit Nathrani.

Back-Off: Real Time Background Replacement

A tool that takes video and replace with new background provided by user in real time.

Table of contents

Description

Background removal helps with creative portrait photography and much more, helping provide the ability to change the background to a location of your choice. There are 4 methods available to use. One is a simple live-method using the webcam, a user can change the background by pressing and holding 'a', 'b', or 'c'. Other is live streaming from a mobile app. The last one is by requesting the server with pre-recorded video and background picture of choice. Fourth one is android app with a Flask server.

Technologies Used

  • Tensorflow
  • OpenCV
  • Flask

Results

Input Background Result
input background output

How It Works

$ git clone https://github.com/neatpun/real-time-background-replacement
  1. Live Webcam Front
  • cd "Live Webcam Front"
  • install dependencies
  • python live_webcam.py
  1. Server Front
  • cd "Server Front"
  • install dependencies
  • FLASK_APP=index.py flask run
  • then open localhost:5000
  • provide video and background image
  • after processing download of required video will begin
  1. Live Stream Output
  • cd "Live Stream Output"
  • install dependencies
  • connect any mobile device to same network and stream video.
  • provide the ip address of mobile device in IP_Webcam_Out.py
  • python IP_Webcam_Out.py

About

Real time background replacement using DeepLabv3 MobileNetv2 model for person segmentation and OpenCV for image processing.


Languages

Language:Python 60.1%Language:Java 39.9%