basic_najman.cc

00001 
00002 #include <cstdlib>
00003 
00004 #include <ntg/int.hh>
00005 #include <oln/basics2d.hh>
00006 #include <oln/lrde/ufmt/basic_najman.hh>
00007 #include <oln/lrde/ufmt/log.hh>
00008 
00009 
00010 
00011 void usage(char* argv[])
00012 {
00013   std::cerr << "usage: " << argv[0] << " input.pgm c" << std::endl;
00014   std::cerr << "basic max-tree computation with Najman et al. algorithm"
00015             << std::endl;
00016   // FIXME: get precise description...
00017   exit(1);
00018 }
00019 
00020 
00021 int main(int argc, char* argv[])
00022 {
00023   if (argc != 3)
00024     usage(argv);
00025 
00026   using namespace oln;
00027   typedef image2d<ntg::int_u8> image_t;
00028 
00029   image_t input = load(argv[1]);
00030 
00031   int c = atoi(argv[2]);
00032   if (not (c == 4 or c == 8))
00033     usage(argv);
00034 
00035   typedef lrde::ufmt::basic_najman<image_t> algorithm_t;
00036 
00037   algorithm_t run(input,
00038                   c == 4 ? neighb_c4() : neighb_c8());
00039   run.go();
00040 
00041   //std::cout << "root = " << run.Root << std::endl;
00042   std::cout << "n level roots = " << n_level_roots(run) << std::endl;
00043 }

Generated on Tue Feb 20 20:18:28 2007 for Olena by  doxygen 1.5.1