Skip to main content

Crate cumulus3d_align

Crate cumulus3d_align 

Source
Expand description

GPS→ENU, Sim3 alignment, shared 3D point alignment, point cloud post-processing.

  • geodesy: WGS84 LLA ↔ ECEF ↔ ENU.
  • umeyama: Umeyama Sim3, LO-RANSAC robust estimation, iterative reweighting (robust Umeyama).
  • model_aligner: alignment of registered image projection centers to GPS ENU (robust Sim3 estimation).
  • shared: shared 3D point correspondences between two reconstructions and their alignment.
  • kdtree, cloud: point cloud transform, proximity masking, thinning, snapshot composition.
  • reanchor: chained Sim3 that reconnects the coordinate frames of earlier zones to the new refined model.

§Usage example

use cumulus3d_align::{compose_snapshot, umeyama, EnuFrame, SnapshotOptions};
use cumulus3d_core::io::PointCloud;
use cumulus3d_core::{Quat, Sim3, Vec3};

// GPS (WGS84) ↔ ENU: east/north/up meter coordinates relative to the origin.
let enu = EnuFrame::new(37.5, 127.0, 10.0);
let p = enu.lla_to_enu(37.5001, 127.0001, 10.0);
let (lat, lon, _alt) = enu.enu_to_lla(&p);
assert!((lat - 37.5001).abs() < 1e-9 && (lon - 127.0001).abs() < 1e-9);

// Estimate the Sim3 (src → dst) between sets of corresponding points.
let truth = Sim3::new(2.0, Quat::from_axis_angle(&Vec3::z(), 0.3), Vec3::new(1.0, 2.0, 3.0));
let src: Vec<Vec3> = (0..10).map(|i| Vec3::new(i as f64, (i * i) as f64 * 0.1, (i as f64).sin())).collect();
let dst: Vec<Vec3> = src.iter().map(|x| truth.transform_point(x)).collect();
let est = umeyama(&src, &dst, true).unwrap();
assert!((est.scale - 2.0).abs() < 1e-9);

// Snapshot: remove preview points within 1.5 m of refined points, merge, then thin by 1/stride.
let fine = PointCloud { positions: vec![[0.0, 0.0, 0.0]], ..Default::default() };
let coarse = PointCloud { positions: vec![[0.5, 0.0, 0.0], [10.0, 0.0, 0.0]], ..Default::default() };
let snap = compose_snapshot(&[&fine], &[&coarse], &SnapshotOptions { mask_radius: 1.5, stride: 1 });
assert_eq!(snap.len(), 2);
use cumulus3d_align::{align_to_gps_file, ModelAlignerOptions};
let mut rec = cumulus3d_core::interop::read_model("model/0").unwrap();
let a = align_to_gps_file(&mut rec, "gps_ref.txt", &ModelAlignerOptions::default()).unwrap();
println!("인라이어 {}/{}, 중앙 오차 {:.2} m", a.num_inliers, a.common.len(), a.median_error);

Re-exports§

pub use cloud::compose_snapshot;
pub use cloud::decimate;
pub use cloud::merge_clouds;
pub use cloud::remove_near;
pub use cloud::select;
pub use cloud::transform_cloud;
pub use cloud::SnapshotOptions;
pub use error::AlignError;
pub use error::Result;
pub use geodesy::ecef_to_lla;
pub use geodesy::lla_to_ecef;
pub use geodesy::EnuFrame;
pub use geodesy::WGS84_A;
pub use geodesy::WGS84_B;
pub use geodesy::WGS84_E2;
pub use geodesy::WGS84_F;
pub use kdtree::KdTree;
pub use model_aligner::align_to_gps;
pub use model_aligner::align_to_gps_file;
pub use model_aligner::estimate_gps_alignment;
pub use model_aligner::gps_to_enu;
pub use model_aligner::EnuOrigin;
pub use model_aligner::GpsAlignment;
pub use model_aligner::ModelAlignerOptions;
pub use reanchor::AnchorChain;
pub use shared::align_reconstructions;
pub use shared::position_index_from_name;
pub use shared::shared_point_correspondences;
pub use shared::SharedPointOptions;
pub use umeyama::estimate_sim3_ransac;
pub use umeyama::robust_umeyama;
pub use umeyama::umeyama;
pub use umeyama::RankCheck;
pub use umeyama::RobustUmeyamaOptions;
pub use umeyama::RobustUmeyamaResult;
pub use umeyama::Sim3Estimator;

Modules§

cloud
Point cloud post-processing: Sim3 transform, proximity masking against the refined cloud, 1/N thinning, snapshot composition.
error
Alignment errors. Every failure condition is distinguished so that failures are never silently ignored.
geodesy
WGS84 geodetic conversion. Angular inputs and outputs are in degrees.
kdtree
3D KD-tree (own implementation). For proximity masking against the refined cloud. Queries are parallel with rayon.
model_aligner
GPS ENU alignment: fits the projection centers of registered images to the ENU coordinates of the GPS reference points with a robust Sim3.
reanchor
Reanchor: a chained Sim3 that reconnects earlier zones to the latest coordinate frame whenever a new refined model appears.
shared
Shared 3D point correspondences between two reconstructions (post-processing).
umeyama
Umeyama Sim3 and robust estimation.