Classes | |
struct | se_array |
Functions | |
template<class I, class SE, unsigned Size, typename Sum> | |
Sum | mean_of_smaller_variance (const oln::abstract::image< I > &im, const typename mlc::exact< I >::ret::point_type &p, const internal::se_array< Size, SE > &w) |
static se_array< 9, window2d > | mk_nagao_windows_5x5 () |
build 9 windows corresponding to the standard 5x5 Nagao filter. |
Sum oln::convol::internal::mean_of_smaller_variance | ( | const oln::abstract::image< I > & | im, | |
const typename mlc::exact< I >::ret::point_type & | p, | |||
const internal::se_array< Size, SE > & | w | |||
) | [inline] |
Return the mean of the windows that has the smallest variance.
I | Input image type. | |
SE | Structuring element type. | |
Size | Number of windows in the array. | |
Sum | Type use to add values of the input image. |
Definition at line 38 of file nagao.hxx.
References oln::abstract::image< Exact >::border(), and oln::convol::internal::se_array< Size, S >::delta().
00041 { 00042 ntg_compare_nb_comp(Sum, oln_value_type(I))::ensure(); 00043 00044 precondition(Size > 0); 00045 precondition(im.border() >= w.delta()); 00046 00047 typedef typename oln::utils::se_stat<Sum, ntg::float_s> se_stat_type; 00048 typedef typename se_stat_type::sum_type sum_type; 00049 typedef typename se_stat_type::variance_type variance_type; 00050 00051 se_stat_type s(im, p, w[0]); 00052 variance_type min_variance = s.variance(); 00053 sum_type mean = s.mean(); 00054 for (unsigned i = 1; i < Size; ++i) 00055 { 00056 variance_type tmp = s.compute(im, p, w[i]).variance(); 00057 if (tmp < min_variance) 00058 { 00059 min_variance = tmp; 00060 mean = s.mean(); 00061 } 00062 } 00063 return mean; 00064 }