Synopsis
HxImageRep HxContrastStretch (HxImageRep img, double mFactor)
Input
HxImageRep img
double mFactor
Return value
HxImageRep
Description
This function stretches the contrast of the function, where the range of the pixel value in the output image is given by the interval [0, mFactor]. The pixel value `y' in the output image is calculated from the original pixel value `x' as follows: Where and denote the minimum and maximum value of the input image. This function is defined for scalar images that are not constant.
Remarks
Examples
Example of stretching the contrast of an image
#include "HxImageRepGlobalFuncs.h" #include "HxImageRep.h" HxImageRep HxContrastStretchExample1(HxImageRep img) { img = HxImageAsDouble(img); img = HxContrastStretch(img, 150.0); img = HxImageAsByte(img); return img; } int main(int argc, char* argv[]) { HxImageRep im1 = HxMakeFromFile(argv[1]); im1 = HxContrastStretchExample1(im1); HxWriteFile(im1, argv[2]); return 0; }
Input image for the HxContrastStretch example.
Output image of the HxContrastStretch example.
In this example we stretch the pixel values to a range from 0 to 150.
See also
Enhancement,