[][src]Struct cv::RelativeCameraPose

pub struct RelativeCameraPose(pub Isometry<f64, U3, Rotation<f64, U3>>);

This contains a relative pose, which is a pose that transforms the CameraPoint of one image into the corresponding CameraPoint of another image. This transforms the point from the camera space of camera A to camera B.

Camera space for a given camera is defined as thus:

  • Origin is the optical center
  • Positive z axis is forwards
  • Positive y axis is up
  • Positive x axis is right

Note that this is a left-handed coordinate space.

Implementations

impl RelativeCameraPose[src]

pub fn from_parts(
    rotation: Rotation<f64, U3>,
    translation: Matrix<f64, U3, U1, <DefaultAllocator as Allocator<f64, U3, U1>>::Buffer>
) -> RelativeCameraPose
[src]

Create the pose from rotation and translation.

pub fn essential_matrix(&self) -> EssentialMatrix[src]

Generates an essential matrix corresponding to this relative camera pose.

If a point a is transformed using [RelativeCameraPose::transform] into a point b, then the essential matrix returned by this method will give a residual of approximately 0.0 when you call essential.residual(&FeatureMatch(a, b)).

See the documentation of EssentialMatrix for more information.

pub fn inverse(&self) -> RelativeCameraPose[src]

Inverses the pose such that it now swaps which camera it is transfering from and to.

Methods from Deref<Target = Isometry<f64, U3, Rotation<f64, U3>>>

#[must_use = "Did you mean to use inverse_mut()?"]pub fn inverse(&self) -> Isometry<N, D, R>[src]

Inverts self.

Example

let iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let inv = iso.inverse();
let pt = Point2::new(1.0, 2.0);

assert_eq!(inv * (iso * pt), pt);

pub fn inverse_mut(&mut self)[src]

Inverts self in-place.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let pt = Point2::new(1.0, 2.0);
let transformed_pt = iso * pt;
iso.inverse_mut();

assert_eq!(iso * transformed_pt, pt);

pub fn append_translation_mut(&mut self, t: &Translation<N, D>)[src]

Appends to self the given translation in-place.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let tra = Translation2::new(3.0, 4.0);
// Same as `iso = tra * iso`.
iso.append_translation_mut(&tra);

assert_eq!(iso.translation, Translation2::new(4.0, 6.0));

pub fn append_rotation_mut(&mut self, r: &R)[src]

Appends to self the given rotation in-place.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::PI / 6.0);
let rot = UnitComplex::new(f32::consts::PI / 2.0);
// Same as `iso = rot * iso`.
iso.append_rotation_mut(&rot);

assert_relative_eq!(iso, Isometry2::new(Vector2::new(-2.0, 1.0), f32::consts::PI * 2.0 / 3.0), epsilon = 1.0e-6);

pub fn append_rotation_wrt_point_mut(&mut self, r: &R, p: &Point<N, D>)[src]

Appends in-place to self a rotation centered at the point p, i.e., the rotation that lets p invariant.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let rot = UnitComplex::new(f32::consts::FRAC_PI_2);
let pt = Point2::new(1.0, 0.0);
iso.append_rotation_wrt_point_mut(&rot, &pt);

assert_relative_eq!(iso * pt, Point2::new(-2.0, 0.0), epsilon = 1.0e-6);

pub fn append_rotation_wrt_center_mut(&mut self, r: &R)[src]

Appends in-place to self a rotation centered at the point with coordinates self.translation.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let rot = UnitComplex::new(f32::consts::FRAC_PI_2);
iso.append_rotation_wrt_center_mut(&rot);

// The translation part should not have changed.
assert_eq!(iso.translation.vector, Vector2::new(1.0, 2.0));
assert_eq!(iso.rotation, UnitComplex::new(f32::consts::PI));

pub fn transform_point(&self, pt: &Point<N, D>) -> Point<N, D>[src]

Transform the given point by this isometry.

This is the same as the multiplication self * pt.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.transform_point(&Point3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Point3::new(3.0, 2.0, 2.0), epsilon = 1.0e-6);

