Skip to main content

from_red_channel

Function from_red_channel 

Source
pub fn from_red_channel<C>(image: &Image<Luma<C>>) -> Image<Rgb<C>>
where Rgb<C>: Pixel<Subpixel = C>, C: Primitive,
Expand description

Creates an RGB image by embedding a grayscale image in its red channel.

ยงExamples

use image::Luma;
use imageproc::map::from_red_channel;

let image = gray_image!(
    1, 2;
    3, 4);

let expected = rgb_image!(
    [1, 0, 0], [2, 0, 0];
    [3, 0, 0], [4, 0, 0]);

let actual = from_red_channel(&image);
assert_pixels_eq!(actual, expected);