1 #ifndef vil_exp_filter_1d_h_ 2 #define vil_exp_filter_1d_h_ 14 template <
class srcT,
class destT,
class accumT>
16 destT* dest, std::ptrdiff_t dstep,
20 const srcT* src_end = src + n*sstep;
21 double f = (1-k)/(1+k);
28 *dest = destT(f * rt);
30 s+=sstep; dest+=dstep;
34 s-=sstep; dest-=dstep;
40 *dest += destT(f * rt);
43 s-=sstep; dest-=dstep;
51 template <
class srcT,
class destT,
class accumT>
56 unsigned ni = src_im.
ni();
57 unsigned nj = src_im.
nj();
59 std::ptrdiff_t s_istep = src_im.
istep(), s_jstep = src_im.
jstep();
60 std::ptrdiff_t d_istep = dest_im.
istep(),d_jstep = dest_im.
jstep();
62 for (
unsigned p=0;p<src_im.
nplanes();++p)
67 for (
unsigned j=0;j<nj;++j,src_row+=s_jstep,dest_row+=d_jstep)
76 template <
class srcT,
class destT,
class accumT>
81 unsigned ni = src_im.
ni();
82 unsigned nj = src_im.
nj();
84 std::ptrdiff_t s_istep = src_im.
istep(), s_jstep = src_im.
jstep();
85 std::ptrdiff_t d_istep = dest_im.
istep(),d_jstep = dest_im.
jstep();
87 for (
unsigned p=0;p<src_im.
nplanes();++p)
92 for (
unsigned i=0;i<ni;++i,src_col+=s_istep,dest_col+=d_istep)
97 #endif // vil_exp_filter_1d_h_ 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.
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.
void vil_exp_filter_1d(const srcT *src, std::ptrdiff_t sstep, destT *dest, std::ptrdiff_t dstep, int n, accumT k)
Apply exponential filter to 1D data.
A base class reference-counting view of some image data.
void vil_exp_filter_j(const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, accumT k)
Apply exponential filter along j to src_im to produce dest_im.
void vil_exp_filter_i(const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, accumT k)
Apply exponential filter along i to src_im to produce dest_im.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
unsigned nplanes() const
Number of planes.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.