Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
camera_diff_detection.h
1#pragma once
2
4#include "motion_detector.h"
5#include "sync.h"
6#include "tracker.h"
7
8#include <atomic>
9#include <cstdint>
10
11#include <freertos/FreeRTOS.h>
12#include <freertos/task.h>
13
14class FrameStore;
15
26{
27public:
28 CameraDiffDetection() = default;
29 ~CameraDiffDetection() override;
31 CameraDiffDetection& operator=(const CameraDiffDetection&) = delete;
32
34 bool begin();
35
37 std::tuple<MoveX, MoveY> detect_object(camera_buffer_t frame) override;
38
45 bool start_task(FrameStore& store);
46
56 void reset() override;
57
58 TrackSnapshot get_track_snapshot() const override;
59 DetectionStats get_stats() const override;
60
61private:
62 struct Pipeline {
65 tracking::Tracker tracker;
66 };
67
68 static void task_entry(void* arg);
69 void task_loop();
71 void apply_reset();
72
73 Pipeline* _pipeline = nullptr;
74 FrameStore* _store = nullptr;
75 TaskHandle_t _task = nullptr;
76 std::atomic<bool> _reset_requested{false};
77 uint32_t _last_sequence = 0;
79 struct Published {
80 TrackSnapshot snapshot;
81 DetectionStats stats;
82 };
84};
Abstract interface for object detection logic on ESP32-CAM.
An abstract base class (Interface) that defines the contract for detection algorithms....
Definition base_detection_module.h:22
Motion detection and persistent single-target tracking on camera frames.
Definition camera_diff_detection.h:26
void reset() override
Publish an Idle snapshot now and request a reset of detector and tracker.
Definition camera_diff_detection.cpp:193
bool start_task(FrameStore &store)
Create the "detect" task (core 1, priority 3, 4096 B stack) and subscribe it to the store.
Definition camera_diff_detection.cpp:130
DetectionStats get_stats() const override
Detection timings and counters for the stats line.
Definition camera_diff_detection.cpp:218
bool begin()
Allocate the pipeline in internal RAM. Without it detect_object() reports no motion.
Definition camera_diff_detection.cpp:60
std::tuple< MoveX, MoveY > detect_object(camera_buffer_t frame) override
Analyse one frame; returns the direction toward the tracked target (None when there is none).
Definition camera_diff_detection.cpp:77
TrackSnapshot get_track_snapshot() const override
Latest tracker output, safe to call from another task (implementations copy under a lock).
Definition camera_diff_detection.cpp:213
Definition frame_store.h:30
Definition motion_detector.h:21
Definition tracker.h:18
A value of type T that owns its own spinlock; every access is one short critical section.
Definition sync.h:54
Finds moving regions in 40x30 gray frames with a background model (pure C++20, natively tested).
Definition track_snapshot.h:32
Definition track_snapshot.h:14
Definition camera.h:14
Small RAII wrappers for the two locking patterns the firmware uses (device only).
Single-target persistent tracker over detector blobs (pure C++20, natively tested).
std::array< uint8_t, kCells > GrayFrame
One 40x30 luma frame, row-major (index = y * kGridW + x).
Definition tracking_types.h:21