Skip to main content

Camera

Struct Camera 

Source
pub struct Camera {
    pub camera_id: CameraId,
    pub model: CameraModelKind,
    pub width: u64,
    pub height: u64,
    pub params: Vec<f64>,
    pub focal_from_prior: bool,
}
Expand description

카메라(내부 파라미터). focal_from_prior 는 메모리 전용(모델 파일에 저장 안 됨).

Fields§

§camera_id: CameraId

카메라 id.

§model: CameraModelKind

카메라 모델.

§width: u64

영상 너비(픽셀).

§height: u64

영상 높이(픽셀).

§params: Vec<f64>

모델 파라미터(순서는 CameraModelKind::params_info).

§focal_from_prior: bool

초점이 EXIF 등 사전 정보에서 왔는지(보정 경로 선택용).

Implementations§

Source§

impl Camera

Source

pub fn new( camera_id: CameraId, model: CameraModelKind, width: u64, height: u64, params: Vec<f64>, ) -> Result<Self>

파라미터 개수를 검증해 생성.

Source

pub fn from_focal( model: CameraModelKind, focal: f64, width: u64, height: u64, ) -> Self

초점 f 로 초기화: 초점 = f, 주점 = (W/2, H/2), 왜곡 0.

Source

pub fn verify_params(&self) -> bool

파라미터 개수가 모델과 맞는지.

Source

pub fn mean_focal(&self) -> f64

평균 초점거리.

Source

pub fn focal_length_x(&self) -> f64

x 초점거리.

Source

pub fn focal_length_y(&self) -> f64

y 초점거리(단일 초점 모델이면 x 와 같음).

Source

pub fn set_focal_length(&mut self, f: f64)

모든 초점 파라미터를 f 로 설정.

Source

pub fn principal_point_x(&self) -> f64

주점 x.

Source

pub fn principal_point_y(&self) -> f64

주점 y.

Source

pub fn set_principal_point(&mut self, cx: f64, cy: f64)

주점 설정.

Source

pub fn extra_params(&self) -> Vec<f64>

왜곡(추가) 파라미터 복사본.

Source

pub fn is_undistorted(&self) -> bool

왜곡 없음 판정: 추가 파라미터가 모두 0.

Source

pub fn calibration_matrix(&self) -> Mat3

보정 행렬 K (왜곡 무시).

Source

pub fn has_implausible_params( &self, min_focal_ratio: f64, max_focal_ratio: f64, max_extra_param: f64, ) -> bool

비정상 파라미터 판정.

Source

pub fn rescale(&mut self, scale: f64)

균일 크기 조정: 초점·주점에 s 곱, 크기는 반올림. 왜곡 계수 불변.

Source

pub fn rescale_to(&mut self, new_width: u64, new_height: u64)

새 크기로 조정: 축별 sx = W’/W, sy = H’/H 를 초점·주점에 곱함.

Source

pub fn img_to_cam_threshold(&self, threshold_px: f64) -> f64

픽셀 오차 임계를 정규화 평면 임계로: τ / 평균 초점.

Source

pub fn normalized_to_img(&self, uv: &Vec2) -> Vec2

정규화 평면 (u, v) → 픽셀 (왜곡 포함).

Source

pub fn cam_to_img(&self, xc: &Vec3) -> Option<Vec2>

카메라 좌표 3D 점 → 픽셀. Z < f64 ε 이면 None.

Source

pub fn img_to_normalized(&self, xy: &Vec2) -> Option<Vec2>

픽셀 → 정규화 평면(왜곡 제거). 뉴턴 100회 내 미수렴이면 None.

Source

pub fn img_to_ray(&self, xy: &Vec2) -> Option<Vec3>

픽셀 → 단위 광선 (u, v, 1)/‖·‖.

Source

pub fn cam_to_img_with_jacobian( &self, xc: &Vec3, d_params: Option<&mut [f64]>, ) -> Option<(Vec2, Matrix2x3<f64>)>

투영과 해석적 야코비안.

반환: (픽셀, ∂픽셀/∂카메라좌표 2×3). d_params 가 주어지면 행 우선 2×num_params (첫 행 = x, 둘째 행 = y, 열 = 파라미터 순서)로 ∂픽셀/∂파라미터를 채운다. Z < ε 이면 None (BA 는 이때 잔차·야코비안 0 으로 둔다).

Trait Implementations§

Source§

impl Clone for Camera

Source§

fn clone(&self) -> Self

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 Debug for Camera

Source§

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

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

impl PartialEq for Camera

Source§

fn eq(&self, other: &Self) -> 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 Camera

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<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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.