ucmou
ucmou

Reputation: 79

Create a region adjacency matrix from a labeled image

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:

algorithm


my code is like this:

my image of size 10x10

I= myimage

// Applying my superpixels algo

L=superpixels(I);
L=

my superpixel matrix

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

Answers (1)

Steve Eddins
Steve Eddins

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

Related Questions