Pixel scatter plot

This function plots a 2D pixel scatter plot visualization for a dataset of images. The horizontal and vertical coordinates are defined by the intensity of the pixels in the specified channels. The color of each dot is given by the original RGB color of the pixel.

plantcv.visualize.pixel_scatter_plot(paths_to_imgs, x_channel, y_channel)

returns fig, ax

  • Parameters:

    • paths_to_imgs - List of paths to the images.
    • x_channel - Channel to use for the horizontal coordinate of the scatter plot. Options: 'R', 'G', 'B', 'l', 'a', 'b', 'h', 's', 'v', 'gray', and 'index'.
    • y_channel - Channel to use for the vertical coordinate of the scatter plot. Options: 'R', 'G', 'B', 'l', 'a', 'b', 'h', 's', 'v', 'gray', and 'index'.
  • Context:

    • The aim of this visualization is to help selecting the threshold parameters to segment an image or dataset of images. This visualization can show the pixels in several images at once, making the selected value more likely to be valid for the whole dataset.
  • Example use:

    • Below

Dataset images:

Screenshot Screenshot

Screenshot Screenshot


from plantcv import plantcv as pcv

fig1, ax1 = pcv.visualize.pixel_scatter_plot(paths_to_imgs=file_paths, x_channel='index', y_channel='G')

fig2, ax2 = pcv.visualize.pixel_scatter_plot(paths_to_imgs=file_paths, x_channel='index', y_channel='s')

Pixel scatter visualizations:

Screenshot

Screenshot

Dataset images:

Screenshot Screenshot

Screenshot Screenshot


from plantcv import plantcv as pcv

fig1, ax1 = pcv.visualize.pixel_scatter_plot(paths_to_imgs=file_paths, x_channel='b', y_channel='a')

fig2, ax2 = pcv.visualize.pixel_scatter_plot(paths_to_imgs=file_paths, x_channel='G', y_channel='b')

Pixel scatter visualizations:

Screenshot

Screenshot

Source Code: Here