Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

channel

Color and image color mode conversions


Description

channel handles color space conversions between image modes. rgbImage combines Grayscale images into a Color one. toRGB is a wrapper function for convenient grayscale to RGB color space conversion; the call toRGB(x) returns the result of channel(x, 'rgb').

Usage

channel(x, mode)
rgbImage(red, green, blue)
toRGB(x)

Arguments

x

An Image object or an array.

mode

A character value specifying the target mode for conversion. See Details.

red, green, blue

Image objects in Grayscale color mode or arrays of the same dimension. If missing, a black image will be used.

Details

Conversion modes:

rgb

Converts a Grayscale image or an array into a Color image, replicating RGB channels.

gray, grey

Converts a Color image into a Grayscale image, using uniform 1/3 RGB weights.

luminance

Luminance-preserving Color to Grayscale conversion using CIE 1931 luminance weights: 0.2126 * R + 0.7152 * G + 0.0722 * B.

red, green, blue

Extracts the red, green or blue channel from a Color image. Returns a Grayscale image.

asred, asgreen, asblue

Converts a Grayscale image or an array into a Color image of the specified hue.

NOTE: channel changes the pixel intensities, unlike colorMode which just changes the way that EBImage renders an image.

Value

An Image object or an array.

Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk

See Also

Examples

x = readImage(system.file("images", "shapes.png", package="EBImage"))
 display(x)
 y = channel(x, 'asgreen')
 display(y)

 ## rgbImage
 x = readImage(system.file('images', 'nuclei.tif', package='EBImage'))
 y = readImage(system.file('images', 'cells.tif', package='EBImage'))
 display(x, title='Cell nuclei')
 display(y, title='Cell bodies')

 cells = rgbImage(green=1.5*y, blue=x)
 display(cells, title='Cells')

EBImage

Image processing and analysis toolbox for R

v4.32.0
LGPL
Authors
Andrzej Oleś, Gregoire Pau, Mike Smith, Oleg Sklyar, Wolfgang Huber, with contributions from Joseph Barry and Philip A. Marais
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.