Olena/MilenaDemoGraphRag

From LRDE

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Source file is accessible here.

An online demo is available here.

The aim of this demo is to show how to construct a region adjacency graph.

Input is house.png:

Olena-house.png


Compute the gradient of the picture.

Olena-gradient.png

Run a morphological closure on the gradient output.

Olena-closure.png

Then run a watershed flooding on the morphological closure result. Here is the input image in which the watershed line have been drawn.

Olena-wshed color.png

For each basin, the value is set to the mean color.

Olena-wshed mean colors.png

A Region Adjacency Graph (RAG) is built from the watershed flooding result. Then, a graph vertex image is built from the graph and the input image. Graph vertex image topology is based on a graph. Each graph vertex is mapped to a site, here the mass center of a basin. The site value is set to the mean color of the corresponding basin. Likewise, in graph edge images each graph edge is mapped to a site, here a pair of basin mass centers. The site value is actually the distance between two vertex values.

The following image is generated from a graph vertex image and a graph edge image.

Olena-wst rag.png