#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxConvKernelSeparated (HxImageRep img, HxImageRep kernel, HxImageRep::ResultPrecision resPrec) |
Convolution with separable kernel. More... |
|
Convolution with separable kernel. The function performs a convolution on the input image via a generalized convolution operation (see Images). The same kernel is applied in each dimension. Implementation specifics : The image functor instantiator for 2D images : HxInstMulAddAss2dK1d, and for 3D images : HxInstMulAddAss3dK1d.
00015 { 00016 HxString fname("HxConvGauss2d"); 00017 00018 if (img.isNull()) 00019 { 00020 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID); 00021 return HxImageRep(); 00022 } 00023 if (kernel.isNull()) 00024 { 00025 HxGlobalError::instance()->reportError(fname, kernel.name(), "null kernel", HxGlobalError::HX_GE_INVALID); 00026 return HxImageRep(); 00027 } 00028 if (kernel.signature().pixelDimensionality() != 1) 00029 { 00030 HxGlobalError::instance()->reportError(fname, "only defined for scalar kernel pixel types", HxGlobalError::HX_GE_INVALID); 00031 return HxImageRep(); 00032 } 00033 if (kernel.dimensionSize(2) != 1) 00034 { 00035 HxGlobalError::instance()->reportError(fname, "N x 1 kernel image required", HxGlobalError::HX_GE_INVALID); 00036 return HxImageRep(); 00037 } 00038 if (kernel.dimensionSize(1) > img.dimensionSize(1)) 00039 { 00040 HxGlobalError::instance()->reportError(fname, "kernel size larger than image x-dimension size", HxGlobalError::HX_GE_INVALID); 00041 return HxImageRep(); 00042 } 00043 if ((img.signature().imageDimensionality() > 2) && 00044 (kernel.dimensionSize(1) > img.dimensionSize(2))) 00045 { 00046 HxGlobalError::instance()->reportError(fname, "kernel size larger than image y-dimension size", HxGlobalError::HX_GE_INVALID); 00047 return HxImageRep(); 00048 } 00049 if ((img.signature().imageDimensionality() > 2) && 00050 (kernel.dimensionSize(1) > img.dimensionSize(3))) 00051 { 00052 HxGlobalError::instance()->reportError(fname, "kernel size larger than image z-dimension size", HxGlobalError::HX_GE_INVALID); 00053 return HxImageRep(); 00054 } 00055 00056 return img.genConvSeparated(kernel, "mul", "addAssign", resPrec); 00057 } |