SPUNMIX

Linear spectral unmixing


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Algorithm :: Acknowledgements :: References :: Related

Back to top

Description


Linearly unmixes a hyperspectral image. The user submits a set of endmember spectra, under the assumption that the band-vector at each image location is a linear combination of the endmember spectra. SPUNMIX evaluates a fraction-map for each spectrum in the set. The pixel values in the fraction-map for a given spectrum are estimates of the fractional contribution of the spectrum to corresponding pixels in the hyperspectral image. The image file must contain band response profile metadata.
Back to top

Parameters


spunmix(fili, dbiw, dbib, specfile, dboc, rmschan, nonneg, sum2one, rtlevel, dbic, wlenint, valonly)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
DBIW List[int] Raster input window 0 - 4 Xoffset, Yoffset, Xsize, Ysize
DBIB List[int] Input bitmap segment 0 - 1 1 -
SPECFILE * str Spectrum library file name 1 -    
DBOC * List[int] Output endmember fraction channel(s) 1 -    
RMSCHAN List[int] Output RMS-Error channel 0 - 1 1 -
NONNEG str Non-negative constraint 0 - 3 YES | NO
Default: NO
SUM2ONE str Sum-to-one constraint 0 - 3 YES | NO
Default: NO
RTLEVEL List[int] Radiometric transformation level 0 - 1 0 -
DBIC List[int] Input raster channel(s) 0 -    
WLENINT List[float] Wavelength interval 0 - 2  
VALONLY str Valid bands only 0 - 3 YES | NO
Default: NO

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the file that contains the image to be unmixed.

DBIW

Optionally specifies the rectangular window (Xoffset, Yoffset, Xsize, Ysize) of image data read from the input channels. If this parameter is not specified, the entire image is processed by default.

Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

Either DBIW (input window) or DBIB (input bitmap) may be specified.

DBIB

Specifies a bitmap segment that defines the image region to which the unmixing will be limited.

Either DBIW (input window) or DBIB (input bitmap) may be specified.

SPECFILE

Specifies the name of the input spectra library file that contains endmembers for unmixing.

All spectra in the library file are used.

DBOC

Specifies the output channels to receive the output endmember fraction maps. One output channel must be specified for each endmember. Output channels must be 32-bit real. The i'th endmember corresponds to the i'th channel in the specified channel number list.

Duplicate channels are NOT allowed. No data set band channels can be specified.

RMSCHAN

Specifies the output channel to receive the residual error map. If this parameter is not specified, the residual error image is not saved.

No data set band channel or fraction map channel can be specified.

NONNEG

Specifies whether a constraint is imposed whereby all endmember fractions found will be non-negative.

SUM2ONE

Specifies whether a constraint is imposed whereby the output endmember fractions sum to 1.0 for each pixel.

RTLEVEL

Specifies the radiometric transformations associated with the data set that is applied to the stored pixel values.

RTLEVEL cannot be greater than the number of radiometric transformations available for the selected data set. If this parameter is not specified, it defaults to the number of radiometric transformations present for the selected data set.

DBIC

Specifies the input channels to process. The image metadata indicates which channels store data set bands. If this parameter is not specified, all data set band channels are processed by default. Only data set band channels can be specified.

WLENINT

Specifies that the selected bands are to be restricted to those whose center wavelength is either inside or outside a closed interval, specified in nanometers. By default, no restriction is applied.

The wavelength interval may be specified as follows:

This parameter has no effect if the input file contains no band center wavelength metadata.

VALONLY

Specifies whether the selected bands are to be restricted to those with "plot" or "bmask" (begin mask) quality values. The default is NO.

This parameter has no effect if the input file contains no band-validity metadata.

Back to top

Details

Traditional image classifiers classify each image pixel into one of a number of classes. In contrast, spectral unmixing permits multiple classes to be associated with each image pixel, under the assumption that an image pixel may be the result of sensing a part of the scene composed of a mixture of multiple spatially homogenous material types (endmembers). In the case of linear spectral unmixing, any image band-vector is assumed to be a linear combination of the endmember band-vectors, and a classification result for a pixel is the fractional contribution of each endmember to that pixel's band vector (that is, the 'endmember fractions' for the pixel).

Spectral unmixing is particularly valuable when the image data is of low spatial resolution with respect to the scene cover types of interest. This is often the case with hyperspectral images.

Linear spectral unmixing requires the dimension of the band-vectors (that is, the number of image bands) to be greater than or equal to the number of endmembers, and the endmembers should be as linearly independent as possible.

Determining endmember fractions for each image pixel is useful when:

To perform spectral unmixing, you must provide a set of spectra that are interpreted as the endmember band-vectors. These 'endmember spectra' are read from the specified spectra file.

If necessary, the input reference spectra are automatically resampled to match the image wavelength sampling.

