Skip to contents

Extract pixels from image which fall inbetween lower- and upper bounds.

Usage

extract_pixels_HSV(
  pixel.array,
  lower_bound,
  upper_bound,
  fast_eval = TRUE,
  bundle_pixelarray = FALSE,
  check_value = FALSE,
  use_single_iteration_cpp = FALSE
)

Arguments

pixel.array

image array as loaded via duflor::load_image()

lower_bound

see upper_bound

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

fast_eval

Use C++-code where possible to reduce execution time?

bundle_pixelarray

logical, indicating if the input parameter pixel.array is to be bundled into the return-value This is useful to retain pixel.array into the output if this function is called in a loop.

check_value

boolean toggle to also check the VALUE-component of an HSV-pixel

use_single_iteration_cpp

Use rectangularRange_HSV_iteronce_cpp() for computing hits per range. This is slightly more efficient than using rectangularRange_HSV_cpp().

Value

EITHER: list-object with the following elements (when supplying one one pair of bounds)

  • pixel.idx - pixel-locations of pixels detected between lower and upper bound.

  • pixel.count - number of pixels detected between lower and upper bound

  • img.fraction - fraction of image detected between lower and upper bound

  • original.img - fed-in pixel.array or list-object with the following elements (when supplying one one pair of bounds)

  • pixel.idx - pixel-locations of pixels detected between lower and upper bound.

  • pixel.count - number of pixels detected between lower and upper bound

  • img.fraction - fraction of image detected between lower and upper bound

  • original.img - fed-in pixel.array

  • indicator.img - pixel.array with hsv-values of pixels at positions pixel.idx modified.