I created some MATLAB code, that find somes shapes in an image
using regionpros
and bwbounaries
functions.
I have:
STATS = regionprops(L, 'all');
and from STATS
I could easily find all my shapes Area and Perimeter.
My problem is the following: I want to find the "square" shapes and I do
in all shapes the following calculation 16 * area / (perimeter * perimeter)
,
if this value is near one then I "may" have a square. But other shapes too like
circles or rectangles are near one too. (Also some squares could be rotated
in the image).
Is there a better way to distinguish the shapes (like circles, triangles ...)?