science_jubilee.tools.Camera
#
Module Contents#
Classes#
A class representation of a Raspberry Pi camera. |
- class science_jubilee.tools.Camera.Camera(index, name)#
Bases:
science_jubilee.tools.Tool.Tool
A class representation of a Raspberry Pi camera.
- Parameters:
Tool (class:Tool) – The base tool class
- load_coefficients(path)#
Loads camera matrix and distortion coefficients.
- Parameters:
path (str) – Path to your camera calibration file
- Returns:
A list containing your camera matrix (index 0) and distortion matrix (index 1)
- Return type:
list
- get_camera_indices()#
Returns valid camera indices for use with OpenCV
- Returns:
A list of valid camera indices
- Return type:
list
- get_frame(resolution=[1200, 1200], uvc=False)#
Take a picture and return the image. Compensates for lens distortion using camera calibration file.
- Parameters:
resolution (list, optional) – Camera resolution, defaults to [1200, 1200]
uvc (bool, optional) – True if the camera is a USB video class (UVC) camera for programmatically setting focus, defaults to False
- Returns:
The captured frame
- Return type:
ndarray
- show_frame(frame, grid=False, save=False, save_path='fig.png')#
Show a captured frame using matplotlib.
- Parameters:
frame (ndarray) – The captured frame to show
grid (bool, optional) – Show grid lines, defaults to False
save (bool, optional) – Save to file, defaults to False
save_path (str, optional) – File path to save image, defaults to “fig.png”
- get_show_frame()#
Get and show a frame.
- video_stream(camera_index=0)#
Start a video stream from the camera.
- Parameters:
camera_index (int, optional) – The camera index, defaults to 0
- image_wells(resolution=[1200, 1200], uvc=False, wells: science_jubilee.labware.Labware.Well = None)#
Move to a number of wells to take and show images.
- Parameters:
resolution (list, optional) – Camera resolution, defaults to [1200, 1200]
uvc (bool, optional) – True if the camera is a USB video class (UVC) camera for programmatically setting focus, defaults to False
wells (
Well
, optional) – A list of wells to image, defaults to None
- get_well_image(resolution=[1200, 1200], uvc=False, well: science_jubilee.labware.Labware.Well = None)#
Move to a single well to take a picture and return the frame.
- Parameters:
resolution (list, optional) – Camera resolution, defaults to [1200, 1200]
uvc (bool, optional) – True if the camera is a USB video class (UVC) camera for programmatically setting focus, defaults to False
well (
Well
, optional) – The well to image, defaults to None
- Returns:
The captured frame
- Return type:
ndarray
- static _get_xyz(well: science_jubilee.labware.Labware.Well = None, location: Tuple[float] = None)#
Get the (x,y,z) position of a well.
- Parameters:
well (
Well
, optional) – The well to fetch position of, defaults to Nonelocation (Tuple[float], optional) – Directly specify an (x,y,z) location, defaults to None
- Raises:
ValueError – Must specify either a well or a location
- Returns:
The well location
- Return type:
Tuple[float, float, float]
- static _get_top_bottom(well: science_jubilee.labware.Labware.Well = None)#
Get the top and bottom heights of a well.
- Parameters:
well (Well, optional) – The well to fetch position of, defaults to None
- Returns:
The z-height of the top and bottom of the well
- Return type:
Tuple[float, float]