Include :file:`<mln/core/image/view/transform.hpp>`
.. cpp:namespace:: mln::view
#. .. cpp:function:: auto transform(Image ima, UnaryFunction f)
#. .. cpp:function:: auto transform(Image ima, Image ima2, BinaryFunction f)
1. Makes a view from `ima` where for each pixel value evals to `out(p) = f(ima(p))`
2. Makes a view from `ima` where for each pixel value evals to `out(p) = f(ima(p),ima2(p))`. For this overload, the domain of both image must be equal.
:param ima: Input range
:param ima2: Input range
:param f: Function to apply on pixel values
.. warning:: The function f must not create dangling references on the input.
.. code::
mln::image2d<mln::rgb8> ima = ...;
auto g1 = mln::view::transform(ima, [](rgb8 v) { return v; }); // OK: identity but creates a non-mutable image
auto g2 = mln::view::transform(g1, [](const rgb8& v) -> const uint8& { return v[0]; }); // KO: create a dangling reference to g1(p)