drawCheckerboard {StereoMorph} | R Documentation |
Creates a checkerboard image
Description
Creates a checkerboard image of specified dimensions and saves to an input file path. The dimensions of the checkerboard are specified by the number of internal corners (the number of squares minus one).
Usage
drawCheckerboard(nx, ny, square.size, file = NULL,
margin.x = c(round(square.size/2), round(square.size/2)),
margin.y = c(round(square.size/2), round(square.size/2)),
filename = NULL, ...)
Arguments
nx |
the number of internal corners in the horizontal direction (the number of squares in each row minus one). |
ny |
the number of internal corners in the vertical direction (the number of squares in each column minus one). |
square.size |
the square size in pixels. |
file |
the file path and name to which the image should be saved. The filename must be a valid image filename. Acceptable extensions are: jpg, jpeg, bmp, png and tiff. |
margin.x |
the margin in pixels on the left and right sides of the checkerboard pattern. |
margin.y |
the margin in pixels on the top and bottom of the checkerboard pattern. |
filename |
Duplicate with |
... |
further arguments to be passed to the image function corresponding to the extension in |
Details
This function requires the grid
package. The image type is determined automatically from the filename and the corresponding image writing function is called.
Value
returns null device
Author(s)
Aaron Olsen
See Also
Examples
## NUMBER OF INTERNAL CORNERS IN THE HORIZONTAL DIMENSION
## NUMBER OF ROWS OF SQUARES MINUS ONE
nx <- 21
## NUMBER OF INTERNAL CORNERS IN THE VERTICAL DIMENSION
## NUMBER OF COLUMNS OF SQUARES MINUS ONE
ny <- 14
## SQUARE SIZE IN PIXELS
square.size <- 200
## WHERE TO SAVE THE FILE
filename <- paste0("checkerboard_", nx, "_", ny, "_", square.size, ".jpeg")
## Not run:
## DRAW CHECKERBOARD
## FILE WILL BE CREATED IN CURRENT WORKING DIRECTORY
drawCheckerboard(nx=nx, ny=ny, square.size=square.size, filename=filename)
## End(Not run)