projective-grid 0.10.1

Image-free, target-agnostic projective grid recovery: label 2D feature points with (i, j) lattice coordinates under perspective
Documentation
use projective_grid::{
    check_consistency, ConsistencyParams, ConsistencyRequest, Coord, CoordinateHypothesis,
    LatticeKind, PointFeature,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut features = Vec::new();
    let mut hypotheses = Vec::new();
    for v in 0..3 {
        for u in 0..4 {
            let source_index = features.len();
            features.push(PointFeature::new(
                source_index,
                nalgebra::Point2::new(100.0 + u as f32 * 16.0, 80.0 + v as f32 * 16.0),
            ));
            hypotheses.push(CoordinateHypothesis::new(
                source_index,
                Coord::new(u, v),
                Some(1.0),
            ));
        }
    }

    let request = ConsistencyRequest::new(
        LatticeKind::Square,
        &features,
        &hypotheses,
        None,
        ConsistencyParams::default(),
    );
    let report = check_consistency(request)?;
    println!("passed: {}", report.passed);
    Ok(())
}