Last chance! 50% off unlimited learning
Sale ends in
A wrapper for countColors
that finds every image (JPEG or PNG) in a #' folder and counts colors in each image.
countColorsInDirectory(folder, color.range = "spherical", center, radius,
lower, upper, bg.lower = rep(0.8, 3), bg.upper = rep(1, 3),
target.color = c("magenta", "cyan", "yellow"), plotting = FALSE,
save.indicator = FALSE, dpi = 72, return.indicator = FALSE)
Path to a folder containing images.
Type of range being specified. Must be either "spherical" or "rectangular".
A vector or n x 3 matrix of color centers (RGB triplets) around which to search using spherical color range. RGB range 0-1 (not 0-255). See details.
Values between 0 and 1 specifying the size of the area around
center
to search. The same number of centers and radii must be
specified.
RGB triplet(s) specifying the bounds of color space to search. Must be the same length. See details.
RGB triplet(s) specifying the bounds of color space to search. Must be the same length. See details.
RGB triplets specifying the bounds of color space to
ignore as background, or NULL
to use the entire image.
RGB triplets specifying the bounds of color space to
ignore as background, or NULL
to use the entire image.
If an indicator image is created, the color with which to
replace specified pixels. Can be either an RGB triplet or one of the
colors listed by colors
.
Logical. Should output be plotted in the plot window?
Logical OR path for saving indicator image. If TRUE, saves image to the same directory as the original image as 'originalimagename_masked.png'; if a path is provided, saves it to that directory/name instead.
Resolution (dots per image) for saving indicator image.
Logical. Should an indicator image (RGB array with targeted pixels changed to indicator color) be returned?
A list of countColors
lists, one for each image.
# NOT RUN {
folder <- system.file("extdata", package = "countcolors")
# Screen out white in both the flower image and the pelican image
upper <- c(1, 1, 1)
lower <- c(0.8, 0.8, 0.8)
white.screen <- countcolors::countColorsInDirectory(folder, color.range =
"rectangular", upper = upper, lower = lower, bg.lower = NULL, plotting =
TRUE, target.color = "turquoise")
# }
Run the code above in your browser using DataLab