26 #ifndef MLN_LINEAR_LOCAL_CONVOLVE_HH
27 # define MLN_LINEAR_LOCAL_CONVOLVE_HH
33 # include <mln/core/concept/image.hh>
34 # include <mln/core/concept/site.hh>
35 # include <mln/core/concept/generalized_pixel.hh>
36 # include <mln/core/concept/weighted_window.hh>
37 # include <mln/metal/const.hh>
59 template <
typename I,
typename P,
typename W,
typename R>
62 const Weighted_Window<W>& w_win,
75 template <
typename P,
typename W,
typename R>
76 void convolve(
const Generalized_Pixel<P>& p,
77 const Weighted_Window<W>& w_win,
81 # ifndef MLN_INCLUDE_ONLY
86 template <
typename I,
typename P,
typename W,
typename R>
88 void convolve(trait::image::speed::any,
94 const P& p = exact(p_);
97 mln_qiter(W) q(w_win, p);
98 for_all(q) if (input.has(q))
99 tmp += input(q) * q.w();
103 template <typename I, typename P, typename W, typename R>
105 void convolve(trait::image::speed::fastest,
111 const P& p = exact(p_);
113 mln_precondition(input.border() >= w_win.delta());
117 mln_qixter(
const I, W) q(input, w_win, p);
119 tmp += w_win.w(i++) * q.val();
123 template <typename P, typename W, typename R>
125 void convolve(const Generalized_Pixel<P>& p_,
129 const P& p = mln::internal::force_exact<P>(p_);
130 mln_precondition(p.ima().border() >= w_win.delta());
136 mln_qixter(mlc_const(mln_image(P)), W) q(p, w_win);
138 tmp += w_win.w(i++) * q.val();
147 template <typename I, typename P, typename W, typename R>
149 void convolve(const
Image<I>& input,
154 mln_precondition(exact(input).is_valid());
155 impl::convolve(mln_trait_image_speed(I)(), exact(input),
156 p, exact(w_win), result);
159 template <
typename P,
typename W,
typename R>
165 impl::convolve(p, exact(w_win), result);
168 # endif // ! MLN_INCLUDE_ONLY
177 #endif // ! MLN_LINEAR_LOCAL_CONVOLVE_HH