halftone: Halftone an input image.

Description Usage Arguments Details Value Author(s) Examples

View source: R/halftone.R

Description

Generates down-sampled coordinates from a base image supplied as a matrix or array for plotting.

Usage

1
2
halftone(img, channel = 1, x.samp = 100, y.samp = 100, deg = 0, 
         invert = FALSE, thresh = 0, seed = 1852, method = "seq")

Arguments

img

a matrix or array with at least 2 dimensions.

channel

which channel of the img should be down-sampled?

x.samp

x-coordinate units to downsample. See details.

y.samp

y-coordinate units to downsample. See details.

deg

degrees to rotate points by after downsampling. Defaults to 0.

invert

recode channel value? Defaults to FALSE.

thresh

clipping threshold of channel value. Defaults to none.

seed

set a random seed for method=samp.

method

Method of downsampling. See details.

Details

If method="samp" then the x.samp argument determines the number of resulting rows (x-coordinates) in the plotting grid. However, if the sequence method is used, then this number results in a number proportional to the original order of the x-dimension of img.

If method="samp" then the y.samp argument determines the number of resulting cols (y-coordinates) in the plotting grid. However, if the sequence method is used, then this number results in a number proportional to the original order of the y-dimension of img.

If method is set to "seq" then a number of proportional rows and columns are removed uniformaly until the desired down sampling is attained. If set to "samp" then the downsampling is done using a random uniform reduction of rows without respect to columns. The latter can result in high deviations from original image.

If method is set to "none" then no downsampling is done. Note that the plotting routine can take a very long time for large dimensional images under this method since every 'pixel' is represented by a point on the grid. However, this may be useful for rendering simple graphics (i.e., clipart, line art) with a transparent element and for rendering large dimensional output.

Value

Returns an object of class 'halftone' with two elements:

x[[1]]

a two-column matrix containing the coordinates for plotting.

x[[2]]

a vector of point values.

Author(s)

Christopher Steven Marcum

Examples

1
2
3

cmarcum/halftoner documentation built on Dec. 2, 2020, 4:24 a.m.