---
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
Show replies by date