AverageBlur#
- class deeptrack.optical.math.AverageBlur(ksize: int = 3, channel_axis: int | None = -1, **kwargs: Any)#
Bases:
BlurBlur an image by computing simple means over neighbourhoods.
Applies a uniform (mean) filter over spatial dimensions.
If channel_axis is specified, the blur is applied independently per channel. Otherwise, all dimensions (including channels, if present) are treated as spatial, and the filter is applied across them.
Parameters#
- ksize: int
Kernel size for the blur operation.
- channel_axis: int or None
The axis representing the channel dimension. If None, channels are not treated separately and the same blurring is applied across all dimensions.
Methods#
- get(image, ksize, channel_axis, **kwargs) –> np.ndarray | torch.Tensor
Applies the average blurring filter to the input image.
Examples#
>>> import deeptrack as dt
Create an input image.
>>> import numpy as np >>> >>> input_image = np.random.rand(32, 32)
Define an average blur feature.
>>> average_blur = dt.AverageBlur(ksize=3, channel_axis=None) >>> output_image = average_blur(input_image) >>> print(output_image.shape) (32, 32)