PCLT

Generate principal components linear transformation


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

Back to top

Description


Generates and saves a linear transformation matrix (and its inverse) that can be used by LINTRN to transform selected channels of the input image into principal component channels.
Back to top

Parameters


pclt(fili, fillt, dbic, wlenint, valonly, sampint)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
FILLT * str Linear transformation parameters file name 1 - 191  
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
SAMPINT List[int] Sampling interval 0 - 2 1 -
Default: 1,1

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the image file containing the channels for which the transformation is to be computed.

FILLT

Specifies the name of the MATLAB save/load format file that will be created and to which the parameters of the linear transformation will be written.

DBIC

Specifies a subset of the input channels to which the channel selection is to be restricted.

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.

SAMPINT

Specifies the X and Y sampling interval within the specified input window.

Back to top

Details

PCLT considers an image to be a raster of image-value vectors, with one vector per pixel location. The components of these vectors are drawn from pixel values in selected channels at the same pixel location.

The forward transformation of each image-value vector consists of subtracting the mean vector from the image-value vector, then pre-multiplying the vector by the forward transformation matrix. This can be performed by LINTRN.

The mean vector subtraction and application of the linear transformation is meant to be performed using LINTRN. The application of the inverse of the linear transformation to a modified (for example, for noise removal) forward transformation result, followed by the addition of the mean vector, can also be performed using LINTRN.

Typically, the input image data for the inverse transformation is a modified version of forward-transformed channels. The modification typically consists of filtering the principal component images in which noise is concentrated. The output of the inverse transformation is typically used to replace the original input image channels with their modified (noise removed) counterparts.

Back to top

Examples

This example demonstrates noise-reduction for channels 108 to 112 of the file 'cuprad.pix'.

Compute the principal components linear transformation for channels 108 to 112 of cuprad.pix.

The replacement channels are the noise-reduced version of the orginal channels 108 to 112.

from pci.pclt import pclt

fili	=	"cuprad.pix"
fillt	=	"cuprad_pclt.mat"
dbic	=	list(range(108, 112 + 1))
wlenint	=	[]	# no wavelength interval restriction
valonly	=	''	# no band validity restriction
sampint	=	[]	# no subsampling

pclt( fili, fillt, dbic, wlenint, valonly, sampint )

Generate the forward transformed bands:

from pci.lintrn import lintrn

fili	=	"cuprad.pix"
filo	=	"cuprad_for.pix"
fillt	=	"cuprad_pclt.pix"
trandir	=	"for"

lintrn( fili, filo, fillt, trandir )

Apply a 5-by-5 averaging filter to the forward transformed channels that are dominated by noise (the last 4 out of the 5 channels):

from pci.fav import fav

file	=	"cuprad_for.pix"
dbic	=	[2]
dboc	=	[2]
flsz	=	[5,5]
mask	=	[]
bgrange	=	[]
failvalu	=	[]
bgzero	=	""
fav(file, dbic, dboc, flsz, mask, bgrange, failvalu, bgzero )

file	=	"cuprad_for.pix"
dbic	=	[3]
dboc	=	[3]
flsz	=	[5,5]
mask	=	[]
bgrange	=	[]
failvalu	=	[]
bgzero	=	""
fav(file, dbic, dboc, flsz, mask, bgrange, failvalu, bgzero )

file	=	"cuprad_for.pix"
dbic	=	[4]
dboc	=	[4]
flsz	=	[5,5]
mask	=	[]
bgrange	=	[]
failvalu	=	[]
bgzero	=	""
fav(file, dbic, dboc, flsz, mask, bgrange, failvalu, bgzero )

file	=	"cuprad_for.pix"
dbic	=	[5]
dboc	=	[5]
flsz	=	[5,5]
mask	=	[]
bgrange	=	[]
failvalu	=	[]
bgzero	=	""
fav(file, dbic, dboc, flsz, mask, bgrange, failvalu, bgzero )

Apply the inverse of the principal components transformation to the altered forward transformation results, and replace channels 108 to 112 in a copy of 'cuprad.pix' named 'cuprad_inv.pix' with the inverse transformation results:

from pci.pclt import pclt

fili	=	"cuprad_for.pix"
filo	=	"cuprad_inv.pix"
fillt	=	"cuprad_pclt.pix"
trandir	=	"inv"

lintrn( fili, filo, fillt, trandir )
Back to top

Algorithm

The Principal Components transformation is based on computing the eigenvalues and eigenvectors of the band-vector covariance matrix. (Because this matrix is real and symmetric, finding a set of n orthonormal eigenvectors is always possible, where n is the dimension of the band-vectors).

Let us call the transformation matrix T. The first row of T is the covariance matrix eigenvector with the largest eigenvalue, the second row of T is the eigenvector with the second-largest eigenvalue, and so on. Because T is an orthogonal matrix, its inverse is its transpose.

Let x be an original band vector, m be the mean band-vector, and y be the transformation result. Then y = T*(x - m). The inverse transformation is computed according to x = (transpose(T)*y) + m.

PCLT saves the elements of T and m to the file specified by FILLT (Linear Transformation Parameters file).

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.

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