Isolate the outline of a shape.

2 ビュー (過去 30 日間)
Alex Perrakis
Alex Perrakis 2021 年 8 月 31 日
コメント済み: Matt J 2021 年 8 月 31 日
Hello i have through binarizing and using bwpropfilt i have got the attached image, my question is : does anyone have an idea how i can isolate the outline of the shape in the middle and have it as a shape?

採用された回答

Matt J
Matt J 2021 年 8 月 31 日
編集済み: Matt J 2021 年 8 月 31 日
Perhaps as follows?
load Image
BW=bwareafilt(Image,1);
BW=imerode(bwconvhull(BW),strel('disk',20))& ~BW;
BW=imopen(BW,ones(10,1));
BW=bwperim(bwareafilt(BW,1));
imshow(BW); zoom(3)
  2 件のコメント
Alex Perrakis
Alex Perrakis 2021 年 8 月 31 日
Thanks i found a way with bwboundaries, now i have another problem.
pic01=imread("01.tiff");
pic050=imread("32.tiff");
%pic50=im2gray(pic050);
%pic1=im2gray(pic01);
newpicture=imsubtract(pic01,pic050);
%imshow(newpicture)
level = graythresh(newpicture);
level = 0.1405;
newbinpic = imbinarize(newpicture,level);
%imshowpair(newpicture,newbinpic,'montage')
newbinpic2=bwpropfilt(newbinpic,'perimeter',1);
imshowpair(newbinpic2,newpicture,'montage');
boundaries = bwboundaries(newbinpic2);
binaryImage = 0.6< newbinpic2 & newbinpic2<1;
hold on
for k=1:length(boundaries)
thisBoundary = boundaries{k};
x = thisBoundary(:,2);
y = thisBoundary(:,1);
plot(x,y,'r-','Linewidth',2);
end
I wanna somehow save the x and y coordinates and plot em in a normal plot, because this plots it on the image i linked before.
Matt J
Matt J 2021 年 8 月 31 日
Thanks i found a way with bwboundaries, now i have another problem.
If so, you should post it as a new question.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by