Transpose#

class deeptrack.features.Transpose(axes: Tuple[int, ...] | None = None, **kwargs: Dict[str, Any])#

Bases: Feature

Transpose the input image.

This feature rearranges the axes of an input image according to the specified order. The axes parameter determines the new order of the dimensions.

Parameters#

axesTuple[int, …], optional

A tuple specifying the permutation of the axes. If None, the axes are reversed by default.

**kwargsDict[str, Any]

Additional keyword arguments passed to the parent Feature class.

Example#

>>> import numpy as np
>>> from deeptrack.features import Transpose

Create an input array:

>>> input_image = np.random.rand(2, 3, 4)
>>> print(input_image.shape)
(2, 3, 4)

Apply a Transpose feature:

>>> transpose_feature = Transpose(axes=(1, 2, 0))
>>> output_image = transpose_feature(input_image)
>>> print(output_image.shape)
(3, 4, 2)

Without specifying axes:

>>> transpose_feature = Transpose()
>>> output_image = transpose_feature(input_image)
>>> print(output_image.shape)
(4, 3, 2)

Methods Summary

get(image[, axes])

Transpose the axes of the input image.

Methods Documentation

get(image: ndarray, axes: Tuple[int, ...] | None = None, **kwargs: Dict[str, Any]) ndarray#

Transpose the axes of the input image.

Parameters#

imagenp.ndarray

The input image to process.

axesTuple[int, …], optional

A tuple specifying the permutation of the axes. If None, the axes are reversed by default.

**kwargsAny

Additional keyword arguments (unused here).

Returns#

np.ndarray

The transposed image with rearranged axes.