2 #ifndef vil_sample_grid_bilin_hxx_ 3 #define vil_sample_grid_bilin_hxx_ 25 && y0+2 <= image.
nj();
33 template <
class imType,
class vecType>
36 double x0,
double y0,
double dx1,
double dy1,
37 double dx2,
double dy2,
int n1,
int n2)
43 y0+(n1-1)*dy1+(n2-1)*dy2,image);
45 const unsigned ni = image.
ni();
46 const unsigned nj = image.
nj();
47 const unsigned np = image.
nplanes();
48 const std::ptrdiff_t istep = image.
istep();
49 const std::ptrdiff_t jstep = image.
jstep();
50 const std::ptrdiff_t pstep = image.
planestep();
59 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
62 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2,++
v)
68 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
71 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2)
73 for (
unsigned p=0;p<np;++p,++
v)
84 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
87 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2,++
v)
93 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
96 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2)
98 for (
unsigned p=0;p<np;++p,++
v)
114 template <
class imType,
class vecType>
117 double x0,
double y0,
double dx1,
double dy1,
118 double dx2,
double dy2,
int n1,
int n2)
124 y0+(n1-1)*dy1+(n2-1)*dy2,image);
126 const unsigned ni = image.
ni();
127 const unsigned nj = image.
nj();
128 const unsigned np = image.
nplanes();
129 const std::ptrdiff_t istep = image.
istep();
130 const std::ptrdiff_t jstep = image.
jstep();
131 const std::ptrdiff_t pstep = image.
planestep();
140 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
143 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2,++
v)
149 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
152 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2)
154 for (
unsigned p=0;p<np;++p,++
v)
165 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
168 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2,++
v)
174 for (
int i=0;i<n1;++i,x1+=dx1,y1+=dy1)
177 for (
int j=0;j<n2;++j,x+=dx2,y+=dy2)
179 for (
unsigned p=0;p<np;++p,++
v)
187 #define VIL_SAMPLE_GRID_BILIN_INSTANTIATE( imType, vecType ) \ 188 template void vil_sample_grid_bilin(vecType* v, \ 189 const vil_image_view<imType >& image, \ 190 double x0, double y0, double dx1, double dy1, \ 191 double dx2, double dy2, int n1, int n2); \ 192 template void vil_sample_grid_bilin_edgena(vecType* v, \ 193 const vil_image_view<imType >& image, \ 194 double x0, double y0, double dx1, double dy1, \ 195 double dx2, double dy2, int n1, int n2) 197 #endif // vil_sample_grid_bilin_hxx_ An abstract base class of smart pointers to actual image data in memory.
Bilinear grid sampling function for 2D images.
double vil_bilin_interp(const vil_image_view< T > &view, double x, double y, unsigned p=0)
Compute bilinear interpolation at (x,y), with minimal bound checks.
Concrete view of image data of type T held in memory.
bool vil_grid_bilin_corner_in_image(double x0, double y0, const vil_image_view_base &image)
This function should not be the same in bicub and bilin.
void vil_sample_grid_bilin(vecType *v, const vil_image_view< imType > &image, double x0, double y0, double dx1, double dy1, double dx2, double dy2, int n1, int n2)
Sample grid from image, using bilinear interpolation.
double vil_bilin_interp_safe(const vil_image_view< T > &view, double x, double y, unsigned p=0)
Compute bilinear interpolation at (x,y), with bound checks.
double vil_bilin_interp_safe_edgena(const vil_image_view< T > &view, double x, double y, unsigned p=0)
Compute bilinear interpolation at (x,y), with bound checks.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
unsigned ni() const
Width.
unsigned nj() const
Height.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
void vil_sample_grid_bilin_edgena(vecType *v, const vil_image_view< imType > &image, double x0, double y0, double dx1, double dy1, double dx2, double dy2, int n1, int n2)
Sample grid from image, using bilinear interpolation.
unsigned nplanes() const
Number of planes.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.
Bilinear interpolation functions for 2D images.