#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxLog (HxImageRep im) |
| Natural logarithm. More... | |
|
|
Natural logarithm. The function computes the natural logarithm (see Pixels) of all pixels in the input image via a unary pixel operation (see Images). Implementation specifics : The pixel functor : HxUpoLog. The image functor instantiator : HxInstantiatorLog.
00013 {
00014 HxString fname("HxLog");
00015
00016 if (im.isNull())
00017 {
00018 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019 return HxImageRep();
00020 }
00021
00022 HxValue vinf = HxPixInf(im);
00023
00024 if (im.signature().pixelDimensionality() == 1)
00025 {
00026 if (((HxScalarDouble) vinf) <= 0.0)
00027 {
00028 HxGlobalError::instance()->reportError(fname, im.name(), "values less than 0", HxGlobalError::HX_GE_OUTOFRANGE);
00029 }
00030 }
00031 else if (im.signature().pixelDimensionality() == 2)
00032 {
00033 HxVec2Double vinf2d = (HxVec2Double) vinf;
00034 if ((vinf2d.x() <= 0.0) || (vinf2d.y() <= 0.0))
00035 {
00036 HxGlobalError::instance()->reportError(fname, im.name(), "2D values are less than 0", HxGlobalError::HX_GE_OUTOFRANGE);
00037 }
00038 }
00039 else if (im.signature().pixelDimensionality() == 3)
00040 {
00041 HxVec3Double vinf3d = (HxVec3Double) vinf;
00042 if ((vinf3d.x() <= 0.0) || (vinf3d.y() <= 0.0) || (vinf3d.z() <= 0.0))
00043 {
00044 HxGlobalError::instance()->reportError(fname, im.name(), "3D values are less than 0", HxGlobalError::HX_GE_OUTOFRANGE);
00045 }
00046 }
00047
00048 return im.unaryPixOp("log");
00049 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001