Skip to main content

flydra_pt_detect_cfg/
lib.rs

1// Copyright (C) The Strand-Braid Authors
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Default values for the [`ImPtDetectCfg`] type of the
5//! [`flydra-feature-detector-types`](https://crates.io/crates/flydra-feature-detector-types)
6//! crate.
7
8use flydra_feature_detector_types::{ContrastPolarity, ImPtDetectCfg};
9use strand_http_video_streaming_types::Shape;
10
11fn my_default(polarity: ContrastPolarity, valid_region: Shape) -> ImPtDetectCfg {
12    ImPtDetectCfg {
13        do_update_background_model: true,
14        polarity,
15        alpha: 0.01,
16        n_sigma: 7.0,
17        bright_non_gaussian_cutoff: 255,
18        bright_non_gaussian_replacement: 5,
19        bg_update_interval: 200,
20        diff_threshold: 30,
21        use_cmp: true,
22        max_num_points: 1,
23        feature_window_size: 30,
24        clear_fraction: 0.3,
25        despeckle_threshold: 5,
26        valid_region,
27    }
28}
29
30/// Default configuration for detecting features brighter or darker than background
31pub fn default_absdiff() -> ImPtDetectCfg {
32    my_default(ContrastPolarity::DetectAbsDiff, Shape::Everything)
33}