Struct sophus_sensor::camera::Camera

source ·
pub struct Camera<S: IsScalar<BATCH>, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort: IsCameraDistortionImpl<S, DISTORT, PARAMS, BATCH>, Proj: IsProjection<S, BATCH>> { /* private fields */ }
Expand description

A generic camera model

Implementations§

source§

impl<S: IsScalar<BATCH>, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort: IsCameraDistortionImpl<S, DISTORT, PARAMS, BATCH>, Proj: IsProjection<S, BATCH>> Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>

source

pub fn new(params: &S::Vector<PARAMS>, image_size: ImageSize) -> Self

Creates a new camera

source

pub fn from_params_and_size(params: &S::Vector<PARAMS>, size: ImageSize) -> Self

Creates a new camera from parameters and image size

source

pub fn image_size(&self) -> ImageSize

Returns the image size

source

pub fn distort( &self, proj_point_in_camera_z1_plane: &S::Vector<2>, ) -> S::Vector<2>

Distortion - maps a point in the camera z=1 plane to a distorted point

source

pub fn undistort(&self, pixel: &S::Vector<2>) -> S::Vector<2>

Undistortion - maps a distorted pixel to a point in the camera z=1 plane

source

pub fn dx_distort_x( &self, proj_point_in_camera_z1_plane: &S::Vector<2>, ) -> S::Matrix<2, 2>

Derivative of the distortion w.r.t. the point in the camera z=1 plane

source

pub fn cam_proj(&self, point_in_camera: &S::Vector<3>) -> S::Vector<2>

Projects a 3D point in the camera frame to a pixel in the image

source

pub fn cam_unproj(&self, point_in_camera: &S::Vector<2>) -> S::Vector<3>

Unprojects a pixel in the image to a 3D point in the camera frame - assuming z=1

source

pub fn cam_unproj_with_z( &self, point_in_camera: &S::Vector<2>, z: S, ) -> S::Vector<3>

Unprojects a pixel in the image to a 3D point in the camera frame

source

pub fn set_params(&mut self, params: &S::Vector<PARAMS>)

Sets the camera parameters

source

pub fn params(&self) -> &S::Vector<PARAMS>

Returns the camera parameters

source

pub fn is_empty(&self) -> bool

Returns true if the camera is empty

source

pub fn params_examples() -> Vec<S::Vector<PARAMS>>

Examples of valid parameters

source

pub fn invalid_params_examples() -> Vec<S::Vector<PARAMS>>

Examples of invalid parameters

Trait Implementations§

source§

impl<S: Clone + IsScalar<BATCH>, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort: Clone + IsCameraDistortionImpl<S, DISTORT, PARAMS, BATCH>, Proj: Clone + IsProjection<S, BATCH>> Clone for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where S::Vector<PARAMS>: Clone,

source§

fn clone(&self) -> Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug + IsScalar<BATCH>, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort: Debug + IsCameraDistortionImpl<S, DISTORT, PARAMS, BATCH>, Proj: Debug + IsProjection<S, BATCH>> Debug for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where S::Vector<PARAMS>: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: IsScalar<BATCH>, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort: IsCameraDistortionImpl<S, DISTORT, PARAMS, BATCH>, Proj: IsProjection<S, BATCH>> Default for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<S: Copy + IsScalar<BATCH>, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort: Copy + IsCameraDistortionImpl<S, DISTORT, PARAMS, BATCH>, Proj: Copy + IsProjection<S, BATCH>> Copy for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where S::Vector<PARAMS>: Copy,

Auto Trait Implementations§

§

impl<S, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort, Proj> Freeze for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where <S as IsScalar<BATCH>>::Vector<PARAMS>: Freeze,

§

impl<S, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort, Proj> RefUnwindSafe for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where <S as IsScalar<BATCH>>::Vector<PARAMS>: RefUnwindSafe, Distort: RefUnwindSafe, Proj: RefUnwindSafe,

§

impl<S, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort, Proj> Send for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where <S as IsScalar<BATCH>>::Vector<PARAMS>: Send, Distort: Send, Proj: Send,

§

impl<S, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort, Proj> Sync for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where <S as IsScalar<BATCH>>::Vector<PARAMS>: Sync, Distort: Sync, Proj: Sync,

§

impl<S, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort, Proj> Unpin for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where <S as IsScalar<BATCH>>::Vector<PARAMS>: Unpin, Distort: Unpin, Proj: Unpin,

§

impl<S, const DISTORT: usize, const PARAMS: usize, const BATCH: usize, Distort, Proj> UnwindSafe for Camera<S, DISTORT, PARAMS, BATCH, Distort, Proj>
where <S as IsScalar<BATCH>>::Vector<PARAMS>: UnwindSafe, Distort: UnwindSafe, Proj: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

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

source§

fn vzip(self) -> V