- pysteps.motion.vet.morph(image, displacement, gradient=False)#
Morph image by applying a displacement field (Warping).
The new image is created by selecting for each position the values of the input image at the positions given by the x and y displacements. The routine works in a backward sense. The displacement vectors have to refer to their destination.
For more information in Morphing functions see Section 3 in Beezley and Mandel (2008).
Beezley, J. D., & Mandel, J. (2008). Morphing ensemble Kalman filters. Tellus A, 60(1), 131-140.
The displacement field in x and y directions and the image must have the same dimensions.
The morphing is executed in parallel over x axis.
The value of displaced pixels that fall outside the limits takes the value of the nearest edge. Those pixels are indicated by values greater than 1 in the output mask.
image (ndarray (ndim = 2)) – Image to morph
displacement (ndarray (ndim = 3)) –
Displacement field to be applied (Warping). The first dimension corresponds to the coordinate to displace.
The dimensions are: displacement [ i/x (0) or j/y (1) , i index of pixel, j index of pixel ]
gradient (bool, optional) – If True, the gradient of the morphing function is returned.
image (ndarray (float64 ,ndim = 2)) – Morphed image.
mask (ndarray (int8 ,ndim = 2)) – Invalid values mask. Points outside the boundaries are masked. Values greater than 1, indicate masked values.
gradient_values (ndarray (float64 ,ndim = 3), optional) – If gradient keyword is True, the gradient of the function is also returned.