The endmember spectra can come from ground-level field measurements or laboratory measurements, or from the image. In the former case, the endmember spectra usually represent material reflectance, and the image must be transformed into an accurate estimate of scene reflectance before spectral unmixing. This requires some form of correction for the effect of the atmosphere between the sensor and the scene on the image values. An advantage of using field- or laboratory-measured spectral is that the material type of the endmembers is clearly known.

When the endmembers are extracted from the image, they may be used to unmix parts of the image where the cover types, illumination conditions, and terrain slope and aspect are represented in the parts of the image from which the endmembers were extracted. ENDMEMB may be used to automatically generate endmembers for an image.

To achieve good unmixing results, the endmember set must be complete with respect to the part of the image to be unmixed. It is also important that redundant endmembers be excluded.

Report

An example output listing produced by SPUNMIX is shown below. This listing can be directed to any report device. In this example, we have separated 4 endmembers.

The number of non-convergent pixels found is reported first; this is the number of pixels within the processed area that were found to not converge mathematically. This value gives an indication of the number of pixels in the image for which the unmixing process is not properly constrained. These pixels will, for example, have missing endmembers.

Each column in the output table contains the following information:

Here is a sample output listing:

Statistical Results from SPUNMIX

Number of Non-Convergent Image Pixels: 0

Emb             Ave     Min     Max     Rep
+--------------------------------------------+
  1             0.124   0.000   1.000   0.094
  2             0.791   0.000   1.000   0.837
  3             0.079   0.000   1.000   0.069
  4             0.006   0.000   0.255   0.000

An interpretation of these numbers is proided in the "Example" section.

Back to top

Examples

This example shows the use of ENDMEMB in computing an endmember set for cupref.pix, and the use of SPUNMIX in computing a fraction vector map for cupref.pix and the endmember set. Also, SPMIX is used to reconstruct an image from the fraction vector map that may be used to assess how well the endmember set represents the spectral classes in cupref.pix on a band-by-band basis.

Compute the endmember set.

from pci.endmemb import endmemb

file	=	"cupref.pix"
dbic	=	[]	# no channel restrictions on the input bands
wlenint	=	[]	# no wavelength interval restriction on the input bands
valonly	=	"yes" # involve only "plot" or "bmask" bands in computation
dbiw	=	[]	# use the full extent of cupref.pix
dbib	=	[]
nendmemb	=	[20]	# compute 20 endmembers
errsetz	=	[10]
bvangthr	=	[5]
specfilo	=	"endmemb.spl"
filotype	=	"spcb"
rtlevel	=	[]	# apply full r.t. sequence, DN to reflectance
report	=	"endmemb.txt"

endmemb( file, dbic, wlenint, valonly, dbiw, dbib, nendmemb, errsetz, bvangthr, specfilo, filotype, rtlevel )

The following report is written to endmemb.txt:

RMSE of unconstrained unmixing model for endmember i,
where unmixing is done with endmembers 1 to i-1
endmember      RMSE
---------      ----
2        0.480
3        0.232
4        0.212
5        0.088
6        0.065
7        0.112
8        0.041
9        0.070
10        0.035
11        0.033
12        0.028
13        0.025
14        0.033
15        0.026
16        0.021
17        0.024
18        0.024
19        0.028
20        0.065

The ENDMEMB estimate of the number of non-redundant endmembers is 4 (that is, when you run the above example without specifying NENDMEM). This corresponds to the sharp decrease in RMSE from endmember 4 to endmember 5. However, the RMSE appears to level off after endmember 9. Try unmixing cupref.pix with endmembers 1 to 9.

Add channels to cupref.pix to hold the 9 fraction vector map components and the RMS-error map:

from pci.pcimod import pcimod

file	=	"cupref.pix"
pciop	=	"ADD"
pcival	=	[0,0,0,10]

pcimod( file, pciop, pcival )

Compute the fraction vector map and the RMS-error map. The RMS-error map (channel 234) gives, for each pixel location, an across-all-bands indication of how well the image may be reconstructed from the fraction vector at that location and the endmembers.

from pci.spunmix import spunmix

fili	=	"cupref.pix"
dbiw	=	[]
dbib	=	[]
specfile	=	"endmemb1.spl"
dboc	=	list(range(225, 233 + 1))	# evaluate these channels to fraction vector map
rmschan	=	[234]	# channel to hold the RMS-error map
nonneg	=	"yes"
sum2one	=	"yes"
rtlevel	=	[]	# apply full r.t. sequence, DN to reflectance
dbic	=	[]
wlenint	=	[]
valonly	=	"yes"	# required because endmembers were computed
# for valonly = "yes"

spunmix( fili, dbiw, dbib, specfile, dboc, rmschan, nonneg, \
         sum2one, rtlevel, dbic ,wlenint, valonly )

The following report is written to spunmix1.txt:

spunmix Spectral Linear Unmixing                
 
