Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 405
dtr43 Avatar asked Mar 12 '19 17:03

dtr43


1 Answers

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.

like image 174
Ander Biguri Avatar answered Oct 17 '22 15:10

Ander Biguri