This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch more-generic-skel has been updated
discards 25950c4401a9d94c8879ff9e9d561272e3055eb4 (commit)
discards c0f02ece8a92571bea34d5b46bdb227094292b48 (commit)
discards 876aaf57aaaf4b4e7b7a5409503b919f89469406 (commit)
discards c9a6f38e521e49267034ffd047ee96882456fe3b (commit)
discards d0945cb873925fb3d20b9853980ee7a020b30157 (commit)
via 8cbc0864835adb146da03fde34e7f3328bc580a8 (commit)
via 086b7d82fff3cea004ec3c1a7ea0b6775df7ab7c (commit)
via c17805cda0f19313b307ac6d31cdd8bdf2ae3a9e (commit)
via 643158a15c5d243a437aaa467efc8234db4f81f3 (commit)
via 0a6d80b5d914e684b642951c0b32c72421e8ceb5 (commit)
via a087bc4d5c23b64db8ca8a3fe40c73387419ec70 (commit)
via ee56e13b49f84c30aaaee1f3c1edfdac61784c52 (commit)
via b4a75638b975b3e0a70d47ab1fa48caff05468f3 (commit)
via a04de22136722fbb9445e9f0eec4b0a474a4393d (commit)
via cb5723f7d881aa291082a67e2a0303456b1b3402 (commit)
via 739f3d21f481e522f8712bbfb5dd891a7886d615 (commit)
via 8b3107da88f52723fe8e170efc6a6f10d4bdc17e (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (25950c4401a9d94c8879ff9e9d561272e3055eb4)
\
N -- N -- N (8cbc0864835adb146da03fde34e7f3328bc580a8)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
8cbc086 Use mln::data::paste to simplify mesh skeleton applications.
086b7d8 Update mesh skeleton applications.
c17805c More generic breadth-first-thinning-based skeleton transformations.
643158a Introduce a helper to build an mln::mutable_extension_ima.
0a6d80b Introduce an extension-by-mutable-image morpher.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 77 +++++++++-
milena/headers.mk | 4 +
milena/mln/topo/detach_cell.hh | 1 -
.../mln/{fun/p2b/chess.hh => topo/detach_point.hh} | 54 +++----
.../estimate.hh => mln/topo/is_not_end_point.hh} | 90 ++++++------
milena/mln/topo/is_simple_point2d.hh | 140 +++++++++++++++++
milena/mln/topo/skeleton/breadth_first_thinning.hh | 10 +-
...rst_thinning.hh => priority_driven_thinning.hh} | 158 ++++++++++----------
milena/tests/topo/skeleton/Makefile.am | 20 +++-
.../skeleton/breadth_first_thinning.cc} | 55 ++++---
.../skeleton/breadth_first_thinning_constrained.cc | 69 +++++----
.../topo/skeleton/priority_driven_thinning.cc | 90 +++++++++++
.../priority_driven_thinning_constrained.cc | 94 ++++++++++++
13 files changed, 636 insertions(+), 226 deletions(-)
copy milena/mln/{fun/p2b/chess.hh => topo/detach_point.hh} (65%)
copy milena/{sandbox/theo/estimate.hh => mln/topo/is_not_end_point.hh} (52%)
create mode 100644 milena/mln/topo/is_simple_point2d.hh
copy milena/mln/topo/skeleton/{breadth_first_thinning.hh => priority_driven_thinning.hh} (52%)
copy milena/tests/{labeling/foreground.cc => topo/skeleton/breadth_first_thinning.cc} (54%)
copy scribo/src/primitive/find/find_pattern_lines.cc => milena/tests/topo/skeleton/breadth_first_thinning_constrained.cc (50%)
create mode 100644 milena/tests/topo/skeleton/priority_driven_thinning.cc
create mode 100644 milena/tests/topo/skeleton/priority_driven_thinning_constrained.cc
hooks/post-receive
--
Olena, a generic and efficient image processing platform
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch skeletons has been created
at a087bc4d5c23b64db8ca8a3fe40c73387419ec70 (commit)
- Log -----------------------------------------------------------------
a087bc4 Catch up with the renaming to detach_cell.
ee56e13 Rename topo::detach as topo::detach_cell.
b4a7563 Exercise breadth-first and priority-driven thinnings.
a04de22 New skeletonization algorithm: priority-driven thinning.
cb5723f Add helpers to compute skeletons by thinning on regular 2D images.
739f3d2 Add tracing mechanism to breadth-first thinning.
8b3107d Small fix in breadth-first thinning.
-----------------------------------------------------------------------
hooks/post-receive
--
Olena, a generic and efficient image processing platform
* tests/topo/skeleton/breadth_first_thinning.cc,
* tests/topo/skeleton/breadth_first_thinning_constrained.cc,
* tests/topo/skeleton/priority_driven_thinning.cc,
* tests/topo/skeleton/priority_driven_thinning_constrained.cc:
New.
* tests/topo/skeleton/Makefile.am (check_PROGRAMS): Add
breadth_first_thinning, breadth_first_thinning_constrained,
priority_driven_thinning and priority_driven_thinning_constrained.
(breadth_first_thinning_SOURCES)
(breadth_first_thinning_constrained_SOURCES)
(priority_driven_thinning_SOURCES)
(priority_driven_thinning_constrained_SOURCES):
New.
(MOSTLYCLEANFILES): Add breadth_first_thinning-small.pbm,
breadth_first_thinning_constrained-small.pbm,
priority_driven_thinning-small.pbm and
priority_driven_thinning_constrained-small.pbm.
---
milena/ChangeLog | 22 +++++
milena/tests/topo/skeleton/Makefile.am | 20 ++++-
.../skeleton/breadth_first_thinning.cc} | 55 ++++++-----
.../skeleton/breadth_first_thinning_constrained.cc | 69 +++++++-------
.../topo/skeleton/priority_driven_thinning.cc | 90 +++++++++++++++++++
.../priority_driven_thinning_constrained.cc | 94 ++++++++++++++++++++
6 files changed, 289 insertions(+), 61 deletions(-)
copy milena/tests/{labeling/foreground.cc => topo/skeleton/breadth_first_thinning.cc} (54%)
copy scribo/src/primitive/find/find_pattern_lines.cc => milena/tests/topo/skeleton/breadth_first_thinning_constrained.cc (50%)
create mode 100644 milena/tests/topo/skeleton/priority_driven_thinning.cc
create mode 100644 milena/tests/topo/skeleton/priority_driven_thinning_constrained.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index b41024f..e3b6019 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,27 @@
2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+ Exercise breadth-first and priority-driven thinnings.
+
+ * tests/topo/skeleton/breadth_first_thinning.cc,
+ * tests/topo/skeleton/breadth_first_thinning_constrained.cc,
+ * tests/topo/skeleton/priority_driven_thinning.cc,
+ * tests/topo/skeleton/priority_driven_thinning_constrained.cc:
+ New.
+ * tests/topo/skeleton/Makefile.am (check_PROGRAMS): Add
+ breadth_first_thinning, breadth_first_thinning_constrained,
+ priority_driven_thinning and priority_driven_thinning_constrained.
+ (breadth_first_thinning_SOURCES)
+ (breadth_first_thinning_constrained_SOURCES)
+ (priority_driven_thinning_SOURCES)
+ (priority_driven_thinning_constrained_SOURCES):
+ New.
+ (MOSTLYCLEANFILES): Add breadth_first_thinning-small.pbm,
+ breadth_first_thinning_constrained-small.pbm,
+ priority_driven_thinning-small.pbm and
+ priority_driven_thinning_constrained-small.pbm.
+
+2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+
New skeletonization algorithm: priority-driven thinning.
* mln/topo/skeleton/priority_driven_thinning.hh: New.
diff --git a/milena/tests/topo/skeleton/Makefile.am b/milena/tests/topo/skeleton/Makefile.am
index 0e60ff6..eb64238 100644
--- a/milena/tests/topo/skeleton/Makefile.am
+++ b/milena/tests/topo/skeleton/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -17,10 +17,26 @@
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
+ breadth_first_thinning \
+ breadth_first_thinning_constrained \
crest \
- is_simple_point
+ is_simple_point \
+ priority_driven_thinning \
+ priority_driven_thinning_constrained
+breadth_first_thinning_SOURCES = breadth_first_thinning.cc
+breadth_first_thinning_constrained_SOURCES = \
+ breadth_first_thinning_constrained.cc
crest_SOURCES = crest.cc
is_simple_point_SOURCES = is_simple_point.cc
+priority_driven_thinning_SOURCES = priority_driven_thinning.cc
+priority_driven_thinning_constrained_SOURCES = \
+ priority_driven_thinning_constrained.cc
TESTS = $(check_PROGRAMS)
+
+MOSTLYCLEANFILES = \
+ breadth_first_thinning-small.pbm \
+ breadth_first_thinning_constrained-small.pbm \
+ priority_driven_thinning-small.pbm \
+ priority_driven_thinning_constrained-small.pbm
diff --git a/milena/tests/labeling/foreground.cc b/milena/tests/topo/skeleton/breadth_first_thinning.cc
similarity index 54%
copy from milena/tests/labeling/foreground.cc
copy to milena/tests/topo/skeleton/breadth_first_thinning.cc
index acdecb6..e77421a 100644
--- a/milena/tests/labeling/foreground.cc
+++ b/milena/tests/topo/skeleton/breadth_first_thinning.cc
@@ -1,5 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,12 +23,19 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+/// \brief Testing the computation of a skeleton of a 2D image using
+/// an (unconstrained) breadth-first thinning.
+
#include <mln/core/image/image2d.hh>
-#include <mln/core/var.hh>
-#include <mln/io/pbm/load.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/data/compare.hh>
-#include <mln/labeling/foreground.hh>
+
+#include <mln/topo/skeleton/breadth_first_thinning.hh>
+
+#include <mln/topo/is_simple_point2d.hh>
+#include <mln/topo/detach_point.hh>
+
+#include <mln/io/pbm/all.hh>
#include "tests/data.hh"
@@ -39,29 +45,28 @@ int main()
using namespace mln;
typedef image2d<bool> I;
- neighb2d nbh = c4();
+ typedef neighb2d N;
- I pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm");
- image2d<unsigned> out, ref;
+ // Add a border of (at least) 1 pixel, to a guarantee a meaningful
+ // result of the computation of connectivity numbers (called within
+ // is_simple_2d); indeed, this computation always expects each pixel
+ // to have 8 neighboring sites.
+ border::thickness = 1;
- unsigned n;
- out = labeling::foreground(pic, nbh, n); // Calls the fastest 'video'
- // version.
- mln_assertion(n == 33);
+ I input = io::pbm::load(MLN_IMG_DIR "/small.pbm");
- {
- // Note that labeling::foreground actually is labeling::value
- // which calls canvas::labeling_video and its generic dispatch
- // leads to canvas::impl::generic::labeling.
+ // FIXME: Use a dual neighborhood instead?
- labeling::impl::value_functor<I> f(pic, true);
+ // Foreground neighborhood.
+ neighb2d nbh_fg = c4();
+ // Background neighborhood.
+ neighb2d nbh_bg = c8();
- unsigned n_;
- ref = canvas::labeling::impl::generic::labeling(pic, nbh, n_,
- pic.domain(),
- f);
- mln_invariant(n_ == n);
- mln_invariant(ref == out);
- }
+ // Simplicity criterion functor.
+ topo::is_simple_point2d<I, N> is_simple(nbh_fg, nbh_bg);
+ I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
+ is_simple,
+ topo::detach_point);
+ io::pbm::save(output, "breadth_first_thinning-small.pbm");
}
diff --git a/scribo/src/primitive/find/find_pattern_lines.cc b/milena/tests/topo/skeleton/breadth_first_thinning_constrained.cc
similarity index 50%
copy from scribo/src/primitive/find/find_pattern_lines.cc
copy to milena/tests/topo/skeleton/breadth_first_thinning_constrained.cc
index 3d8a98f..8ec213a 100644
--- a/scribo/src/primitive/find/find_pattern_lines.cc
+++ b/milena/tests/topo/skeleton/breadth_first_thinning_constrained.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,53 +23,54 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+/// \brief Testing the computation of a skeleton of a 2D image using
+/// an breadth-first thinning preserving end points.
+
#include <mln/core/image/image2d.hh>
-#include <mln/value/label_16.hh>
-#include <mln/value/rgb8.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/io/pbm/all.hh>
-#include <mln/io/ppm/save.hh>
-#include <mln/data/convert.hh>
-#include <mln/debug/superpose.hh>
-#include <scribo/debug/usage.hh>
+#include <mln/topo/skeleton/breadth_first_thinning.hh>
-#include <scribo/core/object_image.hh>
-#include <scribo/primitive/extract/lines_h_pattern.hh>
-#include <scribo/primitive/extract/lines_v_pattern.hh>
+#include <mln/topo/is_simple_point2d.hh>
+#include <mln/topo/detach_point.hh>
+#include <mln/topo/is_not_end_point.hh>
-const char *args_desc[][2] =
-{
- { "input.pbm", "A binary image." },
- { "length", " Minimum line length." },
- {0, 0}
-};
+#include <mln/io/pbm/all.hh>
+#include "tests/data.hh"
-int main(int argc, char *argv[])
+
+int main()
{
using namespace mln;
- if (argc != 4)
- return scribo::debug::usage(argv,
- "Extract discontinued horizontal and vertical lines",
- "input.pbm length output.ppm",
- args_desc,
- "A color image. Horizontal lines are in red and vertical lines in green.");
+ typedef image2d<bool> I;
+ typedef neighb2d N;
- trace::entering("main");
+ // Add a border of (at least) 1 pixel, to a guarantee a meaningful
+ // result of the computation of connectivity numbers (called within
+ // is_simple_2d); indeed, this computation always expects each pixel
+ // to have 8 neighboring sites.
+ border::thickness = 1;
- typedef image2d<bool> I;
- I input;
- io::pbm::load(input, argv[1]);
+ I input = io::pbm::load(MLN_IMG_DIR "/small.pbm");
- I hlines = scribo::primitive::extract::lines_h_pattern(input, atoi(argv[2]), 3);
- I vlines = scribo::primitive::extract::lines_v_pattern(input, atoi(argv[2]), 3);
+ // FIXME: Use a dual neighborhood instead?
- image2d<value::rgb8> out = debug::superpose(input, hlines, literal::red);
- out = debug::superpose(out, vlines, literal::green);
+ // Foreground neighborhood.
+ neighb2d nbh_fg = c4();
+ // Background neighborhood.
+ neighb2d nbh_bg = c8();
- io::ppm::save(out, argv[3]);
+ // Simplicity criterion functor.
+ topo::is_simple_point2d<I, N> is_simple(nbh_fg, nbh_bg);
+ // Constraint: do not collapse end points.
+ topo::is_not_end_point<I, N> constraint(nbh_fg, input);
- trace::exiting("main");
+ I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
+ is_simple,
+ topo::detach_point,
+ constraint);
+ io::pbm::save(output, "breadth_first_thinning_constrained-small.pbm");
}
diff --git a/milena/tests/topo/skeleton/priority_driven_thinning.cc b/milena/tests/topo/skeleton/priority_driven_thinning.cc
new file mode 100644
index 0000000..36470d1
--- /dev/null
+++ b/milena/tests/topo/skeleton/priority_driven_thinning.cc
@@ -0,0 +1,90 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+/// \file
+/// \brief Testing the computation of a skeleton of a 2D image using
+/// an (unconstrained) priority-driven thinning.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/topo/skeleton/priority_driven_thinning.hh>
+
+#include <mln/topo/is_simple_point2d.hh>
+#include <mln/topo/detach_point.hh>
+
+#include <mln/logical/not.hh>
+#include <mln/arith/revert.hh>
+#include <mln/transform/distance_geodesic.hh>
+
+#include <mln/io/pbm/all.hh>
+
+#include "tests/data.hh"
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef image2d<bool> I;
+ typedef neighb2d N;
+
+ // Add a border of (at least) 1 pixel, to a guarantee a meaningful
+ // result of the computation of connectivity numbers (called within
+ // is_simple_2d); indeed, this computation always expects each pixel
+ // to have 8 neighboring sites.
+ border::thickness = 1;
+
+ I input = io::pbm::load(MLN_IMG_DIR "/small.pbm");
+
+ // FIXME: Use a dual neighborhood instead?
+
+ // Foreground neighborhood.
+ neighb2d nbh_fg = c4();
+ // Background neighborhood.
+ neighb2d nbh_bg = c8();
+
+ // Simplicity criterion functor.
+ topo::is_simple_point2d<I, N> is_simple(nbh_fg, nbh_bg);
+
+ // Distance type.
+ typedef value::int_u8 D;
+ // Distance map type.
+ typedef image2d<D> M;
+
+ // Compute a distance map on the objects (foreground) of the image,
+ // instead of the (usual) background.
+ M dmap = transform::distance_geodesic(logical::not_(input), nbh_fg,
+ mln_max(D));
+ // Create a priority function (actually, an image) using the inverse
+ // of the distance map.
+ M priority = arith::revert(dmap);
+
+ I output = topo::skeleton::priority_driven_thinning(input, nbh_fg,
+ is_simple,
+ topo::detach_point,
+ priority);
+ io::pbm::save(output, "priority_driven_thinning-small.pbm");
+}
diff --git a/milena/tests/topo/skeleton/priority_driven_thinning_constrained.cc b/milena/tests/topo/skeleton/priority_driven_thinning_constrained.cc
new file mode 100644
index 0000000..822d5cd
--- /dev/null
+++ b/milena/tests/topo/skeleton/priority_driven_thinning_constrained.cc
@@ -0,0 +1,94 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+/// \file
+/// \brief Testing the computation of a skeleton of a 2D image using
+/// an priority-driven thinning preserving end points.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/topo/skeleton/priority_driven_thinning.hh>
+
+#include <mln/topo/is_simple_point2d.hh>
+#include <mln/topo/detach_point.hh>
+#include <mln/topo/is_not_end_point.hh>
+
+#include <mln/logical/not.hh>
+#include <mln/arith/revert.hh>
+#include <mln/transform/distance_geodesic.hh>
+
+#include <mln/io/pbm/all.hh>
+
+#include "tests/data.hh"
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef image2d<bool> I;
+ typedef neighb2d N;
+
+ // Add a border of (at least) 1 pixel, to a guarantee a meaningful
+ // result of the computation of connectivity numbers (called within
+ // is_simple_2d); indeed, this computation always expects each pixel
+ // to have 8 neighboring sites.
+ border::thickness = 1;
+
+ I input = io::pbm::load(MLN_IMG_DIR "/small.pbm");
+
+ // FIXME: Use a dual neighborhood instead?
+
+ // Foreground neighborhood.
+ neighb2d nbh_fg = c4();
+ // Background neighborhood.
+ neighb2d nbh_bg = c8();
+
+ // Simplicity criterion functor.
+ topo::is_simple_point2d<I, N> is_simple(nbh_fg, nbh_bg);
+ // Constraint: do not collapse end points.
+ topo::is_not_end_point<I, N> constraint(nbh_fg, input);
+
+ // Distance type.
+ typedef value::int_u8 D;
+ // Distance map type.
+ typedef image2d<D> M;
+
+ // Compute a distance map on the objects (foreground) of the image,
+ // instead of the (usual) background.
+ M dmap = transform::distance_geodesic(logical::not_(input), nbh_fg,
+ mln_max(D));
+ // Create a priority function (actually, an image) using the inverse
+ // of the distance map.
+ M priority = arith::revert(dmap);
+
+ I output = topo::skeleton::priority_driven_thinning(input, nbh_fg,
+ is_simple,
+ topo::detach_point,
+ priority,
+ constraint);
+ io::pbm::save(output, "priority_driven_thinning_constrained-small.pbm");
+}
--
1.5.6.5
* mln/topo/skeleton/priority_driven_thinning.hh: New.
* headers.mk: Regen.
---
milena/ChangeLog | 7 +
milena/headers.mk | 1 +
...rst_thinning.hh => priority_driven_thinning.hh} | 144 ++++++++++----------
3 files changed, 81 insertions(+), 71 deletions(-)
copy milena/mln/topo/skeleton/{breadth_first_thinning.hh => priority_driven_thinning.hh} (54%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f0bb818..b41024f 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+ New skeletonization algorithm: priority-driven thinning.
+
+ * mln/topo/skeleton/priority_driven_thinning.hh: New.
+ * headers.mk: Regen.
+
+2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+
Add helpers to compute skeletons by thinning on regular 2D images.
* mln/topo/is_simple_point2d.hh,
diff --git a/milena/headers.mk b/milena/headers.mk
index a4314f5..fd6169c 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -1016,6 +1016,7 @@ mln/topo/n_faces_set.hh \
mln/topo/skeleton/breadth_first_thinning.hh \
mln/topo/skeleton/crest.hh \
mln/topo/skeleton/is_simple_point.hh \
+mln/topo/skeleton/priority_driven_thinning.hh \
mln/topo/static_n_face_iter.hh \
mln/trace/all.hh \
mln/trace/entering.hh \
diff --git a/milena/mln/topo/skeleton/breadth_first_thinning.hh b/milena/mln/topo/skeleton/priority_driven_thinning.hh
similarity index 54%
copy from milena/mln/topo/skeleton/breadth_first_thinning.hh
copy to milena/mln/topo/skeleton/priority_driven_thinning.hh
index 3be9539..f074b6a 100644
--- a/milena/mln/topo/skeleton/breadth_first_thinning.hh
+++ b/milena/mln/topo/skeleton/priority_driven_thinning.hh
@@ -23,11 +23,11 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_TOPO_SKELETON_BREADTH_FIRST_THINNING_HH
-# define MLN_TOPO_SKELETON_BREADTH_FIRST_THINNING_HH
+#ifndef MLN_TOPO_SKELETON_PRIORITY_DRIVEN_THINNING_HH
+# define MLN_TOPO_SKELETON_PRIORITY_DRIVEN_THINNING_HH
/// \file
-/// \brief Computing a skeleton by using breadth-first thinning on a
+/// \brief Computing a skeleton by using priority-driven thinning on a
/// binary image.
# include <algorithm>
@@ -37,7 +37,8 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/p_set.hh>
+# include <mln/core/site_set/p_queue_fast.hh>
+# include <mln/core/site_set/p_priority.hh>
# include <mln/fun/p2b/tautology.hh>
@@ -50,10 +51,10 @@ namespace mln
namespace skeleton
{
- /** \brief Skeleton by Breadth-First Thinning.
+ /** \brief Skeleton by Priority-Driven Thinning.
A generic implementation of the computation of a skeleton
- using a breadth-first thinning on a binary image.
+ using a priority-driven thinning on a binary image.
\param input The input image.
\param nbh The adjacency relation between triangles.
@@ -61,22 +62,25 @@ namespace mln
(sites). This functor must provide a method
<tt>void set_image(const Image<I>&)</tt>.
\param detach A function used to detach a cell from \a input.
+ \param priority A priority function expressed as an image.
\param constraint A constraint on point (site); if it
returns \c false for a point, this point
will not be removed. */
- template <typename I, typename N, typename F, typename G, typename H>
+ template <typename I, typename N, typename F, typename G, typename J,
+ typename H>
mln_concrete(I)
- breadth_first_thinning(const Image<I>& input,
- const Neighborhood<N>& nbh,
- Function_v2b<F>& is_simple,
- G detach,
- const Function_v2b<H>& constraint);
+ priority_driven_thinning(const Image<I>& input,
+ const Neighborhood<N>& nbh,
+ Function_v2b<F>& is_simple,
+ G detach,
+ const Image<J>& priority,
+ const Function_v2b<H>& constraint);
- /** \brief Skeleton by Breadth-First Thinning with no constraint.
+ /** \brief Skeleton by Priority-Driven Thinning with no constraint.
A generic implementation of the computation of a skeleton
- using a breadth-first thinning on a binary image.
+ using a priority-driven thinning on a binary image.
\param input The input image.
\param nbh The adjacency relation between triangles.
@@ -84,31 +88,36 @@ namespace mln
(sites). This functor must provide a method
<tt>void set_image(const Image<I>&)</tt>.
\param detach A function used to detach a cell from
- \a input. */
- template <typename I, typename N, typename F, typename G>
+ \a input.
+ \param priority A priority function expressed as an image. */
+ template <typename I, typename N, typename F, typename G, typename J>
mln_concrete(I)
- breadth_first_thinning(const Image<I>& input,
- const Neighborhood<N>& nbh,
- Function_v2b<F>& is_simple,
- G detach);
+ priority_driven_thinning(const Image<I>& input,
+ const Neighborhood<N>& nbh,
+ Function_v2b<F>& is_simple,
+ G detach,
+ const Image<J>& priority);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename F, typename G, typename H>
+ template <typename I, typename N, typename F, typename G, typename J,
+ typename H>
inline
mln_concrete(I)
- breadth_first_thinning(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- Function_v2b<F>& is_simple_,
- G detach,
- const Function_v2b<H>& constraint_)
+ priority_driven_thinning(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ Function_v2b<F>& is_simple_,
+ G detach,
+ const Image<J>& priority_,
+ const Function_v2b<H>& constraint_)
{
- trace::entering("topo::skeleton::breadth_first_thinning");
+ trace::entering("topo::skeleton::priority_driven_thinning");
const I& input = exact(input_);
const N& nbh = exact(nbh_);
F& is_simple = exact(is_simple_);
+ const J& priority = exact(priority_);
const H& constraint = exact(constraint_);
mln_concrete(I) output = duplicate(input);
@@ -116,9 +125,10 @@ namespace mln
is_simple.set_image(output);
typedef mln_psite(I) psite;
- typedef p_set<psite> set_t;
- set_t set;
- // Populate SET with candidate simple points.
+ typedef p_queue_fast<psite> queue_t;
+ typedef p_priority<mln_value(J), queue_t> p_queue_t;
+ p_queue_t p_queue;
+ // Populate P_QUEUE with candidate simple points.
mln_piter(I) p_(output.domain());
for_all(p_)
{
@@ -129,60 +139,52 @@ namespace mln
the compiler and pass an actual, explicit psite. */
psite p = p_;
if (output(p) && constraint(p) && is_simple(p))
- set.insert(p);
+ p_queue.push(priority(p), p);
}
- while (!set.is_empty())
+ while (!p_queue.is_empty())
{
- set_t next_set;
-
- mln_piter(set_t) ps(set);
- for_all(ps)
- {
- // Same remark as above.
- psite p = ps;
-
- /* FIXME: We compute the cell and attachment of P twice:
- during the call to is_simple() and within detach().
- How could we reuse this elegantly, without breaking
- the genericity of the skeleton algorithm?
- Also, keep in mind that functors can maintain an
- internal state and make side effects, meaning that
- e.g. constraint(p) might not be constant for a
- given p during the thinning. */
- if (output(p) && constraint(p) && is_simple(p))
+ psite p = p_queue.pop_front();
+
+ /* FIXME: We compute the cell and attachment of P twice:
+ during the call to is_simple() and within detach().
+ How could we reuse this elegantly, without breaking
+ the genericity of the skeleton algorithm?
+ Also, keep in mind that functors can maintain an
+ internal state and make side effects, meaning that
+ e.g. constraint(p) might not be constant for a
+ given p during the thinning. */
+ if (output(p) && constraint(p) && is_simple(p))
+ {
+ detach(p, output);
+ mln_niter(N) n_(nbh, p);
+ for_all(n_)
{
- detach(p, output);
- mln_niter(N) n_(nbh, p);
- for_all(n_)
- {
- // Same remark as above regarding P and P_.
- psite n = n_;
- if (output.domain().has(n)
- && output(n) && constraint(n) && is_simple(n))
- next_set.insert(n);
- }
+ // Same remark as above regarding P and P_.
+ psite n = n_;
+ if (output.domain().has(n)
+ && output(n) && constraint(n) && is_simple(n))
+ p_queue.push(priority(n), n);
}
- }
- set.clear();
- std::swap(set, next_set);
+ }
}
- trace::exiting("topo::skeleton::breadth_first_thinning");
+ trace::exiting("topo::skeleton::priority_driven_thinning");
return output;
}
- template <typename I, typename N, typename F, typename G>
+ template <typename I, typename N, typename F, typename G, typename J>
inline
mln_concrete(I)
- breadth_first_thinning(const Image<I>& input,
- const Neighborhood<N>& nbh,
- Function_v2b<F>& is_simple,
- G detach)
+ priority_driven_thinning(const Image<I>& input,
+ const Neighborhood<N>& nbh,
+ Function_v2b<F>& is_simple,
+ G detach,
+ const Image<J>& priority)
{
- return breadth_first_thinning(input, nbh, is_simple, detach,
- fun::p2b::tautology());
+ return priority_driven_thinning(input, nbh, is_simple, detach,
+ priority, fun::p2b::tautology());
}
# endif // MLN_INCLUDE_ONLY
@@ -193,4 +195,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_TOPO_SKELETON_BREADTH_FIRST_THINNING_HH
+#endif // ! MLN_TOPO_SKELETON_PRIORITY_DRIVEN_THINNING_HH
--
1.5.6.5
* mln/topo/is_simple_point2d.hh,
* mln/topo/detach_point.hh,
* mln/topo/is_not_end_point.hh:
New.
* headers.mk: Regen.
---
milena/ChangeLog | 10 ++
milena/headers.mk | 3 +
.../mln/{fun/p2b/chess.hh => topo/detach_point.hh} | 54 ++++-----
.../estimate.hh => mln/topo/is_not_end_point.hh} | 90 ++++++-------
milena/mln/topo/is_simple_point2d.hh | 140 ++++++++++++++++++++
5 files changed, 220 insertions(+), 77 deletions(-)
copy milena/mln/{fun/p2b/chess.hh => topo/detach_point.hh} (65%)
copy milena/{sandbox/theo/estimate.hh => mln/topo/is_not_end_point.hh} (52%)
create mode 100644 milena/mln/topo/is_simple_point2d.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 69123c5..f0bb818 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,15 @@
2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+ Add helpers to compute skeletons by thinning on regular 2D images.
+
+ * mln/topo/is_simple_point2d.hh,
+ * mln/topo/detach_point.hh,
+ * mln/topo/is_not_end_point.hh:
+ New.
+ * headers.mk: Regen.
+
+2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+
Add tracing mechanism to breadth-first thinning.
* mln/topo/skeleton/breadth_first_thinning.hh: Here.
diff --git a/milena/headers.mk b/milena/headers.mk
index 110caa6..a4314f5 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -995,6 +995,7 @@ mln/topo/centered_iter_adapter.hh \
mln/topo/complex.hh \
mln/topo/complex_iterators.hh \
mln/topo/detach.hh \
+mln/topo/detach_point.hh \
mln/topo/essential.hh \
mln/topo/face.hh \
mln/topo/face_data.hh \
@@ -1005,8 +1006,10 @@ mln/topo/internal/complex_relative_iterator_sequence.hh \
mln/topo/internal/complex_set_iterator_base.hh \
mln/topo/is_facet.hh \
mln/topo/is_n_face.hh \
+mln/topo/is_not_end_point.hh \
mln/topo/is_simple_2d.hh \
mln/topo/is_simple_cell.hh \
+mln/topo/is_simple_point2d.hh \
mln/topo/n_face.hh \
mln/topo/n_face_iter.hh \
mln/topo/n_faces_set.hh \
diff --git a/milena/mln/fun/p2b/chess.hh b/milena/mln/topo/detach_point.hh
similarity index 65%
copy from milena/mln/fun/p2b/chess.hh
copy to milena/mln/topo/detach_point.hh
index 53aae9c..818f7cd 100644
--- a/milena/mln/fun/p2b/chess.hh
+++ b/milena/mln/topo/detach_point.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,51 +23,43 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_FUN_P2B_CHESS_HH
-# define MLN_FUN_P2B_CHESS_HH
+#ifndef MLN_TOPO_DETACH_POINT_HH
+# define MLN_TOPO_DETACH_POINT_HH
/// \file
-///
-/// FIXME.
+/// \brief Detaching a point from a binary image.
-# include <mln/core/concept/function.hh>
-# include <mln/core/alias/point2d.hh>
+// FIXME: Not generic. Swap arguments and use Image<I> and
+// mln_psite(I) as types.
+# include <mln/core/image/image2d.hh>
+# include <mln/core/alias/point2d.hh>
namespace mln
{
- namespace fun
+ namespace topo
{
-
- namespace p2b
- {
-
- // FIXME: Doc!
-
- struct chess : public Function_v2b< chess >
- {
- typedef bool result;
- bool operator()(const point2d& p) const;
- };
+
+ /// \brief Detach a point from a binary image.
+ inline
+ void
+ detach_point(const mln::point2d& p, mln::image2d<bool>& ima);
# ifndef MLN_INCLUDE_ONLY
- inline
- bool
- chess::operator()(const point2d& p) const
- {
- return (p.row() + p.col()) % 2 == 0;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
+ inline
+ void
+ detach_point(const mln::point2d& p, mln::image2d<bool>& ima)
+ {
+ ima(p) = false;
+ }
- } // end of namespace mln::fun::p2b
+# endif // MLN_INCLUDE_ONLY
- } // end of namespace mln::fun
+ } // end of namespace mln::topo
} // end of namespace mln
-
-#endif // ! MLN_FUN_P2B_CHESS_HH
+#endif // ! MLN_TOPO_DETACH_POINT_HH
diff --git a/milena/sandbox/theo/estimate.hh b/milena/mln/topo/is_not_end_point.hh
similarity index 52%
copy from milena/sandbox/theo/estimate.hh
copy to milena/mln/topo/is_not_end_point.hh
index bfd98aa..3c419ec 100644
--- a/milena/sandbox/theo/estimate.hh
+++ b/milena/mln/topo/is_not_end_point.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,66 +25,64 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LABELING_ESTIMATE_HH
-# define MLN_LABELING_ESTIMATE_HH
+#ifndef MLN_TOPO_IS_NOT_END_POINT_HH
+# define MLN_TOPO_IS_NOT_END_POINT_HH
-/*! \file mln/labeling/estimate.hh
- *
- * \brief Compute the estimate pixel value.
- */
+/// \file
+/// \brief Non end point predicate in binary images.
+# include <mln/core/concept/function.hh>
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
-# include <mln/canvas/labeling.hh>
-
-# include <mln/accu/compute.hh>
-// # include <mln/core/image_if_value.hh>
-
namespace mln
{
- namespace labeling
+ namespace topo
{
-
- /*! \brief Label a binary image and compute some estimations over
- * the components.
- *
- * \param[in] input The image.
- *
- * The free parameter \c A is a type of accumulator.
- *
- * FIXME: Not yet impled.
- */
- template <typename A, typename I>
- void
- estimate(const Image<I>& input);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename A, typename I>
- void
- estimate(const Image<I>& input)
+ /// \brief Functor determining whether a point is not an end point
+ /// in image of type \p I, based on neighborhood of type \p N.
+ template <typename I, typename N>
+ struct is_not_end_point : public Function_v2b< is_not_end_point<I, N> >
{
- trace::entering("labeling::estimate");
- mlc_equal(mln_trait_image_kind(I), mln::trait::image::kind::binary)::check();
- mln_precondition(exact(input).is_valid());
-
- std::cerr << "Sorry: mln::labeling::estimate is not yet implemented!" << std::endl;
+ /// Build a functor, and assign an image to it.
+ ///
+ /// \param nbh_fg The foreground neighborhood.
+ /// \apram ima The image.
+ is_not_end_point(const Neighborhood<N>& nbh,
+ const Image<I>& ima)
+ : nbh_(exact(nbh)),
+ ima_(exact(ima))
+ {
+ }
+
+ // Is \a p not na end point?
+ bool operator()(const mln_psite(I)& p) const
+ {
+ // Number of foreground neighbors pixels.
+ unsigned nneighbs = 0;
+ mln_niter(N) n(nbh_, p);
+ for_all(n)
+ if (ima_.has(n) && ima_(n))
+ ++nneighbs;
+ return nneighbs != 1;
+ }
+
+ private:
+ /// The foreground neighborhood.
+ const N& nbh_;
+ /// The image.
+ const I& ima_;
+ };
- // FIXME: Was:
- // mln_accu_with(A, util::pix<I>)::result res = accu::compute<A>(input | val);
+# ifndef MLN_INCLUDE_ONLY
- trace::exiting("labeling::estimate");
- }
-# endif // ! MLN_INCLUDE_ONLY
+# endif // MLN_INCLUDE_ONLY
- } // end of namespace mln::labeling
+ } // end of namespace topo
} // end of namespace mln
-
-#endif // ! MLN_LABELING_ESTIMATE_HH
+#endif // ! MLN_TOPO_IS_NOT_END_POINT_HH
diff --git a/milena/mln/topo/is_simple_point2d.hh b/milena/mln/topo/is_simple_point2d.hh
new file mode 100644
index 0000000..145b9d8
--- /dev/null
+++ b/milena/mln/topo/is_simple_point2d.hh
@@ -0,0 +1,140 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_TOPO_IS_SIMPLE_POINT2D_HH
+# define MLN_TOPO_IS_SIMPLE_POINT2D_HH
+
+/// \file
+/// \brief Testing whether an mln::point2d is a simple point.
+
+# include <mln/core/concept/function.hh>
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+
+# include <mln/topo/is_simple_2d.hh>
+
+
+namespace mln
+{
+
+ namespace topo
+ {
+
+ /** \brief A predicate for the simplicity of an mln::point2d based
+ on based on the mask-based criterion mln::topo::is_simple_2d.
+
+ This functor acts as an adapter, since mln::topo::is_simple_2d
+ does not fit (yet) in the canvas of
+ mln::topo::skeleton::breadth_first_thinning. Moreover, this
+ code is a bit easier to read since it does not make use of a
+ dual neighborhood (having a long and complex type). */
+ template <typename I, typename N>
+ class is_simple_point2d : public Function_v2b< is_simple_point2d<I, N> >
+ {
+ public:
+ /// Result type of the functor.
+ typedef bool result;
+
+ /// Build a functor.
+ ///
+ /// \param nbh_fg The foreground neighborhood.
+ /// \param nbh_bg The background neighborhood.
+ is_simple_point2d(const Neighborhood<N>& nbh_fg,
+ const Neighborhood<N>& nbh_bg);
+
+ /// Build a functor, and assign an image to it.
+ ///
+ /// \param nbh_fg The foreground neighborhood.
+ /// \param nbh_bg The background neighborhood.
+ /// \apram ima The image.
+ is_simple_point2d(const Neighborhood<N>& nbh_fg,
+ const Neighborhood<N>& nbh_bg,
+ const Image<I>& ima);
+
+ /// Set the underlying image.
+ void set_image(const Image<I>& ima);
+
+ /// \brief Tell whether \a p is a simple point or not.
+ ///
+ /// This computation is based on connectivity numbers.
+ bool operator()(const mln_psite(I)& p) const;
+
+ private:
+ /// The foreground neighborhood.
+ const N& nbh_fg_;
+ /// The background neighborhood.
+ const N& nbh_bg_;
+ /// The image.
+ const I* ima_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename N>
+ inline
+ is_simple_point2d<I, N>::is_simple_point2d(const Neighborhood<N>& nbh_fg,
+ const Neighborhood<N>& nbh_bg)
+ : nbh_fg_(exact(nbh_fg)), nbh_bg_(exact(nbh_bg)),
+ ima_(0)
+ {
+ }
+
+ template <typename I, typename N>
+ inline
+ is_simple_point2d<I, N>::is_simple_point2d(const Neighborhood<N>& nbh_fg,
+ const Neighborhood<N>& nbh_bg,
+ const Image<I>& ima)
+ : nbh_fg_(exact(nbh_fg)), nbh_bg_(exact(nbh_bg)),
+ ima_(exact(&ima))
+ {
+ }
+
+ template <typename I, typename N>
+ inline
+ void
+ is_simple_point2d<I, N>::set_image(const Image<I>& ima)
+ {
+ ima_ = exact(&ima);
+ }
+
+ template <typename I, typename N>
+ inline
+ bool
+ is_simple_point2d<I, N>::operator()(const mln_psite(I)& p) const
+ {
+ return
+ connectivity_number_2d(*ima_, nbh_fg_, p, true ) == 1 &&
+ connectivity_number_2d(*ima_, nbh_bg_, p, false) == 1;
+ }
+
+# endif // MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::topo
+
+} // end of namespace mln
+
+#endif // ! MLN_TOPO_IS_SIMPLE_POINT2D_HH
--
1.5.6.5
* mln/topo/skeleton/breadth_first_thinning.hh: Here.
Typos and aesthetic changes.
---
milena/ChangeLog | 7 ++++
milena/mln/topo/skeleton/breadth_first_thinning.hh | 36 +++++++++++---------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7dfe92c..69123c5 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+ Add tracing mechanism to breadth-first thinning.
+
+ * mln/topo/skeleton/breadth_first_thinning.hh: Here.
+ Typos and aesthetic changes.
+
+2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+
Small fix in breadth-first thinning.
* mln/topo/skeleton/breadth_first_thinning.hh: Do not try to
diff --git a/milena/mln/topo/skeleton/breadth_first_thinning.hh b/milena/mln/topo/skeleton/breadth_first_thinning.hh
index def3a7a..3be9539 100644
--- a/milena/mln/topo/skeleton/breadth_first_thinning.hh
+++ b/milena/mln/topo/skeleton/breadth_first_thinning.hh
@@ -53,17 +53,17 @@ namespace mln
/** \brief Skeleton by Breadth-First Thinning.
A generic implementation of the computation of a skeleton
- using a breadth-first thinning on a binary.
+ using a breadth-first thinning on a binary image.
- \param input The input image.
- \param nbh The adjacency relation between triangles.
- \param is_simple The predicate on the simplicity of points
- (sites). This functor must provide a method
- <tt>void set_image(const Image<I>&)</tt>.
+ \param input The input image.
+ \param nbh The adjacency relation between triangles.
+ \param is_simple The predicate on the simplicity of points
+ (sites). This functor must provide a method
+ <tt>void set_image(const Image<I>&)</tt>.
\param detach A function used to detach a cell from \a input.
- \param constraint A constraint on point (site); if it
- returns \c false for a point, this point
- will not be removed. */
+ \param constraint A constraint on point (site); if it
+ returns \c false for a point, this point
+ will not be removed. */
template <typename I, typename N, typename F, typename G, typename H>
mln_concrete(I)
breadth_first_thinning(const Image<I>& input,
@@ -76,15 +76,15 @@ namespace mln
/** \brief Skeleton by Breadth-First Thinning with no constraint.
A generic implementation of the computation of a skeleton
- using a breadth-first thinning on a binary.
+ using a breadth-first thinning on a binary image.
- \param input The input image.
- \param nbh The adjacency relation between triangles.
- \param is_simple The predicate on the simplicity of points
- (sites). This functor must provide a method
- <tt>void set_image(const Image<I>&)</tt>.
+ \param input The input image.
+ \param nbh The adjacency relation between triangles.
+ \param is_simple The predicate on the simplicity of points
+ (sites). This functor must provide a method
+ <tt>void set_image(const Image<I>&)</tt>.
\param detach A function used to detach a cell from
- \a input. */
+ \a input. */
template <typename I, typename N, typename F, typename G>
mln_concrete(I)
breadth_first_thinning(const Image<I>& input,
@@ -104,6 +104,8 @@ namespace mln
G detach,
const Function_v2b<H>& constraint_)
{
+ trace::entering("topo::skeleton::breadth_first_thinning");
+
const I& input = exact(input_);
const N& nbh = exact(nbh_);
F& is_simple = exact(is_simple_);
@@ -165,6 +167,8 @@ namespace mln
set.clear();
std::swap(set, next_set);
}
+
+ trace::exiting("topo::skeleton::breadth_first_thinning");
return output;
}
--
1.5.6.5
* mln/topo/skeleton/breadth_first_thinning.hh: Do not try to
detach an aldready processed site.
---
milena/ChangeLog | 7 +++++++
milena/mln/topo/skeleton/breadth_first_thinning.hh | 2 +-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 18e4ada..7dfe92c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-15 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Small fix in breadth-first thinning.
+
+ * mln/topo/skeleton/breadth_first_thinning.hh: Do not try to
+ detach an aldready processed site.
+
2010-09-09 Roland Levillain <roland(a)lrde.epita.fr>
Make the 5th argument of breadth_first_thinning truly optional.
diff --git a/milena/mln/topo/skeleton/breadth_first_thinning.hh b/milena/mln/topo/skeleton/breadth_first_thinning.hh
index f405166..def3a7a 100644
--- a/milena/mln/topo/skeleton/breadth_first_thinning.hh
+++ b/milena/mln/topo/skeleton/breadth_first_thinning.hh
@@ -148,7 +148,7 @@ namespace mln
internal state and make side effects, meaning that
e.g. constraint(p) might not be constant for a
given p during the thinning. */
- if (constraint(p) && is_simple(p))
+ if (output(p) && constraint(p) && is_simple(p))
{
detach(p, output);
mln_niter(N) n_(nbh, p);
--
1.5.6.5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/next-build-ok has been updated
via 6713b18ae5ff02fd54f2496881ccb1118c02f45c (commit)
from 4515a1dc6803595b389196a908ed01c18c63a804 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
6713b18 Temporarily disable static tests on Magick::Quantum type size.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 7 +++++++
milena/mln/io/magick/load.hh | 4 +++-
milena/mln/io/magick/save.hh | 6 ++++--
3 files changed, 14 insertions(+), 3 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform