how to track boundary in matlab

1 回表示 (過去 30 日間)
piku mandal
piku mandal 2018 年 10 月 4 日
編集済み: JSC 2018 年 10 月 4 日
how to track boundary of the red underlined image?
  1 件のコメント
KSSV
KSSV 2018 年 10 月 4 日
Attach original image...

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

採用された回答

JSC
JSC 2018 年 10 月 4 日
編集済み: JSC 2018 年 10 月 4 日
First you should read in the image:
Image=imread('03.png');
Then you can do a color conversion by thresholding on the color channels:
RedChannel=Image(:,:,1);
GreenChannel=Image(:,:,2);
%convert red areas to 1 and others to 0
Image_BW = (RedChannel>200).* (GreenChannel<100);
There is also an app for color thresholding: https://de.mathworks.com/help/images/image-segmentation-using-the-color-thesholder-app.html
Finally you can get a cell array of the boundary pixels with
B=bwboundaries(Image_BW);
and plot the result:
figure(1)
clf
imshow(Image_BW)
%Get and plot boundaries
for i=1:size(B)
Bound=B{i};
hold on
plot(Bound(:,2),Bound(:,1),'g-')
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by