TemplateTrackerWarpTranslation

class TemplateTrackerWarpTranslation(self)

Bases: TemplateTrackerWarp

This class consider the translation warping model \(M\) with parameters \(p=(t_u, t_v)\) such as

\[\begin{split}M(p) = \left[ \begin{array}{c} t_u \\t_v \end{array} \right] \end{split}\]

with \(t_u, t_v\) the translation along u and v axis in the image.

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 2 parameters for translation initialized to zero.

Methods

__init__

Construct a model with 2 parameters for translation initialized to zero.

dWarp

Compute the derivative matrix of the warping 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:

true. This model is 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

setNbParam

Set the number of parameters of the warping function.

getNbParam

Get the number of parameters of the warping function.

warpZone

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

warpTriangle

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

getDistanceBetweenZoneAndWarpedZone

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

Operators

__doc__

__init__

Construct a model with 2 parameters for translation initialized to zero.

__module__

Attributes

__annotations__

__init__(self)

Construct a model with 2 parameters for translation initialized to zero.

dWarp(self, arg0: 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:

\[\frac{\partial M}{\partial p}(p) \]
Parameters:
dM: visp._visp.core.Matrix

Resulting warping model derivative returned as a 2-by-2 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

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

p_inv: visp._visp.core.ColVector

2-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

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

p_down: visp._visp.core.ColVector

2-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

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

p_up: visp._visp.core.ColVector

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

isESMcompatible(self) bool
Returns:

true. This model is 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

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

p2: visp._visp.core.ColVector

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

p12: visp._visp.core.ColVector

2-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.TemplateTrackerWarpTranslation, 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

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

  1. warpX(self: visp._visp.tt.TemplateTrackerWarpTranslation, 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

2-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.