TriTensor Class Reference

#include <TriTensor.h>

List of all members.


Detailed Description

Definition at line 50 of file TriTensor.h.


Public Member Functions

 TriTensor ()
 Default constructor.
 TriTensor (const TriTensor &)
 Copy constructor.
 TriTensor (const double *tritensor_array)
 Construct a TriTensor from a linear array of doubles.
 TriTensor (const PMatrix &P1, const PMatrix &P2, const PMatrix &P3)
 Construct from 3 projection matrices.
 TriTensor (const PMatrix &P2, const PMatrix &P3)
 Construct from 2 projection matrices, as described in set.
 TriTensor (const vnl_matrix< double > &T1, const vnl_matrix< double > &P2, const vnl_matrix< double > &P3)
 Construct from 3 matrices.
 ~TriTensor ()
 Destructor.
TriTensoroperator= (const TriTensor &)
 Assignment.
bool operator== (TriTensor const &p) const
double & operator() (unsigned int i1, unsigned int i2, unsigned int i3)
double operator() (unsigned int i1, unsigned int i2, unsigned int i3) const
void set (unsigned int i1, unsigned int i2, unsigned int i3, double value)
void set (const double *vec)
void set (const vnl_matrix< double > &tvector)
 Convert from 27x1 matrix.
void convert_to_vector (vnl_matrix< double > *tvector) const
 Convert T to 27x1 matrix. Out is assumed to have been appropriately resized.
void set (const PMatrix &P1, const PMatrix &P2, const PMatrix &P3)
 Construct from 3 projection matrices.
void set (const PMatrix &P2, const PMatrix &P3)
 Construct from 2 projection matrices, P2 and P3.
void set (const vnl_matrix< double > &T1, const vnl_matrix< double > &T2, const vnl_matrix< double > &T3)
 Construct from 3 T matrices.
vgl_homg_point_2d< double > image1_transfer (vgl_homg_point_2d< double > const &point2, vgl_homg_point_2d< double > const &point3, vgl_homg_point_2d< double > corrected[]=0) const
 For the specified points in image 2/3, return the transferred point in image 1.
vgl_homg_point_2d< double > image2_transfer (vgl_homg_point_2d< double > const &point1, vgl_homg_point_2d< double > const &point3, vgl_homg_point_2d< double > corrected[]=0) const
vgl_homg_point_2d< double > image3_transfer (vgl_homg_point_2d< double > const &point1, vgl_homg_point_2d< double > const &point2, vgl_homg_point_2d< double > corrected[]=0) const
HomgPoint2D image1_transfer (HomgPoint2D const &point2, HomgPoint2D const &point3, HomgPoint2D corrected[]=0) const
HomgPoint2D image2_transfer (HomgPoint2D const &point1, HomgPoint2D const &point3, HomgPoint2D corrected[]=0) const
 For the specified points in image 1/3, return the transferred point in image 2.
HomgPoint2D image3_transfer (HomgPoint2D const &point1, HomgPoint2D const &point2, HomgPoint2D corrected[]=0) const
 For the specified points in image 1/2, return the transferred point in image 3.
vgl_homg_point_2d< double > image1_transfer_qd (vgl_homg_point_2d< double > const &point2, vgl_homg_point_2d< double > const &point3) const
 For the specified points in image 2/3, return the transferred point in image 1.
vgl_homg_point_2d< double > image2_transfer_qd (vgl_homg_point_2d< double > const &point1, vgl_homg_point_2d< double > const &point3) const
 For the specified points in image 1/3, return the transferred point in image 2.
vgl_homg_point_2d< double > image3_transfer_qd (vgl_homg_point_2d< double > const &point1, vgl_homg_point_2d< double > const &point2) const
 For the specified points in image 1/2, return the transferred point in image 3.
