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.
- 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.
- Python 3.x
- OpenCV (
cv2
) - NumPy (
numpy
)
- Clone this repository:
git clone /~https://github.com/yourusername/Invisibility-Cloak-OpenCV.git
- Navigate to the project directory:
cd Invisibility-Cloak-OpenCV
- Install the required dependencies:
pip install opencv-python numpy
- Run the script:
python invisibility_cloak.py
- Use the sliders to adjust the HSV range for the cloak's color.
- Press
q
to quit the application.
- HSV Color Space:
- Converts frames from BGR to HSV for easier color detection.
- Masking:
- Creates a mask for the selected color range using the trackbars.
- Background Frame:
- Captures the background frame at the start of the script.
- Frame Mixing:
- Combines the mask and background to replace the cloak color with the background.
Feel free to fork this repository and submit pull requests for improvements or new features.
This project is licensed under the MIT License.