viam.media.video

Classes

CameraMimeType

The compatible mime-types for cameras and vision services.

ViamImage

A native implementation of an image.

NamedImage

An implementation of ViamImage that contains a name attribute.

Module Contents

class viam.media.video.CameraMimeType[source]

Bases: str

The compatible mime-types for cameras and vision services.

You can use the CameraMimeType.CUSTOM(…) method to use an unlisted mime-type.

VIAM_RGBA: typing_extensions.ClassVar[typing_extensions.Self]
VIAM_RAW_DEPTH: typing_extensions.ClassVar[typing_extensions.Self]
JPEG: typing_extensions.ClassVar[typing_extensions.Self]
PNG: typing_extensions.ClassVar[typing_extensions.Self]
PCD: typing_extensions.ClassVar[typing_extensions.Self]
property name: str
property value: str
classmethod CUSTOM(mime_type: str) typing_extensions.Self[source]

Create a custom mime type.

Parameters:

mime_type (str) – The mimetype as a string

classmethod from_string(value: str) typing_extensions.Self[source]

Return the mimetype from a string.

Parameters:

value (str) – The mimetype as a string

Returns:

The mimetype

Return type:

Self

classmethod from_proto(format: viam.proto.component.camera.Format.ValueType) typing_extensions.Self[source]

Returns the mimetype from a proto enum.

Parameters:

format (Format.ValueType) – The mimetype in a proto enum.

Returns:

The mimetype.

Return type:

Self

property proto: viam.proto.component.camera.Format.ValueType

Returns the mimetype in a proto enum.

Returns:

The mimetype in a proto enum.

Return type:

Format.ValueType

to_proto() viam.proto.component.camera.Format.ValueType[source]

DEPRECATED: Use CameraMimeType.proto

class viam.media.video.ViamImage(data: bytes, mime_type: CameraMimeType)[source]

A native implementation of an image.

Provides the raw data and the mime type.

property data: bytes

The raw bytes of the image

property mime_type: CameraMimeType

The mime type of the image

property width: int | None

The width of the image

property height: int | None

The height of the image

bytes_to_depth_array() List[List[int]][source]

Decode the data of an image that has the custom depth MIME type image/vnd.viam.dep into a standard representation.

Raises:

NotSupportedError – Raised if the image is not of MIME type image/vnd.viam.dep.

Returns:

The standard representation of the image.

Return type:

List[List[int]]

class viam.media.video.NamedImage(name: str, data: bytes, mime_type: CameraMimeType)[source]

Bases: ViamImage

An implementation of ViamImage that contains a name attribute.

name: str

The name of the image