Skip to content

Latest commit

ย 

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Stereo-Object-Detection

๐Ÿš€ Smart Vision System using ESP32-CAM + YOLO

๐Ÿ“Œ Problem Statement

Visually impaired individuals and general users often lack an affordable, portable system for real-time environmental awareness. Existing solutions are expensive, bulky, or require cloud dependency.


๐Ÿ’ก Solution

We built a low-cost, real-time smart vision system using an ESP32-CAM and an Android application powered by YOLO object detection.

The system captures live images, transmits them wirelessly, processes them on-device, and provides visual + audio feedback to the user.


๐Ÿง  Key Features

  • ๐Ÿ“ท Real-time image capture using ESP32-CAM
  • ๐Ÿ“ก Wireless transmission over WiFi (HTTP)
  • ๐Ÿค– On-device object detection using YOLOv8
  • ๐Ÿ“ Distance estimation (based on bounding box scaling)
  • ๐Ÿ”Š Voice feedback using Text-to-Speech (TTS)
  • ๐Ÿ“ฑ Clean Android UI for portable,offline and light monitoring
  • ๐Ÿ’ป WEB-APP for more accurate detections, hosted locally
  • โšก Low-cost and portable edge solution

๐Ÿ—๏ธ System Architecture

       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚      ESP32-CAM (L)   โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
                 โ”‚ WiFi (Image Stream / Capture)
                 โ–ผ
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚      ESP32-CAM (R)   โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
                 โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚   Web-App Server     โ”‚
        โ”‚     (app.py)         โ”‚
        โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
        โ”‚ โ€ข Stereo Matching    โ”‚
        โ”‚ โ€ข WLS Filtering      โ”‚
        โ”‚ โ€ข Depth Estimation   โ”‚
        โ”‚ โ€ข YOLOv8 Detection   โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚   Browser UI (User)  โ”‚
        โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
        โ”‚ โ€ข Camera Feeds       โ”‚
        โ”‚ โ€ข Depth Map          โ”‚
        โ”‚ โ€ข Bounding Boxes     โ”‚
        โ”‚ โ€ข Distance (meters)  โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


    (Alternative Mobile Pipeline)

       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚     ESP32-CAM        โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚ WiFi (Image POST)
                 โ–ผ
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚   Android Device     โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚ โ€ข YOLOv8 Detection   โ”‚
       โ”‚ โ€ข Distance Estimationโ”‚
       โ”‚ โ€ข Text-to-Speech     โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ–ผ
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚      User Output     โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚ โ€ข Bounding Boxes     โ”‚
       โ”‚ โ€ข Labels             โ”‚
       โ”‚ โ€ข Audio Alerts       โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”„ Workflow Diagram

๐ŸŒ WEB-APP Pipeline

ESP32-CAM (L/R) -> WEB-APP: Send Stereo Frames
WEB-APP -> Stereo Engine: Compute Disparity (WLS)
WEB-APP -> YOLOv8: Detect Objects
YOLOv8 -> WEB-APP: Detection Results
WEB-APP -> WEB-APP: Distance Calculation
WEB-APP -> User (Browser): Display + Depth Map + Distances

๐Ÿ“ฑ ANDROID Pipeline

ESP32-CAM -> APP: Send Image Frame
APP -> YOLOv8: Process Image
YOLOv8 -> APP: Detection Results
APP -> APP: Distance Calculation
APP -> User: Display + Voice Output

๐Ÿ”Œ Hardware Requirements

Component Description
ESP32-CAM (AI Thinker) Camera + microcontroller
5V Power Supply Stable external power
Jumper Wires Connections

๐Ÿ”ง Hardware Setup

Connections:

  • 5V โ†’ ESP32 5V
  • GND โ†’ ESP32 GND

โš ๏ธ Important:

  • Use stable 5V supply (ESP32-CAM is sensitive to voltage drops)
  • During programming: connect GPIO0 โ†’ GND
  • After upload: remove GPIO0 connection

๐Ÿ“ก Software Stack

