class documentation
A class that holds images in memory. The images are by default PIL images.
However subclasses of BaseCamera can use this class to store other object types.
| Method | __init__ |
Create the buffer instance. |
| Method | add |
Add an image to the Memory buffer. |
| Method | clear |
Clear all images from memory. |
| Method | get |
Return the image with the given id. |
| Method | _create |
Create space to add an image. |
| Instance Variable | _latest |
Undocumented |
| Instance Variable | _storage |
Undocumented |
def add_image(self, image:
Any, metadata: dict | None = None, buffer_max: int = 1) -> int:
(source)
¶
Add an image to the Memory buffer.
This will add an image to the memory buffer. By default the buffer will be cleared. To allow saving multiple images the buffer_max must be set every time an image is added.
| Parameters | |
image:Any | The image to add. A PIL image is recommended, but cameras can choose to use other formats |
metadata:dict | None | Optional, a dictionary of the image metadata. |
bufferint | The maximum number of images that should be in the buffer once this images is added. Default is 1. |
| Returns | |
int | The id in the buffer for this image |
def get_image(self, buffer_id:
int | None = None, remove: bool = True) -> tuple[ Any, dict | None]:
(source)
¶
Return the image with the given id.
If no id is given the most recent image is returned. However, the buffer is also cleared, otherwise it would be possible to accidentally retrieve images out of order.
| Parameters | |
bufferint | None | The buffer id of the image to retrieve |
remove:bool | True (default) to remove this image from the buffer, False to leave the image in the buffer. |
| Returns | |
tuple[ | Undocumented |