Specifications

Histogram, Threshold, and Compare Functions
10-7
10
ConstrastStretch
Stretches the contrast of
an image using an
intensity transformation.
void iplContrastStretch(IplImage*
srcImage
,
IplImage*
dstImage
, IplLUT**
lut
);
srcImage
Thesourceimage.
dstImage
The resultant image.
lut
An array of pointers to LUTs, one pointer for
each channel. Each lookup table should have the
key
,
value
and
factor
arrays fully initialized
(see “The
IplLUT Structure”). One or more
channels may share the same LUT. Specifies an
intensity transformation.
Discussion
The function iplContrastStretch() stretches the contrast in a color
source image
srcImage
by applying intensity transformations specified by
LUTs in
lut
to produce an output image
dstImage
. Fully specified LUTs
should be provided to this function.
Example 10-2 Using the Function iplContrastStretch() to Enhance an Image
void fullRange() {
const int width = 32, height = 32, range = 256;
IplLUT lut = { range+1, NULL,NULL,NULL, IPL_LUT_INTER };
IplLUT* plut = &lut;
int i, mn, mx;
/// make a full range image
IplImage* img = iplCreateImageJaehne( IPL_DEPTH_8U, width,
height );
Continued