mod blur;
mod color;
mod heatmap;
mod keypoint;
mod polygon_zone_annotator;
mod shape_annotators;
mod trace;
#[cfg(feature = "annotate-image")]
mod font;
#[cfg(feature = "annotate-image")]
mod image_backend;
#[cfg(feature = "annotate-image")]
mod rich_label;
#[cfg(feature = "annotate-opencv")]
mod opencv_backend;
pub use blur::{BlurAnnotator, PixelateAnnotator};
pub use color::{Color, ColorPalette};
pub use heatmap::HeatMapAnnotator;
pub use keypoint::{EdgeAnnotator, VertexAnnotator, VertexLabelAnnotator};
pub use polygon_zone_annotator::PolygonZoneAnnotator;
#[cfg(feature = "annotate-image")]
pub use rich_label::RichLabelAnnotator;
pub use shape_annotators::{
BackgroundOverlayAnnotator, BoxCornerAnnotator, CircleAnnotator, DotAnnotator,
EllipseAnnotator, HaloAnnotator, IconAnnotator, LabelAnnotator, MaskAnnotator,
PercentageBarAnnotator, PolygonAnnotator, RoundBoxAnnotator, TriangleAnnotator,
};
pub use trace::TraceAnnotator;
pub trait Annotator<Image> {
type Subject;
fn annotate(&self, image: &mut Image, subject: &Self::Subject) -> crate::Result<()>;
}
#[derive(Debug, Clone)]
pub struct BoxAnnotator {
pub palette: ColorPalette,
pub thickness: u32,
}
impl BoxAnnotator {
pub fn new(palette: ColorPalette, thickness: u32) -> Self {
Self { palette, thickness }
}
}
impl Default for BoxAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 2)
}
}
#[derive(Debug, Clone)]
pub struct LineZoneAnnotator {
pub color: Color,
pub thickness: u32,
pub text_scale: f32,
}
impl LineZoneAnnotator {
pub fn new(color: Color, thickness: u32, text_scale: f32) -> Self {
Self {
color,
thickness,
text_scale,
}
}
}
impl Default for LineZoneAnnotator {
fn default() -> Self {
Self::new(Color::new(255, 255, 255), 2, 1.0)
}
}