In this session, you have learnt the basic pipeline for image processing. These techniques are not just limited to OCR or detecting vehicles but can be used in a lot of other applications as well. So you have learnt that before we do any preprocessing, the first step is that we convert the image into greyscale which increases its processing speed and also it makes further preprocessing easier since we have to deal with an only single channel. The preprocessing pipeline is heavily dependent on the type of image and the results we expect from that.
Cenerally, we remove graininess (a form of noise) if it present in the image using smoothing/blurring. The functions that you can use straightway are Caussian Blur, Median blur and Bilateral Filtering present in OpenCV. Blurring can also make the edges to fade away which is a kind not desired. But this can be countered using thresholding.
Next, we do thresholding, that is converting the pixels to either o or 255, making a sharp distinction between the object and background. Again, there are many straight to use functions from OpenCV for thresholding like Simple Thresholding, Adaptive Thresholding and Otsu’s Binarization. Further, we can perform morphological transformations such as dilation and erosion if the image after thresholding is noisy.
If you want to extract some objects from the preprocessed image, you can perform operations such as finding contours and hulls in an image.
Finally, you have also seen that since a contour is an object (having boundary), it can have some properties such as area, parameters, diagonal size, etc. You can store these properties by making an object in Python. Here, the object was defined by the Blob() class. We validate these blobs by separating out the vehicles from other moving objects like person etc. All these object classes are stored in a list called currentframeBlob(), which will be used for tracking.
Report an error