TemplateTrackerMIInverseCompositional

class TemplateTrackerMIInverseCompositional(self)

Bases: TemplateTrackerMI

The algorithm implemented in this class is described in [12] and [31] .

Default constructor.

Methods

__init__

Default constructor.

initTemplateRefBspline

return:

A tuple containing:

setMinimizationMethod

setUseTemplateSelect

Use only the strong gradient pixels to compute the Jabobian.

Inherited Methods

initClick

Select the reference template in image I using mouse click.

setCostFunctionVerification

setHDes

USE_HESSIEN_BEST_COND

HESSIAN_0

BsplineType

Hessian computation.

setGain

BSPLINE_THIRD_ORDER

getRatioPixelIn

setThresholdGradient

setNbIterBrent

setSampling

Set the pixel sampling parameters along the rows and the columns.

setNc

getNbIteration

setHessianComputation

initFromZone

Initialize the reference template from a vector of points.

trackRobust

setCovarianceComputation

BSPLINE_FOURTH_ORDER

setBspline

HessienType

Hessian computation.

getCovarianceMatrix

resetTracker

Reset the tracker by freeing the memory allocated by the template tracker during the initialization.

getNMI

setBlur

USE_HESSIEN_NORMAL

setApprocHessian

HESSIAN_NONSECOND

getZoneRef

Return the reference template zone.

setGaussianFilterSize

getMI

Overloaded function.

HESSIAN_YOUCEF

initFromPoints

Initialize the reference template from a vector of points.

getNbParam

getH

getG

getdp

setUseBrent

By default Brent usage is disabled.

HESSIAN_EXACT

track

Track the template on image I .

HESSIAN_d2I

setPyramidal

Set the number of pyramid levels used in the multi-resolution scheme.

HessienApproximationType

Hessian computation.

setIterationMax

Set the maximum number of iteration of the estimation scheme.

getDiverge

display

Overloaded function.

getp

setLambda

getMI256

HESSIAN_NEW

USE_HESSIEN_DESIRE

setp

setThresholdResidualDifference

Set the threshold used to stop optimization loop.

Operators

__doc__

__init__

Default constructor.

__module__

Attributes

BSPLINE_FOURTH_ORDER

BSPLINE_THIRD_ORDER

HESSIAN_0

HESSIAN_EXACT

HESSIAN_NEW

HESSIAN_NONSECOND

HESSIAN_YOUCEF

HESSIAN_d2I

USE_GRADIENT

USE_HESSIEN_BEST_COND

USE_HESSIEN_DESIRE

USE_HESSIEN_NORMAL

USE_LMA

USE_NEWTON

USE_QUASINEWTON

__annotations__

class BsplineType(self, value: int)

Bases: pybind11_object

Hessian computation.

Values:

  • BSPLINE_THIRD_ORDER

  • BSPLINE_FOURTH_ORDER

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class HessienApproximationType(self, value: int)

Bases: pybind11_object

Hessian computation.

Values:

  • BSPLINE_THIRD_ORDER

  • BSPLINE_FOURTH_ORDER

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class HessienType(self, value: int)

Bases: pybind11_object

Hessian computation.

Values:

  • BSPLINE_THIRD_ORDER

  • BSPLINE_FOURTH_ORDER

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class MinimizationTypeMIInverseCompositional(self, value: int)

Bases: pybind11_object

Minimization method.

Values:

  • USE_NEWTON

  • USE_LMA

  • USE_GRADIENT

  • USE_QUASINEWTON

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
__init__(self)

Default constructor.

display(*args, **kwargs)

Overloaded function.

  1. display(self: visp._visp.tt.TemplateTracker, I: visp._visp.core.ImageGray, col: visp._visp.core.Color = vpColor::green, thickness: int = 3) -> None

Display the warped reference template in an image.

The following code shows how to use display capabilities:

#include <visp3/tt/vpTemplateTrackerSSDInverseCompositional.h>
#include <visp3/tt/vpTemplateTrackerWarpHomography.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpImage<unsigned char> I;
  vpTemplateTrackerWarpHomography warp;
  vpTemplateTrackerSSDInverseCompositional tracker(&warp);
  vpTemplateTrackerZone zoneRef, zoneWarped;

  // Display the warped zone
  tracker.display(I, vpColor::red);

  // Display the reference zone
  zoneRef = tracker.getZoneRef();
  zoneRef.display(I, vpColor::green);

  // Display the warped zone
  vpColVector p = tracker.getp();
  warp.warpZone(zoneRef, p, zoneWarped);
  zoneWarped.display(I, vpColor::blue);
}
Parameters:
I

Image in which the warped zone has to be displayed.

col

Color used to draw the triangle edges.

thickness

Thickness of the lines.

  1. display(self: visp._visp.tt.TemplateTracker, I: visp._visp.core.ImageRGBa, col: visp._visp.core.Color = vpColor::green, thickness: int = 3) -> None

Display the warped reference template in an image.

The following code shows how to use display capabilities:

#include <visp3/tt/vpTemplateTrackerSSDInverseCompositional.h>
#include <visp3/tt/vpTemplateTrackerWarpHomography.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpImage<vpRGBa> I;
  vpTemplateTrackerWarpHomography warp;
  vpTemplateTrackerSSDInverseCompositional tracker(&warp);
  vpTemplateTrackerZone zoneRef, zoneWarped;

  // Display the warped zone
  tracker.display(I, vpColor::red);

  // Display the reference zone
  zoneRef = tracker.getZoneRef();
  zoneRef.display(I, vpColor::green);

  // Display the warped zone
  vpColVector p = tracker.getp();
  warp.warpZone(zoneRef, p, zoneWarped);
  zoneWarped.display(I, vpColor::blue);
}
Parameters:
I

