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
impl Camera
Sourcepub fn new(
camera_id: CameraId,
model: CameraModelKind,
width: u64,
height: u64,
params: Vec<f64>,
) -> Result<Self>
pub fn new( camera_id: CameraId, model: CameraModelKind, width: u64, height: u64, params: Vec<f64>, ) -> Result<Self>
파라미터 개수를 검증해 생성.
Sourcepub fn from_focal(
model: CameraModelKind,
focal: f64,
width: u64,
height: u64,
) -> Self
pub fn from_focal( model: CameraModelKind, focal: f64, width: u64, height: u64, ) -> Self
초점 f 로 초기화: 초점 = f, 주점 = (W/2, H/2), 왜곡 0.
Sourcepub fn verify_params(&self) -> bool
pub fn verify_params(&self) -> bool
파라미터 개수가 모델과 맞는지.
Sourcepub fn mean_focal(&self) -> f64
pub fn mean_focal(&self) -> f64
평균 초점거리.
Sourcepub fn focal_length_x(&self) -> f64
pub fn focal_length_x(&self) -> f64
x 초점거리.
Sourcepub fn focal_length_y(&self) -> f64
pub fn focal_length_y(&self) -> f64
y 초점거리(단일 초점 모델이면 x 와 같음).
Sourcepub fn set_focal_length(&mut self, f: f64)
pub fn set_focal_length(&mut self, f: f64)
모든 초점 파라미터를 f 로 설정.
Sourcepub fn principal_point_x(&self) -> f64
pub fn principal_point_x(&self) -> f64
주점 x.
Sourcepub fn principal_point_y(&self) -> f64
pub fn principal_point_y(&self) -> f64
주점 y.
Sourcepub fn set_principal_point(&mut self, cx: f64, cy: f64)
pub fn set_principal_point(&mut self, cx: f64, cy: f64)
주점 설정.
Sourcepub fn extra_params(&self) -> Vec<f64>
pub fn extra_params(&self) -> Vec<f64>
왜곡(추가) 파라미터 복사본.
Sourcepub fn is_undistorted(&self) -> bool
pub fn is_undistorted(&self) -> bool
왜곡 없음 판정: 추가 파라미터가 모두 0.
Sourcepub fn calibration_matrix(&self) -> Mat3
pub fn calibration_matrix(&self) -> Mat3
보정 행렬 K (왜곡 무시).
Sourcepub fn has_implausible_params(
&self,
min_focal_ratio: f64,
max_focal_ratio: f64,
max_extra_param: f64,
) -> bool
pub fn has_implausible_params( &self, min_focal_ratio: f64, max_focal_ratio: f64, max_extra_param: f64, ) -> bool
비정상 파라미터 판정.
Sourcepub fn rescale_to(&mut self, new_width: u64, new_height: u64)
pub fn rescale_to(&mut self, new_width: u64, new_height: u64)
새 크기로 조정: 축별 sx = W’/W, sy = H’/H 를 초점·주점에 곱함.
Sourcepub fn img_to_cam_threshold(&self, threshold_px: f64) -> f64
pub fn img_to_cam_threshold(&self, threshold_px: f64) -> f64
픽셀 오차 임계를 정규화 평면 임계로: τ / 평균 초점.
Sourcepub fn normalized_to_img(&self, uv: &Vec2) -> Vec2
pub fn normalized_to_img(&self, uv: &Vec2) -> Vec2
정규화 평면 (u, v) → 픽셀 (왜곡 포함).
Sourcepub fn cam_to_img(&self, xc: &Vec3) -> Option<Vec2>
pub fn cam_to_img(&self, xc: &Vec3) -> Option<Vec2>
카메라 좌표 3D 점 → 픽셀. Z < f64 ε 이면 None.
Sourcepub fn img_to_normalized(&self, xy: &Vec2) -> Option<Vec2>
pub fn img_to_normalized(&self, xy: &Vec2) -> Option<Vec2>
픽셀 → 정규화 평면(왜곡 제거). 뉴턴 100회 내 미수렴이면 None.
Sourcepub fn img_to_ray(&self, xy: &Vec2) -> Option<Vec3>
pub fn img_to_ray(&self, xy: &Vec2) -> Option<Vec3>
픽셀 → 단위 광선 (u, v, 1)/‖·‖.
Trait Implementations§
impl StructuralPartialEq for Camera
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnsafeUnpin for Camera
impl UnwindSafe for Camera
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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.