Skip to content

Camera

Description

Represents a camera tool for the Jubilee machine, based on the Raspberry Pi Camera module. Enables frame capture, video streaming, and well imaging tasks. Extends the base Tool class and inherits all standard tool behaviors (activation check, offset, etc.).

Camera operations require the tool to be active (@requires_active_tool enforced).

Constructor

python
Camera(index: int, name: str)

Initializes a Camera tool.

ParameterTypeDescription
indexintTool number assigned to the camera.
namestrHuman-readable name of the camera.

Key Properties

PropertyTypeDescription
_camera_matrixndarray or NoneLoaded camera intrinsic calibration matrix.
_dist_matrixndarray or NoneLens distortion coefficients.

Important Methods

MethodReturnsDescription
load_coefficients(path)listLoads camera calibration coefficients from YAML.
get_camera_indices()listLists all available camera device indices (for OpenCV capture).
get_frame(resolution=[1200,1200], uvc=False)ndarrayCaptures a single still frame (requires PiCamera).
show_frame(frame, grid=False, save=False, save_path="fig.png")NoneDisplays a frame using matplotlib.
get_show_frame()NoneCaptures and displays a frame.
video_stream(camera_index=0)NoneStarts a live video stream from a selected camera.
image_wells(resolution, uvc, wells)NoneMoves to multiple wells and shows captured images.
get_well_image(resolution, uvc, well)ndarrayMoves to a single well and captures a frame.

Helper Functions

MethodReturnsDescription
_get_xyz(well, location)tupleGets (x,y,z) coordinates from either a Well or direct location.
_get_top_bottom(well)tupleGets the z-heights for the top and bottom of a well.

Usage Flow Example

python
from science_jubilee.tools import Camera
from science_jubilee.machine import Machine

# Connect to machine
m = Machine(address="192.168.1.2")

# Load camera tool
camera = Camera(index=5, name="CameraTool")
m.load_tool(camera)
m.pickup_tool(camera)

# Capture a frame
frame = camera.get_frame()
camera.show_frame(frame)

Important Notes

  • Requires Raspberry Pi Camera support (Linux systems only).
  • Always ensure the Camera tool is active (@requires_active_tool) before attempting any camera operations.
  • By default, lens distortion correction is commented out — call load_coefficients(path) if calibration is desired.
  • Move to safe Z heights (m.safe_z_movement()) before adjusting X/Y for imaging wells.
  • For imaging wells, focus height (z=30) is hard-coded — consider adjusting per system setup.

Pre-release documentation · Internal research use only · Not authorized for redistribution.