TemplateTrackerWarpHomography

class TemplateTrackerWarpHomography(self)

Bases: TemplateTrackerWarp

This class consider the homography warping model \(M\) with parameters \(p=(h_1, h_2, h_3, h_4, h_5, h_6, h_7, h_8)\) such as

\[\begin{split}M(p) = \left[ \begin{array}{ccc} h_1 + 1 & h_4 & h_7 \\h_2 & h_5 + 1 & h_8 \\h_3 & h_6 & 1 \end{array} \right] \end{split}\]

We recall that u axis is the image horizontal axis, and v axis is the image vertical axis. A point (u,v) with coordinates (0,0) is located in the top left image corner.

Construct an homography model with 8 parameters initialized to zero.

Methods

__init__

Construct an homography model with 8 parameters initialized to zero.

computeDenom

Compute the projection denominator (Z) used in x = X/Z and y = Y/Z.

dWarp

Compute the derivative matrix of the warping function at point \(X=(u,v)\) according to the model parameters:

getHomography

return:

Corresponding homography.

getParam

Overloaded function.

getParamInverse

Compute inverse of the warping transformation.

getParamPyramidDown

Get the parameters of the warping function one level down where image size is divided by two along the lines and the columns.

getParamPyramidUp

Get the parameters of the warping function one level up where image size is multiplied by two along the lines and the columns.

isESMcompatible

return:

false. Homography model is not compatible with ESM.

pRondp

Compute the transformation resulting from the composition of two other transformations.

warpX

Overloaded function.

warpXInv

Warp a point X1 with the inverse transformation \(M\) .

Inherited Methods

warpTriangle

Warp a triangle and store the result in a new zone.

setNbParam

Set the number of parameters of the warping function.

getDistanceBetweenZoneAndWarpedZone

Compute the distance between a zone and its associated warped zone.

getNbParam

Get the number of parameters of the warping function.

warpZone

Warp a zone and store the result in a new zone.

Operators

__doc__

__init__

Construct an homography model with 8 parameters initialized to zero.

__module__

Attributes

__annotations__

__init__(self)

Construct an homography model with 8 parameters initialized to zero.

computeDenom(self, X: visp._visp.core.ColVector, p: visp._visp.core.ColVector) None

Compute the projection denominator (Z) used in x = X/Z and y = Y/Z.

Note

See warpX(const vpColVector &, vpColVector &, const vpColVector &)

Note

See warpX(const int &, const int &, double &, double &, const vpColVector &)

Note

See dWarp() , dWarpCompo()

Parameters:
X: visp._visp.core.ColVector

Point with coordinates (u, v) to consider.

p: visp._visp.core.ColVector

8-dim vector that contains the current parameters of the warping function.

dWarp(self, arg0: visp._visp.core.ColVector, X: visp._visp.core.ColVector, arg2: visp._visp.core.ColVector, dW: visp._visp.core.Matrix) None

Compute the derivative matrix of the warping function at point \(X=(u,v)\) according to the model parameters:

\[\frac{\partial M}{\partial p}(X, p) \]

Note

See computeDenom()

Parameters:
X: visp._visp.core.ColVector

2-dim vector corresponding to the coordinates \((u_1, v_1)\) of the point to consider in the derivative computation.

getDistanceBetweenZoneAndWarpedZone(self, Z: visp._visp.tt.TemplateTrackerZone, p: visp._visp.core.ColVector) float

Compute the distance between a zone and its associated warped zone.

Parameters:
Z: visp._visp.tt.TemplateTrackerZone

Zone to consider.

p: visp._visp.core.ColVector

Parameters of the warping function.

getHomography(self, ParamM: visp._visp.core.ColVector) visp._visp.vision.Homography
Returns:

Corresponding homography.

getNbParam(self) int

Get the number of parameters of the warping function.

Returns:

Number of parameters.

getParam(*args, **kwargs)

Overloaded function.

  1. getParam(self: visp._visp.tt.TemplateTrackerWarpHomography, H: visp._visp.vision.Homography, p: visp._visp.core.ColVector) -> None

Compute the parameters corresponding to an homography.

Parameters:
H

Homography

p

8-dim vector corresponding to the homography.

  1. getParam(self: visp._visp.tt.TemplateTrackerWarpHomography, H: visp._visp.core.Matrix, p: visp._visp.core.ColVector) -> None

Compute the parameters corresponding to an homography as a 3-by-3 matrix.

Parameters:
H

3-by-3 matrix corresponding to an homography

p

8-dim vector corresponding to the homography.

getParamInverse(self, p: visp._visp.core.ColVector, p_inv: visp._visp.core.ColVector) None

Compute inverse of the warping transformation.

Parameters:
p: visp._visp.core.ColVector

8-dim vector that contains the parameters corresponding to the transformation to inverse.

p_inv: visp._visp.core.ColVector

8-dim vector that contains the parameters of the inverse transformation \({M(p)}^{-1}\) .

getParamPyramidDown(self, p: visp._visp.core.ColVector, p_down: visp._visp.core.ColVector) None

Get the parameters of the warping function one level down where image size is divided by two along the lines and the columns.

Parameters:
p: visp._visp.core.ColVector

8-dim vector that contains the current parameters of the warping function.

p_down: visp._visp.core.ColVector

8-dim vector that contains the resulting parameters one level down.

getParamPyramidUp(self, p: visp._visp.core.ColVector, p_up: visp._visp.core.ColVector) None

Get the parameters of the warping function one level up where image size is multiplied by two along the lines and the columns.

Parameters:
p: visp._visp.core.ColVector

8-dim vector that contains the current parameters of the warping function.

p_up: visp._visp.core.ColVector

8-dim vector that contains the resulting parameters one level up.

isESMcompatible(self) bool
Returns:

false. Homography model is not compatible with ESM.

pRondp(self, p1: visp._visp.core.ColVector, p2: visp._visp.core.ColVector, p12: visp._visp.core.ColVector) None

Compute the transformation resulting from the composition of two other transformations.

Parameters:
p1: visp._visp.core.ColVector

8-dim vector that contains the parameters corresponding to first transformation.

p2: visp._visp.core.ColVector

8-dim vector that contains the parameters corresponding to second transformation.

p12: visp._visp.core.ColVector

8-dim vector that contains the resulting transformation \(p_{12} = p_1 \circ p_2\) .

setNbParam(self, nb: int) None

Set the number of parameters of the warping function.

Parameters:
nb: int

New number of parameters.

warpTriangle(self: visp._visp.tt.TemplateTrackerWarp, in: visp._visp.tt.TemplateTrackerTriangle, p: visp._visp.core.ColVector, out: visp._visp.tt.TemplateTrackerTriangle) None

Warp a triangle and store the result in a new zone.

Parameters:
in

Triangle to warp.

p

Parameters of the warping function. These parameters are estimated by the template tracker and returned using vpTemplateTracker::getp() .

out

Resulting triangle.

warpX(*args, **kwargs)

Overloaded function.

  1. warpX(self: visp._visp.tt.TemplateTrackerWarpHomography, X1: visp._visp.core.ColVector, X2: visp._visp.core.ColVector, p: visp._visp.core.ColVector) -> None

Warp point \(X_1=(u_1,v_1)\) using the transformation model.

\[X_2 = {^2}M_1(p) * X_1\]

Note

See computeDenom()

Parameters:
X1

2-dim vector corresponding to the coordinates \((u_1, v_1)\) of the point to warp.

X2

2-dim vector corresponding to the coordinates \((u_2, v_2)\) of the warped point.

p

8-dim vector that contains the parameters of the transformation.

  1. warpX(self: visp._visp.tt.TemplateTrackerWarpHomography, v1: int, u1: int, v2: float, u2: float, p: visp._visp.core.ColVector) -> tuple[float, float]

Warp point \(X_1=(u_1,v_1)\) using the transformation model with parameters \(p\) .

\[X_2 = {^2}M_1(p) * X_1\]
Parameters:
v1

Coordinate (along the image rows axis) of the point \(X_1=(u_1,v_1)\) to warp.

u1

Coordinate (along the image columns axis) of the point \(X_1=(u_1,v_1)\) to warp.

v2

Coordinate of the warped point \(X_2=(u_2,v_2)\) along the image rows axis.

u2

Coordinate of the warped point \(X_2=(u_2,v_2)\) along the image column axis.

p

8-dim vector that contains the parameters of the transformation.

Returns:

A tuple containing:

  • v2: Coordinate of the warped point \(X_2=(u_2,v_2)\) along the image rows axis.

  • u2: Coordinate of the warped point \(X_2=(u_2,v_2)\) along the image column axis.

warpXInv(self, X1: visp._visp.core.ColVector, X2: visp._visp.core.ColVector, p: visp._visp.core.ColVector) None

Warp a point X1 with the inverse transformation \(M\) .

\[X_2 = {\left({^1}M_2\right)}^{-1} \; X_1\]
Parameters:
X1: visp._visp.core.ColVector

2-dim vector corresponding to the coordinates (u,v) of the point to warp.

X2: visp._visp.core.ColVector

2-dim vector corresponding to the coordinates (u,v) of the warped point.

p: visp._visp.core.ColVector

Parameters corresponding to the warping model \({^1}M_2\) .

warpZone(self: visp._visp.tt.TemplateTrackerWarp, in: visp._visp.tt.TemplateTrackerZone, p: visp._visp.core.ColVector, out: visp._visp.tt.TemplateTrackerZone) None

Warp a zone and store the result in a new zone.

Parameters:
in

Zone to warp.

p

Parameters of the warping function. These parameters are estimated by the template tracker and returned using vpTemplateTracker::getp() .

out

Resulting zone.