Oft-extr

From Open Foris Wiki

Jump to: navigation, search
 
Line 1: Line 1:
-
Extracts pixel values from an image.
+
Extracts pixel values from an image for points into a text file.
'''Usage:''' oft-extr [-nomd] [-mm] [-avg] [-var] [-ws n] [-o outfile] <pointfile> <img-file>
'''Usage:''' oft-extr [-nomd] [-mm] [-avg] [-var] [-ws n] [-o outfile] <pointfile> <img-file>
Line 17: Line 17:
-o outfile = output file name
-o outfile = output file name
 +
Please note that the default behaviour is to extract window's center pixel values.
 +
 +
The text file with the points needs to have spaces as field separators and must not contain strings nor a header line. (If you need to change the field separator in your text file or remove columns that contain strings, you could for example edit the file with awk.)
 +
 +
Both, text file with point coordinates and image, need to be in the same projection.
 +
 +
The programm will process all points that fall within the extent of the image. For all points falling outside of the extent, it will skip them and print on screen "Plot ... is outside the image ... ... size ... ...".
Line 24: Line 31:
*Open your working directory using
*Open your working directory using
  cd /home/...
  cd /home/...
-
#Let's run [[oft-extr]] using the input image ''landsat_t1.tif'' with the point text file ''training.txt''. Output: ''extr.txt'' with '''no extra option''':
+
'''1. Let's run [[oft-extr]] using the input image ''landsat_t1.tif'' with the point text file ''training.txt''. Output: ''extr.txt'' with ''no extra option'':'''
-
  oft-extr -o extr.txt training.txt landsat_t1.tif
+
  oft-extr -o extr.txt txt/training.txt images/landsat_t1.tif
You will be asked
You will be asked
Line 33: Line 40:
*Now we take a closer look at our result:  
*Now we take a closer look at our result:  
  head extr.txt
  head extr.txt
 +
<pre style="overflow:auto; width=auto;">
<pre style="overflow:auto; width=auto;">
       1.00  730785.00 -2456134.00      50.00    3441.00      52.00      24.00      24.00      51.00      65.00    128.00      29.00  
       1.00  730785.00 -2456134.00      50.00    3441.00      52.00      24.00      24.00      51.00      65.00    128.00      29.00  
Line 46: Line 54:
</pre>
</pre>
-
Explanation of values for each column:
+
*Explanation of values for each column:
-
*Col1: pixel ID  
+
:*Col1: pixel ID  
-
*Col2: x-coordinates
+
:*Col2: x-coordinates
-
*Col3: y-coordinates
+
:*Col3: y-coordinates
-
*Col4:
+
:*Col4: pixel col coordinate
-
*Col5:
+
:*Col5: pixel row coordinate
-
*Col6 - col7: Average value of band1, band2, ... band7
+
:*Col6 - Col7: center pixel value for bands 1-7
-
#Exercises using option -mm:
+
'''2. Exercise using option ''-mm'' and ''-ws'':'''
 +
 
 +
oft-extr -ws 3 -mm -o extr_mm.txt training.txt landsat_t1.tif
 +
 
 +
head extr_mm.txt
 +
<pre style="overflow:auto; width=auto;">
 +
1.00  730785.00 -2456134.00      50.00    3441.00      52.00      24.00      24.00      51.00      65.00    128.00      29.00      50.00      23.00      24.00      46.00      64.00    128.00      28.00      52.00      24.00      25.00      53.00      70.00    129.00      32.00
 +
2.00  730785.00 -2455134.00      50.00    3408.00      59.00      27.00      34.00      47.00      82.00    132.00      46.00      56.00      27.00      33.00      46.00      80.00    131.00      44.00      59.00      31.00      39.00      49.00      90.00    132.00      53.00
 +
3.00  730785.00 -2454134.00      50.00    3374.00      57.00      28.00      33.00      50.00      82.00    131.00      44.00      54.00      27.00      29.00      48.00      77.00    130.00      41.00      58.00      29.00      36.00      52.00      82.00    131.00      44.00
 +
4.00  730785.00 -2453134.00      50.00    3341.00      55.00      26.00      29.00      52.00      72.00    129.00      34.00      52.00      24.00      27.00      48.00      68.00    128.00      31.00      58.00      27.00      32.00      54.00      80.00    129.00      41.00
 +
5.00  730785.00 -2452134.00      50.00    3308.00      60.00      28.00      35.00      54.00      87.00    129.00      45.00      56.00      27.00      31.00      51.00      76.00    129.00      36.00      60.00      30.00      37.00      60.00      90.00    129.00      48.00
 +
6.00  730785.00 -2451134.00      50.00    3274.00      47.00      19.00      18.00      37.00      47.00    124.00      20.00      45.00      19.00      17.00      37.00      45.00    124.00      18.00      49.00      20.00      19.00      38.00      48.00    125.00      21.00
 +
7.00  730785.00 -2450134.00      50.00    3241.00      46.00      19.00      17.00      38.00      44.00    123.00      18.00      46.00      19.00      17.00      37.00      40.00    123.00      17.00      49.00      20.00      18.00      39.00      46.00    124.00      21.00
 +
 
 +
</pre>
 +
 
 +
*Explanation of values for each column:
 +
 
 +
:*Col1: pixel ID
 +
:*Col2: x-coordinates
 +
:*Col3: y-coordinates
 +
:*Col4: pixel x coordinated
 +
:*Col5: pixel y coordinates
 +
:*Col6 - Col12: min values for bands 1-7
 +
:*Col13 - Col19: max values for bands 1-7
 +
:*Col20 - Col26: center pixel values for bands 1-7
 +
====3. Exercise using option ''-csv'' and ''-ws'':====
 +
oft-extr -ws 3 -csv -o extr_3.txt training.txt landsat_t1.tif
 +
 +
head extr_3.txt
 +
 
 +
<pre style="overflow:auto; width=auto;">
 +
1.000000,730785.000000,-2456134.000000,50.000000,3441.000000,52.000000,24.000000,24.000000,51.000000,65.000000,128.000000,29.000000
 +
2.000000,730785.000000,-2455134.000000,50.000000,3408.000000,59.000000,27.000000,34.000000,47.000000,82.000000,132.000000,46.000000
 +
3.000000,730785.000000,-2454134.000000,50.000000,3374.000000,57.000000,28.000000,33.000000,50.000000,82.000000,131.000000,44.000000
 +
4.000000,730785.000000,-2453134.000000,50.000000,3341.000000,55.000000,26.000000,29.000000,52.000000,72.000000,129.000000,34.000000
 +
5.000000,730785.000000,-2452134.000000,50.000000,3308.000000,60.000000,28.000000,35.000000,54.000000,87.000000,129.000000,45.000000
 +
6.000000,730785.000000,-2451134.000000,50.000000,3274.000000,47.000000,19.000000,18.000000,37.000000,47.000000,124.000000,20.000000
 +
</pre>
 +
 
 +
 
 +
----
 +
[[Open_Foris_Geospatial_Toolkit|Back to Open Foris Toolkit Main Page]]
 +
[[Tools & Exercises|Back to Tools & Exercises]]
----
----
-
[[Open Foris Geospatial Toolkit|Back to Open Foris Toolkit Main Page]]
 
----
----
<google1 style="3"></google1>
<google1 style="3"></google1>
<facelikebutton style="1" showsend="0"></facelikebutton>
<facelikebutton style="1" showsend="0"></facelikebutton>

Current revision as of 12:07, 7 April 2014

Personal tools