pub struct MinSquaresTriangulator { /* private fields */ }Expand description
This solves triangulation problems by simply minimizing the squared reprojection error of all observances.
This is a quick triangulator to execute and is fairly robust.
use cv_core::nalgebra::{Vector3, Point3, Rotation3, Unit};
use cv_core::{TriangulatorRelative, CameraToCamera, CameraPoint, Pose, Projective};
use cv_geom::MinSquaresTriangulator;
let point = CameraPoint::from_point(Point3::new(0.3, 0.1, 2.0));
let pose = CameraToCamera::from_parts(Vector3::new(0.1, 0.1, 0.1), Rotation3::new(Vector3::new(0.1, 0.1, 0.1)));
let bearing_a = point.bearing();
let bearing_b = pose.transform(point).bearing();
let triangulated = MinSquaresTriangulator::new().triangulate_relative(pose, bearing_a, bearing_b).unwrap();
let distance = (point.point().unwrap().coords - triangulated.point().unwrap().coords).norm();
assert!(distance < 1e-6);Implementations§
Source§impl MinSquaresTriangulator
impl MinSquaresTriangulator
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a MinSquaresTriangulator with default values.
Same as calling Default::default.
Sourcepub fn epsilon(self, epsilon: f64) -> Self
pub fn epsilon(self, epsilon: f64) -> Self
Set the epsilon used in the symmetric eigen solver.
Default is 1e-9.
Sourcepub fn max_iterations(self, max_iterations: usize) -> Self
pub fn max_iterations(self, max_iterations: usize) -> Self
Set the maximum number of iterations for the symmetric eigen solver.
Default is 100.
Trait Implementations§
Source§impl Clone for MinSquaresTriangulator
impl Clone for MinSquaresTriangulator
Source§fn clone(&self) -> MinSquaresTriangulator
fn clone(&self) -> MinSquaresTriangulator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MinSquaresTriangulator
impl Debug for MinSquaresTriangulator
Source§impl Default for MinSquaresTriangulator
impl Default for MinSquaresTriangulator
Source§impl TriangulatorObservances for MinSquaresTriangulator
impl TriangulatorObservances for MinSquaresTriangulator
fn triangulate_observances<B: Bearing>( &self, pairs: impl IntoIterator<Item = (WorldToCamera, B)>, ) -> Option<WorldPoint>
impl Copy for MinSquaresTriangulator
Auto Trait Implementations§
impl Freeze for MinSquaresTriangulator
impl RefUnwindSafe for MinSquaresTriangulator
impl Send for MinSquaresTriangulator
impl Sync for MinSquaresTriangulator
impl Unpin for MinSquaresTriangulator
impl UnwindSafe for MinSquaresTriangulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.