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!