HomgPoint2D image1_transfer_qd (const HomgPoint2D &point2, const HomgPoint2D &point3) const
HomgPoint2D image2_transfer_qd (const HomgPoint2D &point1, const HomgPoint2D &point3) const
HomgPoint2D image3_transfer_qd (const HomgPoint2D &point1, const HomgPoint2D &point2) const
vgl_homg_point_2d< double > image1_transfer (vgl_homg_point_2d< double > const &point1, vgl_homg_line_2d< double > const &line2) const
vgl_homg_point_2d< double > image2_transfer (vgl_homg_point_2d< double > const &point1, vgl_homg_line_2d< double > const &line3) const
vgl_homg_point_2d< double > image3_transfer (vgl_homg_point_2d< double > const &point2, vgl_homg_line_2d< double > const &line3) const
HomgPoint2D image1_transfer (HomgPoint2D const &point1, HomgLine2D const &line2) const
HomgPoint2D image2_transfer (HomgPoint2D const &point1, HomgLine2D const &line3) const
HomgPoint2D image3_transfer (HomgPoint2D const &point2, HomgLine2D const &line3) const
vgl_homg_line_2d< double > image1_transfer (vgl_homg_line_2d< double > const &line2, vgl_homg_line_2d< double > const &line3) const
 For the specified lines in image 2/3, return the transferred line in image 1.
vgl_homg_line_2d< double > image2_transfer (vgl_homg_line_2d< double > const &line2, vgl_homg_line_2d< double > const &line3) const
 For the specified lines in image 2/3, return the transferred line in image 1.
vgl_homg_line_2d< double > image3_transfer (vgl_homg_line_2d< double > const &line2, vgl_homg_line_2d< double > const &line3) const
 For the specified lines in image 1/2, return the transferred line in image 3.
HomgLine2D image1_transfer (const HomgLine2D &line2, const HomgLine2D &line3) const
HomgLine2D image2_transfer (const HomgLine2D &line2, const HomgLine2D &line3) const
HomgLine2D image3_transfer (const HomgLine2D &line2, const HomgLine2D &line3) const
vgl_h_matrix_2d< double > get_hmatrix_31 (vgl_homg_line_2d< double > const &line2) const
 Return the planar homography between views 3 and 1 induced by line 2.
vgl_h_matrix_2d< double > get_hmatrix_21 (vgl_homg_line_2d< double > const &line3) const
 Return the planar homography between views 2 and 1 induced by line 3.
HMatrix2D get_hmatrix_31 (const HomgLine2D &line2) const
HMatrix2D get_hmatrix_21 (const HomgLine2D &line3) const
bool get_epipoles (vgl_homg_point_2d< double > &e2, vgl_homg_point_2d< double > &e3) const
 Return epipoles e2 and e3, from image 1 into images 2 and 3 respectively.
bool get_epipoles (HomgPoint2D *e2, HomgPoint2D *e3) const
bool compute_epipoles () const
 Compute and cache the two epipoles from image 1.
HomgPoint2D get_epipole_12 () const
 Return epipole12.
HomgPoint2D get_epipole_13 () const
 Return epipole13.
FMatrix get_fmatrix_13 () const
 Return F13, the fundamental matrix between images 1 and 3.
FMatrix get_fmatrix_12 () const
 Return F12, the fundamental matrix between images 1 and 2.
FMatrix compute_fmatrix_23 () const
const FManifoldProjectget_fmp12 () const
 Return a manifold-projector for the Fundamental matrix between 1 and 2.
const FManifoldProjectget_fmp23 () const
 Return a manifold-projector as above, between 2 and 3.
const FManifoldProjectget_fmp13 () const
 Return a manifold-projector as above, between 1 and 3.
void compute_P_matrices (const vnl_vector< double > &x, double alpha, double beta, PMatrix *P2, PMatrix *P3) const
 Compute one of the family of P matrix triplets consistent with this T.