๐Ÿ”น Embedded (ESP32)

  • Arduino IDE
  • ESP32 Camera Library
  • WiFi + HTTP Streaming

๐Ÿ”น WEB-APP (Main System)

  • Python (Flask / FastAPI)
  • OpenCV (Stereo Matching + WLS Filtering)
  • YOLOv8 (PyTorch / ONNX)
  • NumPy (Depth Computation)
  • HTML + CSS + JavaScript (Browser UI)

๐Ÿ”น Mobile App (Alternative)

  • Android (Kotlin / Java)
  • YOLOv8 (TFLite)
  • TextToSpeech API

โš™๏ธ Installation Guide

1๏ธโƒฃ ESP32 Setup

  1. Install Arduino IDE

  2. Add ESP32 board:

    https://dl.espressif.com/dl/package_esp32_index.json
    
  3. Select:

    Board: AI Thinker ESP32-CAM
    
  4. Upload code to both cameras (Left & Right)

  5. Open Serial Monitor โ†’ note both IP addresses


2๏ธโƒฃ WEB-APP Setup (Main System)

  1. Clone the repository:

    git clone https://github.com/your-username/your-repo.git
    cd your-repo
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Update camera URLs in app.py:

    LEFT_CAM_URL = "http://<left_cam_ip>"
    RIGHT_CAM_URL = "http://<right_cam_ip>"
    
  4. Run the server:

    python app.py
    
  5. Open in browser:

    http://<your-device-ip>:5000
    

3๏ธโƒฃ Android App Setup (Alternative)

  1. Open project in Android Studio

  2. Connect phone

  3. Grant permissions:

    • Camera
    • Microphone (for TTS output)
    • Internet
  4. Run the app


๐Ÿš€ Usage Instructions

  1. Turn on mobile hotspot
  2. Power ESP32-CAM
  3. Ensure both devices are on same network
  4. Enter ESP32 IP in app (if required)
  5. Start detection

๐Ÿ“ Distance Estimation (Stereo Triangulation)

This project estimates distance using stereo triangulation, similar to how human vision perceives depth.

๐Ÿ”ข Core Formula

Distance= f*B/dโ€‹

f (Focal Length): Camera parameter in pixels (FOCAL_LENGTH_PX = 1700)

B (Baseline): Distance between the two cameras (BASELINE_CM = 10 cm)

d (Disparity): Horizontal pixel difference of the object between left and right images

๐ŸŽฏ How Disparity is Calculated:

Object Matching Detects the same object (e.g., person) in both images using label, position, and size. Refined Matching Extracts a small patch from the object in the left image Uses OpenCV matchTemplate to find the best match in the right image Computes disparity as the difference in X-coordinates

๐Ÿ”„ Smoothing for Stability:

To reduce noise and flickering, the system applies a rolling average (last 10 values) to stabilize disparity and produce smoother distance estimates.

๐Ÿ“Œ Key Insight Large disparity โ†’ Object is close Small disparity โ†’ Object is far


โš ๏ธ Limitations

  • Dependent on lighting conditions
  • Distance estimation is approximate
  • Network latency may affect performance
  • ESP32 has limited processing power

๐Ÿ”ฎ Future Improvements

  • ๐Ÿ“ GPS tracking
  • ๐ŸŽฏ Better distance estimation using depth models
  • ๐Ÿ”‹ Battery-powered portable design
  • ๐Ÿง  Custom-trained YOLO model

๐Ÿงช Demo Instructions (for Judges)

  1. Power the ESP32-CAM
  2. Open the Android app
  3. Show live detection
  4. Demonstrate voice output
  5. Move objects closer/farther to show distance effect

๐Ÿ† Innovation Highlights

  • Combines IoT + Computer Vision + Mobile AI
  • Fully portable and low-cost
  • Works in real-time without cloud dependency
  • Scalable for smart assistive systems

๐Ÿ‘จโ€๐Ÿ’ป Team

  • Ryan Mittal
  • Abdul
  • Aryan Khare

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages