graph_based_image_segmentation/segmentation/distance.rs
1use crate::graph::ImageNodeColor;
2
3/// Trait to be implemented by a concrete distance. The distance defines
4/// how the weights between nodes in the image graph are computed. See the paper
5/// by Felzenswalb and Huttenlocher for details.
6pub trait Distance {
7 /// Compute the distance given two nodes.
8 ///
9 /// # Arguments
10 ///
11 /// * `n` - The first node.
12 /// * `m` - The second node.
13 ///
14 /// # Returns
15 ///
16 /// The distance between the two nodes.
17 fn distance(&self, n: &ImageNodeColor, m: &ImageNodeColor) -> f32;
18}