#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Image/Processing/Filters/ConvolveSeparable2d.hh" // This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVLIMAGE_CONVOLVESEPARABLE2D_HEADER #define RAVLIMAGE_CONVOLVESEPARABLE2D_HEADER 1 ///////////////////////////////////////////////////////////////////////////////////// //! rcsid="$Id: ConvolveSeparable2d.hh,v 1.6 2002/07/14 15:06:24 craftit Exp $" //! userlevel=Normal //! author="Charles Galambos" //! docentry="Ravl.Images.Filtering" //! lib=RavlImageProc //! file="Ravl/Image/Processing/Filters/ConvolveSeparable2d.hh" #include "Ravl/Image/Image.hh" #include "Ravl/Image/ConvolveHorz2d.hh" #include "Ravl/Image/ConvolveVert2d.hh" namespace RavlImageN { //! userlevel=Normal //: Separable 2D Convolution template class ConvolveSeparable2dC { public: ConvolveSeparable2dC() {} //: Default constructor. ConvolveSeparable2dC(const Array1dC &nrowKernel,const Array1dC &ncolKernel) { SetKernel(nrowKernel,ncolKernel); } //: Default constructor. void SetKernel(const Array1dC &nrowKernel,const Array1dC &ncolKernel) { horz.SetKernel(nrowKernel); vert.SetKernel(ncolKernel); } //: Set the convolution kernel. void Apply(const ImageC &in,ImageC &result) const; //: Do convolution on image 'in', put the output in 'result' void operator()(const ImageC &in,ImageC &result) const { Apply(in,result); } protected: ConvolveVert2dC vert; ConvolveHorz2dC horz; }; template void ConvolveSeparable2dC::Apply(const ImageC &in,ImageC &result) const { ImageC tmp; vert.Apply(in,tmp); horz.Apply(tmp,result); } //: Do convolution. } #endif