constructImage {recolorize} | R Documentation |
Generate an image from pixel assignments and color matrix
Description
Combines a matrix of pixel assignments and a corresponding matrix of colors to make a recolored RGB image.
Usage
constructImage(pixel_assignments, centers, background_color = "white")
Arguments
pixel_assignments |
A matrix of index values for each pixel which
corresponds to |
centers |
An n x 3 matrix of color centers where rows are colors and columns are R, G, and B channels. |
background_color |
A numeric RGB triplet, a hex code, or a named R color for the background. Will be masked by alpha channel (and appear white in the plot window), but will be revealed if the alpha channel is removed. If the alpha channel is a background mask, this is the 'baked in' background color. |
Value
An image (raster) array of the recolored image, with four channels (R, G, B, and alpha).