PreviewBuffer

class lib.training.preview_cv.PreviewBuffer

Bases: object

A thread safe class for holding preview images

Attributes Summary

is_updated

True when new images have been loaded into the preview buffer

Methods Summary

add_image(name, image)

Add an image to the preview buffer in a thread safe way

get_images()

Get the latest images from the preview buffer.

Attributes Documentation

is_updated

True when new images have been loaded into the preview buffer

Type:

bool

Methods Documentation

add_image(name: str, image: np.ndarray) None

Add an image to the preview buffer in a thread safe way

Parameters:
  • name (str)

  • image (np.ndarray)

Return type:

None

get_images() Generator[tuple[str, np.ndarray], None, None]

Get the latest images from the preview buffer. When iterator is exhausted clears the updated event.

Yields:
  • name (str) – The name of the image

  • numpy.ndarray – The image in BGR format

Return type:

Generator[tuple[str, np.ndarray], None, None]

add_image(name: str, image: np.ndarray) None

Add an image to the preview buffer in a thread safe way

Parameters:
  • name (str)

  • image (np.ndarray)

Return type:

None

get_images() Generator[tuple[str, np.ndarray], None, None]

Get the latest images from the preview buffer. When iterator is exhausted clears the updated event.

Yields:
  • name (str) – The name of the image

  • numpy.ndarray – The image in BGR format

Return type:

Generator[tuple[str, np.ndarray], None, None]

property is_updated: bool

True when new images have been loaded into the preview buffer

Type:

bool