Skip to content

sumeruJH/Object-Size-Measurement

 
 

Repository files navigation

YOLOv9 + MiDaS Real-Time Object Size Estimation

This project enables real-time object detection and physical size estimation using YOLOv9 and MiDaS. It uses a webcam and provides a browser-based interface via Flask.

📏 Measurements are calibrated using a known reference object (like an A4 paper or credit card) for accurate pixel-to-centimeter scaling.


📹 Demo Preview

Demo


📦 Features

  • ✅ YOLOv9 object detection (runs on GPU or CPU)
  • ✅ Depth-aware size estimation using MiDaS
  • ✅ Web UI for real-time preview (OpenCV + Flask)
  • ✅ Reference-based calibration using a fixed object (e.g., A4 paper or credit card)

🧰 Requirements

  • Python 3.10
  • CUDA 12.1 (for GPU mode — optional)
  • A webcam
  • Python packages listed in requirements.txt

🚀 Installation

# 1. Clone YOLOv9 repo (used for model modules)
git clone https://github.com/WongKinYiu/yolov9.git

# 2. Set up virtual environment
python -m venv yolov_env
.\yolov_env\Scripts\activate

# 3. Install required Python packages
pip install -r requirements.txt

💡 Note

This project does not include the model weight files for YOLOv9 and MiDaS due to file size and licensing limitations.

Please manually download the following files and place them in the weights/ folder:

Your directory structure should look like this:

YOLOv9-Object-Size-Measurement/
│
├── app.py
├── yolo_midas_utils.py
├── requirements.txt
├── camcheck.py
├── camtest.py
├── yolov9/                     # cloned yolov9 repo
├── weights/
│   ├── yolov9-e.pt
│   └── dpt_hybrid_384.pt
└── templates/
    └── index.html

🖼️ Preview

The application uses your webcam to display bounding boxes around objects, showing real-time width and height in centimeters. Measurements are adjusted based on a known reference object’s scale.


🙌 Acknowledgements

  • YOLOv9 by WongKinYiu
  • MiDaS by Intel ISL
  • OpenCV, Flask, and PyTorch communities

Built by @JANGRAEJO 🚀

About

Real-time object size measurement using YOLOv9 and OpenCV in a browser interface. Calibrated using a known reference object (e.g., credit card) for size accuracy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 93.6%
  • HTML 6.4%