Learn R Programming

imager (version 0.45.8)

bbox: Compute the bounding box of a pixset

Description

This function returns the bounding box of a pixset as another pixset. If the image has more than one frame, a bounding cube is returned. If the image has several colour channels, the bounding box is computed separately in each channel. crop.bbox crops an image using the bounding box of a pixset.

Usage

bbox(px)

crop.bbox(im, px)

Value

a pixset object

Arguments

px

a pixset

im

an image

Functions

  • crop.bbox(): crop image using the bounding box of pixset px

Author

Simon Barthelme

Examples

Run this code
cimg.limit.openmp()
im <- grayscale(boats)
px <- im > .85
plot(im)
highlight(bbox(px))
highlight(px,col="green")
crop.bbox(im,px) %>% plot

Run the code above in your browser using DataLab