Index: olena/ChangeLog from Niels Van Vliet niels@lrde.epita.fr * integre/ntg/real/behavior.hh: Change the unsafe::get<T>::check(). * integre/ntg/utils/cast.hh: Change cast::force(). * olena/oln/convert/value_to_point.hh: Fix value_to_point<bin>. * olena/oln/utils/histogram.hh: Fix hisogram<bin>. * olena/oln/morpho/fast_morpho.hxx: Histogram to abstract histogram.
* olena/oln/morpho/hit_or_miss.inc: Enable code in the doc. * olena/oln/morpho/top_hat.inc: Likewise. * olena/oln/morpho/opening.inc: Likewise. * olena/oln/morpho/dilation.hh: Likewise. * olena/oln/morpho/erosion.hh: Likewise. * olena/oln/morpho/dilation.hh: Likewise.
* olena/tests/morpho/tests/edoc: Add tests.
* olena/oln/morpho/attribute_closing_opening_map.hh: Rename images. * olena/oln/morpho/extrema.hxx: Add doc. * olena/oln/morpho/closing.inc: Remove fixme.
Index: olena/oln/morpho/closing.inc --- olena/oln/morpho/closing.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/44_closing.in 1.17 640) +++ olena/oln/morpho/closing.inc Thu, 18 Mar 2004 17:23:19 +0100 van-vl_n (oln/44_closing.in 1.17 640) @@ -56,9 +56,6 @@ ** \arg input Input image to close. ** \arg se Structuring element to use. ** -** \warning This code is the same for morpho and morpho::fast -** namespaces. -** ** \code ** #include <oln/basics2d.hh> ** #include <oln/morpho/closing.hh> @@ -69,7 +66,8 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); -** save(oln::morpho::closing(im1, oln::win_c8p()), IMG_OUT "oln_morpho_closing.pbm"); +** save(oln::morpho::closing(im1, oln::win_c8p()), +** IMG_OUT "oln_morpho_closing.pbm"); ** return 0; ** } ** \endcode Index: olena/oln/morpho/dilation.hh --- olena/oln/morpho/dilation.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/b/5_dilation.h 1.18 640) +++ olena/oln/morpho/dilation.hh Thu, 18 Mar 2004 17:23:08 +0100 van-vl_n (oln/b/5_dilation.h 1.18 640) @@ -76,8 +76,8 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); - ** save(oln::morpho::dilation(im1, oln::win_c8p()), IMG_OUT "oln_morpho_dilation.pbm"); - ** return 0; + ** save(oln::morpho::dilation(im1, oln::win_c8p()), + ** IMG_OUT "oln_morpho_dilation.pbm"); ** } ** \endcode ** @@ -124,8 +124,8 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); - ** save(oln::morpho::n_dilation(im1, oln::win_c8p(), 5), IMG_OUT "oln_morpho_n_dilation.pbm"); - ** return 0; + ** save(oln::morpho::n_dilation(im1, oln::win_c8p(), 5), + ** IMG_OUT "oln_morpho_n_dilation.pbm"); ** } ** \endcode ** @@ -158,7 +158,8 @@ dilation(const abstract::non_vectorial_image<I>& input, const abstract::struct_elt<E>& se) { - return fast_morpho<I, E, utils::histogram_max>(input, se); + return fast_morpho<I, E, utils::histogram_max<oln_value_type(I)> > + (input, se); } } } // end of morpho Index: olena/oln/morpho/erosion.hh --- olena/oln/morpho/erosion.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/b/4_erosion.hh 1.20 640) +++ olena/oln/morpho/erosion.hh Thu, 18 Mar 2004 17:22:50 +0100 van-vl_n (oln/b/4_erosion.hh 1.20 640) @@ -68,8 +68,8 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); - ** save(oln::morpho::erosion(im1, oln::win_c8p()), IMG_OUT "oln_morpho_erosion.pbm"); - ** return 0; + ** save(oln::morpho::erosion(im1, oln::win_c8p()), + ** IMG_OUT "oln_morpho_erosion.pbm"); ** } ** \endcode ** @@ -117,8 +117,8 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); - ** save(oln::morpho::n_erosion(im1, oln::win_c8p(), 5), IMG_OUT "oln_morpho_n_erosion.pbm"); - ** return 0; + ** save(oln::morpho::n_erosion(im1, oln::win_c8p(), 5), + ** IMG_OUT "oln_morpho_n_erosion.pbm"); ** } ** \endcode ** @@ -170,8 +170,8 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); - ** save(oln::morpho::erosion(im1, oln::win_c8p()), IMG_OUT "oln_morpho_fast_erosion.pbm"); - ** return 0; + ** save(oln::morpho::fast::erosion(im1, oln::win_c8p()), + ** IMG_OUT "oln_morpho_fast_erosion.pbm"); ** } ** \endcode ** @@ -180,16 +180,16 @@ ** => ** \image html oln_morpho_fast_erosion.png ** \image latex oln_morpho_fast_erosion.png - ** \todo FIXME: Correct this function and make the example use it. */ template<class I, class E> oln_concrete_type(I) erosion(const abstract::non_vectorial_image<I>& input, const abstract::struct_elt<E>& se) { - return fast_morpho<I, E, utils::histogram_min>(input, se); - } + return fast_morpho<I, E, utils::histogram_min<oln_value_type(I)> > + (input, se); } + } // end of fast
} // end of morpho
Index: olena/oln/morpho/extrema.hxx --- olena/oln/morpho/extrema.hxx Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/j/4_extrema.hx 1.16 640) +++ olena/oln/morpho/extrema.hxx Thu, 18 Mar 2004 17:22:12 +0100 van-vl_n (oln/j/4_extrema.hx 1.16 640) @@ -106,9 +106,10 @@ ** im_type light(oln::load(IMG_IN "lena.pgm")); ** bin_im_type minima(oln::load(IMG_IN "map.pbm")); ** -** oln::save(oln::morpho::sequential::minima_imposition(light, minima, oln::neighb_c4()), +** oln::save(oln::morpho::sequential::minima_imposition(light, +** minima, +** oln::neighb_c4()), ** IMG_OUT "oln_morpho_sequential_minima_imposition.pgm"); -** return 0; ** } ** \endcode ** \image html lena_pgm.png @@ -164,7 +165,6 @@ ** ** oln::save(oln::morpho::sequential::regional_minima(im, oln::neighb_c4()), ** IMG_OUT "oln_morpho_sequential_regional_minima.pgm"); -** return 0; ** } ** \endcode ** \image html lena_pgm.png Index: olena/oln/morpho/extrema_killer.hh --- olena/oln/morpho/extrema_killer.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/e/19_extrema_ki 1.7.1.4.1.13 640) +++ olena/oln/morpho/extrema_killer.hh Thu, 18 Mar 2004 16:53:10 +0100 van-vl_n (oln/e/19_extrema_ki 1.7.1.4.1.13 640) @@ -321,6 +321,8 @@ ** implementation is based on stak. Guichard and Morel, Image ** iterative smoothing and PDE's. Book in preparation. p 265. ** + ** \see oln::morpho::fast::card_closing + ** ** \param I Image exact type. ** \param N Neighborhood exact type. ** @@ -446,6 +448,8 @@ ** implementation is based on stak. Guichard and Morel, Image ** iterative smoothing and PDE's. Book in preparation. p 265. ** + ** \see oln::morpho::fast::card_opening. + ** ** \param I Image exact type. ** \param N Neighborhood exact type. ** Index: olena/oln/morpho/fast_morpho.hxx --- olena/oln/morpho/fast_morpho.hxx Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/45_fast_morph 1.21 640) +++ olena/oln/morpho/fast_morpho.hxx Thu, 18 Mar 2004 17:20:37 +0100 van-vl_n (oln/45_fast_morph 1.21 640) @@ -117,7 +117,7 @@ template<class I, class E1, class E2, class H> // inline void - hist_update(H& hist, + hist_update(utils::abstract::histogram<H>& hist, const abstract::non_vectorial_image<I>& input, const oln_point_type(I)& p, const abstract::struct_elt<E1>& se_rem, @@ -284,6 +284,8 @@ /*! ** \brief Fast morpho algorithm. ** + ** \todo FIXME: This algorithm should be moved to the + ** namespace oln::morpho::fast. ** ** \code ** #include <oln/basics2d.hh> @@ -295,21 +297,21 @@ ** typedef oln::image2dntg::bin im_type; ** ** im_type im1(oln::load(IMG_IN "object.pbm")); - ** //save(oln::morpho::fast_morpho<im_type, oln::win_c8p(), utils::histogram_min> - ** // (im1, oln::win_c8p()), IMG_OUT "oln_morpho_fast_morpho.pbm"); - ** save(im1, IMG_OUT "oln_morpho_fast_morpho.pbm"); - ** return 0; + ** save(oln::morpho::fast_morpho<im_type, oln::window2d, + ** oln::utils::histogram_minntg::bin > + ** (im1, oln::win_c8p()), + ** IMG_OUT "oln_morpho_fast_morpho.pbm"); ** } ** \endcode - ** ** \image html object_pbm.png ** \image latex object_pbm.png ** => ** \image html oln_morpho_fast_morpho.png ** \image latex oln_morpho_fast_morpho.png - ** \todo FIXME: Correct this function and make the example use it. + ** + ** \todo FIXME: add tests. */ - template<class I, class E, template<typename, typename> class H> + template<class I, class E, class H> oln_concrete_type(I) fast_morpho(const abstract::non_vectorial_image<I>& input, const abstract::struct_elt<E>& se) @@ -350,7 +352,7 @@ const typename I::size_type size = input.size();
// Initialize the histogram with the values around the first point. - H<oln_value_type(I),unsigned> hist; + H hist; oln_point_type(I) p;
// oln_iter_type(E) dp(se); @@ -364,7 +366,7 @@ output[p] = hist.res(); // First point.
internal::fast_morpho_inner<1, E::dim, const I, - const typename I::size_type, H<oln_value_type(I),unsigned>, + const typename I::size_type, H, const E,oln_point_type(I),oln_concrete_type(I)>::doit(input.exact(), size, hist, se_add, se_rem, se_add_back, se_rem_back, Index: olena/oln/morpho/hit_or_miss.inc --- olena/oln/morpho/hit_or_miss.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/42_hit_or_mis 1.22 640) +++ olena/oln/morpho/hit_or_miss.inc Thu, 18 Mar 2004 17:18:51 +0100 van-vl_n (oln/42_hit_or_mis 1.22 640) @@ -64,9 +64,9 @@ ** .add(-1,0); ** oln::window2d mywin2 = - mywin; ** -** oln::save(oln::morpho::hit_or_miss(oln::convert::boundntg::int_u8(), im1, mywin, mywin2), +** oln::save(oln::morpho::fast::hit_or_miss +** (oln::convert::boundntg::int_u8(), im1, mywin, mywin2), ** IMG_OUT "oln_morpho_fast_hit_or_miss.pbm"); -** return 0; ** } ** \endcode ** @@ -76,7 +76,6 @@ ** \image html oln_morpho_fast_hit_or_miss.png ** \image latex oln_morpho_fast_hit_or_miss.png ** -** \todo FIXME: Histogram problems (fast version do not work). */ template<class C, class B, class I, class E1, class E2> typename mute<I, typename convoutput<C, B,oln_value_type(I)>::ret>::ret @@ -128,9 +127,8 @@ ** .add(-1,0); ** oln::window2d mywin2 = - mywin; ** -** oln::save(oln::morpho::hit_or_miss(im1, mywin, mywin2), +** oln::save(oln::morpho::fast::hit_or_miss(im1, mywin, mywin2), ** IMG_OUT "oln_morpho_fast_hit_or_miss_overload.pbm"); -** return 0; ** } ** \endcode ** @@ -140,7 +138,6 @@ ** \image html oln_morpho_fast_hit_or_miss_overload.png ** \image latex oln_morpho_fast_hit_or_miss_overload.png ** -** \todo FIXME: Histogram problems (fast version do not work). */ template<class I, class E1, class E2> oln_concrete_type(I) @@ -194,9 +191,8 @@ ** .add(-1,0); ** oln::window2d mywin2 = - mywin; ** -** oln::save(oln::morpho::hit_or_miss_opening(im1, mywin, mywin2), +** oln::save(oln::morpho::fast::hit_or_miss_opening(im1, mywin, mywin2), ** IMG_OUT "oln_morpho_fast_hit_or_miss_opening.pbm"); -** return 0; ** } ** \endcode ** @@ -206,7 +202,6 @@ ** \image html oln_morpho_fast_hit_or_miss_opening.png ** \image latex oln_morpho_fast_hit_or_miss_opening.png ** -** \todo FIXME: Histogram problems (fast version do not work). */ template<class I, class E1, class E2> oln_concrete_type(I) @@ -256,9 +251,8 @@ ** .add(-1,0); ** oln::window2d mywin2 = - mywin; ** -** oln::save(oln::morpho::hit_or_miss_opening_bg(im1, mywin, mywin2), +** oln::save(oln::morpho::fast::hit_or_miss_opening_bg(im1, mywin, mywin2), ** IMG_OUT "oln_morpho_fast_hit_or_miss_opening_bg.pbm"); -** return 0; ** } ** \endcode ** @@ -268,7 +262,6 @@ ** \image html oln_morpho_fast_hit_or_miss_opening_bg.png ** \image latex oln_morpho_fast_hit_or_miss_opening_bg.png ** -** \todo FIXME: Histogram problems (fast version do not work). */ template<class I, class E1, class E2> oln_concrete_type(I) @@ -324,9 +317,8 @@ ** .add(-1,0); ** oln::window2d mywin2 = - mywin; ** -** oln::save(oln::morpho::hit_or_miss_closing(im1, mywin, mywin2), +** oln::save(oln::morpho::fast::hit_or_miss_closing(im1, mywin, mywin2), ** IMG_OUT "oln_morpho_fast_hit_or_miss_closing.pbm"); -** return 0; ** } ** \endcode ** @@ -336,7 +328,6 @@ ** \image html oln_morpho_fast_hit_or_miss_closing.png ** \image latex oln_morpho_fast_hit_or_miss_closing.png ** -** \todo FIXME: Histogram problems (fast version do not work). */ template<class I, class E1, class E2> oln_concrete_type(I) @@ -389,9 +380,8 @@ ** .add(-1,0); ** oln::window2d mywin2 = - mywin; ** -** oln::save(oln::morpho::hit_or_miss_closing_bg(im1, mywin, mywin2), +** oln::save(oln::morpho::fast::hit_or_miss_closing_bg(im1, mywin, mywin2), ** IMG_OUT "oln_morpho_fast_hit_or_miss_closing_bg.pbm"); -** return 0; ** } ** \endcode ** @@ -401,7 +391,6 @@ ** \image html oln_morpho_fast_hit_or_miss_closing_bg.png ** \image latex oln_morpho_fast_hit_or_miss_closing_bg.png ** -** \todo FIXME: Histogram problems (fast version do not work). */ template<class I, class E1, class E2> oln_concrete_type(I) Index: olena/oln/morpho/opening.inc --- olena/oln/morpho/opening.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/40_opening.in 1.15 640) +++ olena/oln/morpho/opening.inc Thu, 18 Mar 2004 16:47:27 +0100 van-vl_n (oln/40_opening.in 1.15 640) @@ -49,9 +49,8 @@ ** ** im_type im(oln::load(IMG_IN "object.pbm")); ** -** oln::save(oln::morpho::opening(im, oln::win_c8p()), +** oln::save(oln::morpho::fast::opening(im, oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_opening.pbm"); -** return 0; ** } ** \endcode ** @@ -61,7 +60,6 @@ ** \image html oln_morpho_fast_opening.png ** \image latex oln_morpho_fast_opening.png ** -** \todo FIXME: Histogram problems (fast version do not compile). */ template<class I, class E> oln_concrete_type(I) Index: olena/oln/morpho/top_hat.inc --- olena/oln/morpho/top_hat.inc Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/39_top_hat.in 1.15 640) +++ olena/oln/morpho/top_hat.inc Thu, 18 Mar 2004 17:46:14 +0100 van-vl_n (oln/39_top_hat.in 1.15 640) @@ -48,11 +48,11 @@ ** ** im_type im1(oln::load(IMG_IN "lena256.pgm")); ** -** oln::save(oln::morpho::fast::white_top_hat(oln::convert::boundntg::int_u8(), +** oln::save(oln::morpho::fast::white_top_hat +** (oln::convert::boundntg::int_u8(), ** im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_white_top_hat.pbm"); -** return 0; ** } ** \endcode ** @@ -94,7 +94,6 @@ ** oln::save(oln::morpho::fast::white_top_hat(im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_white_top_hat_overload.pbm"); -** return 0; ** } ** \endcode ** @@ -136,11 +135,11 @@ ** ** im_type im1(oln::load(IMG_IN "lena256.pgm")); ** -** oln::save(oln::morpho::fast::black_top_hat(oln::convert::boundntg::int_u8(), +** oln::save(oln::morpho::fast::black_top_hat +** (oln::convert::boundntg::int_u8(), ** im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_black_top_hat.pbm"); -** return 0; ** } ** \endcode ** @@ -183,7 +182,6 @@ ** oln::save(oln::morpho::fast::black_top_hat(im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_black_top_hat_overload.pbm"); -** return 0; ** } ** \endcode ** @@ -229,11 +227,11 @@ ** ** im_type im1(oln::load(IMG_IN "lena256.pgm")); ** -** oln::save(oln::morpho::fast::self_complementary_top_hat(oln::convert::boundntg::int_u8(), +** oln::save(oln::morpho::fast::self_complementary_top_hat +** (oln::convert::boundntg::int_u8(), ** im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_self_complementary_top_hat.pbm"); -** return 0; ** } ** \endcode ** @@ -274,7 +272,6 @@ ** oln::save(oln::morpho::fast::self_complementary_top_hat(im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_self_complementary_top_hat_overload.pbm"); -** return 0; ** } ** \endcode ** @@ -318,11 +315,11 @@ ** ** im_type im1(oln::load(IMG_IN "lena256.pgm")); ** -** oln::save(oln::morpho::fast::top_hat_contrast_op(oln::convert::boundntg::int_u8(), +** oln::save(oln::morpho::fast::top_hat_contrast_op +** (oln::convert::boundntg::int_u8(), ** im1, ** oln::win_c8p()), ** IMG_OUT "oln_morpho_fast_top_hat_contrast_op.pbm"); -** return 0; ** } ** \endcode ** @@ -366,11 +363,9 @@ ** ** im_type im1(oln::load(IMG_IN "lena256.pgm")); ** -** //oln::save(oln::morpho::fast::top_hat_contrast_op(im1, -** // oln::win_c8p()), -** // IMG_OUT "oln_morpho_fast_top_hat_contrast_op_overload.pbm"); -** oln::save(im1, IMG_OUT "oln_morpho_fast_top_hat_contrast_op_overload.pbm"); -** return 0; +** oln::save(oln::morpho::fast::top_hat_contrast_op(im1, +** oln::win_c8p()), +** IMG_OUT "oln_morpho_fast_top_hat_contrast_op_overload.pbm"); ** } ** \endcode ** Index: integre/ntg/real/behavior.hh --- integre/ntg/real/behavior.hh Thu, 27 Nov 2003 11:26:27 +0100 burrus_n (oln/g/31_behaviour. 1.13.1.15.1.1 640) +++ integre/ntg/real/behavior.hh Thu, 18 Mar 2004 16:08:00 +0100 van-vl_n (oln/g/31_behaviour. 1.13.1.15.1.1 640) @@ -1,4 +1,4 @@ -// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -107,7 +107,7 @@ template <class P> static storage_type check (const P& p) - { return p; } + { return storage_type(p); } };
static std::string Index: integre/ntg/utils/cast.hh --- integre/ntg/utils/cast.hh Wed, 28 Jan 2004 16:28:44 +0100 palma_g (oln/i/26_cast.hh 1.3.1.12 640) +++ integre/ntg/utils/cast.hh Thu, 18 Mar 2004 16:13:26 +0100 van-vl_n (oln/i/26_cast.hh 1.3.1.12 640) @@ -1,4 +1,4 @@ -// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -77,7 +77,7 @@ const Tdest force(const Tsrc& val) { - return (Tdest)val; + return ntg_unsafe_type(Tdest)(val); }
/*------. Index: olena/oln/utils/histogram.hh --- olena/oln/utils/histogram.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/10_histogram. 1.6.1.14.1.9 640) +++ olena/oln/utils/histogram.hh Wed, 17 Mar 2004 18:24:55 +0100 van-vl_n (oln/10_histogram. 1.6.1.14.1.9 640) @@ -30,14 +30,22 @@
# include <oln/core/image1d.hh> + # include <oln/core/image3d.hh>
# include <oln/convert/value_to_point.hh>
# include <oln/core/abstract/image.hh>
+# include <ntg/core/pred_succ.hh> + # include <vector>
+/// Return the underlying counter type of \a H. +# define oln_cpt_type(H) mlc_exact_type(H)::cpt_type +/// Return the underlying counter type of \a H. +# define oln_cpt_type_(H) mlc_exact_type_(H)::cpt_type + namespace oln { /// \brief Utilities, such as statistics. namespace utils { @@ -49,7 +57,8 @@ struct img_max_size { private: - typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type; + typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type + ensure_type; public: typedef image1d_size size_type; typedef T comp_type; @@ -83,22 +92,29 @@ }; } // end of namespace internal
+ /// Traits for oln::utils::abstract::histogram hierarchy. + template <class Exact> + struct hist_traits + { + }; + + /// \brief Abstract utilities. namespace abstract { - /*! Abstract base class for historgram. + /*! Abstract base class for histogram. ** ** \see oln::histogram */ - template<class T, - typename CPT, - class Exact = mlc::final> + template<class Exact = mlc::final> class histogram: public mlc_hierarchy::any<Exact> { public: - typedef histogram<T, CPT, Exact> self_type; - typedef Exact exact_type; - typedef CPT cpt_type; + typedef typename mlc::exact_vt<histogram<Exact>, + Exact>::ret exact_type; + typedef typename hist_traits<exact_type>::cpt_type cpt_type; + typedef typename hist_traits<exact_type>::value_type value_type; + /// Put the number of occurrence of every value to zero. void clear() @@ -106,14 +122,14 @@ this->exact().clear_impl(); } /// Read the number of occurrence of \a v. - const CPT& - operator[](const T &v)const + const cpt_type& + operator[](const value_type &v)const { return this->exact().at(v); } /// Read or write the number of occurrence of \a v. - CPT& - operator[](const T &v) + cpt_type& + operator[](const value_type &v) { return this->exact().at(v); } @@ -130,6 +146,30 @@ }; } // end of namespace abstract
+ template<typename T, + typename CPT = unsigned, + class V2P = oln::convert::value_to_point<T>, + class Exact = mlc::final> + class histogram; + + /// Traits for oln::utils::abstract::histogram hierarchy. + template <typename T, + typename CPT, + class V2P, + class Exact> + struct hist_traits<histogram<T, CPT, V2P, Exact> > + { + typedef CPT cpt_type; ///< Counter type + typedef T value_type; ///< Value of the input image + typedef V2P value_to_point_type; ///< Class that convert a value to + /// a point + typedef typename value_to_point_type::result_type point_type; + ///< Point type of the internal image. + enum {dim = point_type::dim}; ///< Dimension of the histogram. + typedef typename dim_traits<dim, CPT>::img_type img_type; + ///< Type of the internal image. + }; + /*! Histogram. ** ** This histogram uses an image of unsigned to store the value. @@ -168,26 +208,30 @@ ** \endcode */ template<typename T, - typename CPT = unsigned, - class V2P = oln::convert::value_to_point<T>, - class Exact = mlc::final> + typename CPT, + class V2P, + class Exact> class histogram: public abstract::histogram - <T, CPT, typename mlc::exact_vt<histogram<T, CPT, V2P, Exact>, Exact>::ret> + <typename mlc::exact_vt<histogram<T, CPT, V2P, Exact>, Exact>::ret> { public: - typedef histogram<T, CPT, V2P, Exact> self_type; - typedef Exact exact_type; - typedef T input_type; - typedef V2P value_to_point_type; - typedef CPT cpt_type; - typedef typename value_to_point_type::result_type point_type; - enum {dim = value_to_point_type::result_type::dim}; - typedef abstract::histogram<T, CPT, self_type> upper_type; - typedef typename dim_traits<dim, CPT>::img_type img_type; + typedef typename mlc::exact_vt<histogram<T, CPT, V2P, Exact>, + Exact>::ret exact_type; + typedef typename hist_traits<exact_type>::value_type value_type; + typedef typename hist_traits<exact_type>::cpt_type cpt_type; + typedef typename hist_traits<exact_type>::value_to_point_type + value_to_point_type; + typedef typename hist_traits<exact_type>::point_type point_type; + enum {dim = hist_traits<exact_type>::dim}; + typedef typename hist_traits<exact_type>::img_type img_type;
- /// Empty histogram. The function Init(image) should be used after this constructor. + /*! \brief Empty histogram. + ** + ** \note The function Init(image) should be used after this + ** constructor. + */ histogram(const value_to_point_type & c2p = value_to_point_type()): - v2p_(c2p), img_(internal::img_max_size<input_type>()()) + v2p_(c2p), img_(internal::img_max_size<value_type>()()) { clear(); } @@ -196,7 +240,7 @@ template <class I> histogram(const oln::abstract::image<I> & input, const value_to_point_type & v2p = value_to_point_type()): - v2p_(v2p), img_(internal::img_max_size<input_type>()()) + v2p_(v2p), img_(internal::img_max_size<value_type>()()) { clear(); init(input); @@ -208,18 +252,18 @@ { typename img_type::iter_type it(img_ ); for_all(it) - img_[it] = ntg_zero_val(CPT); + img_[it] = ntg_zero_val(cpt_type); }
/// operator[] should be called. - const CPT& + const cpt_type& at(const T &v)const { return img_[v2p_(v)]; } /// operator[] should be called. - CPT& - at(const T &v) + cpt_type& + at(const value_type &v) { return img_[v2p_(v)]; } @@ -248,49 +292,68 @@
/*! Minimum value of an histogram. ** - ** It return the smaller value within the image used to build the histogram. - ** - ** \warning If there is no min an assertion will fail at the end of the loop. + ** It return the smaller value within the image used to build the + ** histogram. ** - ** \note It can be slow when the histogram is sparse because it iterate over a - ** large range of 0. Use histogram_min or histogram_minmax instead. + ** \note It can be slow when the histogram is sparse because it iterate + ** over a large range of 0. Use \a histogram_min or \a histogram_minmax + ** instead. ** \see histogram_min */ - template< typename T, typename CPT, class Exact> - inline T - min(const abstract::histogram<T, CPT, Exact>& hist) - { - typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type; - - T i; - for (i = ntg_min_val(T); i <= ntg_max_val(T); ++i) - if (hist[i] > ntg_zero_val(CPT)) + template<class T> + inline oln_value_type(T) + min(const abstract::histogram<T>& hist) + { + typedef typename ntg_is_a(oln_value_type(T), + ntg::non_vectorial)::ensure_type ensure_type; + + oln_value_type(T) i; + for (i = ntg_min_val(oln_value_type(T)); + i != ntg_max_val(oln_value_type(T)); + i = ntg::succ(i)) + if (hist[i] > ntg_zero_val(oln_cpt_type(T))) break; return i; } /*! Maximum value of an histogram. ** - ** It return the higher value within the image used to build the histogram. + ** It return the higher value within the image used to build the + ** histogram. ** - ** \warning If there is no min an assertion will fail at the end of the loop. - ** - ** \note It can be slow when the histogram is sparse because it iterate over a - ** large range of 0. Use histogram_max or histogram_minmax instead. + ** \note It can be slow when the histogram is sparse because it + ** iterate over a large range of 0. Use histogram_max or + ** histogram_minmax instead. ** \see histogram_max */ - template< typename T, typename CPT, class Exact> - inline T - max(const abstract::histogram<T, CPT, Exact>& hist) - { - typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type; - - T i; - for (i = ntg_max_val(T); i >= ntg_min_val(T); --i) - if (hist[i] > ntg_zero_val(CPT)) + template<class T> + inline oln_value_type(T) + max(const abstract::histogram<T>& hist) + { + typedef typename ntg_is_a(oln_value_type(T), + ntg::non_vectorial)::ensure_type ensure_type; + + oln_value_type(T) i; + for (i = ntg_max_val(oln_value_type(T)); + i != ntg_min_val(oln_value_type(T)); + i = ntg::pred(i)) + if (hist[i] > ntg_zero_val(oln_cpt_type(T))) break; return i; }
+ template< typename T, + typename CPT = unsigned, + class V2P = convert::value_to_point<T>, + class Exact = mlc::final> + class histogram_minmax; + + template <typename T, + typename CPT, + class V2P, + class Exact> + struct hist_traits<histogram_minmax<T, CPT, V2P, Exact> > + : public hist_traits<histogram<T, CPT, V2P, Exact> > + {}; /*! Build the histogram and has quick min and max functions. ** ** The idea behind the min- and max-specialized histogram is to @@ -307,217 +370,269 @@ ** \see histogram_max */ template< typename T, - typename CPT = unsigned, - class V2P = convert::value_to_point<T>, - class Exact = mlc::final> + typename CPT, + class V2P, + class Exact> class histogram_minmax : public histogram <T, CPT, V2P, - typename mlc::exact_vt<histogram_minmax<T, CPT, V2P, Exact>, Exact>::ret> + typename mlc::exact_vt<histogram_minmax<T, CPT, V2P, Exact>, + Exact>::ret> { private: - typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type; - protected: - /// Maintain the worst min and max. - void - adjust(const T &idx) - { - if (idx > max_) - max_ = idx; - if (idx < min_) - min_ = idx; - } + typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type + ensure_type; public: - typedef histogram_minmax<T, CPT, V2P, Exact> self_type; - typedef Exact exact_type; - typedef histogram<T, CPT, V2P, histogram_minmax<T, CPT, V2P, Exact> > upper_type; - typedef V2P value_to_point_type; + typedef typename mlc::exact_vt<histogram_minmax<T, CPT, V2P, Exact>, + Exact>::ret exact_type; + typedef typename hist_traits<exact_type>::value_type value_type; + typedef typename hist_traits<exact_type>::cpt_type cpt_type; + typedef typename hist_traits<exact_type>::value_to_point_type + value_to_point_type; + typedef typename hist_traits<exact_type>::point_type point_type; + enum {dim = hist_traits<exact_type>::dim}; + typedef typename hist_traits<exact_type>::img_type img_type; + typedef histogram<T, CPT, V2P, exact_type> upper_type;
histogram_minmax(const value_to_point_type & v2p = value_to_point_type()) : upper_type(v2p), - min_(ntg_min_val(T)), max_(ntg_max_val(T)) {} + min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
template <class I> histogram_minmax(const oln::abstract::image<I> & input, const value_to_point_type & v2p = value_to_point_type()) : upper_type(input, v2p), - min_(ntg_min_val(T)), max_(ntg_max_val(T)) {} + min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
/// operator[] should be called. - const CPT& - at(const T& i) const + const cpt_type& + at(const value_type& i) const { adjust(i); return img_[v2p_(i)]; }
/// operator[] should be called. - CPT& - at(const T& i) + cpt_type& + at(const value_type& i) { adjust(i); return img_[v2p_(i)]; }
/// Quick function min. - T + value_type min() { - for (; min_ <= ntg_max_val(T); ++min_) - if (img_[v2p_(min_)] > ntg_zero_val(CPT)) + for (; min_ != ntg_max_val(value_type); min_ = ntg::succ(min_)) + if (img_[v2p_(min_)] > ntg_zero_val(cpt_type)) break; return min_; } /// Quick function max. - T + value_type max() { - for (; max_ > 0; --max_) - if (img_[v2p_(max_)] > ntg_zero_val(CPT)) + for (; max_ != ntg_min_val(value_type); max_ = ntg::pred(max_)) + if (img_[v2p_(max_)] > ntg_zero_val(cpt_type)) break; return max_; }
protected: - T min_, max_; ///< Indices of min and max elements. + /// Maintain the worst min and max. + void + adjust(const value_type &idx) + { + if (idx > max_) + max_ = idx; + if (idx < min_) + min_ = idx; + } + value_type min_, max_; ///< Indices of min and max elements. }; + + + template< typename T, + typename CPT = unsigned, + class V2P = convert::value_to_point<T>, + class Exact = mlc::final> + class histogram_min; + + template <typename T, + typename CPT, + class V2P, + class Exact> + struct hist_traits<histogram_min<T, CPT, V2P, Exact> > + : public hist_traits<histogram<T, CPT, V2P, Exact> > + {}; + /*! Build the histogram and has quick min function. ** ** \see histogram_minmax */ template< typename T, - typename CPT = unsigned, - class V2P = convert::value_to_point<T>, - class Exact = mlc::final> + typename CPT, + class V2P, + class Exact> class histogram_min : public histogram<T, CPT, V2P, typename mlc::exact_vt<histogram_min<T, CPT, V2P, Exact>, Exact>::ret> { private: - typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type ensure_type; - protected: - /// Maintain the worst min. - void - adjust(const T& idx) - { - if (idx < min_) - min_ = idx; - } - public: - typedef histogram_min<T, CPT, V2P, Exact> self_type; - typedef Exact exact_type; - typedef V2P value_to_point_type; - typedef histogram<T, CPT, V2P, histogram_min<T, CPT, V2P, Exact>
upper_type;
+ typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type + ensure_type;
+ public: + typedef typename mlc::exact_vt<histogram_min<T, CPT, V2P, Exact>, + Exact>::ret exact_type; + typedef typename hist_traits<exact_type>::value_type value_type; + typedef typename hist_traits<exact_type>::cpt_type cpt_type; + typedef typename hist_traits<exact_type>::value_to_point_type + value_to_point_type; + typedef typename hist_traits<exact_type>::point_type point_type; + enum {dim = hist_traits<exact_type>::dim}; + typedef typename hist_traits<exact_type>::img_type img_type; + typedef histogram<T, CPT, V2P, exact_type> upper_type;
histogram_min(const value_to_point_type & v2p = value_to_point_type()) : - upper_type(v2p), min_(ntg_min_val(T)) {} + upper_type(v2p), min_(ntg_min_val(value_type)) {}
template <class I> histogram_min(const oln::abstract::image<I> & input, const value_to_point_type & v2p = value_to_point_type()) : - upper_type(input, v2p), min_(ntg_min_val(T)) {} + upper_type(input, v2p), min_(ntg_min_val(value_type)) {}
/// operator[] should be called. - const CPT& - at(const T& i) const + const cpt_type& + at(const value_type& i) const { return img_[v2p_(i)]; }
/// operator[] should be called. - CPT& - at(const T& i) + cpt_type& + at(const value_type& i) { adjust(i); return img_[v2p_(i)]; } /// Quick function min. - T + value_type min() { - for (; min_ <= ntg_max_val(T); ++min_) - if (img_[v2p_(min_)] > ntg_zero_val(CPT)) + for (; min_ != ntg_max_val(value_type); min_ = succ(min_)) + if (img_[v2p_(min_)] > ntg_zero_val(cpt_type)) break; return min_; } /// Return the min. - T + value_type res() { return min(); }
protected: - T min_; ///< Index of the worst min element. + /// Maintain the worst min. + void + adjust(const value_type& idx) + { + if (idx < min_) + min_ = idx; + } + value_type min_; ///< Index of the worst min element. };
+ template< typename T, + typename CPT = unsigned, + class V2P = convert::value_to_point<T>, + class Exact = mlc::final> + class histogram_max; + + template <typename T, + typename CPT, + class V2P, + class Exact> + struct hist_traits<histogram_max<T, CPT, V2P, Exact> > + : public hist_traits<histogram<T, CPT, V2P, Exact> > + {}; + /*! Build the histogram and has quick max function. ** ** \see histogram_minmax */ template< typename T, - typename CPT = unsigned, - class V2P = convert::value_to_point<T> , - class Exact = mlc::final> + typename CPT, + class V2P, + class Exact> class histogram_max : public histogram<T, CPT, V2P, typename mlc::exact_vt<histogram_max<T, CPT, V2P, Exact>, Exact>::ret> { - protected: - /// Maintain the worst max. - void - adjust(const T& idx) - { - if (idx > max_) - max_ = idx; - } + private: + typedef typename ntg_is_a(T, ntg::non_vectorial)::ensure_type + ensure_type;
public: - typedef histogram_max<T, CPT, V2P, Exact> self_type; - typedef Exact exact_type; - typedef V2P value_to_point_type; - typedef histogram<T, CPT, V2P, histogram_max<T, CPT, V2P, Exact>
upper_type;
+ typedef typename mlc::exact_vt<histogram_max<T, CPT, V2P, Exact>, + Exact>::ret exact_type; + typedef typename hist_traits<exact_type>::value_type value_type; + typedef typename hist_traits<exact_type>::cpt_type cpt_type; + typedef typename hist_traits<exact_type>::value_to_point_type + value_to_point_type; + typedef typename hist_traits<exact_type>::point_type point_type; + enum {dim = hist_traits<exact_type>::dim}; + typedef typename hist_traits<exact_type>::img_type img_type; + typedef histogram<T, CPT, V2P, exact_type> upper_type;
histogram_max(const value_to_point_type & v2p = value_to_point_type()) : - upper_type(v2p),max_(ntg_max_val(T)) {} + upper_type(v2p),max_(ntg_max_val(value_type)) {}
template <class I> histogram_max(const oln::abstract::image<I> & input, const value_to_point_type & v2p = value_to_point_type()) : - upper_type(input, v2p),max_(ntg_max_val(T)) {} + upper_type(input, v2p),max_(ntg_max_val(value_type)) {}
/// operator[] should be called. - const CPT& - at(const T& i) const + const cpt_type& + at(const value_type& i) const { return img_[v2p_(i)]; }
/// operator[] should be called. - CPT& - at(const T& i) + cpt_type& + at(const value_type& i) { adjust(i); return img_[v2p_(i)]; } /// Quick function max. - T + value_type max() { - for (; max_ > 0; --max_) - if (img_[v2p_(max_)] > ntg_zero_val(CPT)) + for (; max_ != ntg_min_val(value_type); max_ = ntg::pred(max_)) + if (img_[v2p_(max_)] > ntg_zero_val(cpt_type)) break; return max_; } /// Return the max. - T + value_type res() { return max(); }
protected: - T max_; ///< Index of the worst max element. + + /// Maintain the worst max. + void + adjust(const value_type& idx) + { + if (idx > max_) + max_ = idx; + } + value_type max_; ///< Index of the worst max element. };
/// Minimum non-zero value of an histogram. @@ -563,7 +678,8 @@ { typedef oln_value_type(I) val;
- typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type ensure_type; + typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type + ensure_type;
// check the size precondition(v.size() == im.npoints()); @@ -575,7 +691,8 @@ // with the histogram we can know the number of each color and // then calculate an array of pointer for quick access to each // value of the image - const ntg_cumul_type(val) card = ntg_max_val(val) - ntg_min_val(val) + 1; + const ntg_cumul_type(val) card = ntg_max_val(val) + - ntg_min_val(val) + 1; std::vector<oln_point_type(I)* > ptr(card); ptr[0] = &(v[0]); for (ntg_cumul_type(val) i = 1; i < card; ++i) @@ -588,7 +705,8 @@ *(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p; }
- /*! Inverted sort of the values of an image, and store the result in a vector + /*! Inverted sort of the values of an image, and store the result + ** in a vector ** ** This sort is efficient. ** \arg im Image non_vectorial. @@ -603,13 +721,15 @@ { typedef oln_value_type(I) val;
- typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type ensure_type; + typedef typename ntg_is_a(val, ntg::non_vectorial)::ensure_type + ensure_type;
precondition(v.size() == im.npoints());
utils::histogram<val> histo(im);
- const ntg_cumul_type(val) card = ntg_max_val(val) - ntg_min_val(val) + 1; + const ntg_cumul_type(val) card = ntg_max_val(val) + - ntg_min_val(val) + 1; std::vector<oln_point_type(I)* > ptr(card); ptr[card - 1] = &(v[0]);
Index: olena/tests/morpho/tests/edoc --- olena/tests/morpho/tests/edoc Sun, 03 Aug 2003 19:36:17 +0200 burrus_n (oln/f/13_edoc.cc 1.4.1.5 640) +++ olena/tests/morpho/tests/edoc Thu, 18 Mar 2004 16:34:08 +0100 van-vl_n (oln/f/13_edoc.cc 1.4.1.5 640) @@ -10,6 +10,8 @@ #include <oln/morpho/dilation.hh> #include <oln/morpho/opening.hh> #include <oln/morpho/closing.hh> +#include <oln/morpho/hit_or_miss.hh> +#include <oln/morpho/top_hat.hh>
#include <oln/level/compare.hh>
@@ -27,13 +29,12 @@ fail = true; \ }
+template <class I> bool -check() +check_bin_or_int_u8(const oln::image2d<I> &lena) { bool fail = false;
- image2d<int_u8> lena(rdata("lena128.pgm")); - std::cout << "erosion ... " << std::flush; if (level::is_equal(morpho::erosion(lena, win_c4p()), morpho::fast::erosion(lena, win_c4p()))) @@ -52,5 +53,53 @@ morpho::fast::closing(lena, win_c4p()))) OK_OR_FAIL;
+ std::cout << "closing ... " << std::flush; + if (level::is_equal(morpho::closing(lena, win_c4p()), + morpho::fast::closing(lena, win_c4p()))) + OK_OR_FAIL; + + //FIXME: value are only tested indirectly (this function is tested by + // fast::erosion and fast::dilatation). + oln::morpho::fast_morpho<oln::image2d<I>, oln::window2d, oln::utils::histogram_min<I> > + (lena, oln::win_c4p()); + + oln::window2d mywin; + mywin + .add(-3,-2).add(-3,-1).add(-3,0).add(-3,1).add(-3,2) + .add(-2,-1).add(-2,0).add(-2,1) + .add(-1,0); + oln::window2d mywin2 = - mywin; + + std::cout << "hit_or_miss ... " << std::flush; + if (level::is_equal(morpho::hit_or_miss(oln::convert::boundntg::int_u8(), + lena, mywin, mywin2), + morpho::fast::hit_or_miss(oln::convert::boundntg::int_u8(), + lena, mywin, mywin2))) + OK_OR_FAIL; + + return fail; +} + +bool +check() +{ + bool fail = false; + + image2d<int_u8> lena(rdata("lena128.pgm")); + std::cout << "int_u8..." << std::flush; + + if (!check_bin_or_int_u8(lena)) + OK_OR_FAIL; + + std::cout << "top hat contrast ... " << std::flush; + if (level::is_equal(morpho::top_hat_contrast_op(lena, win_c4p()), + morpho::fast::top_hat_contrast_op(lena, win_c4p()))) + OK_OR_FAIL; + + image2d<bin> obj(rdata("object.pbm")); + std::cout << "bin..." << std::flush; + if (!check_bin_or_int_u8(obj)) + OK_OR_FAIL; + return fail; } Index: olena/oln/convert/value_to_point.hh --- olena/oln/convert/value_to_point.hh Sat, 13 Mar 2004 17:45:05 +0100 van-vl_n (oln/j/43_value_to_p 1.3 644) +++ olena/oln/convert/value_to_point.hh Mon, 15 Mar 2004 18:44:05 +0100 van-vl_n (oln/j/43_value_to_p 1.3 644) @@ -64,12 +64,36 @@ typedef point1d result_type; typedef Argument_type argument_type;
- template <class input_type> + /// This class has bee made because of the lake of operator-- in ntg::bin + template <typename O, typename I> + struct doit_binary + { + static + O + doit(const I &input) + { + return input ? O(1) : O(0); + } + }; + /// This class has bee made because of the lake of operator-- in ntg::bin + template <typename O, typename I> + struct doit_not_binary + { + static + O + doit(const I &input) + { + return O(input - ntg_min_val(I)); + } + }; + result_type - doit(const input_type &input) const + doit(const argument_type &input) const { - result_type r(input - ntg_min_val(input_type)); - return r; + typedef typename mlc::if_<ntg_is_a(argument_type, ntg::binary)::ret, + doit_binary<result_type, argument_type>, + doit_not_binary<result_type, argument_type> >::ret doit_type; + return doit_type::doit(input); } };
@@ -92,11 +116,11 @@ typedef typename ntg::color<3, Qbits, S> argument_type;
result_type - operator()(const argument_type &input) const + doit(const argument_type &input) const { result_type r; for (unsigned i = 0; i < 3; ++i) - r.nth(i) = input[i]; + r.nth(i) = oln::coord(input[i]); return r; } }; Index: olena/oln/morpho/attribute_closing_opening_map.hh --- olena/oln/morpho/attribute_closing_opening_map.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/j/49_attribute_ 1.8 600) +++ olena/oln/morpho/attribute_closing_opening_map.hh Thu, 18 Mar 2004 17:24:51 +0100 van-vl_n (oln/j/49_attribute_ 1.8 600) @@ -255,15 +255,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::card_closing(im1, oln::neighb_c4(), 200); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_card_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_card_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_card_closing.png - ** \image latex oln_morpho_fast_card_closing.png + ** \image html oln_morpho_slow_card_closing.png + ** \image latex oln_morpho_slow_card_closing.png ** */ xxx_closing_map_decl(card); @@ -282,15 +281,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::card_opening(im1, oln::neighb_c4(), 200); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_card_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_card_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_card_opening.png - ** \image latex oln_morpho_fast_card_opening.png + ** \image html oln_morpho_slow_card_opening.png + ** \image latex oln_morpho_slow_card_opening.png ** */ xxx_opening_map_decl(card); @@ -309,15 +307,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::integral_closing(im1, oln::neighb_c4(), 200); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_integral_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_integral_closing.png - ** \image latex oln_morpho_fast_integral_closing.png + ** \image html oln_morpho_slow_integral_closing.png + ** \image latex oln_morpho_slow_integral_closing.png ** */ xxx_closing_map_decl(integral); @@ -336,15 +333,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::integral_opening(im1, oln::neighb_c4(), 200); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_integral_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_integral_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_integral_opening.png - ** \image latex oln_morpho_fast_integral_opening.png + ** \image html oln_morpho_slow_integral_opening.png + ** \image latex oln_morpho_slow_integral_opening.png ** */ xxx_opening_map_decl(integral); @@ -363,15 +359,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::height_opening(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_height_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_height_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_height_opening.png - ** \image latex oln_morpho_fast_height_opening.png + ** \image html oln_morpho_slow_height_opening.png + ** \image latex oln_morpho_slow_height_opening.png ** */ xxx_opening_map_decl(height); @@ -391,15 +386,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::height_closing(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_height_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_height_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_height_closing.png - ** \image latex oln_morpho_fast_height_closing.png + ** \image html oln_morpho_slow_height_closing.png + ** \image latex oln_morpho_slow_height_closing.png ** */ xxx_closing_map_decl(height); @@ -420,15 +414,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::maxvalue_closing(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_maxvalue_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_maxvalue_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_maxvalue_closing.png - ** \image latex oln_morpho_fast_maxvalue_closing.png + ** \image html oln_morpho_slow_maxvalue_closing.png + ** \image latex oln_morpho_slow_maxvalue_closing.png ** */ xxx_closing_map_decl(maxvalue); @@ -448,15 +441,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::maxvalue_opening(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_maxvalue_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_maxvalue_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_maxvalue_opening.png - ** \image latex oln_morpho_fast_maxvalue_opening.png + ** \image html oln_morpho_slow_maxvalue_opening.png + ** \image latex oln_morpho_slow_maxvalue_opening.png ** */ xxx_opening_map_decl(maxvalue); @@ -476,15 +468,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::minvalue_opening(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_minvalue_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_minvalue_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_minvalue_opening.png - ** \image latex oln_morpho_fast_minvalue_opening.png + ** \image html oln_morpho_slow_minvalue_opening.png + ** \image latex oln_morpho_slow_minvalue_opening.png ** */ xxx_opening_map_decl(minvalue); @@ -504,15 +495,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::minvalue_closing(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_minvalue_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_minvalue_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_minvalue_closing.png - ** \image latex oln_morpho_fast_minvalue_closing.png + ** \image html oln_morpho_slow_minvalue_closing.png + ** \image latex oln_morpho_slow_minvalue_closing.png ** */ xxx_closing_map_decl(minvalue); @@ -532,15 +522,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::ball_opening(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_ball_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_ball_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_ball_opening.png - ** \image latex oln_morpho_fast_ball_opening.png + ** \image html oln_morpho_slow_ball_opening.png + ** \image latex oln_morpho_slow_ball_opening.png ** */ xxx_opening_im_map_decl(ball); @@ -560,15 +549,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::ball_closing(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_ball_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_ball_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_ball_closing.png - ** \image latex oln_morpho_fast_ball_closing.png + ** \image html oln_morpho_slow_ball_closing.png + ** \image latex oln_morpho_slow_ball_closing.png ** */ xxx_closing_im_map_decl(ball); @@ -588,15 +576,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::dist_opening(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_dist_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_dist_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_dist_opening.png - ** \image latex oln_morpho_fast_dist_opening.png + ** \image html oln_morpho_slow_dist_opening.png + ** \image latex oln_morpho_slow_dist_opening.png ** */ xxx_opening_im_map_decl(dist); @@ -616,15 +603,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::dist_closing(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_dist_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_dist_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_dist_closing.png - ** \image latex oln_morpho_fast_dist_closing.png + ** \image html oln_morpho_slow_dist_closing.png + ** \image latex oln_morpho_slow_dist_closing.png ** */ xxx_closing_im_map_decl(dist); @@ -644,15 +630,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::cube_closing(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_cube_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_cube_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_cube_closing.png - ** \image latex oln_morpho_fast_cube_closing.png + ** \image html oln_morpho_slow_cube_closing.png + ** \image latex oln_morpho_slow_cube_closing.png ** */ xxx_closing_im_map_decl(cube); @@ -672,15 +657,14 @@ ** ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::cube_opening(im1, oln::neighb_c4(), 5); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_cube_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_cube_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_cube_opening.png - ** \image latex oln_morpho_fast_cube_opening.png + ** \image html oln_morpho_slow_cube_opening.png + ** \image latex oln_morpho_slow_cube_opening.png ** */ xxx_opening_im_map_decl(cube); @@ -701,15 +685,14 @@ ** lambda[0] = lambda[1] = 50; ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::box_closing(im1, oln::neighb_c4(), lambda); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_box_closing.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_box_closing.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_box_closing.png - ** \image latex oln_morpho_fast_box_closing.png + ** \image html oln_morpho_slow_box_closing.png + ** \image latex oln_morpho_slow_box_closing.png ** */ xxx_closing_im_map_decl(box); @@ -730,15 +713,14 @@ ** lambda[0] = lambda[1] = 50; ** im_type im1(oln::load(IMG_IN "lena128.pgm")); ** im1 = oln::morpho::slow::box_opening(im1, oln::neighb_c4(), lambda); - ** oln::save(im1, IMG_OUT "oln_morpho_fast_box_opening.ppm"); - ** return 0; + ** oln::save(im1, IMG_OUT "oln_morpho_slow_box_opening.ppm"); ** } ** \endcode ** \image html lena128_pgm.png ** \image latex lena128_pgm.png ** => - ** \image html oln_morpho_fast_box_opening.png - ** \image latex oln_morpho_fast_box_opening.png + ** \image html oln_morpho_slow_box_opening.png + ** \image latex oln_morpho_slow_box_opening.png ** */ xxx_opening_im_map_decl(box);
On Thu, 18 Mar 2004 18:28:12 +0100 Niels Van Vliet niels@lrde.epita.fr wrote:
typedef V2P value_to_point_type; ///< Class that convert a value to
/// a point
Class that converts.
- ** It return the smaller value within the image used to build the
- ** histogram.
It returns. (a plusieurs endroits)
On avait pas dit qu'on devait utiliser des verbes a l'imperatif ? 'Return' en l'occurence ici.
- ** \note It can be slow when the histogram is sparse because it
- ** iterate over a large range of 0. Use histogram_max or
- ** histogram_minmax instead.
it iterates.
// with the histogram we can know the number of each color and // then calculate an array of pointer for quick access to each // value of the image
Je me rappelle plus qui m'a dit de ne pas utiliser 'we'. :-)
- /*! Inverted sort of the values of an image, and store the result
- ** in a vector
Je me trompe peut-etre, mais j'ai l'impression que cette phrase est bancale.
/// This class has bee made because of the lake of operator-- in
been