Created: 2011-07-14 03:23
Updated: 2019-02-05 13:43

imgraph: a package to create/manipulate graphs on images

This package provides standard functions to create and manipulate edge-weighted graphs of images: create a graph, segment it, compute its watershed, or its connected components...


1/ Torch7 is required:

Dependencies, on Linux (Ubuntu > 9.04):

$ apt-get install gcc g++ git libreadline5-dev cmake wget libqt4-core libqt4-gui libqt4-dev libboost-all-dev

Dependencies, on Mac OS (Leopard, or more), using Homebrew:

$ brew install git readline cmake wget qt

Then on both platforms:

$ git clone
$ cd torch
$ mkdir build; cd build
$ cmake ..
$ make
$ [sudo] make install

2/ Once Torch7 is available, install this package:

$ [sudo] torch-rocks install imgraph

Use the library

First run torch, and load imgraph:

$ torch
> require 'imgraph'

Once loaded, tab-completion will help you navigate through the library:

> imgraph. + TAB
imgraph.colorize(           imgraph.connectcomponents(  
imgraph.graph(              imgraph.histpooling(        
imgraph.segmentmst(         imgraph.testme(             
imgraph.watershed(          imgraph.gradient(

To get quickly started, run the testme() function:

> imgraph.testme()

which computes a few things on the famous image of Lena:


Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more