Learn R Programming

imager (version 0.45.8)

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 subject to boundary conditions. The default is to set them to 0 (Dirichlet), other boundary conditions are listed below. - widths and heights should be odd integers (they're rounded up otherwise).

Usage

extract_patches(im, cx, cy, wx, wy, boundary_conditions = 0L)

extract_patches3D(im, cx, cy, cz, wx, wy, wz, boundary_conditions = 0L)

Value

a list of image patches (cimg objects)

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)

boundary_conditions

integer. Can be 0 (Dirichlet, default), 1 (Neumann) 2 (Periodic) 3 (mirror).

cz

vector of z coordinates for patch centers

wz

vector of coordinates for patch depth

Functions

  • extract_patches3D(): Extract 3D patches

Examples

Run this code
cimg.limit.openmp()
#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