find 8 neighbours in image
1 回表示 (過去 30 日間)
古いコメントを表示
hi dears..... plz help me

how i find the 8 neighbours around the white pixels...
3 件のコメント
Image Analyst
2020 年 7 月 4 日
Use imdilate() then and it with the original
neighbors = imdilate(bw, true(3)) & ~bw;
回答 (2 件)
KSSV
2017 年 9 月 21 日
Read about knnsearch
I = imread('2.png') ;
I = rgb2gray(I) ;
[y,x] = find(I) ;
% 8 nearest neighbors
[ny,nx] = size(I) ;
[X,Y] = meshgrid(1:nx,1:ny) ;
% global indices
idx = knnsearch([X(:) Y(:)],[x,y],'k',8) ;
% sub indices
[i,j] = ind2sub(size(I),idx) ;
2 件のコメント
Walter Roberson
2017 年 10 月 17 日
This code does not answer the questions "Find them in what sense? What output are you looking for?"
Mehadi Hasan
2021 年 10 月 22 日
I = imread('2.png') ;
I = rgb2gray(I) ;
[y,x] = find(I) ;
% 8 nearest neighbors
[ny,nx] = size(I) ;
[X,Y] = meshgrid(1:1x,1:1y) ;
% global indices
idx = knnsearch([X(:1) Y(:1)],[x,y],'k',8) ;
% sub indices
[i,j] = ind2sub(size(I),idx) ;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Point Cloud Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!