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

crop.borders

Crop the outer margins of an image


Description

This function crops pixels on each side of an image. This function is a kind of inverse (centred) padding, and is useful e.g. when you want to get only the valid part of a convolution

Usage

crop.borders(im, nx = 0, ny = 0, nz = 0, nPix)

Arguments

im

an image

nx

number of pixels to crop along horizontal axis

ny

number of pixels to crop along vertical axis

nz

number of pixels to crop along depth axis

nPix

optional: crop the same number of pixels along all dimensions

Value

an image

Author(s)

Simon Barthelme

Examples

#These two versions are equivalent
imfill(10,10) %>% crop.borders(nx=1,ny=1)
imfill(10,10) %>% crop.borders(nPix=1)

#Filter, keep valid part
correlate(boats,imfill(3,3)) %>% crop.borders(nPix=2)

imager

Image Processing Library Based on 'CImg'

v0.42.10
LGPL-3
Authors
Simon Barthelme [aut], David Tschumperle [ctb], Jan Wijffels [ctb], Haz Edine Assemlal [ctb], Shota Ochi [cre]
Initial release

We don't support your browser anymore

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