Berkeley SfM
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
bsfm::GeometricError Struct Reference

#include <cost_functors.h>

Public Member Functions

 GeometricError (const Feature &x, const Point3D &X)
 
template<typename T >
bool operator() (const T *const P, T *geometric_error) const
 

Static Public Member Functions

static ceres::CostFunction * Create (const Feature &x, const Point3D &X)
 

Public Attributes

Feature x_
 
Point3D X_
 

Detailed Description

Definition at line 71 of file cost_functors.h.

Constructor & Destructor Documentation

bsfm::GeometricError::GeometricError ( const Feature x,
const Point3D X 
)
inline

Definition at line 77 of file cost_functors.h.

77 : x_(x), X_(X) {}

Member Function Documentation

static ceres::CostFunction* bsfm::GeometricError::Create ( const Feature x,
const Point3D X 
)
inlinestatic

Definition at line 96 of file cost_functors.h.

96  {
97  static const int kNumResiduals = 2;
98  static const int kNumCameraParameters = 12;
99  return new ceres::AutoDiffCostFunction<GeometricError,
100  kNumResiduals,
101  kNumCameraParameters>(new GeometricError(x, X));
102  }
GeometricError(const Feature &x, const Point3D &X)
Definition: cost_functors.h:77
template<typename T >
bool bsfm::GeometricError::operator() ( const T *const  P,
T *  geometric_error 
) const
inline

Definition at line 82 of file cost_functors.h.

82  {
83 
84  // Matrix multiplication: x - PX. Assume homogeneous coordinates are 1.0.
85  // Matrix P is stored in column-major order.
86  T scale = P[2] * X_.X() + P[5] * X_.Y() + P[8] * X_.Z() + P[11];
87  geometric_error[0] =
88  x_.u_ - (P[0] * X_.X() + P[3] * X_.Y() + P[6] * X_.Z() + P[9]) / scale;
89  geometric_error[1] =
90  x_.v_ - (P[1] * X_.X() + P[4] * X_.Y() + P[7] * X_.Z() + P[10]) / scale;
91 
92  return true;
93  }
double v_
Definition: feature.h:62
double Y() const
Definition: point_3d.cpp:94
double u_
Definition: feature.h:62
double X() const
Definition: point_3d.cpp:92
double Z() const
Definition: point_3d.cpp:96

Member Data Documentation

Feature bsfm::GeometricError::x_

Definition at line 75 of file cost_functors.h.

Point3D bsfm::GeometricError::X_

Definition at line 76 of file cost_functors.h.


The documentation for this struct was generated from the following file: