Skip to content

This project demonstrates an invisibility cloak effect using OpenCV in Python. It leverages HSV color space masking, trackbars for dynamic range adjustment, and real-time video processing to replace specific color ranges with a background frame, creating a magical invisibility effect.

Notifications You must be signed in to change notification settings

dipanjanpathak/Invisibility-Cloak-OpenCV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Invisibility Cloak OpenCV

This project demonstrates the creation of an invisibility cloak effect using OpenCV and Python. By utilizing HSV color space, masking techniques, and real-time video processing, it replaces a specific color in the video frame with the background, creating a magical "invisible" effect.


Features

  • Dynamic adjustment of HSV range using trackbars.
  • Real-time video processing with a webcam.
  • Noise reduction using median blur and dilation techniques.
  • Frame merging to achieve a seamless invisibility effect.

Requirements

  • Python 3.x
  • OpenCV (cv2)
  • NumPy (numpy)

Installation

  1. Clone this repository:
    git clone /~https://github.com/yourusername/Invisibility-Cloak-OpenCV.git
  2. Navigate to the project directory:
    cd Invisibility-Cloak-OpenCV
  3. Install the required dependencies:
    pip install opencv-python numpy

Usage

  1. Run the script:
    python invisibility_cloak.py
  2. Use the sliders to adjust the HSV range for the cloak's color.
  3. Press q to quit the application.

How It Works

  1. HSV Color Space:
    • Converts frames from BGR to HSV for easier color detection.
  2. Masking:
    • Creates a mask for the selected color range using the trackbars.
  3. Background Frame:
    • Captures the background frame at the start of the script.
  4. Frame Mixing:
    • Combines the mask and background to replace the cloak color with the background.

Contribution

Feel free to fork this repository and submit pull requests for improvements or new features.


License

This project is licensed under the MIT License.


Author

Dipanjan Pathak
Portfolio Linked In

About

This project demonstrates an invisibility cloak effect using OpenCV in Python. It leverages HSV color space masking, trackbars for dynamic range adjustment, and real-time video processing to replace specific color ranges with a background frame, creating a magical invisibility effect.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages