【问题标题】:Getting height and width of objects after connected component analysis连通分量分析后获取对象的高度和宽度
【发布时间】:2015-12-23 22:51:38
【问题描述】:

我想在 matlab 中使用 regionprops 'BoundingBox' 属性找到连接组件对象的宽度和高度。我找到并标记了矩形,但我不知道如何提取高度和宽度。那么我该如何提取是吗?我的代码如下所示

cc=bwconncomp(im);    
stats=regionprops(cc,'BoundingBox');    
for n = 1 : length(stats)    
     thisBB = stats(n).BoundingBox;    
     rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...    
     'EdgeColor','r','LineWidth',1 )    
 end    

【问题讨论】:

    标签: matlab


    【解决方案1】:

    您已经提取了矩形的宽度和高度。 BW情况下'BoundingBox'的输出是

    [ corner_x corner_y, width, height]
    

    因此thisBB(3) 是宽度,thisBB(4) 是高度。

    rectangle 函数期望将其作为输入:[x,y,w,h]

    【讨论】:

      猜你喜欢
      • 2012-10-10
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      • 1970-01-01
      • 2012-03-19
      • 2011-09-16
      • 2017-12-26
      相关资源
      最近更新 更多