00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef OLN_CONVOL_NAGAO_HH
00030 # define OLN_CONVOL_NAGAO_HH
00031
00032 # include <oln/utils/se_stat.hh>
00033 # include <oln/core/abstract/struct_elt.hh>
00034 # include <oln/core/abstract/image.hh>
00035 # include <oln/core/image.hh>
00036 # include <oln/core/abstract/image_with_type_with_dim.hh>
00037 # include <mlc/array/1d.hh>
00038 # include <mlc/cmp.hh>
00039
00040
00041 namespace oln {
00042 namespace convol{
00043 namespace internal {
00049 template <unsigned Size, class S>
00050 struct se_array
00051 {
00053 typedef mlc_exact_type(oln::abstract::struct_elt<S>) struct_elt_type;
00054
00056 typedef typename mlc::array1d<typename mlc::array1d_info<Size>,
00057 struct_elt_type > array_type;
00058
00060 enum {size = Size};
00061
00062 se_array():delta_(0){}
00063
00065 struct_elt_type&
00066 operator[](int i)
00067 {
00068 delta_ = -1;
00069 precondition(0 <= i < Size);
00070 return tab[i];
00071 }
00072
00074 struct_elt_type
00075 operator[](int i) const
00076 {
00077 precondition(0 <= i < Size);
00078 return tab[i];
00079 }
00080
00082 coord
00083 delta() const
00084 {
00085
00086 if (delta_ <= 0)
00087 {
00088 for (unsigned i = 0; i < Size; ++i)
00089 if (tab[i].delta() > delta_)
00090 delta_ = tab[i].delta();
00091 }
00092 postcondition (delta_ >= 0);
00093 return delta_;
00094 }
00095 protected:
00097 array_type tab;
00103 mutable coord delta_;
00104 };
00105
00121 template<class I, class SE, unsigned Size, typename Sum>
00122 inline Sum
00123 mean_of_smaller_variance(const oln::abstract::image<I> &im,
00124 const oln_point_type(I) &p,
00125 const internal::se_array<Size, SE> &w);
00126 }
00127
00138 template <class I, unsigned Size, typename SE, typename Sum>
00139 inline oln_concrete_type(I)
00140 nagao_generalized(const oln::abstract::image<I>& in,
00141 const internal::se_array<Size, SE> &sa);
00142
00143 template <class I>
00144 inline oln_concrete_type(I)
00145 nagao(const oln::abstract::non_vectorial_image_with_dim<2, I>& in);
00146
00147
00148 template <class I>
00149 inline oln_concrete_type(I)
00150 nagao(const oln::abstract::vectorial_image_with_dim<2, I>& in);
00151 }
00152
00153 }
00154
00155 #include "nagao.hxx"
00156
00157 #endif // OLENA_CONVOL_NAGAO_HH