pub struct SquareGridHomographyMesh<F: Float = f32> {
pub min_i: i32,
pub min_j: i32,
pub cells_x: usize,
pub cells_y: usize,
pub px_per_cell: F,
pub valid_cells: usize,
pub rect_width: usize,
pub rect_height: usize,
/* private fields */
}Expand description
Per-cell homography mesh over a 2D grid.
Maps between a rectified coordinate system (uniform grid spacing) and the original image coordinates, using one homography per grid cell.
Fields§
§min_i: i32Minimum grid index (corner space).
min_j: i32Minimum grid index (corner space).
cells_x: usizeNumber of cells (squares) horizontally.
cells_y: usizeNumber of cells (squares) vertically.
px_per_cell: FRectified pixels per grid cell.
valid_cells: usizeNumber of cells that have all 4 corners and a valid homography.
rect_width: usizeWidth of the rectified image in pixels.
rect_height: usizeHeight of the rectified image in pixels.
Implementations§
Source§impl<F: Float> SquareGridHomographyMesh<F>
impl<F: Float> SquareGridHomographyMesh<F>
Sourcepub fn from_corners(
corners: &HashMap<GridCoords, Point2<F>>,
px_per_cell: F,
) -> Result<Self, GridMeshError>
pub fn from_corners( corners: &HashMap<GridCoords, Point2<F>>, px_per_cell: F, ) -> Result<Self, GridMeshError>
Build per-cell homographies from a grid corner map.
corners: map from grid index to image position.px_per_cell: rectified pixels per grid cell.
Equivalent to Self::from_corners_with_min_singular_value with
F::zero() — every cell whose four corners are present and whose
homography solves successfully is accepted, regardless of
conditioning.
Sourcepub fn from_corners_with_min_singular_value(
corners: &HashMap<GridCoords, Point2<F>>,
px_per_cell: F,
min_singular_value: F,
) -> Result<Self, GridMeshError>
pub fn from_corners_with_min_singular_value( corners: &HashMap<GridCoords, Point2<F>>, px_per_cell: F, min_singular_value: F, ) -> Result<Self, GridMeshError>
Variant of Self::from_corners that skips cells whose homography
is ill-conditioned.
A cell is treated as invalid (a “hole”) when the smallest singular
value of its 3×3 homography matrix falls below
min_singular_value. The threshold is in the same units as the
matrix entries; for the standard (grid_corner_space → image_pixels)
fit, a threshold around 1e-3 × px_per_cell rejects cells where
three of the four corners are nearly collinear in pixel space.
Cells skipped this way are silently ignored, exactly like cells
missing one or more corners. The error variant
GridMeshError::HomographyFailed is still returned only when the
underlying solver fails — a strictly different failure mode from
“the solver succeeded but the result is degenerate”.
Sourcepub fn rect_to_img(&self, p_rect: Point2<F>) -> Option<Point2<F>>
pub fn rect_to_img(&self, p_rect: Point2<F>) -> Option<Point2<F>>
Map a point in global rectified pixel coordinates to image coordinates.
Returns None if the point lies outside the mesh or the cell is invalid.
Sourcepub fn cell_quality(&self, ci: usize, cj: usize) -> Option<HomographyQuality<F>>
pub fn cell_quality(&self, ci: usize, cj: usize) -> Option<HomographyQuality<F>>
Per-cell homography quality, or None when the cell is missing or
outside the mesh. Returns the quality even for cells marked invalid
by the conditioning gate so callers can introspect why a cell was
rejected.
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for SquareGridHomographyMesh<F>where
F: Freeze,
impl<F> RefUnwindSafe for SquareGridHomographyMesh<F>where
F: RefUnwindSafe,
impl<F> Send for SquareGridHomographyMesh<F>
impl<F> Sync for SquareGridHomographyMesh<F>
impl<F> Unpin for SquareGridHomographyMesh<F>where
F: Unpin,
impl<F> UnsafeUnpin for SquareGridHomographyMesh<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for SquareGridHomographyMesh<F>where
F: UnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
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.