dtr43
dtr43

Reputation: 155

Drawing Region Adjacency Graph

Having centroids of superpixels for an image, is there any MATLAB function for drawing region adjacency graph ?

  L = superpixels(A, 200);
  K=regionprops(L, 'Centroid');  % Detemining centroid coordinates of each superpixels

Centroid coordinates Desired Output

P.S. Similar but not exact solutions :

https://www.mathworks.com/matlabcentral/fileexchange/16938-region-adjacency-graph-rag

https://www.mathworks.com/matlabcentral/fileexchange/53614-image-graphs

Upvotes: 5

Views: 543

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

There are a huge amount of ways of generating graphs from nodes, and you have not specified which one you want.

One that resembles the image you provided (but its not the same) would be triangulating the domain with delaunay(). You can generate a triangulation() object from that, which contains more usable information than the output of delaunay

Alternatively, if you have your own criteria for connecting the nodes that you decided not to share, you can use graph() to generate any topology of graphs.

If you have it in a triangulation format, plotting it can be done with triplot(), trimesh() or some others. With a hold on and triplot() you will find the closest to the figure you posted.

If you want working code I am happy to provide if you add a runnable snippet in the question.

Upvotes: 4

Related Questions