Assuming that you are on Ubuntu Linux, you can install the latest stable version of Docker by running
sudo apt-get install docker.io
Then pull and run the image analysis container with
sudo docker run -d -p 433:8888 -v yourImageFolder:/crc/imagery --name=crc mort/crcdocker
This will run the conainer as a daemon serving the iPython Notebook kernel and map yourImageFolder on your host machine to /crc/imagery/ in the container. You can stop it at any time with
sudo docker stop crc
and re-start it with
sudo docker start crc
Now point your favorite browser to
http://localhost:433
to see the iPython Notebook home page.
In this example we have three \(1000\times 1000\) Landsat 7 TM images in ENVI standard format acquired over the town of Juelich, Germany in May, June and August, 2001. We can see them in the container folder /crc/imagery:
ls -l imagery
With the script dispms.py we can display the June and May images side-by-side. The -f option defines the left-hand image, and the -g option the right-hand image. We choose spectral bands 4,5 and 6 in a linear 2 percent stretch (the default):
run dispms -f imagery/20010626 -g imagery/20010525 -p [4,5,6]
Alternatively, with a 0-255 byte stretch (option -e 1) we can compare the image intensities in digital numbers. They appear to be equally bright:
run dispms -f imagery/20010626 -g imagery/20010525 -p [4,5,6] -e 1
Now let's run the iterative MAD (iMAD or IR-MAD) transformation on this image pair:
run iMad imagery/20010626 imagery/20010525
The canonical correlations have converged nicely after 20 iterations, so we will display the last three MAD variates RGB =(6,5,4) in a linear 2 percent stretch:
run dispms -f imagery/MAD(20010626-20010525) -p [6,5,4]
The changes (bright and dark pixels) are clearly associated primarily with agricultural fields and to a lesser extent mining activities in the open cast mines. The featureless (middle gray) no-change regions correspond to forest canopy and built-up areas. The script radcal.py will extract no-change (or invariant) pixels from the MAD image and use them to radiometrically normalize the two contributing images. More specifically, the May image 20010525 (target) will be normalized to the june image 20010626 (reference).
run radcal imagery/MAD(20010626-20010525)
Note that the slopes are close to unity and the intercepts are small. Solar illumination and atmospheric conditions were similar for both acquisitions.
Next we look at the June and August images:
run dispms -f imagery/20010626 -g imagery/20010829 -p [4,5,6]
The amount of vegetation (red color) has decreased drastically between June and August due to grain harvesting. Also, as can be seen below in the 0-255 linear stretch, the lower solar elevation in August leads to a decrease in brightness and contrast.
run dispms -f imagery/20010626 -g imagery/20010829 -p [4,5,6] -e 1
Running iMad.py on the two scenes again gives a good result:
run iMad imagery/20010626 imagery/20010829
And, normalizing the August image to the June image, we get:
run radcal imagery/MAD(20010626-20010829)
We notice that the slopes are larger than one, since the brighter June image is being regressed onto the darker August image. Comparing before and after normalization, we can see the increase in brightness and contrast:
run dispms -f imagery/20010829 -g imagery/20010829_norm -p [4,5,6] -e 1
But notice what happens when we try to normalize the August image to the May image:
run iMad imagery/20010525 imagery/20010829
run radcal imagery/MAD(20010525-20010829)
There is evidently simply too much real reflectance change over this time period, so that IR-MAD does not converge reliably to a background of invariant pixels.
In this example we will perform unsupervised clustering on the June image. First of all, we perform a principal components transformation.
run pca -h
run pca imagery/20010626
Whoops - pca.py doesn't say what the output file is called. I'll fix that on next commit. In fact it just appends the string "_pca" to the input filename:
run dispms -f imagery/20010626_pca -p [1,2,3]
Now apply Gaussian mixture clustering on the first three principal components. First get help:
run em -h
and run the algorithm with its default parameter values:
run em -p [1,2,3] imagery/20010626_pca
The result is a single-band ENVI classification type image, here is the header:
cat imagery/20010626_pca_em.hdr
We can display it in BW here as follows:
run dispms -f imagery/20010626_pca_em -p [1,1,1] -e 2