This project enables real-time detection of objects and measurement of their sizes using a camera feed or images. It uses OpenCV for object detection based on Aruco markers and measurement based on a homogeneous background.
- Clone the repository:
- Install dependencies:
https://github.com/anandakumarak/Object-Size-Detection-Using-OpenCV.git
pip install opencv-python numpy
To use Aruco markers as reference points for object size measurement, you can download them from the Aruco Generator website. Once downloaded, print the marker and place it in the view of the camera for measurement.
- Run the script:
- Position the camera:
- Use Aruco markers as reference points:
- View measurement results:
python measure_object_size_camera.py
Point the camera towards the objects you want to measure. Ensure the objects are placed on a homogeneous background for accurate measurements.
The system uses Aruco markers as reference points for measuring object sizes. These markers should be visible in the camera frame along with the objects.
The script will display the live camera feed with Aruco markers detected and object sizes measured in centimeters.
- Run the script:
- Provide an image:
- Detect objects and measure sizes:
python measure_object_size.py
Ensure you have an image (`phone_aruco_marker.jpg` in this example) with objects and Aruco markers visible.
The script will load the image, detect objects, measure their sizes, and display the annotated image with object sizes.
Below is an example output image showing object detection and size measurement annotations: