How can shapes be detected by an algorithm?
Shape detection is usually done after blob detection i.e. once the blob details are obtained and it can be processed to find shape of the blob for further classification of blobs. There are various advanced means of shape detection and research is still going on to find even better algorithms for the same.
What is shape detection?
The Shape Detection API is a set of services exposing image processing like OCR (text detection), barcode/QR scanning or face detection capabilities of the underlying system to the Web applications. The availability and quality of the detection varies on the OS & hardware – the API exposes those services as-is.
How to detect square OpenCV?
Compute the aspect ratio of the contour cnt. Set a range of aspect ratios to detect the square. We set it [0.9, 1.1]. If the ratio is between 0.9 and 1.1, the detected contour is a square else it is a rectangle.