Various shortcuts for extracting colour channels, frames, etc

Share:

Description

Various shortcuts for extracting colour channels, frames, etc

Extract one frame out of a 4D image/video

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

Author(s)

Simon Barthelme

Examples

1
2
3
4
5
6
7
8
#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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.