Learn R Programming

recolorize (version 0.2.0)

recolorize_to_patternize: Convert a recolorize object to a raster object

Description

Convert from a recolorize object to a list of RasterLayer objects, the format required by the patternize package. Note that most of the downstream patternize functions that require lists of RasterLayer objects mostly require lists of these lists, so you will probably need to use this function on a list of recolorize objects.

Usage

recolorize_to_patternize(recolorize_obj, return_background = FALSE)

Value

A list of RasterLayer objects, one per color class.

Arguments

recolorize_obj

A recolorize object.

return_background

Logical.

Details

Note that this function does not retain the colors of the layers -- you won't be able to convert back to a recolorize object from this object.

Examples

Run this code

# \donttest{
# fit recolorize object:
img <- system.file("extdata/ephippigera.png", package = "recolorize")
rc <- recolorize2(img)

# takes ~10 sec to run:
# convert to a raster list:
as_raster_list <- recolorize_to_patternize(rc)
# }

Run the code above in your browser using DataLab