* apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc,
* apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc:
New.
* apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc,
* apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc:
Remove dead code.
* apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in,
* apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in:
New.
* apps/mesh-segm-skel/Makefile.am (bin_PROGRAMS): Add
mesh-complex-pinv-curv-segm and mesh-complex-pinv-curv-skel.
(mesh_complex_pinv_curv_segm_SOURCES)
(mesh_complex_pinv_curv_skel_SOURCES):
New.
(TESTS): Add test-mesh-complex-pinv-curv-segm and
test-mesh-complex-pinv-curv-skel.
(MOSTLYCLEANFILES): Add socket-complex-pinv-curv-segm.off,
teapot-complex-pinv-curv-segm.off,
socket-complex-pinv-curv-skel.off and
teapot-complex-pinv-curv-skel.off.
---
milena/ChangeLog | 25 ++++++++++++++++++++
milena/apps/mesh-segm-skel/Makefile.am | 20 ++++++++++++----
.../mesh-segm-skel/mesh-complex-max-curv-segm.cc | 19 ++++-----------
.../mesh-segm-skel/mesh-complex-max-curv-skel.cc | 12 ++-------
...curv-segm.cc => mesh-complex-pinv-curv-segm.cc} | 20 ++++++---------
...curv-skel.cc => mesh-complex-pinv-curv-skel.cc} | 23 ++++++++---------
...segm.in => test-mesh-complex-pinv-curv-segm.in} | 9 ++++---
...skel.in => test-mesh-complex-pinv-curv-skel.in} | 6 ++--
8 files changed, 75 insertions(+), 59 deletions(-)
copy milena/apps/mesh-segm-skel/{mesh-complex-max-curv-segm.cc => mesh-complex-pinv-curv-segm.cc} (91%)
copy milena/apps/mesh-segm-skel/{mesh-complex-max-curv-skel.cc => mesh-complex-pinv-curv-skel.cc} (94%)
copy milena/apps/mesh-segm-skel/{test-mesh-segm.in => test-mesh-complex-pinv-curv-segm.in} (65%)
mode change 100755 => 100644
copy milena/apps/mesh-segm-skel/{test-mesh-complex-max-curv-skel.in => test-mesh-complex-pinv-curv-skel.in} (72%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1fe8399..3d8b6bc 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,28 @@
+2010-07-15 Roland Levillain <roland(a)lrde.epita.fr>
+
+ mesh-complex-pinv-curv-segm and mesh-complex-pinv-curv-skel apps.
+
+ * apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc,
+ * apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc:
+ New.
+ * apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc,
+ * apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc:
+ Remove dead code.
+ * apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in,
+ * apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in:
+ New.
+ * apps/mesh-segm-skel/Makefile.am (bin_PROGRAMS): Add
+ mesh-complex-pinv-curv-segm and mesh-complex-pinv-curv-skel.
+ (mesh_complex_pinv_curv_segm_SOURCES)
+ (mesh_complex_pinv_curv_skel_SOURCES):
+ New.
+ (TESTS): Add test-mesh-complex-pinv-curv-segm and
+ test-mesh-complex-pinv-curv-skel.
+ (MOSTLYCLEANFILES): Add socket-complex-pinv-curv-segm.off,
+ teapot-complex-pinv-curv-segm.off,
+ socket-complex-pinv-curv-skel.off and
+ teapot-complex-pinv-curv-skel.off.
+
2010-06-14 Roland Levillain <roland(a)lrde.epita.fr>
Actually use the maximal curvature in mesh-complex-max-curv-segm.
diff --git a/milena/apps/mesh-segm-skel/Makefile.am b/milena/apps/mesh-segm-skel/Makefile.am
index 868c7d6..5dda5ec 100644
--- a/milena/apps/mesh-segm-skel/Makefile.am
+++ b/milena/apps/mesh-segm-skel/Makefile.am
@@ -171,9 +171,13 @@ MOSTLYCLEANFILES += \
socket-complex-max-curv-segm.off \
teapot-complex-max-curv-segm.off
-# FIXME: Implement `mesh-complex-pinv-curv-segm' (factor as much
-# code as possible with `mesh-complex-max-curv-segm'.
-# ...
+# Likewise, but using pseudo-inverse curvature.
+bin_PROGRAMS += mesh-complex-pinv-curv-segm
+mesh_complex_pinv_curv_segm_SOURCES = mesh-complex-pinv-curv-segm.cc
+TESTS += test-mesh-complex-pinv-curv-segm
+MOSTLYCLEANFILES += \
+ socket-complex-pinv-curv-segm.off \
+ teapot-complex-pinv-curv-segm.off
## Skeletonization.
## ----------------
@@ -187,8 +191,6 @@ MOSTLYCLEANFILES += \
teapot-max-curv.off \
three-triangles-skel.off
-# FIXME: Implement `mesh-complex-{max,pinv}-curv-skel'.
-# ...
bin_PROGRAMS += mesh-complex-max-curv-skel
mesh_complex_max_curv_skel_SOURCES = \
mesh-complex-max-curv-skel.cc save_bin_alt.hh
@@ -196,3 +198,11 @@ TESTS += test-mesh-complex-max-curv-skel
MOSTLYCLEANFILES += \
socket-complex-max-curv-skel.off \
teapot-complex-max-curv-skel.off
+
+bin_PROGRAMS += mesh-complex-pinv-curv-skel
+mesh_complex_pinv_curv_skel_SOURCES = \
+ mesh-complex-pinv-curv-skel.cc save_bin_alt.hh
+TESTS += test-mesh-complex-pinv-curv-skel
+MOSTLYCLEANFILES += \
+ socket-complex-pinv-curv-skel.off \
+ teapot-complex-pinv-curv-skel.off
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc
index a7a741a..aa55244 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 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
@@ -30,6 +31,8 @@
/// surface of the (triangle) mesh of a statue, then performing a
/// WST-based segmentation, using a complex-based image.
+// Factor with mesh-complex-pinv-curv-segm.cc.
+
#include <cstdlib>
#include <cmath>
@@ -53,10 +56,6 @@
#include "trimesh/misc.hh"
-// Doesn't C++ have a better way to express Pi?
-static const float pi = 4 * atanf(1);
-
-
int main(int argc, char* argv[])
{
if (argc != 4)
@@ -91,17 +90,9 @@ int main(int argc, char* argv[])
mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0);
for_all(v)
{
- // FIXME: The program should allow the user to choose the kind
- // of measure (curvature).
-#if 0
- float h = (curv.first(v) + curv.second(v)) / 2;
- // Pseudo-inverse curvature.
- float h_inv = 1 / pi * (atan(-h) + pi / 2);
- float_ima(v) = h_inv;
-#endif
// Max curvature.
float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)),
- mln::math::sqr(curv.second(v)));
+ mln::math::sqr(curv.second(v)));
}
// Values on edges.
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
index a174dd6..b910aae 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
@@ -29,9 +29,11 @@
/// \file apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
/// \brief A program computing the maximal curvature values from the
/// surface of the (triangle) mesh of a statue, then computing a
-/// skeleton of this surface (by/ thinning), using a complex-based
+/// skeleton of this surface (by thinning), using a complex-based
/// image.
+// FIXME: Factor with mesh-complex-pinv-curv-skel.cc.
+
#include <iostream>
#include <mln/core/image/complex_image.hh>
@@ -92,14 +94,6 @@ main(int argc, char* argv[])
mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0);
for_all(v)
{
- // FIXME: The program should allow the user to choose the kind
- // of measure (curvature).
-#if 0
- float h = (curv.first(v) + curv.second(v)) / 2;
- // Pseudo-inverse curvature.
- float h_inv = 1 / pi * (atan(-h) + pi / 2);
- float_ima(v) = h_inv;
-#endif
// Max curvature.
float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)),
mln::math::sqr(curv.second(v)));
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc
similarity index 91%
copy from milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc
copy to milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc
index a7a741a..fe7ee70 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 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,10 +26,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc
-/// \brief A program computing the maximal curvature values from the
-/// surface of the (triangle) mesh of a statue, then performing a
-/// WST-based segmentation, using a complex-based image.
+/// \file apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc
+/// \brief A program computing the pseudo-inverse curvature values
+/// from the surface of the (triangle) mesh of a statue, then
+/// performing a WST-based segmentation, using a complex-based image.
+
+// Factor with mesh-complex-max-curv-segm.cc.
#include <cstdlib>
#include <cmath>
@@ -91,17 +94,10 @@ int main(int argc, char* argv[])
mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0);
for_all(v)
{
- // FIXME: The program should allow the user to choose the kind
- // of measure (curvature).
-#if 0
float h = (curv.first(v) + curv.second(v)) / 2;
// Pseudo-inverse curvature.
float h_inv = 1 / pi * (atan(-h) + pi / 2);
float_ima(v) = h_inv;
-#endif
- // Max curvature.
- float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)),
- mln::math::sqr(curv.second(v)));
}
// Values on edges.
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
similarity index 94%
copy from milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
copy to milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
index a174dd6..4a59a6b 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
@@ -26,11 +26,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
-/// \brief A program computing the maximal curvature values from the
-/// surface of the (triangle) mesh of a statue, then computing a
-/// skeleton of this surface (by/ thinning), using a complex-based
-/// image.
+/// \file apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
+/// \brief A program computing the pseudo-inverse curvature values
+/// from the surface of the (triangle) mesh of a statue, then
+/// computing a skeleton of this surface (by thinning), using a
+/// complex-based image.
+
+// FIXME: Factor with mesh-complex-max-curv-skel.cc.
#include <iostream>
@@ -57,6 +59,10 @@
#include "trimesh/misc.hh"
+// Doesn't C++ have a better way to express Pi?
+static const float pi = 4 * atanf(1);
+
+
int
main(int argc, char* argv[])
{
@@ -92,17 +98,10 @@ main(int argc, char* argv[])
mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0);
for_all(v)
{
- // FIXME: The program should allow the user to choose the kind
- // of measure (curvature).
-#if 0
float h = (curv.first(v) + curv.second(v)) / 2;
// Pseudo-inverse curvature.
float h_inv = 1 / pi * (atan(-h) + pi / 2);
float_ima(v) = h_inv;
-#endif
- // Max curvature.
- float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)),
- mln::math::sqr(curv.second(v)));
}
// Values on triangles.
diff --git a/milena/apps/mesh-segm-skel/test-mesh-segm.in b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in
old mode 100755
new mode 100644
similarity index 65%
copy from milena/apps/mesh-segm-skel/test-mesh-segm.in
copy to milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in
index e70e63a..345aefd
--- a/milena/apps/mesh-segm-skel/test-mesh-segm.in
+++ b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+# Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -20,7 +21,7 @@ set -ex
mesh_dir=@top_srcdir@/milena/mesh
-time ./mesh-segm $mesh_dir/socket.off 25 socket-segm.off
-time ./mesh-segm $mesh_dir/teapot.off 50 teapot-segm.off
+time ./mesh-complex-pinv-curv-segm $mesh_dir/socket.off 25 socket-complex-pinv-curv-segm.off
+time ./mesh-complex-pinv-curv-segm $mesh_dir/teapot.off 50 teapot-complex-pinv-curv-segm.off
# FIXME: Too long. Should be run with (future) target `check-full'.
-#time ./mesh-segm $mesh_dir/bunny-holefilled.off 500 bunny-holefilled-segm.off
+#time ./mesh-complex-pinv-curv-segm $mesh_dir/bunny-holefilled.off 500 bunny-holefilled-complex-pinv-curv-segm.off
diff --git a/milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-skel.in b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in
similarity index 72%
copy from milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-skel.in
copy to milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in
index ea7f604..0af2151 100644
--- a/milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-skel.in
+++ b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in
@@ -20,7 +20,7 @@ set -ex
mesh_dir=@top_srcdir@/milena/mesh
-time ./mesh-complex-max-curv-skel $mesh_dir/socket.off 10 socket-complex-max-curv-skel.off
-time ./mesh-complex-max-curv-skel $mesh_dir/teapot.off 20 teapot-complex-max-curv-skel.off
+time ./mesh-complex-pinv-curv-skel $mesh_dir/socket.off 10 socket-complex-pinv-curv-skel.off
+time ./mesh-complex-pinv-curv-skel $mesh_dir/teapot.off 20 teapot-complex-pinv-curv-skel.off
# FIXME: Too long. Should be run with (future) target `check-full'.
-#time ./mesh-complex-max-curv-skel $mesh_dir/bunny-holefilled.off 50 bunny-holefilled-complex-max-curv-skel.off
+time ./mesh-complex-pinv-curv-skel $mesh_dir/bunny-holefilled.off 50 bunny-holefilled-complex-pinv-curv-skel.off
--
1.5.6.5
#233: Implement reconstructions on sets (logic/binary values)
----------------------+-----------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: defect | Status: new
Priority: major | Milestone: Olena 1.1
Component: Milena | Version: 1.0
Keywords: |
----------------------+-----------------------------------------------------
The following routines:
* `mln::morpho::reconstruction::by_dilation::union_find`
* `mln::morpho::reconstruction::by_erosion::union_find`
are not implemented on sets (logic/binary values), and worse, they do not
warn the user of this fact (neither a compile- nor at run-time).
--
Ticket URL: <https://trac.lrde.org/olena/ticket/233>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
* debug/char_space_image.hh,
* debug/line_info_image.hh: New.
---
scribo/ChangeLog | 7 ++
scribo/debug/char_space_image.hh | 113 ++++++++++++++++++++++++++++++++++
scribo/debug/line_info_image.hh | 123 ++++++++++++++++++++++++++++++++++++++
3 files changed, 243 insertions(+), 0 deletions(-)
create mode 100644 scribo/debug/char_space_image.hh
create mode 100644 scribo/debug/line_info_image.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index b48eaff..0f88d85 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2010-07-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add new debug routines.
+
+ * debug/char_space_image.hh,
+ * debug/line_info_image.hh: New.
+
+2010-07-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Disable some debug output.
* text/clean_inplace.hh,
diff --git a/scribo/debug/char_space_image.hh b/scribo/debug/char_space_image.hh
new file mode 100644
index 0000000..6dc6f8f
--- /dev/null
+++ b/scribo/debug/char_space_image.hh
@@ -0,0 +1,113 @@
+// 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 SCRIBO_DEBUG_CHAR_SPACE_IMAGE_HH
+# define SCRIBO_DEBUG_CHAR_SPACE_IMAGE_HH
+
+/// \file
+///
+/// \brief Draw inter character space.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/alias/point2d.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/data/convert.hh>
+
+# include <mln/draw/box.hh>
+# include <mln/draw/line.hh>
+
+# include <mln/literal/colors.hh>
+
+# include <scribo/core/line_set.hh>
+
+
+namespace scribo
+{
+
+ namespace debug
+ {
+
+ using namespace mln;
+
+
+ /// \brief Draw inter character space.
+ //
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ char_space_image(const Image<I>& input, const line_set<L>& line,
+ const value::rgb8& v = literal::cyan);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ char_space_image(const Image<I>& input, const line_set<L>& line,
+ const value::rgb8& v)
+ {
+ trace::entering("scribo::debug::char_space_image");
+
+ mln_ch_value(I,value::rgb8) output = data::convert(value::rgb8(), input);
+
+ const component_set<L>& comps = line.components();
+ for_all_lines(l, line)
+ {
+ if (! line(l).is_valid() || line(l).is_hidden()
+ || line(l).components().size() < 2)
+ continue;
+
+
+ for_all_elements(i, line(l).components())
+ {
+ if (i == line(l).components().nelements() - 1)
+ continue;
+
+ unsigned c = line(l).components()[i];
+
+ point2d
+ beg = comps(c).bbox().pmax(),
+ end = beg;
+ beg.row() = comps(c).bbox().pmin().row();
+ mln::draw::line(output, beg, end, v);
+ beg.col() += line(l).char_space();
+ end.col() += line(l).char_space();
+ mln::draw::line(output, beg, end, v);
+ }
+
+ }
+
+ trace::exiting("scribo::debug::char_space_image");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::debug
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_DEBUG_CHAR_SPACE_IMAGE_HH
diff --git a/scribo/debug/line_info_image.hh b/scribo/debug/line_info_image.hh
new file mode 100644
index 0000000..1b6532b
--- /dev/null
+++ b/scribo/debug/line_info_image.hh
@@ -0,0 +1,123 @@
+// 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 SCRIBO_DEBUG_LINE_INFO_IMAGE_HH
+# define SCRIBO_DEBUG_LINE_INFO_IMAGE_HH
+
+/// \file
+///
+/// Draw typographic information from lines.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/alias/point2d.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/data/convert.hh>
+
+# include <mln/draw/box.hh>
+# include <mln/draw/line.hh>
+
+# include <mln/literal/colors.hh>
+
+# include <scribo/core/line_set.hh>
+
+
+namespace scribo
+{
+
+ namespace debug
+ {
+
+ using namespace mln;
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ line_info_image(const Image<I>& input, const line_set<L>& line);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename L>
+ mln_ch_value(I,value::rgb8)
+ line_info_image(const Image<I>& input, const line_set<L>& line)
+ {
+ trace::entering("scribo::debug::line_info_image");
+
+ mln_ch_value(I,value::rgb8) output = data::convert(value::rgb8(), input);
+
+ for_all_lines(l, line)
+ {
+ if (! line(l).is_valid() || line(l).is_hidden())
+ continue;
+
+ // Bounding box.
+ mln::draw::box(output, line(l).bbox(), literal::green);
+
+ // baseline
+ mln::draw::line(output,
+ point2d(line(l).baseline(),
+ line(l).bbox().pmin().col()),
+ point2d(line(l).baseline(),
+ line(l).bbox().pmax().col()),
+ literal::red);
+
+ // baseline
+ mln::draw::line(output,
+ point2d(line(l).meanline(),
+ line(l).bbox().pmin().col()),
+ point2d(line(l).meanline(),
+ line(l).bbox().pmax().col()),
+ literal::cyan);
+
+ // Ascent
+ mln::draw::line(output,
+ point2d(line(l).baseline() - line(l).a_height() + 1,
+ line(l).bbox().pmin().col()),
+ point2d(line(l).baseline() - line(l).a_height() + 1,
+ line(l).bbox().pmax().col()),
+ literal::violet);
+
+ // Descent
+ mln::draw::line(output,
+ point2d(line(l).baseline() - line(l).d_height() + 1,
+ line(l).bbox().pmin().col()),
+ point2d(line(l).baseline() - line(l).d_height() + 1,
+ line(l).bbox().pmax().col()),
+ literal::orange);
+ }
+
+ trace::exiting("scribo::debug::line_info_image");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::debug
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_DEBUG_LINE_INFO_IMAGE_HH
--
1.5.6.5