as.cimg.function: Create an image by sampling a function
Description
Similar to as.im.function from the spatstat package, but simpler. Creates a grid of pixel coordinates x=1:width,y=1:height and (optional) z=1:depth, and evaluates the input function at these values.
Usage
## S3 method for class 'function':
as.cimg(obj, width, height, depth = 1,
normalise.coord = FALSE, ...)
Arguments
obj
a function with arguments (x,y) or (x,y,z). Must be vectorised.
width
width of the image (in pixels)
height
height of the image (in pixels)
depth
depth of the image (in pixels)
normalise.coord
coordinates are normalised so that x,y,z are in (0,1) (default FALSE)