Skip to content

Asiwaju24/computer_vision

Repository files navigation

Computer Vision Projects — OpenCV & Python

A collection of computer vision projects built with Python and OpenCV, covering real-time face detection, face recognition, motion-based security systems, and an AI voice assistant. All projects run locally using a webcam or image input.


Projects

1. Real-Time Face Detection (alert.py, Face Recognition.py, import cv2.py)

Real-time face detection from a live webcam feed using OpenCV's Haar cascade classifier.

  • Captures live video stream
  • Detects faces frame-by-frame using haarcascade_frontalface_default.xml
  • Draws bounding rectangles around detected faces
  • Prints detection alerts to console

2. Face Recognition System (face_train.py, face_detect.py)

A trained face recognition model that identifies individuals from images or live input.

Training (face_train.py):

  • Loads images from the images/ folder (organised by person)
  • Extracts facial features using OpenCV
  • Trains a recognition model and saves it to face_trained.yml

Recognition (face_detect.py):

  • Loads the trained model
  • Detects and identifies a face in a test image
  • Returns the predicted label and confidence score

Subjects trained on: Messi, Elon, Bezos, Ryan Reynolds, Canu


3. Motion Detection Security Camera (newsecurity.py, security.py)

A motion-sensitive security system that triggers an alert when movement is detected.

  • Compares consecutive webcam frames to detect movement
  • Triggers a siren audio file (siren.wav) or system beep on motion detection
  • Runs continuously until manually stopped

4. AI Voice Assistant (New Ai.py)

A voice-activated assistant using Vosk for offline speech recognition.

  • Listens for voice commands via microphone
  • Handles commands such as playing YouTube videos and fetching Wikipedia summaries
  • Uses pyttsx3 for text-to-speech responses

5. Intent Classifier (model_train.py, intent.json)

Prepares training data for an NLP intent classification model.

  • Loads intent patterns from intent.json
  • Processes and labels patterns for machine learning training

Tech Stack

Area Libraries
Computer Vision OpenCV (cv2)
Face Recognition OpenCV LBPH Recognizer
Speech Recognition Vosk
Text-to-Speech pyttsx3
Audio simpleaudio, winsound
Web Automation pywhatkit
Information Retrieval wikipedia
Data Processing NumPy, scikit-learn

Getting Started

Install dependencies

pip install opencv-python numpy scikit-learn vosk pyttsx3 simpleaudio pywhatkit wikipedia

Train the face recognition model

python face_train.py

Run face detection

python face_detect.py

Run the security camera

python newsecurity.py

Run the voice assistant

python "New Ai.py"

Project Structure

computer_vision/
├── images/                             # Training images organised by person
│   ├── Messi/
│   ├── Elon/
│   ├── Bezoz/
│   ├── Ryan/
│   └── Canu/
├── Face Recognition.py                 # Real-time face detection (webcam)
├── New Ai.py                           # Voice assistant
├── alert.py                            # Face detection with console alerts
├── face_detect.py                      # Face recognition inference
├── face_train.py                       # Face recognition model training
├── haarcascade_frontalface_default.xml # Haar cascade classifier
├── import cv2.py                       # Basic face detection script
├── intent.json                         # Intent patterns for NLP training
├── model_train.py                      # Intent classifier data preparation
├── newsecurity.py                      # Motion detection with audio alert
└── security.py                         # Motion detection with system beep

Note on YOLOv8 Object Detection

A separate real-time object detection project using YOLOv8 and the COCO dataset was developed in Google Colab. It covers custom model training, multi-object recognition across diverse categories, and live webcam inference. The Colab notebook will be linked here once published.


Author

Olaniyan Taslimgithub.com/Asiwaju24

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages