[Image-SIG] working with multi-spectral imagery, PIL, and NumPy

Ali Santacruz amsd2013 at hotmail.com
Tue May 8 05:05:09 CEST 2007

Hi Nate,

I am also working in an academic application for image processing (remote 
sensing data) based in Python, which is intended to accompany a book over 
this topic (written in Spanish).

I have been working around the same tools you mention (PIL, Numpy, 
wxPython), as you can see in the attached file, although a problem I have 
found with PIL is that the georeference is lost after the processing (I have 
had also some problems linking this to an interface developed with wxPython, 
a question that I am going to send to the wxPython list soon). Now, I am 
looking toward GDAL.

Maybe you have seen this doc: 
http://www.esri.com/news/arcuser/0405/files/python.pdf, where there is an 
interesting example using GDAL (page 2, listing 1). I tried it with my own 
data, but I got an unexpected result. Anyway, you can also take a look at 
hobutools (http://hobu.biz/software/hobutools/index_html), which include 
several tools (GDAL/OGR, MapScript, …) for Python 2.4.

I have written some functions for image preprocessing (contrast adjustment, 
PCA, filtering) in the R language, which is also a very useful language for 
teaching purposes, although it is not well-fitted for very large datasets, 
like a raster image (that is one of the reasons why I am going to make the 
translation to Python).

I think it is also worthy to look at PCL (Python Cartographic Library) and 
the GRASS/Python interface, but as you know, they require a more advanced 


Ali Santacruz
M.Sc. Geomatics, Student
National University of Colombia
Bogotá D.C.

>From: "Nate Jennings" <nate at deltateck.com>
>To: image-sig at python.org
>Subject: [Image-SIG] working with multi-spectral imagery, PIL, and NumPy
>Date: Fri, 4 May 2007 14:47:39 -0700
>I am working on building an image processing application for a class I am
>teaching in remote sensing.
>I have multi-spectral (multi-band...greater than 3 bands of imagery) that I
>would like to load into a NumPy array so I can process it.  PIL seems to be
>limited to 3 bands for PIL.  Is there any other methods using PIL, NumPy, 
>other to work with more than 3 bands?
>The file format I am working with is TIF.  The data is often from 
>(Landsat, SPOT, RADAR) or hyperspectral.
>I would like to do pixel processing such as custom filters that are not
>found in PIL, band ratios, image enhancements such as Principle Components,
>and image classification (such as maximum likelihood, or ISOData
>(unsupervised classification).  Many of these functions require linear
>algebra, trigonometry functions, and statistics (the use of means, st
>deviations, histograms, etc) as well as 3x3, 5x5, or greater kernels (i.e.
>moving windows).
>>From my research there seems to be some work out there regarding 3 band
>images, performance testing for PIL and C routines, some basic filtering
>functions and kernel use.
>My work is related to remote sensing and GIS.  Yes, I know about GRASS, but
>this is too complicated for my students who know very little about remote
>sensing and GIS.  It looks like QGIS and GRASS have some integration, but 
>is still too cumbersome for novice users.  I have been through a remote
>sensing algorithms class in grad school and I have fundamental knowledge of
>the math and programming logic.  I am just trying to get it to work with
>Python, wxPython interface building, PIL, NumPy, and anything else I may
>need.  Trying to communicate Python to C++ is beyond my capability without
>any serious documentation or samples to work from.  I know C++, but it has
>been over 10 year since I programmed in this and it was done in OS2.
>Please provide me with links, sample code, and/or contacts to follow up
>Thank you in advance with any information.

>Image-SIG maillist  -  Image-SIG at python.org

Express yourself instantly with MSN Messenger! Download today it's FREE! 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filterf.py
Type: text/x-python
Size: 1307 bytes
Desc: not available
Url : http://mail.python.org/pipermail/image-sig/attachments/20070507/522a0374/attachment.py 

More information about the Image-SIG mailing list