TemplateTrackerZNCC

class TemplateTrackerZNCC

Bases: TemplateTracker

Methods

__init__

setGain

Overloaded function.

Inherited Methods

getNbIteration

setLambda

Set the convergence gain used in the estimation scheme.

setp

setPyramidal

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

getdp

setThresholdResidualDifference

Set the threshold used to stop optimization loop.

setUseBrent

By default Brent usage is disabled.

getZoneRef

Return the reference template zone.

getp

setBlur

track

Track the template on image I .

initFromPoints

Initialize the reference template from a vector of points.

setHDes

getNbParam

setIterationMax

Set the maximum number of iteration of the estimation scheme.

display

Overloaded function.

getDiverge

initClick

Select the reference template in image I using mouse click.

getG

setSampling

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

trackRobust

setCostFunctionVerification

setGaussianFilterSize

initFromZone

Initialize the reference template from a vector of points.

setNbIterBrent

resetTracker

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

getRatioPixelIn

setThresholdGradient

getH

Operators

__doc__

__init__

__module__

Attributes

__annotations__

__init__(*args, **kwargs)
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>

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>

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.

getDiverge(self) bool
getG(self) visp._visp.core.ColVector
getH(self) visp._visp.core.Matrix
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.

resetTracker(self) None

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

setBlur(self, b: bool) None
setCostFunctionVerification(self, b: bool) None
setGain(*args, **kwargs)

Overloaded function.

  1. setGain(self: visp._visp.tt.TemplateTrackerZNCC, _gain: float) -> None

  2. setGain(self: visp._visp.tt.TemplateTracker, g: float) -> None

setGaussianFilterSize(self, new_taill: int) None
setHDes(self, tH: visp._visp.core.Matrix) 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

Set the convergence gain used in the estimation scheme.

Parameters:
l: float

Gain. A typical value is 0.001.

setNbIterBrent(self, b: 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.

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