pub struct DistortionFixMask {
pub k1: bool,
pub k2: bool,
pub k3: bool,
pub p1: bool,
pub p2: bool,
}Expand description
Mask for fixing distortion parameters during optimization.
Supports Brown-Conrady distortion model with:
- Radial coefficients: k1, k2, k3
- Tangential coefficients: p1, p2
Set a field to true to keep that parameter fixed during optimization.
§Default
By default, k3 is fixed because it often causes overfitting with
typical calibration data. Only enable k3 optimization for wide-angle
lenses or with high-quality calibration data.
§Example
use vision_calibration_core::DistortionFixMask;
// Default: k3 fixed, others free
let mask = DistortionFixMask::default();
assert!(!mask.k1);
assert!(mask.k3); // k3 fixed by default
// Fix tangential distortion
let mask = DistortionFixMask {
p1: true,
p2: true,
..Default::default()
};Fields§
§k1: boolFix first radial distortion coefficient.
k2: boolFix second radial distortion coefficient.
k3: boolFix third radial distortion coefficient (fixed by default).
p1: boolFix first tangential distortion coefficient.
p2: boolFix second tangential distortion coefficient.
Implementations§
Source§impl DistortionFixMask
impl DistortionFixMask
Sourcepub fn radial_only() -> Self
pub fn radial_only() -> Self
Create a mask that only allows radial distortion (k1, k2) to be optimized.
Fixes k3, p1, p2 - useful for standard lenses with minimal tangential distortion.
Sourcepub fn all_are_fixed(&self) -> bool
pub fn all_are_fixed(&self) -> bool
Returns true if all parameters are fixed.
Sourcepub fn to_indices(&self) -> Vec<usize>
pub fn to_indices(&self) -> Vec<usize>
Convert to a vector of fixed indices (for IR FixedMask).
Index mapping: k1=0, k2=1, k3=2, p1=3, p2=4
Trait Implementations§
Source§impl Clone for DistortionFixMask
impl Clone for DistortionFixMask
Source§fn clone(&self) -> DistortionFixMask
fn clone(&self) -> DistortionFixMask
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DistortionFixMask
impl Debug for DistortionFixMask
Source§impl Default for DistortionFixMask
impl Default for DistortionFixMask
Source§impl<'de> Deserialize<'de> for DistortionFixMask
impl<'de> Deserialize<'de> for DistortionFixMask
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DistortionFixMask
impl PartialEq for DistortionFixMask
Source§impl Serialize for DistortionFixMask
impl Serialize for DistortionFixMask
impl Copy for DistortionFixMask
impl Eq for DistortionFixMask
impl StructuralPartialEq for DistortionFixMask
Auto Trait Implementations§
impl Freeze for DistortionFixMask
impl RefUnwindSafe for DistortionFixMask
impl Send for DistortionFixMask
impl Sync for DistortionFixMask
impl Unpin for DistortionFixMask
impl UnsafeUnpin for DistortionFixMask
impl UnwindSafe for DistortionFixMask
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.