core/vil/vil_resample_nearest.h
Go to the documentation of this file.
00001 // This is core/vil/vil_resample_nearest.h
00002 #ifndef vil_resample_nearest_h_
00003 #define vil_resample_nearest_h_
00004 //:
00005 // \file
00006 // \brief Sample image with nearest neighbour interpolation in one image and place in another
00007 // \author dac
00008 //
00009 // The vil nearest neighbour source files were derived from the corresponding
00010 // vil bilin files, thus the vil bilin/bicub/nearest source files are very
00011 // similar.  If you modify something in this file, there is a
00012 // corresponding bicub/bilin file that would likely also benefit from
00013 // the same change.
00014 
00015 #include <vil/vil_image_view.h>
00016 
00017 //: Sample grid of points in one image and place in another, using nearest neighbour interpolation.
00018 //  dest_image(i,j,p) is sampled from the src_image at
00019 //  (x0+i.dx1+j.dx2,y0+i.dy1+j.dy2), where i=[0..n1-1], j=[0..n2-1]
00020 //  dest_image resized to (n1,n2,src_image.nplanes())
00021 //  Points outside image return zero.
00022 // \relatesalso vil_image_view
00023 template <class sType, class dType>
00024 void vil_resample_nearest(const vil_image_view<sType>& src_image,
00025                           vil_image_view<dType>& dest_image,
00026                           double x0, double y0, double dx1, double dy1,
00027                           double dx2, double dy2, int n1, int n2);
00028 
00029 //: Resample image to a specified width (n1) and height (n2)
00030 // \relatesalso vil_image_view
00031 template <class sType, class dType>
00032 void vil_resample_nearest(const vil_image_view<sType>& src_image,
00033                           vil_image_view<dType>& dest_image,
00034                           int n1, int n2);
00035 
00036 //: Sample grid of points in one image and place in another, using nearest neighbour interpolation.
00037 //  dest_image(i,j,p) is sampled from the src_image at
00038 //  (x0+i.dx1+j.dx2,y0+i.dy1+j.dy2), where i=[0..n1-1], j=[0..n2-1]
00039 //  dest_image resized to (n1,n2,src_image.nplanes())
00040 //  Points outside image return the value of the nearest valid pixel.
00041 // \relatesalso vil_image_view
00042 template <class sType, class dType>
00043 void vil_resample_nearest_edge_extend(const vil_image_view<sType>& src_image,
00044                                       vil_image_view<dType>& dest_image,
00045                                       double x0, double y0, double dx1, double dy1,
00046                                       double dx2, double dy2, int n1, int n2);
00047 
00048 //: Resample image to a specified width (n1) and height (n2)
00049 // \relatesalso vil_image_view
00050 template <class sType, class dType>
00051 void vil_resample_nearest_edge_extend(const vil_image_view<sType>& src_image,
00052                                       vil_image_view<dType>& dest_image,
00053                                       int n1, int n2);
00054 
00055 #endif // vil_resample_nearest_h_