Abstract:
The present invention is applicable to the technical field of video monitoring. Provided are a method and an apparatus for recognizing a moving target. The method comprises: A: acquiring a video image with a background and a moving target; B: modeling a first video image to obtain a first background model; C: calculating a first differential image according to a second image and the first background model; D: modeling a second video image to obtain a second background model; E: calculating a second differential image according to a third image and the second background model; F: separately calculating a first binary image and a second binary image according to the first diferential image and the second differential image; G: obtaining a variation region of the moving target according to the first binary image and the second binary image; and H: repeatedly performing steps A to G sequentially, and detecting variation regions of all moving targets. The present invention has good adaptability to a vehicle-mounted camera and has a high recognition rate of the moving target.

Description:
FIELD OF THE INVENTION 
       [0001]    The present invention relates to the technical field of video monitoring, and more particularly to a method and device for recognizing a moving target. 
       BACKGROUND OF THE INVENTION 
       [0002]    Video monitoring is an important application of computer vision, and is widely used in many sites such as residential areas, office buildings, traffic transportation, and so on, and has become an important means for security protection monitoring in many fields such as residential areas, transportation, business and even national defence. 
         [0003]    Commonly used methods for motion detection include a background deduction method, a frame difference method, an optical flow method, etc. These methods generally take a static background or a quasi static background as a condition, and are adapted to sites where moving speeds of vehicles are low and a requirement for the accuracy of image segmentation is not high. However, in the event that the background is a dynamic background or a complicated background, using these methods to implement the motion detection is weak in instantaneity, very sensitive to external environmental changes, and has a bad noise-resistance performance; when video images are seriously contaminated by noises, a greater error probability may be caused. 
       Technical Problems 
       [0004]    The embodiments of the present invention provide a method and apparatus for recognizing a moving target, which aim at solving a problem that a method for detecting a moving target provided by the prior art has a great error probability. 
       Technical Solution 
       [0005]    In one aspect, the present invention provides a method for recognizing a moving target, the method comprises: 
         [0006]    step A, collecting video images that contain backgrounds and moving targets; 
         [0007]    step B, modeling a first frame of the video images and obtaining a first background model; 
         [0008]    step C, calculating and obtaining a first differential image according to a second frame of the video images and the first background model; 
         [0009]    step D, modeling the second frame of the video images and obtaining a second background model; 
         [0010]    step E, calculating and obtaining a second differential image according to a third frame of the video images and the second background model; 
         [0011]    step F, calculating and obtaining a first binary image and a second binary image respectively according to the first differential image and the second differential image; 
         [0012]    step G, obtaining a variation region of the moving target according to the first binary image and the second binary image; and 
         [0013]    step H, sequentially and repeatedly performing the steps A-G and detecting variation regions of all moving targets. 
         [0014]    Further, after the step G, the method further comprises: 
         [0015]    performing a two-dimensional cross entropy threshold division process based on spatial neighborhood information for the variation region of the moving target , and using a macro block with a preset size as a unit to judge whether there exists a moving target in the variation region of the moving target. 
         [0016]    Furthermore, using a macro block with a preset size as a unit to judge whether there exists a moving target in the variation region of the moving target comprises: 
         [0017]    dividing variation regions of all moving targets by the macro block with the preset size, and counting the total number N1 of used macro blocks; 
         [0018]    detecting the N1 macro blocks one by one; wherein, if a total number of pixels of the moving target contained in a detected macro block exceeds a preset pixel number, the detected macro block is counted by one time; and 
         [0019]    counting a number N2 of counted macro blocks; 
         [0020]    when N2/N1 exceeds a preset value, judging that there exists a moving target in the variation region of the moving target. 
         [0021]    Furthermore, the method further comprises: 
         [0022]    using an improved gaussian mixture model to model the first frame of the video images and obtaining the first background model; and 
         [0023]    using the improved gaussian mixture model to model the second frame of the video images and obtaining the second background model. 
         [0024]    Furthermore, the method further comprises: 
         [0025]    using an inter-frame difference method to calculate and obtain the first differential image according to the second frame of the video images and the first background model; and 
         [0026]    using the inter-frame difference method to calculate and obtain the second differential image according to the third frame of the video images and the second background model. 
         [0027]    In another aspect, the method provides an apparatus for recognizing a moving target, the apparatus comprises: 
         [0028]    a video image collecting unit configured for collecting video images that contain backgrounds and moving targets; 
         [0029]    a first background model obtaining unit configured for modeling a first frame of the video images and obtaining a first background model; 
         [0030]    a first differential image obtaining unit configured for calculating and obtaining a first differential image according to a second frame of the video images and the first background model; 
         [0031]    a second background model obtaining unit configured for modeling the second frame of the video images and obtaining a second background model; 
         [0032]    a second differential image obtaining unit configured for calculating and obtaining a second differential image according to a third frame of the video images and the second background model; 
         [0033]    a binary image obtaining unit configured for calculating and obtaining a first binary image and a second binary image respectively according to the first differential image and the second differential image; and 
         [0034]    a variation region obtaining unit configured for obtaining a variation region of the moving target according to the first binary image and the second binary image. 
         [0035]    Further, the apparatus further comprises: 
         [0036]    a moving target recognizing unit configured for performing a two-dimensional cross entropy threshold division process based on spacial neighborhood information for the variation region of the moving target, and using a macro block with a preset size as an unit to judge whether there exists a moving target in the variation region of the moving target. 
         [0037]    Furthermore, the moving target recognizing unit comprises: 
         [0038]    a macro block total number counting module configured for dividing variation regions of all moving targets by the macro block with the preset size, and counting the total number N1 of used macro blocks; 
         [0039]    a macro block detecting module configured for detecting for the Ni macro blocks one by one; wherein, if a total number of pixels of the moving target contained in a detected macro block exceeds a preset pixel number, the detected macro block is counted by one time; 
         [0040]    a macro block number counting module configured for counting a number N2 of the counted macro blocks; and 
         [0041]    a moving target judging module configured for judging that there exists a moving target in the variation region of the moving target when N2/N1 exceeds a preset value. 
         [0042]    Furthermore, the first background model obtaining unit is configured for using an improved gaussian mixture model to model the first frame of the video images and obtaining the first background model; and 
         [0043]    the second background model obtaining unit is configured for using the improved gaussian mixture model to model the second frame of the video images and obtaining the second background model. 
         [0044]    Furthermore, the first differential image obtaining unit is configured for using an inter-frame difference method to calculate and obtain the first differential image according to the second frame of the video images and the first background model; and 
         [0045]    the second differential image obtaining unit is configured for using the inter-frame difference method to calculate and obtain the second differential image according to the third frame of the video images and the second background model. 
       Advantageous Effects of the Present Invention 
       [0046]    In the embodiments of the present invention, during a moving process of a vehicle, background models are firstly established and updated continuously according to video frame images collected in real time, and then a variation region of a moving target is calculated according to the updated background models and the video frames collected in real time. The present invention has a good self-adaptability to a vehicle-mounted moving camera and has a high recognition rate for moving targets. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0047]      FIG. 1  is an implementation flow chart of a method for recognizing a moving target provided by a first embodiment of the present invention; 
           [0048]      FIG. 2  is a structural block diagram of an apparatus for recognizing a moving target provided by a second embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
       [0049]    In order to make the purposes, technical solutions, and advantages of the present invention be clearer and more understandable, the present invention will be further described in detail hereafter with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are only intended to illustrate but not to limit the present invention. 
         [0050]    In the embodiments of the present invention, video images that contain backgrounds and moving targets are collected; a first frame of the video images is modeled and a first background model is obtained; a first differential image is calculated and obtained according to a second frame of the video images and the first background model; the second frame of the video images is modeled and a second background model is obtained; a second differential image is calculated and obtained according to a third frame of the video images and the second background model; a first binary image and a second binary image are calculated and obtained according to the first differential image and the second differential image respectively; a variation region of a moving target is obtained according to the first binary image and the second binary image; the aforesaid steps are executed repeatedly and sequentially, and variation regions of all moving targets are detected. 
         [0051]    An implementation of the present invention is described in detail hereinafter in combination with specified embodiments: 
       Embodiment I 
       [0052]      FIG. 1  illustrates an implementation flow chart of a method for recognizing a moving target provided by a first embodiment of the present invention, which is described in detail as follows: 
         [0053]    In a step S 101 , collecting video images that contain backgrounds and moving targets. 
         [0054]    In this embodiment, a vehicle-mounted video surveillance camera is used to collect the video images containing backgrounds and moving targets. 
         [0055]    In a step S 102 , modeling a first frame of the video images and obtaining a first background model. 
         [0056]    In this embodiment, the first frame of the video images collected in the step S 101  is used as an initial background image, pixels of the initial background image is modeled using a gaussian mixture model, and the first background model is obtained. 
         [0057]    Of course, the pixels of the initial background image can be modeled using an improved gaussian mixture model, and thus the first background model is obtained. 
         [0058]    Specifically, in this embodiment, the pixels of the initial background image can also be modeled by other modeling methods, such as a mid-value method background modeling, an average value method background modeling, a kalman filtering background modeling, an advanced background modeling, and so on, thereby obtaining the first background model. A specific modeling method to be used is not limited herein, but it is preferred that the gaussian mixture modeling is adopted to model the pixels of the initial background image. 
         [0059]    In a step S 103 , calculating and obtaining a first differential image according to the second frame of the video images and the first background model. 
         [0060]    In this embodiment, after the second frame of the video images and the first background model are grayed respectively, the grayed second frame of the video images and the grayed first background model are further processed by an inter-frame difference method respectively, and the first differential image is obtained. 
         [0061]    In a step S 104 , modeling the second frame of the video images and obtaining a second background model. 
         [0062]    In this embodiment, pixels of the second frame of the video images collected in the step S 101  are modeled using the gaussian mixture model, so that the second background model can be obtained. 
         [0063]    Of course, the pixels of the second frame of the video images can also be modeled by the improved gaussian mixture model, so that the second background model can be obtained. 
         [0064]    In a step S 105 , calculating and obtaining a second differential image according to a third frame of the video images and the second background model. 
         [0065]    In this embodiment, after the third frame of the video images collected in the step S 101  and the second background model obtained in the step S 104  are grayed respectively, the grayed third frame of the video images and the grayed second background model are processed by the inter-frame difference method, and thus the second differential image is obtained. 
         [0066]    In a step S 106 , calculating and obtaining a first binary image and a second binary image respectively according to the first differential image and the second differential image. 
         [0067]    In this embodiment, the first differential image obtained in the step S 103  and the second differential image obtained in the step S 105  are obtained are binarized respectively, and thus the first binary image and the second binary image can be obtained respectively. 
         [0068]    In a step S 107 , calculating and obtaining a variation region of a moving target according to the first binary image and the second binary image. 
         [0069]    In this embodiment, in each of the pixels, a logic AND calculation for the first binary image and the second binary image obtained in the step S 106  is performed, and thus the variation region of the moving target can be calculated. Based on a gray value of the variation region of the moving target, a gray detecting threshold is set, so that the moving target in the video images can be accurately recognized. 
         [0070]    After the step S 107  has been executed, the steps S 101 -S 107  can be performed sequentially and repeatedly, such that variation regions of all moving targets are detected. 
         [0071]    As a preferred embodiment of the present invention, after the step S 107 , the method further comprises: 
         [0072]    performing a two-dimensional cross entropy threshold division process based on spatial neighborhood information for the variation region of the moving target, and using a macro block with a preset size as a unit to judge whether there exists the moving target in the variation region of the moving target. Wherein, performing the two-dimensional cross entropy threshold division process based on spatial neighborhood information for the variation region of the moving target can not only eliminate disturbances of noise pixels as much as possible, but also extract pixels being relevant to the moving target at the largest extent, thereby achieving a more accurate judgment for the variation region of the moving target. 
         [0073]    Wherein, in this embodiment, the variation region of the moving target is divided into a plurality of image blocks with the same size, each of the image blocks has a size of 16×16 pixels, that is, the macro block has a size of 16×16 pixels. 
         [0074]    In a specific implementation, if a size of each of divided small regions exceeds 16×8 pixels, each of the small regions is considered as an image block. 
         [0075]    Specifically, variation regions of all moving targets are divided by the macro block with the size of 16×16 pixels, and a total number N1 of used macro blocks are counted; afterwards, the N1 macro blocks are analyzed and judged one by one, if a total number of pixels of a moving target contained in a macro block exceeds a preset number of pixels, such as 128 (that is, a half of the number of the pixels in the macro block), the macro block is counted by one time; thus, a total number N2 of the counted macro blocks are counted; finally, a value of N2/N1 is judged, when N2/N1 exceeds a preset value (e.g., ¼ or ⅓ or ½), it is judged that there exists a moving target in the variation region of the moving target. Wherein, “N2/N1” represents that “N1 is divided by N2”. 
         [0076]    In this embodiment, in a moving process of a vehicle, background models are continuously established and updated according to video frame images collected in real time, and then variation regions of the moving target are calculated according to the updated background models and the video frame images collected in real time. The present invention has an excellent adaptability to a vehicle-mounted movable camera, and has a high recognition rate for moving targets. In addition, the video images are processed by a method combining the inter-frame difference method with the two-dimensional cross entropy threshold value dividing method, thereby improving a probability of accurately judging the moving target and a noise-resistance performance. 
         [0077]    It can be understood for the one of ordinary skill in the art that all of or some steps of each of the methods in the aforesaid embodiments can be accomplished by using programs to instruct relevant hardware, and the corresponding programs can be stored in a computer readable storage medium, the computer readable storage medium can be, for example, ROM (Read Only Memory)/RAM (Random Access Memory), disks, and so on. 
       Embodiment II 
       [0078]      FIG. 2  illustrates a specific structural block diagram of an apparatus  2  for recognizing a moving target provided by a second embodiment of the present invention. For convenient description, only the part that is relevant with the embodiment of the present invention is illustrated. The apparatus  2  for recognizing the moving target comprises: a video image collecting unit  21 , a first background model obtaining unit  22 , a first differential image obtaining unit  23 , a second background model obtaining unit  24 , a second differential image obtaining unit  25 , a binary image obtaining unit  26 , and a variation region obtaining unit  27 . 
         [0079]    Wherein, the video image collecting unit  21  is configured for collecting video images that contain backgrounds and moving targets; 
         [0080]    the first background model obtaining unit  22  is configured for modeling a first frame of the video images and obtaining a first background model; 
         [0081]    the first differential image obtaining unit  23  is configured for calculating and obtaining a first differential image according to a second frame of the video images and the first background model; 
         [0082]    a second background model obtaining unit  24  is configured for modeling the second frame of the video images and obtaining a second background model; 
         [0083]    a second differential image obtaining unit  25  is configured for calculating and obtaining a second differential image according to a third frame of the video images and the second background model; 
         [0084]    the binary image obtaining unit  26  is configured for calculating and obtaining a first binary image and a second binary image respectively according to the first differential image and the second differential image; and 
         [0085]    the variation region obtaining unit  27  is configured for obtaining a variation region of the moving target according to the first binary image and the second binary image. 
         [0086]    Further, the apparatus  2  further comprises: 
         [0087]    a moving target recognizing unit configured for performing a two-dimensional cross entropy threshold division process based on spacial neighborhood information for the variation region of the moving target, and using a macro block with a preset size as an unit to judge whether there exists a moving target in the variation region of the moving target. 
         [0088]    Specifically, the moving target recognizing unit comprises: 
         [0089]    a macro block total number counting module configured for dividing variation regions of all moving targets by the macro block with the preset size, and counting a total number N1 of used macro blocks; 
         [0090]    a macro block detecting module configured for detecting for the N1 macro blocks one by one; wherein, if a total number of pixels of the moving target contained in a detected macro block exceeds a preset pixel number, the detected macro block is counted by one time; 
         [0091]    a macro block number counting module configured for counting a number N2 of the counted macro blocks; 
         [0092]    a moving target judging module configured for judging that there exists a moving target in the variation region of the moving target when N2/N1 exceeds a preset value. 
         [0093]    Furthermore, the first background model obtaining unit is configured for using an improved gaussian mixture model to model the first frame of the video images and obtaining the first background model; 
         [0094]    the second background model obtaining unit is configured for using the improved gaussian mixture model to model the second frame of the video images and obtaining the second background model. 
         [0095]    Furthermore, the first differential image obtaining unit is configured for using an inter-frame difference method to calculate and obtain the first differential image according to the second frame of the video images and the first background model; 
         [0096]    the second differential image obtaining unit is configured for using the inter-frame difference method to calculate and obtain the second differential image according to the third frame of the video images and the second background model. 
         [0097]    The apparatus for recognizing the moving target provided by the embodiment of the present invention can be applied in the aforesaid corresponding method embodiment, for details, please refer to the description in the aforesaid embodiment I, it is not repeatedly described here. 
         [0098]    It should be noted that, each of the units included in the aforesaid apparatus embodiment are divided by logic function merely, and should not be limited by the aforesaid dividing method as long as corresponding functions can be implemented; in addition, a specific name of each of functional units intends to distinguish from each other conveniently but not to be configured to limit the protection scope of the present invention. 
         [0099]    The aforementioned embodiments are only preferred embodiments of the present invention, and should not be regarded as being limitation to the present invention. Any modification, equivalent replacement, improvement, and so on, which are made within the spirit and the principle of the present invention, should be included within the protection scope of the present invention.