AFL.automation.vision.RGBCamera#

Classes

Driver(name[, defaults, overrides, ...])

NeutronSampleCell()

Describe the circular optical region of a neutron sample cell.

RGBCamera([overrides])

Driver for capturing RGB images and computing average RGB values.

class AFL.automation.vision.RGBCamera.RGBCamera(overrides=None)[source]#

Driver for capturing RGB images and computing average RGB values.

This driver interfaces with a USB camera to capture images and extract the average RGB values along with image metadata.

defaults = {'background_capture_on_init': True, 'background_threshold': 25, 'camera_index': 0, 'camera_warmup_delay': 0.2, 'hough_radii': 40, 'px_crop': [220, 350], 'py_crop': [120, 250], 'save_path': '/home/afl642/rgb_images/', 'show_background_pipeline': False, 'subtract_background': True}#
__init__(overrides=None)[source]#

Initialize RGBCamera driver.

Parameters:

overrides (dict, optional) – Configuration overrides for PersistentConfig.

open()[source]#

Open the configured OpenCV camera and retain its capture handle.

close()[source]#

Release the OpenCV camera handle so another process can use it.

refresh_background(**kwargs)[source]#

Capture and store a new cropped background reference image.

capture_rgb(name='', plotting=False, subtract_background=False, show_background_pipeline=False, **kwargs)[source]#

Capture an image and compute average RGB values.

Parameters:
  • name (str, optional) – Name/identifier for the measurement.

  • plotting (bool, optional) – If True, save diagnostic plots of the captured image.

  • subtract_background (bool, optional) – If True, use the stored background reference to compute the average RGB.

  • show_background_pipeline (bool, optional) – If True, display the background subtraction diagnostic plot.

  • **kwargs (dict) – Additional arguments passed to image collection.

Returns:

Dataset with average RGB values, image, and metadata.

Return type:

xarray.Dataset