contrib/mul/vimt/algo/vimt_pyramid_values_at_point.h
Go to the documentation of this file.
00001 // This is mul/vimt/algo/vimt_pyramid_values_at_point.h
00002 #ifndef vimt_pyramid_values_at_point_h_
00003 #define vimt_pyramid_values_at_point_h_
00004 //:
00005 // \file
00006 // \brief Function to sample a point at each level of an image pyramid
00007 // \author Tim Cootes
00008 
00009 #include <vimt/vimt_image_pyramid.h>
00010 #include <vimt/vimt_image_2d_of.h>
00011 #include <vgl/vgl_point_2d.h>
00012 
00013 //: Use bilinear to sample from each level of the image pyramid
00014 //  \param samples: Filled with image_pyr.n_levels() values
00015 //  \param dummy: Used to define type of image pyramid
00016 template<class T>
00017 void vimt_pyramid_values_at_point(const vimt_image_pyramid& image_pyr,
00018                                   vgl_point_2d<double> p,
00019                                   vcl_vector<double>& samples,
00020                                   T dummy, int plane=0)
00021 {
00022   samples.resize(image_pyr.n_levels());
00023   for (unsigned L=image_pyr.lo();L<=image_pyr.hi();++L)
00024   {
00025     const vimt_image_2d_of<T>& image
00026             = static_cast<const vimt_image_2d_of<T>&>(image_pyr(L));
00027     samples[L] = vimt_bilin_interp_safe(image,p,plane);
00028   }
00029 }
00030 
00031 #endif // vimt_pyramid_values_at_point_h_