contrib/mul/vimt/algo/vimt_normalised_correlation_2d.h
Go to the documentation of this file.
00001 // This is mul/vimt/algo/vimt_normalised_correlation_2d.h
00002 #ifndef vimt_normalised_correlation_2d_h_
00003 #define vimt_normalised_correlation_2d_h_
00004 //:
00005 //  \file
00006 //  \brief 2D Normalised correlation
00007 //  \author Tim Cootes
00008 
00009 #include <vil/algo/vil_normalised_correlation_2d.h>
00010 #include <vimt/vimt_image_2d_of.h>
00011 #include <vgl/vgl_fwd.h>
00012 
00013 //: Evaluate dot product between kernel and (normalised) src_im
00014 // Assumes that the kernel has been normalised to have zero mean
00015 // and unit variance.
00016 // \relatesalso vimt_image_2d_of
00017 template <class srcT, class destT, class kernelT, class accumT>
00018 inline void vimt_normalised_correlation_2d(const vimt_image_2d_of<srcT>& src_im,
00019                                            vimt_image_2d_of<destT>& dest_im,
00020                                            const vil_image_view<kernelT>& kernel,
00021                                            vgl_point_2d<double> kernel_ref_pt,
00022                                            accumT ac)
00023 {
00024   vil_normalised_correlation_2d(src_im.image(),dest_im.image(),kernel,ac);
00025   vimt_transform_2d offset;
00026   offset.set_translation(-kernel_ref_pt.x(),-kernel_ref_pt.y());
00027   dest_im.set_world2im(offset * src_im.world2im());
00028 }
00029 
00030 #endif // vimt_normalised_correlation_2d_h_