colour.characterisation.apply_tps3d#

colour.characterisation.apply_tps3d(RGB: ArrayLike, W: np.ndarray, A: np.ndarray, ctrl: np.ndarray, *, kernel: Literal['Bookstein', 'Polyharmonic 3D'] | str = 'Bookstein', clip: bool = True, chunk_size: int = 250_000) NDArrayFloat[source]#

Apply pre-fitted TPS-3D to an arbitrary RGB array (… , 3).

Parameters:
  • RGB (ArrayLike) – RGB array to warp. Can be (M,3) or (H,W,3) etc.

  • W (np.ndarray) – TPS parameters from tps3d_parameters.

  • A (np.ndarray) – TPS parameters from tps3d_parameters.

  • ctrl (np.ndarray) – TPS parameters from tps3d_parameters.

  • kernel (Literal['Bookstein', 'Polyharmonic 3D'] | str) – Same kernel used during fitting.

  • clip (bool) – Whether to clip to [0, 1].

  • chunk_size (int) – Process pixels in chunks to avoid huge (M,N) temporary arrays for images.

Returns:

Warped RGB array with same shape as input.

Return type:

numpy.ndarray