* mln/fun/p2b/tautology.hh,
* mln/fun/p2b/antilogy.hh:
New files.
Include them...
* mln/fun/p2b/all.hh: ...here.
---
milena/ChangeLog | 10 +++++
milena/mln/fun/p2b/all.hh | 5 ++-
milena/mln/fun/p2b/{all.hh => antilogy.hh} | 51 +++++++++++++++++++-------
milena/mln/fun/p2b/{all.hh => tautology.hh} | 51 +++++++++++++++++++-------
4 files changed, 88 insertions(+), 29 deletions(-)
copy milena/mln/fun/p2b/{all.hh => antilogy.hh} (57%)
copy milena/mln/fun/p2b/{all.hh => tautology.hh} (57%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fb1e5da..b637f0a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,15 @@
2009-04-07 Roland Levillain <roland(a)lrde.epita.fr>
+ Add a tautology and an antilogy p2b functors.
+
+ * mln/fun/p2b/tautology.hh,
+ * mln/fun/p2b/antilogy.hh:
+ New files.
+ Include them...
+ * mln/fun/p2b/all.hh: ...here.
+
+2009-04-07 Roland Levillain <roland(a)lrde.epita.fr>
+
Add minima simplification to apps/statues/mesh-complex-skel.
* apps/statues/mesh-complex-skel.cc (main): Take the second
diff --git a/milena/mln/fun/p2b/all.hh b/milena/mln/fun/p2b/all.hh
index ed6e926..e1c75f3 100644
--- a/milena/mln/fun/p2b/all.hh
+++ b/milena/mln/fun/p2b/all.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 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
@@ -51,6 +52,8 @@ namespace mln
# include <mln/fun/p2b/chess.hh>
# include <mln/fun/p2b/has.hh>
+# include <mln/fun/p2b/tautology.hh>
+# include <mln/fun/p2b/antilogy.hh>
diff --git a/milena/mln/fun/p2b/all.hh b/milena/mln/fun/p2b/antilogy.hh
similarity index 57%
copy from milena/mln/fun/p2b/all.hh
copy to milena/mln/fun/p2b/antilogy.hh
index ed6e926..5a7744f 100644
--- a/milena/mln/fun/p2b/all.hh
+++ b/milena/mln/fun/p2b/antilogy.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// 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
@@ -25,13 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_P2B_ALL_HH
-# define MLN_FUN_P2B_ALL_HH
+#ifndef MLN_FUN_P2B_ANTILOGY_HH
+# define MLN_FUN_P2B_ANTILOGY_HH
-/*! \file mln/fun/p2b/all.hh
- *
- * \brief File that includes all functions from point to boolean.
- */
+/// \file mln/fun/p2b/antilogy.hh
+/// \brief Definition of a p2b function always returning \c false.
+
+# include <mln/core/concept/function.hh>
+# include <mln/core/alias/point2d.hh>
namespace mln
@@ -40,18 +41,40 @@ namespace mln
namespace fun
{
- /// Namespace of functions from point to boolean.
namespace p2b
{
- }
- }
-}
+ /// \brief A p2b function always returning \c false.
+ ///
+ /// A simpler name would be `false', but this is not a valid C++
+ /// identifier, as \c false is a keyword of the language.
+ struct antilogy : public Function_p2b< antilogy >
+ {
+ typedef bool result;
+
+ template <typename P>
+ bool operator()(const P& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ inline
+ bool
+ antilogy::operator()(const P& /* p */) const
+ {
+ return false;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::p2b
-# include <mln/fun/p2b/chess.hh>
-# include <mln/fun/p2b/has.hh>
+ } // end of namespace mln::fun
+} // end of namespace mln
-#endif // ! MLN_FUN_P2B_ALL_HH
+#endif // ! MLN_FUN_P2B_ANTILOGY_HH
diff --git a/milena/mln/fun/p2b/all.hh b/milena/mln/fun/p2b/tautology.hh
similarity index 57%
copy from milena/mln/fun/p2b/all.hh
copy to milena/mln/fun/p2b/tautology.hh
index ed6e926..20d03d5 100644
--- a/milena/mln/fun/p2b/all.hh
+++ b/milena/mln/fun/p2b/tautology.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// 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
@@ -25,13 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_P2B_ALL_HH
-# define MLN_FUN_P2B_ALL_HH
+#ifndef MLN_FUN_P2B_TAUTOLOGY_HH
+# define MLN_FUN_P2B_TAUTOLOGY_HH
-/*! \file mln/fun/p2b/all.hh
- *
- * \brief File that includes all functions from point to boolean.
- */
+/// \file mln/fun/p2b/tautology.hh
+/// \brief Definition of a p2b function always returning \c true.
+
+# include <mln/core/concept/function.hh>
+# include <mln/core/alias/point2d.hh>
namespace mln
@@ -40,18 +41,40 @@ namespace mln
namespace fun
{
- /// Namespace of functions from point to boolean.
namespace p2b
{
- }
- }
-}
+ /// \brief A p2b function always returning \c true.
+ ///
+ /// A simpler name would be `true', but this is not a valid C++
+ /// identifier, as \c true is a keyword of the language.
+ struct tautology : public Function_p2b< tautology >
+ {
+ typedef bool result;
+
+ template <typename P>
+ bool operator()(const P& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ inline
+ bool
+ tautology::operator()(const P& /* p */) const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::p2b
-# include <mln/fun/p2b/chess.hh>
-# include <mln/fun/p2b/has.hh>
+ } // end of namespace mln::fun
+} // end of namespace mln
-#endif // ! MLN_FUN_P2B_ALL_HH
+#endif // ! MLN_FUN_P2B_TAUTOLOGY_HH
--
1.6.1.2
* apps/statues/mesh-complex-skel.cc (main): Take the second
command line parameter into account.
Apply an area closing on the input before computing minima.
Propagate minima information to egdes and vertices.
* apps/statues/test-mesh-complex-skel.in: Adjust values passed as
second parameter (lambda) to mesh-complex-skel.
---
milena/ChangeLog | 11 +++
milena/apps/statues/mesh-complex-skel.cc | 101 +++++++++++++++++++------
milena/apps/statues/test-mesh-complex-skel.in | 8 +-
3 files changed, 93 insertions(+), 27 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 9b9ea06..fb1e5da 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,16 @@
2009-04-07 Roland Levillain <roland(a)lrde.epita.fr>
+ Add minima simplification to apps/statues/mesh-complex-skel.
+
+ * apps/statues/mesh-complex-skel.cc (main): Take the second
+ command line parameter into account.
+ Apply an area closing on the input before computing minima.
+ Propagate minima information to egdes and vertices.
+ * apps/statues/test-mesh-complex-skel.in: Adjust values passed as
+ second parameter (lambda) to mesh-complex-skel.
+
+2009-04-07 Roland Levillain <roland(a)lrde.epita.fr>
+
* apps/statues/mesh-complex-skel.cc: Remove dead code.
2009-04-07 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
diff --git a/milena/apps/statues/mesh-complex-skel.cc b/milena/apps/statues/mesh-complex-skel.cc
index ca8ff8a..1fa460e 100644
--- a/milena/apps/statues/mesh-complex-skel.cc
+++ b/milena/apps/statues/mesh-complex-skel.cc
@@ -49,7 +49,10 @@
#include <mln/literal/white.hh>
#include <mln/core/routine/duplicate.hh>
+
#include <mln/labeling/regional_minima.hh>
+#include <mln/morpho/erosion.hh>
+#include <mln/morpho/closing/area.hh>
#include <mln/io/off/load.hh>
#include <mln/io/off/save.hh>
@@ -554,9 +557,7 @@ int main(int argc, char* argv[])
std::string input_filename = argv[1];
// FIXME: Use lambda to filter the input.
-#if 0
unsigned lambda = atoi(argv[2]);
-#endif
std::string output_filename = argv[3];
/*----------------.
@@ -582,6 +583,16 @@ int main(int argc, char* argv[])
for_all(e)
input(e) = mln_max(float);
+ /*-----------------.
+ | Simplification. |
+ `-----------------*/
+
+ /// Adjacent triangles are connected by shared edges.
+ typedef mln::complex_lower_dim_connected_n_face_neighborhood<D, G> nbh_t;
+ nbh_t nbh;
+
+ ima_t closed_input = mln::morpho::closing::area(input, nbh, lambda);
+
/*---------------.
| Local minima. |
`---------------*/
@@ -589,38 +600,82 @@ int main(int argc, char* argv[])
typedef mln::value::label_16 label_t;
label_t nminima;
- typedef mln::complex_lower_dim_connected_n_face_neighborhood<D, G> nbh_t;
- nbh_t nbh;
-
/* FIXME: We should use something like `ima_t | p_n_faces(2)' instead
of `ima_t' here. Or better: `input' should only associate data
to 2-faces. */
- mln_ch_value_(ima_t, label_t) minima =
- mln::labeling::regional_minima(input, nbh, nminima);
+ typedef mln_ch_value_(ima_t, label_t) label_ima_t;
+ label_ima_t minima =
+ mln::labeling::regional_minima(closed_input, nbh, nminima);
+
+ typedef mln::complex_higher_neighborhood<D, G> higher_nbh_t;
+ higher_nbh_t higher_nbh;
+
+ // Propagate minima values from triangles to edges.
+ // FIXME: Factor this inside a function.
+ mln_niter_(higher_nbh_t) adj_t(higher_nbh, e);
+ for_all(e)
+ {
+ label_t ref_adj_minimum = mln::literal::zero;
+ for_all(adj_t)
+ if (minima(adj_t) == mln::literal::zero)
+ {
+ // If E is adjcent to a non-minimal triangle, then it must
+ // not belong to a minima.
+ ref_adj_minimum = mln::literal::zero;
+ break;
+ }
+ else
+ {
+ if (ref_adj_minimum == mln::literal::zero)
+ // If this is the first minimum seen, use it as a reference.
+ ref_adj_minimum = minima(adj_t);
+ else
+ // If this is not the first time a minimum is encountered,
+ // ensure it is REF_ADJ_MINIMUM.
+ mln_assertion(minima(adj_t) == ref_adj_minimum);
+ }
+ minima(e) = ref_adj_minimum;
+ }
+
+ // Likewise from edges to edges to vertices.
+ mln_niter_(higher_nbh_t) adj_e(higher_nbh, v);
+ for_all(v)
+ {
+ label_t ref_adj_minimum = mln::literal::zero;
+ for_all(adj_e)
+ if (minima(adj_e) == mln::literal::zero)
+ {
+ // If V is adjcent to a non-minimal triangle, then it must
+ // not belong to a minima.
+ ref_adj_minimum = mln::literal::zero;
+ break;
+ }
+ else
+ {
+ if (ref_adj_minimum == mln::literal::zero)
+ // If this is the first minimum seen, use it as a reference.
+ ref_adj_minimum = minima(adj_e);
+ else
+ // If this is not the first time a minimum is encountered,
+ // ensure it is REF_ADJ_MINIMUM.
+ mln_assertion(minima(adj_e) == ref_adj_minimum);
+ }
+ minima(v) = ref_adj_minimum;
+ }
/*-----------------------.
| Initial binary image. |
`-----------------------*/
typedef mln_ch_value_(ima_t, bool) bin_ima_t;
- bin_ima_t surface(input.domain());
+ bin_ima_t surface(minima.domain());
mln::data::fill(surface, true);
// Dig ``holes'' in the surface surface by setting minima faces to false.
-#if 0
- /* FIXME: The `is_n_face<2>' predicate is required because the
- domain of SURFACE also comprises 0-faces and 1-faces... */
- mln::data::fill(surface
- | is_n_face<2>()
- | mln::pw::value(minima) != mln::pw::cst(mln::literal::zero),
- false);
-#endif
- /* FIXME: The code above does not compile (yet). Probably because
- of an incompatibility between complex_image and image_if. Use
- this hand-made filling for the moment. */
- mln::p_n_faces_fwd_piter<D, G> t(input.domain(), 2);
- for_all(t)
- if (minima(t) != mln::literal::zero)
- surface(t) = false;
+ // FIXME: Use fill with an image_if instead, when available/working.
+ mln_piter_(bin_ima_t) f(minima.domain());
+ for_all(f)
+ if (minima(f) != mln::literal::zero)
+ surface(f) = false;
/*-----------.
| Skeleton. |
diff --git a/milena/apps/statues/test-mesh-complex-skel.in b/milena/apps/statues/test-mesh-complex-skel.in
index 1f8a184..9b34767 100644
--- a/milena/apps/statues/test-mesh-complex-skel.in
+++ b/milena/apps/statues/test-mesh-complex-skel.in
@@ -4,7 +4,7 @@ set -ex
mesh_dir=@top_srcdir@/milena/mesh
-time ./mesh-complex-skel $mesh_dir/three-triangles.off 25 three-triangles-skel.off
-time ./mesh-complex-skel $mesh_dir/socket-max-curv.off 25 socket-max-curv-skel.off
-time ./mesh-complex-skel $mesh_dir/teapot-max-curv.off 50 teapot-max-curv-skel.off
-time ./mesh-complex-skel $mesh_dir/bunny-holefilled-pinv-curv.off 500 bunny-holefilled-pinv-curv-skel.off
+time ./mesh-complex-skel $mesh_dir/three-triangles.off 1 three-triangles-skel.off
+time ./mesh-complex-skel $mesh_dir/socket-max-curv.off 10 socket-max-curv-skel.off
+time ./mesh-complex-skel $mesh_dir/teapot-max-curv.off 20 teapot-max-curv-skel.off
+time ./mesh-complex-skel $mesh_dir/bunny-holefilled-pinv-curv.off 50 bunny-holefilled-pinv-curv-skel.off
--
1.6.1.2
* icdar/2009/hsc/icdar_io.cc: sample / test.
* icdar/2009/hsc/io/icdar/load.hh,
* icdar/2009/hsc/io/icdar/save.hh: I/O routines.
---
milena/sandbox/ChangeLog | 8 ++
milena/sandbox/icdar/2009/hsc/icdar_io.cc | 51 +++++++++++++
milena/sandbox/icdar/2009/hsc/io/icdar/load.hh | 96 ++++++++++++++++++++++++
milena/sandbox/icdar/2009/hsc/io/icdar/save.hh | 88 ++++++++++++++++++++++
4 files changed, 243 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/icdar/2009/hsc/icdar_io.cc
create mode 100644 milena/sandbox/icdar/2009/hsc/io/icdar/load.hh
create mode 100644 milena/sandbox/icdar/2009/hsc/io/icdar/save.hh
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 37485b0..a5875f7 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,13 @@
2009-04-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add ICDAR I/O routines.
+
+ * icdar/2009/hsc/icdar_io.cc: sample / test.
+ * icdar/2009/hsc/io/icdar/load.hh,
+ * icdar/2009/hsc/io/icdar/save.hh: I/O routines.
+
+2009-04-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add new small tools for ICDAR.
* icdar/2009/hsc/input_lines_to_lines.cc: Iterate on lbl.domain().
diff --git a/milena/sandbox/icdar/2009/hsc/icdar_io.cc b/milena/sandbox/icdar/2009/hsc/icdar_io.cc
new file mode 100644
index 0000000..3b9ca74
--- /dev/null
+++ b/milena/sandbox/icdar/2009/hsc/icdar_io.cc
@@ -0,0 +1,51 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/make/image2d.hh>
+#include <mln/debug/println.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/level/compare.hh>
+
+#include "io/icdar/save.hh"
+#include "io/icdar/load.hh"
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+ using namespace mln::value;
+
+ if (argc < 2)
+ {
+ std::cout << "Usage: " << argv[0] << " <input.pgm>" << std::endl;
+ return 1;
+ }
+
+ image2d<int_u8> input;
+ io::pgm::load(input, argv[1]);
+ io::icdar::save(input, "icdar.raw");
+
+ image2d<int_u8> output;
+ io::icdar::load(output, "icdar.raw", 48, 44);
+
+ mln_assertion(output.domain() == input.domain());
+ mln_assertion(output == input);
+
+ /// Small test.
+// {
+// int_u8 val[4][5] = { { 2, 3, 6, 7, 8 },
+// { 1, 2, 3, 4, 5 },
+// { 1, 2, 3, 4, 5 },
+// { 1, 2, 3, 4, 5 } };
+//
+// image2d<int_u8> ima = make::image(val);
+//
+// debug::println(ima);
+//
+// io::icdar::save(ima, "icdar.raw");
+//
+// image2d<int_u8> ima_l;
+//
+// io::icdar::load(ima_l, "icdar.raw", 4, 5);
+//
+// debug::println(ima_l);
+// }
+}
diff --git a/milena/sandbox/icdar/2009/hsc/io/icdar/load.hh b/milena/sandbox/icdar/2009/hsc/io/icdar/load.hh
new file mode 100644
index 0000000..35f59f6
--- /dev/null
+++ b/milena/sandbox/icdar/2009/hsc/io/icdar/load.hh
@@ -0,0 +1,96 @@
+// 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_IO_ICDAR_LOAD_HH
+# define MLN_IO_ICDAR_LOAD_HH
+
+/// \file mln/io/icdar/load.hh
+///
+/// Load an image saved as a raw buffer of integers.
+/// Output file format for ICDAR 2009 contest.
+///
+/// Reference: http://www.iit.demokritos.gr/~bgat/HandSegmCont2009/Protocol.html
+
+#include <cstdio>
+#include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace icdar
+ {
+
+ template <typename I>
+ void load(Image<I>& ima_, const std::string& filename,
+ int nrows, int ncols);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void load(Image<I>& ima_, const std::string& filename,
+ int nrows, int ncols)
+ {
+ trace::entering("io::icdar::load");
+
+ I& ima = exact(ima_);
+ ima = I(nrows, ncols, 0); // Make sure there is no border.
+
+ int size = nrows * ncols;
+ unsigned int *buffer; //Pointer to store raw data
+ FILE *f;
+
+ buffer = (unsigned int *) calloc (size, sizeof (int));
+ f = fopen(filename.c_str(), "rb");
+ fread(buffer, size, sizeof (int),f);
+
+ for (int i = 0; i < size; ++i)
+ {
+ mln_value(I) v;// = buffer[i];
+ convert::from_to(buffer[i], v);
+ ima(ima.point_at_index(i)) = v;
+ }
+
+ fclose(f);
+
+ trace::exiting("io::icdar::load");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::icdar
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_ICDAR_LOAD_HH
diff --git a/milena/sandbox/icdar/2009/hsc/io/icdar/save.hh b/milena/sandbox/icdar/2009/hsc/io/icdar/save.hh
new file mode 100644
index 0000000..7a9ad5f
--- /dev/null
+++ b/milena/sandbox/icdar/2009/hsc/io/icdar/save.hh
@@ -0,0 +1,88 @@
+// 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_IO_ICDAR_SAVE_HH
+# define MLN_IO_ICDAR_SAVE_HH
+
+/// \file mln/io/icdar/save.hh
+///
+/// Save an image as a raw buffer of integers.
+/// Output file format for ICDAR 2009 contest.
+///
+/// Reference: http://www.iit.demokritos.gr/~bgat/HandSegmCont2009/Protocol.html
+
+#include <cstdio>
+#include <mln/core/concept/image.hh>
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace icdar
+ {
+
+ template <typename I>
+ void save(const Image<I>& ima_, const std::string& filename);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void save(const Image<I>& ima_, const std::string& filename)
+ {
+ trace::entering("io::icdar::save");
+
+ const I& ima = exact(ima_);
+ mln_precondition(ima.is_valid());
+
+ FILE *f = fopen(filename.c_str(), "wb");
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ /// Probably too violent...
+ unsigned int value = static_cast<unsigned int>(ima(p));
+ fwrite(&value, sizeof (int), 1, f);
+ }
+
+ fclose(f);
+
+ trace::exiting("io::icdar::save");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::icdar
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+#endif // ! MLN_IO_ICDAR_SAVE_HH
--
1.5.6.5
* bugs/algebra_vec_ne_op.cc: issues with algebra::vec operators.
* bugs/lut.cc: issues with lookup table and level::transform.
---
milena/sandbox/ChangeLog | 8 ++++++++
milena/sandbox/bugs/algebra_vec_ne_op.cc | 19 +++++++++++++++++++
milena/sandbox/bugs/lut.cc | 23 +++++++++++++++++++++++
3 files changed, 50 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/bugs/algebra_vec_ne_op.cc
create mode 100644 milena/sandbox/bugs/lut.cc
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index f6e6e15..ba700f8 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add new known bugs in sandbox.
+
+ * bugs/algebra_vec_ne_op.cc: issues with algebra::vec operators.
+
+ * bugs/lut.cc: issues with lookup table and level::transform.
+
2009-04-06 Guillaume Lazzara <z(a)lrde.epita.fr>
Add a small tool to map text components to lines.
diff --git a/milena/sandbox/bugs/algebra_vec_ne_op.cc b/milena/sandbox/bugs/algebra_vec_ne_op.cc
new file mode 100644
index 0000000..aee31ed
--- /dev/null
+++ b/milena/sandbox/bugs/algebra_vec_ne_op.cc
@@ -0,0 +1,19 @@
+/// Do not compile
+
+
+# include <mln/algebra/vec.hh>
+int main()
+{
+ using namespace mln::algebra;
+ vec<3, float> a, b;
+
+ // Do NOT work
+ bool c = (a != b);
+
+ // Work
+ c = !(a == b);
+
+ // Work
+ c = (a == b);
+}
+
diff --git a/milena/sandbox/bugs/lut.cc b/milena/sandbox/bugs/lut.cc
new file mode 100644
index 0000000..d7e9ecb
--- /dev/null
+++ b/milena/sandbox/bugs/lut.cc
@@ -0,0 +1,23 @@
+/// Passing a fun::i2v::array to level::Transform can lead to a segfault.
+/// Through the dispatch of level::transform, a dispatch function detects that
+/// we are using int_u8 as values, meaning a low quantification value type.
+/// It tries to compute a look-up table (lut) which for each int_u8 value
+/// (0-255), maps a new value computed thanks to the function.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/fun/i2v/array.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/level/transform.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<value::int_u8> ima(4, 4);
+
+ /// This function can compute values for 0,1 and 2.
+ fun::i2v::array<bool> f(3, true);
+
+ /// Crash, since the lut computes values for 0-255.
+ level::transform(ima, f);
+}
--
1.5.6.5