Analyze NIR Intensity¶
This function calculates the intensity of each pixel associated with the plant and writes the values out to the Outputs class. Can also return/plot/print out a histogram plot of pixel intensity.
plantcv.analyze_nir_intensity(gray_img, mask, bins=256, histplot=False)
returns Histogram image (if histplot is not
True, otherwise returns
- gray_img - 8- or 16-bit grayscale image data
- mask - Binary mask made from selected contours
- bins - Number of class to divide spectrum into (default bins = 256)
- histplot - If True plots histogram of intensity values (default histplot = False)
- Near Infrared pixel frequencies within a masked area of an image.
- Example use:
- Output data stored: Data ('nir_frequencies') automatically gets stored to the
Outputsclass when this function is ran. These data can always get accessed during a workflow (example below). For more detail about data output see Summary of Output Observations
Original grayscale 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" # Caclulates the proportion of pixels that fall into a signal bin and writes the values to a file. Also provides a histogram of this data analysis_image = pcv.analyze_nir_intensity(gray_img, mask, 256, histplot=True) # Access data stored out from analyze_nir_intensity nir_frequencies = pcv.outputs.observations['nir_frequencies']['value']
NIR signal histogram
Note: The grayscale input image and object mask can be used with the pcv.visualize.pseudocolor function which allows the user to pick a colormap for plotting.