machinevisiontoolbox.Image.warp_perspective
- Image.warp_perspective(H, method='linear', inverse=False, tile=False, size=None)
Perspective warp
- Parameters:
H (ndarray(3,3)) – homography
method (str, optional) – interpolation mode: ‘linear’ [default], ‘nearest’
inverse (bool, optional) – use inverse of
H
, defaults to Falsetile (bool, optional) – return minimal enclosing tile, defaults to False
size (array_like(2), optional) – size of output image, defaults to size of input image
- Raises:
TypeError – H must be a 3x3 NumPy array
- Returns:
warped image
- Return type:
Image
Applies a perspective warp to the input image.
\[\begin{split}Y_{u,v} = X_{u^\prime, v^\prime} \mbox{, where } u^\prime=\frac{\tilde{u}}{\tilde{w}}, v^\prime=\frac{\tilde{v}}{\tilde{w}}, \begin{pmatrix} \tilde{u} \\ \tilde{v} \\ \tilde{w} \end{pmatrix} = \mat{H} \begin{pmatrix} u \\ v \\ 1 \end{pmatrix}\end{split}\]The resulting image may be smaller or larger than the input image. If
tile
is True then the output image is the smallest rectangle that contains the warped result, and its position with respect to the origin of the input image, and the coordinates of the four corners of the input image.- References:
Robotics, Vision & Control for Python, Section 14.8, P. Corke, Springer 2023.
- Seealso: