Skip to content

Commit

Permalink
Merge branch 'main' into jp/upgrade-ubuntu-22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
jpilet authored Mar 22, 2024
2 parents 19f08ce + c724192 commit 71f3357
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions opensfm/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
reconstruct_from_prior,
undistort,
)
# pyre-fixme[21]: Could not find module `opensfm.commands.command_runner`.
from .command_runner import command_runner


Expand Down
3 changes: 2 additions & 1 deletion opensfm/src/dense/src/depthmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ cv::Vec3f PlaneFromDepthAndNormal(float x, float y, const cv::Matx33d &K,
}

float UniformRand(float a, float b) {
return a + (b - a) * float(rand()) / RAND_MAX;
// Note that float(RAND_MAX) cannot be exactly represented as a float. We ignore the small inaccuracy here; this is already a bad way to get random numbers.
return a + (b - a) * float(rand()) / static_cast<float>(RAND_MAX);
}

DepthmapEstimator::DepthmapEstimator()
Expand Down
4 changes: 2 additions & 2 deletions opensfm/src/features/src/matching.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ void MatchUsingWords(const cv::Mat &f1, const cv::Mat &w1, const cv::Mat &f2,
}

std::vector<int> best_match(f1.rows, -1), second_best_match(f1.rows, -1);
std::vector<float> best_distance(f1.rows, 99999999),
second_best_distance(f1.rows, 99999999);
std::vector<float> best_distance(f1.rows, std::numeric_limits<float>::infinity());
std::vector<float> second_best_distance(f1.rows, std::numeric_limits<float>::infinity());
*matches = cv::Mat(0, 2, CV_32S);
cv::Mat tmp_match(1, 2, CV_32S);
for (unsigned int i = 0; i < w1.rows; ++i) {
Expand Down
3 changes: 2 additions & 1 deletion opensfm/src/geometry/relative_pose.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ struct RelativePoseCost {
std::srand(42);
const int count = end_ - begin_;
for (int i = 0; i < MAX_ERRORS; ++i) {
const int index = (float(std::rand()) / RAND_MAX) * count;
// Note that float(RAND_MAX) cannot be exactly represented as a float. We ignore the small inaccuracy here; this is already a bad way to get random numbers.
const int index = (float(std::rand()) / static_cast<float>(RAND_MAX)) * count;
picked_errors_.push_back(begin_ + index);
}
}
Expand Down
2 changes: 1 addition & 1 deletion opensfm/src/geometry/src/camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ MatX2d Camera::PixelToNormalizedCoordinatesMany(const MatX2d& px_coords,
norm_coords.row(i) =
PixelToNormalizedCoordinates(px_coords.row(i), width, height);
}
return px_coords;
return norm_coords;
}

Vec2d Camera::NormalizedToPixelCoordinates(const Vec2d& norm_coord) const {
Expand Down
3 changes: 1 addition & 2 deletions opensfm/src/third_party/akaze/lib/AKAZE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void AKAZE::Find_Scale_Space_Extrema(std::vector<cv::KeyPoint>& kpts) {
double t1 = 0.0, t2 = 0.0;
float value = 0.0;
float dist = 0.0, ratio = 0.0, smax = 0.0;
int npoints = 0, id_repeated = 0;
int id_repeated = 0;
int sigma_size_ = 0, left_x = 0, right_x = 0, up_y = 0, down_y = 0;
bool is_extremum = false, is_repeated = false, is_out = false;
cv::KeyPoint point;
Expand Down Expand Up @@ -357,7 +357,6 @@ void AKAZE::Find_Scale_Space_Extrema(std::vector<cv::KeyPoint>& kpts) {
point.pt.x *= ratio;
point.pt.y *= ratio;
kpts_aux.push_back(point);
npoints++;
}
else {
point.pt.x *= ratio;
Expand Down

0 comments on commit 71f3357

Please sign in to comment.