Skip to main content

Crate radsym

Crate radsym 

Source
Expand description

§radsym

Radial symmetry detection library: center proposal generation, local circular and elliptical support analysis, support scoring, and local image-space refinement. CPU-first, deterministic, composable tools.

§Quick start

use radsym::{
    ImageView, FrstConfig, Circle, Polarity, ScoringConfig, NmsConfig,
    sobel_gradient, frst_response, extract_proposals, score_circle_support,
};

// 1. Load or create an image (here: synthetic bright disk)
let size = 64;
let mut data = vec![0u8; size * size];
for y in 0..size {
    for x in 0..size {
        let dx = x as f32 - 32.0;
        let dy = y as f32 - 32.0;
        if (dx * dx + dy * dy).sqrt() <= 10.0 {
            data[y * size + x] = 255;
        }
    }
}
let image = ImageView::from_slice(&data, size, size).unwrap();

// 2. Compute gradient and FRST response
let gradient = sobel_gradient(&image).unwrap();
let config = FrstConfig { radii: vec![9, 10, 11], ..FrstConfig::default() };
let response = frst_response(&gradient, &config).unwrap();

// 3. Extract proposals via NMS
let nms = NmsConfig { radius: 5, threshold: 0.0, max_detections: 5 };
let proposals = extract_proposals(&response, &nms, Polarity::Bright);

// 4. Score the best proposal
if let Some(best) = proposals.first() {
    let circle = Circle::new(best.seed.position, 10.0);
    let score = score_circle_support(&gradient, &circle, &ScoringConfig::default());
    assert!(score.total > 0.0);
}

§Modules

  • core — fundamental types, image views, geometry, gradient, NMS, homography, circle fitting
  • propose — center-proposal generation (FRST, RSD, homography-aware)
  • support — local support extraction and scoring
  • refine — local hypothesis refinement (Parthasarathy radial center, iterative circle/ellipse, homography-aware ellipse)
  • diagnostics — visualization: heatmaps, overlays

§Feature flags

  • rayon — parallel execution for multi-radius proposals
  • image-io — load images via the image crate
  • tracing — structured logging
  • affine — experimental affine-aware extensions (GFRS)
  • serde — serialization support

Re-exports§

pub use crate::core::circle_fit::fit_circle;
pub use crate::core::circle_fit::fit_circle_weighted;
pub use crate::core::coords::PixelCoord;
pub use crate::core::error::RadSymError;
pub use crate::core::error::Result;
pub use crate::core::geometry::Annulus;
pub use crate::core::geometry::Circle;
pub use crate::core::geometry::Ellipse;
pub use crate::core::gradient::GradientField;
pub use crate::core::gradient::GradientOperator;
pub use crate::core::gradient::compute_gradient;
pub use crate::core::gradient::compute_gradient_f32;
pub use crate::core::gradient::scharr_gradient;
pub use crate::core::gradient::scharr_gradient_f32;
pub use crate::core::gradient::sobel_gradient;
pub use crate::core::gradient::sobel_gradient_f32;
pub use crate::core::homography::Homography;
pub use crate::core::homography::RectifiedGrid;
pub use crate::core::homography::rectified_circle_to_image_ellipse;
pub use crate::core::image_view::ImageView;
pub use crate::core::image_view::OwnedImage;
pub use crate::core::nms::NmsConfig;
pub use crate::core::polarity::Polarity;
pub use crate::core::pyramid::OwnedPyramidLevel;
pub use crate::core::pyramid::PyramidLevelView;
pub use crate::core::pyramid::PyramidWorkspace;
pub use crate::core::pyramid::pyramid_level_owned;
pub use crate::propose::extract::ResponseMap;
pub use crate::propose::extract::extract_proposals;
pub use crate::propose::extract::suppress_proposals_by_distance;
pub use crate::propose::frst::FrstConfig;
pub use crate::propose::frst::frst_response;
pub use crate::propose::frst::frst_response_single;
pub use crate::propose::frst::multiradius_response;
pub use crate::propose::homography::HomographyProposal;
pub use crate::propose::homography::HomographyRerankConfig;
pub use crate::propose::homography::RectifiedResponseMap;
pub use crate::propose::homography::RerankedProposal;
pub use crate::propose::homography::extract_rectified_proposals;
pub use crate::propose::homography::frst_response_homography;
pub use crate::propose::homography::rerank_proposals_homography;
pub use crate::propose::remap::remap_proposal_to_image;
pub use crate::propose::remap::remap_proposals_to_image;
pub use crate::propose::rsd::RsdConfig;
pub use crate::propose::rsd::rsd_response;
pub use crate::propose::rsd::rsd_response_fused;
pub use crate::propose::seed::Proposal;
pub use crate::propose::seed::ProposalSource;
pub use crate::propose::seed::SeedPoint;
pub use crate::support::annulus::AnnulusSamplingConfig;
pub use crate::support::evidence::SupportEvidence;
pub use crate::support::hypothesis::AnnulusHypothesis;
pub use crate::support::hypothesis::CircleHypothesis;
pub use crate::support::hypothesis::ConcentricPairHypothesis;
pub use crate::support::hypothesis::EllipseHypothesis;
pub use crate::support::score::ScoringConfig;
pub use crate::support::score::SupportScore;
pub use crate::support::score::score_circle_support;
pub use crate::support::score::score_ellipse_support;
pub use crate::support::score::score_rectified_circle_support;
pub use crate::refine::circle::CircleRefineConfig;
pub use crate::refine::circle::refine_circle;
pub use crate::refine::ellipse::EllipseRefineConfig;
pub use crate::refine::ellipse::refine_ellipse;
pub use crate::refine::homography::HomographyEllipseRefineConfig;
pub use crate::refine::homography::HomographyRefinementResult;
pub use crate::refine::homography::refine_ellipse_homography;
pub use crate::refine::radial_center::RadialCenterConfig;
pub use crate::refine::radial_center::radial_center_refine;
pub use crate::refine::radial_center::radial_center_refine_from_gradient;
pub use crate::refine::result::RefinementResult;
pub use crate::refine::result::RefinementStatus;
pub use crate::pipeline::DetectCirclesConfig;
pub use crate::pipeline::Detection;
pub use crate::pipeline::detect_circles;
pub use crate::diagnostics::heatmap::Colormap;
pub use crate::diagnostics::heatmap::DiagnosticImage;
pub use crate::diagnostics::heatmap::response_heatmap;
pub use crate::diagnostics::overlay::overlay_circle;
pub use crate::diagnostics::overlay::overlay_ellipse;

Modules§

core
Fundamental types, image views, geometry, gradient computation, and NMS.
diagnostics
Visualization and diagnostic export.
pipeline
High-level detection pipeline.
prelude
Convenience re-exports for common workflows.
propose
Center-proposal generation.
refine
Local image-space hypothesis refinement.
support
Local support extraction and scoring.