Fill
Include <mln/core/algorithm/fill.hpp>
-
template<class V>
void fill(OutputImage ima, const V &value) Assign the value value to each pixel of the image. This is equivalent to the following code:
for (auto& vout : ima.values()) vout = value;
This function has a parallel implementation, see following section for an example.
- Parameters:
ima – The image to be filled.
value – The value to fill with.
- Template Parameters:
V – Must be convertible to image_value_t<OutputImage>
OutputImage – A model of
OutputImage
Examples
Set the pixels to a color:
mln::image2d<mln::rgb8> f = ...; mln::fill(f, mln::rgb8{255,0,0});
Set the red component of a RGB image:
mln::image2d<mln::rgb8> f = ...; mln::fill(mln::view::red(f), 69);
Using parallel fill to set the pixels to a color:
mln::image2d<mln::rgb8> f = ...; mln::parallel::fill(f, mln::rgb8{255,0,0});
Complexity
Linear in the number of pixels.