00001 00002 #include <cstdlib> 00003 00004 #include <ntg/int.hh> 00005 #include <oln/basics1d.hh> 00006 #include <oln/lrde/ufmt/r1ic_maxtree.hh> 00007 #include <oln/lrde/ufmt/log.hh> 00008 00009 00010 00011 void usage(char* argv[]) 00012 { 00013 std::cerr << "usage: " << argv[0] << " input1D.pgm" << std::endl; 00014 std::cerr << "1D raster max-tree computation with union-find" << std::endl; 00015 std::cerr << " r. for raster video scan" << std::endl; 00016 std::cerr << " i. par = image<int>" << std::endl; 00017 std::cerr << " c. level compression" << std::endl; 00018 std::cerr << "inspecting the only neighbor calls 'insert'" << std::endl; 00019 exit(1); 00020 } 00021 00022 00023 int main(int argc, char* argv[]) 00024 { 00025 if (argc != 2) 00026 usage(argv); 00027 00028 using namespace oln; 00029 typedef image1d<ntg::int_u8> image_t; 00030 00031 image_t input = load(argv[1]); 00032 typedef lrde::ufmt::r1ic_maxtree<image_t> algorithm_t; 00033 00034 algorithm_t run(input); 00035 run.go(); 00036 std::cout << "n level roots = " << n_level_roots(run) << std::endl; 00037 }