Cast (View) ########### Include :file:`` .. cpp:namespace:: mln::view #. .. cpp:function:: template auto cast(Image ima) 1. Makes a view from `ima` where for each pixel value evals to :cpp:expr:`out(p) = static_cast(ima(p))` :param ima: Input range :tparam T: Type to cast to .. code:: mln::image2d ima = ...; auto g1 = mln::view::cast(ima); +----------------+---------------+-------+----------------+ | | | *ima* | *cast(ima)* | +================+===============+=======+================+ | | Forward | X | X | + +---------------+-------+----------------+ | **Category** | Bidirectional | X | X | + +---------------+-------+----------------+ | | Raw | X | | +----------------+---------------+-------+----------------+ | | Writable | X | | + +---------------+-------+----------------+ | **Properties** | Accessible | X | X | + +---------------+-------+----------------+ | | Indexable | X | X | +----------------+---------------+-------+----------------+ Examples -------- * Double image to int: .. code:: mln::image2d input = { {0.1, 1.1, 2.1}, {3.5, 4.5, 5.5} }; auto g = mln::view::cast(input); mln::io::imprint(g); Outputs: .. code-block:: text 0 1 2 3 4 5