Image in which the warped zone has to be displayed.

col

Color used to draw the triangle edges.

thickness

Thickness of the lines.

getCovarianceMatrix(self) visp._visp.core.Matrix
getDiverge(self) bool
getG(self) visp._visp.core.ColVector
getH(self) visp._visp.core.Matrix
getMI(*args, **kwargs)

Overloaded function.

  1. getMI(self: visp._visp.tt_mi.TemplateTrackerMI) -> float

  2. getMI(self: visp._visp.tt_mi.TemplateTrackerMI, I: visp._visp.core.ImageGray, nc: int, bspline: int, tp: visp._visp.core.ColVector) -> tuple[float, int]

Returns:

A tuple containing:

  • nc

getMI256(self, I: visp._visp.core.ImageGray, tp: visp._visp.core.ColVector) float
getNMI(self) float
getNbIteration(self) int
getNbParam(self) int
getRatioPixelIn(self) float
getZoneRef(self) visp._visp.tt.TemplateTrackerZone

Return the reference template zone.

getdp(self) visp._visp.core.ColVector
getp(self) visp._visp.core.ColVector
initClick(self, I: visp._visp.core.ImageGray, delaunay: bool = false) None

Select the reference template in image I using mouse click.

Parameters:
I: visp._visp.core.ImageGray

Image containing the reference template.

delaunay: bool = false

Flag used to enable Delaunay triangulation.

  • If true, from the image points selected by the user, a Delaunay triangulation is performed to initialize the reference template.

    • A left click select a image point;

    • A right click select the last image point and ends the initialisation stage.

  • If false, the user select directly points as successive triangle corners. The size of v_ip vector should be a multiple of 3. It is not mandatory that triangles have one edge in common; they can define a discontinued area.

    • A left click select a triangle corner;

    • A right click select the last triangle corner and ends the initialisation stage. For example, to select the reference template as two triangles, the user has to left click five times and finish the selection on the sixth corner with a right click.

initFromPoints(self, I: visp._visp.core.ImageGray, v_ip: list[visp._visp.core.ImagePoint], delaunay: bool = false) None

Initialize the reference template from a vector of points.

Parameters:
I: visp._visp.core.ImageGray

Image containing the reference template.

v_ip: list[visp._visp.core.ImagePoint]

Vector of image points defining the reference template.

delaunay: bool = false

  • If true, from the image points defining the reference template enable Delaunay triangulation.

  • If false, the vector of image points define the reference template as a list of triangles. The size of v_ip vector should be a multiple of 3.

initFromZone(self, I: visp._visp.core.ImageGray, zone: visp._visp.tt.TemplateTrackerZone) None

Initialize the reference template from a vector of points.

Parameters:
I: visp._visp.core.ImageGray

Image containing the reference template.

zone: visp._visp.tt.TemplateTrackerZone

The zone that describes the reference template.

initTemplateRefBspline(self, ptIndex: int, et: float) float
Returns:

A tuple containing:

  • et

resetTracker(self) None

Reset the tracker by freeing the memory allocated by the template tracker during the initialization.

setApprocHessian(self, approx: visp._visp.tt_mi.TemplateTrackerMI.HessienApproximationType) None
setBlur(self, b: bool) None
setBspline(self, newbs: visp._visp.tt_mi.TemplateTrackerMI.BsplineType) None
setCostFunctionVerification(self, b: bool) None
setCovarianceComputation(self, flag: bool) None
setGain(self, g: float) None
setGaussianFilterSize(self, new_taill: int) None
setHDes(self, tH: visp._visp.core.Matrix) None
setHessianComputation(self, type: visp._visp.tt_mi.TemplateTrackerMI.HessienType) None
setIterationMax(self, n: int) None

Set the maximum number of iteration of the estimation scheme.

Parameters:
n: int

Maximum number of iterations to stop the estimation scheme. A typical value is around 100.

setLambda(self, _l: float) None
setMinimizationMethod(self, method: visp._visp.tt_mi.TemplateTrackerMIInverseCompositional.MinimizationTypeMIInverseCompositional) None
setNbIterBrent(self, b: int) None
setNc(self, newNc: int) None
setPyramidal(self, nlevels: int = 2, level_to_stop: int = 1) None

Set the number of pyramid levels used in the multi-resolution scheme. If nlevels > 1, the tracker uses a pyramidal approach.

Parameters:
nlevels: int = 2

Number of pyramid levels. Algorithm starts at level nlevels-1.

level_to_stop: int = 1

Last level of the pyramid that will be considered. Lowest level is zero.

setSampling(self, sample_i: int, sample_j: int) None

Set the pixel sampling parameters along the rows and the columns.

Parameters:
sample_i: int

Sampling factor along the rows. If 1 all the lines are considered. If 2, consider one line over two.

sample_j: int

Sampling factor along the columns. If 1 all the columns are considered. If 2, consider one column over two.

setThresholdGradient(self, threshold: float) None
setThresholdResidualDifference(self, threshold: float) None

Set the threshold used to stop optimization loop. When the residual difference between two successive iterations becomes lower than the threshold we stop optimization loop.

Note

Increasing the default value allows to speed up the tracking.

Parameters:
threshold: float

Threshold used to stop optimization. Default value is set to 1e-4.

setUseBrent(self, b: bool) None

By default Brent usage is disabled.

setUseTemplateSelect(self, b: bool) None

Use only the strong gradient pixels to compute the Jabobian. By default this feature is disabled.

setp(self, tp: visp._visp.core.ColVector) None
track(self, I: visp._visp.core.ImageGray) None

Track the template on image I .

Parameters:
I: visp._visp.core.ImageGray

Image to process.

trackRobust(self, I: visp._visp.core.ImageGray) None