Skip to content

i.pysptools.unmix

Extract endmembers from imagery group and perform spectral unmixing using pysptools

i.pysptools.unmix [-n] input=name [output=name] [prefix=string] [endmembers=name] endmember_n=integer [extraction_method=string] [unmixing_method=string] [maxit=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

i.pysptools.unmix input=name output=name endmember_n=integer

grass.script.run_command("i.pysptools.unmix", input, output=None, prefix=None, endmembers=None, endmember_n, extraction_method="NFINDR", unmixing_method="FCLS", maxit=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("i.pysptools.unmix", input="name", output="name", endmember_n=integer)

Parameters

input=name [required]
    Input imagery group
output=name
    Text file storing endmember information for i.spec.unmix
prefix=string
    Prefix for resulting raster maps
endmembers=name
    Vector map representing identified endmembers
endmember_n=integer [required]
    Number of endmembers to identify
extraction_method=string
    Method for endmember extraction
    Allowed values: FIPPI, PPI, NFINDR
    Default: NFINDR
unmixing_method=string
    Algorithm for spectral unmixing
    Allowed values: FCLS, UCLS, NNLS
    Default: FCLS
maxit=integer
    Maximal number of iterations for endmember extraction (default=3*number of bands)
-n
    Do not use Automatic Target Generation Process (ATGP)
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Input imagery group
    Used as: input, group, name
output : str, optional
    Text file storing endmember information for i.spec.unmix
    Used as: output, file, name
prefix : str, optional
    Prefix for resulting raster maps
endmembers : str, optional
    Vector map representing identified endmembers
    Used as: output, vector, name
endmember_n : int, required
    Number of endmembers to identify
extraction_method : str, optional
    Method for endmember extraction
    Allowed values: FIPPI, PPI, NFINDR
    Default: NFINDR
unmixing_method : str, optional
    Algorithm for spectral unmixing
    Allowed values: FCLS, UCLS, NNLS
    Default: FCLS
maxit : int, optional
    Maximal number of iterations for endmember extraction (default=3*number of bands)
flags : str, optional
    Allowed values: n
    n
        Do not use Automatic Target Generation Process (ATGP)
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

i.pysptools.unmix extracts endmembers from imagery group and performs spectral unmixing using pysptools. The module creates an endmember text file and endmember raster maps.

The module is a wrapper around the pysptools Python library, that integrates its functionality for Endmember Extraction and Spectral Unmixing into GRASS GIS.

It requires that the Python libraries pysptools and scikit-learn are installed (see below).

Supported algorithms for Endmember Extraction are:

  • NFINDR: N-FINDR endmembers induction algorithm after Winter (1999), that also makes use of an Automatic Target Generation Process (ATGP) (Plaza & Chang 2006). (Default)
  • FIPPI: Fast Iterative Pixel Purity Index after Chang (2006)
  • PPI: Pixel Purity Index

Supported algorithms for Spectral Unmixing are:

  • FCLS: Fully Constrained Least Squares (FCLS): Estimates endmember abundance per pixel with the constraint that values are non-negative and sum up to one per pixel (Default)
  • UCLS: Unconstrained Least Squares (UCLS): Estimates endmember abundance per pixel in an unconstrained way
  • NNLS: Non-negative Constrained Least Squares (NNLS): Estimates endmember abundance per pixel with the constraint that values are non-negative

NOTES

Number of endmembers to extract (endmember_n) is supposed to be lower than the number of bands in the imagery group. Only the PPI method can extract more endmembers than there are bands in the imagery group.

EXAMPLE

Example for the North Carolina sample dataset:

# Create list of bands excluding thermal bands
bands=`g.list type=raster pattern="lsat7_2002*" exclude="lsat7_2002_6?" separator=','`
echo "$bands"

# Create imagery group
i.group group=lsat_2002 input="$bands"

# set computation region
g.region raster=lsat7_2002_10 -p

# Extract Endmembers and perform spectral unmixing using pysptools
# resulting in an endmember text file and raster maps (here: 5 endmember)
i.pysptools.unmix input=lsat_2002 endmembers=endmembers endmember_n=5 \
  output=spectrum.txt prefix=lsat_spectra --v

# Compare to result from i.spec.unmix addon
i.spec.unmix group=lsat7_2002 matrix=sample/spectrum.dat result=lsat7_2002_unmix \
  error=lsat7_2002_unmix_err iter=lsat7_2002_unmix_iterations

REQUIREMENTS

  • python-cvxopt (install through system software management)
  • python-matplotlib (install through system software management)
  • python-scikit-learn (install through system software management)
  • python-scipy (install through system software management)
  • pysptools library
  • scikit-learn library

REFERENCES

  • Chang, C.-I. 2006: A fast iterative algorithm for implementation of pixel purity index. Geoscience and Remote Sensing Letters, IEEE, 3(1): 63-67.
  • Plaza, A. & Chang, C.-I. 2006: Impact of Initialization on Design of Endmember Extraction Algorithms. Geoscience and Remote Sensing, IEEE Transactions. 44(11): 3397-3407.
  • Winter, M. E. 1999: N-FINDR: an algorithm for fast autonomous spectral end-member determination in hyperspectral data. Presented at the Imaging Spectrometry V, Denver, CO, USA, (3753): 266-275.

SEE ALSO

i.spec.unmix

AUTHORS

Stefan Blumentrath, Norwegian Institute for Nature Research (NINA), Oslo, Norway
Zofie Cimburova, Norwegian Institute for Nature Research (NINA), Oslo, Norway

SOURCE CODE

Available at: i.pysptools.unmix source code (history)
Latest change: Friday Feb 21 10:10:05 2025 in commit 7d78fe3