A Python project that creates a real-time invisibility cloak effect using OpenCV and NumPy. The program detects green-colored fabric and replaces it with a pre-recorded background, giving the illusion of disappearing.
- Real-time video processing using webcam
- Detects green cloth as the "cloak"
- Smooth masking using morphological operations and Gaussian blur
- Fullscreen display for immersive effect
- Python 3.13
- OpenCV
- NumPy
Install dependencies using pip:
pip install opencv-python numpy- Clone the repository:
git clone https://github.com/your-username/Green-Invisibility-Cloak- Navigate to the project folder:
cd Green-Invisibility-Cloak- Run the program:
python green_invisibility_cloak.py- Make sure you have a green cloth ready for the effect. Press
qto quit.
- Background Capture: The program first captures the static background for a few seconds.
- Color Detection: It converts each video frame to HSV color space and detects green color.
- Masking: Smooths the mask using morphological operations and Gaussian blur.
- Combining Frames: Replaces green regions with the captured background to create the invisibility effect.
This project is open-source and available under the MIT License.
✨ Enjoy creating your own green invisibility cloak!