Patent Publication Number: US-10321132-B2

Title: System and method for detecting motion in compressed video

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
     This application is a continuation of and claims the benefit of the filing date of U.S. application Ser. No. 14/696,258 filed Apr. 24, 2015, which is a continuation of and claims the benefit of the filing date of U.S. application Ser. No. 13/772,012 filed Feb. 20, 2013, now U.S. Pat. No. 9,053,366. 
    
    
     FIELD 
     The field relates to video cameras and, more particularly, to detecting motion in a field of view of video cameras. 
     BACKGROUND 
     Security systems that detect intruders via one or more security cameras are generally known. Such systems may be based upon the use of a security guard that monitors the cameras for intruders and raises an alarm when he/she notices an intruder. 
     In other security systems, the detection of intruders is automatic. In such systems, the detection of intruders may be based upon the detection of motion within a field of view of a camera. In such systems, a computer is generally used to compare successive frames of video for changes between the successive frames. When a change of sufficient magnitude is detected and is recognized as an object of interest, e.g., a human, the computer alerts a security guard or central monitoring station. 
     In order to reduce costs, most security systems have only a single, central location that monitors for and that detects intruders. Where a secured area extends over a large geographic expanse (e.g., an airport), the bandwidth of bringing all video signals back to the monitoring location for the detection of motion is prohibitively large. In order to reduce bandwidth, video signals may be compressed for transmission using an appropriate compression algorithm (e.g., H.264). 
     However, processing the compressed video signal at the monitoring station is also problematic in terms of interpretation, e.g., detection of intruder. State-of-the-art intruder detection systems work in the uncompressed pixel domain. Therefore, the compressed video signal must be decompressed before the intruder detection algorithms may be applied. Decompression is a time consuming process; it often prevents real-time operation, such as motion detection used for intruder detection, unless multiple, expensive processors are used. Accordingly, a need exists for a better method of processing compressed video signals at the monitoring station. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWING 
         FIG. 1  is a block diagram of a security system in accordance with an illustrated embodiment. 
     
    
    
     DETAILED DESCRIPTION OF AN ILLUSTRATED EMBODIMENT 
     While embodiments can take many different forms, specific embodiments thereof are shown in the drawings and will be described herein in detail with the understanding that the present disclosure is to be considered as an exemplification of the principles hereof, as well as the best mode of practicing the same. No limitation to the specific embodiment illustrated is intended. 
       FIG. 1  is a block diagram of a security system  10  shown generally in accordance with an illustrated embodiment. Shown within the security system  10  is a number of sensors  12 , . . . ,  14  used to detect events within a secured area  16 . The sensors may be switches coupled to portals of the secured area (e.g., doors, windows, etc.). Alternatively, the sensors may be environmental detectors (e.g., smoke detectors, gas detectors, etc.). 
     The status of the sensors may be monitored by a security system control station  18 . In the event that one or more of the sensors is activated, the control station  18  may send an alarm message to a central monitoring station  20 . 
     The security system may also include one or more cameras  22 , . . . ,  24 , which transmit the video images via wired or wireless links  46 , . . .  48 . Video from the cameras may be received by the control station  18  and saved in one or more video files  26 , . . . ,  28  located within a non-transitory computer readable medium (memory)  30 . 
     The security system may also include one or more processing apparatus (processors)  32 , . . . ,  34 . The processors operate under control of one or more computer programs  36 , . . . ,  38  loaded from a non-transitory computer readable medium (memory)  30 . As used herein, reference to a step performed by a computer program is also a reference to the processor that executed that step. 
     During normal operation, a human operator may view video from the cameras through a display  42  on a user interface  40 . The operator may select a camera for viewing by entering an identifier of a camera through a keyboard or touchscreen  44  and via operation of a camera control processor. 
     In order to reduce the bandwidth necessary to transmit image frames from the cameras  22 ,  24 , a programmed processor within each of the cameras may compress the video using an appropriate codec (e.g., H.264/MPEG-4). In order to view images from the cameras, a decoding processor may decode the compressed video images for presentation on the display  42 . The compressed video may simply be saved into a video file. 
     Under the illustrated embodiment, the compressed data is continuously processed in a compressed state in order to detect motion in a selected field of view of at least some of the cameras. In prior systems, in order to detect motion, the compressed video data needed to be partially or completely decoded before motion could be detected. However, the decompression of compressed data requires a significant amount of computer processing and is, therefore, expensive. 
     One solution to the problem of detecting motion in compressed data has been to process motion vectors that are already computed in the compressed data. The computed motion vectors are developed for efficient compression, not for motion detection. However, the processing of motion vectors is still time consuming and expensive. 
     In contrast, the system  10  uses macroblock size information for detecting motion. Macroblock size information can be easily extracted from the compressed stream from each camera without imposing significant computational costs on the system  10 . However, macroblock size alone may not be a reliable factor for motion detection because a number of other factors may influence the number of bits used for coding the macroblock. In order to accurately detect motion, the system described below uses a number of mechanisms to normalize the macroblock bit information. 
     As such, the motion detection system described below can detect motion in the compressed domain directly from the incoming video stream (e.g., H.264/MPEP-4) without fully decoding the stream. Since the video is not fully decoded, the computational cost is much less and more video streams can be analyzed for motion with the same processing power. The motion detection system can also be used for the detection of motion in stored compressed video, thereby generating the analysis results much faster. 
     In general, motion detection in the compressed video domain is accomplished using the size (number of bits) of the macroblock as the main feature. Three different motion detection methods may be implemented using the size of the macroblock. These methods are explained in detail below. 
     Under one illustrated embodiment, various combinations of three motion detection methods are used by one or more programmed motion detection processors to detect motion. The method used may be determined from the frame characteristics of the video stream, wherein the frame characteristics may be determined from one or more of average Macro Block (MB) size, median MB size in the frame, most often occurring MB size, histogram of MB size in the frame, etc. One or more adaptive thresholds may be computed from the frame characteristics. 
     The three methods can be implemented using various combinations of the following steps. First, the video is parsed to obtain the frame level and MB level information. Second, quantization normalization is used to obtain normalized MB size information. Third, the presence of motion in each MB is determined. This third step can be done using the MB size information under two different methods. The presence of motion in each MB under the first method can be determined by computing the ratio associated with a current MB size by using the same MB in two adjacent i-frames (past and future). If the ratio is greater than a Ratio Threshold (RT) value, then the MB is marked as having motion. Alternatively, the presence of motion under a second method can be determined by comparing the MB size directly against a Bit Threshold (BT). If the MB is greater than the BT, then the MB is marked as having motion. 
     The third step may also require a fourth step. The fourth step may include performing spatio-temporal filtering on the motion MBs identified. This may be needed to remove the holes and missing regions in a moving object. 
     The second step of applying quantization normalization will be discussed next. In this regard, the quantization is used to reduce the size (number of bits) of the MB residual error based on the chosen level of compression or chosen level of bit rates. The MB size extracted from the uncompressed stream is that of the quantized MB bit stream, which may not give the full extent of the residual error of the MB. To recover the original bit size of the MB residual error, the processor applies the quantization process in a reverse format, including, for each non-zero element, finding the original element size before quantization. The steps performed by the normalization processor may be characterized by the equation that follows.
 
