autocrop: Autocrop image region

View source: R/utils.R

autocropR Documentation

Autocrop image region

Description

Autocrop image region

Usage

autocrop(im, color = color.at(im, 1, 1), axes = "zyx")

Arguments

im

an image

color

Colour used for the crop. If missing, the colour is taken from the top-left pixel. Can also be a colour name (e.g. "red", or "black")

axes

Axes used for the crop.

Examples


#Add pointless padding
padded <- pad(boats,30,"xy")
plot(padded)
#Remove padding
autocrop(padded) %>% plot
#You can specify the colour if needs be
autocrop(padded,"black") %>% plot
#autocrop has a zero-tolerance policy: if a pixel value is slightly different from the one you gave
#the pixel won't get cropped. A fix is to do a bucket fill first
padded <- isoblur(padded,10)
autocrop(padded) %>% plot
padded2 <- bucketfill(padded,1,1,col=c(0,0,0),sigma=.1)
autocrop(padded2) %>% plot


imager documentation built on May 31, 2023, 8:56 p.m.