Finding adjacent superpixels in an image
古いコメントを表示
After segmenting an image into N superpixels, I need to specify the superpixels that are adjacent to a superpixel.
[L,NumLabels] = superpixels(A,200);
How can I specify the adjacent superpixels for each of superpixels?
B=imread('H.jpg');
[L,N] = superpixels(B,200);
glcms=graycomatrix(L);
kkkk=glcms(:,50); %SupNum=50
[rrrr,~]=find(kkkk>0);
aa=find(rrrr==50);
rrrr(aa)=[];

How it could be fixed or any working solution ?
回答 (1 件)
Image Analyst
2019 年 3 月 10 日
編集済み: Image Analyst
2019 年 3 月 10 日
glcms is an 8 by 8 matrix. It does not have a fiftieth column. Not sure what you're thinking, so not sure how to fix it. What superpixel (what label number) are you hoping to find neighboring superpixels of?
rgbImage=imread('H.jpg');
subplot(2, 1, 1);
imshow(rgbImage);
axis('on', 'image');
title('Original Image', 'FontSize', 18);
[labeledImage, N] = superpixels(rgbImage,200);
subplot(2, 1, 2);
imshow(labeledImage, []);
axis('on', 'image');
title('Labeled Image', 'FontSize', 18);
% Nonsense after this:
glcms=graycomatrix(labeledImage);
kkkk=glcms(:,50); %SupNum=50
[rrrr,~]=find(kkkk>0);
aa=find(rrrr==50);
rrrr(aa)=[];

カテゴリ
ヘルプ センター および File Exchange で Image Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!