Ask Your Question

Build graph from an image

asked 2013-05-24 13:32:45 -0500

Jawaher Khemakhem gravatar image

I have a binary image and I am trying to build undirected graph from this image in order to apply minimum spanning tree . My idea is from this paper

I have no idea how to build the graph .

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-05-24 16:19:07 -0500

Guanta gravatar image

updated 2013-05-25 07:21:52 -0500

Sorry to not directly answer your question. However, from the paper exist the code by the authors: So maybe you can just have a look at that?

Alternatively you could use other existing segmentation methods, e.g. Power-watersheds: or use one segmentation method of OpenCV, it comes with GrabCut, Watersheds, and (partially) MeanShift (pyrMeanShift()).

edit flag offensive delete link more


Thank you very much for your reply , I looked at the code existent but I didn't understand how they built the graph from the image , precisely the algorithm I mean .

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-25 02:43:00 -0500 )edit

Sry, I don't hvae the time to dig into the code, but I guess (haven't implemented any graph-based algoritm myself yet) that the graph is actually the image itself, thus, a component of the graph is one pixel. Let's say you have a pixel w. value 100 next to one with 30 then the cost of using the edge between those two components could be (depending of course on the cost function) the difference between them, i.e. 70.

Guanta gravatar imageGuanta ( 2013-05-25 07:28:58 -0500 )edit

Many thanks , I got the idea how we can build a graph from an image :)

Jawaher Khemakhem gravatar imageJawaher Khemakhem ( 2013-05-25 08:33:58 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-05-24 13:32:45 -0500

Seen: 1,116 times

Last updated: May 25 '13