2 #ifndef vil_resample_bicub_hxx_ 3 #define vil_resample_bicub_hxx_ 24 && y0+2 <= image.
nj();
33 template <
class sType,
class dType>
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,src_image);
45 const unsigned ni = src_image.
ni();
46 const unsigned nj = src_image.
nj();
47 const unsigned np = src_image.
nplanes();
48 const std::ptrdiff_t istep = src_image.
istep();
49 const std::ptrdiff_t jstep = src_image.
jstep();
50 const std::ptrdiff_t pstep = src_image.
planestep();
54 const std::ptrdiff_t d_istep = dest_image.
istep();
55 const std::ptrdiff_t d_jstep = dest_image.
jstep();
56 const std::ptrdiff_t d_pstep = dest_image.
planestep();
66 dType *row = d_plane0;
67 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
71 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
77 dType *row = d_plane0;
78 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
82 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
84 for (
unsigned int p=0;p<np;++p)
95 dType *row = d_plane0;
96 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
100 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
107 dType *row = d_plane0;
108 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
112 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
114 for (
unsigned int p=0;p<np;++p)
130 template <
class sType,
class dType>
133 double x0,
double y0,
double dx1,
double dy1,
134 double dx2,
double dy2,
int n1,
int n2)
140 y0+(n1-1)*dy1+(n2-1)*dy2,src_image);
142 const unsigned ni = src_image.
ni();
143 const unsigned nj = src_image.
nj();
144 const unsigned np = src_image.
nplanes();
145 const std::ptrdiff_t istep = src_image.
istep();
146 const std::ptrdiff_t jstep = src_image.
jstep();
147 const std::ptrdiff_t pstep = src_image.
planestep();
151 const std::ptrdiff_t d_istep = dest_image.
istep();
152 const std::ptrdiff_t d_jstep = dest_image.
jstep();
153 const std::ptrdiff_t d_pstep = dest_image.
planestep();
163 dType *row = d_plane0;
164 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
168 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
174 dType *row = d_plane0;
175 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
179 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
181 for (
unsigned int p=0;p<np;++p)
192 dType *row = d_plane0;
193 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
197 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
204 dType *row = d_plane0;
205 for (
int j=0;j<n2;++j,x1+=dx2,y1+=dy2,row+=d_jstep)
209 for (
int i=0;i<n1;++i,x+=dx1,y+=dy1,dpt+=d_istep)
211 for (
unsigned int p=0;p<np;++p)
222 template <
class sType,
class dType>
230 double dx1=f*(src_image.
ni()-1)*1.0/(n1-1);
233 double dy2=f*(src_image.
nj()-1)*1.0/(n2-1);
238 template <
class sType,
class dType>
246 double dx1=f*(src_image.
ni()-1)*1.0/(n1-1);
249 double dy2=f*(src_image.
nj()-1)*1.0/(n2-1);
253 #define VIL_RESAMPLE_BICUB_INSTANTIATE( sType, dType ) \ 254 template void vil_resample_bicub(const vil_image_view<sType >& src_image, \ 255 vil_image_view<dType >& dest_image, \ 256 double x0, double y0, double dx1, double dy1, \ 257 double dx2, double dy2, int n1, int n2); \ 258 template void vil_resample_bicub(const vil_image_view<sType >& src_image, \ 259 vil_image_view<dType >& dest_image, \ 261 template void vil_resample_bicub_edge_extend(const vil_image_view<sType >& src_image, \ 262 vil_image_view<dType >& dest_image, \ 263 double x0, double y0, double dx1, double dy1, \ 264 double dx2, double dy2, int n1, int n2); \ 265 template void vil_resample_bicub_edge_extend(const vil_image_view<sType >& src_image, \ 266 vil_image_view<dType >& dest_image, \ 269 #endif // vil_resample_bicub_hxx_ An abstract base class of smart pointers to actual image data in memory.
Concrete view of image data of type T held in memory.
void set_size(unsigned ni, unsigned nj) override
resize current planes to ni x nj.
Bicubic interpolation functions for 2D images.
Sample grid of points with bicubic interpolation in one image and place in another.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
unsigned ni() const
Width.
unsigned nj() const
Height.
void vil_resample_bicub_edge_extend(const vil_image_view< sType > &src_image, vil_image_view< dType > &dest_image, double x0, double y0, double dx1, double dy1, double dx2, double dy2, int n1, int n2)
Sample grid of points in one image and place in another, using bicubic interpolation.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
double vil_bicub_interp_raw(double x, double y, const T *data, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
Compute bicubic interpolation at (x,y), no bound checks.
void vil_resample_bicub(const vil_image_view< sType > &src_image, vil_image_view< dType > &dest_image, double x0, double y0, double dx1, double dy1, double dx2, double dy2, int n1, int n2)
Sample grid of points in one image and place in another, using bicubic interpolation.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
double vil_bicub_interp_safe(const vil_image_view< T > &view, double x, double y, unsigned p=0)
Compute bicubic interpolation at (x,y), with bound checks.
unsigned nplanes() const
Number of planes.
bool vil_resample_bicub_corner_in_image(double x0, double y0, const vil_image_view_base &image)
This function should not be the same in bicub and bilin.
double vil_bicub_interp_safe_extend(const vil_image_view< T > &view, double x, double y, unsigned p=0)
Compute bicubic interpolation at (x,y), with bound checks.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.