source: level2/competencies/MotionDirectionDetection/src/MotionDirection.h @ 322

Revision 322, 2.8 KB checked in by ginevra, 10 years ago (diff)
Line 
1// AUTHOR: Ginevra Castellano
2// Queen Mary University of London
3// DATE: 03/2010
4// VERSION: 1.0
5
6// Copyright (C) 2009 Ginevra Castellano
7// Queen Mary University of London
8
9// This file is part of the MotionDirectionDetection program
10
11// MotionDirectionDetection is free software: you can redistribute it and/or modify
12// it under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 3 of the License, or
14// (at your option) any later version.
15
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19// GNU Lesser General Public License for more details.
20
21// You should have received a copy of the GNU Lesser General Public License
22// along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24// MotionDirectionDetection uses the OpenCV library
25// Copyright (C) 2000-2006, Intel Corporation, all rights reserved.
26// Third party copyrights are property of their respective owners.
27// See OpenCV_license.txt, in the program folder, for details.
28
29
30#ifndef _MOTION_DIRECTION
31#define _MOTION_DIRECTION
32
33
34#include "CaptureFrame.h" 
35#include "MessageStorage.h"
36#include "BackgroundSubtr.h"
37
38#include "cv.h"
39#include "highgui.h"
40
41enum MovementType {
42       
43        NO_MOTION = 0,
44        ENTERING_THE_ROOM = 1,
45        LEAVING_THE_ROOM = 2
46};
47
48class MotionDirection
49{
50        public:
51        MotionDirection(void);
52        ~MotionDirection(void);
53
54        int execute(CaptureType c, char* aviname = NULL); // process video, detect type of movement and store this information in a list
55        double update_mhi(void); // detect overall motion direction
56        int getMovementType(void); // detect type of movement based on overall motion direction
57
58        MessageStorage* ms;
59
60        private:
61        CaptureFrame captureFrame;
62        BackgroundSubtr backgroundSubtr;
63
64        IplImage* motion;
65        IplImage* image;
66        IplImage* frame_background;
67        IplImage* silhouette;
68        double motionOrient;
69
70        bool finished;
71
72        // tracking parameters (in seconds)
73        const double MHI_DURATION; // how long motion history pixels are allowed to remain in the mhi
74        const double MIN_TIME_DELTA; // minimum gradient magnitude allowed
75        const double MAX_TIME_DELTA;  // maximum gradient magnitude allowed
76       
77        // temporary images
78        IplImage *mhi; // motion history image (mhi)
79        IplImage *orient; // orientation
80        IplImage *mask; // valid orientation mask
81        CvMemStorage* storage; // temporary storage
82
83        double timestamp; // current time in seconds
84    CvSize size; // current frame size
85    double count; // a measure of motion
86        int threshold; // threshold to disregard little motion
87    int angle; // motion orientation
88    CvPoint center;
89    double magnitude;         
90    CvScalar color;
91};
92
93#endif
Note: See TracBrowser for help on using the repository browser.