Skip to main content

correspond

Function correspond 

Source
pub fn correspond(
    photo1: impl Into<Arc<Photo>>,
    photo2: impl Into<Arc<Photo>>,
) -> Result<Correspondence, Error>
Expand description

Maps two photos onto each other with every default.

Shorthand for Correspondence::builder().run(photo1, photo2).

ยงErrors

As Builder::run.

Examples found in repository?
examples/lookup.rs (line 19)
16fn main() -> Result<(), pixelmap::Error> {
17    let (photo1, photo2) = shifted_pair();
18
19    let mapping = correspond(photo1, photo2)?;
20    println!(
21        "mapped {:.1}% of the image in {} comparisons",
22        mapping.coverage() * 100.0,
23        mapping.comparisons()
24    );
25    println!("working scale: {:.3}", mapping.working_scale());
26    println!("\n  point        maps to        (expected)");
27
28    for (x, y) in [(40.0, 40.0), (120.0, 90.0), (200.0, 140.0)] {
29        match mapping.lookup(x, y) {
30            Some((mx, my)) => println!(
31                "  ({x:5.0},{y:5.0}) -> ({mx:6.1},{my:6.1})   ({:6.1},{:6.1})",
32                x - SHIFT as f32,
33                y - SHIFT as f32
34            ),
35            None => println!("  ({x:5.0},{y:5.0}) -> unmapped"),
36        }
37    }
38
39    Ok(())
40}