graph_based_image_segmentation/graph/image_edge.rs
1/// Represents an edge between two pixels in an image.
2/// Each edge is characterized by a weight and the adjacent nodes.
3#[derive(Debug, PartialOrd, PartialEq, Copy, Clone, Default)]
4pub struct ImageEdge {
5 /// Index of first node.
6 pub n: usize,
7 /// Index of second node.
8 pub m: usize,
9 /// Edge weight, i.e. the distance of two pixels in feature space.
10 pub w: f32,
11}
12
13impl ImageEdge {
14 pub fn new(n: usize, m: usize, w: f32) -> Self {
15 Self { n, m, w }
16 }
17}