Learn R Programming

imager (version 0.31)

extract_patches: Extract image patches and return a list

Description

Patches are rectangular (cubic) image regions centered at cx,cy (cz) with width wx and height wy (opt. depth wz) WARNINGS: - values outside of the image region are considered to be 0. - widths and heights should be odd integers (they're rounded up otherwise).

Usage

extract_patches(im, cx, cy, wx, wy)
extract_patches3D(im, cx, cy, cz, wx, wy, wz)

Arguments

im
an image
cx
vector of x coordinates for patch centers
cy
vector of y coordinates for patch centers
wx
vector of patch widths (or single value)
wy
vector of patch heights (or single value)
cz
vector of z coordinates for patch centers
wz
vector of coordinates for patch depth

Value

a list of image patches (cimg objects)

Functions

  • extract_patches3D: Extract 3D patches

Examples

Run this code
#2 patches of size 5x5 located at (10,10) and (10,20)
extract_patches(boats,c(10,10),c(10,20),5,5)

Run the code above in your browser using DataLab