URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-02-05 Fabien Freling <freling(a)lrde.epita.fr>
Correct generic implementation labeling.
* fabien/labeling.hh: Minor fixes, fastest version off.
* fabien/regional_maxima.cc: Print output.
* fabien/regional_maxima.hh: Correct generic impl.
---
labeling.hh | 6 +++---
regional_maxima.cc | 3 ++-
regional_maxima.hh | 16 ++++++++--------
3 files changed, 13 insertions(+), 12 deletions(-)
Index: trunk/milena/sandbox/fabien/regional_maxima.cc
===================================================================
--- trunk/milena/sandbox/fabien/regional_maxima.cc (revision 3291)
+++ trunk/milena/sandbox/fabien/regional_maxima.cc (revision 3292)
@@ -38,6 +38,7 @@
#include "regional_maxima.hh"
#include <tests/data.hh>
+#include <mln/debug/println.hh>
int main()
@@ -48,6 +49,6 @@
image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR
"/tiny.pgm");
unsigned n;
- labeling::regional_maxima(lena, c4(), n);
+ debug::println(labeling::regional_maxima(lena, c4(), n));
mln_assertion(n == 25);
}
Index: trunk/milena/sandbox/fabien/regional_maxima.hh
===================================================================
--- trunk/milena/sandbox/fabien/regional_maxima.hh (revision 3291)
+++ trunk/milena/sandbox/fabien/regional_maxima.hh (revision 3292)
@@ -84,15 +84,15 @@
void init() { data::fill(attr, true); }
bool handles(const P&) const { return true; }
- bool labels(const P& p) const { return attr.element(p); }
- bool equiv(const P& n, const P& p) const { return input.element(n) ==
- input.element(p); }
- void do_no_union(const P& n, const P& p) { mln_invariant(input.element(n) >
- input.element(p));
- attr.element(p) = false; }
+ bool labels(const P& p) const { return attr(p); }
+ bool equiv(const P& n, const P& p) const { return input(n) ==
+ input(p); }
+ void do_no_union(const P& n, const P& p) { mln_invariant(input(n) >
+ input(p));
+ attr(p) = false; }
void init_attr(const P&) {}
- void merge_attr(const P& r, const P& p) { attr.element(p) = attr.element(p)
&&
- attr.element(r); }
+ void merge_attr(const P& r, const P& p) { attr(p) = attr(p) &&
+ attr(r); }
// Fastest implementation
Index: trunk/milena/sandbox/fabien/labeling.hh
===================================================================
--- trunk/milena/sandbox/fabien/labeling.hh (revision 3291)
+++ trunk/milena/sandbox/fabien/labeling.hh (revision 3292)
@@ -154,7 +154,7 @@
// First Pass.
{
- mln_fwd_piter(S) p(f.s);
+ mln_fwd_piter(S) p(s);
mln_niter(N) n(nbh, p);
for_all(p) if (f.handles(p))
{
@@ -184,7 +184,7 @@
// Second Pass.
{
- mln_bkd_piter(S) p(f.s);
+ mln_bkd_piter(S) p(s);
for_all(p) if (f.handles(p))
{
if (parent(p) == p) // if p is root
@@ -530,7 +530,7 @@
&&
mln_is_simple_neighborhood(N)::value
};
- return labeling_sorted_dispatch(metal::bool_<test>(),
+ return labeling_sorted_dispatch(metal::false_(),
input, nbh, nlabels,
functor, increasing);
}