pub fn transform_vector(
    &self,
    v: &Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D, U1>>::Buffer>
) -> Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D, U1>>::Buffer>
[src]

Transform the given vector by this isometry, ignoring the translation component of the isometry.

This is the same as the multiplication self * v.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.transform_vector(&Vector3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Vector3::new(3.0, 2.0, -1.0), epsilon = 1.0e-6);

pub fn inverse_transform_point(&self, pt: &Point<N, D>) -> Point<N, D>[src]

Transform the given point by the inverse of this isometry. This may be less expensive than computing the entire isometry inverse and then transforming the point.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.inverse_transform_point(&Point3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Point3::new(0.0, 2.0, 1.0), epsilon = 1.0e-6);

pub fn inverse_transform_vector(
    &self,
    v: &Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D, U1>>::Buffer>
) -> Matrix<N, D, U1, <DefaultAllocator as Allocator<N, D, U1>>::Buffer>
[src]

Transform the given vector by the inverse of this isometry, ignoring the translation component of the isometry. This may be less expensive than computing the entire isometry inverse and then transforming the point.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.inverse_transform_vector(&Vector3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Vector3::new(-3.0, 2.0, 1.0), epsilon = 1.0e-6);

pub fn to_homogeneous(
    &self
) -> Matrix<N, <D as DimNameAdd<U1>>::Output, <D as DimNameAdd<U1>>::Output, <DefaultAllocator as Allocator<N, <D as DimNameAdd<U1>>::Output, <D as DimNameAdd<U1>>::Output>>::Buffer> where
    D: DimNameAdd<U1>,
    R: SubsetOf<Matrix<N, <D as DimNameAdd<U1>>::Output, <D as DimNameAdd<U1>>::Output, <DefaultAllocator as Allocator<N, <D as DimNameAdd<U1>>::Output, <D as DimNameAdd<U1>>::Output>>::Buffer>>,
    DefaultAllocator: Allocator<N, <D as DimNameAdd<U1>>::Output, <D as DimNameAdd<U1>>::Output>, 
[src]

Converts this isometry into its equivalent homogeneous transformation matrix.

Example

let iso = Isometry2::new(Vector2::new(10.0, 20.0), f32::consts::FRAC_PI_6);
let expected = Matrix3::new(0.8660254, -0.5,      10.0,
                            0.5,       0.8660254, 20.0,
                            0.0,       0.0,       1.0);

assert_relative_eq!(iso.to_homogeneous(), expected, epsilon = 1.0e-6);

Trait Implementations

impl AsMut<Isometry<f64, U3, Rotation<f64, U3>>> for RelativeCameraPose[src]

impl AsMut<RelativeCameraPose> for UnscaledRelativeCameraPose[src]

impl AsRef<Isometry<f64, U3, Rotation<f64, U3>>> for RelativeCameraPose[src]

impl AsRef<RelativeCameraPose> for UnscaledRelativeCameraPose[src]

impl Clone for RelativeCameraPose[src]

impl Copy for RelativeCameraPose[src]

impl Debug for RelativeCameraPose[src]

impl Deref for RelativeCameraPose[src]

type Target = Isometry<f64, U3, Rotation<f64, U3>>

The resulting type after dereferencing.

impl DerefMut for RelativeCameraPose[src]

impl From<Isometry<f64, U3, Rotation<f64, U3>>> for RelativeCameraPose[src]

impl From<RelativeCameraPose> for UnscaledRelativeCameraPose[src]

impl From<RelativeCameraPose> for Isometry<f64, U3, Rotation<f64, U3>>[src]

impl From<UnscaledRelativeCameraPose> for RelativeCameraPose[src]

impl PartialEq<RelativeCameraPose> for RelativeCameraPose[src]

impl Pose for RelativeCameraPose[src]

type InputPoint = CameraPoint

type OutputPoint = CameraPoint

impl StructuralPartialEq for RelativeCameraPose[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: PartialEq<T> + Copy + Any + Debug
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,