Background removal and change the background during live camera feed.
This project utilizes computer vision techniques to enable real-time background switching in a live video feed. It leverages the MediaPipe library for selfie segmentation, allowing users to seamlessly change their background during video capture. The project is implemented in Python using OpenCV and MediaPipe.
- Real-time background switching using selfie segmentation.
- User-friendly interface for interactive control.
- Predefined set of background images with the ability to add more.
- Dynamic adaptation to changes in the background image set.
- Supports keyboard inputs for background switching and user input.
- Python 3.x
- OpenCV (
pip install opencv-python) - MediaPipe (
pip install mediapipe)
-
Clone the repository:
git clone https://github.com/Shubham-bit-hash/BackBuster/.git
-
open the folder where the files downloaded:
downloads/BackBuster/
-
Run the application:
python main.py
-
Use the following keyboard inputs:
- Press 'Esc' to exit the application.
- Press 'n' to switch to the next background image.
- Press 'i' to input the index of the background image.
- Add your background images to the
./back/directory. - Update the
bg_imageslist inmain.pywith the new image file paths.
bg_images = [
cv2.imread('./back/office.jpg'),
cv2.imread('./back/bedroom.jpg'),
cv2.imread('./back/1.jpeg'),
cv2.imread('./back/2.jpeg'),
# Add more background images as needed
]