如果图像使用 matlab,则区域周围的最小矩形边界框

Minimal Rectangle Bounding box around a region if an image using matlab

您好,我正在使用 matlab 并尝试 select 使用边界框的区域。代码如下图

BW=bwconncomp(I1);
STATS = regionprops(BW, 'FilledArea','BoundingBox','Image');

结果如下图

我正在尝试获得如下所示的输出。可能吗?

我在 File Exchange 上找到了这两个用于生成 oriented bounding boxes 的代码:

  • orientedBoxgeom2dDavid Legland:

    OBOX = orientedBox(PTS) Computes the oriented bounding box of a set of points.

  • imOrientedBox Feret 直径和定向盒子 也由 David Legland

    OBB = imOrientedBox(IMG) Computes the minimum area oriented bounding box of labels in image IMG.

您可能会从 imOrientedBox.

中找到您想要的东西