pub struct SubPixelRefiner {
pub half_window: usize,
pub max_iterations: usize,
pub epsilon: f64,
}Expand description
Sub-pixel corner refinement using parabolic fitting.
After FAST detects corners at integer-pixel positions, this refiner fits a 2-D parabola to the corner response in a small neighbourhood and finds the sub-pixel maximum. This improves localisation accuracy from ~0.5 px to ~0.05 px, which is critical for high-quality homography estimation and camera calibration.
Fields§
§half_window: usizeHalf-size of the refinement window.
max_iterations: usizeMaximum number of Newton iterations.
epsilon: f64Convergence threshold (pixels).
Implementations§
Source§impl SubPixelRefiner
impl SubPixelRefiner
Sourcepub fn new(half_window: usize, max_iterations: usize, epsilon: f64) -> Self
pub fn new(half_window: usize, max_iterations: usize, epsilon: f64) -> Self
Create a new sub-pixel refiner.
Sourcepub fn refine(
&self,
image: &[u8],
width: usize,
height: usize,
keypoints: &[Keypoint],
) -> AlignResult<Vec<Keypoint>>
pub fn refine( &self, image: &[u8], width: usize, height: usize, keypoints: &[Keypoint], ) -> AlignResult<Vec<Keypoint>>
Refine a set of keypoint positions to sub-pixel accuracy.
Uses a quadratic surface fit: within the window around each keypoint,
fit I(x,y) = a*x^2 + b*y^2 + c*x*y + d*x + e*y + f and find the
extremum at (-dI/dx, -dI/dy) / Hessian. This works for both
corners and peaks/blobs, unlike the structure tensor method which
only converges for true corners.
Keypoints too close to the image border are left unmodified.
§Errors
Returns an error if the image dimensions are invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SubPixelRefiner
impl RefUnwindSafe for SubPixelRefiner
impl Send for SubPixelRefiner
impl Sync for SubPixelRefiner
impl Unpin for SubPixelRefiner
impl UnsafeUnpin for SubPixelRefiner
impl UnwindSafe for SubPixelRefiner
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> 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>
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>
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
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.