radsym 0.4.1

Radial symmetry detection: center proposals, local support analysis, scoring, and refinement
Documentation
//! Support evidence types.
//!
//! [`SupportEvidence`] holds the raw gradient samples and summary statistics
//! extracted from an annular region around a hypothesis.

use crate::core::coords::PixelCoord;
use crate::core::scalar::Scalar;

/// A single gradient sample with its radial alignment score.
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub(crate) struct GradientSample {
    /// Sample position in image coordinates.
    pub position: PixelCoord,
    /// Absolute cosine between gradient direction and the radial direction
    /// from the hypothesis center. Range `[0, 1]`: 1 = perfectly radial.
    pub radial_alignment: Scalar,
}

/// Extracted local evidence around a hypothesis.
///
/// Produced by annulus sampling functions and consumed by scoring functions.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub(crate) struct SupportEvidence {
    /// Individual gradient samples with alignment scores.
    pub gradient_samples: Vec<GradientSample>,
    /// Number of valid samples (with non-negligible gradient).
    pub sample_count: usize,
    /// Mean absolute radial alignment across all samples. Range `[0, 1]`.
    pub mean_gradient_alignment: Scalar,
}