Search code examples
matlabrectanglesregiondrawrectangle

Represent white spots by rectangles


I have this binary image with white spots: Binary image I want to represent each white spot by a rectangle with the same size of spot and if possible with same orientation. There are any function that do that? I can detect each spot using RP: enter image description here


Solution

  • I would compute the smallest Feret diameter (shortest projection) with corresponding angle, and the perpendicular projection. That usually corresponds to the smallest bounding box.

    See here for MATLAB code on computing Feret diameters: http://www.crisluengo.net/archives/408