MATLAB: How to detect the Hexagon in imageprocessing

digital image processingimag segmentationimage processingImage Processing ToolboxMATLAB

I don't know how to find the hexagon shape in image. please anyone help

Best Answer

Get the boundary of the object with bwboundaries(). Then find out if there are 6 kinks in the boundaries with the FAQ. Then see if the lengths of the sides are similar enough to be considered a hexagon rather than just some arbitrary 6-sided polygon. Also make sure it's convex by checking that the solidity is really close to 1.
Related Question