.\
cgimgscl.pro
top cgImgScl
Graphics, Utilities
result = cgImgScl(image [, xsize] [, ysize] [, BOTTOM=integer] [, BETA=float] [, CLIP=float] [, CONSTANT=float] [, EXCLUDE=numeric] [, EXPONENT=float] [, GAMMA=float] [, /INTERPOLATE] [, MAXVALUE=varies] [, MEAN=float] [, /MINUS_ONE] [, MINVALUE=varies] [, MISSING_INDEX=integer] [, MISSING_VALUE=integer] [, MULTIPLIER=float] [, NCOLORS=integer] [, /NEGATIVE] [, /SCALE] [, STRETCH=integer/string] [, SIGMA=float] [, TOP=integer])
This function scales an image using the same keywords and scaling available in
cgImage and cgStretch. Set the Stretch
keyword for the types of image scaling
or stretching available.
Return value
Returns a scaled image.
Parameters
- image in required
The input image that is to be scaled. Only 2D images can be scaled, although true-color images can be resized.
- xsize in optional
The output X size of the image.
- ysize in optional
The output Y size of the image.
Keywords
- BOTTOM in optional type=integer default=0
If the
SCALE
keyword is set, the image is scaled before display so that all displayed pixels have values greater than or equal toBOTTOM
and less than or equal toTOP
.- BETA in optional type=float default=3.0
The beta factor in a Hyperpolic Sine stretch.
- CLIP in optional type=float default=2
A number between 0 and 50 that indicates the percentage of pixels to clip off either end of the image histogram before performing a linear stretch.
- CONSTANT in optional type=float default=1.0
A constant value applied in a logarithmic stretch.
- EXCLUDE in optional type=numeric
The value to exclude in a standard deviation stretch.
- EXPONENT in optional type=float default=4.0
The logarithm exponent in a compression stretch.
- GAMMA in optional type=float default=1.5
The gamma factor in a gamma stretch.
- INTERPOLATE in optional type=boolean default=0
Set this keyword to interpolate with bilinear interpolation the display image as it is sized to its final position in the display window. Interpolation will potentially create image values that do not exist in the original image. The default is to do no interpolation, so that image values to not change upon resizing. Interpolation can result in smoother looking final images.
- MAXVALUE in optional type=varies
If this value is defined, the data is linearly scaled between
MINVALUE
andMAXVALUE
.MAXVALUE
is set toMAX
(image) by default. Setting this keyword to a value automatically setsSCALE
to 1. If the maximum value of the image is greater than 255, this keyword is defined and SCALE=1.- MEAN in optional type=float default=0.5
The mean factor in a compression stretch.
- MINUS_ONE in optional type=boolean default=0
The value of this keyword is passed along to the cgResizeImage command. It prevents cgResizeImage from adding an extra row and column to the resulting array, which can be a problem with small image arrays.
- MINVALUE in optional type=varies
If this value is defined, the data is linearly scaled between MINVALUE and
MAXVALUE
.MINVALUE
is set toMIN
(image) by default. Setting this keyword to a value automatically sets SCALE=1. If the minimum value of the image is less than 0, this keyword is defined and SCALE=1.- MISSING_INDEX in optional type=integer default=255
The index of the missing color in the final byte scaled image.
- MISSING_VALUE in optional type=integer
The number that represents the missing value in the image.
- MULTIPLIER in optional type=float
The multiplication factor in a standard deviation stretch. The standard deviation is multiplied by this factor to produce the thresholds for a linear stretch.
- NCOLORS in optional type=integer default=256
If this keyword is supplied, the
TOP
keyword is ignored and the TOP keyword is set equal to NCOLORS-1. This keyword is provided to make cgImgScl easier to use with the color-loading programs such as cgLOADCT:Setting this keyword to a value automatically sets SCALE=1 and STRETCH='LINEAR', if not defined otherwise. Available only with 2D images.cgLoadCT, 5, NColors=100, Bottom=100 scaled = cgImgScl(image, NColors=100, Bottom=100)
- NEGATIVE in optional type=boolean default=0
Set this keyword if you want to display the image with a negative or reverse stretch.
- SCALE in optional type=boolean default=0
Set this keyword to byte scale the image before display. If this keyword is not set, the image is not scaled before display. This keyword will be set automatically by using any of the keywords normally associated with byte scaling an image.
- STRETCH in optional type=integer/string default=0
The type of scaling performed prior to display. May be specified as a number or as a string (e.g, 3 or "Log"). Available only with 2D images. If Min(image) is less than zero or Max(image) is greater than 255, then the default value for stretch is 1.
Number Type of Stretch:
0 None No scaling whatsoever is done. 1 Linear scaled = BytScl(image, MIN=minValue, MAX=maxValue) 2 Linear 2% A histogram stretch, with a percentage of pixels clipped at both the top and bottom 3 Gamma scaled = cgGmaScl(image, MIN=minValue, MAX=maxValue, Gamma=gamma) 4 Log scaled = cgLogScl(image, MIN=minValue, MAX=maxValue, Mean=mean, Exponent=exponent) 5 Asinh scaled = cgAsinhScl(image, MIN=minValue, MAX=maxValue, Beta=beta) 6 SquareRoot A linear stretch of the square root histogram of the image values. 7 Equalization A linear stretch of the histogram equalized image histogram. 8 Gaussian A Gaussian normal function is applied to the image histogram. 9 MODIS Scaling done in the differential manner of the MODIS Rapid Response Team and implemented in the Coyote Library routine ScaleModis. 10 StdDev Standard deviation stretch. scaled = cgSDevScl(image, MULTIPLIER=2). 11 Compression Compress mid-tones in image with cgCompressScl.
- SIGMA in optional type=float default=1.0
The sigma scale factor in a Gaussian stretch.
- TOP in optional type=integer default=255
If the
SCALE
keyword is set, the image is scaled before display so that all displayed pixels have values greater than or equal toBOTTOM
and less than or equal toTOP
.
Examples
Used to for image display:
IDL> scaledImage = cgImgScl(image, Stretch=4, Exponent=2)
IDL> cgImage, scaledImage[0:100, 200:400], /Keep_Aspect
Author information
- Author:
FANNING SOFTWARE CONSULTING:
David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com
- Copyright:
Copyright (c) 2012-2015, Fanning Software Consulting, Inc.
- History:
Change History:
Written by David W. Fanning, 21 September 2012. Only define MISSING_INDEX value if needed. Change to support TRANSPARENT keyword in cgImage. 18 October 2012. DWF. Only 2D images can be scaled. 18 October 2012. DWF. Made LOG stretch a real log stretch and add a compression stretch. 27 March 2015. DWF.
File attributes
Modification date: | Fri Mar 27 10:58:47 2015 |
Lines: | 419 |
Docformat: | rst rst |