Oft-classvalues-plot.bash

From Open Foris Wiki

Jump to: navigation, search

This script creates scatterplots of image grey values in different classes of training data. Also figures of class means and standard deviations are provided.

Training areas need to be in shapefiles.

Usage: oft-classvalues-plot.bash <image> <shapefile_basename> <shapefile_class_fieldname> <Image band for x-axis> <Image band for y-axis>

Example: oft-classvalues-plot.bash p170r64.tif p170r64_poly ID 3 4 (Do not put the .shp extension in the shapefile name)

  • The figures of class means and std's for both required bands are created in the launching folder (.png format).
  • It also puts the class means and standard deviations into text files.
  • Pixel-by-pixel values are stored in a separate text file.
  • The pixel plots are created in a folder named "plots_imagename_band1_band2". They are for all classes, .png image files. And same as text files.
  • A further script oft-classvalues-compare.bash can then be used to compare up to 5 classes in one view.


Example:

  • Get Example data set
  • For this exercise following tools are used: oft-classvalues-plot.bash
  • Open your working directory using
cd /home/...
  • First of all make sure that you have installed GNUPLOT. Further information on Gnuplot and Ubuntu. If you don't have Gnuplot type in your terminal:
sudo apt-get install gnuplot //press 'enter'
  • Run oft-classvalues-plot.bash with input: satellite image | shapefile | Attribute column for ID in this case name| band3 | band4; Note: output automatically processed.
oft-classvalues-plot.bash landsat_t1.tif landuse name 3 4 

Output:

1. pixelvalueslandsat_t1.tif_bands_3_4.txt:

head pixelvalueslandsat_t1.tif_bands_3_4.txt
Column 1-6: Pixel_ID, X , Y , class (from attribute name), pixelvalue_bandnr3, pixelvalue_bandnr4
1.00 771870.00 -2402010.00 6.00 22.00 47.00
2.00 771900.00 -2402010.00 6.00 22.00 53.00
3.00 771930.00 -2402010.00 6.00 23.00 55.00
4.00 771960.00 -2402010.00 6.00 22.00 55.00
5.00 771990.00 -2402010.00 6.00 21.00 53.00

2. classvalues_landsat_t1.tif_band_3.txt:

head classvalues_landsat_t1.tif_band_3.txt
Column 1-3: classvalue, bandnr3 , std
7 27.224344 2.480986
13 28.945946 1.679205
8 28.140811 2.322499
9 29.036641 2.258223
12 27.879464 1.288049
11 27.423695 1.199933

3. classvalues_landsat_t1.tif_band_4.txt

head  classvalues_landsat_t1.tif_band_4.txt
Column 1-3: classvalue, bandnr4 , std
7 48.176611 2.622561
13 45.385749 1.525189
8 49.842482 2.397968
9 52.786260 3.513642
12 49.943452 2.232350
11 48.779116 1.172885

4. Folder plots_landsat_t1.tif_bands_3_4 contains the classes to be used for oft-classvalues-compare.bash



Back to Open Foris Toolkit Main Page

Back to Tools & Exercises



Personal tools