【问题标题】:how to find largest connected component from a black and white image如何从黑白图像中找到最大的连通分量
【发布时间】:2015-02-08 17:40:22
【问题描述】:

我正在尝试从以光盘的中心像素为中心的视网膜图像中提取 360*360 像素的部分。请帮助我如何从图像中找到连接的组件,然后仅在 matlab 中提取较大的组件。

【问题讨论】:

  • 你期待什么样的答案?

标签: matlab connected-components


【解决方案1】:

您可以使用以下代码:

connComp = bwlabel(yourImage); %find the connected components
imageStats = regionprops(connComp,'all'); 
compNumber = size(imageStats);
for i=1:compNumber - 1 % to compare sizes of connected components
   box1 = imageStats(i).BoundingBox;
   compareVar1 = box1(3)*box1(4);
   box2 = imageStats(i+1).BoundingBox;
   compareVar2 = box2(3)*box2(4);
   if compareVar1 > compareVar2
      largestPosition=i;
   end
end
imshow(imageStats(largestPosition).Image) %this is the largest connected component

【讨论】:

  • 一些解释会很好。
猜你喜欢
  • 2017-07-18
  • 2014-07-10
  • 1970-01-01
  • 1970-01-01
  • 2012-05-10
  • 1970-01-01
  • 2015-11-26
  • 2018-05-11
  • 1970-01-01
相关资源
最近更新 更多