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_image Acquire one image from the camera and return as a PIL image.
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_name The name of the active background selector.
Method background_detector_name.setter Validate and set background_detector_name.
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_jpeg Acquire one image from the camera as a JPEG.
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 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.
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.
Property background_detector The active background detector instance.
Property calibration_required Whether the camera needs calibrating.
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.
Property thing_state Empty metadata dict for subclasses to populate.
Method _add_metadata_to_capture Add the EXIF metadata for a JPEG image.
Method _capture_metadata Return the metadata for a capture, from the thing states, time and known names.
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 _all_background_detectors Undocumented
Class Variable _memory_buffer Undocumented
Instance Variable _background_detector_name Undocumented
Instance Variable _default_background_detector Undocumented
def __enter__(self) -> Self: (source)

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

def __exit__(self, exc_type: type[BaseException], exc_value: BaseException | None, traceback: TracebackType | None): (source)

Release the camera when the Thing context manager is closed.

Before releasing the camera the capture thread is closed.

def __init__(self, thing_server_interface: lt.ThingServerInterface, camera_index: int = 0): (source)

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

Parameters
thing_server_interface:lt.ThingServerInterfaceUndocumented
camera_index:intThe index of the camera to use for the microscope.
@lt.action
def capture_array(self, stream_name: Literal['main', 'lores', 'raw', 'full'] = 'full', wait: float | None = None) -> 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.

def capture_image(self, stream_name: Literal['main', 'lores', 'full'] = 'main', wait: float | None = None) -> Image.Image: (source)

Acquire one image from the camera and return as a PIL image.

This function will produce a JPEG image.

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

Discard frames so that the next frame captured is fresh.

camera_index = (source)

Undocumented

Undocumented

@lt.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