Software for Satellite Image processing and analysis
Programming languages
Ideal programming language for satellite image processing and analysis
- Fast array operations
- Image processing and numeric/scientific routines
- Visualization
- Various data formats
- Processing of files and metadata
- Short development cycles
- Very high level of abstraction
- Interactive
Ideal programming language for satellite image processing and analysis?
- Assembler
- Fortran, C/C++, Java
- Perl, Python
- Matlab, IDL
- Visual and menu driven environments, ENVI, GIS
Visual environments
Examples
Programming versus visual environments
- Visual environments are very useful for specific tasks
- Closed commerical software
- Programming offers more flexibility
- ESRI's ArcGIS scripting with python
Scripting verus Traditional Programming
- Traditional programming refers to building usually large, monolithic systems
- Fortran, C/C++, Java
- Scripting means programming at a high and flexible abstraction level
- Perl, Python, Ruby, Scheme, Tcl
- Scientific computing environments
- IDL, Matlab/Octave, Maple, Mathematica, R
Why Python?
Scalability
- The ability to scale from easy to difficult problems and the ability for beginners and experts to be comfortable.
- Python is easy enough to be a first language and powerful enough to write complex applications
- Scientific computing is more than number crunching
- Converting data formats
- Extracting metadata from text
- Working with a large number of files and directories
- Object oriented programming possible, but not required
- Freely available and runs on Unix, Mac and Windows
- Simple interfacing of C,C++ and Fortran code
- Heterogeneous data structures are easy to use
- Readable and compact code
Scientific Python Environment
- Basic Python has limited instruction set
- Extensions (modules)
- Scientific modules (scipy/numpy)
- Interactive environment (ipython)
- Plots and visualization (pylab)
Getting started with IPython
Invoking the IPython shell
ipython ipython -pylab
loads pylab module and enables interactive plotting
Quit with CTRL-D
Getting help
help() help modules
list available modules
Features of IPython:
- Command history (up, down)
- Completion by typing TAB
- System commands through magic functions cd, ls, env, pwd
- Access to Unix shell by prefix ! {!ls -s $|$ sort -g}
- Debugging and profiling
Program control: run
Print interactive variables who, whos
Importing modules
There are many ways to import modules. The resulting namespaces are different
Import module SciPy: import scipy
List SciPy subpackages help(scipy) or scipy.info(scipy)
Import SciPy subpackage n-dimensional image package import scipy.ndimage
List ndimage functions help(scipy.ndimage)
Help on ndimage function laplace help(scipy.ndimage.laplace)
Import SciPy module into local namespace from scipy import *
Import SciPy subpackage ndimage in namespace ndi import scipy.ndimage as ndi
Write source for this object to output scipy.source(ndi.laplace)
Defining functions and visualization
def tv(a): imshow(a,interpolation='nearest') colorbar() a=rand(10,10) tv(a) savefig('figure1.png',dpi=100)
x=linspace(0,2*pi,100) plot(x,sin(x),x,cos(x)) grid() axis('tight') legend(('sin(x)','cos(x)'),'upper right') xlabel('x') ylabel('f(x)')