Analyze Color¶
Extract color data of objects and produce pseudocolored images, can extract data for RGB (Red, Green, Blue), HSV (Hue, Saturation, Value) and LAB (Lightness, Green-Magenta, Blue Yellow) channels.
plantcv.analyze_color(rgb_img, mask, hist_plot_type=None)
returns data analysis images
- Parameters:
- rgb_img - RGB image data
- mask - binary mask of selected contours
- hist_plot_type - None (default), 'all', 'rgb','lab' or 'hsv', this is the data to be printed to an SVG histogram file, however all (every channel) data is still stored to the database.
- Context:
- Used to extract color data from RGB, LAB, and HSV color channels.
- Generates histogram of color channel data. Data automatically gets stored into the Outputs class. Users can look at the data collected at any point during the workflow by using pcv.print_results which prints all stored data to a .json file.
- Example use:
- Output data stored: Summary of Output Observations
Original image
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 = "print"
# Analyze Color
analysis_images = pcv.analyze_color(rgb_img, mask, 'all')
Histograms of (R, G, B), (H, S, V), and (L, A, B) color channels
Pseudocolored value-channel image