#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxConvGauss2d (HxImageRep img, double sigmax, int orderDerivx, double accuracyx, double sigmay, int orderDerivy, double accuracyy) |
HxConvGauss2d. More... |
|
HxConvGauss2d. Equivalent to : img.genConvSeparated( 1, gaussx, gaussy, "mul", "addAssign", HxImageRep::ARITH_PREC) where gaussx, gaussy are the 1d double-precision Gaussian kernels based on the respective sets of sigma, orderDeriv, accuracy parameters. Notice that the kernel is applied to every dimension of the image separately and that the result image has a double-precision pixel type.
00018 { 00019 HxString fname("HxConvGauss2d"); 00020 00021 HxImageRep gaussx, gaussy; 00022 00023 if (img.isNull()) 00024 { 00025 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID); 00026 return HxImageRep(); 00027 } 00028 if (sigmax <= 0.0) 00029 { 00030 HxGlobalError::instance()->reportError(fname, img.name(), "sigmax is equal to or less than zero", HxGlobalError::HX_GE_INVALID); 00031 return HxImageRep(); 00032 } 00033 if (sigmay <= 0.0) 00034 { 00035 HxGlobalError::instance()->reportError(fname, img.name(), "sigmay is equal to or less than zero", HxGlobalError::HX_GE_INVALID); 00036 return HxImageRep(); 00037 } 00038 if (orderDerivx < 0) 00039 { 00040 HxGlobalError::instance()->reportError(fname, img.name(), "orderDerivx is less than 0", HxGlobalError::HX_GE_INVALID); 00041 return HxImageRep(); 00042 } 00043 if (orderDerivy < 0) 00044 { 00045 HxGlobalError::instance()->reportError(fname, img.name(), "orderDerivy is less than 0", HxGlobalError::HX_GE_INVALID); 00046 return HxImageRep(); 00047 } 00048 if (truncationx < 0) 00049 { 00050 HxGlobalError::instance()->reportError(fname, img.name(), "truncationx is less than 0", HxGlobalError::HX_GE_INVALID); 00051 return HxImageRep(); 00052 } 00053 if (truncationy < 0) 00054 { 00055 HxGlobalError::instance()->reportError(fname, img.name(), "truncationy is less than 0", HxGlobalError::HX_GE_INVALID); 00056 return HxImageRep(); 00057 } 00058 00059 if (img.dimensionality() != 2) 00060 { 00061 HxGlobalError::instance()->reportError(fname, "only defined for 2D images", HxGlobalError::HX_GE_INVALID); 00062 return HxImageRep(); 00063 } 00064 00065 gaussx = HxMakeGaussian1d(sigmax, orderDerivx, truncationx, 00066 img.dimensionSize(1)); 00067 gaussy = HxMakeGaussian1d(sigmay, orderDerivy, truncationy, 00068 img.dimensionSize(2)); 00069 00070 return img.genConv2dSep( 00071 gaussx, gaussy, "mul", "addAssign", HxImageRep::ARITH_PREC); 00072 } |