updating points name, constexpr

release/4.3a0
Akshay Krishnan 2021-06-21 03:47:10 +00:00
parent 47f9f30b39
commit e3b6c8308a
2 changed files with 17 additions and 20 deletions

View File

@ -26,7 +26,7 @@ using namespace gtsam;
/* ************************************************************************* */ /* ************************************************************************* */
void createExampleBALFile(const string& filename, const vector<Point3>& P, void createExampleBALFile(const string& filename, const vector<Point3>& points,
const Pose3& pose1, const Pose3& pose2, const Pose3& pose1, const Pose3& pose2,
const Cal3Bundler& K = Cal3Bundler()) { const Cal3Bundler& K = Cal3Bundler()) {
// Class that will gather all data // Class that will gather all data
@ -35,7 +35,7 @@ void createExampleBALFile(const string& filename, const vector<Point3>& P,
data.cameras.push_back(SfmCamera(pose1, K)); data.cameras.push_back(SfmCamera(pose1, K));
data.cameras.push_back(SfmCamera(pose2, K)); data.cameras.push_back(SfmCamera(pose2, K));
for (const Point3& p : P) { for (const Point3& p : points) {
// Create the track // Create the track
SfmTrack track; SfmTrack track;
track.p = p; track.p = p;
@ -63,13 +63,12 @@ void create5PointExample1() {
Pose3 pose1, pose2(aRb, aTb); Pose3 pose1, pose2(aRb, aTb);
// Create test data, we need at least 5 points // Create test data, we need at least 5 points
vector<Point3> P; vector<Point3> points = {{0, 0, 1}, {-0.1, 0, 1}, {0.1, 0, 1}, //
P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), // {0, 0.5, 0.5}, {0, -0.5, 0.5}};
Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5);
// Assumes example is run in ${GTSAM_TOP}/build/examples // Assumes example is run in ${GTSAM_TOP}/build/examples
const string filename = "../../examples/Data/5pointExample1.txt"; const string filename = "../../examples/Data/5pointExample1.txt";
createExampleBALFile(filename, P, pose1, pose2); createExampleBALFile(filename, points, pose1, pose2);
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -81,15 +80,14 @@ void create5PointExample2() {
Pose3 pose1, pose2(aRb, aTb); Pose3 pose1, pose2(aRb, aTb);
// Create test data, we need at least 5 points // Create test data, we need at least 5 points
vector<Point3> P; vector<Point3> points = {{0, 0, 100}, {-10, 0, 100}, {10, 0, 100}, //
P += Point3(0, 0, 100), Point3(-10, 0, 100), Point3(10, 0, 100), // {0, 50, 50}, {0, -50, 50}, {-20, 0, 80},
Point3(0, 50, 50), Point3(0, -50, 50), Point3(-20, 0, 80), {20, -50, 80}};
Point3(20, -50, 80);
// Assumes example is run in ${GTSAM_TOP}/build/examples // Assumes example is run in ${GTSAM_TOP}/build/examples
const string filename = "../../examples/Data/5pointExample2.txt"; const string filename = "../../examples/Data/5pointExample2.txt";
Cal3Bundler K(500, 0, 0); Cal3Bundler K(500, 0, 0);
createExampleBALFile(filename, P, pose1, pose2, K); createExampleBALFile(filename, points, pose1, pose2, K);
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -101,17 +99,16 @@ void create18PointExample1() {
Pose3 pose1, pose2(aRb, aTb); Pose3 pose1, pose2(aRb, aTb);
// Create test data, we need 15 points // Create test data, we need 15 points
vector<Point3> P; vector<Point3> points = {{0, 0, 1}, {-0.1, 0, 1}, {0.1, 0, 1}, //
P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), // {0, 0.5, 0.5}, {0, -0.5, 0.5}, {-1, -0.5, 2}, //
Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5), Point3(-1, -0.5, 2), // {-1, 0.5, 2}, {0.25, -0.5, 1.5}, {0.25, 0.5, 1.5}, //
Point3(-1, 0.5, 2), Point3(0.25, -0.5, 1.5), Point3(0.25, 0.5, 1.5), // {-0.1, -0.5, 0.5}, {0.1, -0.5, 1}, {0.1, 0.5, 1}, //
Point3(-0.1, -0.5, 0.5), Point3(0.1, -0.5, 1), Point3(0.1, 0.5, 1), // {-0.1, 0, 0.5}, {-0.1, 0.5, 0.5}, {0, 0, 0.5}, //
Point3(-0.1, 0, 0.5), Point3(-0.1, 0.5, 0.5), Point3(0, 0, 0.5), // {0.1, -0.5, 0.5}, {0.1, 0, 0.5}, {0.1, 0.5, 0.5}};
Point3(0.1, -0.5, 0.5), Point3(0.1, 0, 0.5), Point3(0.1, 0.5, 0.5);
// Assumes example is run in ${GTSAM_TOP}/build/examples // Assumes example is run in ${GTSAM_TOP}/build/examples
const string filename = "../../examples/Data/18pointExample1.txt"; const string filename = "../../examples/Data/18pointExample1.txt";
createExampleBALFile(filename, P, pose1, pose2); createExampleBALFile(filename, points, pose1, pose2);
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {

View File

@ -315,7 +315,7 @@ class EssentialMatrixFactor4
typedef NoiseModelFactor2<EssentialMatrix, CALIBRATION> Base; typedef NoiseModelFactor2<EssentialMatrix, CALIBRATION> Base;
typedef EssentialMatrixFactor4 This; typedef EssentialMatrixFactor4 This;
static const int DimK = FixedDimension<CALIBRATION>::value; static constexpr int DimK = FixedDimension<CALIBRATION>::value;
typedef Eigen::Matrix<double, 2, DimK> JacobianCalibration; typedef Eigen::Matrix<double, 2, DimK> JacobianCalibration;
public: public: