42 for (
int i = 1; i <
markers.size(); ++i) {
43 if (
markers[i].image != *image1) {
49 LOG(FATAL) <<
"Only one image in the markers.";
57 LG <<
"Not enough markers to initialize from two frames: "
63 GetImagesInMarkers(
markers, &image1, &image2);
80 Mat3 K = Mat3::Identity();
82 E,
K, x1.col(0),
K, x2.col(0), &
R, &t)) {
83 LG <<
"Failed to compute R and t from E and K.";
91 LG <<
"From two frame reconstruction got:\nR:\n"
92 <<
R <<
"\nt:" << t.transpose();
100 Map<const Mat3> full_rank_F(encoded_F.data(), 3, 3);
101 Eigen::JacobiSVD<Mat3> svd(full_rank_F,
102 Eigen::ComputeFullU | Eigen::ComputeFullV);
103 Vec3 diagonal = svd.singularValues();
105 Mat3 F = svd.matrixU() * diagonal.asDiagonal() * svd.matrixV().transpose();
111struct FundamentalSampsonCostFunction {
113 typedef Vec FMatrixType;
114 typedef Vec9 XMatrixType;
117 explicit FundamentalSampsonCostFunction(
const vector<Marker>& markers)
122 Mat3 F = DecodeF(encoded_F);
126 for (
int i = 0; i <
markers.size() / 2; ++i) {
127 const Marker& marker1 =
markers[2 * i + 0];
128 const Marker& marker2 =
markers[2 * i + 1];
129 CHECK_EQ(marker1.track, marker2.track);
130 Vec2 x1(marker1.x, marker1.y);
131 Vec2 x2(marker2.x, marker2.y);
149 GetImagesInMarkers(
markers, &image1, &image2);
168 FundamentalSampsonCostFunction fundamental_cost(
markers);
173 Solver solver(fundamental_cost);
175 Solver::SolverParameters
params;
176 Solver::Results results = solver.minimize(
params, &encoded_F);
180 F = DecodeF(encoded_F);
184 Mat34 P1 = Mat34::Zero();
185 P1.block<3, 3>(0, 0) = Mat3::Identity();
192 LG <<
"From two frame reconstruction got P2:\n" << P2;
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Map
void InsertCamera(int image, const Mat34 &P)
const vector< Marker > & markers
const ProjectiveReconstruction & reconstruction
double SampsonDistance(const Mat &F, const Vec2 &x1, const Vec2 &x2)
Eigen::Matrix< double, 3, 3 > Mat3
bool ProjectiveReconstructTwoFrames(const vector< Marker > &markers, ProjectiveReconstruction *reconstruction)
bool EuclideanReconstructTwoFrames(const vector< Marker > &markers, EuclideanReconstruction *reconstruction)
void ProjectionsFromFundamental(const Mat3 &F, Mat34 *P1, Mat34 *P2)
bool MotionFromEssentialAndCorrespondence(const Mat3 &E, const Mat3 &K1, const Vec2 &x1, const Mat3 &K2, const Vec2 &x2, Mat3 *R, Vec3 *t)
Eigen::Matrix< double, 3, 4 > Mat34
double NormalizedEightPointSolver(const Mat &x1, const Mat &x2, Mat3 *F)
void CoordinatesForMarkersInImage(const vector< Marker > &markers, int image, Mat *coordinates)
void FundamentalToEssential(const Mat3 &F, Mat3 *E)
Eigen::Matrix< double, 9, 1 > Vec9