TemplateTrackerWarpAffine¶
- class TemplateTrackerWarpAffine(self)¶
Bases:
TemplateTrackerWarp
This class consider the affine warping model \(M\) with parameters \(p=(a_1, a_2, a_3, a_4, a_5, a_6)\) such as
\[\begin{split}M(p) = \left[ \begin{array}{ccc} a_1 + 1 & a_3 & a_5 \\a_2 & a_4 + 1 & a_6 \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 a model with 6 affine parameters initialized to zero.
Methods
Construct a model with 6 affine parameters initialized to zero.
Compute the derivative matrix of the warping function at point \(X=(u,v)\) according to the model parameters:
Compute inverse of the warping transformation.
Get the parameters of the warping function one level down where image size is divided by two along the lines and the columns.
Get the parameters of the warping function one level up where image size is multiplied by two along the lines and the columns.
- return:
false. Affine model is not compatible with ESM.
Compute the transformation resulting from the composition of two other transformations.
Overloaded function.
Warp a point X1 with the inverse transformation \(M\) .
Inherited Methods
Set the number of parameters of the warping function.
Get the number of parameters of the warping function.
Warp a zone and store the result in a new zone.
Warp a triangle and store the result in a new zone.
Compute the distance between a zone and its associated warped zone.
Operators
__doc__
Construct a model with 6 affine parameters initialized to zero.
__module__
Attributes
__annotations__
- __init__(self)¶
Construct a model with 6 affine parameters initialized to zero.
- dWarp(self, X: visp._visp.core.ColVector, arg1: visp._visp.core.ColVector, arg2: visp._visp.core.ColVector, dM: 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) \]- 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.
- dM: visp._visp.core.Matrix¶
Resulting warping model derivative returned as a 2-by-6 matrix.
- 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.
- getNbParam(self) int ¶
Get the number of parameters of the warping function.
- Returns:
Number of parameters.
- 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¶
6-dim vector that contains the parameters corresponding to the transformation to inverse.
- p_inv: visp._visp.core.ColVector¶
6-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¶
6-dim vector that contains the current parameters of the warping function.
- p_down: visp._visp.core.ColVector¶
6-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¶
6-dim vector that contains the current parameters of the warping function.
- p_up: visp._visp.core.ColVector¶
6-dim vector that contains the resulting parameters one level up.
- 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¶
6-dim vector that contains the parameters corresponding to first transformation.
- p2: visp._visp.core.ColVector¶
6-dim vector that contains the parameters corresponding to second transformation.
- p12: visp._visp.core.ColVector¶
6-dim vector that contains the resulting transformation \(p_{12} = p_1 \circ p_2\) .
- 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.
warpX(self: visp._visp.tt.TemplateTrackerWarpAffine, 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\]- 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
6-dim vector that contains the parameters of the transformation.
warpX(self: visp._visp.tt.TemplateTrackerWarpAffine, 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
6-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.