void compute_P_matrices (const vnl_vector< double > &x, double alpha, PMatrix *P2, PMatrix *P3) const
void compute_P_matrices (const vnl_vector< double > &x, PMatrix *P2, PMatrix *P3) const
void compute_P_matrices (PMatrix *P2, PMatrix *P3) const
void compute_P_matrices (vgl_p_matrix< double > &P2, vgl_p_matrix< double > &P3) const
void compute_caches ()
void clear_caches ()
void get_constraint_lines_image3 (vgl_homg_point_2d< double > const &p1, vgl_homg_point_2d< double > const &p2, vcl_vector< vgl_homg_line_2d< double > > &lines) const
void get_constraint_lines_image2 (vgl_homg_point_2d< double > const &p1, vgl_homg_point_2d< double > const &p3, vcl_vector< vgl_homg_line_2d< double > > &lines) const
void get_constraint_lines_image1 (vgl_homg_point_2d< double > const &p2, vgl_homg_point_2d< double > const &p3, vcl_vector< vgl_homg_line_2d< double > > &lines) const
void get_constraint_lines_image3 (HomgPoint2D const &p1, HomgPoint2D const &p2, vcl_vector< HomgLine2D > *lines) const
void get_constraint_lines_image2 (HomgPoint2D const &p1, HomgPoint2D const &p3, vcl_vector< HomgLine2D > *lines) const
void get_constraint_lines_image1 (HomgPoint2D const &p2, HomgPoint2D const &p3, vcl_vector< HomgLine2D > *lines) const
TriTensor postmultiply (unsigned tensor_axis, const vnl_matrix< double > &M) const
 Contract Tensor axis tensor_axis with first component of Matrix M.
TriTensor premultiply (unsigned tensor_axis, const vnl_matrix< double > &M) const
 Contract Tensor axis tensor_axis with second component of Matrix M.
TriTensor postmultiply1 (const vnl_matrix< double > &M) const
 Compute $ S_{ijk} = T_{pjk} M_{pi} $.
TriTensor postmultiply2 (const vnl_matrix< double > &M) const
 Compute $ S_{ijk} = T_{ipk} M_{pj} $.
TriTensor postmultiply3 (const vnl_matrix< double > &M) const
 Compute $ S_{ijk} = T_{ijp} M_{pk} $.
TriTensor premultiply1 (const vnl_matrix< double > &M) const
 Compute $ S_{ijk} = M_{ip} T_{pjk} $.
TriTensor premultiply2 (const vnl_matrix< double > &M) const
 Compute $ S_{ijk} = M_{jp} T_{ipk} $.
TriTensor premultiply3 (const vnl_matrix< double > &M) const
 Compute $ S_{ijk} = M_{kp} T_{ijp} $.
vnl_double_3x3 dot1 (const vnl_double_3 &v) const
 Compute ${ M}_{jk} = T_{ijk} v_i$.
vnl_double_3x3 dot2 (const vnl_double_3 &v) const
 Compute ${ M}_{ik} = T_{ijk} v_j$.
vnl_double_3x3 dot3 (const vnl_double_3 &v) const
 Compute ${ M}_{ij} = T_{ijk} v_k$.
vnl_double_3x3 dot1t (const vnl_double_3 &v) const
 Compute ${ M}_{kj} = T_{ijk} v_i$. (The transpose of dot1).
vnl_double_3x3 dot2t (const vnl_double_3 &v) const
 Compute ${ M}_{ki} = T_{ijk} v_j$.
vnl_double_3x3 dot3t (const vnl_double_3 &v) const
 Compute ${ M}_{ji} = T_{ijk} v_k$.
bool check_equal_up_to_scale (const TriTensor &that) const
 Check that another trifocal tensor is equal to this one up to scale.
TriTensor condition (const vnl_matrix< double > &line_1_denorm, const vnl_matrix< double > &line_2_norm, const vnl_matrix< double > &line_3_norm) const
 C123 are line conditioning matrices.
TriTensor decondition (const vnl_matrix< double > &line_1_norm, const vnl_matrix< double > &line_2_denorm, const vnl_matrix< double > &line_3_denorm) const

Private Member Functions

void delete_caches () const

Private Attributes

vbl_array_3d< double > T
const HomgPoint2De12_
const HomgPoint2De13_
const FManifoldProjectfmp12_
const FManifoldProjectfmp13_
const FManifoldProjectfmp23_

Constructor & Destructor Documentation

TriTensor::TriTensor (  ) 

Default constructor.

