#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Image/Processing/Filters/Convolve2d.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_CONVOLVE2D_HEADER #define RAVLIMAGE_CONVOLVE2D_HEADER 1 ///////////////////////////////////////////////////////////////////////////////////// //! rcsid="$Id: Convolve2d.hh,v 1.8 2002/07/14 15:06:24 craftit Exp $" //! userlevel=Normal //! author="Charles Galambos" //! lib=RavlImageProc //! file="Ravl/Image/Processing/Filters/Convolve2d.hh" //! docentry="Ravl.Images.Filtering" #include "Ravl/Image/Correlate2d.hh" namespace RavlImageN { //! userlevel=Normal //: 2D Convolution template class Convolve2dC : protected Correlate2dC { public: Convolve2dC() {} //: Default constructor. // Use SetKernel() to setup a kernel before calling Apply(). Convolve2dC(const ImageC &nkernel) { SetKernel(nkernel); } //: Default constructor. void SetKernel(const ImageC &nkernel) { // The apply method actualy does correlation. Correlate2dC::SetKernel(nkernel.Rotate180()); } //: Set the convolution kernel. // Note: This method flips the kernel, so does take some time. void Apply(const ImageC &in,ImageC &result) const { Correlate2dC::Apply(in,result); } //: Do convolution on image 'in', put the output in 'result' void operator()(const ImageC &in,ImageC &result) const { Apply(in,result); } }; } #endif