Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vimt_correlate_2d.h

Go to the documentation of this file.
00001 // This is mul/vimt/algo/vimt_correlate_2d.h
00002 #ifndef vimt_correlate_2d_h_
00003 #define vimt_correlate_2d_h_
00004 //:
00005 //  \file
00006 //  \brief 2D Convolution
00007 //  \author Tim Cootes
00008 
00009 #include <vil/algo/vil_correlate_2d.h>
00010 #include <vimt/vimt_image_2d_of.h>
00011 
00012 //: Correlate kernel with src_im, keeping track of transformations.
00013 // dest is resized to (1+src_im.ni()-kernel.ni())x(1+src_im.nj()-kernel.nj())
00014 // (a one plane image).
00015 //
00016 // On exit dest(x,y) = sum_ij src_im(x+i,y+j)*kernel(i,j)
00017 //
00018 // dest_im.world2im() is set up so that vimt_bilin_interp(dest_im,p) is the convolution
00019 // of the kernel with the source image when the kernel's reference point is
00020 // placed at p in src_im
00021 // \relates vil_image_view
00022 template <class srcT, class destT, class kernelT, class accumT>
00023 inline void vimt_correlate_2d(const vimt_image_2d_of<srcT>& src_im,
00024                              vimt_image_2d_of<destT>& dest_im,
00025                              const vil_image_view<kernelT>& kernel,
00026                              vgl_point_2d<double> kernel_ref_pt,
00027                              accumT ac)
00028 {
00029   vil_correlate_2d(src_im.image(),dest_im.image(),kernel,ac);
00030   vimt_transform_2d offset;
00031   offset.set_translation(-kernel_ref_pt.x(),-kernel_ref_pt.y());
00032   dest_im.set_world2im(offset * src_im.world2im());
00033 }
00034 
00035 #endif // vimt_correlate_2d_h_

Generated on Thu Jan 10 14:43:58 2008 for contrib/mul/vimt by  doxygen 1.4.4