Go to the documentation of this file.00001
00002 #ifndef vil_warp_h_
00003 #define vil_warp_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <vil/vil_fwd.h>
00018 #include <vcl_cassert.h>
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 template <class sType, class dType, class MapFunctor, class InterpFunctor>
00040 void vil_warp(const vil_image_view<sType>& in,
00041 vil_image_view<dType>& out,
00042 MapFunctor mapper,
00043 InterpFunctor interp)
00044 {
00045 unsigned const out_w = out.ni();
00046 unsigned const out_h = out.nj();
00047
00048 assert(out.nplanes() == in.nplanes());
00049
00050 for (unsigned p = 0; p < out.nplanes(); ++p)
00051 {
00052 for (unsigned oy = 0; oy < out_h; ++oy)
00053 {
00054 for (unsigned ox = 0; ox < out_w; ++ox)
00055 {
00056
00057 double ix, iy;
00058 mapper(double(ox), double(oy), ix, iy);
00059 out(ox, oy, p) = dType(interp(in, ix, iy, p));
00060 }
00061 }
00062 }
00063 }
00064
00065 #endif // vil_warp_h_