SPECTRAL TUTORIAL=================Getting Started---------------Start up Mosaic, put it in the backgroundhys298 >> Mosaic&Follow the links to the Spectral Tutorial.  That should bring you to here.Move to the directory where you want to work. There should be adirectory that resembles your name.  This holds your images.  As an aside, when your following along in this tutorial, you can usethe mouse to cut any of the commands shown here, and paste them inyour window.  This will save time and reduce typing errors.hys298 >> pwd/proj/hys298hys298 >> lsandrew/        dem.ipw        ipwxv          maddogg/       prhdrann/           docs/          isaac/         make_rgb*      quinn/app-defaults/  eric/          jeff/          make_rgb~*     rgb.ipwbill/          george/        joann/         martha/        scott/bob/           gf.ipw         julie/         miguel/        ustin/cat/           glen/          karen/         mux            wanli/claudia/       hoosse/        katie/         num.ipw        william/cynn/          index.html     ken/           paul/          yululong/david/         index.html~    lincom         peter/hys298 >> cd quinnhys298 >> pwd/proj/hys298/quinnhys298 >> lsblu.hst       bw.pcx        grn.pcx       red.pcx       rgb_lin.pcxblu.pcx       grn.hst       red.hst       rgb_hist.pcx  users.etxStart another terminal window.  This is the window you will use to doyour spectral work.hys298 >> dxterm&The software (ipw) that you will be using is only available on onemachine in the lab.  That machine is vaca.  You need to login to thismachine to use the ipw software.  So in your new window:hys298 >> xrlogin vacaYou're now logged onto vaca.  Cd to your directory.hys298 >> cd quinnhys298 >> pwd/proj/hys298/quinnhys298 >> lsblu.hst       bw.pcx        grn.pcx       red.pcx       rgb_lin.pcxblu.pcx       grn.hst       red.hst       rgb_hist.pcx  users.etxViewing your data-----------------We're going to be using a free software package known as xv to do ourimage viewing.   Try this out be looking at some of our images.  Type:hys298 >> xv&A window will appear on your terminal.  Move yor mouse into thiswindow and click your right mouse button.  The XV control panel willappear on your terminal.  Click the 'Visual Schnauzer' button in thispanel.  Because of the display aspects of your terminal, the VisualSchnauzer window will look strange until you move your mouse pointerinto it.  When you do, the rest of the terminal will appear strangelycolored.  This is just a method that is used by the program to allowthe terminal to display more colors than are normally allowed.  Thiswill bring up a graphical version of your directory.  Click the'Update' button in the Visual Schnauzer window and thumbnail versionsof your images will be created.  You can double click on any of theimages to load it and display it.  Double click on grn.pcx right now.This is the green filtered image.  Note that using the buttons alongthe bottom of the xv control panel, you can change the size, rotate,mirror, crop, etc.  your image.  Unless you save the new image, ifwon't affect your file at all.  Play around with the controls for alittle bit.Probably the best tool that any image processing software can have isa way to manipulate the intensities and color shades of a digitalimage.  Xv has very nice capabilities for this kind of thing.  Clickon the ColEdit button in the Xv control panel, and investigate some ofthese.  Basically, the Color editing panel is divided into threeareas.  The left most allows manipulation of individual pixels, themiddle allows HSV Modification, and the right most one allows rgbManipulation.  You really need to play with this some to get a feelingof how this works.  Since this image is a grey scale image, the toolsaren't quite as interesting as they can be.  However, the Intensitywindow, can result in more balanced contrast, or thresholds, etc.Simple Classification---------------------Double click on one of the color images and reexamine the Color Editfunctions.  One thing you may notice is that you can now imagine waysthat you might classify your image.  For example, you could change allthe greenish pixel colors to bright green.  You now have a classifiedimage of green regions.  Pick a greenish pixel, use the RGB colorwheels to change the color to all green, no red, no blue.  Do the samefor a number of the greenish pixels.  Now, use the Intensity window toonly display values of 255.  The resultant image is aclassification of the image, displaying areas in the image that are green.Save this to a file, Click on the 'Save' button in the XV controlpanel.  Choose an X11 bitmap format, and call the file gv1.bit.  Youcan now use your schnauzer to load this image, and verify.You might think that this an overly simple classifiaction, but reallythis is an example of a Supervised Maximum likelyhood classificationscheme, one of the most popular classification methods used.Three Color Image-----------------The color images that are in your directory did not come from thedigital camera.  The camera output was simply three grey scale imagesthat had different color filters.  Some image processing software wasused to put these images together.  Lets redo this process.  The stepsinvolved are :**1. Reformat the image file to a format ipw can use.**Here we use a combination of two free software packages, and some unixcommands to accomplish this task.hys298 >> pcxtoppm red.pcx | ppmtopgm | dd bs=15 skip=1 | \> mkbih -l 360 -s 496 > red.ipwDon't be concerned if you get a few error messeges, the files shouldbe ok anyways.  These are 4 commands strung together.  **pcxtoppm**converts the pcx file to a portable color file.  **ppmtopgm** convertsthis to a normal grey scale image, that is just the raw bytes plus asmall header.  **dd** removes the header.**mkbih** is an ipw command that creates an ipw format file from a rawfile.  You must specify the number of rows and columns in your image(you cn get these using xv).  The resultant file is stored in red.ipw.You can look at the header information of this file using another ipwcommand.  hys298 >> prhdr red.ipw!<header> basic_image_i -1 $Revision: 1.10 $byteorder = 0123nlines = 360nsamps = 496nbands = 1!<header> basic_image 0 $Revision: 1.10 $bytes = 1bits = 8!<header> image -1 $Revision: 1.5 $This shows the size of the file, and the number of bands, etc.  If youwould ever like to see a listing of what an ipw command does you canget a description using the command ipwman.  For example,hys298 >> ipwman prhdrRepeat this process for the blu.pcx and grn.pcx.  You should thenhave three ipw files.**2. Put the three bands together.**Use the ipw command:hys298 >> mux red.ipw grn.ipw blu.ipw > rgb.ipwhys298 >> prhdr rgb.ipw!<header> basic_image_i -1 $Revision: 1.10 $byteorder = 0123nlines = 360nsamps = 496nbands = 3!<header> basic_image 0 $Revision: 1.10 $bytes = 1bits = 8!<header> basic_image 1 $Revision: 1.10 $bytes = 1bits = 8!<header> basic_image 2 $Revision: 1.10 $bytes = 1bits = 8!<header> image -1 $Revision: 1.5 $Note that now we have a file with three image bands.3. Change the three band image back into a file format that xv can use.hys298 >>  rmhdr rgb.ipw | rawtoppm -rgb  -interpixel 496 360 > rgb.ppmNow look at this file using Xv.  Compared to the color images youhave, this one looks pretty washed out.  That's because the otherimages were stretched to give them more contrast, and this one wasn't.You might also notice that this image is in 24-bit mode, where theprevious images you were looking at were not.  You could use xv toperform constrast streching on your image, (look at the .hst files) toobtain less muddy images.  But we want to perform the some moreanalysis on this image, so let's keep it the way it is.Green Vegetation Indicator--------------------------Before, we made a classified image of the green veg areas byclassifing certain pixels in the 3 color image.  We couldn't use thistechnique on the green image alone, because there are lots of areasthat are high in green but also high in red and blue too.  What we'dlike to come up with is an indicator that somehow took this into account. We want an index that is high whenever green is bright, in comparisonto the red and blue values.  If we did something like :Greenness =  green-blue + green-redWe'd get positive values when green was brighter than blue and red,and negative value otherwise.  However, in the above scale, Dark greenpixels would have a lower greenness factor than bright green pixels.Since, were not sure that's accurate, lets normalize the function tothe overall brightness of the pixel.Green Factor = ((green-blue)+(green-blue))/(green+blue+red) We can accomplish this in ipw with the commands lincom, mux and mult.hys298 >> lincom -c -1,2,-1 rgb.ipw > num.ipwhys298 >> lincom rgb.ipw > dem.ipwhys298 >> mux num.ipw dem.ipw | mult -r 1 > gf.ipwhys298 >> rm num.ipw dem.ipwhys298 >> rmhdr rgb.ipw | rawtopgm 496 360 > gf.pgmPart of the problem with the setup that we have is that we have toconstantly make more than one version of the files, one for ipw toread and one that xv can read.  It would be much better if we couldavoid that step.  Well, we can.  Since xv is a public domain software,the developers of xv modified it to read ipw files.  YOu can use thisversion by using 'ipwxv&' on the machine vaca, instead of 'xv&'.  Thisis an older version of xv however, and you don't get allfunctionality, like the Visual Schnauzer.Now look at this image in xv and you can see that the green areas showup brighter in this image.  You can again use the Intensity window inthe Color Edit to threshold this image.  Save the thresholded image,and compare it to your first classification scheme.The above procedure is very similar to using NDVI to determinevegetation locations in satalitte imagery.  In NDVI, though the greenband is not used, but Near IR bands instead. Why?Unsupervised Classification---------------------------Now, we will perform an unsupervised classification on our image.  Wewill use clustering.  In clustering, signatures in the image aregenerated automatically.  They are chosen so as to be unique and tospan the range of signatures in the image. Since the images areclassified automatically, we don't really know what the resultantclasses are, and normally another step is taken to assign the classesto some real land cover.Create some clustered classifications with the commandshys298 >> ustats -c 10 -r 10 rgb.ipw > class10.statshys298 >> ustats -c 10 -r 2 rgb.ipw > class2.statshys298 >> bayes -s class10.stats rgb.ipw > class10.ipwhys298 >> bayes -s class2.stats rgb.ipw > class2.ipwThese images look black when viewed in ipwxv.  This is because theimage has values only between 0 and 10.  These all appear black withthe default color table.  Go into the Color Edit window of ipwxv andchange the color table to Random.  Do any of the classes seems tocorrespond with the green veg areas? How about other classes?  Why doyou think they are different?  What can you tell about theillumination from this classified image?Supervised Classification-------------------------Now, let's revisit the Supervised Classification.  Reload a colorimage, and try and use xv to pick out a small number of pixel colorsthat you can use for a number of different classes in your scene. Tryand get about 4-5 different classes.  You want your xv image to haveonly 5 different colors, and the rest of the image black.  You can useany color image so maybe the rgb_lin.pcx is the best choice.  Savethat image and convert to ipw (from above you should know how to dothis) with the name sup.ipw.  Now, you want to compute the stats for the different classes that youidentified in this file, and do another classification.hys298 >> mstats -m sup.ipw rgb.ipw > sup.statshys298 >> bayes -s sup.stats  rgb.ipw > supclass.ipwhys298 >> bayes -s sup.stats -t 2 rgb.ipw > supclass2.ipwLook at these images and decide how well they classified your image.Also, what do you think the -t 2 in the second command means?