x3p_sample: Sample from an x3p object

Description Usage Arguments Value Examples

View source: R/sample_x3p.R

Description

Sample from an x3p object

Usage

1
2
3
x3p_sample(x3p, m = 2, mY = m, offset = 0, offsetY = offset)

sample_x3p(x3p, m = 2, mY = m, offset = 0, offsetY = offset)

Arguments

x3p

x3p object

m

integer value - every mth value is included in the sample

mY

integer value - every mth value is included in the sample in x direction and every mYth value is included in y direction

offset

integer value between 0 and m-1 to specify offset of the sample

offsetY

integer value between 0 and mY-1 to specify different offsets for x and y direction

Value

down-sampled x3p object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
dim(logo$surface.matrix)
# down-sample to one-fourth of the image:
logo4 <- x3p_sample(logo, m=4)
dim(logo4$surface.matrix)
## Not run: 
x3p_image(logo)
x3p_image(logo4)

## End(Not run)

x3ptools documentation built on Nov. 27, 2021, 1:06 a.m.