LinearAlgebraCV.h
Go to the documentation of this file.
1 // ****************************************************************************
2 // This file is part of the Integrating Vision Toolkit (IVT).
3 //
4 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
5 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
6 //
7 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // 3. Neither the name of the KIT nor the names of its contributors may be
21 // used to endorse or promote products derived from this software
22 // without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
25 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
28 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 // ****************************************************************************
35 
36 
37 #ifndef _LINEAR_ALGEBRA_CV_H_
38 #define _LINEAR_ALGEBRA_CV_H_
39 
40 #include "opencv/cv.h"
41 // ****************************************************************************
42 // Forward declarations
43 // ****************************************************************************
44 
45 class CFloatMatrix;
46 class CFloatVector;
47 class CDoubleMatrix;
48 class CDoubleVector;
49 struct Mat3d;
50 struct Vec2d;
51 
52 
53 
54 // ****************************************************************************
55 // LinearAlgebraCV
56 // ****************************************************************************
57 
62 namespace LinearAlgebraCV
63 {
64  // operating on CFloatMatrix and CFloatVector
65 
66  // singular value decomposition
67  void SVD(const CFloatMatrix *A, CFloatMatrix *W, CFloatMatrix *U = 0, CFloatMatrix *V = 0,
68  bool bAllowModifyA = false, bool bReturnUTransposed = false, bool bReturnVTransposed = false);
69 
70  // linear least squares
74 
75  // calculation of pseudoinverse
76  void CalculatePseudoInverseSVD(const CFloatMatrix *pInputMatrix, CFloatMatrix *pOutputMatrix);
77  void CalculatePseudoInverseSimple(const CFloatMatrix *pInputMatrix, CFloatMatrix *pResultMatrix);
78 
79  // basic operations on matrices
80  void Multiply(const CFloatMatrix *A, const CFloatMatrix *B, CFloatMatrix *pResultMatrix, bool bTransposeB = false);
81  void Invert(const CFloatMatrix *A, const CFloatMatrix *pResultMatrix);
82  void Transpose(const CFloatMatrix *A, const CFloatMatrix *pResultMatrix);
83  void SelfProduct(const CFloatMatrix *pMatrix, CFloatMatrix *pResultMatrix, bool bTransposeSecond = false);
84 
85  // 2d homographies
86  bool DetermineAffineTransformation(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, Mat3d &A, bool bUseSVD = false);
87  bool DetermineHomography(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, Mat3d &A, bool bUseSVD = false);
88 
89  // covariance matrix
90  void CalculateCovarianceMatrix(const CFloatMatrix *pMatrix, CFloatMatrix *pCovarianceMatrix);
91 
92  // PCA
93  void PCA(const CFloatMatrix *pData, CFloatMatrix *pTransformationMatrix, CFloatMatrix *pTransformedData, int nTargetDimension);
94  void PCA(const CFloatMatrix *pData, CFloatMatrix *pTransformationMatrix, CFloatMatrix *pEigenValues);
95 
96 
97 
98  // operating on CDoubleMatrix and CDoubleVector
99 
100  // singular value decomposition
101  void SVD(const CDoubleMatrix *A, CDoubleMatrix *W, CDoubleMatrix *U = 0, CDoubleMatrix *V = 0,
102  bool bAllowModifyA = false, bool bReturnUTransposed = false, bool bReturnVTransposed = false);
103 
104  // linear least squares
108 
109  // calculation of pseudoinverse
110  void CalculatePseudoInverseSVD(const CDoubleMatrix *pInputMatrix, CDoubleMatrix *pOutputMatrix);
111  void CalculatePseudoInverseSimple(const CDoubleMatrix *pInputMatrix, CDoubleMatrix *pResultMatrix);
112 
113  // basic operations on matrices
114  void Multiply(const CDoubleMatrix *A, const CDoubleMatrix *B, CDoubleMatrix *pResultMatrix, bool bTransposeB = false);
115  void Invert(const CDoubleMatrix *A, const CDoubleMatrix *pResultMatrix);
116  void Transpose(const CDoubleMatrix *A, const CDoubleMatrix *pResultMatrix);
117 }
118 
119 
120 
121 #endif /* _LINEAR_ALGEBRA_CV_H_ */
void SolveLinearLeastSquaresSimple(const CFloatMatrix *A, const CFloatVector *b, CFloatVector *x)
void Transpose(const CFloatMatrix *A, const CFloatMatrix *pResultMatrix)
void CalculateCovarianceMatrix(const CFloatMatrix *pMatrix, CFloatMatrix *pCovarianceMatrix)
Data structure for the representation of a vector of values of the data type double.
Definition: DoubleVector.h:54
GLenum GLint x
Definition: glext.h:3125
void Invert(const CFloatMatrix *A, const CFloatMatrix *pResultMatrix)
Data structure for the representation of a matrix of values of the data type float.
Definition: FloatMatrix.h:56
bool DetermineHomography(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, Mat3d &A, bool bUseSVD=false)
Obsolete (encapsulated OpenCV calls). Use LinearAlgebra instead.
void Multiply(const CFloatMatrix *A, const CFloatMatrix *B, CFloatMatrix *pResultMatrix, bool bTransposeB=false)
GLubyte GLubyte b
Definition: glext.h:5166
Data structure for the representation of a vector of values of the data type float.
Definition: FloatVector.h:53
void SelfProduct(const CFloatMatrix *pMatrix, CFloatMatrix *pResultMatrix, bool bTransposeSecond=false)
void SVD(const CFloatMatrix *A, CFloatMatrix *W, CFloatMatrix *U=0, CFloatMatrix *V=0, bool bAllowModifyA=false, bool bReturnUTransposed=false, bool bReturnVTransposed=false)
Data structure for the representation of a 2D vector.
Definition: Math2d.h:82
Data structure for the representation of a matrix of values of the data type double.
Definition: DoubleMatrix.h:54
void SolveLinearLeastSquaresSVD(const CFloatMatrix *A, const CFloatVector *b, CFloatVector *x)
bool DetermineAffineTransformation(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, Mat3d &A, bool bUseSVD=false)
Data structure for the representation of a 3x3 matrix.
Definition: Math3d.h:93
void SolveLinearLeastSquaresHomogeneousSVD(const CFloatMatrix *A, CFloatVector *x)
void CalculatePseudoInverseSVD(const CFloatMatrix *pInputMatrix, CFloatMatrix *pOutputMatrix)
void PCA(const CFloatMatrix *pData, CFloatMatrix *pTransformationMatrix, CFloatMatrix *pTransformedData, int nTargetDimension)
void CalculatePseudoInverseSimple(const CFloatMatrix *pInputMatrix, CFloatMatrix *pResultMatrix)


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:28