filmov
tv
Measure size of objects with image | Computer Vision | Opencv with Python | Pyresearch
Показать описание
#Pyresearch
#Measure #size #objects #image #ComputerVision #Opencv #Python #Pyresearch
Measure the size of objects in an image using OpenCV
The project provides a script to read an image and based on the dimensions of a reference object find the dimensions of other objects in a scene. The reference object must be the leftmost object in the scene. In the sample images given, a box of dimension 2cm x 2cm is taken as a reference object.
### Constraints
1. Shadow effect: use a dark background
2. Object boundary: use a contrasting background
## Getting Started
### Prerequisites
Python 3
Pip
OpenCV
Numpy
Other prerequisites:
- pip install numpy
- pip install opencv-python
## Algorithm
1. Image pre-processing
- Read an image and convert it to no grayscale
- Blur the image using Gaussian Kernel to remove unnecessary edges
- Edge detection using Canny edge detector
- Perform morphological closing operation to remove noisy contours
2. Object Segmentation
- Find contours
- Remove small contours by calculating their area (the threshold used here is 100)
- Sort contours from left to right to find the reference objects
3. Reference object
- Calculate how many pixels are there per metric (centi meter is used here)
4. Compute results
- Draw bounding boxes around each object and calculate its height and width
Please let me know your valuable feedback on the video by means of comments. Please like and share the video. Do not forget to subscribe to my channel for more educational videos.
Any type of problem you can comment down.
Want more education? Connect with me here:
#python #opencv #cvzone #computervision #ai #shorts
#Measure #size #objects #image #ComputerVision #Opencv #Python #Pyresearch
Measure the size of objects in an image using OpenCV
The project provides a script to read an image and based on the dimensions of a reference object find the dimensions of other objects in a scene. The reference object must be the leftmost object in the scene. In the sample images given, a box of dimension 2cm x 2cm is taken as a reference object.
### Constraints
1. Shadow effect: use a dark background
2. Object boundary: use a contrasting background
## Getting Started
### Prerequisites
Python 3
Pip
OpenCV
Numpy
Other prerequisites:
- pip install numpy
- pip install opencv-python
## Algorithm
1. Image pre-processing
- Read an image and convert it to no grayscale
- Blur the image using Gaussian Kernel to remove unnecessary edges
- Edge detection using Canny edge detector
- Perform morphological closing operation to remove noisy contours
2. Object Segmentation
- Find contours
- Remove small contours by calculating their area (the threshold used here is 100)
- Sort contours from left to right to find the reference objects
3. Reference object
- Calculate how many pixels are there per metric (centi meter is used here)
4. Compute results
- Draw bounding boxes around each object and calculate its height and width
Please let me know your valuable feedback on the video by means of comments. Please like and share the video. Do not forget to subscribe to my channel for more educational videos.
Any type of problem you can comment down.
Want more education? Connect with me here:
#python #opencv #cvzone #computervision #ai #shorts
Комментарии