Finding adjacent superpixels in an image
Afficher commentaires plus anciens
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 ?
Réponses (1)
Image Analyst
le 10 Mar 2019
Modifié(e) : Image Analyst
le 10 Mar 2019
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)=[];

1 commentaire
Nazir Shanbe
le 11 Mar 2019
Catégories
En savoir plus sur Image Segmentation dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!