Test fire and smoke

This commit is contained in:
2026-06-18 05:57:14 +10:00
parent e70acb463e
commit 49a53c344e
196 changed files with 17854 additions and 2 deletions
@@ -38,6 +38,9 @@ class CUSTOM_API ANSCustomFS : public IANSCustomClass
// V-channel flicker gate: real fire oscillates in luma; sunlight does not
static constexpr double FLICKER_V_STD_THRESHOLD = 3.0;
static constexpr int FLICKER_MIN_SAMPLES = 6;
// Minimum fire/smoke box area as a fraction of the full frame (configurable via "MinObjectSize").
// Resolution-independent: rejects tiny boxes (the dominant small false-positive source).
static constexpr float DEFAULT_MIN_OBJECT_RATIO = 0.0003f; // 0.03% of frame area
private:
using ANSLIBPtr = std::unique_ptr<ANSCENTER::ANSLIB, decltype(&ANSCENTER::ANSLIB::Destroy)>;
@@ -99,6 +102,8 @@ private:
std::vector<cv::Rect> _exclusiveROIs;
float _smokeDetetectionThreshold{ 0 };
float _motionSpecificity{ 0 };
// Min fire/smoke box area as a fraction of the full frame; see DEFAULT_MIN_OBJECT_RATIO.
float _minObjectAreaRatio{ DEFAULT_MIN_OBJECT_RATIO };
// Tracker-based voting state
std::unordered_map<int, TrackRecord> _trackHistory;
@@ -118,6 +123,7 @@ private:
bool IsROIOverlapping(const cv::Rect& obj, const std::vector<cv::Rect>& objectList, float iouThreshold = 0.5);
bool IsDetectedAreaValid(const cv::Rect& area) const;
bool IsObjectLargeEnough(const cv::Rect& box, const cv::Size& frameSize) const;
bool IsFireOrSmoke(int classId, float confidence) const;
bool ValidateMotionCorrelation(const std::vector<cv::Rect>& fireNSmokeRects) const;
void UpdatePositiveDetection();