MCPcopy Create free account
hub / github.com/UniflexAI/tinynav / operator()

Method operator()

tinynav/cpp/bundle_adjustment.cpp:31–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 : observed_keypoint_(observed_keypoint), K_(K) {}
30 template<typename T>
31 bool operator()(const T* camera_parameters, const T* point_parameters, T* residuals) const {
32 using Vector3T = Eigen::Matrix<T, 3, 1>;
33 Eigen::Map<const Eigen::Matrix<T, 6, 1>> camera(camera_parameters);
34 Eigen::Map<const Vector3T> point_3d(point_parameters);
35 Eigen::Matrix<T, 3, 1> phi = Eigen::Map<const Eigen::Matrix<T, 3, 1>>(camera.data() + 3);
36 Eigen::Matrix<T, 3, 1> translation = Eigen::Map<const Vector3T>(camera.data());
37 Eigen::Matrix<T, 3, 3> rotation;
38 ceres::AngleAxisToRotationMatrix(phi.data(), rotation.data());
39 Vector3T point_3d_in_camera = rotation.transpose() * (point_3d - translation);
40 Vector3T reprojection = K_ * point_3d_in_camera;
41 residuals[0] = reprojection[0] / reprojection[2] - observed_keypoint_[0];
42 residuals[1] = reprojection[1] / reprojection[2] - observed_keypoint_[1];
43 return true;
44 }
45 private:
46 Eigen::Vector2d observed_keypoint_;
47 Eigen::Matrix3d K_;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected