Skip to main content

parse_orientation_angle

Function parse_orientation_angle 

Source
pub fn parse_orientation_angle(
    label: &str,
    confidence: f32,
    threshold: Option<f32>,
    valid_angles: &[f32],
) -> OrientationResult
Expand description

Parses orientation angle from various label formats

This function provides robust parsing that can handle:

  • String labels: “0”, “90”, “180”, “270”
  • Numeric strings: “0.0”, “90.0”, etc.
  • Direct numeric values when converted to strings

§Arguments

  • label - The label string to parse
  • confidence - The confidence score for this prediction
  • threshold - Optional confidence threshold
  • valid_angles - Set of valid angles to accept

§Returns

An OrientationResult containing the parsed angle and confidence information