Showing results for 
Search instead for 
Do you mean 

Calculate Principal Components and Report Percentage Contribution of each PC

by Technical Evangelist ‎03-22-2018 12:14 PM - edited ‎03-22-2018 12:26 PM (1,018 Views)


Download model





The old ones are the best. This is an update of this older Spatial Recipe:





This Model creates a user-defined number of Principal Components from an input multispectral image and also enables calculating and outputting the percentage each Component contributes to the overall scene variation (as both a text file and as a list in the Session Log).


Screenshot showing PCs at upper right (PC 1,2,3), original Landsat image at lower right (4,3,2), model in center, and contribution values at lower left. 


Additionally the Model provides an option to stretch the output PCs to the same dynamic range as the input imagery and with the same data type. For example, if the input image were a 16bit data type with an Actual Bits Per Pixel (ABPP) of 11,  turning the Stretch option to True would produce a set of Principal Components stretched to a dynamic range of 0 to 2047 stored as integers. Doing so saves disk space while preserving a large degree of accuracy. 


This Model makes use of the If Else operator introduced with ERDAS IMAGINE 2016 to provide the option to stretch the output (as well as other operators such as Get Actual Bits Per Pixel) and so can only be used with ERDAS IMAGINE 2016 (v16.1) or later.



Input parameters: 


Input MS:  Multispectral input image filename from which Principal Components are to be calculated.

PC Filename Out: Name of the output image file containing the requested Principal Components.

Number of PCs: Enter the number of Principal Components to calculate and output. Minimum is 1, maximum should be the number of bands in the input image.

Skip Factor: Skip factor for calculating image statisitcs. Larger numbers will increase processing speed at the expense of some accuracy. 1 uses all pixel values, 4  uses every fourth row and column value, etc.

Output Report File: Output filename representing the Percentage Contribution each PC represents of the original scene variability  (e.g. Contrib.txt). The Eigen Matrix is also included. Outputting a file is optional and can be left blank if no file is required. Values will also be shown in the Session Log.

Stretch to Integer?: Stretch the output file to the same ABPP dynamic range as the input image? True / False



by Technical Evangelist
on ‎09-10-2018 06:41 AM

See the following Spatial Recipe for how to calculate Factor Loadings for Principal Component Analysis: