Code Monkey home page Code Monkey logo

invisible-cloak-'s Introduction

About

In this project we try to make a cloak invisible with the help of OpenCV. The technique here used is just opposite to that of green screening. In green screening effect we remove the background but here we will remove the foreground frame.

Steps that will be followed

  1. Capture and store the background frame. (This will be done for few seconds)

  2. Detect the red colored cloth using color detection and segmentation algorithm.

  3. Segment out the red colored cloth by generating a mask. (used in code)

  4. Generate the final augmented output to create a magical effect. (harry.avi)

For simplicity, here we will make a red colored cloth disappear. We can also make other color disappear by updating the corresponding HSV values.

What is HSV?

1)H:Hue

Hue is the color portion of the model, expressed as a number from 0 to 360 degrees:

  • Red falls between 0 and 60 degrees.

  • Yellow falls between 61 and 120 degrees.

  • Green falls between 121–180 degrees.

  • Cyan falls between 181–240 degrees.

  • Blue falls between 241–300 degrees.

  • Magenta falls between 301–360 degrees.

2)S:Saturation

Saturation describes the amount of grey in a particular color, from 0 to 100 percent. Reducing this component toward zero introduces more grey and produces a faded effect. Sometimes, saturation appears as a range from just 0–1, where 0 is grey, and 1 is a primary color.

3)V:Value

Value works in conjunction with saturation and describes the brightness or intensity of the color, from 0–100 percent, where 0 is completely black, and 100 is the brightest and reveals the most color.

To learn about the variations in HSV values of red color you can also visit:- http://hanzratech.in/2015/02/07/caveat-thresholding-hue-component.html

Other colors

Blue color

low_blue = np.array([94,80,2])

high_blue = np.array([126,255,255])

Green color

low_green = np.array([25, 52, 72])

high_green = np.array([102, 255, 255])

Every color except white

low = np.array([0, 42, 0])

high = np.array([179, 255, 255])

Note:- In order to find HSV values for other colors you can visit following site:-http://colorizer.org/

When you run the program wait for few seconds, let the webcam capture the background image. Then you can come inside the frame with your magical Cloak and be invisible. To stop the video press 'q'.

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.