#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxGaussDerivative2d (HxImageRep img, double sigma, int orderDerivx, int orderDerivy, double accuracy=3.0) |
Convolution Gaussian. More... |
|
Convolution Gaussian. Equivalent to : img.genConv2dSep( gaussx, gaussy, "mul", "addAssign", HxImageRep::ARITH_PREC) where gaussx and gaussy are the 1d double-precision Gaussian kernel based on sigma, orderDeriv{x,y}, and accuracy. 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("HxGaussDerivative2d"); 00020 00021 if (img.isNull()) 00022 { 00023 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID); 00024 return HxImageRep(); 00025 } 00026 00027 if (sigma <= 0.0) 00028 { 00029 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of sigma", HxGlobalError::HX_GE_INVALID); 00030 return HxImageRep(); 00031 } 00032 if (orderDerivx < 0) 00033 { 00034 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of OrderDerivx", HxGlobalError::HX_GE_INVALID); 00035 return HxImageRep(); 00036 } 00037 if (orderDerivy < 0) 00038 { 00039 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of OrderDerivy", HxGlobalError::HX_GE_INVALID); 00040 return HxImageRep(); 00041 } 00042 00043 if (truncation < 0.0) 00044 { 00045 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of truncation", HxGlobalError::HX_GE_INVALID); 00046 return HxImageRep(); 00047 } 00048 00049 if (img.dimensionality() != 2) 00050 { 00051 HxGlobalError::instance()->reportError(fname, img.name(), "function only valid for 2D images", HxGlobalError::HX_GE_INVALID); 00052 return HxImageRep(); 00053 } 00054 00055 HxImageRep gaussx, gaussy; 00056 00057 gaussx = HxMakeGaussian1d(sigma, orderDerivx, truncation, 00058 img.dimensionSize(1)); 00059 gaussy = HxMakeGaussian1d(sigma, orderDerivy, truncation, 00060 img.dimensionSize(2)); 00061 00062 return img.genConv2dSep( 00063 gaussx, gaussy, "mul", "addAssign", HxImageRep::ARITH_PREC); 00064 } |