class documentation

A Thing that provides and interface to an OpenCV Camera.

Method __enter__ Start the capture thread when the Thing context manager is opened.
Method __exit__ Release the camera when the Thing context manager is closed.
Method __init__ Iniatilise the thing storing the index of the camera to use.
Method capture_array Acquire one image from the camera and return as an array.
Method capture_jpeg Acquire one image from the camera and return as a JPEG blob.
Method discard_frames Discard frames so that the next frame captured is fresh.
Instance Variable camera_index Undocumented
Instance Variable cap Undocumented
Property stream_active Whether the MJPEG stream is active.
Method _capture_frames Undocumented
Instance Variable _capture_enabled Undocumented
Instance Variable _capture_thread Undocumented

Inherited from BaseCamera:

Method background_detector_data The data for each background detector, used to save to disk.
Method background_detector_data.setter Set the data for each detector. Only to be used as settings are loaded from disk.
Method capture_and_save Capture an image and save it to disk.
Method capture_downsampled_array Acquire one image from the camera, downsample, and return as an array.
Method capture_image Capture a PIL image from stream stream_name with timeout wait.
Method capture_to_memory Capture an image to memory. This can be saved later with save_from_memory.
Method clear_buffers Clear all images in memory.
Method detector_name The name of the active background selector.
Method detector_name.setter Validate and set detector_name.
Method grab_as_array Acquire one image from the preview stream and return as an array.
Method grab_jpeg Acquire one image from the preview stream and return as blob of JPEG data.
Method grab_jpeg_size Acquire one image from the preview stream and return its size.
Method image_is_sample Label the current image as either background or sample.
Method kill_mjpeg_streams Kill the streams now as the server is shutting down.
Method save_from_memory Save an image that has been captured to memory.
Method set_background Grab an image, and use its statistics to set the background.
Method settle Sleep for the settling time, ready to provide a fresh frame.
Method start_streaming Start (or stop and restart) the camera.
Method update_detector_settings Update the settings of the current detector.
Class Variable downsampled_array_factor The downsampling factor when calling capture_downsampled_array.
Class Variable lores_mjpeg_stream Undocumented
Class Variable mjpeg_stream Undocumented
Class Variable settling_time The settling time when calling the settle() method.
Instance Variable background_detectors Undocumented
Property active_detector The active background detector instance.
Property background_detector_status The status of the active detector for the UI.
Property manual_camera_settings The camera settings to expose as property controls in the settings panel.
Property primary_calibration_actions The calibration actions for both calibration wizard and settings panel.
Property secondary_calibration_actions The calibration actions that appear only in settings panel.
Method _robust_image_capture Capture an image in memory and return it with metadata.
Method _save_capture Save the captured image and metadata to disk.
Class Variable _memory_buffer Undocumented
Instance Variable _detector_name Undocumented
def __enter__(self): (source)

Start the capture thread when the Thing context manager is opened.

def __exit__(self, _exc_type, _exc_value, _traceback): (source)

Release the camera when the Thing context manager is closed.

Before releasing the camera the capture thread is closed.

def __init__(self, camera_index: int = 0): (source)

Iniatilise the thing storing the index of the camera to use.

Parameters
camera_index:intThe index of the camera to use for the microscope.
@lt.thing_action
def capture_array(self, resolution: Literal['main', 'full'] = 'full') -> NDArray: (source)

Acquire one image from the camera and return as an array.

This function will produce a nested list containing an uncompressed RGB image. It's likely to be highly inefficient - raw and/or uncompressed captures using binary image formats will be added in due course.

@lt.thing_action
def capture_jpeg(self, metadata_getter: lt.deps.GetThingStates, resolution: Literal['main', 'full'] = 'main') -> JPEGBlob: (source)

Acquire one image from the camera and return as a JPEG blob.

This function will produce a JPEG image.

@lt.thing_action
def discard_frames(self): (source)

Discard frames so that the next frame captured is fresh.

camera_index = (source)

Undocumented

Undocumented

@lt.thing_property
stream_active: bool = (source)

Whether the MJPEG stream is active.

def _capture_frames(self): (source)

Undocumented

_capture_enabled: bool = (source)

Undocumented

_capture_thread: Thread | None = (source)

Undocumented