MB original size in bits=MB size compressed +log 2 (quantization index)*number_of_non_zero_elements_MB
 
where
 
Quantization index= QP _table(quantization_parameter)*2 floor(quantization   _   para/6)  
 
     The first detection method of motion using the ratio threshold will be discussed in more detail next. In this regard, the MB of an i-frame is intra coded, i.e. the MB is predicted from neighbors from its right side and the error is coded with DCT. Since the MB is predicted from its neighborhood, the chances are that the match will not be very good and, therefore, the error will be greater and the size of the coded MB will (in turn) be greater. Whereas in a normal p-frame, the MB is inter coded, i.e. predicted from an adjacent frame (past or future), in which case the chances of getting a good match are greater and the coded MB will, therefore, be smaller in size. The idea here is that the i-frame intra coding of an MB is considered the worst case scenario when a non-optimal match is found. This can only happen in the case of p-frame inter coding when there is a new object or motion present in the MB. 
     The steps in motion detection using the RT method include the following steps. First, store the size information of each MB in two successive i-frames, where, for all of the p-frames present in between these i-frames, the stored information will be used for motion detection. Second, in the p-frame for each MB, compute the ratios between the current p-frame MB size and the stored size information of the same MB in the two i-frames (past, future). Third, if at least one of the two bit size ratios is greater than the Ratio Threshold (RT), then the MB is probably affected by motion. Fourth, the identified MBs sizes are compared with a Bit Threshold (BT). If the MB is greater than the BT, then the MB contains motion. 
     Finally, if some of the MBs in the i-frame which are intra-predicted don&#39;t have AC components (otherwise indicating a good match with surrounding left-top MB&#39;s), such MBs will have significantly smaller size. As such, it will be incorrect to use such MBs for comparison using the RT method. In such cases, only the BT is used for motion detection. 
     The method of MB motion detection using the bit threshold will be discussed next. The computation in this method is similar as described above with the exception that only the Bit Threshold is used to find the presence and absence of motion in the MB. The steps in motion detection using the BT method include, in the p-frame for each MB, compare the current p-frame MB size with the Bit Threshold (BT). If the MB is greater than the BT, then the MB contains motion. 
     The method of MB detection using spatio-temporal filtering and another adaptive threshold will be discussed next. In this regard, there is a chance that some MBs are not detected as motion MBs due to the presence of very small changes or due to reasons such as getting near perfect matches (in intra-prediction), thereby reducing the MB size in the i-frame, etc. Most of such cases are observed to occur in the inside portion (mid-portion) of the moving object, as the edge MBs are mostly identified as motion. Such MBs are called holes, which can be regained using morphological operations along the spatial and temporal axis, which is referred to as spatio-temporal filtering. The steps in spatio-temporal filtering include the following steps. First, in the given frame for each non-motion MB, compute the number of motion MBs present in its 8-connected neighborhood, which will be called a neighborhood score. Second, identify all of the non-motion MBs whose neighborhood scores are bigger or equal to 4. These MBs are then marked as motion MBs. Third, identify all of the non-motion MBs whose neighborhood scores are 3. Refer to this set of MBs as {MB 3}. For all MBs in {MB 3}, retrieve their neighborhood scores in the previous (past) two frames. Finally, mark a MB in {MB 3} as a motion MB when its two previous neighborhood scores are at least 5. This will be the spatio-temporal filtering method. 
     Once the stream is processed, the number of motion MBs may be compared with a threshold value. If the number exceeds the threshold, then motion is detected. 
     Upon detection of motion by the one or more motion detection processors, the detecting processor may send an alert to the alarm processor. The alarm processor may, in turn, alert the human operator or send an alarm message to the central monitoring station. 
     From the foregoing, it will be observed that numerous variations and modifications may be effected without departing from the spirit and scope hereof. It is to be understood that no limitation with respect to the specific apparatus illustrated herein is intended or should be inferred. It is, of course, intended to cover by the appended claims all such modifications as fall within the scope of the claims.