Orfeo ToolBox is not a black box

It seems that C++ programming can be cumbersome for some users. Well, OTB allows you to work also in other programming languages as for instance Python. The Pylab Project which gathers numeric and scientific Python packages such as NumPy, SciPy and Matplotlib is considered as having the same features as some commercial scientific environments. Some people consider that Pylab is even more powerful than these commercial tools, since you get for free the power of a full featured and general purpose programming language as Python.

Recently I needed to quickly plot the temporal profiles of several pixels coming from temporal image series in order to easily assess the impact of a correction algorithm. I have to admit that my first idea was to generate simple ASCII files with the pixel values and then feed these files to Gnuplot. However, I found a more elegant (at least from my point of view) way to do this.

I use the OTB Python bindings in order to read my images (2 GeoTiff files with 49 bands each). Using the “GetPixel” method, I access the pixels I want to plot. Finally I use pylab to plot 2 temporal profiles (before and after correction). Here goes the code.

Of course, you can imagine to make this script a little bit more interactive in order to choose other pixel coordinates, etc., but I hope you grasp the power of this approach. By using the OTB Python bindings and other freely available open source Python goodies (NumPy, SciPy, Matplotlib, rpy) you get the user friendly approach of Octave, Scilab and their commercial counterparts plus the power of OTB (which in turn makes available ITK, OSSIM, etc.).