
find pixels with color-values lying between upper_bound and lower_bound
Source:R/rectangularRange_HSV.R
rectangularRange_HSV.RdTakes HSV-formatted pixel.array and bounds.
When determining which pixels lie within the bounds, only the hue- and saturation-
values are respected. The value-component is not considered.
Arguments
- pixel.array
image array as loaded via duflor::load_image()
- upper_bound
EITHER:
list of upper HSV-bounds, e.g.
list(green = c(H_green_lower,S_green_lower,V_green_lower),drought = c(H_drought_lower,S_drought_lower,V_drought_lower))single vector of length 3 declaring a set of HSV-values
- lower_bound
see
upper_bound- check_V
boolean toggle to also check the
VALUE-component of an HSV-pixel
Value
upon success, returns a list-object with the following elements:
pixel.idx- pixel-locations of pixels detected between lower and upper bound.pixel.count- number of pixels detected between lower and upper boundimg.fraction- fraction of image detected between lower and upper boundoriginal.img- fed-in pixel.array
Upon failure to find any matching pixels, an empty matrix of dimensions [0, 1:2] is returned
Note
The use of rectangularRange_HSV_cpp() is strongly suggested due to its drastically faster execution.
Adopted from countcolors::rectangularRange, reworked to work in HSV color
space instead of RGB and simplified.