Environments | PYTHON :: EASI :: MODELER |
Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Examples :: Algorithm :: References :: Related |
Back to top |
Back to top |
decorr(file, dbic, dboc, mask, eigensup)
Name | Type | Caption | Length | Value range |
---|---|---|---|---|
FILE* | str | Input file name | 1 - | |
DBIC* | List[int] | Input raster channels | 2 - 256 | -1024 - |
DBOC* | List[int] | Output decorrelated channels | 1 - 256 | -1024 - |
MASK | List[int] | Area Mask (Window or Bitmap) | 0 - 4 | Xoffset, Yoffset, Xsize, Ysize |
EIGENSUP | List[float] | Eigenchannels to suppress | 0 - 16 | 1 - |
Back to top |
FILE
Specifies the name of the PCIDSK image file that contains the image channels to decorrelate.
DBIC
Specifies the image channels to be decorrelated.
At least two channels must be specified, to a maximum of 256 channels. Duplicate channels are NOT allowed.
DBOC
Specifies the image channels to receive the decorrelated results.
The number of output channels must be the same or fewer than the specified input channels.
Each output channel saves the decorrelated results of the corresponding input channel. Duplicate channels are NOT allowed.
MASK
Specifies the window or bitmap that defines the area to be processed within the input raster.
If a single value is specified, that value represents the channel number of the bitmap segment in the input file. Only the pixels under the bitmap are processed; the rest of the image remains unchanged.
If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. 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.
If no value is specified, the entire channel is processed.
Regardless of the mask area defined, the entire image is decorrelated. The decorrelation is optimized over the mask area.
EIGENSUP
Specifies the eigenchannels to suppress. Eigenchannels are numbered from 1 to the number of specified input channels.
Eigenchannels are often suppressed to reduce noise (error). Error is typically concentrated in the last or last few eigenchannels.
Eigenchannels are generated internally for the decorrelation process. The first eigenchannel contains the most variance, the second the next most variance, and the last the least.
At most, 16 eigenchannels can be suppressed.
Back to top |
Decorrelation stretching is a method of enhancing multispectral image data, typically in an attempt to improve it visually. The basic concept is to force the variance between multispectral image channels to be maximized using a principal component transformation. The resulting imagery is (usually) quite similar to the original imagery, maintaining the average gray level and dynamic range, except that details have been improved, especially in areas which were 'uniform' in color (that is, correlated). Not all images, however, look better after decorrelation.
DECORR performs a decorrelation stretch on a set of input image channels (DBIC) in a PCIDSK image file. The results of the stretch are saved on the output channels (DBOC). Each output channel corresponds to the input channel.
More input channels can be specified than output channels. In these cases, the decorrelation transformation is calculated for all input channels, but only the specified output channels are saved. This is useful, because the extra channels usually contribute some information to the output channels, so the overall information content of the output channels is increased.
The decorrelation can be optimized for a specific region of interest (MASK). This region can be described by either a window (MASK=i,j,k,l) or a bitmap (MASK=i). If the MASK parameter is not specified, the entire image is used. Regardless of the interest region specified, the decorrelation is applied to the entire image.
It is possible to suppress the variance contribution of selected eigenchannels (EIGENSUP). This capability serves to improve image quality by suppressing noise (or error). When an eigenchannel is suppressed, its variance is suppressed, but its mean is still used. This ensures that the resulting decorrelated image has the same mean(s) as the original. Eigenchannels are a calculated, intermediate step in the decorrelation process. There is one eigenchannel for each input channel, and each one holds a decreasing amount of variance. Typically, the last few eigenchannels hold little variance, most of which is error, and these are the ones that are suppressed.
Back to top |
Channels 1, 2, and 3 of the file irvine.pix represent Landsat TM true color; however, these channels (in this particular scene) are highly correlated. The user wishes to perform a decorrelation stretch on these channels to enhance the visual appearance when shown on the display. Channels 1 through 5 are used as input, though only decorrelated channels 1, 2, and 3 are saved on output to channels 7, 8, and 9.
from pci.decorr import * file = 'irvine.pix' dbic = [3,2,1,4,5] dboc = [7,8,9] # save results for 3,2,1 only mask = [] # default, quick sampling of entire image eigensup = [] # no eigenchannels suppressed decorr( file, dbic, dboc, mask, eigensup )
The output generated is shown in "Output report" in the Algorithm section. Transferring channels 7, 8, 9 to the display (using IVI) and using a linear enhancement, the user notices very poor image quality and a large amount of noise. Examining the report produced, the user notices that most of the variance ( > 99%) is concentrated in the first three eigenchannels. The last two eigenchannels are mostly error, and are scaled so much that they ruin the visual appearance of the image. The user decides to rerun the decorrelation with these last two eigenchannels suppressed.
from pci.decorr import * file = 'irvine.pix' dbic = [3,2,1,4,5] dboc = [7,8,9] # save result for 3,2,1 only mask = [] # default, quick sampling of entire image eigensup = [4,5] # suprres eigenchannels 4 and 5 decorr( file, dbic, dboc, mask, eigensup )
Back to top |
A decorrelation stretch attempts to maximize the variance between output channels. The basis for this is Principal Component Analysis, which is discussed in detail in the PCA documentation.
Suppression of eigenchannels (components) is done in step 2. Instead of scaling to match the variance of the first component, DECORR sets the scale factor to 0.
A visual interpretation of the effects of the decorrelation stretch using two channels is demonstrated in their scatterplots before and after decorrelation:
C | C | h | h | * a | * a | * n | ** n | * * * n | *** n | ** *** * e | ** e | * * * * l | *** l | * * ** | ** | ** A | * A | * +------------------------ +------------------------ channel B channel B Fig.1: Before decorrelation Fig.2: After decorrelation
For further information on decorrelation stretching consult the following paper:
Gillespie, A.R., A.B. Kahle, R.E. Walker, 1986. "Color Enhancement of Highly Correlated Images. I. Decorrelation and HSI Contrast Stretches". Remote Sensing of Environment, Vol.20, p.209-235.
Using many channels
Although DECORR can handle up to 256 channels of data, using more than 32 is not recommended. The internal calculations are done in single precision (32-bit) floating point mathematics. Using a large number of channels tends to result in numerical instability and eventually poor results or program failure.
Output Report
The report below is an example of the report generated by DECORR.
irvine.pix [S 14PIC 512P 512L] 14-Aug-90 Input Channels: 3 2 1 4 5 Output Channels: 7 8 9 Sampling Window: 0 0 512 512 Sampling Bitmap: none used Sample size : 32768 Input Channel Mean Deviation 3 29.1240 9.5824 2 25.4875 5.9492 1 64.4771 10.0178 4 39.7752 11.2962 5 25.9260 11.1319 Covariance matrix for input channels: 3 2 1 4 5 +----------------------------------------------------------- 3| 91.822 2| 55.315 35.392 1| 91.265 57.234 100.356 4| 53.626 35.933 51.623 127.605 5| 86.124 49.949 76.609 61.284 123.920 Eigenchan Eigenvalue Deviation %Variance Scale Factor (Used) 1 353.9080 18.8124 73.87% 1.00 ( 1.00) 2 81.4424 9.0245 17.00% 2.08 ( 2.08) 3 39.5849 6.2917 8.26% 2.99 ( 2.99) 4 3.0105 1.7351 0.63% 10.84 (10.84) 5 1.1499 1.0723 0.24% 17.54 (17.54) Eigenvectors of covariance matrix (arranged by rows): 0.48655427 0.29934525 0.48355350 0.41353855 0.51847798 0.24679996 0.11529773 0.28296703 -0.90557152 0.16020662 0.18398458 0.19743498 0.49801043 0.08589405 -0.81962007 0.72211707 0.19005740 -0.63968229 -0.01107403 -0.18195906 -0.38347274 0.90664017 -0.16999383 -0.03775945 0.02506943 Inverse eigenvector matrix (channels arranged by rows): 0.48655421 0.24679999 0.18398456 0.72211707 -0.38347280 0.29934525 0.11529772 0.19743498 0.19005737 0.90664023 0.48355344 0.28296697 0.49801043 -0.63968223 -0.16999382
Back to top |
Gillespie, A.R., A.B. Kahle, R.E. Walker, 1986. "Color Enhancement of Highly Correlated Images. I. Decorrelation and HSI Contrast Stretches". Remote Sensing of Environment, Vol.20, p.209-235.
© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.