1from __future__
import annotations
3from abc
import ABC, abstractmethod
4from typing
import TYPE_CHECKING
8from ids_peak_common.datatypes.geometry.size
import Size
9from ids_peak_common.datatypes.pixelformat
import PixelFormat
10from ids_peak_common.datatypes.metadata
import Metadata
16 Interface for viewing image pixel data from arbitrary sources, for example a camera buffer.
18 @ingroup ids_peak_common_python_types
25 Returns the image data as a NumPy array.
27 By default, the data is copied. Setting copy=False makes the array share memory with
28 the internal buffer, so any changes to the array will be reflected in the image data.
30 The dimensionality of the returned NumPy array varies according to the pixel format:
31 * Packed formats produce a 1-dimensional array.
32 * Single-channel formats (for example, Mono8) produce a 2-dimensional array with shape (height, width).
33 * Multi-channel formats (for example, RGB8) produce a 3-dimensional array with shape (height, width, num_channels).
35 @param copy: Whether to copy the data. Default is True.
36 @return The image data as a NumPy array.
44 Return a zero-copy memoryview of the image data.
46 The returned memoryview provides direct access to the underlying image data
47 without copying data. Modifying the memoryview will modify the image data itself.
48 Ensure that the image view and its underlying buffer remain valid before
49 accessing or using the memoryview.
58 Returns the pixel format of the image.
67 Returns the image dimensions as a Size object.
76 Returns the width of the image in pixels.
85 Returns the height of the image in pixels.
91 def metadata(self) -> Metadata:
94 Returns the metadata object which can be used to retrieve or set metadata belonging to the image.
Interface for viewing image pixel data from arbitrary sources, for example a camera buffer.
memoryview to_memoryview(self)
Return a zero-copy memoryview of the image data.
PixelFormat pixel_format(self)
Returns the pixel format of the image.
int height(self)
Returns the height of the image in pixels.
Size size(self)
Returns the image dimensions as a Size object.
np.ndarray to_numpy_array(self, bool copy=True)
Returns the image data as a NumPy array.
int width(self)
Returns the width of the image in pixels.