ListOfImages
Represents a list of Image objects. Supports to_list(). Images can have different shapes and formats (e.g. RGBA, BGR). This datatype is used for batch image transport and multi-image outputs within the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
image_list | list[Image] | List of Image objects. Each may have different dimensions and formats. |
Optional
None.
Methods
| Method | Description |
|---|---|
to_list() | Returns a Python list of Image objects. |
Example
From the datatypes examples:
python
import numpy as np
from datatypes import datatypes
from loguru import logger
# ------------------------------------------------
# 1. Create ListOfImages instance
# ------------------------------------------------
image_rgba = np.array([
[[255, 0, 0, 255], [0, 255, 0, 255]],
[[0, 0, 255, 255], [255, 255, 0, 255]],
], dtype=np.uint8)
image_bgr = np.array([
[[255, 0, 0], [0, 255, 0]],
[[0, 0, 255], [255, 255, 0]],
], dtype=np.uint8)
img_1 = datatypes.Image(image=image_rgba)
img_2 = datatypes.Image(image=image_bgr)
list_of_images = datatypes.ListOfImages(image_list=[img_1, img_2])
# ------------------------------------------------
# 2. Access images via to_list
# ------------------------------------------------
images_list = list_of_images.to_list()
logger.info("ListOfImages to_list num_images={}", len(images_list))
logger.info("ListOfImages to_list first shape={}", images_list[0].to_numpy().shape)
logger.info("ListOfImages to_list second shape={}", images_list[1].to_numpy().shape)
