* scribo/src/primitive/extract/Makefile.am: Add a new target.
* scribo/src/primitive/extract/lines_pattern.cc: New.
--- scribo/ChangeLog | 8 +++ scribo/src/primitive/extract/Makefile.am | 4 +- scribo/src/primitive/extract/lines_pattern.cc | 76 +++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletions(-) create mode 100644 scribo/src/primitive/extract/lines_pattern.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 279e1fd..4fed85c 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,13 @@ 2009-11-03 Guillaume Lazzara z@lrde.epita.fr
+ Add a new example in Scribo. + + * scribo/src/primitive/extract/Makefile.am: Add a new target. + + * scribo/src/primitive/extract/lines_pattern.cc: New. + +2009-11-03 Guillaume Lazzara z@lrde.epita.fr + First draft of multiscale Sauvola's binarization.
* scribo/src/binarization/Makefile.am: Add new target. diff --git a/scribo/src/primitive/extract/Makefile.am b/scribo/src/primitive/extract/Makefile.am index 636abc3..7e1ea78 100644 --- a/scribo/src/primitive/extract/Makefile.am +++ b/scribo/src/primitive/extract/Makefile.am @@ -25,11 +25,13 @@ bin_PROGRAMS = \ extract_discontinued_vlines \ extract_discontinued_hlines \ extract_thick_vlines \ - extract_thick_hlines + extract_thick_hlines \ + lines_pattern
extract_discontinued_lines_SOURCES = extract_discontinued_lines.cc extract_discontinued_vlines_SOURCES = extract_discontinued_vlines.cc extract_discontinued_hlines_SOURCES = extract_discontinued_hlines.cc extract_thick_vlines_SOURCES = extract_thick_vlines.cc extract_thick_hlines_SOURCES = extract_thick_hlines.cc +lines_pattern_SOURCES = lines_pattern.cc
diff --git a/scribo/src/primitive/extract/lines_pattern.cc b/scribo/src/primitive/extract/lines_pattern.cc new file mode 100644 index 0000000..d794c71 --- /dev/null +++ b/scribo/src/primitive/extract/lines_pattern.cc @@ -0,0 +1,76 @@ +// Copyright (C) 2009 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. + +#include <mln/core/image/image2d.hh> +#include <mln/io/pbm/all.hh> +#include <mln/pw/all.hh> +#include <mln/data/fill.hh> +#include <mln/core/image/dmorph/image_if.hh> + +#include <scribo/primitive/extract/lines_h_pattern.hh> +#include <scribo/primitive/extract/lines_v_pattern.hh> +#include <scribo/debug/usage.hh> + + +const char *args_desc[][2] = +{ + { "input.pbm", "A binary image." }, + { "length", " Minimum line length. (Common value : 51)" }, + { "delta", " Distance between the object pixel and the background pixel (Common value : 5)" }, + {0, 0} +}; + + +int main(int argc, char *argv[]) +{ + using namespace mln; + + if (argc != 5) + return scribo::debug::usage(argv, + "Extract horizontal lines patterns", + "input.pbm length delta output.pbm", + args_desc, + "A binary image of lines."); + + trace::entering("main"); + + image2d<bool> input; + io::pbm::load(input, argv[1]); + + image2d<bool> + h_lines = scribo::primitive::extract::lines_h_pattern(input, + atoi(argv[2]), + atoi(argv[3])); + image2d<bool> + v_lines = scribo::primitive::extract::lines_v_pattern(input, + atoi(argv[2]), + atoi(argv[3])); + + data::fill((v_lines | pw::value(h_lines)).rw(), true); + + io::pbm::save(v_lines, argv[4]); + + trace::exiting("main"); +}