Definition at line 60 of file TriTensor.cxx.

TriTensor::TriTensor ( const TriTensor  ) 

Copy constructor.

Definition at line 75 of file TriTensor.cxx.

TriTensor::TriTensor ( const double *  tritensor_array  ) 

Construct a TriTensor from a linear array of doubles.

The doubles are stored in ``matrix'' order, with the last index increasing fastest.

Definition at line 69 of file TriTensor.cxx.

TriTensor::TriTensor ( const PMatrix P1,
const PMatrix P2,
const PMatrix P3 
)

Construct from 3 projection matrices.

Definition at line 81 of file TriTensor.cxx.

TriTensor::TriTensor ( const PMatrix P2,
const PMatrix P3 
)

Construct from 2 projection matrices, as described in set.

Definition at line 90 of file TriTensor.cxx.

TriTensor::TriTensor ( const vnl_matrix< double > &  T1,
const vnl_matrix< double > &  P2,
const vnl_matrix< double > &  P3 
)

Construct from 3 matrices.

Definition at line 98 of file TriTensor.cxx.

TriTensor::~TriTensor (  ) 

Destructor.

Definition at line 116 of file TriTensor.cxx.


Member Function Documentation

TriTensor & TriTensor::operator= ( const TriTensor  ) 

Assignment.

Definition at line 107 of file TriTensor.cxx.

bool TriTensor::operator== ( TriTensor const &  p  )  const [inline]

Definition at line 80 of file TriTensor.h.

double& TriTensor::operator() ( unsigned int  i1,
unsigned int  i2,
unsigned int  i3 
) [inline]

Definition at line 83 of file TriTensor.h.

double TriTensor::operator() ( unsigned int  i1,
unsigned int  i2,
unsigned int  i3 
) const [inline]

Definition at line 84 of file TriTensor.h.

void TriTensor::set ( unsigned int  i1,
unsigned int  i2,
unsigned int  i3,
double  value 
)

void TriTensor::set ( const double *  vec  ) 

void TriTensor::set ( const vnl_matrix< double > &  tvector  ) 

Convert from 27x1 matrix.

Definition at line 140 of file TriTensor.cxx.

void TriTensor::convert_to_vector ( vnl_matrix< double > *  tvector  )  const

Convert T to 27x1 matrix. Out is assumed to have been appropriately resized.

Definition at line 132 of file TriTensor.cxx.

void TriTensor::set ( const PMatrix P1,
const PMatrix P2,
const PMatrix P3 
)

Construct from 3 projection matrices.

Definition at line 151 of file TriTensor.cxx.

void TriTensor::set ( const PMatrix P2,
const PMatrix P3 
)

Construct from 2 projection matrices, P2 and P3.

The first is assumed to be the canonical [I | 0].

Definition at line 176 of file TriTensor.cxx.

void TriTensor::set ( const vnl_matrix< double > &  T1,
const vnl_matrix< double > &  T2,
const vnl_matrix< double > &  T3 
)

Construct from 3 T matrices.

Definition at line 194 of file TriTensor.cxx.

vgl_homg_point_2d< double > TriTensor::image1_transfer ( vgl_homg_point_2d< double > const &  point2,
vgl_homg_point_2d< double > const &  point3,
vgl_homg_point_2d< double >  corrected[] = 0 
) const

For the specified points in image 2/3, return the transferred point in image 1.

Definition at line 260 of file TriTensor.cxx.

vgl_homg_point_2d<double> TriTensor::image2_transfer ( vgl_homg_point_2d< double > const &  point1,
vgl_homg_point_2d< double > const &  point3,
vgl_homg_point_2d< double >  corrected[] = 0 
) const

vgl_homg_point_2d<double> TriTensor::image3_transfer ( vgl_homg_point_2d< double > const &  point1,
vgl_homg_point_2d< double > const &  point2,
vgl_homg_point_2d< double >  corrected[] = 0 
) const

HomgPoint2D TriTensor::image1_transfer ( HomgPoint2D const &  point2,
HomgPoint2D const &  point3,
HomgPoint2D  corrected[] = 0 
) const

