Use separate compilation.
[seam-carving.git] / src / nrg_main.cc
blob5b0782b0a68f65cbe9b74020294de82ca5f46229
1 #include <iostream>
3 #include <mln/border/duplicate.hh>
4 #include <mln/io/ppm/load.hh>
5 #include <mln/io/pgm/save.hh>
6 #include <mln/level/stretch.hh>
8 #include "all.hh"
10 using namespace mln;
11 using namespace mln::value;
13 int main (int argc, char** argv)
15 if (argc != 3)
17 std::cerr << "usage: " << *argv << " in.ppm out.pgm\n";
18 return 1;
21 image2d<rgb8> img = io::ppm::load<rgb8> (argv[1]);
22 border::duplicate (img);
23 image2d<float> nrg (img.domain ());
24 image2d<rgb8>::fwd_piter p (img.domain ());
26 for_all (p)
27 nrg (p) = get_nrg (img, p);
29 std::cerr << "saving" << std::endl;
30 image2d<int_u8> gl (img.domain ());
31 level::stretch (nrg, gl);
32 io::pgm::save (gl, argv[2]);
33 std::cerr << "end" << std::endl;