module documentation

OpenFlexure Microscope OpenCV Camera.

This module defines a Thing that is responsible for using the stage and camera together to perform an autofocus routine.

See repository root for licensing information.

Class SimulatedCamera A Thing that simulates a camera for testing.
Function colour_str_to_colour Convert a colour string into RGB colour values.
Function fast_pil_blur Apply Gaussian blur using PIL (faster than scipy).
Constant BG_COLOR Undocumented
Constant COLOUR_LIST_REGEX Undocumented
Constant COLOUR_REGEX Undocumented
Constant DOWNSAMPLE Undocumented
Constant LOGGER Undocumented
Constant RATIO Undocumented
Constant RNG Undocumented
Constant SPRITE_UPSAMPLE Undocumented
Function _downsample_shape Undocumented
Function _frame2bytes Convert frame to bytes.
def colour_str_to_colour(colour_str: str) -> tuple[int, int, int]: (source)

Convert a colour string into RGB colour values.

Parameters
colour_str:strShould be a hex colour such as #33aa33 or a list of hex colours separated by semicolons (with optional spaces).
Returns
tuple[int, int, int]The colour as a tuple of 3 integers from 0 to 255 in value
Raises
ValueErrorIf the hex string is not valid. This should never happen if the user enters a bad colour string as the colour property setter checks the whole string regex.
def fast_pil_blur(array: np.ndarray, sigma: float) -> np.ndarray: (source)

Apply Gaussian blur using PIL (faster than scipy).

BG_COLOR: list[int] = (source)

Undocumented

Value
[220, 215, 217]
COLOUR_LIST_REGEX = (source)

Undocumented

Value
re.compile(r'^\s*(#[0-9a-fA-F]{6})\s*(?:;\s*(#[0-9a-fA-F]{6})\s*)*;?\s*$')
COLOUR_REGEX = (source)

Undocumented

Value
re.compile(r'^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$')
DOWNSAMPLE: int = (source)

Undocumented

Value
2

Undocumented

Value
logging.getLogger(__name__)
RATIO: tuple = (source)

Undocumented

Value
(2, 2, 0.2)

Undocumented

Value
np.random.default_rng()
SPRITE_UPSAMPLE: int = (source)

Undocumented

Value
4
@overload
def _downsample_shape(shape: tuple[int, int]) -> tuple[int, int]:
@overload
def _downsample_shape(shape: tuple[int, int, int]) -> tuple[int, int, int]:
(source)

Undocumented

def _frame2bytes(frame: Image.Image) -> bytes: (source)

Convert frame to bytes.