pub fn fast_corner_score(image: &GrayImage, threshold: u8, x: u32, y: u32, variant: Fast) -> u8 {
    let mut max = 255u8;
    let mut min = threshold;

    loop {
        if max == min {
            return max;
        }

        let mean = ((max as u16 + min as u16) / 2u16) as u8;
        let probe = if max == min + 1 { max } else { mean };

        let is_corner = match variant {
            Fast::Nine => is_corner_fast9(image, probe, x, y),
            Fast::Twelve => is_corner_fast12(image, probe, x, y),
        };

        if is_corner {
            min = probe;
        } else {
            max = probe - 1;
        }
    }
}
The score of a corner detected using the FAST
detector is the largest threshold for which this
pixel is still a corner. We input the threshold at which
the corner was detected as a lower bound on the search.
Note that the corner check uses a strict inequality, so if
the smallest intensity difference between the center pixel
and a corner pixel is n then the corner will have a score of n - 1.
src/corners.rs