core/vil/algo/vil_convolve_2d.h
Go to the documentation of this file.
00001 // This is core/vil/algo/vil_convolve_2d.h
00002 #ifndef vil_convolve_2d_h_
00003 #define vil_convolve_2d_h_
00004 //:
00005 // \file
00006 // \brief 2D Convolution
00007 // \author Tim Cootes
00008 
00009 #include <vcl_compiler.h>
00010 #include <vil/vil_flip.h>
00011 #include <vil/algo/vil_correlate_2d.h>
00012 
00013 
00014 //: Convolve kernel with srcT
00015 // dest is resized to (1+src_im.ni()-kernel.ni())x(1+src_im.nj()-kernel.nj())
00016 // (a one plane image).
00017 // On exit dest(x,y) = sum_ij src_im(x-i,y-j)*kernel(i,j)
00018 // \relatesalso vil_image_view
00019 template <class srcT, class destT, class kernelT, class accumT>
00020 inline void vil_convolve_2d(const vil_image_view<srcT>& src_im,
00021                             vil_image_view<destT>& dest_im,
00022                             const vil_image_view<kernelT>& kernel,
00023                             accumT ac)
00024 {
00025   vil_correlate_2d(src_im,dest_im,vil_flip_ud(vil_flip_lr(kernel)), ac);
00026 }
00027 
00028 #endif // vil_convolve_2d_h_