graph-based-image-segmentation 0.2.1

An implementation of graph-based image segmentation algorithms based on superpixels.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::graph::ImageNodeColor;

/// Trait to be implemented by a concrete distance. The distance defines
/// how the weights between nodes in the image graph are computed. See the paper
/// by Felzenswalb and Huttenlocher for details.
pub trait Distance {
    /// Compute the distance given two nodes.
    ///
    /// # Arguments
    ///
    /// * `n` - The first node.
    /// * `m` - The second node.
    ///
    /// # Returns
    ///
    /// The distance between the two nodes.
    fn distance(&self, n: &ImageNodeColor, m: &ImageNodeColor) -> f32;
}