https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog from Dalila Benboudjema dalila@lrde.epita.fr
Add images for Dalila and create IGR directories .
* igr, * igr/images, * igr/images/s7.ppm, * igr/out, * igr/code: Add IGR directories.
* scribo/10_00000002.pbm_text2cell.ppm, * scribo/8_00000002.pbm_lbl-grouped-boxes.pgm, * scribo/2_00000002.pbm_horizontal-erosion.pbm, * scribo/11_00000002.pbm_out.ppm, * scribo/6_00000002.pbm_lbl-small-comps-removed.pgm, * scribo/5_00000002.pbm_table.ppm, * scribo/demat.hh: . * scribo/00000002.pbm, * scribo/demat_v2.hh, * scribo/facture2-neg.pbm, * scribo/+out.txt, * scribo/1_00000002.pbm_vertical-erosion.pbm, * scribo/9_00000002.pbm_cells-labels.ppm, * scribo/00000002-neg.pbm, * scribo/3_00000002.pbm_vertical-and-horizontal-erosion.ppm, * scribo/4_00000002.pbm_after-alignment.ppm, * scribo/7_00000002.pbm_character-bboxes.ppm, * scribo/demat31Oct2008.hh, * scribo/facture-neg.pbm, * scribo/Makefile, * dalila/images, * dalila/dematOld.hh, * dalila/plop.cc: Add scribo stuff.
dalila/dematOld.hh | 553 +++++++++ dalila/plop.cc | 19 scribo/+out.txt | 1882 +++++++++++++++++++++++++++++++++ scribo/9_00000002.pbm_cells-labels.ppm | 6 scribo/Makefile | 5 scribo/demat.hh | 9 scribo/demat31Oct2008.hh | 559 +++++++++ scribo/demat_v2.hh | 134 ++ 8 files changed, 3167 insertions(+)
Index: igr/images/s7.ppm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: igr/images/s7.ppm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/10_00000002.pbm_text2cell.ppm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/10_00000002.pbm_text2cell.ppm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/8_00000002.pbm_lbl-grouped-boxes.pgm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/8_00000002.pbm_lbl-grouped-boxes.pgm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/2_00000002.pbm_horizontal-erosion.pbm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/2_00000002.pbm_horizontal-erosion.pbm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/11_00000002.pbm_out.ppm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/11_00000002.pbm_out.ppm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/6_00000002.pbm_lbl-small-comps-removed.pgm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/6_00000002.pbm_lbl-small-comps-removed.pgm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/5_00000002.pbm_table.ppm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/5_00000002.pbm_table.ppm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/demat.hh --- scribo/demat.hh (revision 3156) +++ scribo/demat.hh (working copy) @@ -370,6 +370,15 @@ util::array<int> cols = align_lines(in.ncols(), geom::min_col(in), geom::max_col(in), tblboxes.first, 1); +# ifndef NOUT + image2d<rgb8> out2(in.domain()); + level::fill(out2, literal::black); + for_all_components(i, tblboxes.first) + draw::box(out2, tblboxes.first[i], literal::red); + for_all_components(i, tblboxes.second) + draw::box(out2, tblboxes.second[i], literal::red); + io::ppm::save(out2, output_file("after-alignment.ppm")); +# endif
connect_lines(rows, tblboxes.first, 0, in.nrows()); connect_lines(cols, tblboxes.second, 1, in.ncols()); Index: scribo/00000002.pbm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/00000002.pbm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/demat_v2.hh --- scribo/demat_v2.hh (revision 0) +++ scribo/demat_v2.hh (revision 0) @@ -0,0 +1,134 @@ +// 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 DEMAT_HH_ +# define DEMAT_HH_ + +# 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/value/int_u16.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> + +# include <mln/labeling/compute.hh> +# include <mln/accu/bbox.hh> + +namespace scribo +{ + + namespace internal + { + + void filter_image(mln::image2d<bool>& ima, + const mln::image2d<bool>& filter, + unsigned bbox_larger) + { + using namespace mln; + using value::int_u16; + + typedef image2d<int_u16> I; + typedef mln_accu_with_(accu::meta::bbox, mln_psite_(I)) A; + typedef util::array<A::result> boxes_t; + + int_u16 nlabels; + I lbl = labeling::blobs(filter, c4(), nlabels); + + boxes_t boxes = labeling::compute(accu::meta::bbox(), lbl, nlabels); + + for (unsigned i = 1; i <= nlabels; ++i) + level::paste(pw::cst(false) + | boxes[i].to_larger(bbox_larger), + ima); + } + + void remove_tables(mln::image2d<bool>& in, unsigned h, unsigned w, unsigned n) + { + using namespace mln; + + // Lignes verticales + win::rectangle2d vwin(h, w); + image2d<bool> vfilter = morpho::opening(in, vwin); + io::pbm::save(vfilter, "./table-vfilter.pbm"); + filter_image(in, vfilter, n); + + + // Lignes horizontales + win::rectangle2d hwin(w, h); + image2d<bool> hfilter = morpho::opening(in, hwin); + io::pbm::save(hfilter, "./table-hfilter.pbm"); + filter_image(in, hfilter, n); + } + + } // end of namespace scribo::internal + + + + // Facade + void demat(char *argv[]) + { + using namespace mln; + using value::int_u8; + + //Useful debug variables + unsigned h = atoi(argv[2]); + unsigned w = atoi(argv[3]); + unsigned n = atoi(argv[4]); + + //Load image + image2d<bool> in; + io::pbm::load(in, argv[1]); + + internal::remove_tables(in, h, w, n); + + io::pbm::save(in, "./table-filtered.pbm"); + } + +} // end of namespace scribo + +# endif // ! DEMAT_HH Index: scribo/facture2-neg.pbm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/facture2-neg.pbm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/+out.txt --- scribo/+out.txt (revision 0) +++ scribo/+out.txt (revision 0) @@ -0,0 +1,1882 @@
Index: scribo/1_00000002.pbm_vertical-erosion.pbm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
Property changes on: scribo/1_00000002.pbm_vertical-erosion.pbm ___________________________________________________________________ Name: svn:mime-type + application/octet-stream
Index: scribo/9_00000002.pbm_cells-labels.ppm --- scribo/9_00000002.pbm_cells-labels.ppm (revision 0) +++ scribo/9_00000002.pbm_cells-labels.ppm (revision 0) @@ -0,0 +1,6 @@ +P6 +# Generated by Milena 1.0 http://olena.lrde.epita.fr +# EPITA Research and Development Laboratory (LRDE) +1180 1680 +255