RGB to HSV

Convert image from RGB color space to HSV color space and split the channels.

plantcv.rgb2gray_hsv(rgb_img, channel)

returns split image (h, s, or v channel)

  • Parameters:

    • rgb_img - RGB image data
    • channel - Split 'h' (hue), 's' (saturation), or 'v' (value) channel
  • Context:

    • Used to help differentiate plant and background
  • Example use:

Original RGB image

Screenshot


from plantcv import plantcv as pcv

# Set global debug behavior to None (default), "print" (to file), 
# or "plot" (Jupyter Notebooks or X11)
pcv.params.debug = "plot"

# image converted from RGB to HSV, channels are then split. 
# Hue ('h') channel is output
h_channel = pcv.rgb2gray_hsv(rgb_img=rgb_img, channel='h')

Hue channel image

Screenshot


# Saturation ('s') channel is output    
s_channel = pcv.rgb2gray_hsv(rgb_img=rgb_img, channel='s')

Saturation channel image

Screenshot


# Value ('v') channel is output
v_channel = pcv.rgb2gray_hsv(rgb_img=rgb_img, channel='v')

Value channel image

Screenshot

Source Code: Here