A real-time AI-powered invisibility portal built using Python, OpenCV, and MediaPipe. The portal follows the user's index finger, dynamically changes size based on finger distance, and reveals the captured background inside the portal to create a magical invisibility effect.
- 🪄 Real-time hand tracking using MediaPipe
- 🎯 Portal follows the index finger
- 📏 Dynamic portal size controlled by thumb-index distance
- ✨ Smooth portal movement
- 🌟 Glowing portal effect
- 👻 Real-time invisibility illusion
- ⚡ Fast performance using OpenCV
- 👋 Gesture-based controls
- Python
- OpenCV
- MediaPipe
- NumPy
AI-Magic-Invisibility-Portal/
│
├── main.py
├── portal.py
├── gesture_recognizer.py
├── requirements.txt
├── README.md
└── screenshots/
git clone https://github.com/YOUR_GITHUB_USERNAME/AI-Magic-Invisibility-Portal.gitcd AI-Magic-Invisibility-Portalpython -m venv venvWindows
venv\Scripts\activatepip install -r requirements.txtpython main.pyAdd screenshots inside the screenshots folder.
Example:
screenshots/
portal_demo1.png
portal_demo2.png
- Animated energy portal
- Particle effects
- Multiple portals
- Portal color customization
- Background stabilization
Sanya Rathore
GitHub: https://github.com/sanya-1612
- Index finger — Move portal position
- Thumb (distance from index finger) — Adjust portal size
| Key | Action |
|---|---|
B |
Capture/Refresh Background |
Q |
Quit Application |
Hand gestures provide an additional way to control the portal without the keyboard.
| Gesture | Action |
|---|---|
| 👌 OK Sign | Capture / Refresh Background |
| ✌️ Peace Sign | Toggle Portal Visibility |
| ✊ Closed Fist | Pause / Resume Portal |
| 🖐️ Open Palm | Reset Portal to Default State |
Gesture recognition uses MediaPipe Hands. Hold each gesture steady for about 1 second for reliable detection. Keyboard shortcuts continue to work alongside gestures.
- Launch the application — a background frame is captured automatically.
- Move the portal — point your index finger at the screen.
- Resize the portal — adjust the distance between your index finger and thumb.
- Use gestures — perform the supported gestures to control portal actions without the keyboard.
- Good lighting improves gesture detection accuracy.
- Only one hand is tracked at a time.
- Hold gestures briefly for reliable detection.
- Keyboard shortcuts remain available as an alternative.
If you like this project, consider giving it a ⭐ on GitHub.
