Skip to content

Commit

Permalink
BUG: fix nasty bug causing scene points to disappear.
Browse files Browse the repository at this point in the history
  • Loading branch information
Odd Kiva committed May 25, 2024
1 parent 22a049e commit de57358
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cpp/src/DO/Sara/SfM/BuildingBlocks/BundleAdjuster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ auto BundleAdjuster::populate_camera_params(
const Eigen::Vector3d aaxis_v_3d = aaxis_v.angle() * aaxis_v.axis();
// Initialize the absolute rotation.
extrinsics_v << aaxis_v_3d.transpose(), pose_v.t.transpose();
SARA_LOGD(logger, "Populating extrinsics[{}]=\n{}", v, extrinsics_v.eval());
SARA_LOGT(logger, "Populating extrinsics[{}]=\n{}", v, extrinsics_v.eval());

// Initialize the internal camera parameters.
const auto& K = calibration_matrices[v];
intrinsics_v(0) = K(0, 0); // fx
intrinsics_v(1) = K(1, 1); // fy
intrinsics_v(2) = K(0, 2); // u0
intrinsics_v(3) = K(1, 2); // v0
SARA_LOGD(logger, "Populating intrinsics[{}]=\n{}", v, intrinsics_v.eval());
SARA_LOGT(logger, "Populating intrinsics[{}]=\n{}", v, intrinsics_v.eval());
}
}

Expand Down
10 changes: 5 additions & 5 deletions cpp/src/DO/Sara/SfM/BuildingBlocks/PointCloudGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,12 @@ auto PointCloudGenerator::grow_point_cloud(
auto scene_point_value = ScenePoint{coords, color};
_point_cloud.emplace_back(std::move(scene_point_value));

// Recall that a match is a pair of feature vertex.
const auto& [x, y] = fmatches[j];

// Assign a scene point index to the two feature vertices.
_from_vertex_to_scene_point_index[x] = scene_point_index;
_from_vertex_to_scene_point_index[y] = scene_point_index;
const auto& ftrack = ftracks_without_scene_point[j];
for (const auto& v : ftrack)
_from_vertex_to_scene_point_index[v] = scene_point_index;

// Increment the scene point index.
++scene_point_index;
}

Expand Down
6 changes: 0 additions & 6 deletions cpp/src/DO/Sara/SfM/Odometry/OdometryPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,9 @@ auto OdometryPipeline::adjust_bundles() -> void
const auto& ftrack = ftracks_filtered[t];
const auto idx = _point_cloud_generator->scene_point_index(ftrack.front());
if (idx == std::nullopt)
#ifdef BUG_DEBUG_ME
throw std::runtime_error{fmt::format(
"Error: the feature vertex {} must have a scene point index!",
ftrack.front())};
#else
SARA_LOGE(logger,
"Error: the feature vertex {} must have a scene point index!",
ftrack.front());
#endif

if (*idx >= _point_cloud.size())
throw std::runtime_error{
Expand Down

0 comments on commit de57358

Please sign in to comment.