Description Usage Arguments Examples
This function resizes the image in rows first, and then columns. If the final dimension is smaller than the current dimension, the offset which minimizes the distance between the average pixel value of the middle 2/3 of the original image and the average pixel value of the new image will be used. If the final dimension is larger than the current dimension, the image will be symmetrically padded on that dimension with pixels of the value specified or (if not specified) the median pixel value of the 10 outmost rows/columns of the image. This function operates with the assumption that the center of the image contains the majority of the useful information.
1 | auto_resize_img(img, final_dims, value = NULL)
|
img |
image. If img has more than one frame (color or otherwise), the operation will be performed on each frame of the image separately. |
final_dims |
numerical vector of length two giving the width and height of the output image, respectively. |
value |
fill value to use for padding the image if necessary (if NULL, will be automatically set to the median value of the 10 pixels on the left and right edge of the image). If value has the same length as the number of frames in img, value will be applied frame-wise. |
1 2 3 4 5 6 7 8 9 10 11 12 | par(mfrow = c(1, 3))
im <- EBImage::readImage(system.file('images', 'nuclei.tif', package='EBImage'))
dim(im)
plot(im, all = TRUE)
im_sm <- auto_resize_img(im, c(510, 490))
dim(im_sm)
plot(im_sm, all = TRUE)
im_big <- auto_resize_img(im, c(510, 550), value = c(0, .25, .5, .75))
dim(im_big)
plot(im_big, all = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.