---
ChangeLog | 6 ++
milena/sandbox/scribo/remove_tables.cc | 111 ++++++++++++++++++++++++++++++++
2 files changed, 117 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/scribo/remove_tables.cc
diff --git a/ChangeLog b/ChangeLog
index 2757d06..2bf6a2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-13-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * milena/sandbox/scribo/remove_tables.cc:
+ New small example to remove table borders in a document such as a
+ bill.
+
2008-10-07 Guillaume Lazzara <z(a)lrde.epita.fr>
Fix most of the doxygen warnings.
diff --git a/milena/sandbox/scribo/remove_tables.cc b/milena/sandbox/scribo/remove_tables.cc
new file mode 100644
index 0000000..0ee0528
--- /dev/null
+++ b/milena/sandbox/scribo/remove_tables.cc
@@ -0,0 +1,111 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file doc/examples/hit_or_miss.cc
+ *
+ * \brief Test on mln::morpho::hit_or_miss.
+ */
+
+# include <mln/core/image/image2d.hh>
+
+# include <mln/core/image/image_if.hh>
+# include <mln/core/image/sub_image.hh>
+# include <mln/core/alias/neighb2d.hh>
+# include <mln/core/var.hh>
+# include <mln/core/site_set/p_vaccess.hh>
+
+# include <mln/binarization/threshold.hh>
+# include <mln/morpho/hit_or_miss.hh>
+# include <mln/level/fill.hh>
+# include <mln/border/fill.hh>
+# include <mln/io/pbm/load.hh>
+# include <mln/io/pgm/load.hh>
+# include <mln/io/pbm/save.hh>
+# include <mln/io/pgm/save.hh>
+# include <mln/debug/println.hh>
+# include <mln/morpho/opening.hh>
+# include <mln/trait/value_.hh>
+# include <mln/value/int_u8.hh>
+# include <mln/level/paste.hh>
+# include <mln/labeling/blobs.hh>
+# include <mln/level/fill.hh>
+# include <mln/pw/all.hh>
+# include <mln/convert/to_fun.hh>
+# include <mln/geom/bbox.hh>
+
+void clean_lines(mln::image2d<bool>& in,
+ const mln::image2d<bool>& ima,
+ unsigned bbox_larger)
+{
+ using namespace mln;
+ using value::int_u8;
+
+ int_u8 nlabels;
+ image2d<int_u8> lbl = labeling::blobs(ima, c4(), nlabels);
+
+ for (unsigned i = nlabels; i > 0; --i)
+ {
+ level::paste(pw::cst(false)
+ | geom::bbox(lbl | (pw::value(lbl) == pw::cst(i))),//.to_larger(bbox_larger),
+ in);
+ }
+}
+
+int main(int argc, char*argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+
+ if (argc < 2)
+ {
+ std::cout << argv[0] << " <image.pgm> <h> <w>" << std::endl;
+ return 1;
+ }
+
+ image2d<bool> in;
+ io::pbm::load(in, argv[1]);
+
+ unsigned h = atoi(argv[2]);
+ unsigned w = atoi(argv[3]);
+ unsigned n = atoi(argv[4]);
+
+ // Lignes verticales
+ win::rectangle2d vwin(h, w);
+ image2d<bool> vout = morpho::opening(in, vwin);
+ io::pbm::save(vout, "./vout.pbm");
+ clean_lines(in, vout, n);
+
+ // Lignes horizontales
+ win::rectangle2d hwin(w, h);
+ image2d<bool> hout = morpho::opening(in, hwin);
+ io::pbm::save(hout, "./hout.pbm");
+ clean_lines(in, hout, n);
+
+ io::pbm::save(in, "./outt.pbm");
+
+ return 0;
+}
--
1.5.6.5
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Update Registration.
* mln/fun/x2v/all.hh: Add all header.
* mln/fun/x2x/all.hh: Fix includes.
* mln/fun/x2p/closest_point.hh: Fix g++4.3 error.
* mln/registration/registration.hh: Fix namespace use.
* mln/registration/icp.hh: Fix namespace use.
fun/x2p/closest_point.hh | 13 ++++-----
fun/x2v/all.hh | 61
+++++++++++++++++++++++++++++++++++++++++++
fun/x2x/all.hh | 10 ++-----
registration/icp.hh | 3 +-
registration/registration.hh | 4 +-
5 files changed, 75 insertions(+), 16 deletions(-)
Index: mln/fun/x2v/all.hh
--- mln/fun/x2v/all.hh (revision 0)
+++ mln/fun/x2v/all.hh (revision 0)
@@ -0,0 +1,61 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_X2V_ALL_HH
+# define MLN_FUN_X2V_ALL_HH
+
+/*! \file mln/fun/x2v/all.hh
+ *
+ * \brief File that includes all functions from vector to value.
+ */
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ /// Namespace of functions from vector to value.
+ namespace x2v
+ {
+
+ /// Internal namespace of functions form vector to vector.
+ namespace internal
+ {
+ }
+ }
+ }
+
+}
+
+
+# include <mln/fun/x2v/linear.hh>
+# include <mln/fun/x2v/bilinear.hh>
+# include <mln/fun/x2v/nneighbor.hh>
+
+#endif // ! MLN_FUN_X2V_ALL_HH
Index: mln/fun/x2x/all.hh
--- mln/fun/x2x/all.hh (revision 2542)
+++ mln/fun/x2x/all.hh (working copy)
@@ -54,13 +54,9 @@
}
-# include <mln/fun/x2x/geom/composed.hh>
-# include <mln/fun/x2x/geom/rotation.hh>
-# include <mln/fun/x2x/geom/translation.hh>
-
-# include <mln/fun/x2x/interpol/linear.hh>
-# include <mln/fun/x2x/interpol/bilinear.hh>
-
+# include <mln/fun/x2x/composed.hh>
+# include <mln/fun/x2x/rotation.hh>
+# include <mln/fun/x2x/translation.hh>
#endif // ! MLN_FUN_X2X_ALL_HH
Index: mln/fun/x2p/closest_point.hh
--- mln/fun/x2p/closest_point.hh (revision 2542)
+++ mln/fun/x2p/closest_point.hh (working copy)
@@ -31,6 +31,7 @@
# include <mln/algebra/vec.hh>
# include <mln/norm/l2.hh>
+
namespace mln
{
@@ -44,25 +45,25 @@
template <typename P>
struct closest_point
{
- typedef algebra::vec<P::dim, float> input;
+ typedef const algebra::vec<P::dim, float>& input;
typedef P result;
closest_point(const p_array<P>& X, const box<P>& box)
- : X(X), box(box)
+ : X(X), box_(box)
, log_functor_call(0)
{ }
result
//inline
- operator () (const input& Ck) const
+ operator () (const algebra::vec<P::dim, float>& Ck) const
{
++log_functor_call;
algebra::vec<P::dim,float> Cki = Ck;
algebra::vec<P::dim,float> best_x = X[0];
float best_d = norm::l2(Cki - best_x);
- for (size_t j = 1; j < X.nsites(); ++j)
+ for (unsigned j = 1; j < X.nsites(); ++j)
{
algebra::vec<P::dim,float> Xj = X[j];
float d = norm::l2(Cki - Xj);
@@ -77,11 +78,11 @@
const box<P>& domain() const
{
- return box;
+ return box_;
}
+ const box<P> box_;
const p_array<P>& X;
- const box<P> box;
// log call to the functor
mutable unsigned log_functor_call;
Index: mln/registration/registration.hh
--- mln/registration/registration.hh (revision 2542)
+++ mln/registration/registration.hh (working copy)
@@ -44,7 +44,7 @@
{
- using namespace fun::x2x::geom;
+ using namespace fun::x2x;
/*! Register an image \p cloud over the image \p surface.
*/
@@ -70,7 +70,7 @@
p_array<mln_psite(J)> x = convert::to< p_array<mln_psite(I)>
>(surface);
//init rigid transform qk
- composed< rotation<I::P::dim, float>, translation<I::P::dim,
float> > qk;
+ composed< rotation<I::psite::dim, float>,
translation<I::psite::dim, float> > qk;
//working box
const box<mln_psite(I)> working_box =
Index: mln/registration/icp.hh
--- mln/registration/icp.hh (revision 2542)
+++ mln/registration/icp.hh (working copy)
@@ -34,6 +34,7 @@
*/
# include <mln/fun/x2x/all.hh>
+# include <mln/fun/x2v/all.hh>
namespace mln
{
@@ -80,7 +81,7 @@
namespace registration
{
- using namespace fun::x2x::geom;
+ using namespace fun::x2x;
/*! Register point in \p c using a map of closest points \p map
*