fdetect {gdi} | R Documentation |
Tool to help determine which threshold value and method to use with measuresil() or cscorr(). The function analyzes all pixels along the edges of the image to determine the background color, to help with deciding on appropriate settings and avoid errors introduced by inappropriate settings
Description
Tool to help determine which threshold value and method to use with measuresil() or cscorr(). The function analyzes all pixels along the edges of the image to determine the background color, to help with deciding on appropriate settings and avoid errors introduced by inappropriate settings
Usage
fdetect(image_file, threshold = 0.5, channel = 4, plot = FALSE)
Arguments
image_file |
Image to be read. Images can be jpeg or png files, or a previously read image saved as an object in R. |
threshold |
Reference value for color criterium after which pixels that are part of the silhouette should be differentiated from the background. |
channel |
Color channel to which to apply the threshold criterium. Default is 4 (alpha channel of rgba image). Channel setting needs to be adjusted depending on the color mode of the image used (e.g. there are two channels to choose from in a greyscale image, and 3 in an rgb image). |
plot |
Whether to plot a histogram with the detected color values (if TRUE) or not (if FALSE, default). |
Value
A list()-object containing: $edgetable (a table of the different color values detected and their respective frequencies), $histogram (a histogram-object of the color values), $most_common (the most common color value found), $foreground (a character string, indicating whether the foreground color value is likely "greater" or "less" than the specified threshold), $result (a character string giving a summary of the results)
Examples
fdir <- system.file(package="gdi")
fdetect(file.path(fdir,"exdata","lat.png"))