
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2008-01-08 Guillaume Duhamel <guillaume.duhamel@lrde.epita.fr> Add file for example of character extraction. * sandbox/nivault/extract_character.cc: New example. --- extract_character.cc | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) Index: trunk/milena/sandbox/nivault/extract_character.cc =================================================================== --- trunk/milena/sandbox/nivault/extract_character.cc (revision 0) +++ trunk/milena/sandbox/nivault/extract_character.cc (revision 1640) @@ -0,0 +1,69 @@ +// Copyright (C) 2007, 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. + +# include <mln/core/image2d.hh> +# include <mln/io/pbm/load.hh> +# include <mln/debug/println.hh> +# include <mln/logical/not.hh> +# include <mln/logical/or.hh> +# include <mln/io/pbm/save.hh> + +# include <mln/morpho/erosion.hh> +# include <mln/morpho/dilation.hh> +# include <mln/make/w_window2d.hh> +# include <mln/win/rectangle2d.hh> +# include <mln/win/vline2d.hh> +# include <mln/win/hline2d.hh> +# include <mln/level/fill.hh> + + +using namespace mln; + +int +main(int argc, char** argv) +{ + using value::int_u8; + + if (argc != 3) + { + std::cerr << "Usage : " << argv[0] + << " input.pbm output.pbm" << std::endl; + exit(1); + } + std::string path_input = argv[1]; + std::string path_output = argv[2]; + + image2d<bool> input = io::pbm::load (path_input); + + image2d<bool> output = clone(input); + output = logical::not_(output); + + io::pbm::save (output, path_output); + + std::cout << path_output << " generated" << std::endl; +} +