pub struct PinholeCameraModel {
pub fx: f64,
pub fy: f64,
pub cx: f64,
pub cy: f64,
pub width: usize,
pub height: usize,
}Expand description
Pinhole camera intrinsic model.
§Coordinate convention
- X points right, Y points down, Z points forward (camera space).
- The image origin is at the top-left pixel centre.
Projection: u = fx * X/Z + cx, v = fy * Y/Z + cy.
Fields§
§fx: f64Focal length in pixels along the X axis.
fy: f64Focal length in pixels along the Y axis.
cx: f64Principal point X coordinate in pixels.
cy: f64Principal point Y coordinate in pixels.
width: usizeImage width in pixels.
height: usizeImage height in pixels.
Implementations§
Source§impl PinholeCameraModel
impl PinholeCameraModel
Sourcepub fn new(
fx: f64,
fy: f64,
cx: f64,
cy: f64,
width: usize,
height: usize,
) -> Self
pub fn new( fx: f64, fy: f64, cx: f64, cy: f64, width: usize, height: usize, ) -> Self
Create a new pinhole camera model.
Sourcepub fn from_calibration_matrix(
k: &[[f64; 3]; 3],
width: usize,
height: usize,
) -> Self
pub fn from_calibration_matrix( k: &[[f64; 3]; 3], width: usize, height: usize, ) -> Self
Build from a 3×3 calibration matrix K.
let k = [[800.0, 0.0, 320.0], [0.0, 800.0, 240.0], [0.0, 0.0, 1.0]];
let cam = PinholeCameraModel::from_calibration_matrix(&k, 640, 480);
assert!((cam.fx - 800.0).abs() < 1e-9);Trait Implementations§
Source§impl Clone for PinholeCameraModel
impl Clone for PinholeCameraModel
Source§fn clone(&self) -> PinholeCameraModel
fn clone(&self) -> PinholeCameraModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PinholeCameraModel
impl Debug for PinholeCameraModel
Source§impl PartialEq for PinholeCameraModel
impl PartialEq for PinholeCameraModel
impl StructuralPartialEq for PinholeCameraModel
Auto Trait Implementations§
impl Freeze for PinholeCameraModel
impl RefUnwindSafe for PinholeCameraModel
impl Send for PinholeCameraModel
impl Sync for PinholeCameraModel
impl Unpin for PinholeCameraModel
impl UnsafeUnpin for PinholeCameraModel
impl UnwindSafe for PinholeCameraModel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
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.