Accept a bias for the energy.
[seam-carving.git] / src / all.hh
blob4bd5a1fe76d54439192d00d2bea6e59f1a7c3f52
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 /// Compute the entropy in \a img using a 9x9 window.
19 image2d<float> get_entropy (const image2d<rgb8>& img);
21 /** Find a vertical seam in the image. The process only relies on the
22 * energy in the image.
23 * \param nrg The energy in the image.
24 * \return A vector with the points in the seam. Let \c c be the \c r th
25 * value in the vector. This means that the seam passes by the point
26 * (r, c) in the image.
28 std::vector<unsigned>
29 find_vertical_seam (const image2d<float> nrg);
31 /** Carve a seam out of an image.
32 * \param img Image to modify.
33 * \param path Path of the seam to carve.
34 * \return \a img with the seam \a path carved out.
36 template <typename T>
37 image2d<T>
38 carve_vertical_seam (const image2d<T> img, const std::vector<unsigned>& path);
40 image2d<rgb8>
41 uncarve_vertical_seam (const image2d<rgb8> img, const std::vector<unsigned>& path);
43 #endif /* !ALL_HH_ */