Skip to content

Manzikevin/python-computer-vision-projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👁️ Computer Vision Projects Sandbox

A collection of Computer Vision (CV) projects exploring Human-Computer Interaction (HCI), real-time object detection, and AI-powered automation using Python, OpenCV, MediaPipe, and YOLO.

This repository currently contains:

  • 🎵 Hand Gesture Music Controller
  • 🚗 YOLO Real-Time Vehicle Counter

📂 Repository Structure

.
├── hand_music_controller.py
├── car_counter.py
├── requirements.txt
├── mysong.mp3
├── yolov8n.pt
└── README.md

🚀 Features

🎵 Hand Gesture Music Controller

  • Real-time hand tracking using MediaPipe
  • Detects finger positions from webcam input
  • Plays music when an open hand is detected
  • Stops music when a closed fist is detected
  • Lightweight and CPU-friendly

🚗 YOLO Vehicle Counter

  • Real-time vehicle detection using YOLOv8 Nano

  • Detects:

    • 🚗 Cars
    • 🏍️ Motorcycles
    • 🚌 Buses
    • 🚚 Trucks
  • Live bounding boxes

  • Vehicle counting

  • Works with webcam or video files

  • Optimized for CPU execution


🛠️ Environment Setup

Prerequisites

Install the required system packages:

sudo apt update

sudo apt install \
python3-venv \
python3-pip \
libgl1-mesa-glx \
libasound2-dev -y

Create a Virtual Environment

python3 -m venv cv_env

Activate it:

Linux/macOS

source cv_env/bin/activate

Windows

cv_env\Scripts\activate

Install Dependencies

pip install -r requirements.txt

🎵 Project 1 — Hand Gesture Music Controller

Control music playback using simple hand gestures captured by your webcam.

Supported Gestures

Gesture Action
✋ Open Hand Play music
✊ Closed Fist Stop music

How It Works

MediaPipe detects 21 hand landmarks.

Finger states are determined using landmark coordinates.

Because image coordinates start at the top-left corner, a raised finger has a smaller Y coordinate than its lower joint.

The rule used is:

Finger Tip Y < Finger PIP Y
        ↓
Finger is UP

Run the Application

Place your music file in the project directory:

mysong.mp3

Then run:

python hand_music_controller.py

🚗 Project 2 — YOLO Real-Time Vehicle Counter

A lightweight vehicle detection system powered by YOLOv8 Nano.


Detection Pipeline

  1. Capture webcam/video frame
  2. Run YOLOv8 inference
  3. Filter vehicle classes
  4. Draw bounding boxes
  5. Display live vehicle count

Supported COCO classes:

Class ID
Car 2
Motorcycle 3
Bus 5
Truck 7

Run the Vehicle Counter

python car_counter.py

To use a video instead of the webcam, change:

source = 0

to:

source = "traffic.mp4"

📦 Technologies Used

  • Python
  • OpenCV
  • MediaPipe
  • YOLOv8 (Ultralytics)
  • NumPy
  • Pygame

⚡ CPU Optimization

This repository is designed to work efficiently on systems without NVIDIA GPUs.

Benefits include:

  • Smaller installation size
  • Reduced dependency footprint
  • Faster setup
  • Lower memory usage
  • Ideal for laptops and virtual machines

🔮 Future Improvements

Hand Gesture Controller

  • Swipe gesture detection
  • Volume control using finger distance
  • Gesture-based media controls
  • Multi-hand support

Vehicle Counter

  • ROI (Region of Interest) counting
  • Object tracking across frames
  • Vehicle speed estimation
  • Lane-wise analytics
  • Traffic statistics dashboard

📸 Example Projects

Project Description
🎵 Hand Gesture Music Controller Control music with hand gestures
🚗 YOLO Vehicle Counter Detect and count vehicles in real time

🤝 Contributing

Contributions, ideas, and improvements are welcome.

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a Pull Request

📄 License

This project is licensed under the MIT License.

Feel free to use, modify, and share it for educational and personal projects.


⭐ Support

If you found this repository useful, consider giving it a ⭐ Star on GitHub. It helps others discover the project and motivates future improvements.

About

A collection of Computer Vision (CV) projects exploring Human-Computer Interaction (HCI), real-time object detection, and AI-powered automation using Python, OpenCV, MediaPipe, and YOLO.

Topics

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages