from tdw.agent_data.agent_dynamic import AgentDynamic
Abstract base class for agent dynamic data that can change per communicate() call.
-
transformTheTransformof the agent. -
imagesThe images rendered by the agent as dictionary. Key = the name of the pass. Value = the pass as a numpy array. -
projection_matrixThe camera projection matrix of the agent's camera as a numpy array. -
camera_matrixThe camera matrix of the agent's camera as a numpy array. -
got_imagesIf True, we got images from the output data. -
avatar_idThe ID of the avatar.
AgentDynamic(resp, agent_id, frame_count)
| Parameter | Type | Default | Description |
|---|---|---|---|
| resp | List[bytes] | The response from the build. | |
| agent_id | int | The ID of this agent. | |
| frame_count | int | The current frame count. |
self.save_images(output_directory)
Save the ID pass (segmentation colors) and the depth pass to disk.
Images will be named: [frame_number]_[pass_name].[extension]
For example, the depth pass on the first frame will be named: 00000000_depth.png
The img pass is either a .jpg. The id and depth passes are .png files.
| Parameter | Type | Default | Description |
|---|---|---|---|
| output_directory | PATH | The directory that the images will be saved to. |
self.get_pil_image()
self.get_pil_image(pass_mask="img")
Convert raw image data to a PIL image.
Use this function to read and analyze an image in memory.
Do NOT use this function to save image data to disk; save_image is much faster.
| Parameter | Type | Default | Description |
|---|---|---|---|
| pass_mask | str | "img" | The pass mask. Options: "img", "id", "depth". |
Returns: A PIL image.