Code Monkey home page Code Monkey logo

invisibility-cloak's Introduction

Invisibility-Cloak โœจ

About

Hello there ๐Ÿ‘‹! I am Sakshi Gupta a backend developer and Machine Learning Enthusiast. After attending a super fun boot-camp about Data Science and Machine Learning I learned how to work around with python libraries like OpenCv and Numpy.

Logic

The basic idea of this project is to build a invisibility cloak which will:

  1. ๐Ÿ“ธ Capture the background image and save it.
  2. ๐Ÿƒโ€โ™€๏ธ Read input video frame by frame and Replace all the pixels of the cloth (here I have used a red colored cloth) with those of the background image.

Languages & Libraries Used

The complete project is created using one language i.e Python. There are two python libraries used:

  1. OpenCV : It is a huge open-source library for the computer vision, machine learning, and image processing and it plays a major role in real-time operation which is very important in today's systems. By using it, one can process images and videos to identify objects, faces, or even handwriting of a human.
  2. Numpy: It is an open-source numerical Python library. NumPy contains a multi-dimensional array and matrix data structures. It can be utilised to perform a number of mathematical operations on arrays such as trigonometric, statistical, and algebraic routines.

Install the latest version of Python3

pip install opencv-python      #installs opencv
pip install numpy              #installs numpy

Steps

  • background.py
    1. Capture the background image.
    2. Save it.
  • invisibility_cloak.py
    1. Read input video frame by frame.
    2. Convert the frame from bgr to hsv (best for color detection).
    3. Set the bgr value of red color in a numpy array.
    4. Convert it into hsv.
    5. Determine the threshold values for detecting red color (basically used to determine the shades of red).
    6. Create masks to detect the red color only.
    7. Refine the masks by using morphology techniques
    8. Create anti-mask to determine all the colors except red.
    9. Combine the background and the current frame.
    10. Let the magic begin!

How to run this code?

  • Fork this repository.
  • Download soource code.
  • Open command prompt.
  • Switch to the directory where the project is stored.
  • Run the background.py file using python background.py
  • Run the invisibility_cloak file using python invisibility_cloak.py

Demo

video-to-gif-converter (1)

Thanks! ๐ŸŽ‰

invisibility-cloak's People

Contributors

sakshigupta265 avatar

Stargazers

 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.