https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix missing files and tests in world inter-pixel.
* mln/world/inter_pixel/all.hh: New.
* mln/world/inter_pixel/dim2/all.hh: Fix copyright.
* mln/world/all.hh: New.
* mln/all.hh: Update.
* tests/world/inter_pixel/is_separator.cc: New.
* tests/world/inter_pixel/is_pixel.cc: New.
* tests/world/inter_pixel/Makefile.am: Update.
* tests/world/inter_pixel/separator_to_pixels.cc: New.
* mln/world/inter_pixel/make: Remove; useless.
* tests/world/inter_pixel/image2full.cc: Remove;
new stuff is...
* tests/world/inter_pixel/immerse.hh: ...this.
mln/all.hh | 1
mln/world/all.hh | 41 ++++++++++++++++++
mln/world/inter_pixel/all.hh | 47 ++++++++++++++++++++
mln/world/inter_pixel/dim2/all.hh | 6 +-
tests/world/inter_pixel/Makefile.am | 12 ++++-
tests/world/inter_pixel/is_pixel.cc | 46 ++++++++++++++++++++
tests/world/inter_pixel/is_separator.cc | 47 ++++++++++++++++++++
tests/world/inter_pixel/separator_to_pixels.cc | 56 +++++++++++++++++++++++++
8 files changed, 250 insertions(+), 6 deletions(-)
Index: mln/world/inter_pixel/all.hh
--- mln/world/inter_pixel/all.hh (revision 0)
+++ mln/world/inter_pixel/all.hh (revision 0)
@@ -0,0 +1,47 @@
+// Copyright (C) 2009 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_WORLD_INTER_PIXEL_ALL_HH
+# define MLN_WORLD_INTER_PIXEL_ALL_HH
+
+/// \file mln/world/inter_pixel/all.hh
+///
+/// File that includes all the inter-pixel routines.
+
+
+// Sub-directories.
+# include <mln/world/inter_pixel/dim2/all.hh>
+
+
+# include <mln/world/inter_pixel/compute.hh>
+# include <mln/world/inter_pixel/immerse.hh>
+# include <mln/world/inter_pixel/is_separator.hh>
+# include <mln/world/inter_pixel/is_pixel.hh>
+# include <mln/world/inter_pixel/separator_to_pixels.hh>
+
+
+#endif // ! MLN_WORLD_INTER_PIXEL_ALL_HH
Index: mln/world/inter_pixel/dim2/all.hh
--- mln/world/inter_pixel/dim2/all.hh (revision 3770)
+++ mln/world/inter_pixel/dim2/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 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
@@ -30,10 +31,9 @@
/// \file mln/world/inter_pixel/dim2/all.hh
///
-/// File that includes all the dim2 routines.
+/// File that includes all the inter-pixel 2D routines.
-// Local directory.
# include <mln/world/inter_pixel/dim2/is_dot.hh>
# include <mln/world/inter_pixel/dim2/is_edge.hh>
# include <mln/world/inter_pixel/dim2/is_pixel.hh>
Index: mln/world/all.hh
--- mln/world/all.hh (revision 0)
+++ mln/world/all.hh (revision 0)
@@ -0,0 +1,41 @@
+// Copyright (C) 2009 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_WORLD_ALL_HH
+# define MLN_WORLD_ALL_HH
+
+/// \file mln/world/all.hh
+///
+/// File that includes all the world routines.
+
+
+// Sub-directories.
+# include <mln/world/binary_2d/all.hh>
+# include <mln/world/inter_pixel/all.hh>
+
+
+#endif // ! MLN_WORLD_ALL_HH
Index: mln/all.hh
--- mln/all.hh (revision 3770)
+++ mln/all.hh (working copy)
@@ -72,6 +72,7 @@
#include <mln/util/all.hh>
#include <mln/value/all.hh>
#include <mln/win/all.hh>
+#include <mln/world/all.hh>
#include <mln/essential/1d.hh>
#include <mln/essential/2d.hh>
Index: tests/world/inter_pixel/is_separator.cc
--- tests/world/inter_pixel/is_separator.cc (revision 0)
+++ tests/world/inter_pixel/is_separator.cc (revision 0)
@@ -0,0 +1,47 @@
+// Copyright (C) 2009 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.
+
+/// \file tests/world/inter_pixel/is_separator.cc
+///
+/// Tests on mln::world::inter_pixel::is_separator.
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/inter_pixel/is_separator.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using namespace world::inter_pixel;
+
+ point2d p00(0, 0), p01(0, 1), p10(1, 0), p11(1, 1);
+
+ mln_assertion(! is_separator()(p00));
+ mln_assertion( is_separator()(p01));
+ mln_assertion(! is_separator()(p11));
+ mln_assertion( is_separator()(p10));
+}
Property changes on: tests/world/inter_pixel/is_separator.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: tests/world/inter_pixel/is_pixel.cc
--- tests/world/inter_pixel/is_pixel.cc (revision 0)
+++ tests/world/inter_pixel/is_pixel.cc (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (C) 2009 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.
+
+/// \file tests/world/inter_pixel/is_pixel.cc
+///
+/// Tests on mln::world::inter_pixel::is_pixel.
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/inter_pixel/is_pixel.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using namespace world::inter_pixel;
+
+ point2d p00(0, 0), p01(0, 1), p11(1, 1);
+
+ mln_assertion( is_pixel()(p00));
+ mln_assertion(! is_pixel()(p01));
+ mln_assertion(! is_pixel()(p11));
+}
Index: tests/world/inter_pixel/Makefile.am
--- tests/world/inter_pixel/Makefile.am (revision 3770)
+++ tests/world/inter_pixel/Makefile.am (working copy)
@@ -6,10 +6,16 @@
dim2
check_PROGRAMS = \
- image2full \
- immerse
+ compute \
+ immerse \
+ is_pixel \
+ is_separator \
+ separator_to_pixels
-image2full_SOURCES = image2full.cc
+compute_SOURCES = compute.cc
immerse_SOURCES = immerse.cc
+is_pixel_SOURCES = is_pixel.cc
+is_separator_SOURCES = is_separator.cc
+separator_to_pixels_SOURCES = separator_to_pixels.cc
TESTS = $(check_PROGRAMS)
Index: tests/world/inter_pixel/separator_to_pixels.cc
--- tests/world/inter_pixel/separator_to_pixels.cc (revision 0)
+++ tests/world/inter_pixel/separator_to_pixels.cc (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 2009 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.
+
+/// \file tests/world/inter_pixel/separator_to_pixels.cc
+///
+/// Tests on mln::world::inter_pixel::separator_to_pixels.
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/inter_pixel/separator_to_pixels.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using namespace world::inter_pixel;
+
+ point2d
+ p00(0, 0), p01(0, 1), p02(0, 2),
+ p10(1, 0),
+ p20(2, 0);
+
+ {
+ point2d p00_, p02_;
+ separator_to_pixels(p01, p00_, p02_);
+ mln_assertion(p00_ == p00 && p02_ == p02);
+ }
+ {
+ point2d p00_, p20_;
+ separator_to_pixels(p10, p00_, p20_);
+ mln_assertion(p00_ == p00 && p20_ == p20);
+ }
+}
* mln/debug/colorize.hh: move...
* mln/labeling/colorize.hh: ... here.
* tests/labeling/Makefile.am,
* tests/labeling/colorize.cc: add a new test.
---
milena/ChangeLog | 10 +++++
milena/mln/{debug => labeling}/colorize.hh | 40 ++++++++++++++++---
milena/tests/labeling/Makefile.am | 2 +
milena/tests/labeling/colorize.cc | 56 ++++++++++++++++++++++++++++
4 files changed, 101 insertions(+), 7 deletions(-)
rename milena/mln/{debug => labeling}/colorize.hh (80%)
create mode 100644 milena/tests/labeling/colorize.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c69383e..4430b6c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-07 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Move debug::colorize to labeling::colorize.
+
+ * mln/debug/colorize.hh: move...
+ * mln/labeling/colorize.hh: ... here.
+
+ * tests/labeling/Makefile.am,
+ * tests/labeling/colorize.cc: add a new test.
+
2009-05-07 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Several fixes and new stuff.
diff --git a/milena/mln/debug/colorize.hh b/milena/mln/labeling/colorize.hh
similarity index 80%
rename from milena/mln/debug/colorize.hh
rename to milena/mln/labeling/colorize.hh
index 4f492bf..49b1f63 100644
--- a/milena/mln/debug/colorize.hh
+++ b/milena/mln/labeling/colorize.hh
@@ -29,7 +29,7 @@
#ifndef MLN_DEBUG_COLORIZE_HH
# define MLN_DEBUG_COLORIZE_HH
-/// \file mln/debug/colorize.hh
+/// \file mln/labeling/colorize.hh
///
/// Fill an image with successive values.
@@ -38,12 +38,14 @@
# include <mln/value/rgb8.hh>
# include <mln/literal/black.hh>
# include <mln/level/transform.hh>
+# include <mln/level/compute.hh>
+# include <mln/accu/max.hh>
namespace mln
{
- namespace debug
+ namespace labeling
{
namespace colorize_
@@ -58,8 +60,8 @@ namespace mln
/*!
* litera::black is used for component 0, e.g. the background.
* Min and max values for RGB values can be set through the global
- * variables mln::debug::colorize_::min_value and
- * mln::debug::colorize_::max_value.
+ * variables mln::labeling::colorize_::min_value and
+ * mln::labeling::colorize_::max_value.
*
* \param[in] value value type used in the returned image.
* \param[in] labeled_image A labeled image (\sa labeling::blobs).
@@ -72,6 +74,12 @@ namespace mln
const mln_value(L)& nlabels);
+ template <typename V, typename L>
+ mln_ch_value(L, V)
+ colorize(const V& value,
+ const Image<L>& labeled_image);
+
+
# ifndef MLN_INCLUDE_ONLY
namespace colorize_
@@ -105,7 +113,7 @@ namespace mln
const Image<L>& input,
const mln_value(L)& nlabels)
{
- trace::entering("debug::colorize");
+ trace::entering("labeling::colorize");
mln_precondition(exact(input).is_valid());
// FIXME: check that V is a color type.
// FIXME: we want to be sure that this is a label.
@@ -132,13 +140,31 @@ namespace mln
mln_assertion(f.size() >= (label_count));
mln_ch_value(L, V) output = level::transform(input, f);
- trace::exiting("debug::colorize");
+ trace::exiting("labeling::colorize");
+ return output;
+ }
+
+ template <typename V, typename L>
+ inline
+ mln_ch_value(L, V)
+ colorize(const V& value,
+ const Image<L>& input)
+ {
+ trace::entering("labeling::colorize");
+ mln_precondition(exact(input).is_valid());
+
+ accu::max<mln_value(L)> accu;
+ mln_value(L) nlabels = level::compute(accu, input);
+
+ mln_ch_value(L,V) output = colorize(value, input, nlabels);
+
+ trace::exiting("labeling::colorize");
return output;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::debug
+ } // end of namespace mln::labeling
} // end of namespace mln
diff --git a/milena/tests/labeling/Makefile.am b/milena/tests/labeling/Makefile.am
index 411674e..0dfb121 100644
--- a/milena/tests/labeling/Makefile.am
+++ b/milena/tests/labeling/Makefile.am
@@ -5,6 +5,7 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
background \
blobs \
+ colorize \
compute \
fill_holes \
flat_zones \
@@ -20,6 +21,7 @@ check_PROGRAMS = \
background_SOURCES = background.cc
blobs_SOURCES = blobs.cc
+colorize_SOURCES = colorize.cc
compute_SOURCES = compute.cc
fill_holes_SOURCES = fill_holes.cc
flat_zones_SOURCES = flat_zones.cc
diff --git a/milena/tests/labeling/colorize.cc b/milena/tests/labeling/colorize.cc
new file mode 100644
index 0000000..e424473
--- /dev/null
+++ b/milena/tests/labeling/colorize.cc
@@ -0,0 +1,56 @@
+// Copyright (C) 2009 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.
+
+/// \file tests/labeling/colorize.cc
+///
+/// Test on mln::labeling::colorize.
+
+# include <mln/make/image.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/value/int_u8.hh>
+# include <mln/labeling/colorize.hh>
+# include <mln/level/compare.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ value::int_u8 values[][2] = { { 3, 3 },
+ { 0, 0 } };
+
+ typedef value::rgb8 rgb_t;
+ value::rgb8 ref_data[][2] = { { rgb_t(89,92,86), rgb_t(89,92,86) },
+ { rgb_t(0,0,0), rgb_t(0,0,0) } };
+
+ image2d<value::int_u8> ima = make::image(values);
+ image2d<rgb_t> ref = make::image(ref_data);
+
+ image2d<value::rgb8> ima_color = labeling::colorize(value::rgb8(), ima);
+
+ mln_assertion(ref == ima_color);
+}
--
1.6.1.2
* mln/debug/colorize.hh: move...
* mln/labeling/colorize.hh: ... here.
* tests/labeling/Makefile.am,
* tests/labeling/colorize.cc: add a new test.
---
milena/ChangeLog | 10 +++++
milena/mln/{debug => labeling}/colorize.hh | 40 ++++++++++++++++---
milena/tests/labeling/Makefile.am | 2 +
milena/tests/labeling/colorize.cc | 56 ++++++++++++++++++++++++++++
4 files changed, 101 insertions(+), 7 deletions(-)
rename milena/mln/{debug => labeling}/colorize.hh (80%)
create mode 100644 milena/tests/labeling/colorize.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c69383e..4430b6c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-07 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Move debug::colorize to labeling::colorize.
+
+ * mln/debug/colorize.hh: move...
+ * mln/labeling/colorize.hh: ... here.
+
+ * tests/labeling/Makefile.am,
+ * tests/labeling/colorize.cc: add a new test.
+
2009-05-07 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Several fixes and new stuff.
diff --git a/milena/mln/debug/colorize.hh b/milena/mln/labeling/colorize.hh
similarity index 80%
rename from milena/mln/debug/colorize.hh
rename to milena/mln/labeling/colorize.hh
index 4f492bf..49b1f63 100644
--- a/milena/mln/debug/colorize.hh
+++ b/milena/mln/labeling/colorize.hh
@@ -29,7 +29,7 @@
#ifndef MLN_DEBUG_COLORIZE_HH
# define MLN_DEBUG_COLORIZE_HH
-/// \file mln/debug/colorize.hh
+/// \file mln/labeling/colorize.hh
///
/// Fill an image with successive values.
@@ -38,12 +38,14 @@
# include <mln/value/rgb8.hh>
# include <mln/literal/black.hh>
# include <mln/level/transform.hh>
+# include <mln/level/compute.hh>
+# include <mln/accu/max.hh>
namespace mln
{
- namespace debug
+ namespace labeling
{
namespace colorize_
@@ -58,8 +60,8 @@ namespace mln
/*!
* litera::black is used for component 0, e.g. the background.
* Min and max values for RGB values can be set through the global
- * variables mln::debug::colorize_::min_value and
- * mln::debug::colorize_::max_value.
+ * variables mln::labeling::colorize_::min_value and
+ * mln::labeling::colorize_::max_value.
*
* \param[in] value value type used in the returned image.
* \param[in] labeled_image A labeled image (\sa labeling::blobs).
@@ -72,6 +74,12 @@ namespace mln
const mln_value(L)& nlabels);
+ template <typename V, typename L>
+ mln_ch_value(L, V)
+ colorize(const V& value,
+ const Image<L>& labeled_image);
+
+
# ifndef MLN_INCLUDE_ONLY
namespace colorize_
@@ -105,7 +113,7 @@ namespace mln
const Image<L>& input,
const mln_value(L)& nlabels)
{
- trace::entering("debug::colorize");
+ trace::entering("labeling::colorize");
mln_precondition(exact(input).is_valid());
// FIXME: check that V is a color type.
// FIXME: we want to be sure that this is a label.
@@ -132,13 +140,31 @@ namespace mln
mln_assertion(f.size() >= (label_count));
mln_ch_value(L, V) output = level::transform(input, f);
- trace::exiting("debug::colorize");
+ trace::exiting("labeling::colorize");
+ return output;
+ }
+
+ template <typename V, typename L>
+ inline
+ mln_ch_value(L, V)
+ colorize(const V& value,
+ const Image<L>& input)
+ {
+ trace::entering("labeling::colorize");
+ mln_precondition(exact(input).is_valid());
+
+ accu::max<mln_value(L)> accu;
+ mln_value(L) nlabels = level::compute(accu, input);
+
+ mln_ch_value(L,V) output = colorize(value, input, nlabels);
+
+ trace::exiting("labeling::colorize");
return output;
}
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::debug
+ } // end of namespace mln::labeling
} // end of namespace mln
diff --git a/milena/tests/labeling/Makefile.am b/milena/tests/labeling/Makefile.am
index 411674e..0dfb121 100644
--- a/milena/tests/labeling/Makefile.am
+++ b/milena/tests/labeling/Makefile.am
@@ -5,6 +5,7 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
background \
blobs \
+ colorize \
compute \
fill_holes \
flat_zones \
@@ -20,6 +21,7 @@ check_PROGRAMS = \
background_SOURCES = background.cc
blobs_SOURCES = blobs.cc
+colorize_SOURCES = colorize.cc
compute_SOURCES = compute.cc
fill_holes_SOURCES = fill_holes.cc
flat_zones_SOURCES = flat_zones.cc
diff --git a/milena/tests/labeling/colorize.cc b/milena/tests/labeling/colorize.cc
new file mode 100644
index 0000000..e424473
--- /dev/null
+++ b/milena/tests/labeling/colorize.cc
@@ -0,0 +1,56 @@
+// Copyright (C) 2009 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.
+
+/// \file tests/labeling/colorize.cc
+///
+/// Test on mln::labeling::colorize.
+
+# include <mln/make/image.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/value/int_u8.hh>
+# include <mln/labeling/colorize.hh>
+# include <mln/level/compare.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ value::int_u8 values[][2] = { { 3, 3 },
+ { 0, 0 } };
+
+ typedef value::rgb8 rgb_t;
+ value::rgb8 ref_data[][2] = { { rgb_t(89,92,86), rgb_t(89,92,86) },
+ { rgb_t(0,0,0), rgb_t(0,0,0) } };
+
+ image2d<value::int_u8> ima = make::image(values);
+ image2d<rgb_t> ref = make::image(ref_data);
+
+ image2d<value::rgb8> ima_color = labeling::colorize(value::rgb8(), ima);
+
+ mln_assertion(ref == ima_color);
+}
--
1.5.6.5