Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxContrastStretch.h File Reference

More...

#include "HxImageRep.h"

Go to the source code of this file.

Functions

HxImageRep L_HXIMAGEREP HxContrastStretch (HxImageRep img, double mFactor)
 Contrast stretching. More...


Detailed Description


Function Documentation

HxImageRep L_HXIMAGEREP HxContrastStretch HxImageRep    img,
double    mFactor
 

Contrast stretching.

Computes mFactor * ((I - Imin) / (Imax - Imin)) with Imin and Imax the minimum and maximum value present in image I.

00019 {
00020     HxString fname("HxContrastStretch");
00021 
00022     if (img.isNull())
00023     {
00024         HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00025         return HxImageRep();
00026     }
00027 
00028     HxScalarDouble min = HxPixMin(img);
00029     HxScalarDouble max = HxPixMax(img);
00030     if (min <= max)
00031     {
00032         HxGlobalError::instance()->reportError(fname, img.name(), "maximum is less than or equal to minimum is not allowed", HxGlobalError::HX_GE_INVALID);
00033         return HxImageRep();
00034     }
00035     if (mFactor < (max.x() - min.x()))
00036     {
00037         HxGlobalError::instance()->reportError(fname, img.name(), "mFactor is less than original range", HxGlobalError::HX_GE_INVALID);
00038         return HxImageRep();
00039     }
00040 
00041     return HxMulVal(HxSubVal(img, min), mFactor / (max - min));
00042 }


Generated on Tue Feb 3 14:18:46 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001