TemplateTrackerWarpSRT

class TemplateTrackerWarpSRT(self)

Bases: TemplateTrackerWarp

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

\[\begin{split}M(p) = \left[ \begin{array}{ccc} s * \cos(\theta) & - s * \sin(\theta) & t_u \\s * \sin(\theta) & s * \cos(\theta) & t_v \end{array} \right] \end{split}\]

with \(s\) the scale, \(\theta\) the rotation, and \(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 4 parameters for scale, rotation and translation initialized to zero.

Methods

__init__

Construct a model with 4 parameters for scale, rotation and translation initialized to zero.

dWarp

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

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. SRT 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 a model with 4 parameters for scale, rotation and translation initialized to zero.

__module__

Attributes

__annotations__

__init__(self)

Construct a model with 4 parameters for scale, rotation and translation initialized to zero.

dWarp(self, X: visp._visp.core.ColVector, arg1: visp._visp.core.ColVector, p: 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.

p: visp._visp.core.ColVector

4-dim vector that contains the parameters of the warping function.

dM: visp._visp.core.Matrix

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

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

p_inv: visp._visp.core.ColVector

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

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

p_down: visp._visp.core.ColVector

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

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

p_up: visp._visp.core.ColVector

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

isESMcompatible(self) bool
Returns:

false. SRT 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

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

p2: visp._visp.core.ColVector

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

p12: visp._visp.core.ColVector

4-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.TemplateTrackerWarpSRT, 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

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

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

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