π― An AI-powered desktop tool for removing video backgrounds using YOLOv8 segmentation.
π¨ Choose solid colors, images, or blur effects as your new backdrop β it's fast, clean, and stunningly simple!
- β¨ Features
- πΈ Demo Screenshots
- π§ How It Works
- π File Structure
- βοΈ Requirements
- π How to Run
- π§© Technologies Used
- π¨π»βπ» Author
- π License
- π§ββοΈ AI-Powered Person Segmentation β Detects humans using
YOLOv8n-seg
. - π¨ Background Options:
- Solid color picker π¨
- Custom background image πΌοΈ
- Gaussian blur effect π
- π Video File Input β Select and process any video file.
- π Progress Tracking β Real-time status updates with loading bars.
- π§ Lightweight YOLOv8n Model β Fast, accurate, and ideal for personal devices.
- π₯οΈ Cross-compatible β Works on both CPU and GPU environments.
from ultralytics import YOLO
model = YOLO("yolov8n-seg.pt")
results = model.track(frame, persist=True, classes=0)
Detects the person (class ID 0) and generates binary masks for each frame.
Based on your choice:
- Color: Overlays the mask with the selected RGB color.
- Image: Resizes and merges a new image background.
- Blur: Applies
cv2.GaussianBlur()
behind the person.
mask = masks[0]
inverse_mask = cv2.bitwise_not(mask)
foreground = cv2.bitwise_and(frame, frame, mask=mask)
background = cv2.bitwise_and(chosen_bg, chosen_bg, mask=inverse_mask)
final = cv2.add(foreground, background)
π¦ CamouflageAI/
β£ π Camouflage AI.py # GUI App using CustomTkinter
β£ π process_video.py # Main processing logic with YOLO
β£ π requirements.txt # Dependencies
β π README.md # Youβre here!
Install all required packages with:
pip install -r requirements.txt
Or manually:
pip install customtkinter opencv-python numpy rembg pillow tkinter moviepy matplotlib scikit-image tqdm pyperclip
π Tested with Python 3.10+ on Windows
python "Camouflage AI.py"
β
Make sure process_video.py
is in the same directory.
πΌοΈ Output videos are automatically saved in the output/
folder.
Made with β€οΈ by Vishnu
βBuild with passion, debug with precision.β π₯
This project is open-source and licensed under the MIT License.
π If you found this useful, leave a β on the repo and share it!