pub struct FThetaCamera {
pub cx: f64,
pub cy: f64,
pub distortion: DistortionModel,
}Expand description
NVIDIA f-theta fisheye camera with 6 intrinsic parameters.
Stores the principal point (cx, cy) and the four forward-polynomial coefficients k₁…k₄. The model is isotropic (no separate fx/fy).
Fields§
§cx: f64Principal point x (u₀ in the paper), pixels.
cy: f64Principal point y (v₀ in the paper), pixels.
distortion: DistortionModelForward-polynomial distortion — must be DistortionModel::FTheta.
Implementations§
Source§impl FThetaCamera
impl FThetaCamera
Sourcepub fn new(
cx: f64,
cy: f64,
distortion: DistortionModel,
) -> Result<Self, CameraModelError>
pub fn new( cx: f64, cy: f64, distortion: DistortionModel, ) -> Result<Self, CameraModelError>
Creates a new f-theta camera.
§Errors
Returns CameraModelError::InvalidParams if distortion is not
DistortionModel::FTheta, or if any parameter fails validation.
§Example
use apex_camera_models::{CameraModel, DistortionModel, FThetaCamera};
let distortion = DistortionModel::FTheta { k1: 500.0, k2: 0.0, k3: 0.0, k4: 0.0 };
let camera = FThetaCamera::new(320.0, 240.0, distortion)?;
assert_eq!(camera.get_model_name(), "ftheta");Sourcepub fn try_from_params(params: &[f64]) -> Result<Self, CameraModelError>
pub fn try_from_params(params: &[f64]) -> Result<Self, CameraModelError>
Build directly from the six scalar parameters [cx, cy, k1, k2, k3, k4].
Sourcepub fn distortion_params(&self) -> (f64, f64, f64, f64)
pub fn distortion_params(&self) -> (f64, f64, f64, f64)
Extract (k1, k2, k3, k4) from the stored distortion.
§Panics
Panics if self.distortion is not DistortionModel::FTheta — this
cannot happen after successful construction.
Sourcepub fn linear_estimation(
&self,
points_3d: &Matrix3xX<f64>,
points_2d: &Matrix2xX<f64>,
) -> Result<Self, CameraModelError>
pub fn linear_estimation( &self, points_3d: &Matrix3xX<f64>, points_2d: &Matrix2xX<f64>, ) -> Result<Self, CameraModelError>
Least-squares estimation of k₁..k₄ given 3D-2D correspondences, assuming cx and cy are already known.
Constructs a Vandermonde system [θ θ² θ³ θ⁴] · [k₁ k₂ k₃ k₄]ᵀ = r
and solves it with SVD (nalgebra full-pivoting).
Returns an updated FThetaCamera with the estimated polynomial
coefficients. The principal point is unchanged.
§Arguments
points_3d— 3×N matrix of 3D points in camera framepoints_2d— 2×N matrix of observed pixel coordinates
Trait Implementations§
Source§impl CameraModel for FThetaCamera
impl CameraModel for FThetaCamera
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 project(
&self,
p_cam: &Vector3<f64>,
) -> Result<Vector2<f64>, CameraModelError>
fn project( &self, p_cam: &Vector3<f64>, ) -> Result<Vector2<f64>, CameraModelError>
Source§fn unproject(
&self,
point_2d: &Vector2<f64>,
) -> Result<Vector3<f64>, CameraModelError>
fn unproject( &self, point_2d: &Vector2<f64>, ) -> Result<Vector3<f64>, CameraModelError>
Source§fn jacobian_point(&self, p_cam: &Vector3<f64>) -> Self::PointJacobian
fn jacobian_point(&self, p_cam: &Vector3<f64>) -> Self::PointJacobian
Source§fn jacobian_intrinsics(&self, p_cam: &Vector3<f64>) -> Self::IntrinsicJacobian
fn jacobian_intrinsics(&self, p_cam: &Vector3<f64>) -> Self::IntrinsicJacobian
N = INTRINSIC_DIM. The parameter order is
model-specific; see the per-model cookbook page.Source§fn validate_params(&self) -> Result<(), CameraModelError>
fn validate_params(&self) -> Result<(), CameraModelError>
Source§fn get_pinhole_params(&self) -> PinholeParams
fn get_pinhole_params(&self) -> PinholeParams
(f_x, f_y, c_x, c_y).Source§fn get_distortion(&self) -> DistortionModel
fn get_distortion(&self) -> DistortionModel
Source§fn get_model_name(&self) -> &'static str
fn get_model_name(&self) -> &'static str
"pinhole", "rad_tan", …).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 FThetaCamera
impl Clone for FThetaCamera
Source§fn clone(&self) -> FThetaCamera
fn clone(&self) -> FThetaCamera
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 FThetaCamera
Source§impl Debug for FThetaCamera
impl Debug for FThetaCamera
Source§impl From<&FThetaCamera> for [f64; 6]
Parameter order: [cx, cy, k1, k2, k3, k4].
impl From<&FThetaCamera> for [f64; 6]
Parameter order: [cx, cy, k1, k2, k3, k4].
Source§fn from(cam: &FThetaCamera) -> Self
fn from(cam: &FThetaCamera) -> Self
Source§impl From<&FThetaCamera> for DVector<f64>
impl From<&FThetaCamera> for DVector<f64>
Source§fn from(cam: &FThetaCamera) -> Self
fn from(cam: &FThetaCamera) -> Self
Source§impl PartialEq for FThetaCamera
impl PartialEq for FThetaCamera
impl StructuralPartialEq for FThetaCamera
Auto Trait Implementations§
impl Freeze for FThetaCamera
impl RefUnwindSafe for FThetaCamera
impl Send for FThetaCamera
impl Sync for FThetaCamera
impl Unpin for FThetaCamera
impl UnsafeUnpin for FThetaCamera
impl UnwindSafe for FThetaCamera
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.