cutcutcodec.core.analysis.video.complexity.dct¶
Compute a differenciable batched torch spacial dtc complexity.
Functions
|
Compute the spacial dct complexity for the image. |
Details
- cutcutcodec.core.analysis.video.complexity.dct.spacial_dct(img: Tensor, threads: int = 0) Tensor[source]
Compute the spacial dct complexity for the image.
Parameters¶
- imgarraylike
The Y[UV] images, of shape ([*batch], [1], height, width, [channels]). Only the Y component is used. It has to be in range [0, 1]. As there is no padding on the edges, the image must be at least 64x64 pixels.
- threadsint, optional
Defines the number of threads. The value -1 means that the function uses as many calculation threads as there are cores. The default value (0) allows the same behavior as (-1) if the function is called in the main thread, otherwise (1) to avoid nested threads. Any other positive value corresponds to the number of threads used.
Returns¶
- spacial_dctarraylike
The \(C_{sob} \in \mathbb{R}^+\) scalar for each image (of shape batch).
Examples¶
>>> import numpy as np >>> from cutcutcodec.core.analysis.video.complexity import spacial_dct >>> np.random.seed(0) >>> img = np.random.random((720, 1080, 3)) # It could also be a torch array list... >>> spacial_dct(img).round(1) np.float64(1.4) >>>