pub struct DoubleSphereCamera {
pub pinhole: PinholeParams,
pub distortion: DistortionModel,
}Expand description
Double Sphere camera model with 6 parameters.
Fields§
§pinhole: PinholeParams§distortion: DistortionModelImplementations§
Source§impl DoubleSphereCamera
impl DoubleSphereCamera
Sourcepub fn new(
pinhole: PinholeParams,
distortion: DistortionModel,
) -> Result<Self, CameraModelError>
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");Sourcepub fn linear_estimation(
&mut self,
points_3d: &Matrix3xX<f64>,
points_2d: &Matrix2xX<f64>,
) -> Result<(), CameraModelError>
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
impl CameraModel for DoubleSphereCamera
Source§fn project(
&self,
p_cam: &Vector3<f64>,
) -> Result<Vector2<f64>, CameraModelError>
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>
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
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
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>
fn validate_params(&self) -> Result<(), CameraModelError>
Validates the camera parameters.
§Validation Rules
fx,fymust be positive (> 0) and finitecx,cymust 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
fn get_pinhole_params(&self) -> PinholeParams
Returns the pinhole parameters.
Source§fn get_distortion(&self) -> DistortionModel
fn get_distortion(&self) -> DistortionModel
Returns the distortion model (must be DistortionModel::DoubleSphere).
Source§fn get_model_name(&self) -> &'static str
fn get_model_name(&self) -> &'static str
Returns the model name: "double_sphere".
Source§const INTRINSIC_DIM: usize = 6
const INTRINSIC_DIM: usize = 6
Source§type IntrinsicJacobian = Matrix<f64, Const<2>, Const<6>, ArrayStorage<f64, 2, 6>>
type IntrinsicJacobian = Matrix<f64, Const<2>, Const<6>, ArrayStorage<f64, 2, 6>>
Source§type PointJacobian = Matrix<f64, Const<2>, Const<3>, ArrayStorage<f64, 2, 3>>
type PointJacobian = Matrix<f64, Const<2>, Const<3>, ArrayStorage<f64, 2, 3>>
Source§fn jacobian_pose(
&self,
p_world: &Vector3<f64>,
pose: &SE3,
) -> (Self::PointJacobian, SMatrix<f64, 3, 6>)
fn jacobian_pose( &self, p_world: &Vector3<f64>, pose: &SE3, ) -> (Self::PointJacobian, SMatrix<f64, 3, 6>)
Source§impl Clone for DoubleSphereCamera
impl Clone for DoubleSphereCamera
Source§fn clone(&self) -> DoubleSphereCamera
fn clone(&self) -> DoubleSphereCamera
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DoubleSphereCamera
Source§impl Debug for DoubleSphereCamera
Debug formatter for DoubleSphereCamera.
impl Debug for DoubleSphereCamera
Debug formatter for DoubleSphereCamera.
Source§impl From<&DoubleSphereCamera> for DVector<f64>
Converts the camera to a dynamic vector with layout [fx, fy, cx, cy, xi, alpha].
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
fn from(camera: &DoubleSphereCamera) -> Self
Source§impl From<&DoubleSphereCamera> for [f64; 6]
Converts the camera to a fixed-size array with layout [fx, fy, cx, cy, xi, alpha].
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
fn from(camera: &DoubleSphereCamera) -> Self
Source§impl From<[f64; 6]> for DoubleSphereCamera
Creates a camera from a fixed-size array with layout [fx, fy, cx, cy, xi, alpha].
impl From<[f64; 6]> for DoubleSphereCamera
Creates a camera from a fixed-size array with layout [fx, fy, cx, cy, xi, alpha].
Source§impl PartialEq for DoubleSphereCamera
impl PartialEq for DoubleSphereCamera
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.
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.
Auto Trait Implementations§
impl Freeze for DoubleSphereCamera
impl RefUnwindSafe for DoubleSphereCamera
impl Send for DoubleSphereCamera
impl Sync for DoubleSphereCamera
impl Unpin for DoubleSphereCamera
impl UnsafeUnpin for DoubleSphereCamera
impl UnwindSafe for DoubleSphereCamera
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
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,
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.