Classes | |
struct | gaussian_kernel |
struct | gaussian_kernel< 1 > |
Kernel of a 1D Gaussian. More... | |
struct | gaussian_kernel< 2 > |
Kernel of a 2D Gaussian. More... | |
struct | gaussian_kernel< 3 > |
Kernel of a 3D Gaussian. More... | |
Namespaces | |
namespace | internal |
Functions | |
template<class DestValue, class I, class Win> | |
mute< I, DestValue >::ret | convolve (const abstract::image< I > &input, const abstract::w_window< Win > &win) |
Perform a convolution of an image and a window. | |
template<class DestValue, class I, class J> | |
mute< I, DestValue >::ret | convolve (const abstract::non_vectorial_image< I > &input, const abstract::non_vectorial_image< J > &k) |
Perform a convolution of two images. | |
template<class DestValue, class I, class Info, class Win> | |
mute< I, DestValue >::ret | convolve (const abstract::image< I > &input, const mlc::array2d< Info, Win > &arr) |
Perform a convolution of an image and a window. | |
template<class I, class BE> | |
oln::mute< I >::ret | gaussian (const oln::abstract::non_vectorial_image< I > &in, const ntg::float_d sigma, const ntg::float_d radius_factor, const oln::abstract::behavior< BE > &behavior) |
template<class I> | |
oln::mute< I >::ret | gaussian (const oln::abstract::non_vectorial_image< I > &in, const ntg::float_d sigma, const ntg::float_d radius_factor) |
Gaussian filter, with default borders. |
mute<I, DestValue>::ret oln::convol::slow::convolve | ( | const abstract::image< I > & | input, | |
const mlc::array2d< Info, Win > & | arr | |||
) |
Perform a convolution of an image and a window.
DestValue | Data type of the output image you want. | |
I | Exact type of the input image. | |
Info | Informations about the array. | |
Win | Data type of the array. |
Definition at line 148 of file slow_convolution.hh.
00150 { 00151 return convolve<DestValue>(input, static_cast< w_window2d<Win> >(arr)); 00152 // FIXME: Should be abstract::w_window<T_arr>. Adjust #include once done. 00153 }
mute<I, DestValue>::ret oln::convol::slow::convolve | ( | const abstract::non_vectorial_image< I > & | input, | |
const abstract::non_vectorial_image< J > & | k | |||
) |
Perform a convolution of two images.
DestValue | Data type of the output image you want. | |
I | Exact type of the input image. | |
J | Exact type of the input image (convolution kernel). |
Definition at line 98 of file slow_convolution.hh.
References oln::abstract::image< Exact >::border_adapt_copy(), mlc::eq< i, j >::ensure(), and oln::abstract::image< Exact >::size().
00100 { 00101 mlc::eq<I::dim, J::dim>::ensure(); 00102 00103 typename mute<I, DestValue>::ret output(input.size()); 00104 00105 // Compute Delta. 00106 // \todo FIXME: should be in the image hierarchy. 00107 coord delta = 0; 00108 for (unsigned i = 0; i < J::dim; i++) 00109 if (k.size().nth(i) > delta) 00110 delta = k.size().nth(i); 00111 delta = (delta + 1) / 2; 00112 input.border_adapt_copy(delta); 00113 00114 // Computer center of the kernel. 00115 // \todo FIXME: should be in the image hierarchy. 00116 oln_point_type(I) center; 00117 for (unsigned i = 0; i < J::dim; i++) 00118 center.nth(i) = (k.size().nth(i) - 1) / 2; 00119 00120 oln_iter_type(I) p_im(input); 00121 oln_iter_type(J) p_k(k); 00122 for_all(p_im) 00123 { 00124 ntg::float_d sum = ntg_zero_val(ntg::float_d); 00125 for_all(p_k) 00126 sum += ntg::cast::bound<ntg::float_d>(k[p_k]) * 00127 ntg::cast::bound<ntg::float_d>(input[p_im - (center - p_k)]); 00128 output[p_im] = sum; 00129 } 00130 return output; 00131 }
mute<I, DestValue>::ret oln::convol::slow::convolve | ( | const abstract::image< I > & | input, | |
const abstract::w_window< Win > & | win | |||
) |
Perform a convolution of an image and a window.
DestValue | Data type of the output image you want. | |
I | Exact type of the input image. |
Definition at line 64 of file slow_convolution.hh.
References oln::abstract::image< Exact >::border_adapt_copy(), oln::abstract::struct_elt< Exact >::card(), oln::abstract::struct_elt< Exact >::delta(), oln::abstract::struct_elt< Exact >::dp(), mlc::eq< i, j >::ensure(), oln::abstract::image< Exact >::size(), and oln::abstract::w_window< Exact >::w().
00066 { 00067 mlc::eq<I::dim, Win::dim>::ensure(); 00068 00069 typename mute<I, DestValue>::ret output(input.size()); 00070 input.border_adapt_copy(win.delta()); 00071 oln_iter_type(I) p_im(input); 00072 for_all(p_im) 00073 { 00074 ntg::float_d sum = ntg_zero_val(ntg::float_d); 00075 for (unsigned i = 0; i < win.card(); ++i) 00076 sum += ntg::cast::bound<ntg::float_d>(win.w(i)) * 00077 ntg::cast::bound<ntg::float_d>(input[p_im - win.dp(i)]); 00078 output[p_im] = sum; 00079 } 00080 00081 return output; 00082 }
oln::mute< I >::ret oln::convol::slow::gaussian | ( | const oln::abstract::non_vectorial_image< I > & | in, | |
const ntg::float_d | sigma, | |||
const ntg::float_d | radius_factor, | |||
const oln::abstract::behavior< BE > & | behavior | |||
) |
Slow Gaussian filter.
#include <oln/basics2d.hh> #include <oln/convol/slow_gaussian.hh> #include <ntg/int.hh> using namespace oln; using namespace ntg; int main() { image2d<int_u8> lena(IMG_IN "lena.pgm"); float_d sigma = 2.5; lena = convol::slow::gaussian(lena, sigma, 3); save(lena, IMG_OUT "oln_convol_slow_gaussian.pgm"); }
Definition at line 83 of file slow_gaussian.hh.
Referenced by gaussian().
00087 { 00088 const typename gaussian_kernel<I::dim>::ret k 00089 = gaussian_kernel<I::dim>::kernel(sigma, radius_factor); 00090 00091 // Compute Delta. 00092 // \todo FIXME: should be in the image hierarchy. 00093 coord delta = 0; 00094 for (unsigned i = 0; i < I::dim; i++) 00095 if (in.size().nth(i) > delta) 00096 delta = in.size().nth(i); 00097 delta = (delta + 1) / 2; 00098 behavior.adapt_border(in, delta); 00099 00100 typename mute<I, ntg::float_d>::ret im = 00101 oln::convol::slow::convolve<ntg::float_d> (in, k); 00102 oln_concrete_type(I) out(in.size()); 00103 oln_iter_type(I) it(out); 00104 for_all(it) 00105 out[it] = oln_value_type(I)(im[it]); 00106 return out; 00107 }