URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-19 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update fllt.
* fllt.hh: Update.
---
fllt.hh | 5 +++++
1 file changed, 5 insertions(+)
Index: trunk/milena/sandbox/garrigues/fllt.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt.hh (revision 1360)
+++ trunk/milena/sandbox/garrigues/fllt.hh (revision 1361)
@@ -168,16 +168,21 @@
set_p<P>& N,
V& gn)
{
+ // Count the number of conected components of the border of R.
image2d<int> tmp;
unsigned n;
labeling::level(convert::to_image(N), true, c8(), tmp, n);
+ if (n > 1)
+ {
// IF number of conected components of the border > 1
+
// follow each border to find which is the exterior border
// and which are the holes. Keep one pixel of each holes.
// Remove from N border of holes.
// Recompute gn <- min u(x) x belongs to A
+ }
// g <- gn
// A <- {x belongs to N / u(x) == g}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-19 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Update fllt.
* sandbox/garrigues/fllt.hh: Update.
---
fllt.hh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
Index: trunk/milena/sandbox/garrigues/fllt.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt.hh (revision 1358)
+++ trunk/milena/sandbox/garrigues/fllt.hh (revision 1359)
@@ -163,6 +163,38 @@
tagged(qa) = true;
}
+ // 4)
+
+ // IF g < gn
+ if (g < gn)
+ {
+ // IF number of conected components of the border > 1
+ // follow each border to find which is the exterior border
+ // and which are the holes. Keep one pixel of each holes.
+ //
+ // Remove from N border of holes.
+ // Recompute gn <- min u(x) x belongs to A
+ //
+ // g <- gn
+ // A <- {x belongs to N / u(x) == g}
+ // N <- N\{x belongs to N / u(x) == g}
+ // GO TO 3)
+ }
+
+ // IF g == gn
+ if (g == gn)
+ {
+ // A <- {x belongs to N / u(x) == g}
+ // N <- N\{x belongs to N / u(x) == g}
+ // GO TO 3)
+ }
+
+ // IF g > gn
+ if (g > gn)
+ {
+ // set the gray-level of the pixels of R to g.
+ // GO TO 1)
+ }
}
}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-18 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Starts with FLLT.
* mln/core/image_if.hh: Add fixme for theo.
* sandbox/garrigues/fllt.hh: Try to implement FLLT.
* sandbox/garrigues/test_fllt.cc: a test for FLLT.
---
mln/core/image_if.hh | 2
sandbox/garrigues/fllt.hh | 177 +++++++++++++++++++++++++++++++++++++++++
sandbox/garrigues/test_fllt.cc | 29 ++++++
3 files changed, 208 insertions(+)
Index: trunk/milena/mln/core/image_if.hh
===================================================================
--- trunk/milena/mln/core/image_if.hh (revision 1356)
+++ trunk/milena/mln/core/image_if.hh (revision 1357)
@@ -32,6 +32,8 @@
*
* \brief Definition of a image which domain is restricted by a
* function.
+ *
+ * \todo FIXME for theo : add image_if_great_than / less_than
*/
# include <mln/core/internal/image_if_base.hh>
Index: trunk/milena/sandbox/garrigues/fllt.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/fllt.hh (revision 1357)
@@ -0,0 +1,177 @@
+// 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_LEVEL_MEDIAN_HH
+# define MLN_LEVEL_MEDIAN_HH
+
+/*! \file fllt.hh
+ *
+ * \brief Fast level line transform of an image.
+ *
+ */
+
+# include <mln/core/image2d.hh>
+# include <mln/core/set_p.hh>
+# include <mln/core/inplace.hh>
+# include <mln/core/neighb2d.hh>
+# include <mln/core/pset_if_piter.hh>
+
+# include <mln/debug/println.hh>
+
+# include <mln/level/compute.hh>
+# include <mln/accu/min.hh>
+
+# include <mln/labeling/regional_minima.hh>
+
+# include <mln/core/image_if.hh>
+# include <mln/fun/ops.hh>
+# include <mln/pw/value.hh>
+# include <mln/pw/cst.hh>
+# include <mln/fun/p2b/chess.hh>
+
+namespace mln
+{
+
+ // 1)
+ // x0 <- a not tagged local mininum of ima.
+ // g <- u(x0)
+
+ // 2)
+ // A <- {x0}
+ // R <- {}
+ // N <- {}
+
+ // 3)
+ // N <- N union {x neighbor of a pixel in a}
+ // gn <- min u(x) x belongs to N.
+ // R <- R union A
+ // tag the pixels of A.
+
+ // 4)
+ // IF g < gn
+ // IF number of conected components of the border > 1
+ // follow each border to find which is the exterior border
+ // and which are the holes. Keep one pixel of each holes.
+ //
+ // Remove from N border of holes.
+ // Recompute gn <- min u(x) x belongs to A
+ //
+ // g <- gn
+ // A <- {x belongs to N / u(x) == g}
+ // N <- N\{x belongs to N / u(x) == g}
+ // GO TO 3)
+ // IF g == gn
+ // A <- {x belongs to N / u(x) == g}
+ // N <- N\{x belongs to N / u(x) == g}
+ // GO TO 3)
+ // IF g > gn
+ // set the gray-level of the pixels of R to g.
+ // GO TO 1)
+
+
+ template <typename V>
+ void compute_level_set(image2d<V>& ima)
+ {
+ typedef point2d P;
+ typedef image2d<V> I;
+ typedef mln::image_if<
+ mln::image2d<int>,
+ mln::fun::greater_p2b_expr_<mln::pw::value_<mln::image2d<int> >,
+ mln::pw::cst_<int> >
+ > I_IF;
+
+
+ set_p<P> R, N, A;
+ V g, gn;
+ point2d x0;
+ image2d<int> min_locals(ima.domain());
+ image2d<bool> tagged(ima.domain());
+
+ unsigned nlabels;
+ labeling::regional_minima(ima, c4(), min_locals, nlabels);
+
+ debug::println(min_locals);
+ debug::println(min_locals | (pw::value(min_locals) > pw::cst(0)));
+
+ mln_piter(I_IF) p((min_locals | (pw::value(min_locals) > pw::cst(0))).domain());
+ for_all(p)
+ {
+ if (tagged(p))
+ continue;
+
+ // 1)
+ // x0 <- a not tagged local mininum of ima.
+ x0 = p;
+ // g <- u(x0)
+ g = ima(x0);
+
+ // 2)
+ // A <- {x0}
+ A.clear();
+ A.insert(x0);
+ // R <- {}
+ R.clear();
+ // N <- {}
+ N.clear();
+
+ // 3)
+ // N <- N union {x neighbor of a pixel in a\R}
+ mln_piter(set_p<P>) qa(A);
+ for_all(qa)
+ {
+ mln_niter(neighb2d) n(c4(), qa);
+ for_all (n)
+ if (!R.has(n))
+ N.insert(n);
+ }
+
+ // gn <- min u(x) x belongs to N.
+ // FIXME : how can I do that?
+ //gn = level::compute<accu::min>(ima | N);
+ mln_piter(set_p<P>) qn(N);
+ accu::min_<V> min;
+ for_all(qn)
+ min.take(ima(qn));
+ gn = min;
+
+ // R <- R union A
+ // tag the pixels of A.
+ for_all(qa)
+ {
+ R.insert(qa);
+ tagged(qa) = true;
+ }
+
+ }
+ }
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_LEVEL_MEDIAN_HH
Index: trunk/milena/sandbox/garrigues/test_fllt.cc
===================================================================
--- trunk/milena/sandbox/garrigues/test_fllt.cc (revision 0)
+++ trunk/milena/sandbox/garrigues/test_fllt.cc (revision 1357)
@@ -0,0 +1,29 @@
+# include <mln/core/image2d.hh>
+# include "fllt.hh"
+# include <mln/debug/println.hh>
+# include <mln/convert/to_w_window.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/convert/to_image.hh>
+
+int main()
+{
+
+ using namespace mln;
+
+ int ws[81] = {3,2,3,3,5,5,5,5,5,
+ 2,1,3,4,4,4,4,5,5,
+ 2,3,4,2,3,3,2,4,4,
+ 1,4,2,1,1,2,1,2,2,
+ 1,2,4,2,1,2,1,1,1,
+ 1,3,3,4,2,3,2,1,1,
+ 1,3,3,4,2,3,2,1,1,
+ 1,3,3,4,2,3,2,1,1,
+ 1,3,3,4,2,3,2,1,1};
+
+ w_window2d_int w_win = make::w_window2d(ws);
+
+ image2d<int> ima = convert::to_image(w_win);
+
+ debug::println(ima);
+ compute_level_set(ima);
+}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-17 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update typo and win_chamfer.
Update win_chamfer.
* mln/make/win_chamfer.hh,
* tests/chamfer.cc,
* tests/color_pretty.cc,
* tests/seed2tiling.cc,
* tests/show.cc: Update win_chamfer.
Upudate typo.
* mln/value/internal/all.hh: New typo.
---
mln/make/win_chamfer.hh | 7 ++++---
mln/value/internal/all.hh | 41 +++++++++++++++++++++++++++++++++++++++++
tests/chamfer.cc | 6 +++---
tests/color_pretty.cc | 2 +-
tests/seed2tiling.cc | 2 +-
tests/show.cc | 2 +-
6 files changed, 51 insertions(+), 9 deletions(-)
Index: trunk/milena/tests/chamfer.cc
===================================================================
--- trunk/milena/tests/chamfer.cc (revision 1355)
+++ trunk/milena/tests/chamfer.cc (revision 1356)
@@ -54,7 +54,7 @@
{
level::fill(ima, false);
ima.at(4,4) = true;
- const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 0> ();
image2d<unsigned> out = geom::chamfer(ima, w_win, max);
debug::println(out | value::interval(0, 8));
}
@@ -62,7 +62,7 @@
{
level::fill(ima, false);
ima.at(4,4) = true;
- const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 3> ();
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 3> ();
image2d<unsigned> out = geom::chamfer(ima, w_win, max);
debug::println(out | value::interval(0, 8));
}
@@ -70,7 +70,7 @@
{
level::fill(ima, false);
ima.at(4,4) = true;
- const w_window2d_int& w_win = win_chamfer::mk_chamfer_5x5_int<4, 6, 9> ();
+ const w_window2d_int& w_win = make::mk_chamfer_5x5_int<4, 6, 9> ();
image2d<unsigned> out = geom::chamfer(ima, w_win, max);
image2d<unsigned>::fwd_piter p(out.domain());
for_all(p)
Index: trunk/milena/tests/seed2tiling.cc
===================================================================
--- trunk/milena/tests/seed2tiling.cc (revision 1355)
+++ trunk/milena/tests/seed2tiling.cc (revision 1356)
@@ -75,7 +75,7 @@
image2d<int_u8> inte2(input.domain());
image2d<int_u8> out(input.domain());
- const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2,3> ();
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2,3> ();
unsigned n;
labeling::foreground(input, c4(), lab, n);
Index: trunk/milena/tests/show.cc
===================================================================
--- trunk/milena/tests/show.cc (revision 1355)
+++ trunk/milena/tests/show.cc (revision 1356)
@@ -58,7 +58,7 @@
// 0 2 0
// 2 p 2
// 0 2 0
- const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 0> ();
// Call chamfer for a distance image.
image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
Index: trunk/milena/tests/color_pretty.cc
===================================================================
--- trunk/milena/tests/color_pretty.cc (revision 1355)
+++ trunk/milena/tests/color_pretty.cc (revision 1356)
@@ -56,7 +56,7 @@
// 0 2 0
// 2 p 2
// 0 2 0
- const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 0> ();
// Call chamfer for a distance image.
image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
Index: trunk/milena/mln/value/internal/all.hh
===================================================================
--- trunk/milena/mln/value/internal/all.hh (revision 0)
+++ trunk/milena/mln/value/internal/all.hh (revision 1356)
@@ -0,0 +1,41 @@
+// 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_VALUE_INTERNAL_ALL_HH
+# define MLN_VALUE_INTERNAL_ALL_HH
+
+/*! \file mln/value/internal/all.hh
+ *
+ * \brief FIXME
+ */
+
+# include <mln/value/internal/encoding.hh>
+# include <mln/value/internal/integer.hh>
+# include <mln/value/internal/iterable_set.hh>
+# include <mln/value/internal/value_like.hh>
+
+#endif // ! MLN_VALUE_INTERNAL_ALL_HH
Index: trunk/milena/mln/make/win_chamfer.hh
===================================================================
--- trunk/milena/mln/make/win_chamfer.hh (revision 1355)
+++ trunk/milena/mln/make/win_chamfer.hh (revision 1356)
@@ -43,7 +43,8 @@
namespace mln
{
- namespace win_chamfer
+
+ namespace make
{
template<int d10, int d11>
@@ -103,8 +104,8 @@
return (make::w_window2d(ws));
}
- } // end of mln::win_chamfer
+ } // end of namespace mln::make
-} // end of mln
+} // end of namespace mln
#endif // ! MLN_MAKE_WIN_CHAMFER_HH