Skip to content

An application that detects the presence of people via webcam and plays music when a person is detected. Includes functionalities for controlling music playback and dynamically handling file paths.

License

Notifications You must be signed in to change notification settings

idoalit/webcam-music-detector

Repository files navigation

Webcam Music Detector

Description

This Python application utilizes a webcam to detect the presence of people and plays music when a person is detected. The music continues to play in a loop as long as a person is present in the frame. Once no person is detected, the music stops. The application also features functionality to dynamically handle file paths and manage virtual environments.

Features

  • Real-time person detection using OpenCV.
  • Music playback controlled by Pygame.
  • Dynamic handling of script paths with batch and shell scripts.
  • Virtual environment support for isolated package management.

Requirements

  • Python 3.x
  • OpenCV
  • Pygame
  • Ultralytics YOLOv8

Installation

  1. Clone this repository:
    git clone https://github.com/idoalit/webcam-music-detector.git
  2. Navigate to the project directory:
    cd webcam-music-detector
  3. Create and activate a virtual environment:
    python -m venv venv
    venv\Scripts\activate
  4. Install the required packages:
    pip install -r requirements.txt

Usage

  1. Run the script:

    python music.py

    or use Yolo instead

    python yolo.py
  2. To stop the running script, use the provided stop.bat file.

Batch Files

  • start.bat: Activates the virtual environment and runs the Python script.
  • stop.bat: Closes any running Python scripts.

About

An application that detects the presence of people via webcam and plays music when a person is detected. Includes functionalities for controlling music playback and dynamically handling file paths.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published