Skip to main content

DoubleSphereCamera

Struct DoubleSphereCamera 

Source
pub struct DoubleSphereCamera {
    pub pinhole: PinholeParams,
    pub distortion: DistortionModel,
}
Expand description

Double Sphere camera model with 6 parameters.

Fields§

§pinhole: PinholeParams§distortion: DistortionModel

Implementations§

Source§

impl DoubleSphereCamera

Source

pub fn new( pinhole: PinholeParams, distortion: DistortionModel, ) -> Result<Self, CameraModelError>

Creates a new Double Sphere camera.

§Errors

Returns CameraModelError::InvalidParams if distortion is not DistortionModel::DoubleSphere, or if validation fails (e.g. non-positive focal length, alpha out of range).

§Example
use apex_camera_models::{CameraModel, DistortionModel, DoubleSphereCamera, PinholeParams};

let pinhole = PinholeParams::new(300.0, 300.0, 320.0, 240.0)?;
let distortion = DistortionModel::DoubleSphere { xi: -0.2, alpha: 0.6 };
let camera = DoubleSphereCamera::new(pinhole, distortion)?;
assert_eq!(camera.get_model_name(), "double_sphere");
Source

pub fn linear_estimation( &mut self, points_3d: &Matrix3xX<f64>, points_2d: &Matrix2xX<f64>, ) -> Result<(), CameraModelError>

Estimates the alpha parameter via linear least-squares given 3D–2D correspondences. xi is reset to 0.0. Requires the intrinsics [fx, fy, cx, cy] to already be set; needs at least 1 correspondence.

Trait Implementations§

Source§

impl CameraModel for DoubleSphereCamera

Source§

fn project( &self, p_cam: &Vector3<f64>, ) -> Result<Vector2<f64>, CameraModelError>

Projects a 3D point in the camera frame to 2D image coordinates. Returns CameraModelError::PointBehindCamera / PointOutsideImage if the point violates the model’s domain (check_projection_condition).

Source§

fn unproject( &self, point_2d: &Vector2<f64>, ) -> Result<Vector3<f64>, CameraModelError>

Unprojects a 2D image point to a unit 3D ray via the double-sphere algebraic inverse. Returns CameraModelError::PointOutsideImage if the unprojection domain (check_unprojection_condition) is violated.

Source§

fn jacobian_point(&self, p_cam: &Vector3<f64>) -> Self::PointJacobian

2×3 Jacobian ∂(u,v)/∂(x,y,z). See the cookbook for the full derivation.

Source§

fn jacobian_intrinsics(&self, p_cam: &Vector3<f64>) -> Self::IntrinsicJacobian

2×6 Jacobian ∂(u,v)/∂[fx, fy, cx, cy, xi, alpha]. See the cookbook for the full derivation.

Source§

fn validate_params(&self) -> Result<(), CameraModelError>

Validates the camera parameters.

§Validation Rules
  • fx, fy must be positive (> 0) and finite
  • cx, cy must be finite
  • ξ must be finite
  • α must be in (0, 1]
§Errors

Returns CameraModelError if any rule is violated.

Source§

fn get_pinhole_params(&self) -> PinholeParams

Returns the pinhole parameters.

Source§

fn get_distortion(&self) -> DistortionModel

Returns the distortion model (must be DistortionModel::DoubleSphere).

Source§

fn get_model_name(&self) -> &'static str

Returns the model name: "double_sphere".

Source§

const INTRINSIC_DIM: usize = 6

Number of intrinsic parameters (compile-time constant).
Source§

type IntrinsicJacobian = Matrix<f64, Const<2>, Const<6>, ArrayStorage<f64, 2, 6>>

Jacobian type for intrinsics: 2 × INTRINSIC_DIM.
Source§

type PointJacobian = Matrix<f64, Const<2>, Const<3>, ArrayStorage<f64, 2, 3>>

Jacobian type for 3D point: 2 × 3.
Source§

fn jacobian_pose( &self, p_world: &Vector3<f64>, pose: &SE3, ) -> (Self::PointJacobian, SMatrix<f64, 3, 6>)

∂(u,v)/∂(δξ) — 2×6 Jacobian of projection w.r.t. the camera pose. Read more
Source§

fn project_batch(&self, points_cam: &Matrix3xX<f64>) -> Matrix2xX<f64>

Projects N 3D points in one call. Invalid projections are replaced by the sentinel (1e6, 1e6). Models may override with a vectorised implementation.
Source§

impl Clone for DoubleSphereCamera

Source§

fn clone(&self) -> DoubleSphereCamera

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for DoubleSphereCamera

Source§

impl Debug for DoubleSphereCamera

Debug formatter for DoubleSphereCamera.

Source§

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

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

impl From<&DoubleSphereCamera> for DVector<f64>

Converts the camera to a dynamic vector with layout [fx, fy, cx, cy, xi, alpha].

Source§

fn from(camera: &DoubleSphereCamera) -> Self

Converts to this type from the input type.
Source§

impl From<&DoubleSphereCamera> for [f64; 6]

Converts the camera to a fixed-size array with layout [fx, fy, cx, cy, xi, alpha].

Source§

fn from(camera: &DoubleSphereCamera) -> Self

Converts to this type from the input type.
Source§

impl From<[f64; 6]> for DoubleSphereCamera

Creates a camera from a fixed-size array with layout [fx, fy, cx, cy, xi, alpha].

Source§

fn from(params: [f64; 6]) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DoubleSphereCamera

Source§

fn eq(&self, other: &DoubleSphereCamera) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DoubleSphereCamera

Source§

impl TryFrom<&[f64]> for DoubleSphereCamera

Creates a camera from a slice with layout [fx, fy, cx, cy, xi, alpha]. Returns an error if the slice has fewer than 6 elements.

Source§

type Error = CameraModelError

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

fn try_from(params: &[f64]) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

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,

Source§

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>,

Source§

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>,

Source§

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