Definition at line 274 of file TriTensor.cxx.

HomgPoint2D TriTensor::image2_transfer ( HomgPoint2D const &  point1,
HomgPoint2D const &  point3,
HomgPoint2D  corrected[] = 0 
) const

For the specified points in image 1/3, return the transferred point in image 2.

Definition at line 241 of file TriTensor.cxx.

HomgPoint2D TriTensor::image3_transfer ( HomgPoint2D const &  point1,
HomgPoint2D const &  point2,
HomgPoint2D  corrected[] = 0 
) const

For the specified points in image 1/2, return the transferred point in image 3.

Transfer is via optimal backprojection.

Definition at line 222 of file TriTensor.cxx.

vgl_homg_point_2d< double > TriTensor::image1_transfer_qd ( vgl_homg_point_2d< double > const &  point2,
vgl_homg_point_2d< double > const &  point3 
) const

For the specified points in image 2/3, return the transferred point in image 1.

Definition at line 343 of file TriTensor.cxx.

vgl_homg_point_2d< double > TriTensor::image2_transfer_qd ( vgl_homg_point_2d< double > const &  point1,
vgl_homg_point_2d< double > const &  point3 
) const

For the specified points in image 1/3, return the transferred point in image 2.

Definition at line 320 of file TriTensor.cxx.

vgl_homg_point_2d< double > TriTensor::image3_transfer_qd ( vgl_homg_point_2d< double > const &  point1,
vgl_homg_point_2d< double > const &  point2 
) const

For the specified points in image 1/2, return the transferred point in image 3.

Definition at line 295 of file TriTensor.cxx.

HomgPoint2D TriTensor::image1_transfer_qd ( const HomgPoint2D point2,
const HomgPoint2D point3 
) const

Definition at line 352 of file TriTensor.cxx.

HomgPoint2D TriTensor::image2_transfer_qd ( const HomgPoint2D point1,
const HomgPoint2D point3 
) const

Definition at line 329 of file TriTensor.cxx.

HomgPoint2D TriTensor::image3_transfer_qd ( const HomgPoint2D point1,
const HomgPoint2D point2 
) const

Definition at line 305 of file TriTensor.cxx.

vgl_homg_point_2d<double> TriTensor::image1_transfer ( vgl_homg_point_2d< double > const &  point1,
vgl_homg_line_2d< double > const &  line2 
) const

vgl_homg_point_2d<double> TriTensor::image2_transfer ( vgl_homg_point_2d< double > const &  point1,
vgl_homg_line_2d< double > const &  line3 
) const

vgl_homg_point_2d<double> TriTensor::image3_transfer ( vgl_homg_point_2d< double > const &  point2,
vgl_homg_line_2d< double > const &  line3 
) const

HomgPoint2D TriTensor::image1_transfer ( HomgPoint2D const &  point1,
HomgLine2D const &  line2 
) const

HomgPoint2D TriTensor::image2_transfer ( HomgPoint2D const &  point1,
HomgLine2D const &  line3 
) const

HomgPoint2D TriTensor::image3_transfer ( HomgPoint2D const &  point2,
HomgLine2D const &  line3 
) const

vgl_homg_line_2d< double > TriTensor::image1_transfer ( vgl_homg_line_2d< double > const &  line2,
vgl_homg_line_2d< double > const &  line3 
) const

For the specified lines in image 2/3, return the transferred line in image 1.

Definition at line 366 of file TriTensor.cxx.

vgl_homg_line_2d< double > TriTensor::image2_transfer ( vgl_homg_line_2d< double > const &  line2,
vgl_homg_line_2d< double > const &  line3 
) const

For the specified lines in image 2/3, return the transferred line in image 1.

Definition at line 403 of file TriTensor.cxx.

vgl_homg_line_2d< double > TriTensor::image3_transfer ( vgl_homg_line_2d< double > const &  line2,
vgl_homg_line_2d< double > const &  line3 
) const

For the specified lines in image 1/2, return the transferred line in image 3.

Definition at line 425 of file TriTensor.cxx.

