#include <SimdMotion.hpp>
Public Member Functions | |
| Detector () | |
| virtual | ~Detector () |
| bool | SetOptions (const Simd::Motion::Options &options) |
| bool | SetModel (const Model &model) |
| bool | NextFrame (const Frame &input, Metadata &metadata, Frame *output=NULL) |
Detailed Description
Motion detector.
Processes a sequence of frames and reports classified moving objects and events through Metadata.
Typical usage:
- construct Detector (default Model and Options);
- optionally SetModel and SetOptions before the video loop;
- for each frame: Frame input(view, false, timestampInSeconds), NextFrame(input, metadata), then annotate metadata.objects and metadata.events on the image.
NextFrame must be called for every frame in order. Timestamp is used for background update, tracking timeout and classification lifetime. Recalibration runs when the input size changes.
The optional output Frame, if given, must have the same size as input. Debug drawing (Options::Debug*) is applied only when output is Bgr24.
Constructor & Destructor Documentation
◆ Detector()
| Detector | ( | ) |
◆ ~Detector()
Member Function Documentation
◆ SetOptions()
| bool SetOptions | ( | const Simd::Motion::Options & | options | ) |
Sets options of the motion detector.
Typical usage changes a few Options fields (see the shooting-star example) and calls this once before NextFrame. Pyramid scale and difference-feature allocation are applied on the next calibration (first NextFrame or input size change). Other fields are read every frame.
- Parameters
-
[in] options - options of motion detector.
- Returns
- true.
◆ SetModel()
| bool SetModel | ( | const Model & | model | ) |
Sets the scene model of the motion detector.
Typical usage sets Model::size and optionally Model::mask or Model::roi, then calls this once before NextFrame. The model is applied on the next calibration (first NextFrame or input size change).
- Parameters
-
[in] model - a model of the scene.
- Returns
- true.
◆ NextFrame()
Processes the next video frame.
Call this for every frame in order. input is typically Frame(image, false, capture.get(cv::CAP_PROP_POS_MSEC) * 0.001). metadata.events is cleared, then filled with events of this frame. metadata.objects receives classified moving objects (including those that disappeared on this frame).
output may be NULL. If it is not NULL it must have the same size as input; otherwise the function returns false. Debug annotation from Options is drawn only when output is Bgr24. Typical usage either annotates the input View (as in the example) or passes an output Frame and annotates output->planes[0].
- Parameters
-
[in] input - a current input frame (image plus timestamp in seconds). [out] metadata - detected objects and generated events of this frame. [out] output - optional frame for debug annotation. Can be NULL.
- Returns
- true on success; false if output is not NULL and its size differs from input.