#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxPercentile (HxImageRep im, int neighSize, double perc) |
| Percentile filter. More... | |
|
||||||||||||||||
|
Percentile filter. Implementation specifics : The neighbourhood functor : HxNgbPercentile2d. The image functor instantiator : HxInstNgbPercentile2d_c.
00014 {
00015 HxString fname("HxPercentile");
00016
00017 if (im.isNull())
00018 {
00019 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID);
00020 return HxImageRep();
00021 }
00022
00023 if (im.dimensionality() != 2)
00024 {
00025 HxGlobalError::instance()->reportError(fname, im.name(), "Only valid for 2D images", HxGlobalError::HX_GE_INVALID);
00026 return HxImageRep();
00027 }
00028 if (neighSize < 1)
00029 {
00030 HxGlobalError::instance()->reportError(fname, "neighbourhoud too small", HxGlobalError::HX_GE_INVALID);
00031 return HxImageRep();
00032 }
00033 if ((neighSize > im.dimensionSize(1)) || (neighSize > im.dimensionSize(2)))
00034 {
00035 HxGlobalError::instance()->reportError(fname, "neighbourhoud too large", HxGlobalError::HX_GE_INVALID);
00036 return HxImageRep();
00037 }
00038 if ((perc < 0) || (perc > 1))
00039 {
00040 HxGlobalError::instance()->reportError(fname, "percentile in [0:1]", HxGlobalError::HX_GE_INVALID);
00041 return HxImageRep();
00042 }
00043
00044 HxTagList tags;
00045 HxAddTag(tags, "size", neighSize);
00046 HxAddTag(tags, "percentile", perc);
00047
00048 return im.neighbourhoodOp("percentile", tags);
00049 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001