Transpose#
- class deeptrack.features.Transpose(axes: tuple[int, ...] | None = None, **kwargs: dict[str, Any])#
Bases:
FeatureTranspose 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#
- axes: tuple[int, …], optional
A tuple specifying the permutation of the axes. If None, the axes are reversed by default.
- **kwargs:: dict of str to Any
Additional keyword arguments passed to the parent Feature class.
Methods#
- get(image: np.ndarray, axes: tuple[int, …] | None, **kwargs: dict[str, Any]) -> np.ndarray
Transpose the axes of the input image
Examples#
>>> import deeptrack as dt >>> import numpy as np
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 = dt.Transpose(axes=(1, 2, 0)) >>> output_image = transpose_feature(input_image) >>> print(output_image.shape) (3, 4, 2)
Without specifying axes: >>> transpose_feature = dt.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: np.ndarray, axes: tuple[int, ...] | None = None, **kwargs: dict[str, Any]) np.ndarray#
Transpose the axes of the input image.
Parameters#
- image: np.ndarray
The input image to process.
- axes: tuple[int, …], optional
A tuple specifying the permutation of the axes. If None, the axes are reversed by default.
- **kwargs: Any
Additional keyword arguments (unused here).
Returns#
- np.ndarray
The transposed image with rearranged axes.