【发布时间】:2017-02-16 00:06:50
【问题描述】:
我有一个使用 bwlabel 标记的 blob 图像,我想找到一个具有像素位置 [x,y] 的 blob 并通过删除其余 blob 来显示它。 这是我写的代码,但它没有给出正确的答案,请修复这个
[y, x] = ginput(1);
x = round(x);
y = round(y); % here x and y is a location of blob i want to keep
BW = bwlabel(newImgg,4) ; % labelled image contains several blobs
% figure, imshow(BW, [])
props = regionprops(logical(BW),'all');
while(1)
for k = 2:length(props)
if ismember([x,y],props(k,1).PixelList) == [1, 1];
keeperIndex = k;
break
end
end
break
end
keeperBlobsImage = ismember(BW, keeperIndex);
keeperBlobsImage = imfill(keeperBlobsImage,'holes');
figure, imshow(keeperBlobsImage,[])
谢谢,
戈皮
【问题讨论】:
-
不是答案,只是评论,因为我不知道 Matlab。也许您可以在图像副本中为每个检测到的 blob 着色,然后查看该像素的颜色以确定它属于哪个 blob。
-
我正在使用基本上是灰度的医学 dicom 图像,我不想更改像素值,我认为这不是我想要做的,谢谢你的建议
标签: image matlab image-processing