Valkka  1.6.1
OpenSource Video Management
movement.h
Go to the documentation of this file.
1 #ifndef movement_HEADER_GUARD
2 #define movement_HEADER_GUARD
3 /*
4  * movement.h : Framefilter implementing a movement detector
5  *
6  * (c) Copyright 2017-2024 Sampsa Riikonen
7  *
8  * Authors: Petri Eranko <petri.eranko@dasys.fi>
9  *
10  * This file is part of the Valkka library.
11  *
12  * Valkka is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License as
14  * published by the Free Software Foundation, either version 3 of the
15  * License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>
24  *
25  */
26 
37 #include "framefilter.h"
38 #include "Python.h"
39 
40 class MovementFrameFilter : public FrameFilter { // <pyapi>
41 
42 public: // <pyapi>
49  MovementFrameFilter(const char* name, long int interval, float treshold, long int duration, FrameFilter* next=NULL); // <pyapi>
50  virtual ~MovementFrameFilter(); // <pyapi>
51 
52 protected:
53  long int movement_start;
54  long int mstimestamp;
55  long int duration;
56  long int interval;
57  int y_size;
58  uint8_t* luma;
59  PyObject* pycallback;
60  float treshold;
61 
62 
63 protected:
65  void run(Frame* frame);
66  void go(Frame* frame);
67 
68 public:
69  void reset(); // <pyapi>
71  void setCallback(PyObject* pycallback); // <pyapi>
72 }; // <pyapi>
73 
74 
75 
76 #endif
The mother class of all frame filters! FrameFilters are used to create "filter chains".
Definition: framefilter.h:44
FrameFilter * next
The next frame filter in the chain to be applied.
Definition: framefilter.h:60
Frame: An abstract queueable class.
Definition: frame.h:112
Definition: movement.h:40
uint8_t * luma
Cached luma component of the yuv image.
Definition: movement.h:58
long int mstimestamp
Saved timestamp: time of the previous frame.
Definition: movement.h:54
long int interval
How often check the frames.
Definition: movement.h:56
long int movement_start
State of the movement detector & the timestamp when movement was first detected.
Definition: movement.h:53
void run(Frame *frame)
Takes AVBitmapFrame.
Definition: movement.cpp:71
void setCallback(PyObject *pycallback)
Set a python callable on movement start & stop events.
Definition: movement.cpp:46
int y_size
Size of the last cached luma plane.
Definition: movement.h:57
void go(Frame *frame)
Does the actual filtering/modification to the Frame. Define in subclass.
Definition: movement.cpp:67
long int duration
Movement events within this time are the same event.
Definition: movement.h:55
PyObject * pycallback
Python method to be called at movement & still events.
Definition: movement.h:59
MovementFrameFilter(const char *name, long int interval, float treshold, long int duration, FrameFilter *next=NULL)
Definition: movement.cpp:39
Definition of FrameFilter and derived classes for various purposes.