fiorio.cc

00001 // Copyright (C) 2006  EPITA Research and Development Laboratory
00002 //
00003 // This file is part of the Olena Library.  This library is free
00004 // software; you can redistribute it and/or modify it under the terms
00005 // of the GNU General Public License version 2 as published by the
00006 // Free Software Foundation.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this library; see the file COPYING.  If not, write to
00015 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
00016 // Boston, Boston, MA 02110-1301, USA.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software library without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to
00022 // produce an executable, this file does not by itself cause the
00023 // resulting executable to be covered by the GNU General Public
00024 // License.  This exception does not however invalidate any other
00025 // reasons why the executable file might be covered by the GNU General
00026 // Public License.
00027 
00028 #include <cstdlib>
00029 
00030 #include <ntg/int.hh>
00031 #include <ntg/color/rgb.hh>
00032 
00033 #include <oln/basics2d.hh>
00034 #include <oln/level/fill.hh>
00035 
00036 // Max-tree computation base on Fiorio's and Gustedt's algorithm.
00037 #if defined(FIORIO_VERSION) && FIORIO_VERSION == 3
00038 # include <oln/lrde/ufmt/fiorio-3.hh>
00039 #else
00040 # if defined(FIORIO_VERSION) && FIORIO_VERSION == 2
00041 #  include <oln/lrde/ufmt/fiorio-2.hh>
00042 # else
00043 #  include <oln/lrde/ufmt/fiorio-1.hh>
00044 # endif
00045 #endif
00046 
00047 
00048 void usage(char* argv[])
00049 {
00050   std::cerr << "usage: " << argv[0] << " input.pgm"
00051             << std::endl
00052             << "Max-tree computation with Fiorio's and Gustedt's algorithm."
00053             << std::endl;
00054   exit(1);
00055 }
00056 
00057 
00058 int main(int argc, char* argv[])
00059 {
00060   if (argc != 2)
00061     usage(argv);
00062 
00063   typedef oln::image2d<ntg::int_u8> image_type;
00064   image_type input = oln::io::load(argv[1]);
00065 
00066   typedef oln::lrde::ufmt::fiorio<image_type> algorithm_type;
00067   algorithm_type run(input);
00068   std::cout << "npoint                        = " << run.ima().npoints()
00069             << std::endl;
00070   run.go();
00071   std::cout << "n level roots (first method)  = " << run.n_level_roots1()
00072             << std::endl
00073             << "n level roots (second method) = " << run.n_level_roots2()
00074             << std::endl;
00075 }

Generated on Tue Feb 20 20:19:01 2007 for Olena by  doxygen 1.5.1