How to find adjacent object of an labeled image?

1 回表示 (過去 30 日間)
Casio Uploader
Casio Uploader 2018 年 6 月 6 日
編集済み: Casio Uploader 2018 年 6 月 9 日
Consider the attached labeled image of 10 objects. Each object is denoted by a numeric value 1-10.
I want to count adjacent objects for each that it shares a border with. For example for object 2 it shares the border with 1 and 3. So input will be 2 and output will be 1 and 3.
For the case of 7. Input 7, Output 3,4,6,8,9,10

採用された回答

Image Analyst
Image Analyst 2018 年 6 月 6 日
This can be done with graycomatrix(). Trust me. Please think about it and try it yourself first.
  1 件のコメント
Casio Uploader
Casio Uploader 2018 年 6 月 9 日
編集済み: Casio Uploader 2018 年 6 月 9 日
Thanks, It worked... Just few lines of code for other help:
glcms=graycomatrix(Labled Image);
kkkk=glcms(:,SupNum); %if you want to find neibours of 1,then input SupNum=1
[rrrr,~]=find(kkkk>0); aa=find(rrrr==SupNum); rrrr(aa)=[];
%%rrrr is output matrix which contains the neighbours of 1(or your desired one)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by