27 #ifndef MLN_LINEAR_LOCAL_CONVOLVE_HH
28 # define MLN_LINEAR_LOCAL_CONVOLVE_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/site.hh>
36 # include <mln/core/concept/generalized_pixel.hh>
37 # include <mln/core/concept/weighted_window.hh>
38 # include <mln/metal/const.hh>
62 template <
typename I,
typename P,
typename W,
typename R>
65 const Weighted_Window<W>& w_win,
80 template <
typename P,
typename W,
typename R>
81 void convolve(
const Generalized_Pixel<P>&
p,
82 const Weighted_Window<W>& w_win,
86 # ifndef MLN_INCLUDE_ONLY
91 template <
typename I,
typename P,
typename W,
typename R>
93 void convolve(trait::image::speed::any,
102 mln_qiter(W) q(w_win, p);
103 for_all(q) if (input.has(q))
104 tmp += input(q) * q.w();
108 template <typename I, typename P, typename W, typename R>
110 void convolve(trait::image::speed::fastest,
116 const P& p =
exact(p_);
118 mln_precondition(input.border() >= w_win.delta());
122 mln_qixter(
const I, W) q(input, w_win, p);
124 tmp += w_win.w(i++) * q.val();
128 template <typename P, typename W, typename R>
130 void convolve(const Generalized_Pixel<P>& p_,
134 const P& p = mln::internal::force_exact<P>(p_);
135 mln_precondition(p.ima().border() >= w_win.delta());
141 mln_qixter(mlc_const(mln_image(P)), W) q(p, w_win);
143 tmp += w_win.w(i++) * q.val();
152 template <typename I, typename P, typename W, typename R>
154 void convolve(const Image<I>& input,
156 const Weighted_Window<W>& w_win,
159 mln_precondition(
exact(input).is_valid());
161 p,
exact(w_win), result);
164 template <
typename P,
typename W,
typename R>
166 void convolve(
const Generalized_Pixel<P>& p,
167 const Weighted_Window<W>& w_win,
173 # endif // ! MLN_INCLUDE_ONLY
182 #endif // ! MLN_LINEAR_LOCAL_CONVOLVE_HH