source: level2/competencies/MotionDirectionDetection/README.txt @ 322

Revision 322, 3.5 KB checked in by ginevra, 10 years ago (diff)
Line 
1************************
2MotionDirectionDetection
3************************
4
5This module allows for the overall motion direction of a person walking in an orthogonal direction to the camera to be
6computed. Specifically, this program can detect whether (1) a person is moving to the camera's left, (2) a person is moving
7to the camera's right, or (3) there is no motion in the camera's field of view.
8
9The code is based on the motion templates routines provided by OpenCV.
10Using motion templates requires the silhouette of the user. Given the silhouette of the user, a motion template is built using
11a motion history image (mhi) and an indication of the overall motion can be derived by computing the gradient of the mhi.
12
13As the human silhouette is the starting point to compute the overall motion direction using motion templates, note that
14the performance of the system depends on how well the human silhouette is extracted from the background.
15
16The MotionDirectionDetection module is comprised of the following classes:
17
18**CaptureFrame**
19This class contains functions to capture a video from camera or avi file.
20
21**BackgroundSubtr**
22This class contains functions to extract the user's silhouette from the background.
23The silhouette is extracted from the background by subtracting the first valid frame of the video to the current frame.
24
25**MotionDirection**
26This class contains functions to compute the overall motion direction of the user.
27The execute() function is the central function of the module. It calls the functions to capture the video, extract the silhouette
28from the background, compute the overall motion direction, classify the type of movement and add this information to a list.
29The update_mhi() function builds the motion templates and computes the overall motion direction by taking the gradient of the
30motion history image.
31The getMovementType() function returns a message code depending on the overall motion direction of the user: NO_MOTION (0),
32ENTERING_THE_ROOM (1) or LEAVING_THE_ROOM (2).
33
34**MessageStorage**
35This class contains functions to store information about the type of movement in a list.
36The function addMessage() adds the latest message code and timestamp to a list and stores the last N message codes and timestamps
37in the list.
38The function getMessage() allows for the latest message code and related timestamp to be accessed.
39
40
41The main program calls the function execute() of the class MotionDirectionDetection, which allows the user to specify whether
42to capture from camera or file.
43
44Note that the initial frames of the videos should contain only the background and not the user, as the silhouette is obtained
45by subtracting the first valid frame to the current frame.
46
47The values of some of the parameters used in this module may change according to your application and setup.
48Examples include the threshold values in the cvThreshold() function used in the function to extract the silhouette from the
49background (extractBackground()); the value assigned to the "threshold" variable in the update_mhi() function (which is used
50to disregard small motion); the number (currently set to 1000) that the norm of the image including the silhouette is
51divided by before being assigned to the variable "count" in the function update_mhi(); the values of the variables MHI_DURATION,
52MIN_TIME_DELTA, MAX_TIME_DELTA.
53
54The code has been written and tested in Windows, but it should work under Linux as well.
55
56You will need to install OpenCV on your machine.
57
58Questions to: ginevra@dcs.qmul.ac.uk 
59
60
61
62
Note: See TracBrowser for help on using the repository browser.