Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
April 2008
- 11 participants
- 119 discussions
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-04-28 Caroline Vigouroux <vigour_c(a)epita.fr>
Upgrade literals.
* color/my_cmy.hh: .
* literal/black.hh, literal/blue.hh,
literal/cyan.hh, literal/green.hh,
literal/red.hh, literal/white.hh: New literal.
---
color/my_cmy.hh | 57 -------------------------------------------------------
literal/black.hh | 37 +++++++++++++++++++++++++++++++++++
literal/blue.hh | 37 +++++++++++++++++++++++++++++++++++
literal/cyan.hh | 10 +++++++++
literal/green.hh | 37 +++++++++++++++++++++++++++++++++++
literal/red.hh | 37 +++++++++++++++++++++++++++++++++++
literal/white.hh | 37 +++++++++++++++++++++++++++++++++++
7 files changed, 195 insertions(+), 57 deletions(-)
Index: trunk/milena/sandbox/vigouroux/literal/blue.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/blue.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/blue.hh (revision 1895)
@@ -0,0 +1,37 @@
+#ifndef MLN_LITERAL_BLUE_HH
+# define MLN_LITERAL_BLUE_HH
+
+/*! \file mln/literal/blue.hh
+ * \brief Definition of the literal of mln::blue.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal blue.
+ struct blue_t : public Literal<blue_t>
+ {
+ T_rgb operator()() const
+ {
+ return value::rgb8(0,0,255);
+ }
+ };
+
+
+ /// Literal blue.
+ // FIXME: Make this a proper global (issue #43).
+ static const blue_t blue = blue_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_BLUE_HH
Index: trunk/milena/sandbox/vigouroux/literal/cyan.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/cyan.hh (revision 1894)
+++ trunk/milena/sandbox/vigouroux/literal/cyan.hh (revision 1895)
@@ -7,6 +7,9 @@
*/
# include <mln/core/concept/literal.hh>
+# include <mln/value/rgb8.hh>
+# include "../cmy/my_cmy.hh"
+# include "../cmy/rgb_to_cmy.hh"
namespace mln
{
@@ -17,6 +20,13 @@
/// Type of literal cyan.
struct cyan_t : public Literal<cyan_t>
{
+ value::rgb8 operator()() const
+ {
+ const value::cmy_f cmy(255,0,0);
+ value::rgb8 rgb = fun::v2v::f_rgb_to_cmy_f(fun::v2v::f_rgb_to_cmy_f(cmy));
+
+ return rgb;
+ }
};
Index: trunk/milena/sandbox/vigouroux/literal/green.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/green.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/green.hh (revision 1895)
@@ -0,0 +1,37 @@
+#ifndef MLN_LITERAL_GREEN_HH
+# define MLN_LITERAL_GREEN_HH
+
+/*! \file mln/literal/green.hh
+ * \brief Definition of the literal of mln::green.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal green.
+ struct green_t : public Literal<green_t>
+ {
+ T_rgb operator()() const
+ {
+ return value::rgb8(0,255,0);
+ }
+ };
+
+
+ /// Literal green.
+ // FIXME: Make this a proper global (issue #43).
+ static const green_t green = green_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_GREEN_HH
Index: trunk/milena/sandbox/vigouroux/literal/red.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/red.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/red.hh (revision 1895)
@@ -0,0 +1,37 @@
+#ifndef MLN_LITERAL_RED_HH
+# define MLN_LITERAL_RED_HH
+
+/*! \file mln/literal/red.hh
+ * \brief Definition of the literal of mln::red.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal red.
+ struct red_t : public Literal<red_t>
+ {
+ T_rgb operator()() const
+ {
+ return value::rgb8(255,0,0);
+ }
+ };
+
+
+ /// Literal red.
+ // FIXME: Make this a proper global (issue #43).
+ static const red_t red = red_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_RED_HH
Index: trunk/milena/sandbox/vigouroux/literal/black.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/black.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/black.hh (revision 1895)
@@ -0,0 +1,37 @@
+#ifndef MLN_LITERAL_BLACK_HH
+# define MLN_LITERAL_BLACK_HH
+
+/*! \file mln/literal/black.hh
+ * \brief Definition of the literal of mln::black.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal black.
+ struct black_t : public Literal<black_t>
+ {
+ T_rgb operator()() const
+ {
+ return value::rgb8(0,0,0);
+ }
+ };
+
+
+ /// Literal black.
+ // FIXME: Make this a proper global (issue #43).
+ static const black_t black = black_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_BLACK_HH
Index: trunk/milena/sandbox/vigouroux/literal/white.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/white.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/white.hh (revision 1895)
@@ -0,0 +1,37 @@
+#ifndef MLN_LITERAL_WHITE_HH
+# define MLN_LITERAL_WHITE_HH
+
+/*! \file mln/literal/white.hh
+ * \brief Definition of the literal of mln::white.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal white.
+ struct white_t : public Literal<white_t>
+ {
+ T_rgb operator()() const
+ {
+ return value::rgb8(255,255,255);
+ }
+ };
+
+
+ /// Literal white.
+ // FIXME: Make this a proper global (issue #43).
+ static const white_t white = white_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_WHITE_HH
Index: trunk/milena/sandbox/vigouroux/color/my_cmy.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/color/my_cmy.hh (revision 1894)
+++ trunk/milena/sandbox/vigouroux/color/my_cmy.hh (revision 1895)
@@ -62,61 +62,4 @@
} // end of namespace mln
-// template <unsigned n>
-// struct cmy
-// {
-// public:
-// /// Constructor without argument.
-// cmy();
-
-// /// Constructor from component values.
-// cmy(double c, double m, double y);
-
-// /// Access to component values.
-// double c() const { return this->c_; }
-// double m() const { return this->m_; }
-// double y() const { return this->y_; }
-
-// /// Set component values.
-// void c(double c)
-// {
-// mln_precondition(c >= 0);
-// this->c_ = c;
-// }
-// void m(double m)
-// {
-// mln_precondition(m >= 0);
-// this->m_ = m;
-// }
-// void y(double y)
-// {
-// mln_precondition(y >= 0);
-// this->y_ = y;
-// }
-
-// private:
-// double c_;
-// double m_;
-// double y_;
-// };
-
-// template <unsigned n>
-// inline
-// cmy<n>::cmy()
-// :c_(0), m_(0), y_(0)
-// {
-// }
-
-// template <unsigned n>
-// inline
-// cmy<n>::cmy(double c, double m, double y)
-// {
-// mln_precondition(c >= 0);
-// mln_precondition(m >= 0);
-// mln_precondition(y >= 0);
-// this->c_ = c;
-// this->m_ = m;
-// this->y_ = y;
-// }
-
#endif // ! MLN_VALUE_CMY_HH
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-04-25 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add delta points array and use it in fllt.
* mln/core/dp_array.hh: New. Array for delta points
* sandbox/garrigues/fllt/fllt_simple.cc: Use dp_array for c6
neighborhood. Start a test with interpixel browsing.
---
mln/core/dp_array.hh | 256 ++++++++++++++++++++++++++++++++++
sandbox/garrigues/fllt/fllt_simple.cc | 222 ++++++++++++++++++++++-------
2 files changed, 426 insertions(+), 52 deletions(-)
Index: trunk/milena/mln/core/dp_array.hh
===================================================================
--- trunk/milena/mln/core/dp_array.hh (revision 0)
+++ trunk/milena/mln/core/dp_array.hh (revision 1894)
@@ -0,0 +1,256 @@
+// Copyright (C) 2007 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_DP_ARRAY_HH
+# define MLN_CORE_DP_ARRAY_HH
+
+/*! \file mln/core/dp_array.hh
+ *
+ * \brief Definition of a point set class based on std::vector.
+ */
+
+# include <vector>
+
+# include <mln/core/internal/point_set_base.hh>
+# include <mln/accu/bbox.hh>
+
+
+namespace mln
+{
+
+ // Fwd decls.
+ template <typename D> struct dp_array_fwd_piter_;
+ template <typename D> struct dp_array_bkd_piter_;
+
+
+ /*! \brief Point set class based on std::vector.
+ *
+ * This is a multi-set of points.
+ *
+ * \warning We have some troubles with point set comparison based on
+ * a call to npoints(). FIXME: Explain!
+ *
+ * \todo Make it work with P being a Point_Site.
+ */
+ template <typename D>
+ class dp_array : public internal::dpoints_base_< D, dp_array<D> >
+ {
+ public:
+
+ /// Dpoint associated type.
+ typedef D dpoint;
+
+ /// Point associated type.
+ typedef mln_point(D) point;
+
+ /*! \brief Point_Iterator type to browse the points of a generic
+ * neighborhood w.r.t. the ordering of delta-points.
+ */
+ typedef dpoints_fwd_piter<D> fwd_niter;
+
+ /*! \brief Point_Iterator type to browse the points of a generic
+ * neighborhood w.r.t. the reverse ordering of delta-points.
+ */
+ typedef dpoints_bkd_piter<D> bkd_niter;
+
+ /// Constructor.
+ dp_array();
+
+ /// Constructor from a vector \p vect.
+ dp_array(const std::vector<D>& vect);
+
+ /// Reserve \p n cells.
+ void reserve(std::size_t n);
+
+ /// Test is \p p belongs to this point set.
+ bool has(const D& dp) const;
+
+ /// Give the number of dpoints.
+ std::size_t ndpoints() const;
+
+ /// Give the exact bounding box.
+ const box_<point>& bbox() const;
+
+ /// Append a point \p p.
+ dp_array<D>& append(const D& dp);
+
+ /// Append an array \p other of points.
+ dp_array<D>& append(const dp_array<D>& other);
+
+ /// Clear this set.
+ void clear();
+
+ /// Return the corresponding std::vector of points.
+ const std::vector<D>& vect() const;
+
+ /// Return the \p i-th point.
+ const D& operator[](unsigned i) const;
+
+ /// Hook to data.
+ std::vector<D>& hook_();
+
+ protected:
+
+ std::vector<D> vect_;
+ mutable accu::bbox<dpoint> bb_;
+ mutable bool bb_needs_update_;
+
+ void update_bb_() const;
+ // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename D>
+ inline
+ dp_array<D>::dp_array()
+ {
+ bb_needs_update_ = false;
+ }
+
+ template <typename D>
+ inline
+ dp_array<D>::dp_array(const std::vector<D>& vect)
+ : vect_(vect)
+ {
+ bb_needs_update_ = true;
+ }
+
+ template <typename D>
+ inline
+ void
+ dp_array<D>::reserve(std::size_t n)
+ {
+ vect_.reserve(n);
+ }
+
+ template <typename D>
+ inline
+ std::vector<D>&
+ dp_array<D>::hook_()
+ {
+ return vect_;
+ }
+
+ template <typename D>
+ inline
+ void
+ dp_array<D>::update_bb_() const
+ {
+ bb_.init();
+ for (unsigned i = 0; i < vect_.size(); ++i)
+ bb_.take(vect_[i]);
+ bb_needs_update_ = false;
+ }
+
+ template <typename D>
+ inline
+ bool
+ dp_array<D>::has(const D& dp) const
+ {
+ for (unsigned i = 0; i < vect_.size(); ++i)
+ if (vect_[i] == dp)
+ return true;
+ return false;
+ }
+
+ template <typename D>
+ inline
+ std::size_t
+ dp_array<D>::ndpoints() const
+ {
+ return vect_.size();
+ }
+
+ template <typename D>
+ inline
+ const box_<mln_point(D)>&
+ dp_array<D>::bbox() const
+ {
+ mln_precondition(ndpoints() != 0);
+ if (bb_needs_update_)
+ update_bb_();
+ return bb_.to_result();
+ }
+
+ template <typename D>
+ inline
+ dp_array<D>&
+ dp_array<D>::append(const D& dp)
+ {
+ vect_.push_back(dp);
+ if (! bb_needs_update_)
+ bb_needs_update_ = true;
+ return *this;
+ }
+
+ template <typename D>
+ inline
+ dp_array<D>&
+ dp_array<D>::append(const dp_array<D>& other)
+ {
+ vect_.insert(vect_.end(),
+ other.vect().begin(), other.vect().end());
+ if (! bb_needs_update_)
+ bb_needs_update_ = true;
+ return *this;
+ }
+
+ template <typename D>
+ inline
+ void
+ dp_array<D>::clear()
+ {
+ bb_.init();
+ vect_.clear();
+ bb_needs_update_ = false;
+ }
+
+ template <typename D>
+ inline
+ const std::vector<D>&
+ dp_array<D>::vect() const
+ {
+ return vect_;
+ }
+
+ template <typename D>
+ inline
+ const D&
+ dp_array<D>::operator[](unsigned i) const
+ {
+ mln_precondition(i < ndpoints());
+ return vect_[i];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif // ! MLN_CORE_DP_ARRAY_HH
Index: trunk/milena/sandbox/garrigues/fllt/fllt_simple.cc
===================================================================
--- trunk/milena/sandbox/garrigues/fllt/fllt_simple.cc (revision 1893)
+++ trunk/milena/sandbox/garrigues/fllt/fllt_simple.cc (revision 1894)
@@ -35,6 +35,11 @@
#include <mln/core/p_array.hh>
#include <mln/core/clone.hh>
+#include <mln/core/cast_image.hh>
+#include <mln/core/p_queue_fast.hh>
+
+#include <mln/core/dp_array.hh>
+
#include <mln/value/int_u8.hh>
#include <mln/io/pgm/load.hh>
@@ -51,8 +56,6 @@
#include <mln/util/tree_to_image.hh>
#include <mln/util/branch_iter_ind.hh>
-#include <mln/core/cast_image.hh>
-#include <mln/core/p_queue_fast.hh>
namespace mln
{
@@ -142,6 +145,146 @@
};
+ struct c6_neighb
+ {
+ // C6 neigboohood.
+ //static std::vector<dpoint2d> nbhs[2];
+ static dp_array<dpoint2d> nbhs[2];
+
+ static inline const dp_array<dpoint2d>& get(point2d p)
+ {
+ static bool toto = false;
+
+ if (!toto)
+ {
+ toto = true;
+ c6_neighb::nbhs[0].append(make::dpoint2d(-1,-1));
+ c6_neighb::nbhs[0].append(make::dpoint2d(-1,0));
+ c6_neighb::nbhs[0].append(make::dpoint2d(-1,1));
+ c6_neighb::nbhs[0].append(make::dpoint2d(0,1));
+ c6_neighb::nbhs[0].append(make::dpoint2d(1,0));
+ c6_neighb::nbhs[0].append(make::dpoint2d(0,-1));
+
+ c6_neighb::nbhs[1].append(make::dpoint2d(-1,0));
+ c6_neighb::nbhs[1].append(make::dpoint2d(0,1));
+ c6_neighb::nbhs[1].append(make::dpoint2d(1,1));
+ c6_neighb::nbhs[1].append(make::dpoint2d(1,0));
+ c6_neighb::nbhs[1].append(make::dpoint2d(1,-1));
+ c6_neighb::nbhs[1].append(make::dpoint2d(0,-1));
+ }
+
+ return nbhs[abs(p[1] % 2)];
+ }
+ };
+ dp_array<dpoint2d> c6_neighb::nbhs[2];
+
+
+ struct c6_interpixel
+ {
+ c6_interpixel() {}
+
+ c6_interpixel(point2d pt1, point2d pt2,
+ unsigned i1, unsigned i2)
+ : pt1(pt1), pt2(pt2),
+ i1(i1), i2(i2)
+ {
+ mln_assertion(pt1 + c6_neighb::get(pt1)[i1] == pt2);
+ mln_assertion(pt2 + c6_neighb::get(pt2)[i2] == pt1);
+ }
+
+ bool is_valid()
+ {
+ return (pt1 + c6_neighb::get(pt1)[i1] == pt2) &&
+ (pt2 + c6_neighb::get(pt2)[i2] == pt1);
+ }
+
+ point2d pt1, pt2;
+ unsigned i1, i2;
+ };
+
+ template <typename I>
+ inline bool is_level_line_in_ip(const Image<I>& ima,
+ const c6_interpixel& ip,
+ const mln_value(I)& v)
+ {
+ mln_value(I) v1, v2;
+ v1 = ima(ip.pt1);
+ v2 = ima(ip.pt2);
+
+ return v1 != v2 && ((v1 >= v && v2 <= v) || (v1 <= v && v2 >= v));
+ }
+
+ class c6_interpixel_niter
+ {
+ public:
+ c6_interpixel_niter(const c6_interpixel& ip)
+ : ip_ref_(ip)
+ {
+ }
+
+ bool is_valid() const
+ {
+ i_ >= 4;
+ }
+
+ void invalidate()
+ {
+ i_ = 4;
+ }
+
+ void start()
+ {
+ i_ = 0;
+ ip_.pt1 = ip_ref_.pt1 + c6_neighb::get(ip_ref_.pt1)[ip_ref_.i1 + 1];
+ ip_.pt2 = ip_ref_.pt2;
+ ip_.i1 = ip_ref_.i1 + 1;
+ ip_.i2 = ip_ref_.i2 - 1;
+ mln_assertion(ip_.is_valid());
+ }
+
+ void next_()
+ {
+ mln_assertion(is_valid() && i_ > 0);
+ i_++;
+ switch (i_)
+ {
+ case 1:
+ ip_.pt1 = ip_ref_.pt1 + c6_neighb::get(ip_ref_.pt1)[ip_ref_.i1 - 1];
+ mln_assertion(ip_.pt2 == ip_ref_.pt2);
+ ip_.i1 = ip_ref_.i1 - 1;
+ ip_.i2 = ip_ref_.i2 + 1;
+ break;
+ case 2:
+ ip_.pt1 = ip_ref_.pt1;
+ ip_.pt2 = ip_ref_.pt2 + c6_neighb::get(ip_ref_.pt2)[ip_.i2 + 1];
+ ip_.i1 = ip_ref_.i1 - 1;
+ ip_.i2 = ip_ref_.i2 + 1;
+ break;
+ case 3:
+ mln_assertion(ip_.pt1 == ip_ref_.pt1);
+ ip_.pt1 = ip_ref_.pt2 + c6_neighb::get(ip_ref_.pt2)[ip_.i2 - 1];
+ ip_.i1 = ip_ref_.i1 + 1;
+ ip_.i2 = ip_ref_.i2 - 1;
+ break;
+ }
+ mln_assertion(ip_.is_valid());
+ }
+
+ private:
+ unsigned i_;
+ c6_interpixel ip_;
+ const c6_interpixel& ip_ref_;
+ };
+
+ struct c6_niter : public dpoints_fwd_piter<dpoint2d>
+ {
+ typedef dpoints_fwd_piter<dpoint2d> super;
+
+ c6_niter(const point2d& p)
+ : super(c6_neighb::get(p), p)
+ {}
+ };
+
template <typename P, typename V>
void add_npoints_to(fllt_node(P, V)* node, unsigned npoints)
{
@@ -152,7 +295,6 @@
add_npoints_to(node->parent(), npoints);
}
-
template <typename R>
struct map_cell
{
@@ -172,8 +314,6 @@
}
};
-
-
template <typename P, typename V>
void
draw_tree(const image2d<V>& ima,
@@ -196,7 +336,6 @@
}
}
-
template <typename P, typename V>
void
visualize_bounds(image2d<value::int_u8>& output,
@@ -246,7 +385,6 @@
N = tmp;
}
-
template <typename N_t>
void clear_N(N_t& N)
{
@@ -255,7 +393,7 @@
}
template <typename I, typename CC>
- void erase_exterior_border(I& map, const box2d& bbox, const CC& current_cc, const std::vector<dpoint2d> nbh[])
+ void erase_exterior_border(I& map, const box2d& bbox, const CC& current_cc)
{
typedef const std::vector<dpoint2d> arr_dp_t;
typedef std::vector<dpoint2d>::const_iterator arr_dp_t_it;
@@ -276,21 +414,17 @@
{
mln_point(I) a = qu.pop_front();
//map(a).border_of_hole_of = 0;
- arr_dp_t* n_dp = &nbh[abs(a[1] % 2 > 0)];
-// unsigned i = 0;
- for(arr_dp_t_it x = n_dp->begin(); x != n_dp->end(); x++)
- {
- mln_point(I) n = mln_point(I)(a) + mln_dpoint(I)(*x);
+
+ c6_niter n(a);
+ for_all(n)
+ {
if(!map.has(n))
continue;
if (map(n).border_of_hole_of == current_cc &&
map(n).belongs_to != current_cc)
{
-// i++;
-// std::cout << i << std::endl;
-// mln_assertion(i <= 2);
map(n).restore_border();
qu.push(n);
break;
@@ -310,22 +444,6 @@
typedef fllt_node(mln_point(I), mln_value(I)) node_type;
typedef fllt_tree(mln_point(I), mln_value(I)) tree_type;
- // C6 neigboohood.
- arr_dp_t neighb_c6[2];
- neighb_c6[0].push_back(make::dpoint2d(-1,-1));
- neighb_c6[0].push_back(make::dpoint2d(-1,0));
- neighb_c6[0].push_back(make::dpoint2d(-1,1));
- neighb_c6[0].push_back(make::dpoint2d(0,1));
- neighb_c6[0].push_back(make::dpoint2d(1,0));
- neighb_c6[0].push_back(make::dpoint2d(0,-1));
-
- neighb_c6[1].push_back(make::dpoint2d(-1,0));
- neighb_c6[1].push_back(make::dpoint2d(0,1));
- neighb_c6[1].push_back(make::dpoint2d(1,1));
- neighb_c6[1].push_back(make::dpoint2d(1,0));
- neighb_c6[1].push_back(make::dpoint2d(1,-1));
- neighb_c6[1].push_back(make::dpoint2d(0,-1));
-
// Variables.
image2d<map_cell<node_type> > map(input.domain().to_larger(1));
I u = mln::clone(input);
@@ -454,10 +572,10 @@
#endif
for_all(a)
{
- arr_dp_t* nbh = &neighb_c6[a[1] % 2];
- for(arr_dp_t_it x = nbh->begin(); x != nbh->end(); x++)
+
+ c6_niter n(a);
+ for_all(n)
{
- mln_point(I) n = mln_point(I)(a) + mln_dpoint(I)(*x);
if (is(n) == in_O)
{
if (!current_parent)
@@ -500,7 +618,7 @@
add_npoints_to(current_parent, current_cc->elt().npoints);
// Was : current_parent->elt().npoints += current_cc->elt().npoints;
current_cc->set_parent(current_parent);
- erase_exterior_border(map, N_box, current_cc, neighb_c6);
+ erase_exterior_border(map, N_box, current_cc);
goto step_1;
}
else
@@ -537,9 +655,9 @@
typedef fllt_node(mln_point_(I), mln_value_(I)) node_type;
typedef fllt_tree(mln_point_(I), mln_value_(I)) tree_type;
-// image2d<int_u8> ima;
-// //io::pgm::load(ima, "../../../img/lena.pgm");
-// io::pgm::load(ima, "../tapis.pgm");
+ image2d<int_u8> ima;
+ //io::pgm::load(ima, "../../../img/lena.pgm");
+ io::pgm::load(ima, "../tapis.pgm");
// int_u8 vs[9][9] = {
@@ -568,15 +686,15 @@
// {100, 200, 255, 200, 100},
// {100, 100, 100, 100, 100} };
- int vs[9][9] = { {2,2,2,2,2,2,2,2,2},
- {2,2,2,2,2,2,2,2,2},
- {2,1,1,1,1,1,1,1,2},
- {2,1,2,2,1,0,0,1,2},
- {2,1,2,2,1,0,0,1,2},
- {2,1,2,2,1,0,0,1,2},
- {2,1,1,1,1,1,1,1,2},
- {2,1,1,1,1,1,1,1,2},
- {2,2,2,2,2,2,2,2,2} };
+// int vs[9][9] = { {2,2,2,2,2,2,2,2,2},
+// {2,2,2,2,2,2,2,2,2},
+// {2,1,1,1,1,1,1,1,2},
+// {2,1,2,2,1,0,0,1,2},
+// {2,1,2,2,1,0,0,1,2},
+// {2,1,2,2,1,0,0,1,2},
+// {2,1,1,1,1,1,1,1,2},
+// {2,1,1,1,1,1,1,1,2},
+// {2,2,2,2,2,2,2,2,2} };
// int vs[7[7] = { {101, 101, 101, 191, 204, 255, 191},
// {101, 101, 191, 204, 204, 204, 204},
@@ -589,14 +707,14 @@
// int vs[2][1] = { {121}, {101} };
- image2d<int> ima_(make::image2d(vs));
- image2d<int_u8> ima(ima_.domain());
- level::fill(ima, ima_);
+// image2d<int> ima_(make::image2d(vs));
+// image2d<int_u8> ima(ima_.domain());
+// level::fill(ima, ima_);
tree_type tree = my::fllt(ima);
- draw_tree(ima, tree);
+// draw_tree(ima, tree);
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Sandbox: ICP: Icp Final Translation.
This patch allows icp to neglect errors due to �noise� in the image
registarted.
* sandbox/jardonnet/test/icp.cc: Add final translation.
* sandbox/jardonnet/test/length.ppm: Add Xk points (green).
registration/quat7.hh | 2 ++
test/icp.cc | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 2 deletions(-)
Index: sandbox/jardonnet/test/icp.cc
--- sandbox/jardonnet/test/icp.cc (revision 1892)
+++ sandbox/jardonnet/test/icp.cc (working copy)
@@ -68,8 +68,6 @@
const box_<point2d> box2d(400,700);
image2d<value::rgb8> output(box2d, 1);
-
-
std::vector<float> length(c.npoints());
//mean + length
float mean = 0;
@@ -90,9 +88,41 @@
stdev = math::sqrt(stdev);
std::cout << stdev << std::endl;
+ //final translate translate using point only separated less than 2*stdev
+ //mu_Xk = center map(Ck)
+ algebra::vec<3,float> mu_Xk(literal::zero);
+ algebra::vec<3,float> mu_C(literal::zero);
+ float nb_point = 0;
+ for (size_t i = 0; i < c.npoints(); ++i)
+ {
+ if (length[i] > 2 * stdev)
+ {
+ algebra::vec<3,float> xki = map(c[i]);
+ algebra::vec<3,float> ci = c[i];
+ mu_C += ci;
+
+ mu_Xk += xki;
+ nb_point++;
+ }
+ }
+ mu_C /= nb_point;
+ mu_Xk /= nb_point;
+
+ // qT
+ const algebra::vec<3,float> qT = mu_Xk - mu_C;
+
+ //translate
+ for (size_t i = 0; i < c.npoints(); ++i)
+ {
+ algebra::vec<3,float> ci = c[i];
+ ci -= qT;
+ c.hook_()[i] = algebra::to_point<point3d>(ci);
+ }
+
//to 2d : projection (FIXME:if 3d)
for (size_t i = 0; i < c.npoints(); i++)
{
+ //Ck points
point2d p(c[i][0], c[i][1]);
if (output.has(p))
{
@@ -103,6 +133,10 @@
else
output(p) = value::rgb8(255,255,255);
}
+ //Xk points
+ point2d x(map(c[i])[0], map(c[i])[1]);
+ if (output.has(x))
+ output(x) = value::rgb8(0,255,0);
}
io::ppm::save(output, "registred.ppm");
Index: sandbox/jardonnet/test/length.ppm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: sandbox/jardonnet/registration/quat7.hh
--- sandbox/jardonnet/registration/quat7.hh (revision 1892)
+++ sandbox/jardonnet/registration/quat7.hh (working copy)
@@ -138,12 +138,14 @@
}
mu_Xk /= c_length;
+
// qR
algebra::mat<P::dim,P::dim,float> Mk(literal::zero);
for (size_t i = 0; i < c_length; ++i)
{
algebra::vec<P::dim,float> Ci = C[i];
algebra::vec<P::dim,float> Xki = map(Ck[i]);
+
Mk += make::mat(Ci - mu_C) * trans(make::mat(Xki - mu_Xk));
}
Mk /= c_length;
1
0
25 Apr '08
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Factor iterators on p_graph neighborhoods and windows.
* mln/core/internal/graph_vicinity_piter.hh: New file.
Use it to factor...
* mln/core/graph_neighborhood_piter.hh,
* mln/core/graph_window_piter.hh
(mln::graph_neighborhood_fwd_piter<P, N>)
(mln::graph_neighborhood_bkd_piter<P, N>)
(mln::graph_window_fwd_piter<P, W>)
(mln::graph_window_bkd_piter<P, W>):
...these iterators.
(mln::internal::graph_neighborhood_piter_<P, N, E>)
(mln::internal::graph_window_piter_<P, W, E>):
New classes.
graph_neighborhood_piter.hh | 346 ++++++++-------------------------------
graph_window_piter.hh | 341 +++++++-------------------------------
internal/graph_vicinity_piter.hh | 232 ++++++++++++++++++++++++++
3 files changed, 375 insertions(+), 544 deletions(-)
Index: mln/core/internal/graph_vicinity_piter.hh
--- mln/core/internal/graph_vicinity_piter.hh (revision 0)
+++ mln/core/internal/graph_vicinity_piter.hh (revision 0)
@@ -0,0 +1,232 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_INTERNAL_GRAPH_VICINITY_PITER_HH
+# define MLN_CORE_INTERNAL_GRAPH_VICINITY_PITER_HH
+
+/// \file mln/core/internal/graph_vicinity_piter.hh
+/// \brief Factored implementation for point iterators on a graph windows
+/// and graph neighborhoods, called "vicinities".
+
+# include <mln/core/concept/point_iterator.hh>
+# include <mln/core/p_graph.hh>
+# include <mln/core/graph_psite.hh>
+
+/* FIXME: Due to the poor interface of mln::p_graph and
+ mln::util::graph, we show to much implementation details here.
+ Enrich their interfaces to avoid that. */
+
+namespace mln
+{
+ // Fwd decls.
+ template <typename P> class p_graph;
+ template <typename P> class graph_psite;
+
+
+ /*----------------------------------------.
+ | internal::graph_vicinity_piter_<P, E>. |
+ `----------------------------------------*/
+
+ namespace internal
+ {
+
+ /// \brief Base for iterator on a graph vicinity.
+ template <typename P, typename E>
+ class graph_vicinity_piter_ : public Point_Iterator< E >
+ {
+ typedef graph_vicinity_piter_<P, E> self_;
+ typedef Point_Iterator< self_ > super_;
+
+ public:
+ enum { dim = P::dim };
+
+ typedef graph_psite<P> psite;
+ typedef P point;
+ typedef mln_coord(P) coord;
+ // FIXME: Dummy typedef.
+ typedef void dpoint;
+ // FIXME: Dummy value.
+ typedef void mesh;
+
+ public:
+ /// Construction.
+ /// \{
+ template <typename Pref>
+ graph_vicinity_piter_(const Point_Site<Pref>& p_ref);
+ /// \}
+
+ /// Manipulation.
+ /// \{
+ /// Test if the iterator is valid.
+ bool is_valid() const;
+ /// Invalidate the iterator.
+ void invalidate();
+
+ /// Is the piter adjacent to the reference point?
+ bool adjacent_to_p_ref_() const;
+ /// Is the piter adjacent or equal to the reference point?
+ bool adjacent_or_equal_to_p_ref_() const;
+ /// Update the internal data of the iterator.
+ void update_();
+ /// \}
+
+ /// Conversion and accessors.
+ /// \{
+ /// Reference to the corresponding point.
+ const point& to_point() const;
+ /// Reference to the corresponding point site.
+ const psite& to_psite() const;
+ /// Convert the iterator into a line graph psite.
+ operator psite() const;
+
+ /// Read-only access to the \a i-th coordinate.
+ coord operator[](unsigned i) const;
+ /// \}
+
+ /// Internals, used by the vicinity.
+ /// \{
+ public:
+ /// An internal iterator on the set of nodes of the underlying graph.
+ util::node_id id_;
+ /// \}
+
+ protected:
+ /// The ``central'' psite of the vicinity (for instance, the
+ /// center of the neighborhood, in the case of a neighborhood
+ /// piter).
+ const psite& p_ref_;
+
+ private:
+ /// The psite corresponding to this iterator.
+ psite psite_;
+ /// The point corresponding to this iterator.
+ point p_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P, typename E>
+ template <typename Pref>
+ inline
+ graph_vicinity_piter_<P, E>::graph_vicinity_piter_(const Point_Site<Pref>& p_ref)
+ : p_ref_(exact(p_ref).to_psite()),
+ // Initialize psite_ to a dummy value.
+ psite_(),
+ p_()
+ {
+ // Invalidate id_.
+ invalidate();
+ }
+
+ template <typename P, typename E>
+ inline
+ bool
+ graph_vicinity_piter_<P, E>::is_valid() const
+ {
+ /* FIXME: We depend too much on the implementation of
+ util::graph here. The util::graph should provide the service
+ to abstract these manipulations. */
+ return p_ref_.is_valid() && id_ < p_ref_.pg().npoints();
+ }
+
+ template <typename P, typename E>
+ inline
+ void
+ graph_vicinity_piter_<P, E>::invalidate()
+ {
+ id_ = -1;
+ }
+
+ template <typename P, typename E>
+ inline
+ bool
+ graph_vicinity_piter_<P, E>::adjacent_to_p_ref_() const
+ {
+ return p_ref_.pg().adjacent(p_ref_.id(), id_);
+ }
+
+ template <typename P, typename E>
+ inline
+ bool
+ graph_vicinity_piter_<P, E>::adjacent_or_equal_to_p_ref_() const
+ {
+ return p_ref_.pg().adjacent_or_equal(p_ref_.id(), id_);
+ }
+
+ template <typename P, typename E>
+ inline
+ void
+ graph_vicinity_piter_<P, E>::update_()
+ {
+ // Update psite_.
+ psite_ = graph_psite<P>(p_ref_.pg(), id_);
+ // Update p_.
+ p_ = p_ref_.pg().point_from_id(id_);
+ }
+
+ template <typename P, typename E>
+ inline
+ const P&
+ graph_vicinity_piter_<P, E>::to_point() const
+ {
+ return p_;
+ }
+
+ template <typename P, typename E>
+ inline
+ const graph_psite<P>&
+ graph_vicinity_piter_<P, E>::to_psite() const
+ {
+ return psite_;
+ }
+
+ template <typename P, typename E>
+ inline
+ graph_vicinity_piter_<P, E>::operator graph_psite<P>() const
+ {
+ mln_precondition(is_valid());
+ return psite_;
+ }
+
+ template <typename P, typename E>
+ inline
+ mln_coord(P)
+ graph_vicinity_piter_<P, E>::operator[](unsigned i) const
+ {
+ assert(i < dim);
+ return p_[i];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+#endif // ! MLN_CORE_INTERNAL_GRAPH_VICINITY_PITER_HH
Index: mln/core/graph_neighborhood_piter.hh
--- mln/core/graph_neighborhood_piter.hh (revision 1891)
+++ mln/core/graph_neighborhood_piter.hh (working copy)
@@ -42,9 +42,7 @@
- mln::line_graph_window_bkd_piter
- mln::line_graph_neighborhood_bkd_piter. */
-# include <mln/core/concept/point_iterator.hh>
-# include <mln/core/p_graph.hh>
-# include <mln/core/graph_psite.hh>
+# include <mln/core/internal/graph_vicinity_piter.hh>
/* FIXME: Due to the poor interface of mln::p_graph and
mln::util::graph, we show to much implementation details here.
@@ -52,9 +50,35 @@
namespace mln
{
- // Fwd decls.
- template <typename P> class p_graph;
- template <typename P> class graph_psite;
+
+ /*-----------------------------------------------.
+ | internal::graph_neighborhood_piter_<P, N, E>. |
+ `-----------------------------------------------*/
+
+ namespace internal
+ {
+
+ /// \brief Base for iterator on a graph neighborhood.
+ template <typename P, typename N, typename E>
+ class graph_neighborhood_piter_ : public graph_vicinity_piter_<P, E>
+ {
+ typedef graph_neighborhood_piter_<P, N, E> self_;
+ typedef graph_vicinity_piter_<P, E> super_;
+
+ public:
+ /// Construction.
+ /// \{
+ template <typename Pref>
+ graph_neighborhood_piter_(const Neighborhood<N>& nbh,
+ const Point_Site<Pref>& p_ref);
+ /// \}
+
+ protected:
+ /// The neighborhood.
+ const N& nbh_;
+ };
+
+ } // end of namespace mln::internal
/*-------------------------------------.
@@ -63,21 +87,11 @@
template <typename P, typename N>
class graph_neighborhood_fwd_piter :
- public Point_Iterator< graph_neighborhood_fwd_piter<P, N> >
+ public internal::graph_neighborhood_piter_< P, N,
+ graph_neighborhood_fwd_piter<P, N> >
{
typedef graph_neighborhood_fwd_piter<P, N> self_;
- typedef Point_Iterator< self_ > super_;
-
- public:
- enum { dim = P::dim };
-
- typedef graph_psite<P> psite;
- typedef P point;
- typedef mln_coord(P) coord;
- // FIXME: Dummy typedef.
- typedef void dpoint;
- // FIXME: Dummy value.
- typedef void mesh;
+ typedef internal::graph_neighborhood_piter_<P, N, self_> super_;
public:
/// Construction.
@@ -89,53 +103,19 @@
/// Manipulation.
/// \{
- /// Test if the iterator is valid.
- bool is_valid() const;
- /// Invalidate the iterator.
- void invalidate();
/// Start an iteration.
void start();
-
/// Go to the next point.
void next_();
- /// Is the piter adjacent to the reference point?
- bool adjacent_to_p_ref_() const;
- /// Update the internal data of the iterator.
- void update_();
/// \}
- /// Conversion and accessors.
- /// Reference to the corresponding point.
- const point& to_point() const;
- /// Reference to the corresponding point site.
- const psite& to_psite() const;
- /// Convert the iterator into a line graph psite.
- operator psite() const;
-
- /// Read-only access to the \a i-th coordinate.
- coord operator[](unsigned i) const;
-
/// Internals, used by the neighborhood.
/// \{
- public:
/// Set the iterator to the first site of the graph.
void first_();
/// Advance the position of the iterator by one step.
void step_();
-
- /// An internal iterator on the set of nodes of the underlying graph.
- util::node_id id_;
/// \}
-
- private:
- /// The neighborhood.
- const N& nbh_;
- /// The ``central'' psite of the neighborhood.
- const psite& p_ref_;
- /// The psite corresponding to this iterator.
- psite psite_;
- /// The point corresponding to this iterator.
- point p_;
};
@@ -145,21 +125,11 @@
template <typename P, typename N>
class graph_neighborhood_bkd_piter :
- public Point_Iterator< graph_neighborhood_bkd_piter<P, N> >
+ public internal::graph_neighborhood_piter_< P, N,
+ graph_neighborhood_bkd_piter<P, N> >
{
typedef graph_neighborhood_bkd_piter<P, N> self_;
- typedef Point_Iterator< self_ > super_;
-
- public:
- enum { dim = P::dim };
-
- typedef graph_psite<P> psite;
- typedef P point;
- typedef mln_coord(P) coord;
- // FIXME: Dummy typedef.
- typedef void dpoint;
- // FIXME: Dummy value.
- typedef void mesh;
+ typedef internal::graph_neighborhood_piter_<P, N, self_> super_;
public:
/// Construction.
@@ -171,95 +141,56 @@
/// Manipulation.
/// \{
- /// Test if the iterator is valid.
- bool is_valid() const;
- /// Invalidate the iterator.
- void invalidate();
/// Start an iteration.
void start();
-
/// Go to the next point.
void next_();
- /// Is the piter adjacent to the reference point?
- bool adjacent_to_p_ref_() const;
- /// Update the internal data of the iterator.
- void update_();
/// \}
- /// Conversion and accessors.
- /// Reference to the corresponding point.
- const point& to_point() const;
- /// Reference to the corresponding point site.
- const psite& to_psite() const;
- /// Convert the iterator into a line graph psite.
- operator psite() const;
-
- /// Read-only access to the \a i-th coordinate.
- coord operator[](unsigned i) const;
-
/// Internals, used by the neighborhood.
/// \{
- public:
/// Set the iterator to the first site of the graph.
void first_();
/// Advance the position of the iterator by one step.
void step_();
-
- /// An internal iterator on the set of nodes of the underlying graph.
- util::node_id id_;
/// \}
-
- private:
- /// The neighborhood.
- const N& nbh_;
- /// The ``central'' psite of the neighborhood.
- const psite& p_ref_;
- /// The psite corresponding to this iterator.
- psite psite_;
- /// The point corresponding to this iterator.
- point p_;
};
# ifndef MLN_INCLUDE_ONLY
- /*-------------------------------------.
- | graph_neighborhood_fwd_piter<P, N>. |
- `-------------------------------------*/
+ /*-----------------------------------------------.
+ | internal::graph_neighborhood_piter_<P, N, E>. |
+ `-----------------------------------------------*/
- template <typename P, typename N>
+ namespace internal
+ {
+
+ template <typename P, typename N, typename E>
template <typename Pref>
inline
- graph_neighborhood_fwd_piter<P, N>::graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh,
+ graph_neighborhood_piter_<P, N, E>::graph_neighborhood_piter_(const Neighborhood<N>& nbh,
const Point_Site<Pref>& p_ref)
- : nbh_(exact(nbh)),
- p_ref_(exact(p_ref).to_psite()),
- // Initialize psite_ to a dummy value.
- psite_(),
- p_()
+ : super_(p_ref),
+ nbh_(exact(nbh))
{
- // Invalidate id_.
- invalidate();
}
- template <typename P, typename N>
- inline
- bool
- graph_neighborhood_fwd_piter<P, N>::is_valid() const
- {
- // FIXME: We depend too much on the implementation of util::graph
- // here. The util::graph should provide the service to abstract
- // these manipulations.
- return p_ref_.is_valid() && id_ < p_ref_.pg().gr_->nnodes();
- }
+ } // end of namespace mln::internal
+
+
+ /*-------------------------------------.
+ | graph_neighborhood_fwd_piter<P, N>. |
+ `-------------------------------------*/
template <typename P, typename N>
+ template <typename Pref>
inline
- void
- graph_neighborhood_fwd_piter<P, N>::invalidate()
+ graph_neighborhood_fwd_piter<P, N>::graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh,
+ const Point_Site<Pref>& p_ref)
+ : super_(nbh, p_ref)
{
- id_ = -1;
}
template <typename P, typename N>
@@ -267,9 +198,9 @@
void
graph_neighborhood_fwd_piter<P, N>::start()
{
- nbh_.start(*this);
- if (is_valid())
- update_();
+ this->nbh_.start(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename N>
@@ -277,9 +208,9 @@
void
graph_neighborhood_fwd_piter<P, N>::next_()
{
- nbh_.next_(*this);
- if (is_valid())
- update_();
+ this->nbh_.next_(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename N>
@@ -287,7 +218,7 @@
void
graph_neighborhood_fwd_piter<P, N>::first_()
{
- id_ = 0;
+ this->id_ = 0;
}
template <typename P, typename N>
@@ -295,60 +226,7 @@
void
graph_neighborhood_fwd_piter<P, N>::step_()
{
- ++id_;
- }
-
-
- template <typename P, typename N>
- inline
- bool
- graph_neighborhood_fwd_piter<P, N>::adjacent_to_p_ref_() const
- {
- return p_ref_.pg().adjacent(p_ref_.id(), id_);
- }
-
- template <typename P, typename N>
- inline
- void
- graph_neighborhood_fwd_piter<P, N>::update_()
- {
- // Update psite_.
- psite_ = graph_psite<P>(p_ref_.pg(), id_);
- // Update p_.
- p_ = p_ref_.pg().gr_->node_data(id_);
- }
-
- template <typename P, typename N>
- inline
- const P&
- graph_neighborhood_fwd_piter<P, N>::to_point() const
- {
- return p_;
- }
-
- template <typename P, typename N>
- inline
- const graph_psite<P>&
- graph_neighborhood_fwd_piter<P, N>::to_psite() const
- {
- return psite_;
- }
-
- template <typename P, typename N>
- inline
- graph_neighborhood_fwd_piter<P, N>::operator graph_psite<P>() const
- {
- mln_precondition(is_valid());
- return psite_;
- }
-
- template <typename P, typename N>
- inline
- mln_coord(P)
- graph_neighborhood_fwd_piter<P, N>::operator[](unsigned i) const
- {
- assert(i < dim);
- return p_[i];
+ ++this->id_;
}
@@ -361,33 +239,8 @@
inline
graph_neighborhood_bkd_piter<P, N>::graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh,
const Point_Site<Pref>& p_ref)
- : nbh_(exact(nbh)),
- p_ref_(exact(p_ref).to_psite()),
- // Initialize psite_ to a dummy value.
- psite_(),
- p_()
+ : super_(nbh, p_ref)
{
- // Invalidate id_.
- invalidate();
- }
-
- template <typename P, typename N>
- inline
- bool
- graph_neighborhood_bkd_piter<P, N>::is_valid() const
- {
- // FIXME: We depend too much on the implementation of util::graph
- // here. The util::graph should provide the service to abstract
- // these manipulations.
- return p_ref_.is_valid() && id_ < p_ref_.pg().gr_->nnodes();
- }
-
- template <typename P, typename N>
- inline
- void
- graph_neighborhood_bkd_piter<P, N>::invalidate()
- {
- id_ = -1;
}
template <typename P, typename N>
@@ -395,9 +248,9 @@
void
graph_neighborhood_bkd_piter<P, N>::start()
{
- nbh_.start(*this);
- if (is_valid())
- update_();
+ this->nbh_.start(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename N>
@@ -405,9 +258,9 @@
void
graph_neighborhood_bkd_piter<P, N>::next_()
{
- nbh_.next_(*this);
- if (is_valid())
- update_();
+ this->nbh_.next_(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename N>
@@ -415,7 +268,7 @@
void
graph_neighborhood_bkd_piter<P, N>::first_()
{
- id_ = p_ref_.pg().gr_->nnodes() - 1;
+ this->id_ = this->p_ref_.pg().gr_->nnodes() - 1;
}
template <typename P, typename N>
@@ -423,60 +276,7 @@
void
graph_neighborhood_bkd_piter<P, N>::step_()
{
- --id_;
- }
-
-
- template <typename P, typename N>
- inline
- bool
- graph_neighborhood_bkd_piter<P, N>::adjacent_to_p_ref_() const
- {
- return p_ref_.pg().adjacent(p_ref_.id(), id_);
- }
-
- template <typename P, typename N>
- inline
- void
- graph_neighborhood_bkd_piter<P, N>::update_()
- {
- // Update psite_.
- psite_ = graph_psite<P>(p_ref_.pg(), id_);
- // Update p_.
- p_ = p_ref_.pg().gr_->node_data(id_);
- }
-
- template <typename P, typename N>
- inline
- const P&
- graph_neighborhood_bkd_piter<P, N>::to_point() const
- {
- return p_;
- }
-
- template <typename P, typename N>
- inline
- const graph_psite<P>&
- graph_neighborhood_bkd_piter<P, N>::to_psite() const
- {
- return psite_;
- }
-
- template <typename P, typename N>
- inline
- graph_neighborhood_bkd_piter<P, N>::operator graph_psite<P>() const
- {
- mln_precondition(is_valid());
- return psite_;
- }
-
- template <typename P, typename N>
- inline
- mln_coord(P)
- graph_neighborhood_bkd_piter<P, N>::operator[](unsigned i) const
- {
- assert(i < dim);
- return p_[i];
+ --this->id_;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/graph_window_piter.hh
--- mln/core/graph_window_piter.hh (revision 1891)
+++ mln/core/graph_window_piter.hh (working copy)
@@ -42,9 +42,7 @@
- mln::line_graph_window_bkd_piter
- mln::line_graph_neighborhood_bkd_piter. */
-# include <mln/core/concept/point_iterator.hh>
-# include <mln/core/p_graph.hh>
-# include <mln/core/graph_psite.hh>
+# include <mln/core/internal/graph_vicinity_piter.hh>
/* FIXME: Due to the poor interface of mln::p_graph and
mln::util::graph, we show to much implementation details here.
@@ -52,9 +50,34 @@
namespace mln
{
- // Fwd decls.
- template <typename P> class p_graph;
- template <typename P> class graph_psite;
+
+ /*-----------------------------------------.
+ | internal::graph_window_piter_<P, W, E>. |
+ `-----------------------------------------*/
+
+ namespace internal
+ {
+
+ /// \brief Base for iterator on a graph window.
+ template <typename P, typename W, typename E>
+ class graph_window_piter_ : public graph_vicinity_piter_<P, E>
+ {
+ typedef graph_window_piter_<P, W, E> self_;
+ typedef graph_vicinity_piter_<P, E> super_;
+
+ public:
+ /// Construction.
+ /// \{
+ template <typename Pref>
+ graph_window_piter_(const Window<W>& win, const Point_Site<Pref>& p_ref);
+ /// \}
+
+ protected:
+ /// The window.
+ const W& win_;
+ };
+
+ } // end of namespace mln::internal
/*-------------------------------.
@@ -64,21 +87,10 @@
/// \brief Forward iterator on graph window.
template <typename P, typename W>
class graph_window_fwd_piter :
- public Point_Iterator< graph_window_fwd_piter<P, W> >
+ public internal::graph_window_piter_< P, W, graph_window_fwd_piter<P, W> >
{
typedef graph_window_fwd_piter<P, W> self_;
- typedef Point_Iterator< self_ > super_;
-
- public:
- enum { dim = P::dim };
-
- typedef graph_psite<P> psite;
- typedef P point;
- typedef mln_coord(P) coord;
- // FIXME: Dummy typedef.
- typedef void dpoint;
- // FIXME: Dummy value.
- typedef void mesh;
+ typedef internal::graph_window_piter_<P, W, self_> super_;
public:
/// Construction.
@@ -89,55 +101,19 @@
/// Manipulation.
/// \{
- /// Test if the iterator is valid.
- bool is_valid() const;
- /// Invalidate the iterator.
- void invalidate();
/// Start an iteration.
void start();
-
/// Go to the next point.
void next_();
- /// Is the piter adjacent or equal to the reference point?
- bool adjacent_or_equal_to_p_ref_() const;
- /// Update the internal data of the iterator.
- void update_();
- /// \}
-
- /// Conversion and accessors.
- /// \{
- /// Reference to the corresponding point.
- const point& to_point() const;
- /// Reference to the corresponding point site.
- const psite& to_psite() const;
- /// Convert the iterator into a line graph psite.
- operator psite() const;
-
- /// Read-only access to the \a i-th coordinate.
- coord operator[](unsigned i) const;
/// \}
/// Internals, used by the window.
/// \{
- public:
/// Set the iterator to the first site of the graph.
void first_();
/// Advance the position of the iterator by one step.
void step_();
-
- /// An internal iterator on the set of nodes of the underlying graph.
- util::node_id id_;
/// \}
-
- private:
- /// The window.
- const W& win_;
- /// The ``central'' psite of the window.
- const psite& p_ref_;
- /// The psite corresponding to this iterator.
- psite psite_;
- /// The point corresponding to this iterator.
- point p_;
};
@@ -148,21 +124,10 @@
/// \brief Backward iterator on graph window.
template <typename P, typename W>
class graph_window_bkd_piter :
- public Point_Iterator< graph_window_bkd_piter<P, W> >
+ public internal::graph_window_piter_< P, W, graph_window_bkd_piter<P, W> >
{
typedef graph_window_bkd_piter<P, W> self_;
- typedef Point_Iterator< self_ > super_;
-
- public:
- enum { dim = P::dim };
-
- typedef graph_psite<P> psite;
- typedef P point;
- typedef mln_coord(P) coord;
- // FIXME: Dummy typedef.
- typedef void dpoint;
- // FIXME: Dummy value.
- typedef void mesh;
+ typedef internal::graph_window_piter_<P, W, self_> super_;
public:
/// Construction.
@@ -173,94 +138,56 @@
/// Manipulation.
/// \{
- /// Test if the iterator is valid.
- bool is_valid() const;
- /// Invalidate the iterator.
- void invalidate();
/// Start an iteration.
void start();
-
/// Go to the next point.
void next_();
- /// Is the piter adjacent or equal to the reference point?
- bool adjacent_or_equal_to_p_ref_() const;
- /// Update the internal data of the iterator.
- void update_();
- /// \}
-
- /// Conversion and accessors.
- /// \{
- /// Reference to the corresponding point.
- const point& to_point() const;
- /// Reference to the corresponding point site.
- const psite& to_psite() const;
- /// Convert the iterator into a line graph psite.
- operator psite() const;
-
- /// Read-only access to the \a i-th coordinate.
- coord operator[](unsigned i) const;
/// \}
/// Internals, used by the window.
/// \{
- public:
/// Set the iterator to the first site of the graph.
void first_();
/// Advance the position of the iterator by one step.
void step_();
-
- /// An internal iterator on the set of nodes of the underlying graph.
- util::node_id id_;
/// \}
-
- private:
- /// The window.
- const W& win_;
- /// The ``central'' psite of the window.
- const psite& p_ref_;
- /// The psite corresponding to this iterator.
- psite psite_;
- /// The point corresponding to this iterator.
- point p_;
};
# ifndef MLN_INCLUDE_ONLY
- /*-------------------------------.
- | graph_window_fwd_piter<P, W>. |
- `-------------------------------*/
+ /*-----------------------------------------.
+ | internal::graph_window_piter_<P, W, E>. |
+ `-----------------------------------------*/
- template <typename P, typename W>
+ namespace internal
+ {
+
+ template <typename P, typename W, typename E>
template <typename Pref>
inline
- graph_window_fwd_piter<P, W>::graph_window_fwd_piter(const Window<W>& win,
+ graph_window_piter_<P, W, E>::graph_window_piter_(const Window<W>& win,
const Point_Site<Pref>& p_ref)
- : win_(exact(win)),
- p_ref_(exact(p_ref).to_psite()),
- // Initialize psite_ to a dummy value.
- psite_(),
- p_()
+ : super_(p_ref),
+ win_(exact(win))
{
- // Invalidate id_.
- invalidate();
}
- template <typename P, typename W>
- inline
- bool
- graph_window_fwd_piter<P, W>::is_valid() const
- {
- return p_ref_.is_valid() && id_ < p_ref_.pg().npoints();
- }
+ } // end of namespace mln::internal
+
+
+ /*-------------------------------.
+ | graph_window_fwd_piter<P, W>. |
+ `-------------------------------*/
template <typename P, typename W>
+ template <typename Pref>
inline
- void
- graph_window_fwd_piter<P, W>::invalidate()
+ graph_window_fwd_piter<P, W>::graph_window_fwd_piter(const Window<W>& win,
+ const Point_Site<Pref>& p_ref)
+ : super_(win, p_ref)
{
- id_ = -1;
}
template <typename P, typename W>
@@ -268,9 +195,9 @@
void
graph_window_fwd_piter<P, W>::start()
{
- win_.start(*this);
- if (is_valid())
- update_();
+ this->win_.start(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename W>
@@ -278,9 +205,9 @@
void
graph_window_fwd_piter<P, W>::next_()
{
- win_.next_(*this);
- if (is_valid())
- update_();
+ this->win_.next_(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename W>
@@ -288,7 +215,7 @@
void
graph_window_fwd_piter<P, W>::first_()
{
- id_ = 0;
+ this->id_ = 0;
}
template <typename P, typename W>
@@ -296,60 +223,7 @@
void
graph_window_fwd_piter<P, W>::step_()
{
- ++id_;
- }
-
-
- template <typename P, typename W>
- inline
- bool
- graph_window_fwd_piter<P, W>::adjacent_or_equal_to_p_ref_() const
- {
- return p_ref_.pg().adjacent_or_equal(p_ref_.id(), id_);
- }
-
- template <typename P, typename W>
- inline
- void
- graph_window_fwd_piter<P, W>::update_()
- {
- // Update psite_.
- psite_ = graph_psite<P>(p_ref_.pg(), id_);
- // Update p_.
- p_ = p_ref_.pg().point_from_id(id_);
- }
-
- template <typename P, typename W>
- inline
- const P&
- graph_window_fwd_piter<P, W>::to_point() const
- {
- return p_;
- }
-
- template <typename P, typename W>
- inline
- const graph_psite<P>&
- graph_window_fwd_piter<P, W>::to_psite() const
- {
- return psite_;
- }
-
- template <typename P, typename W>
- inline
- graph_window_fwd_piter<P, W>::operator graph_psite<P>() const
- {
- mln_precondition(is_valid());
- return psite_;
- }
-
- template <typename P, typename W>
- inline
- mln_coord(P)
- graph_window_fwd_piter<P, W>::operator[](unsigned i) const
- {
- assert(i < dim);
- return p_[i];
+ ++this->id_;
}
@@ -362,30 +236,8 @@
inline
graph_window_bkd_piter<P, W>::graph_window_bkd_piter(const Window<W>& win,
const Point_Site<Pref>& p_ref)
- : win_(exact(win)),
- p_ref_(exact(p_ref).to_psite()),
- // Initialize psite_ to a dummy value.
- psite_(),
- p_()
- {
- // Invalidate id_.
- invalidate();
- }
-
- template <typename P, typename W>
- inline
- bool
- graph_window_bkd_piter<P, W>::is_valid() const
- {
- return p_ref_.is_valid() && id_ < p_ref_.pg().npoints();
- }
-
- template <typename P, typename W>
- inline
- void
- graph_window_bkd_piter<P, W>::invalidate()
+ : super_(win, p_ref)
{
- id_ = -1;
}
template <typename P, typename W>
@@ -393,9 +245,9 @@
void
graph_window_bkd_piter<P, W>::start()
{
- win_.start(*this);
- if (is_valid())
- update_();
+ this->win_.start(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename W>
@@ -403,9 +255,9 @@
void
graph_window_bkd_piter<P, W>::next_()
{
- win_.next_(*this);
- if (is_valid())
- update_();
+ this->win_.next_(*this);
+ if (this->is_valid())
+ this->update_();
}
template <typename P, typename W>
@@ -413,7 +265,7 @@
void
graph_window_bkd_piter<P, W>::first_()
{
- id_ = p_ref_.pg().gr_->nnodes() - 1;
+ this->id_ = this->p_ref_.pg().gr_->nnodes() - 1;
}
template <typename P, typename W>
@@ -421,60 +273,7 @@
void
graph_window_bkd_piter<P, W>::step_()
{
- --id_;
- }
-
-
- template <typename P, typename W>
- inline
- bool
- graph_window_bkd_piter<P, W>::adjacent_or_equal_to_p_ref_() const
- {
- return p_ref_.pg().adjacent_or_equal(p_ref_.id(), id_);
- }
-
- template <typename P, typename W>
- inline
- void
- graph_window_bkd_piter<P, W>::update_()
- {
- // Update psite_.
- psite_ = graph_psite<P>(p_ref_.pg(), id_);
- // Update p_.
- p_ = p_ref_.pg().point_from_id(id_);
- }
-
- template <typename P, typename W>
- inline
- const P&
- graph_window_bkd_piter<P, W>::to_point() const
- {
- return p_;
- }
-
- template <typename P, typename W>
- inline
- const graph_psite<P>&
- graph_window_bkd_piter<P, W>::to_psite() const
- {
- return psite_;
- }
-
- template <typename P, typename W>
- inline
- graph_window_bkd_piter<P, W>::operator graph_psite<P>() const
- {
- mln_precondition(is_valid());
- return psite_;
- }
-
- template <typename P, typename W>
- inline
- mln_coord(P)
- graph_window_bkd_piter<P, W>::operator[](unsigned i) const
- {
- assert(i < dim);
- return p_[i];
+ --this->id_;
}
# endif // ! MLN_INCLUDE_ONLY
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Alexandre Abraham <abraham(a)lrde.epita.fr>
Add comments and a max function.
* sandbox/abraham/morpho/basic_najman.hh:
(mln::morpho::basic_najman::max) New .
* sandbox/abraham/morpho/test_component_tree.cc: .
* sandbox/abraham/morpho/test_watershed.cc: .
basic_najman.hh | 2 +-
test_watershed.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: sandbox/abraham/morpho/basic_najman.hh
Index: sandbox/abraham/morpho/test_watershed.cc
--- sandbox/abraham/morpho/test_watershed.cc (revision 1891)
+++ sandbox/abraham/morpho/test_watershed.cc (working copy)
@@ -33,7 +33,7 @@
// #define TEST
// io::pgm::load(input, "./images/test_watershed.pgm");
- io::pgm::load(input, "./images/test_2.pgm");
+ io::pgm::load(input, "./images/test_3.pgm");
// io::pgm::load(input, "./images/lena_light.pgm");
// io::pgm::load(mverif, "./images/result_m_watershed.pgm");
// io::pgm::load(wverif, "./images/result_topo_watershed.pgm");
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Alexandre Abraham <abraham(a)lrde.epita.fr>
Clean and comment code.
* sandbox/abraham/morpho/basic_najman.hh:
(mln::morpho::basic_najman::go) Increment image before
computing component tree;
(mln::morpho::basic_najman::BuildComponentTree) Remove
useless brackets
(mln::morpho::basic_najman::highest_fork) Really look
for the min at beginning
(mln::morpho::basic_najman::w_watershed) Really compute
min and max, add comments.
* sandbox/abraham/morpho/images/test_watershed.pgm: .
* sandbox/abraham/morpho/test_watershed.cc: .
basic_najman.hh | 190 ++++++++++++++++++++++++++++++++----------------------
test_watershed.cc | 8 +-
2 files changed, 118 insertions(+), 80 deletions(-)
Index: sandbox/abraham/morpho/basic_najman.hh
--- sandbox/abraham/morpho/basic_najman.hh (revision 1889)
+++ sandbox/abraham/morpho/basic_najman.hh (working copy)
@@ -2,13 +2,11 @@
#include <mln/level/fill.hh>
#include <mln/core/image2d.hh>
#include <mln/core/p_set.hh>
-//#include <mln/util/greater_psite.hh>
+#include <mln/estim/min_max.hh>
+
#include <queue>
#include <set>
-#define MOINS_UN
-
-
namespace mln
{
@@ -43,7 +41,6 @@
}; // struct node
I pima;
- const Image<I>& ima;
const Neighborhood<N>& nbh;
mln_ch_value(I, psite) Par_node;
mln_ch_value(I, psite) Par_tree;
@@ -57,10 +54,10 @@
p_array<mln_psite(I)> S;
// std::map<psite,psite> M; // to keep the root of any point.
+ // Ctor
basic_najman(const Image<I>& i,
const Neighborhood<N>& n)
: pima(exact(i)),
- ima(i),
nbh(n),
Par_node(exact(i).domain(), exact(i).border()),
Par_tree(exact(i).domain(), exact(i).border()),
@@ -72,7 +69,6 @@
{
}
-
void MakeSet_tree(psite x)
{
Par_tree(x) = x;
@@ -108,15 +104,24 @@
void go()
{
+ mln_piter(I) p (pima.domain());
+ for_all(p)
+ pima(p) = pima(p) + 1;
+
init();
+
BuildComponentTree();
+
+ for_all(p)
+ pima(p) = pima(p) - 1;
+
}
void init()
{
// Sort the points in increasing order
- S = level::sort_psites_increasing(ima);
+ S = level::sort_psites_increasing(pima);
// Clear the marker map
level::fill(isproc, false);
@@ -128,42 +133,39 @@
// if (subtreeRoot.hold(p))
subtreeRoot(p) = p;
// if (nodes.hold(p))
- nodes(p) = MakeNode(exact(ima)(p));
+ nodes(p) = MakeNode(pima(p));
}
}
void BuildComponentTree()
{
- for (int ip = 0; ip < int(S.npoints()); ++ip)
+ p_array<mln_psite(I)>::fwd_piter ip(S);
+ for_all(ip)
{
- psite p = S[ip];
+ psite p = ip.to_point();
- psite curTree = Find_tree(p);
- psite curNode = Find_node(subtreeRoot(curTree));
+ psite curCanonicalElt = Find_tree(p);
+ psite curNode = Find_node(subtreeRoot(curCanonicalElt));
mln_niter(N) q(nbh, p);
-
for_all(q)
- if (exact(ima).has(q) and isproc(q) and exact(ima)(q) <= exact(ima)(p))
+ if (pima.has(q) and isproc(q) and pima(q) <= pima(p))
{
- psite adjTree = Find_tree(q);
- psite adjNode = Find_node(subtreeRoot(adjTree));
+ psite adjCanonicalElt = Find_tree(q);
+ psite adjNode = Find_node(subtreeRoot(adjCanonicalElt));
if (curNode != adjNode)
- {
if (nodes(curNode).level == nodes(adjNode).level)
- {
curNode = MergeNode(adjNode, curNode);
- }
else
{
nodes(curNode).addChild(adjNode);
nodes(curNode).area += nodes(adjNode).area;
nodes(curNode).highest += nodes(adjNode).highest;
}
- }
- curTree = Link_tree(adjTree, curTree);
- subtreeRoot(curTree) = curNode;
+
+ curCanonicalElt = Link_tree(adjCanonicalElt, curCanonicalElt);
+ subtreeRoot(curCanonicalElt) = curNode;
}
isproc(p) = true;
}
@@ -323,7 +325,8 @@
psite min = components[0];
for_all(it)
- if (nodes(it.to_point()).level > nodes(min).level)
+ // if (nodes(it.to_point()).level < nodes(min).level)
+ if (pima(it.to_point()) < pima(min))
min = it.to_point();
return min;
@@ -332,15 +335,20 @@
psite highest_fork (p_set<psite>& components)
{
if (components.npoints() == 0)
+ {
+ std::cerr << "highest fork : empty set" << std::endl;
return psite(-1, -1);
+ }
- psite hfork = components[0], min = hfork;
- typename p_set<psite>::fwd_piter it(components);
+ psite
+ hfork = components[0],
+ m = min(components);
+ typename p_set<psite>::fwd_piter it(components);
for_all(it)
hfork = lca(hfork, it.to_point());
- if (nodes(min).level == nodes(hfork).level)
+ if (nodes(m).level == nodes(hfork).level)
return psite(-1, -1);
return hfork;
@@ -352,7 +360,7 @@
p_set<psite> v;
for_all(q)
- if (exact(pima).has(q) && exact(pima)(q) < exact(pima)(p))
+ if (pima.has(q) && pima(q) < pima(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
@@ -363,7 +371,7 @@
if (hf == psite(-1, -1))
return min(v);
- if (nodes(hf).level <= exact(ima)(p))
+ if (nodes(hf).level <= pima(p))
return hf;
return psite(-1, -1);
@@ -375,7 +383,7 @@
p_set<psite> v;
for_all(q)
- if (exact(pima).has(q) && exact(pima)(q) < exact(pima)(p))
+ if (pima.has(q) && pima(q) < pima(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
@@ -405,7 +413,7 @@
// Clear the marker map
level::fill(isproc, false);
- mln_piter(I) it(exact(ima).domain());
+ mln_piter(I) it(pima.domain());
for_all(it)
if (m_destructible(it.to_point()) != psite(-1, -1))
@@ -417,23 +425,30 @@
psite p, i;
while (!l.empty())
{
+ // Extract priority queue
p = l.top();
l.pop();
+
+ // unmark p
isproc(p) = false;
i = m_destructible(p);
if (i != psite(-1, -1))
{
- pima(p) = nodes(i).level MOINS_UN ;
+ pima(p) = nodes(i).level - 1 ;
Par_node(p) = i;
- mln_niter(N) q(nbh, p);
+ // isproc(p) = true;
+ mln_niter(N) q(nbh, p);
for_all(q)
- if (exact(pima).has(q) && !isproc(q))
+ if (pima.has(q) && !isproc(q))
if (m_destructible(q) != psite(-1, -1))
{
+ // Add priority queue
l.push(q);
+
+ // mark q
isproc(q) = true;
}
}
@@ -442,67 +457,89 @@
void w_watershed()
{
- std::vector< std::set<psite> > L(255);
- // TODO : replace int with the type of value
- I K(exact(ima).domain(), exact(ima).border());
- mln_ch_value(I, psite) H(exact(ima).domain(), exact(ima).border());
-
- mln_piter(I) it(exact(ima).domain());
+ std::map< mln_value(I), std::set<psite> > L;
- // mln_value(I) max = 0;
+ // Setting the min and the max of the image
+ mln_value(I) k, kmin, kmax;
+ mln::estim::min_max(pima, kmin, kmax);
+
+ // For k From kmin to kmax - 1 Do Lk <- <empty set>
+ for (k = kmin; k < kmax; k++)
+ L[k] = std::set<psite>();
+
+ // I K(pima.domain(), pima.border());
+ mln_ch_value(I, int) K(pima.domain(), pima.border());
+ mln_ch_value(I, psite) H(pima.domain(), pima.border());
- psite i;
+ // For All p of E do
+ mln_piter(I) it(pima.domain());
for_all(it)
{
psite p = it.to_point();
- i = w_destructible(p);
+ // i <- W-Destructible(p)
+ psite i = w_destructible(p);
+
+ // If i != inf then
if (i != psite(-1, -1))
{
- // if (max < nodes(i).level)
- // max = nodes(i).level;
- L[nodes(i).level MOINS_UN].insert(p);
- K(p) = nodes(i).level MOINS_UN;
+ L[nodes(i).level - 1].insert(p);
+ K(p) = nodes(i).level - 1;
H(p) = i;
}
}
- mln_value(I) k = 0;
-
- typename std::vector< std::set<psite> >::iterator n;
- for( n = L.begin(); n != L.end(); n++, k++ )
+ for (k = kmin; k < kmax; k++)
{
+ std::set<psite>& Lk = L[k];
- // to avoid looping on max
- // if (k + 1 == max)
- // break;
-
- while (!n->empty())
+ while (!Lk.empty())
{
- psite p = *(n->begin());
- n->erase(p);
- // mln_value(I) k = nodes(p).level;
+ psite p = *(Lk.begin());
+ Lk.erase(p);
- if (K(p) == k)
+ if (K(p) == (int) k)
{
pima(p) = k;
Par_node(p) = H(p);
mln_niter(N) q(nbh, p);
for_all(q)
- if (exact(pima).has(q) && k < pima(q))
+ if (pima.has(q) && k < pima(q))
{
- psite j = w_destructible(q);
- if (j == psite(-1, -1))
- K(q) = 255;
+ psite i = w_destructible(q);
+ if (i == psite(-1, -1))
+ K(q) = 10000;
else
- if (K(q) != nodes(j).level MOINS_UN)
+ if (K(q) != nodes(i).level - 1)
{
- n->insert(q);
- K(q) = nodes(j).level MOINS_UN;
- H(q) = j;
+ L[nodes(i).level - 1].insert(q);
+ K(q) = nodes(i).level - 1;
+ H(q) = i;
}
}
+
+
+
+ if (pima.has(p) && k < pima(p))
+ {
+
+ std::cout << "cas improbable" << std::endl;
+
+ psite i = w_destructible(p);
+ if (i == psite(-1, -1))
+ K(p) = 255;
+ else
+ if (K(p) != nodes(i).level - 1)
+ {
+ L[nodes(i).level - 1].insert(p);
+ K(p) = nodes(i).level - 1;
+ H(p) = i;
+ }
+ }
+
+
+
}
}
}
@@ -513,3 +550,4 @@
}; // namespace morpho
}; // namespace mln
+
Index: sandbox/abraham/morpho/images/test_watershed.pgm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: sandbox/abraham/morpho/test_watershed.cc
--- sandbox/abraham/morpho/test_watershed.cc (revision 1889)
+++ sandbox/abraham/morpho/test_watershed.cc (working copy)
@@ -30,10 +30,10 @@
image2dint input, mverif, wverif;
- #define TEST
+ // #define TEST
- io::pgm::load(input, "./images/test_watershed.pgm");
- // io::pgm::load(input, "./images/test_3.pgm");
+ // io::pgm::load(input, "./images/test_watershed.pgm");
+ io::pgm::load(input, "./images/test_2.pgm");
// io::pgm::load(input, "./images/lena_light.pgm");
io::pgm::load(mverif, "./images/result_m_watershed.pgm");
io::pgm::load(wverif, "./images/result_topo_watershed.pgm");
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Sandbox: ICP: ck point to xk point distance.
* sandbox/jardonnet/test/icp.cc: Ck point color depends on the distance
with its closest point.
* sandbox/jardonnet/test/length.ppm: Result image.
* sandbox/jardonnet/TODO: Update.
* sandbox/jardonnet/registration/quat7.hh: Minor fix.
* sandbox/jardonnet/registration/icp.hh: Minor fix.
mln/core/dpoint.hh | 1
sandbox/jardonnet/TODO | 2 +
sandbox/jardonnet/registration/quat7.hh | 2 -
sandbox/jardonnet/test/icp.cc | 37 +++++++++++++++++++++++++++++---
4 files changed, 36 insertions(+), 6 deletions(-)
Index: mln/core/dpoint.hh
--- mln/core/dpoint.hh (revision 1888)
+++ mln/core/dpoint.hh (working copy)
@@ -39,7 +39,6 @@
# include <mln/algebra/vec.hh>
# include <mln/metal/converts_to.hh>
-
namespace mln
{
Index: sandbox/jardonnet/test/icp.cc
--- sandbox/jardonnet/test/icp.cc (revision 1888)
+++ sandbox/jardonnet/test/icp.cc (working copy)
@@ -2,6 +2,8 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/pbm/save.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/norm/l2.hh>
#include <sandbox/jardonnet/registration/icp.hh>
#include <sandbox/jardonnet/registration/tools.hh>
@@ -64,17 +66,46 @@
qk.apply_on(c, c, c.npoints());
const box_<point2d> box2d(400,700);
- image2d<bool> output(box2d, 1);
+ image2d<value::rgb8> output(box2d, 1);
+
+
+
+ std::vector<float> length(c.npoints());
+ //mean + length
+ float mean = 0;
+ for (size_t i = 0; i < c.npoints(); i++)
+ {
+ float f = norm::l2(algebra::vec<3,int> (c[i] - map(c[i])));;
+ length[i] = f;
+ mean += f;
+ }
+ mean /= c.npoints();
+ std::cout << mean << std::endl;
+
+ //standar variation
+ float stdev = 0;
+ for (size_t i = 0; i < c.npoints(); i++)
+ stdev += (length[i] - mean) * (length[i] - mean);
+ stdev /= c.npoints();
+ stdev = math::sqrt(stdev);
+ std::cout << stdev << std::endl;
//to 2d : projection (FIXME:if 3d)
for (size_t i = 0; i < c.npoints(); i++)
{
point2d p(c[i][0], c[i][1]);
if (output.has(p))
- output(p) = true;
+ {
+ if (length[i] > 2 * stdev)
+ output(p) = value::rgb8(255,0,0);
+ else if (length[i] > stdev)
+ output(p) = value::rgb8(255,200,0);
+ else
+ output(p) = value::rgb8(255,255,255);
+ }
}
- io::pbm::save(output, "registred.pbm");
+ io::ppm::save(output, "registred.ppm");
}
Index: sandbox/jardonnet/test/length.ppm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: sandbox/jardonnet/test/length.ppm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: sandbox/jardonnet/TODO
--- sandbox/jardonnet/TODO (revision 1888)
+++ sandbox/jardonnet/TODO (working copy)
@@ -19,3 +19,5 @@
trans : vec --> quat
v |-> m = trans(t)
+- -
+io/all.hh cass�
\ No newline at end of file
Index: sandbox/jardonnet/registration/quat7.hh
--- sandbox/jardonnet/registration/quat7.hh (revision 1888)
+++ sandbox/jardonnet/registration/quat7.hh (working copy)
@@ -129,8 +129,6 @@
M& map,
size_t c_length)
{
- //FIXME: mix mu_Xk and qk loop
-
//mu_Xk = center map(Ck)
algebra::vec<P::dim,float> mu_Xk(literal::zero);
for (size_t i = 0; i < c_length; ++i)
Index: sandbox/jardonnet/registration/icp.hh
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Alexandre Abraham <abraham(a)lrde.epita.fr>
W-watershed implemented, dummy tikz output.
* milena/sandbox/abraham/morpho/basic_najman.hh: Fix bugs.
* milena/sandbox/abraham/morpho/images/test_2.pgm: New.
* milena/sandbox/abraham/morpho/images/test_3.pgm: New.
* milena/sandbox/abraham/morpho/images/test_4.pgm: New.
* milena/sandbox/abraham/morpho/tikz.h: New
(mln::io::tikz::save) New, working on 2d grayscale images.
* milena/sandbox/abraham/morpho/test_watershed.cc:
Add tikz output.
* milena/sandbox/abraham/morpho/Makefile: .
Makefile | 2 -
basic_najman.hh | 96 ++++++++++++++++++++++++++++++------------------------
images/test_2.pgm | 5 ++
images/test_3.pgm | 29 ++++++++++++++++
test_watershed.cc | 64 ++++++++++++++++++++++++++++++++----
tikz.h | 37 ++++++++++++++++++++
6 files changed, 184 insertions(+), 49 deletions(-)
Index: milena/sandbox/abraham/morpho/basic_najman.hh
--- milena/sandbox/abraham/morpho/basic_najman.hh (revision 1887)
+++ milena/sandbox/abraham/morpho/basic_najman.hh (working copy)
@@ -6,6 +6,9 @@
#include <queue>
#include <set>
+#define MOINS_UN
+
+
namespace mln
{
@@ -19,7 +22,7 @@
typedef mln_psite(I) psite;
struct node {
- int level;
+ mln_value(I) level;
int area;
int highest;
p_array<mln_psite(I)> children;
@@ -349,8 +352,8 @@
p_set<psite> v;
for_all(q)
- if (exact(ima)(q) < exact(ima)(p))
- v.append(Par_node(q));
+ if (exact(pima).has(q) && exact(pima)(q) < exact(pima)(p))
+ v.insert(Par_node(q));
if (v.npoints() == 0)
return psite(-1, -1);
@@ -372,7 +375,7 @@
p_set<psite> v;
for_all(q)
- if (exact(ima)(q) < exact(ima)(p))
+ if (exact(pima).has(q) && exact(pima)(q) < exact(pima)(p))
v.insert(Par_node(q));
if (v.npoints() == 0)
@@ -422,12 +425,12 @@
if (i != psite(-1, -1))
{
- pima(p) = nodes(i).level ;
+ pima(p) = nodes(i).level MOINS_UN ;
Par_node(p) = i;
mln_niter(N) q(nbh, p);
for_all(q)
- if (!isproc(q))
+ if (exact(pima).has(q) && !isproc(q))
if (m_destructible(q) != psite(-1, -1))
{
l.push(q);
@@ -439,13 +442,15 @@
void w_watershed()
{
- p_array< p_set<psite> > L;
+ std::vector< std::set<psite> > L(255);
// TODO : replace int with the type of value
- mln_ch_value(I, int) K;
- mln_ch_value(I, psite) H;
+ I K(exact(ima).domain(), exact(ima).border());
+ mln_ch_value(I, psite) H(exact(ima).domain(), exact(ima).border());
mln_piter(I) it(exact(ima).domain());
+ // mln_value(I) max = 0;
+
psite i;
for_all(it)
{
@@ -454,19 +459,30 @@
i = w_destructible(p);
if (i != psite(-1, -1))
{
- L[nodes(i).level].insert(p);
- K(p) = nodes(i).level;
+ // if (max < nodes(i).level)
+ // max = nodes(i).level;
+ L[nodes(i).level MOINS_UN].insert(p);
+ K(p) = nodes(i).level MOINS_UN;
H(p) = i;
+ }
+ }
- typename p_array< p_set<psite> >::fwd_piter n(L);
- for_all(n)
+ mln_value(I) k = 0;
+
+ typename std::vector< std::set<psite> >::iterator n;
+ for( n = L.begin(); n != L.end(); n++, k++ )
{
- while (!n.empty())
+
+ // to avoid looping on max
+ // if (k + 1 == max)
+ // break;
+
+ while (!n->empty())
{
- psite p = *n.begin();
- n.erase(p);
- // TODO : replace int with the type of value
- int k = nodes(p).level + 1;
+ psite p = *(n->begin());
+ n->erase(p);
+ // mln_value(I) k = nodes(p).level;
+
if (K(p) == k)
{
pima(p) = k;
@@ -474,16 +490,16 @@
mln_niter(N) q(nbh, p);
for_all(q)
- if (k < pima(q))
+ if (exact(pima).has(q) && k < pima(q))
{
psite j = w_destructible(q);
- if (j != psite(-1, -1))
- K(q) = -1;
+ if (j == psite(-1, -1))
+ K(q) = 255;
else
- if (K(q) != nodes(j).level)
+ if (K(q) != nodes(j).level MOINS_UN)
{
- n.insert(q);
- K(q) = i-1;
+ n->insert(q);
+ K(q) = nodes(j).level MOINS_UN;
H(q) = j;
}
}
@@ -491,10 +507,6 @@
}
}
}
- }
-
- }
-
}; // struct basic_najman
Index: milena/sandbox/abraham/morpho/images/test_2.pgm
--- milena/sandbox/abraham/morpho/images/test_2.pgm (revision 0)
+++ milena/sandbox/abraham/morpho/images/test_2.pgm (revision 0)
@@ -0,0 +1,5 @@
+P5
+# CREATOR: GIMP PNM Filter Version 1.1
+7 6
+255
+3M³fMf³MMÌÌÌfÌ̳æMMæ³f3MfæM
\ No newline at end of file
Index: milena/sandbox/abraham/morpho/images/test_3.pgm
--- milena/sandbox/abraham/morpho/images/test_3.pgm (revision 0)
+++ milena/sandbox/abraham/morpho/images/test_3.pgm (revision 0)
@@ -0,0 +1,29 @@
+P5
+# CREATOR: GIMP PNM Filter Version 1.1
+100 100
+255
+!$(-17=CIPX_gow¡ª²»ÃËÒÙßäèëììëéåáÛÔÍż´¬¥~}|||{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ $(,16<BHOU]dlt|¨±ºÃËÓÚßäèêëêèåàÚÓÌļ´¬¤
~}|||{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{#'+/4:?ELRY`hpx§±ºÃÌÓÚàäçèèæãßÙÓËû³«£
~}|||{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{!%)-27<BHNU\dlu~§±»ÄÍÕÛàäææåâÞÙÒËû³«£
~}|||{{{{{{{{{{{{{{{zzzzzzzzz{{{{{{|||
"&*/38>DJQX`ir|§²½ÇÏ×ÝáãääáÝØÑʺ²ª¢}}||{{{{{{{{{{{{{{zzzzzzzzzz{{{{{{{|||
#'+/49?ELT]fp{ªµÀÉÒØÞáââàÜ×Ñʺ²ª¢~}}||{{{{{{{{{{zzzzzzzzzzzzzz{{{{{{||||
+
+
+
+
#'+05;BIQ[ep|¡®¹ÄÍÔÚÞàáßÛ×Ðɹ±©¢~}||{{{{{{{{{zzzzzzzzzzzzzz{{{{{{||||}}
+
+
+
#',28?GPZfr¦³¾ÈÑ×ÜÞßÞÛÖÐÉÁ¹±©¡~}||{{{{zzzzzzzzzzzzzzzzzz{{{{{{||||}}}
+
+
$)/6>GQ\iv¬¹ÄÍÔÙÜÞÝÚÕÏÈÁ¹±©¡~}|{{{{zzzzzzzzzzzzzzzzzzz{{{{{||||}}}~
+
"'.5>ITan|§´¿ÉÑ×ÛÜÜÙÕÏÈÁ¹±©¡~}|{{{zzzzzzzzzzzzzzzzzzzz{{{{{||||}}}~
+!'.7AMYgv
¢°¼ÆÏÕÙÛÛÙÕÏÈÁ¹±©¡}||{{{zzzzzzzzzzzzzzzzzz{{{{{{||||}}}}~
+")1;GSap¬¸ÄÍÓØÚÚØÔÏÈÁ¹±©¡}||{{zzzzzzzzzzzzzzzzzzz{{{{{{|||}}}~~~
$,6AN\k{¨¶ÁËÒ×ÙÚØÔÏÈÁ¹±©¡}||{{zzzzzzzzzzzzzzzzzz{{{{{{|||}}}~~~
+
)2>JYhx¦´¿ÉÑÖÙÙ×ÔÏÈÁ¹±©¡}||{{zzzzzzzzzzzzzzzzzz{{{{{||||}}}~~~
+ &/;GVeu
¤²¾ÈÐÕØÙ×ÔÏÈÁ¹±©¡}||{{zzzzzzzzzzzzzzzzzz{{{{{||||}}}~~~
+ $-9FTcs£±½ÇÏÕØÙ×ÔÏÈÁ¹±©¢}||{{zzzzzzzzzzzzzzzzz{{{{{{||||}}}}~~~
+ #,8DSbr¢°½ÇÏÕØÙ×ÔÏÉÁº±©¢}||{{zzzzzzzzzzzzzzzzz{{{{{{|||||}}}~~~
+ ",7DRbr¢°½ÇÏÕØÙØÔÏɺ²ª¢}||{{zzzzzzzzzzzzzzzzz{{{{{{|||||}}}}~~
+",7DSbr£±½ÈÐÕØÙØÕÏɺ²ª¢~||{{zzzzzzzzzzzzzzzzz{{{{{{|||||}}}}~~ #-8ETct¤²¾ÈÐÖÙÚØÕÐʺ²ª£~}|{{{zzzzzzzzzzzzzzzz{{{{{{{|||||}}}}}#!
+
+
%/:GVeu¥³¿ÉÑ×ÚÚÙÕÐÊû³«£~}|{{{zzzzzzzzzzzzzzzz{{{{{{{|||||}}}}},)&#
+ '1=JXhx§µÁËÒØÛÛÚÖÑËü´«¤~}|{{{zzzzzzzzzzzzzzzz{{{{{{{{|||||||}}62/+'$
+
+
+"*4@M\k{ª·ÃÌÔÙÜÜÚ×ÒËļ´¬¤
~}|{{{zzzzzzzzzzzzzzzz{{{{{{{{{|||||||}A=950,($
&/9ER`pºÅÏÖÛÝÝÜØÓÍŽµ¦
}||{{{zzzzzzzzzzzzzzzz{{{{{{{{{{{|||||MIE@;61-($!$+4>JWfu£±½ÈÑØÜßßÝÙÔÎÆ¾¶®¦~}|{{{zzzzzzzzzzzzzzzz{{{{{{{{{{{{{|||[VQLFA<72-)%"$*1:EP^l{§µÁËÔÚÞààÞÚÕÏÈÀ¸°¨ ~}|{{{zzzzzzzzzzzzzzzz{{{{{{{{{{{{{|||id^YSMGB<73.+'$" !#'+19BLXes¹ÅÏ×ÜàââàÜ×Ñɺ²ª¢
}||{{{zzzzzzzzzzzzzz{{{{{{{{{{{{{{{||wrlg`ZTNHC>951.+)(''(),/4:BKUam{¥²¾ÉÒÚßâäãáÝØÒËû³«¤~}||{{{{zzzzzzzzzzz{{{{{{{{{{{{{{{{{{
ztnhb[UPJEA=964221236:>ELU_kw¬¸ÄÎÖÝâåæåãßÚÔÍÆ¾¶®¦ ~}||{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{|vpic]WRMIFC@>==>?BEJPX`ju§³¿ÉÒÚàåçèçåáÜÖÐÈÀ¹±©¢~}}|||{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ }wqke`[WSPNLKJKLORW]dmv¤¯»ÅÏ×ÞäèêêéçäßÙÒËü´¬¥
~}}|||||{{{{{{{{{{{{{{{{{{{|||||||¬§¢
ytojfb_\[YYY[]aekrz¢¸ÂÌÕÜâçêìíìéæáÛÕÎÆ¿·°©¢
~~}}}|||||||||||||||||||||||||||¶²¨£}xtqnkjhhhjloty£·ÀÊÒÚáæêíïïîëèãÞØÑÊû´¦ ~~~}}}}}||||||||||||||||}}}}}}¾º¶±¬§¢}{yxxxy|¥®·ÀÉÑÙßåêíðññðíêæáÛÔÍÆ¿¸±ª¤
~~~~~}}}}}}}}}}}}}}}~~~~~ÃÀ¼¸´°«§£¢©±¸ÁÉÐØÞäéíðòóóñïìèãÞØÑÊüµ¯©£~~~~~~~~~~ÇÄÁ½º¶³¯¬¨¥¢¤©®µ»ÂÉÐ×ÝãèìðòôõôóñîêæáÛÕÎÇÁº³¨£
ÈÅÂÀ½º·´²¯«©§¥¤£¢¢¢£¤¦©¬°´¹¿ÅËÑ×ÝãçìïòôöööôóðìèãÞØÒÌÅ¿¸²¨£
ÆÄÂÀ½»¹·¶´³±°¯®®®®°±´·º¾ÃÈÍÒØÝâçëïòôö÷÷÷öôñîêæáÛÕÏÉý·²¨¤
ÂÁ¿½¼º¹¸·¶¶µµµµµµµµ¶·¹º½¿ÃÆÊÏÓØÜáåêíðóõ÷÷ø÷öõòïìèãÞØÓÍÇÁ¼¶²©¥¢½»º¹¸·¶¶¶¶¶··¸¸¹º»¼½¾¿ÁÃÆÉÌÐÓ×Üàäèëïñôö÷øøø÷õóðíéäßÚÕÏÊÅÀ»¶²®«¨¥£ ¶´³³²²²²³´µ¶·¸º»¼½¿ÀÂÃÅÇÊÌÏÒÖÚÝáåèìïñôõ÷÷ø÷öõóðíéåàÛÖÑÌǾº¶³°ª¨¦¥£¢ ¬¬«««¬®¯±³µ¶¸º¼¾¿ÁÃÄÆÈËÍÐÓÖÚÝáäèëîðóôö÷÷ööôòïìéäàÛ×ÒÍÉÄÀ½¹¶´±¯®¬«©¨§¦¥¤£¡ ¤¤££££¤¦§©«°²µ·¹»½¿ÁÃÅÇÉÌÏÒÕØÛßâåéìîñóôõõõôóñîëçãßÚÖÑÍÉÅÁ¾»¹·µ´²±°¯®¬«ª©¨§¦¥¤£¢¡¡ ¡¡¡¡¢¢¡¤§©¬¯²´¶¹»½¿ÁÃÆÈËÎÑÔ×ÛÞâåèëîðòóóóòñïìèäàÜ×ÓÏËÇÃÀ¾¼º¸··¶µµµ´´³³²±°°¯®¬«ª©©¨¨¨§§§¨¨¨¨¨©©©©ª¢¥¨«°²µ·¹»¾ÀÂÅÈËÎÒÖÙÝáäèêíïðññðîìéåáÝØÓÏËÇÃÀ¾¼º¹¸¸¸¸¸¹¹¹¹¹¹¹¸¸··¶µ´³²²±°°°°°°°°°°±±±²²²¢¥¨«¯²´¶¹»¾ÁÄÇËÏÓ×ÛßãæéëíîííëèåáÜ×ÓÎÉÅÁ¾»¹¸····¸¹º»¼½¾¿¿¿¿¿¿¾¾½¼¼»º¹¹¹¸¸¸¸¸¸¸¹¹¹ººº»~
¢¤¦©«°²µ¸¼¿ÃÇÌÐÕÙÝáäçéêêéçäàÛÖÑÌǽº·´³²²²³´¶¸º¼¾¿ÁÂÄÅÅÆÆÆÅÅÄÄÃÂÂÁÁÁÀÀÀÀÀÁÁÁÂÂÂÃÃwwwwwxz{}
¢¤¦©¬¯²¶º¿ÃÈÍÒ×ÜßâäææäâßÛÖÐÊÄ¿ºµ±®¬«ª«¬®°²µ¸»½ÀÃÅÇÉÊËÌÌÍÌÌÌËËÊÊÉÉÉÈÈÈÈÈÉÉÉÊÊÊÊpppppqrtvxz}
¢¥¨¬±µ»ÀÆËÐÕÚÝßááßÝÙÔÏɼ¶°«§¤¢¡¡¢¤¦©¬°´¸¼¿ÃÆÉÌÎÐÑÒÓÓÓÓÓÒÒÑÑÐÐÐÐÐÐÐÐÐÑÑÑÒÒjiijjklmoqsuwz|£§¬²¸¾ÄÊÏÔØÚÜÜÚØÓÎÈÁº³¬¦¡¡¥©®³¸½ÁÆÊÍÐÓÕרÙÙÙÙÙÙØØ×××ÖÖÖÖÖ×××רØeeeeefghiklnpsuwy{}
£©¯¶¼ÃÈÎÒÕ××ÕÒÍÇÀ¹±©¢¡§³¸¾ÃÈÍÑÕØÚÜÝÞßßÞÞÞÝÝÜÜÜÜÛÛÜÜÜÜÝÝÝ````aabcdeghjlnprsuwxz|~
§®µ¼ÂÈÌÐÑÑÐÌÇÁ¹±¨
¥¬²¹ÀÆËÑÕÙÜßáâããããââááààààßßßààààà]]]]]]^_`abcefhikmnoqrtvxz|¦®µ¼ÂÇÊÌÌÊÆÁº²©zvtstvy}¤¬³»ÂÉÏÔÙÝàãäæææææååääãããââââããããZZZZZ[[\\]^_abcdfghiklmoqsux|
§¯¶¼ÁÅÇÇÅÁ»³«¡|uplihiknrw}£¬´½ÄÌÒØÝáäæèèééèèççæååäääääääääYXXXXYYYZ[[\]^_`abcdefgijloquy~¡©°·½ÀÂÂÀ¼µ¤
|slfb_^^`cglry¤®·¿ÈÏÖÛàäæèéêêêéèèçæåååääääääåWWWWWWWXXXYZZ[\]]^_`abcdegilosx~
¤¬²¸¼¾¾¼·°¨~tkc]XUTTUX\ahov¦°ºÃËÓÙÞãæèêêêêêéèçæååääääääääVVVVVVVVWWWXXYYZ[[\]]^_`acegkosy§®´¸ºº·³¬£wmd\UPMKKLOSX^emu©´½ÇÏÖÜáåèéêêêéèçæåääããâââââãUUUUUUUUUVVVWWWXXYYZZ[\]^_adgkou|¤«±µ··´¯¨}rg]UNIFDCDGJOU\dmv¢¸ÂËÓÚßãæèéééèçæåäãâááàààààáTTTTTTTUUUUUVVVWWWXXXYZZ[]_adhlry¡¨®²´´±«¤
ymbXPIC@>=>@CGMT[dny§³½ÇÏ×ÝáäæçèççåäãâáàßßÞÞÞÞÞÞTTTTTTTTTTTUUUUUVVVWWWXYZ[]_bfjpv~¦¬°²±®©¡ui^TKD?;888:=AFMT]gr}¢®¹ÃÌÔÚßãåæææåäâáàÞÝÝÜÜÜÛÛÜÜTTTTTTTTTTTTTTTUUUUUVVVWXY[]`dhnt|¤ª®°¯¬§rf[QHA;753458<AGNWalw©µ¿ÉÑØÝàãäääãâàßÝÜÛÚÚÙÙÙÙÙÙTTTTSSSSSSTTTTTTTTTUUUVVWXZ\_bgmsz£¨®®«¥|pdYNF>84100147<BIR\fr¥±¼ÆÏÕÛÞáâââáàÞÝÛÚÙØØ××××××TTTTSSSSSSSSSTTTTTTTTUUVVXY[^bflry¢¨¬®ª¤{ocWMD=72/../149?FNXcn{¢®ºÄÌÓÙÝßááàßÞÜÛÙØ×ÖÕÕÔÔÔÔÔTTSSSSSSSSSSSSSSTTTTTTUUVWY[^afkry¡§«©¤{nbWLC;51.,,-/26<CKU`lx
¬¸ÂËÒ×ÛÞßßßÞÜÚÙ×ÖÕÔÓÓÓÒÒÒÒTTSSSSSSSSSSSSSSSTTTTTUUVWY[]afkry¡§«¬©¤{nbVLC;50-++,.15;AJS^jw«¶ÁÉÑÖÚÜÞÞÝÜÚÙ×ÖÕÓÓÒÑÑÑÑÑÑTTSSSSSSSSSSSSSSSSSSTTTUVWXZ]aekqy¡§«ª¤{ocWMD<61.,+,-05:AJS^jv«¶ÀÉÐÕÙÛÜÜÜÛÙ×ÖÔÓÒÑÐÐÐÏÏÏÏTTSSSSSSSSSSSSSSSSSSSTTTUVXZ]aekqy¢¨¬®ª¥}pdYNE=72/-,-.16;BJT_jw«¶ÀÉÏÕØÚÛÛÛÙØÖÕÓÒÑÐÏÏÎÎÎÎÎTSSSSSSSSSSSSSSSSSSSSTTTUVXZ]aekqy¢¨¯¯¬§sg[QG@941/..038=DLVamy ¬·ÁÉÐÔØÚÛÛÚØ×ÕÔÒÑÐÏÎÎÎÎÍÍÍTSSSSSSSSSSSSSSSSSSSSTTTUVXZ]aekry£©®°°®©¡vj_TKC<7421136;@GOYdo|¢®¸ÂÉÐÔØÙÚÚÙØÖÔÓÑÐÏÏÎÎÍÍÍÍÍTSSSSSSSSSSSSSSSSSSSSTTTUVXZ]afkry¤ª¯²²°«¤zncYOGA<86568;?ELT^ht¥°ºÃÊÐÕ×ÙÙÙØ×ÕÔÒÑÐÏÎÍÍÍÍÌÌÌTSSSSSSSSSSSSSSSSSSSTTTUVWXZ]aflrz¥«±´´³®¨ ti^UMGA><;;=@EJRZcny
¨³½ÅÌÑÕØÙÙØ×ÖÔÓÑÐÏÎÍÍÍÌÌÌÌÌTSSSSSSSSSSSSSSSSTTTTTTUVWY[^aflsz¦²¶·¶²¬¤
zoe\TMHEBBBDGLQXajt¢¬¶¿ÇÍÒÕØÙÙØ×ÕÔÒÑÐÏÎÍÍÌÌÌÌÌÌTTTSSSSSSSSSSTTTTTTTTTUUVWY[^bgms{§¯´¸º¹¶±ª¡wmd\VQMKJKLPTZair|§±ºÂÉÏÓÖרØ×ÖÕÓÒÐÏÎÎÍÍÌÌÌÌÌÌTTTTTTTTTTTTTTTTTTTTTUUVWXY\_cgmt|
©±·»½½º¶¯§vmf_ZWTSTVY]cjrz¢¬µ¾ÅËÐÔÖØØØ×ÕÔÓÑÐÏÎÍÍÌÌÌÌÌÌÌTTTTTTTTTTTTTTTUUUUUUUVVWYZ]`chnu}¢«²¹¾ÀÁ¿»µ®¥wpjea_^_adhmt{©²ºÁÈÍÑÔÖ×××ÖÕÓÒÑÏÎÎÍÍÌÌÌÌÌÍÍUUUTTTUUUUUUUUUUUVVVVVWWXZ[^aejov~¤µ¼ÁÄÅÄÁ¼µ¥{uqmkjklosy§¯·¾ÅËÏÒÕÖ××ÖÕÔÒÑÐÏÎÍÌÌÌÌÌÌÌÌÍUUUUUUUUUVVVVVVVVWWWWWXYY[]_bfkqx¥¯·¾ÄÇÉÈÆÂ¼µ®¥}zxwwy|¦®µ¼ÃÈÍÑÓÕÖÖÖÕÔÓÑÐÏÎÍÍÌÌÌÌÌÌÌÌÍVVVVVVVWWWWWWXXXXXXYYYZZ[]^adhmsz¨±ºÁÇËÍÍÌÈľ·¯¨
¡¨¯µ¼ÁÇËÏÒÔÕÖÖÕÔÓÒÑÐÏÎÍÌÌÌÌÌÌÌÍÍÍXXXXXXXXXYYYYYZZZZ[[[[\]^_acgkpv}
¡ª´¼ÄÊÎÑÒÑÏËÅ¿¹²¬¦ ¥«°¶¼ÁÆÊÎÑÓÔÕÕÕÔÓÒÑÐÏÎÍÍÌÌÌÌÌÌÌÍÍÍZZZZZZZZ[[[\\\\]]]]^^^_`abdgjnsy¤·¿ÇÍÒÕÖÖÔÑÍǼ¶±¬§¤¡ ¢¤§«¯´¸½ÂÆÊÍÐÒÓÔÕÕÔÓÒÑÐÏÎÎÍÌÌÌÌÌÌÌÌÍÍÍ\\\\]]]]^^^__```aaabbbcdefhknrw}§±ºÂÊÐÕØÚÚÙ×ÓÏÊÅÀ»·³°¬««¬¯²µ¸¼¿ÃÇÊÍÏÑÓÔÔÔÔÓÒÑÐÏÎÎÍÌÌÌÌÌÌÌÌÌÍÍÍ__````aaabbccddeefffgghijkmpsw|¢«´½ÅÍÓØÛÝÞÝÛÙÕÑÍÈÄÀ½º¸·¶¶¶·¹»½ÀÃÅÈËÍÏÑÒÓÔÔÓÓÒÑÐÐÏÎÍÍÌÌÌÌÌÌÌÌÍÍÍÎcddddeeffgghiijjkkllmmnopqsvy}§°¸ÁÉÐÖÛÞáááàÝÛ×ÔÐÍÉÆÄÂÁÀÀÀÀÂÃÅÇÈÊÌÎÐÑÒÓÓÓÓÒÒÑÐÏÏÎÍÍÌÌÌËËËÌÌÌÍÍÍÎiiiijjkklmnnoppqrrssttuvwxz}¤¬´½ÅÌÓÙÞáãääãáßÜÙÖÓÐÎÌÊÉÈÈÈÈÉÉËÌÍÎÐÑÑÒÓÓÓÓÒÒÑÐÏÏÎÍÍÌÌËËËËËËÌÌÌÍÍÍoooppqrrstuvwwxyzz{{||}~
£ª²ºÂÉÐÖÜàãåææåäâàÝÛØÖÔÒÐÏÎÎÎÎÎÏÏÐÐÑÒÒÓÓÓÓÒÒÑÑÐÏÏÎÍÍÌÌËËËËËËËÌÌÌÍÍÍvvwwxyyz{|}~
¤ª±¸ÀÇÎÔÚÞâåæçççæäâàÞÜÚØ×ÕÔÓÓÒÒÒÒÒÒÓÓÓÓÓÓÓÒÒÑÐÐÏÎÎÍÍÌÌËËËËËËËËÌÌÌÍÍÍ~
¢§¬²¹¿ÆÌÒØÝáäæèèèèæåãâàÞÝÛÚÙØ×ÖÖÕÕÕÔÔÔÔÔÓÓÒÒÑÑÐÐÏÎÎÍÍÌÌËËËËËËËËËÌÌÌÌÍÍ ¢¥¨¬°µºÀÆÌÑÖÛßãåçèèèçæåãâàßÞÜÛÚÙØØ××ÖÖÕÕÔÔÓÓÒÒÑÑÐÏÏÎÍÍÌÌÌËËËËËËËËËËËÌÌÌÌÍ ¡¢£¤¥¥¦§§¨ª«°²¶º¾ÃÇÍÒÖÛßâåçèèèèçæåãâàßÞÝÜÛÚÙÙØ××ÖÖÕÔÔÓÒÒÑÐÐÏÎÎÍÍÌÌÌËËËËËËËËËËËËËÌÌÌÍ ¢£¤¥¦¨©ª«¬®¯°°±²²³µ¶¸º¼¿ÃÇËÏÓ×ÛßâåæèèèèçæåãâáßÞÝÜÛÚÚÙØØ×ÖÖÕÔÔÓÒÒÑÐÐÏÎÎÍÍÌÌÌËËËËËËËËËËËËËËËÌĮ̀¨©ª«¬®¯°²³´¶·¸¹ºº»¼¼½¾¾¿ÁÂÄÆÉÌÏÒÖÙÝàãåçèééèçæåãâáßÞÝÜÛÚÙÙØØ×ÖÖÕÔÔÓÒÒÑÐÐÏÎÎÍÍÌÌÌËËËËËËËËËËËËËËËËÌÌ̳´´µ¶·¸¹º¼½¾¿ÁÂÃÄÄÅÆÆÇÇÈÉÊËÌÎÐÒÔ×ÚÜßâäæèééééèçåãâàßÝÜÛÚÙÙØØ×ÖÖÕÕÔÓÓÒÑÑÐÏÏÎÎÍÍÍÌÌÌÌËËËËËËËËËËËËËËËËË̾¿¿ÀÁÂÃÄÅÆÇÉÊËÌÍÎÎÏÐÐÑÑÒÒÓÔÕרÚÜÞàãåçèêêëëêéçæäâàßÝÜÚÙØØ×ÖÖÕÕÔÔÓÓÒÑÑÐÐÏÏÎÎÍÍÌÌÌÌÌËËËËËËËËËËËËËËËËÌÌÌÉÉÊÊËÌÍÎÏÐÑÒÓÔÕÖרØÙÙÚÚÛÛÜÝÝßàáãäæèéëìììììêéçåãáßÝÛÚÙØ×ÖÕÕÔÔÓÓÓÒÒÑÑÐÏÏÎÎÎÍÍÌÌÌÌÌËËËËËËËËËËËËËËËËËÌÌÌÒÓÓÔÕÕÖרÙÚÛÜÝÞßßààááâââããäåææèéêëìíîïïîîìëéçäâàÞÜÚØ×ÖÕÔÔÓÓÒÒÒÑÑÐÐÐÏÏÎÎÎÍÍÍÌÌÌÌËËËËËËËËËËËËËËËËÌÌÌÌÌÛÜÜÝÝÞßßàáâãääåææççèèèéééêêëëìíîïïðññññðïíëéçäáßÝÚÙ×ÖÔÔÓÒÒÑÑÑÐÐÐÏÏÏÎÎÎÍÍÍÍÌÌÌÌÌÌËËËËËËËËËËËËÌÌÌÌÌÌÌÌãããääåææçèèéêëëììíííîîîîïïïððññòóóóôôóòñðîìéæäáÞÜÚØÖÔÓÒÑÑÐÐÐÏÏÏÏÏÎÎÎÎÍÍÍÍÍÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌééêêëëììííîïïððñññòòòóóóóóôôôõõõöööööõôòñïìéæäáÞÛÙ×ÕÓÒÑÐÐÏÏÏÏÎÎÎÎÎÍÍÍÍÍÍÍÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌïïïðððññòòòóóôôõõõõöööööö÷÷÷÷÷øøøøøø÷öõóñïìéæãàÝÛØÖÔÓÑÐÐÏÏÎÎÎÎÎÍÍÍÍÍÍÍÍÍÍÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌóóóôôôõõõööö÷÷÷øøøøùùùùùùùùúúúúúúúùùø÷öôòïíêçãàÝÛØÖÔÒÑÐÏÎÎÎÍÍÍÍÍÍÍÍÍÍÍÍÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÍÍÍÍÍÌÌÌÌÌ
\ No newline at end of file
Index: milena/sandbox/abraham/morpho/images/test_4.pgm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: milena/sandbox/abraham/morpho/images/test_4.pgm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: milena/sandbox/abraham/morpho/tikz.h
--- milena/sandbox/abraham/morpho/tikz.h (revision 0)
+++ milena/sandbox/abraham/morpho/tikz.h (revision 0)
@@ -0,0 +1,37 @@
+#ifndef TIKZ_H
+# define TIKZ_H
+
+#include <fstream>
+
+namespace mln {
+ namespace io {
+ namespace tikz {
+
+ template <typename I>
+ void save (const Image<I>& input, std::string filename)
+ {
+ const I& ima = exact(input);
+
+ std::ofstream file(filename.c_str());
+ file << "\\begin{tikzpicture}" << std::endl;
+ file << "\\tikzstyle{every node}=[draw,shape=rectangle, minimum width=1cm, minimum height=1cm]" << std::endl;
+
+ typename I::fwd_piter p(ima.domain());
+
+ int i = 0;
+
+ for_all(p)
+ file << "\\path " << p.to_point() << "node[fill=black!" << ((255 - ima(p)) * 100) / 255 << "] (p_" << i++ << ") { \\scriptsize "
+ << ((ima(p) < 127)?("\\color{white}"):("")) << ima(p) << "};" << std::endl;
+
+ file << "\\end{tikzpicture}" << std::endl;
+ }
+
+ } // namespace tikz
+ } // namespace io
+} // namespace mln
+
+
+
+
+#endif // !TIKZ_H
Index: milena/sandbox/abraham/morpho/test_watershed.cc
--- milena/sandbox/abraham/morpho/test_watershed.cc (revision 1887)
+++ milena/sandbox/abraham/morpho/test_watershed.cc (working copy)
@@ -13,6 +13,8 @@
#include <string>
#include <iostream>
+#include "tikz.h"
+
int print_and_exit (std::string s)
{
std::cerr << s << std::endl;
@@ -26,15 +28,41 @@
typedef image2d<int_u8> image2dint;
- image2dint input, mverif;
+ image2dint input, mverif, wverif;
+
+ #define TEST
+
io::pgm::load(input, "./images/test_watershed.pgm");
- // io::pgm::load(input, "./images/lena.pgm");
+ // io::pgm::load(input, "./images/test_3.pgm");
+ // io::pgm::load(input, "./images/lena_light.pgm");
io::pgm::load(mverif, "./images/result_m_watershed.pgm");
+ io::pgm::load(wverif, "./images/result_topo_watershed.pgm");
morpho::basic_najman< image2d<int_u8>, neighb2d> n(input, c4());
+
+ /*
+ image2dint::fwd_piter it(input.domain());
+ for_all(it)
+ {
+ input(it) = input(it)/17;
+ mverif(it) = mverif(it)/17;
+ }
+ */
+
+ io::tikz::save(input, "start.tex");
+
+ std::cout << "Building Component tree..." << std::endl;
+
n.go();
+
+ std::cout << "M-Watershed" << std::endl;
+
n.m_watershed();
+ io::tikz::save(n.pima, "step.tex");
+
+#ifdef TEST
+
bool equal = true;
equal = n.pima == mverif;
@@ -47,7 +75,31 @@
else
std::cout << "M-Watershed good as chocolate ice cream" << std::endl;
- // n.w_watershed();
+#endif
+
+ std::cout << "W-watershed" << std::endl;
+
+ n.w_watershed();
+
+ // for_all(it)
+ // n.pima(it) = n.pima(it) * 17;
+
+
+#ifdef TEST
+ equal = n.pima == wverif;
+
+ if (!equal)
+ {
+ std::cout << "W-Watershed broken" << std::endl;
+ return 1;
+ }
+ else
+ std::cout << "W-Watershed good as chocolate ice cream" << std::endl;
+#endif
+
+ io::tikz::save(n.pima, "end.tex");
+
+ // n.image_output(n.pima);
io::pgm::save(n.pima, "out.pgm");
Index: milena/sandbox/abraham/morpho/Makefile
--- milena/sandbox/abraham/morpho/Makefile (revision 1887)
+++ milena/sandbox/abraham/morpho/Makefile (working copy)
@@ -11,6 +11,6 @@
all: tree
-test_watershed.o: basic_najman.hh
+test_watershed.o: basic_najman.hh tikz.h
test_component_tree.o: basic_najman.hh
test.o: basic_najman.hh
\ No newline at end of file
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-04-22 Caroline Vigouroux <vigour_c(a)epita.fr>
Add literals.
* literal/brown.hh, literal/cyan.hh,
literal/darkgray.hh, literal/gray.hh,
literal/lightgray.hh, literal/lime.hh,
literal/magenta.hh, literal/olive.hh,
literal/orange.hh, literal/pink.hh,
literal/purple.hh, literal/teal.hh,
literal/violet.hh, literal/yellow.hh: New literals.
* literal: New folder.
---
brown.hh | 33 +++++++++++++++++++++++++++++++++
cyan.hh | 33 +++++++++++++++++++++++++++++++++
darkgray.hh | 33 +++++++++++++++++++++++++++++++++
gray.hh | 33 +++++++++++++++++++++++++++++++++
lightgray.hh | 33 +++++++++++++++++++++++++++++++++
lime.hh | 33 +++++++++++++++++++++++++++++++++
magenta.hh | 33 +++++++++++++++++++++++++++++++++
olive.hh | 33 +++++++++++++++++++++++++++++++++
orange.hh | 33 +++++++++++++++++++++++++++++++++
pink.hh | 33 +++++++++++++++++++++++++++++++++
purple.hh | 33 +++++++++++++++++++++++++++++++++
teal.hh | 33 +++++++++++++++++++++++++++++++++
violet.hh | 33 +++++++++++++++++++++++++++++++++
yellow.hh | 33 +++++++++++++++++++++++++++++++++
14 files changed, 462 insertions(+)
Index: trunk/milena/sandbox/vigouroux/literal/pink.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/pink.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/pink.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_PINK_HH
+# define MLN_LITERAL_PINK_HH
+
+/*! \file mln/literal/pink.hh
+ * \brief Definition of the literal of mln::pink.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal pink.
+ struct pink_t : public Literal<pink_t>
+ {
+ };
+
+
+ /// Literal pink.
+ // FIXME: Make this a proper global (issue #43).
+ static const pink_t pink = pink_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_PINK_HH
Index: trunk/milena/sandbox/vigouroux/literal/gray.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/gray.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/gray.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_GRAY_HH
+# define MLN_LITERAL_GRAY_HH
+
+/*! \file mln/literal/gray.hh
+ * \brief Definition of the literal of mln::gray.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal gray.
+ struct gray_t : public Literal<gray_t>
+ {
+ };
+
+
+ /// Literal gray.
+ // FIXME: Make this a proper global (issue #43).
+ static const gray_t gray = gray_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_GRAY_HH
Index: trunk/milena/sandbox/vigouroux/literal/violet.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/violet.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/violet.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_VIOLET_HH
+# define MLN_LITERAL_VIOLET_HH
+
+/*! \file mln/literal/violet.hh
+ * \brief Definition of the literal of mln::violet.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal violet.
+ struct violet_t : public Literal<violet_t>
+ {
+ };
+
+
+ /// Literal violet.
+ // FIXME: Make this a proper global (issue #43).
+ static const violet_t violet = violet_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_VIOLET_HH
Index: trunk/milena/sandbox/vigouroux/literal/darkgray.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/darkgray.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/darkgray.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_DARKGRAY_HH
+# define MLN_LITERAL_DARKGRAY_HH
+
+/*! \file mln/literal/darkgray.hh
+ * \brief Definition of the literal of mln::darkgray.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal darkgray.
+ struct darkgray_t : public Literal<darkgray_t>
+ {
+ };
+
+
+ /// Literal darkgray.
+ // FIXME: Make this a proper global (issue #43).
+ static const darkgray_t darkgray = darkgray_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_DARKGRAY_HH
Index: trunk/milena/sandbox/vigouroux/literal/teal.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/teal.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/teal.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_TEAL_HH
+# define MLN_LITERAL_TEAL_HH
+
+/*! \file mln/literal/teal.hh
+ * \brief Definition of the literal of mln::teal.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal teal.
+ struct teal_t : public Literal<teal_t>
+ {
+ };
+
+
+ /// Literal teal.
+ // FIXME: Make this a proper global (issue #43).
+ static const teal_t teal = teal_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_TEAL_HH
Index: trunk/milena/sandbox/vigouroux/literal/lime.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/lime.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/lime.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_LIME_HH
+# define MLN_LITERAL_LIME_HH
+
+/*! \file mln/literal/lime.hh
+ * \brief Definition of the literal of mln::lime.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal lime.
+ struct lime_t : public Literal<lime_t>
+ {
+ };
+
+
+ /// Literal lime.
+ // FIXME: Make this a proper global (issue #43).
+ static const lime_t lime = lime_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_LIME_HH
Index: trunk/milena/sandbox/vigouroux/literal/purple.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/purple.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/purple.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_PURPLE_HH
+# define MLN_LITERAL_PURPLE_HH
+
+/*! \file mln/literal/purple.hh
+ * \brief Definition of the literal of mln::purple.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal purple.
+ struct purple_t : public Literal<purple_t>
+ {
+ };
+
+
+ /// Literal purple.
+ // FIXME: Make this a proper global (issue #43).
+ static const purple_t purple = purple_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_PURPLE_HH
Index: trunk/milena/sandbox/vigouroux/literal/brown.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/brown.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/brown.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_BROWN_HH
+# define MLN_LITERAL_BROWN_HH
+
+/*! \file mln/literal/brown.hh
+ * \brief Definition of the literal of mln::brown.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal brown.
+ struct brown_t : public Literal<brown_t>
+ {
+ };
+
+
+ /// Literal brown.
+ // FIXME: Make this a proper global (issue #43).
+ static const brown_t brown = brown_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_BROWN_HH
Index: trunk/milena/sandbox/vigouroux/literal/lightgray.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/lightgray.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/lightgray.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_LIGHTGRAY_HH
+# define MLN_LITERAL_LIGHTGRAY_HH
+
+/*! \file mln/literal/lightgray.hh
+ * \brief Definition of the literal of mln::lightgray.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal lightgray.
+ struct lightgray_t : public Literal<lightgray_t>
+ {
+ };
+
+
+ /// Literal lightgray.
+ // FIXME: Make this a proper global (issue #43).
+ static const lightgray_t lightgray = lightgray_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_LIGHTGRAY_HH
Index: trunk/milena/sandbox/vigouroux/literal/cyan.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/cyan.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/cyan.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_CYAN_HH
+# define MLN_LITERAL_CYAN_HH
+
+/*! \file mln/literal/cyan.hh
+ * \brief Definition of the literal of mln::cyan.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal cyan.
+ struct cyan_t : public Literal<cyan_t>
+ {
+ };
+
+
+ /// Literal cyan.
+ // FIXME: Make this a proper global (issue #43).
+ static const cyan_t cyan = cyan_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_CYAN_HH
Index: trunk/milena/sandbox/vigouroux/literal/yellow.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/yellow.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/yellow.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_YELLOW_HH
+# define MLN_LITERAL_YELLOW_HH
+
+/*! \file mln/literal/yellow.hh
+ * \brief Definition of the literal of mln::yellow.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal yellow.
+ struct yellow_t : public Literal<yellow_t>
+ {
+ };
+
+
+ /// Literal yellow.
+ // FIXME: Make this a proper global (issue #43).
+ static const yellow_t yellow = yellow_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_YELLOW_HH
Index: trunk/milena/sandbox/vigouroux/literal/orange.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/orange.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/orange.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_ORANGE_HH
+# define MLN_LITERAL_ORANGE_HH
+
+/*! \file mln/literal/orange.hh
+ * \brief Definition of the literal of mln::orange.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal orange.
+ struct orange_t : public Literal<orange_t>
+ {
+ };
+
+
+ /// Literal orange.
+ // FIXME: Make this a proper global (issue #43).
+ static const orange_t orange = orange_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_ORANGE_HH
Index: trunk/milena/sandbox/vigouroux/literal/magenta.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/magenta.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/magenta.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_MAGENTA_HH
+# define MLN_LITERAL_MAGENTA_HH
+
+/*! \file mln/literal/magenta.hh
+ * \brief Definition of the literal of mln::magenta.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal magenta.
+ struct magenta_t : public Literal<magenta_t>
+ {
+ };
+
+
+ /// Literal magenta.
+ // FIXME: Make this a proper global (issue #43).
+ static const magenta_t magenta = magenta_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_MAGENTA_HH
Index: trunk/milena/sandbox/vigouroux/literal/olive.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/literal/olive.hh (revision 0)
+++ trunk/milena/sandbox/vigouroux/literal/olive.hh (revision 1887)
@@ -0,0 +1,33 @@
+#ifndef MLN_LITERAL_OLIVE_HH
+# define MLN_LITERAL_OLIVE_HH
+
+/*! \file mln/literal/olive.hh
+ * \brief Definition of the literal of mln::olive.
+ *
+ */
+
+# include <mln/core/concept/literal.hh>
+
+namespace mln
+{
+
+ namespace literal
+ {
+
+ /// Type of literal olive.
+ struct olive_t : public Literal<olive_t>
+ {
+ };
+
+
+ /// Literal olive.
+ // FIXME: Make this a proper global (issue #43).
+ static const olive_t olive = olive_t();
+
+
+ } // end of namespace mln::literal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LITERAL_OLIVE_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Miscellaneous clean up in tests.
* tests/core/graph_image.cc,
* tests/core/line_graph_image.cc:
Aesthetics changes.
Remove dead code.
* tests/morpho/lena_line_graph_image_wst2.cc: Typos.
* mln/util/graph.hh: Remove old FIXME.
* doc/Makefile.am: Add a FIXME.
doc/Makefile.am | 1 +
mln/util/graph.hh | 4 ----
tests/core/graph_image.cc | 4 ++--
tests/core/line_graph_image.cc | 26 ++------------------------
tests/morpho/lena_line_graph_image_wst2.cc | 8 ++++----
5 files changed, 9 insertions(+), 34 deletions(-)
Index: tests/core/graph_image.cc
--- tests/core/graph_image.cc (revision 1885)
+++ tests/core/graph_image.cc (working copy)
@@ -136,9 +136,9 @@
}
std::cout << std::endl;
- /*-------------------------.
+ /*--------------------------.
| Processing graph images. |
- `-------------------------*/
+ `--------------------------*/
graph_image<point2d, int> ima_dil = morpho::dilation(ima, win);
draw::graph(ima_rep, ima_dil, 9);
Index: tests/core/line_graph_image.cc
--- tests/core/line_graph_image.cc (revision 1885)
+++ tests/core/line_graph_image.cc (working copy)
@@ -118,9 +118,9 @@
}
std::cout << std::endl;
- /*-------------------------.
+ /*--------------------------.
| Processing graph images. |
- `-------------------------*/
+ `--------------------------*/
line_graph_image<point2d, int> ima_dil = morpho::dilation(ima, win);
// Manual iteration over the domain of IMA_DIL.
@@ -134,26 +134,4 @@
mln_piter_(ima_t) p_ero(ima_ero.domain());
for_all (p_ero)
std::cout << "ima_ero (" << p_ero << ") = " << ima_ero(p_ero) << std::endl;
-
-
-// /* FIXME: When implementing convert::to_line_graph_image, don't
-// forget to give a second argument defaulting to something like
-// fun::vv2v::max(). This second argument is a functor used to
-// compute the values of the edges of the line graph image. */
-// image2d ima; // = ...
-// lg_ima_t lg_ima = convert::to_line_graph_image (ima);
-
-// // Image2d representation.
-// image2d<value_t> out = convert::to_image2d (lg_ima);
-// io::pgm::save(out, "out.pgm");
-
-// /* FIXME: Then, add some real processing on the line graph image
-// before converting to an image2d:
-// - erosion/dilation,
-// - Beucher's gradient,
-// - Meyer's WST (on the gradient of LG_IMA?),
-// - attribute filters (see my notes on Laurent's remarks about
-// attributes),
-// - etc.
-// Creating seperate tests for all these would be wise. */
}
Index: tests/morpho/lena_line_graph_image_wst2.cc
--- tests/morpho/lena_line_graph_image_wst2.cc (revision 1885)
+++ tests/morpho/lena_line_graph_image_wst2.cc (working copy)
@@ -37,12 +37,12 @@
The scenario is as follows:
\li load a 2-D, gray-level image from a PGM file;
\li convert this 2-D image into a line graph-based one, where values
- on edges are computed as the absolute value f the difference
+ on edges are computed as the absolute value of the difference
between the values on the nodes adjacent to the edge, so as to
- create a (norm of the gradient) ``between the pixels'' of the
+ create a (norm of the) gradient ``between the pixels'' of the
input image;
- \li reduce the number of minima using an area opening (computing the
- area using the vertices, not the edges);
+ \li reduce the number of minima using an area opening (counting the
+ vertices to compute the area, not the edges);
\li perform a WST on this simplified line graph image;
\li reduce the quantification of the result of the WST;
\li create an 2-D, color output image with height and width double
Index: mln/util/graph.hh
--- mln/util/graph.hh (revision 1885)
+++ mln/util/graph.hh (working copy)
@@ -33,12 +33,8 @@
# include <mln/util/internal/graph_base.hh>
-
-// FIXME: More doc!
-
// FIXME: Rename node(s) as vertex (vertices).
-
namespace mln
{
Index: doc/Makefile.am
--- doc/Makefile.am (revision 1885)
+++ doc/Makefile.am (working copy)
@@ -1,4 +1,5 @@
# FIXME: To be overhauled! (See ticket #134).
+# FIXME: Rename `internal' as `all' or `complete'.
DOXYGEN = doxygen
1
0