Learn R Programming

imager (version 0.42.10)

cimg.extract: Various shortcuts for extracting colour channels, frames, etc

Description

Various shortcuts for extracting colour channels, frames, etc

Extract one frame out of a 4D image/video

Usage

frame(im, index)

imcol(im, x)

imrow(im, y)

channel(im, ind)

R(im)

G(im)

B(im)

Arguments

im

an image

index

frame index

x

x coordinate of the row

y

y coordinate of the row

ind

channel index

Functions

  • frame: Extract frame

  • imcol: Extract a particular column from an image

  • imrow: Extract a particular row from an image

  • channel: Extract an image channel

  • R: Extract red channel

  • G: Extract green channel

  • B: Extract blue channel

Examples

Run this code
# NOT RUN {
#Extract the red channel from the boats image, then the first row, plot
rw <- R(boats) %>% imrow(10)
plot(rw,type="l",xlab="x",ylab="Pixel value")
#Note that R(boats) returns an image
R(boats)
#while imrow returns a vector or a list
R(boats) %>% imrow(1) %>% str
imrow(boats,1) %>% str

# }

Run the code above in your browser using DataLab