RGB to LAB

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

plantcv.rgb2gray_lab(rgb_img, channel)

returns split image (l, a, or b channel)

  • Parameters:

    • rgb_img - RGB image data
    • channel - Split 'l' (lightness), 'a' (green-magenta), or 'b' (blue-yellow) 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 LAB, channels are then split. 
# Lightness ('l') channel is output
l_channel = pcv.rgb2gray_lab(rgb_img=rgb_img, channel='l')

Lightness channel image

Screenshot


# Green-Magenta ('a') channel is output
a_channel = pcv.rgb2gray_lab(rgb_img=rgb_img, channel='a')

Green-Magenta channel image

Screenshot


# Blue-Yellow ('b') channel is output
b_channel = pcv.rgb2gray_lab(rgb_img=rgb_img, channel='b')

Blue-Yellow channel image

Screenshot

Source Code: Here