HomgLine2D TriTensor::image1_transfer ( const HomgLine2D line2,
const HomgLine2D line3 
) const

Definition at line 382 of file TriTensor.cxx.

HomgLine2D TriTensor::image2_transfer ( const HomgLine2D line2,
const HomgLine2D line3 
) const

Definition at line 413 of file TriTensor.cxx.

HomgLine2D TriTensor::image3_transfer ( const HomgLine2D line2,
const HomgLine2D line3 
) const

Definition at line 435 of file TriTensor.cxx.

vgl_h_matrix_2d< double > TriTensor::get_hmatrix_31 ( vgl_homg_line_2d< double > const &  line2  )  const

Return the planar homography between views 3 and 1 induced by line 2.

Definition at line 444 of file TriTensor.cxx.

vgl_h_matrix_2d< double > TriTensor::get_hmatrix_21 ( vgl_homg_line_2d< double > const &  line3  )  const

Return the planar homography between views 2 and 1 induced by line 3.

Definition at line 456 of file TriTensor.cxx.

HMatrix2D TriTensor::get_hmatrix_31 ( const HomgLine2D line2  )  const

Definition at line 450 of file TriTensor.cxx.

HMatrix2D TriTensor::get_hmatrix_21 ( const HomgLine2D line3  )  const

Definition at line 462 of file TriTensor.cxx.

bool TriTensor::get_epipoles ( vgl_homg_point_2d< double > &  e2,
vgl_homg_point_2d< double > &  e3 
) const

Return epipoles e2 and e3, from image 1 into images 2 and 3 respectively.

Definition at line 1934 of file TriTensor.cxx.

bool TriTensor::get_epipoles ( HomgPoint2D e2,
HomgPoint2D e3 
) const

Definition at line 1946 of file TriTensor.cxx.

bool TriTensor::compute_epipoles (  )  const

Compute and cache the two epipoles from image 1.

Definition at line 1892 of file TriTensor.cxx.

HomgPoint2D TriTensor::get_epipole_12 (  )  const

Return epipole12.

Definition at line 1959 of file TriTensor.cxx.

HomgPoint2D TriTensor::get_epipole_13 (  )  const

Return epipole13.

Definition at line 1966 of file TriTensor.cxx.

FMatrix TriTensor::get_fmatrix_13 (  )  const

Return F13, the fundamental matrix between images 1 and 3.

Definition at line 1980 of file TriTensor.cxx.

FMatrix TriTensor::get_fmatrix_12 (  )  const

Return F12, the fundamental matrix between images 1 and 2.

Definition at line 1973 of file TriTensor.cxx.

FMatrix TriTensor::compute_fmatrix_23 (  )  const

Definition at line 1986 of file TriTensor.cxx.

const FManifoldProject * TriTensor::get_fmp12 (  )  const

Return a manifold-projector for the Fundamental matrix between 1 and 2.

The projector is cached until the next time T is changed.

Definition at line 1995 of file TriTensor.cxx.

const FManifoldProject * TriTensor::get_fmp23 (  )  const

Return a manifold-projector as above, between 2 and 3.

Definition at line 2011 of file TriTensor.cxx.

const FManifoldProject * TriTensor::get_fmp13 (  )  const

Return a manifold-projector as above, between 1 and 3.

Definition at line 2003 of file TriTensor.cxx.

void TriTensor::compute_P_matrices ( const vnl_vector< double > &  x,
double  alpha,
double  beta,
PMatrix P2,
PMatrix P3 
) const

Compute one of the family of P matrix triplets consistent with this T.

Definition at line 2027 of file TriTensor.cxx.

void TriTensor::compute_P_matrices ( const vnl_vector< double > &  x,
double  alpha,
PMatrix P2,
PMatrix P3 
) const [inline]

Definition at line 177 of file TriTensor.h.

void TriTensor::compute_P_matrices ( const vnl_vector< double > &  x,
PMatrix P2,
PMatrix P3 
) const [inline]

Definition at line 180 of file TriTensor.h.

void TriTensor::compute_P_matrices ( PMatrix