hpx_maxtree.cc

00001 
00002 #include <cstdlib>
00003 
00004 #include <ntg/int.hh>
00005 #include <oln/basics2d.hh>
00006 #include <oln/lrde/ufmt/hpx_maxtree.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 << "max-tree computation with union-find:" << std::endl;
00015   std::cerr << "  h. for low quant (for h, for p at h)" << std::endl;
00016   std::cerr << "  p. image<point>" << std::endl;
00017   std::cerr << "  x. level compression + full compression aux data" << std::endl;
00018   exit(1);
00019 }
00020 
00021 
00022 int main(int argc, char* argv[])
00023 {
00024   if (argc != 3)
00025     usage(argv);
00026 
00027   using namespace oln;
00028   typedef image2d<ntg::int_u8> image_t;
00029 
00030   image_t input = load(argv[1]);
00031 
00032   int c = atoi(argv[2]);
00033   if (not (c == 4 or c == 8))
00034     usage(argv);
00035 
00036   typedef lrde::ufmt::hpx_maxtree<image_t> algorithm_t;
00037 
00038   algorithm_t run(input,
00039                   c == 4 ? neighb_c4() : neighb_c8());
00040   run.go<void>();
00041   // save(tree_image(run, true), "tree.pgm");
00042 
00043   unsigned n = run.nnodes;
00044   assert(n == n_level_roots(run));
00045   std::cout << "n level roots = " << n << std::endl;
00046 }

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