RGB (View)

Include <mln/core/image/view/rgb.hpp>

  1. auto red(Image ima)
  2. auto green(Image ima)
  3. auto blue(Image ima)
    1. Makes a view that project the red channel of an rgb colored image.

    2. Makes a view that project the green channel of an rgb colored image.

    3. Makes a view that project the blue channel of an rgb colored image.

    Parameters:

    ima – Input range

    mln::image2d<mln::rgb8> ima = ...;
    auto ima_r = mln::view::red(ima);
    auto ima_g = mln::view::green(ima);
    auto ima_b = mln::view::blue(ima);
    

ima

red(ima), green(ima), blue(ima)

Category

Forward

X

X

Bidirectional

X

X

Raw

X

Properties

Writable

X

X

Accessible

X

X

Indexable

X

X

Examples

  • Set the red channel to max:

mln::image2d<mln::rgb8> ima = {
  { {0, 0, 255}, {0, 0, 255}, {0, 0, 255} },
  { {0, 0, 255}, {0, 0, 255}, {0, 0, 255} },
  { {0, 0, 255}, {0, 0, 255}, {0, 0, 255} }
  };
auto ima_r = mln::view::red(ima);
mln::fill(ima_r, 255);
mln::io::imprint(ima);

Outputs:

(255, 0, 255) (255, 0, 255) (255, 0, 255)
(255, 0, 255) (255, 0, 255) (255, 0, 255)
(255, 0, 255) (255, 0, 255) (255, 0, 255)