Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) 00002 // 00003 // This file is part of Olena. 00004 // 00005 // Olena is free software: you can redistribute it and/or modify it under 00006 // the terms of the GNU General Public License as published by the Free 00007 // Software Foundation, version 2 of the License. 00008 // 00009 // Olena is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software project without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to produce 00021 // an executable, this file does not by itself cause the resulting 00022 // executable to be covered by the GNU General Public License. This 00023 // exception does not however invalidate any other reasons why the 00024 // executable file might be covered by the GNU General Public License. 00025 00029 00030 00031 00032 # include <mln/core/image/image2d.hh> 00033 # include <mln/core/image/dmorph/sub_image.hh> 00034 # include <mln/core/alias/neighb2d.hh> 00035 # include <mln/value/int_u8.hh> 00036 # include <mln/data/stretch.hh> 00037 # include <mln/border/fill.hh> 00038 # include <mln/io/pbm/load.hh> 00039 # include <mln/io/pgm/save.hh> 00040 # include <mln/labeling/foreground.hh> 00041 # include <mln/debug/println.hh> 00042 # include <mln/geom/seeds2tiling.hh> 00043 # include <mln/geom/seeds2tiling_roundness.hh> 00044 # include <mln/make/voronoi.hh> 00045 00046 #include <mln/core/image/image2d.hh> 00047 #include <mln/core/image/dmorph/sub_image.hh> 00048 #include <mln/core/image/dmorph/image_if.hh> 00049 00050 00051 #include <mln/core/alias/w_window2d_int.hh> 00052 #include <mln/make/win_chamfer.hh> 00053 00054 int main(int argc, char* argv[]) 00055 { 00056 if (argc < 2) 00057 { 00058 std::cerr << "missing argument: " 00059 << "specify the location of the binary image (*.pbm)" 00060 << std::endl; 00061 return 1; 00062 } 00063 using namespace mln; 00064 using value::int_u8; 00065 unsigned max = 2048; 00066 00067 image2d<bool> input = io::pbm::load(argv[1]); 00068 00069 { 00070 const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2,3>(); 00071 00072 unsigned n; 00073 image2d<unsigned> lab = labeling::foreground(input, c4(), n); 00074 std::cout << "number of labels = " << n << std::endl; 00075 00076 00077 image2d<unsigned> inte = geom::seeds2tiling(lab, c4()); 00078 border::fill(inte, 0); 00079 00080 image2d<int_u8> inte2 = data::stretch(int_u8(), inte); 00081 io::pgm::save(inte2, "ima1.pgm"); 00082 00083 std::cout << "ima1 generate with seeds2tiling" 00084 << std::endl; 00085 inte = geom::seeds2tiling_roundness(lab, w_win, max, c4()); 00086 border::fill(inte, 0); 00087 00088 inte2 = data::stretch(int_u8(), inte); 00089 00090 io::pgm::save(inte2, "ima2.pgm"); 00091 std::cout << "ima2 generate with seeds2tiling_roundness" 00092 << std::endl; 00093 } 00094 00095 }