Statistical Results from SPUNMIX
Number of Non-Convergent Image Pixels : 0
 No    Name                  Ave     Min     Max     Rep
+------------------------------------------------------------------------------+
 1     endmember 1         0.034   0.000   1.000   0.004
 2     endmember 2         0.227   0.000   0.985   0.228
 3     endmember 3         0.020   0.000   0.998   0.001
 4     endmember 4         0.137   0.000   1.000   0.025
 5     endmember 5         0.144   0.000   0.995   0.001
 6     endmember 6         0.022   0.000   0.981   0.022
 7     endmember 7         0.051   0.000   1.000   0.031
 8     endmember 8         0.346   0.000   0.983   0.681
 9     endmember 9         0.019   0.000   0.994   0.006
+------------------------------------------------------------------------------+

For endmember 9 the average, minimum, and maximum pixel fractions over all pixels in the image are 0.019, 0.000, and 0.994. Endmember 8 has the highest fraction of all the endmembers for 68% of the pixels.

Create the file to hold the reconstructed image.

from pci.cim import cim

file	=	"cuprec.pix"
tex1	=	"reconstruction of cupref.pix from endmembers"
tex2	=	"and a fraction vector map"
dbsz	=	[614,2206]	# same dimensions as cupref.pix
pxsz	=	[1, 1]
dbnc	=	[0,0,0,233]	# 224 image channels plus 9 fraction vector map channels
dblayout	=	"pixel"

cim( file, tex1, tex2, dbsz, pxsz, dbnc, dblayout)

Copy the fraction vector map to the reconstructed image file:

from pci.iii import iii

fili	=	"cupref.pix"
filo	=	"cuprec.pix"
dbic	=	[225,-233]
dboc	=	[225,-233]
dbiw	=       []
dbow	=       []

iii( fili, filo, dbic, dboc, dbiw, dbow )

Reconstruct the image from the endmember set and the fraction vector map:

from pci.spmix import spmix

file	=	"cuprec.pix"
specfile	=	"endmemb.spl"
dbic	=	[225,-232]
dboc	=	[1, -234]

spmix( file, specfile, dbic, dboc )
Back to top

Algorithm

This section provides a brief overview of the nature of the problem solved by spectral unmixing, and discusses how it is solved.

Formulation

For one wavelength, the linear mixing model can be written as:

E(1) x frac(1) + ... + E(m) x frac(m) = I
where:

If we employ multiple wavelengths, we get a system of multiple linear equations (one per wavelength) that can be represented as:

_E x _frac = _I

where _E, _frac, and _I are matrix/vector versions of E, frac, and I, above.

Specifically, the endmember data matrix is defined as:

      (E(wave_1, emb_1) ... E(wave_1, emb_m) )
 _E = (       .         ...          .       )
      (E(wave_n, emb_1) ... E(wave_n, emb_m) )
where:

The endmember fraction vector is defined as:

         ( frac(1) )
 _frac = (    .    )
         ( frac(m) )

and the image band-vector is defined as:

       ( I(1) )
 _I =  (  .   )
       ( I(n) )

The spectral mixing problem is equivalent to knowing _E and _frac and solving for _I. The spectral unmixing problem is equivalent to knowing _E and _I and solving for _frac.

Solution

To solve the unmixing problem, we must solve a system of linear equations. This system can be solved in many ways; however, a least-squares solution is appropriate, and is used in SPUNMIX. SPUNMIX employs a process known as "Singular Value Decomposition" to solve the linear systems.

Not only must a solution to the linear system be found, but due to the nature of the unmixing problem, it may be desirable to solve the linear system with some constraints. Reasonable constraints are:

These constraints have obvious physical meaning, and may be applied individually or together. SPUNMIX applies these constraints by modifying the linear system to be solved, and by the selection of the numerical algorithm chosen to determine the endmember fractions; it does not simply apply normalization factors to the endmember fractions determined without any constraints applied.

Back to top

Acknowledgements

PCI Geomatics received financial support from the Canadian Space Agency/L'Agence Spatiale Canadienne through the Earth Observation Application Development Program (EOADP) for the development of this software, under contract 9F028-0-4902/12.

Back to top

References

Neville, R. A., K. Staenz, T. Szeredi, and P. Hauff, 1997, "Spectral Unmixing of SFSI Imagery in Nevada", Proceedings of the Twelfth International Conference and Workshops on Applied Geologic Remote Sensing, Denver Colorado, pp. 449-456.

Winter, M.E., "Comparison of Approaches for Determining End-Members in Hyperspectral Data", Aerospace Conference, Proceedings 2000 IEEE, Big Sky MT., Vol. 3 pp 305-313.

Staenz, K., T. Szeredi, J. Schwarz, 1998, "ISDAS – A System for Processing/Analyzing Hyperspectral Data", Canadian Journal of Remote Sensing, Vol. 24, No. 2, pp. 99-113.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.