1 // This is core/vil/vil_resample_bilin.h
2 #ifndef vil_resample_bilin_h_
3 #define vil_resample_bilin_h_
4 //:
5 // \file
6 // \brief Sample grid of points with bilinear interpolation in one image and place in another
7 // \author Tim Cootes
8 //
9 // The vil bicub source files were derived from the corresponding
10 // vil bilin files, thus the vil bilin/bicub source files are very
11 // similar.  If you modify something in this file, there is a
12 // corresponding bicub file that would likely also benefit from
13 // the same change.
14 
15 #include "vil_image_view.h"
16 
17 //: Sample grid of points in one image and place in another, using bilinear interpolation.
18 //  dest_image(i,j,p) is sampled from the src_image at
19 //  (x0+i.dx1+j.dx2,y0+i.dy1+j.dy2), where i=[0..n1-1], j=[0..n2-1]
20 //  dest_image resized to (n1,n2,src_image.nplanes())
21 //  Points outside image return zero.
22 // \sa vil_resample_bicub
23 // \relatesalso vil_image_view
24 template <class sType, class dType>
25 void vil_resample_bilin(const vil_image_view<sType>& src_image,
26                         vil_image_view<dType>& dest_image,
27                         double x0, double y0, double dx1, double dy1,
28                         double dx2, double dy2, int n1, int n2);
29 
30 //: Resample image to a specified width (n1) and height (n2)
31 // \sa vil_resample_bicub
32 // \relatesalso vil_image_view
33 template <class sType, class dType>
34 void vil_resample_bilin(const vil_image_view<sType>& src_image,
35                         vil_image_view<dType>& dest_image,
36                         int n1, int n2);
37 
38 //: Sample grid of points in one image and place in another, using bilinear interpolation.
39 //  dest_image(i,j,p) is sampled from the src_image at
40 //  (x0+i.dx1+j.dx2,y0+i.dy1+j.dy2), where i=[0..n1-1], j=[0..n2-1]
41 //  dest_image resized to (n1,n2,src_image.nplanes())
42 //  Points outside image return the value of the nearest valid pixel.
43 // \relatesalso vil_image_view
44 template <class sType, class dType>
45 void vil_resample_bilin_edge_extend(const vil_image_view<sType>& src_image,
46                                     vil_image_view<dType>& dest_image,
47                                     double x0, double y0, double dx1, double dy1,
48                                     double dx2, double dy2, int n1, int n2);
49 
50 //: Resample image to a specified width (n1) and height (n2)
51 // \relatesalso vil_image_view
52 template <class sType, class dType>
53 void vil_resample_bilin_edge_extend(const vil_image_view<sType>& src_image,
54                                     vil_image_view<dType>& dest_image,
55                                     int n1, int n2);
56 
57 #endif // vil_resample_bilin_h_
58