package documentation

OpenFlexure Microscope Camera.

This module defines the interface for cameras. Any compatible lt.Thing should enable the server to work.

See repository root for licensing information.

Module opencv OpenFlexure Microscope OpenCV Camera.
Module opencv_utils Utilities for managing CV2 cameras.
Module picamera Submodule for interacting with a Raspberry Pi camera using the Picamera2 library.
Module picamera_recalibrate_utils Functions to set up a Raspberry Pi Camera (v2 and HQ) for scientific use.
Module picamera_tuning_file_utils Functions for loading, adjusting, or reading from the Picamera2 tuning file.
Module simulation OpenFlexure Microscope OpenCV Camera.

From __init__.py:

Class BaseCamera The base class for all cameras. All cameras must directly inherit from this class.
Class CameraGalleryDBEngine The database engine to back gallery interactions for the captures.
Class CameraMemoryBuffer A class that holds images in memory. The images are by default PIL images.
Class CaptureGalleryInfo Summary information for the UI about an image.
Class CaptureMode Description of still capture modes for the camera.
Class CaptureParams A class for capturing at least a single image.
Class ImageFormatInfo Basic data for image formats.
Class MJPEGStreamDescriptorWithTimestamp Subclass the Labthings descriptor to return our own class.
Class MJPEGStreamWithTimestamp An MJPEG stream where the frame time can be recorded with the frame.
Class StreamingMode Description of streaming modes for the camera.
Exception CaptureError An error trying to capture from a CameraThing.
Exception NoImageInMemoryError An error called if no image is in memory when accessed.
Function downsample Downsample an image by taking the mean of each nxn region.
Constant BASE_IMAGE_FORMATS Undocumented
Function _file_is_capture Return whether this filename is a capture.
def downsample(factor: int, image: np.ndarray) -> np.ndarray: (source)

Downsample an image by taking the mean of each nxn region.

This should be very efficient:

  • calculate each pixel as the mean of each factor * factor square without
    interpolation.
  • If the image is not an integer multiple of the resampling factor, discard
    the left-over pixels to avoid odd edge effects and keep performance quick.
BASE_IMAGE_FORMATS: dict[str, ImageFormatInfo] = (source)

Undocumented

Value
{'jpeg': ImageFormatInfo(media_type='image/jpeg',
                         extension='.jpeg',
                         supported_extensions=('.jpeg', '.jpg')),
 'png': ImageFormatInfo(media_type='image/png',
                        extension='.png',
                        supported_extensions=('.png'))}
def _file_is_capture(filename: str) -> bool: (source)

Return whether this filename is a capture.