---
milena/ChangeLog | 5 ++
milena/mln/labeling/{value.hh => values.hh} | 61 +++++++++++++--------------
2 files changed, 34 insertions(+), 32 deletions(-)
copy milena/mln/labeling/{value.hh => values.hh} (69%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 0b6c2ae..4314a02 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-13 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * mln/labeling/values.hh: Labeling algorithm for gray-level
+ images.
+
2013-04-12 Guillaume Lazzara <z(a)lrde.epita.fr>
* doc/Makefile.am: Remove duplicate '/' in path.
diff --git a/milena/mln/labeling/value.hh b/milena/mln/labeling/values.hh
similarity index 69%
copy from milena/mln/labeling/value.hh
copy to milena/mln/labeling/values.hh
index 069b2a1..b5e74cb 100644
--- a/milena/mln/labeling/value.hh
+++ b/milena/mln/labeling/values.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,8 +23,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_LABELING_VALUE_HH
-# define MLN_LABELING_VALUE_HH
+#ifndef MLN_LABELING_VALUES_HH
+# define MLN_LABELING_VALUES_HH
/// \file
///
@@ -44,19 +43,20 @@ namespace mln
namespace labeling
{
- /// \brief Connected component labeling of the image sites at a given
- /// value.
- ///
- /// \param[in] input The input image.
- /// \param[in] val The value to consider.
- /// \param[in] nbh The connectivity of components.
- /// \param[out] nlabels The number of labels.
- /// \return The label image.
- //
+ /*! \brief Connected component labeling of the image sites at a
+ given values.
+
+ \param[in] input The input image.
+ \param[in] nbh The connectivity of components.
+ \param[out] nlabels The number of labels.
+ \return The label image.
+
+ \ingroup labeling
+ */
template <typename I, typename N, typename L>
mln_ch_value(I, L)
- value(const Image<I>& input, const mln_value(I)& val,
- const Neighborhood<N>& nbh, L& nlabels);
+ values(const Image<I>& input,
+ const Neighborhood<N>& nbh, L& nlabels);
# ifndef MLN_INCLUDE_ONLY
@@ -69,14 +69,13 @@ namespace mln
template <typename I, typename N, typename L>
void
- value_tests(const Image<I>& input, const mln_value(I)& val, const
Neighborhood<N>& nbh,
+ values_tests(const Image<I>& input, const Neighborhood<N>&
nbh,
L& nlabels)
{
mln_precondition(exact(input).is_valid());
mln_precondition(exact(nbh).is_valid());
(void) input;
- (void) val;
(void) nbh;
(void) nlabels;
}
@@ -91,12 +90,11 @@ namespace mln
// Generic functor.
template <typename I, typename L>
- struct value_functor
+ struct values_functor
{
typedef mln_psite(I) P;
const I& input;
- const mln_value(I)& val;
// Requirements from mln::canvas::labeling.
@@ -105,8 +103,8 @@ namespace mln
// Generic implementation
void init() {}
- bool handles(const P& p) const { return input(p) == val; }
- bool equiv(const P& n, const P&) const { return input(n) == val; }
+ bool handles(const P& p) const { return true; }
+ bool equiv(const P& n, const P& p) const { return input(n) == input(p); }
bool labels(const P&) const { return true; }
void do_no_union(const P&, const P&) {}
void init_attr(const P&) {}
@@ -118,8 +116,8 @@ namespace mln
// Fastest implementation
void init_() {}
- bool handles_(unsigned p) const { return input.element(p) == val; }
- bool equiv_(unsigned n, unsigned) const { return input.element(n) == val; }
+ bool handles_(unsigned p) const { return true; }
+ bool equiv_(unsigned n, unsigned p) const { return input.element(n) == input.element(p);
}
bool labels_(unsigned) const { return true; }
void do_no_union_(unsigned, unsigned) {}
void init_attr_(unsigned) {}
@@ -130,9 +128,8 @@ namespace mln
// end of Requirements.
- value_functor(const Image<I>& input_, const mln_value(I)& val)
- : input(exact(input_)),
- val(val)
+ values_functor(const Image<I>& input_)
+ : input(exact(input_))
{
}
};
@@ -146,15 +143,15 @@ namespace mln
template <typename I, typename N, typename L>
mln_ch_value(I, L)
- value(const Image<I>& input, const mln_value(I)& val,
- const Neighborhood<N>& nbh, L& nlabels)
+ values(const Image<I>& input,
+ const Neighborhood<N>& nbh, L& nlabels)
{
- mln_trace("labeling::value");
+ mln_trace("labeling::values");
- internal::value_tests(input, val, nbh, nlabels);
+ internal::values_tests(input, nbh, nlabels);
mln_ch_value(I, L) output;
- impl::value_functor<I,L> f(input, val);
+ impl::values_functor<I,L> f(input);
output = canvas::labeling::video(input, nbh, nlabels, f);
return output;
@@ -167,4 +164,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_LABELING_VALUE_HH
+#endif // ! MLN_LABELING_VALUES_HH
--
1.7.2.5