フィルターのクリア

Outer and inner contour of the image from the centroid

2 ビュー (過去 30 日間)
Ivan Shorokhov
Ivan Shorokhov 2015 年 1 月 5 日
コメント済み: Image Analyst 2015 年 1 月 5 日
Hello everybody,
I have following image:
I would like to find the Outer and inner contour of the image from the centroid, for example as here:
I would appreciate any help!
Thanks in advance!

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 5 日
Use bwconvhull() and then bwboundaries(). The outer is the boundaries of the convex hull. To get the inner, subtract or XOR the original from the convex hull, then call bwboundaries().
  2 件のコメント
Ivan Shorokhov
Ivan Shorokhov 2015 年 1 月 5 日
編集済み: Ivan Shorokhov 2015 年 1 月 5 日
Dear Image Analyst,
I have tried to implement your answer, but it didn't work, could you show me please how to do it right.
Here is the result and code:
close all; clc; clear all;
original=imread('LA_shape.jpg');
original = rgb2gray(original);
figure; imshow(original);
outer = bwconvhull(original,'objects',4);
subplot(2,2,1);imshow(outer);
B = bwboundaries(outer,'noholes');
subplot(2,2,2); imshow(outer);
for k=1:length(B),
boundary = B{k};
hold on;
plot(boundary(:,2), boundary(:,1));
end
inner = im2bw(original)- outer;
B2 = bwboundaries(inner,'noholes');
subplot(2,2,3);imshow(inner);
for l=1:length(B2),
boundary1 = B2{l};
hold on;
plot(boundary1(:,2), boundary1(:,1),'r');
end
hold off;
subplot(2,2,4); imshow(original);
hold on;
for l=1:length(B2),
boundary1 = B2{l};
plot(boundary1(:,2), boundary1(:,1),'r');
end
for k=1:length(B),
boundary = B{k};
plot(boundary(:,2), boundary(:,1));
end
Image Analyst
Image Analyst 2015 年 1 月 5 日
You need to take special care to handle the top of the U.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by