This university project is an implementation of a visual system which is able to analyze motorcycle connecting rods, by applying the following steps:
- A grayscale image is loaded and binarized using
Otsu's method - The image is bitwise inverted to get a white foreground and a black background
- Morphological operations are carried out in order to detach touching rods
- Blobs are extracted using
connected components labeling - Blobs are filtered using a threshold on the blob's area, to remove iron powder and distractors
- Circles are calculated using a custom
contour findingmethod and theHaralick's circularitymeasure - Blob's
momentsare calculated using a custom method - Blob's
orientationand its bounding box are determined - Blob's
shape features, like length and width, are calculated - The number of holes inside each rod is computed, based on the
Euler number - Finally, results are printed out
In the whole execution, images of the happening processing are shown for debug purposes.
This software is written in Python 3.7.6, using the following third-party libraries:
plac 1.1.3, to parse from CLI "the easy way"scipy 1.4.1, to efficiently perform scientific computationsopencv-python 4.2.0.32, to exploit some computer vision algorithms
To install the software, just clone this repository locally.
To execute it, cd into the downloaded folder (cv-con-rod-inspection) and run
python inspection.py -i "<image_path>"The last thing to refine is how to detach touching rods, without altering their main structure.
