Population
Image processing library in C++
Python

Compilation

You do as in this page CMake (cross-platform) but this time you quote the BUILD_PYTHON_SWIG before to generate it.

In windows, you need to configure the PATH environment variable based on the location of SWIG and Python (download here https://www.python.org/downloads/windows/, and http://www.swig.org/download.html).

In linux, you need to install python and swig

aptitude install swig python-dev

After the compilation, in the build the binaries, you have three files : population.py, _population.so and firststep.py. With your favourite IDE (PyDev plugging for eclipse is nice http://www.vogella.com/articles/Python/article.html), you can execute the file firststep.py

1 import sys
2 import os
3 PathPop= ""
4 if os.path.isfile(PathPop+"population.py")==0:
5  print "set the variable PathPop to the path where you compile population, for instance D:\Users/vtariel/Desktop/ANV/Population-build/. This folder must contain population.py"
6  sys.exit(-1)
7 sys.path.append(PathPop)
8 from population import *
9 
10 img =Mat2UI8()#2d grey-level image object
11 img.load(PathPop+"image/iex.png")#replace this path by those on your computer
12 img.display("initial",False)
13 pde = PDE()
14 img = pde.nonLinearAnisotropicDiffusion(img)
15 proc = Processing()
16 threshold = proc.thresholdOtsuMethod(img)#threshold segmentation with OtsuMethod
17 threshold.save("iexseg.png")
18 visu = Visualization()
19 color = visu.labelForeground(threshold,img)#Visual validation
20 color.display()
21 

displaying a grey image and a segmented image.

The most important is that the notations remains almost the same with the C++ language. So the full documentation is also on the module page. For each tutorial, you can find python code at $${PopulationPath}/other/tutorial/.