Reputation: 79
I have an image matrix. After, I apply the superpixel algorithm to obtain the labeled matrix and I want to generate the adjacency matrix from this labeled image, my code is like that:
I=imread(myimage);
SP=superpixelalgo(I);
How I can generate the adjacency matrix from SP
? I need something like what is described below:
my code is like this:
my image of size 10x10
I=
// Applying my superpixels algo
L=superpixels(I);
L=
the number of superpixels is:
SP=length(unique(L))=3; // so we have 3 regions
I want now to generate an adjacency matrix of size 3x3 for the regions
Upvotes: 0
Views: 1000
Reputation: 1311
If you have the most recent version of MATLAB (R2015b), then try the function adjacentRegionsGraph in the MATLAB Central File Exchange submission called Image Graphs.
Upvotes: 2