rerun_recolorize {recolorize} | R Documentation |
Rerun the sequence of calls used to produce a recolorize object
Description
Evaluates the series of calls in the 'call' element of a recolorize object, either on the original image (default) or on another image. It will almost always be easier (and better practice) to define a new function that calls a series of recolorize function in order than to use this function!
Usage
rerun_recolorize(recolorize_obj, img = "original")
Arguments
recolorize_obj |
An object of S3 class 'recolorize'. |
img |
The image on which to call the recolorize functions. If left as
"original" (the default), functions are called on the original image stored
in the recolorize object. Otherwise can be an object taken by the |
Details
This function utilizes eval
statements to evaluate the calls
that were stored in the call
element of the specified recolorize object.
This makes it potentially more unpredictable than simply defining your own
function, which is preferable.
Value
A recolorize
object.
Examples
# list images
corbetti <- system.file("extdata/corbetti.png", package = "recolorize")
chongi <- system.file("extdata/chongi.png", package = "recolorize")
# fit a recolorize object by running two functions in a row:
rc <- recolorize(corbetti, bins = 2, plotting = FALSE)
rc <- recluster(rc, cutoff = 45)
# check out the call structure (a list of commands that were run):
rc$call
# we can rerun the analysis on the same image (bit pointless):
rerun <- rerun_recolorize(rc)
# or, we can rerun it on a new image:
rerun_chongi <- rerun_recolorize(rc, img = chongi)