Commit 7991e3f7 authored by Roland Levillain's avatar Roland Levillain
Browse files

Milena: Add helpers to instantiate mln::interpolated and mln::tr_image.

	* mln/core/image/imorph/interpolated.hh (mln::interpolate)
	* mln/core/image/imorph/tr_image.hh (mln::apply_tr):
	New functions.
parent 8fecc482
2013-10-09 Roland Levillain <roland@lrde.epita.fr>
Milena: Add helpers to instantiate mln::interpolated and mln::tr_image.
* mln/core/image/imorph/interpolated.hh (mln::interpolate)
* mln/core/image/imorph/tr_image.hh (mln::apply_tr):
New functions.
2013-10-09 Roland Levillain <roland@lrde.epita.fr>
 
Milena: Exercise mln::interpolated and mln::tr_image together.
......@@ -138,6 +138,22 @@ namespace mln
};
/** \brief Helper routine to create an mln::interpolated morphed
image.
Careful, the order of the template parameters is inverted
compared to mln::interpolated. This is so that the routine can
be used this way:
\code
mln::interpolate<mln::fun::x2v::bilinear>(ima);
\encode
(i.e., so that parameter I can be deduced from \a ima). */
template <template <class> class F, typename I>
interpolated<I, F> interpolate(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
......@@ -216,6 +232,15 @@ namespace mln
}
// interpolate.
template <template <class> class F, typename I>
interpolated<I, F> interpolate(Image<I>& ima)
{
interpolated<I, F> tmp(exact(ima));
return tmp;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
......
......@@ -155,6 +155,19 @@ namespace mln
};
/// \brief Helper routine to create an mln::tr_image morphed image.
template <typename S, typename I, typename T>
tr_image<S, I, T>
apply_tr(const Site_Set<S>& s, const Image<I>& ima,
const Function_v2v<T>& tr);
/// \brief Helper routine to create an mln::tr_image morphed
/// images. The domain is deduced from \a ima.
template <typename I, typename T>
tr_image<mln_domain(I), I, T>
apply_tr(const Image<I>& ima, const Function_v2v<T>& tr);
# ifndef MLN_INCLUDE_ONLY
......@@ -265,6 +278,27 @@ namespace mln
return tmp;
}
/// transform.
template <typename S, typename I, typename T>
tr_image<S, I, T>
apply_tr(const Site_Set<S>& s, const Image<I>& ima,
const Function_v2v<T>& tr)
{
tr_image<S, I, T> tmp(exact(s), exact(ima), exact(tr));
return tmp;
}
template <typename I, typename T>
tr_image<mln_domain(I), I, T>
apply_tr(const Image<I>& ima, const Function_v2v<T>& tr)
{
tr_image<mln_domain(I), I, T> tmp(exact(ima).domain(), exact(ima),
exact(tr));
return tmp;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment