The old ones are the best. This is an update of this older Spatial Recipe: https://community.hexagongeospatial.com/t5/Spatial-Recipes/PC-with-Percentage-Contribution/ta-p/776
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 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