science_jubilee.tools.WebCamera#
Classes#
A class representation of a Raspberry Pi camera server client. |
Module Contents#
- class science_jubilee.tools.WebCamera.Camera(index, name, ip_address, port, video_endpoint, still_endpoint, image_folder, focus_height, light: bool = False, light_pin: int = None)[source]#
Bases:
science_jubilee.tools.Tool.Tool
A class representation of a Raspberry Pi camera server client.
- classmethod from_config(index, name, config_file: str, path: str = os.path.join(os.path.dirname(__file__), 'configs'))[source]#
Initialize the pipette object from a config file
- Parameters:
index (int) – The tool index of the pipette on the machine
name (str) – The name associated with the tool (e.g. ‘WebCamera’)
config_file (str) – The name of the config file containing the tool parameters
path (str, optional) – The path to the labware configuration .json files for the labware, defaults to the ‘labware_definition/’ in the science_jubilee/labware directory.
- Returns:
the initialized
Camera
object- Return type:
Camera
object
- capture_image(location: science_jubilee.labware.Labware.Well | Tuple, light: bool = False, light_intensity: int = 0, timeout=30)[source]#
Capture an image from the WebCamera at the specified location
- Parameters:
- Returns:
the image as an bstring
- Return type:
- decode_image(image_bin)[source]#
Decode a bstring image into an np.array
- Parameters:
image_bin (bytes) – the image as a bstring
- Returns:
the image as an np.array
- Return type:
np.array
- process_image(image_bin, radius=50)[source]#
Externally callable function to run processing pipeline
- _mask_image(image, radius=50)[source]#
Apply a circular mask to an image
- Parameters:
image (np.array) – the image object
radius (int, optional) – the size (in pixels) of the circular mask, defaults to 50
- Returns:
the masked image
- Return type:
np.array
- _get_rgb_avg(image)[source]#
Extract the average rgb values from an image
- Parameters:
image (np.array) – the image object
- Returns:
the average rgb values in a list [R,G,B]
- Return type: