countColorsInDirectory {countcolors} | R Documentation |
Count colors within range(s) in every image in a directory
Description
A wrapper for countColors
that finds every image (JPEG or PNG) in a #' folder and counts colors in each image.
Usage
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)
Arguments
folder |
Path to a folder containing images. |
color.range |
Type of range being specified. Must be either "spherical" or "rectangular". |
center |
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. |
radius |
Values between 0 and 1 specifying the size of the area around
|
lower |
RGB triplet(s) specifying the bounds of color space to search. Must be the same length. See details. |
upper |
RGB triplet(s) specifying the bounds of color space to search. Must be the same length. See details. |
bg.lower |
RGB triplets specifying the bounds of color space to
ignore as background, or |
bg.upper |
RGB triplets specifying the bounds of color space to
ignore as background, or |
target.color |
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 |
plotting |
Logical. Should output be plotted in the plot window? |
save.indicator |
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. |
dpi |
Resolution (dots per image) for saving indicator image. |
return.indicator |
Logical. Should an indicator image (RGB array with targeted pixels changed to indicator color) be returned? |
Value
A list of countColors
lists, one for each image.
See Also
Examples
## 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")
## End(Not run)