img_pad: Pad an image

Description Usage Arguments Examples

View source: R/utils.R

Description

Pad an image

Usage

1
2
img_pad(img, padding = c(0, 0, 0, 0), value = 0, top = padding[1],
  bottom = padding[2], left = padding[3], right = padding[4])

Arguments

img

image

padding

vector of four padding values (top, bottom, left, right). Specifying any one of the individual values will override the vector specification.

value

fill value to use for padding the image. If value has the same length as the number of frames in the image, it will be applied frame-wise.

top

number of pixels to add to the top

bottom

number of pixels to add to the bottom

left

number of pixels to add to the left

right

number of pixels to add to the right

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
par(mfrow = c(1, 2))
im <- EBImage::readImage(system.file('images', 'nuclei.tif', package='EBImage'))[,,1:3]
EBImage::colorMode(im) <- "Color"
dim(im)
plot(im)

im_pad <- img_pad(im, value = c(0, 1, 0), top = 15, bottom = 10, left = 5, right = 0)
dim(im_pad)
plot(im_pad)
im_pad <- img_pad(im, value = c(0, 1, 0), padding = c(15, 10, 5, 0))
dim(im_pad)
plot(im_pad)

srvanderplas/ShoeScrubR documentation built on Nov. 27, 2019, 2:09 p.m.