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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With