Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bundler reader and Clang compilation issue #252

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/theia/io/bundler_file_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ bool ReadViewList(FILE* in, std::vector<FeatureInfo>* view_list) {
int num_views = 0;
if (fscanf(in, "%d", &num_views) != 1) {
VLOG(3) << "Unable to read number of views for point.";
return false;
}
VLOG(3) << "Num. views to read: " << num_views;
view_list->resize(num_views);
Expand All @@ -153,12 +154,12 @@ bool ReadViewList(FILE* in, std::vector<FeatureInfo>* view_list) {
if (fscanf(in, "%f", &entry) != 1) {
return false;
}
(*view_list)[i].kpt_x = static_cast<int>(entry);
(*view_list)[i].kpt_x = entry;
// Kpt y.
if (fscanf(in, "%f", &entry) != 1) {
return false;
}
(*view_list)[i].kpt_y = static_cast<int>(entry);
(*view_list)[i].kpt_y = entry;
}
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/theia/io/bundler_file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct FeatureInfo {
// Index of the feature in the SIFT file.
int sift_index;
// Pixel position.
int kpt_x;
int kpt_y;
float kpt_x;
float kpt_y;
};

// Reconstructed 3D point.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ static constexpr double kRadialDistortion1 = -1e-7;
static constexpr double kRadialDistortion2 = -5e-7;
static constexpr double kReprojectionError = 3.0;

// allowing 10 percent error for radial distortion parameters
static constexpr double kRadDistThreshold1 =
// Allowing 10 percent error for radial distortion parameters.
static const double kRadDistThreshold1 =
0.1 * std::abs(kRadialDistortion1 * std::pow(kFocalLength1, 2));
static constexpr double kRadDistThreshold2 =
static const double kRadDistThreshold2 =
0.1 * std::abs(kRadialDistortion2 * std::pow(kFocalLength2, 2));

// Generate points on a plane so that a homography can accurately estimate the
Expand Down Expand Up @@ -111,7 +111,7 @@ void GenerateDistortedImagePoint(
AddNoiseToProjection(projection_noise_std_dev, &rng, &image_2_point);
}

// normalize points with focal length (and principal point) estimate
// Normalize points with focal length (and principal point) estimate.
UndistortPoint(image_1_point, focal_length1, 0.0, image_1_point_normalized);
UndistortPoint(image_2_point, focal_length2, 0.0, image_2_point_normalized);
}
Expand Down Expand Up @@ -164,13 +164,13 @@ void ExecuteRandomTest(const RansacParameters& options,
std::vector<Vector2d> image_1_points_normalized, image_2_points_normalized;
std::vector<Vector2d> image_1_points, image_2_points;

// Generate distorted points
// Generate distorted points.
GenerateDistortedImagePoints(
points3d, noise, rotation, position, focal_length_1, focal_length_2,
radial_distortion_1, radial_distortion_2, inlier_ratio,
&image_1_points_normalized, &image_2_points_normalized, &image_1_points,
&image_2_points);
// Get correspondences
// Get correspondences.
std::vector<RadialDistortionFeatureCorrespondence> correspondences;
for (size_t i = 0; i < image_1_points.size(); ++i) {
RadialDistortionFeatureCorrespondence correspondence;
Expand Down