how to find coordinates of each brick corners using matlab

1 view (last 30 days)
How can i find the coordinates of the four corners of each brick in this figure?
I tried different functions like corner(), and regionprops('Extrema') with no benefits. Problem is the bricks is not usually a perfect rectangle, so i need some kind of sharpening-edge technique or a more "intelligent" find-corner-algorithm to find them.

Answers (2)

Image Analyst
Image Analyst on 9 Oct 2020
I'd call imopen() or watershed() to separate the bricks so they don't touch. Then I'd call regionprops() to get the bounding box of each. If you need the actual pixel in the corner instead of the bounding box corner, then you need to get the boundary with bwboundaries() and find the peaks with findpeaks(). I do this in the attached demo on shape finding.
For fun, I'm also including a demo on how to find the average shape.

Matt J
Matt J on 29 Oct 2020
After applying imopen() like ImageAnalyst recommends, you could download pgonCorners and apply it as in this example in this example

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!