pysdic.Pairing#

The pysdic.Pairing is a link between two views of a pysdic.SDICAnalysis: the view view_index_1 of the frame frame_index_1 and the view view_index_2 of the frame frame_index_2. The gray levels of the material points are compared between the two views with the residual:

\[r(\vec{X}) = [I_2 \circ P_2](\vec{X} + \vec{u}_2(\vec{X})) - [I_1 \circ P_1](\vec{X} + \vec{u}_1(\vec{X}))\]
  • Stereo pairing: two views of the same frame (frame_index_1 == frame_index_2), to compare two cameras at the same instant.

  • Temporal pairing: the same view index at two frames, to follow one camera along the time.

Note

A pairing is a frozen object that does not know the analysis: use pysdic.SDICAnalysis.validate_pairing() to check that its views exist in an analysis. The pairings are given to a pysdic.SDICCorrelationTerm with the unknowns and the integration points (SDICCorrelationTerm(unknowns, integration_points, pairings)); a pairing without unknown (both views fixed) is ignored by the term.

Pairing class#

class Pairing(frame_index_1, view_index_1, frame_index_2, view_index_2)[source]#

Bases: object

A link between two views of a pysdic.SDICAnalysis analysis: the view view_index_1 of the frame frame_index_1 and the view view_index_2 of the frame frame_index_2.

The gray levels of the material points are compared between the two views, with the residual:

\[r(\vec{X}) = [I_2 \circ P_2](\vec{X} + \vec{u}_2(\vec{X})) - [I_1 \circ P_1](\vec{X} + \vec{u}_1(\vec{X}))\]

where \(\vec{u}_1\) and \(\vec{u}_2\) are the displacements of the frames 1 and 2, \(P_1\), \(P_2\) the projections of the cameras and \(I_1\), \(I_2\) the images of the views.

  • Two views of the same frame (frame_index_1 == frame_index_2) give a stereo pairing (see stereo()).

  • The same view index at two frames gives a temporal pairing (see temporal()).

The pairing does not know the analysis: use pysdic.SDICAnalysis.validate_pairing() to check that its views exist.

Parameters:
  • frame_index_1 (Integral) – The index of the frame of the first view (non-negative).

  • view_index_1 (Integral) – The index of the first view in its frame (non-negative).

  • frame_index_2 (Integral) – The index of the frame of the second view (non-negative).

  • view_index_2 (Integral) – The index of the second view in its frame (non-negative).

Raises:
  • TypeError – If an index is not an integer.

  • ValueError – If an index is negative or if the two views are the same.

Examples

Compare the first view of the frame 0 with the first view of the frame 3:

from pysdic import Pairing

pairing = Pairing(0, 0, 3, 0)  # Same as Pairing.temporal(0, 0, 3)
print(pairing)  # Pairing((frame 0, view 0) -> (frame 3, view 0))

Instantiation#

The Pairing class is instantiated with its constructor Pairing(frame_index_1, view_index_1, frame_index_2, view_index_2) or with the following class methods. The indices must be non-negative integers and the two views must be different.

Pairing.stereo(frame_index, view_index_1, ...)

Create a pairing between two views of the same frame.

Pairing.temporal(view_index, frame_index_1, ...)

Create a pairing between the views of same index of two frames.

from pysdic import Pairing

Pairing.stereo(0, 0, 1)    # Pairing((frame 0, view 0) -> (frame 0, view 1))
Pairing.temporal(0, 0, 3)  # Pairing((frame 0, view 0) -> (frame 3, view 0))

Implemented methods and attributes#

The following sections provide an overview of the attributes and methods defined in the pysdic.Pairing class.

Attributes#

Pairing.frame_index_1

Pairing.view_index_1

Pairing.frame_index_2

Pairing.view_index_2

Pairing.view_1

[Get] The first view as a tuple (frame_index_1, view_index_1).

Pairing.view_2

[Get] The second view as a tuple (frame_index_2, view_index_2).

Pairing.is_stereo

[Get] Whether the two views belong to the same frame.

Operations#

Pairing.reversed()

Return the pairing with the two views swapped (opposite residual).