00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
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 }