Add more test images.
[seam-carving.git] / src / all.hh
blob1b359e54e543fda38a3c9057aef7cf02bcecf661
1 #ifndef ALL_HH_
2 # define ALL_HH_
4 # include <mln/core/image2d.hh>
5 # include <mln/value/rgb8.hh>
7 using mln::image2d;
8 using mln::point2d;
9 using mln::value::rgb8;
11 /// Load a color image from \a path.
12 image2d<rgb8> load (const char* path);
13 /// Save a gray-level stretched image \a img to \a path.
14 void save (const image2d<float>& img, const char* path);
16 /// Compute the energy in \a img using the norm of the gradient.
17 image2d<float> get_nrg (const image2d<rgb8>& img);
18 /** Adjust an existing energy computation. Optimized way of adjusting the
19 * energy in an image from which a seam has been carved.
20 * \param img The input image.
21 * \param nrg The existing energy computation of \a img.
22 * \param path The vertical seam which has been removed from \a img and
23 * from which the energy must be re-computed.
25 void adjust_vertical_nrg (const image2d<rgb8> img, image2d<float> nrg,
26 std::vector<unsigned> path);
27 /// Compute the entropy in \a img using a 9x9 window.
28 image2d<float> get_entropy (const image2d<rgb8>& img);
30 /** Find a vertical seam in the image. The process only relies on the
31 * energy in the image.
32 * \param nrg The energy in the image.
33 * \return A vector with the points in the seam. Let \c c be the \c r th
34 * value in the vector. This means that the seam passes by the point
35 * (r, c) in the image.
37 std::vector<unsigned>
38 find_vertical_seam (const image2d<float> nrg);
40 /** Carve a seam out of an image.
41 * \param img Image to modify.
42 * \param path Path of the seam to carve.
43 * \return \a img with the seam \a path carved out.
45 template <typename T>
46 image2d<T>
47 carve_vertical_seam (const image2d<T> img, const std::vector<unsigned>& path);
49 image2d<rgb8>
50 uncarve_vertical_seam (const image2d<rgb8> img, const std::vector<unsigned>& path);
52 #endif /* !ALL_HH_ */