Oft-segmode.bash

From Open Foris Wiki

Jump to: navigation, search

Burn the mode of the values of a given raster into defined zones from another raster (zonal statistics)


Usage: oft-segmode.bash <mask> <infile> <outfile>

<mask> is an image consisting of pixels with integer values. Each value designs a zone. All connected pixels with identical value are considered as a zone to compute statistics on

<input> is an image consisting of pixels with integer values that will feed the statistical mode calculation

<output> is an image consisting of pixels with the mode of <input> values calculated for each <mask> zones


Example:

oft-segmode.bash segments.tif classification.tif output_segs.tif


Exercise:

  • Get Example data set
  • For this exercise following tools are used: oft-segmode.bash, oft-polygonize.bash
  • As input, we use :
    • the result of the classification performed in the oft-kmeans exercise, my_kmeans.tif. It contains pixel values between 1 and 25 (class)
    • the segments produced in the oft-seg exercise, landsat_t1_min50.tif. It contains the same values for connected pixels (zone ID)

Open your working directory using

cd /home/data-ofgt
cd results

Run oft-segmode

  • Run oft-segmode with Input: landsat_t1_min50.tif, my_kmeans.tif; Output: km_segments.tif:
oft-segmode landsat_t1_min50.tif  my_kmeans.tif km_segments.tif

Polygonize the results

oft-polygonize.bash km_segments.tif km_segments.shp
  • Lets take a look at the results in QGIS. Top is my_kmeans.tif, bottom is km_segments.shp



Back to Open Foris Toolkit Main Page

Back to Tools & Exercises



Personal tools