Summary of the invention
The invention provides road image extraction method and device in a kind of intelligent video monitoring, in order to accurately to determine the moving region of moving target in the monitoring scene.
The invention provides the road image extraction method in a kind of intelligent video monitoring, comprising:
Obtain the input picture in the video flowing, according to the input picture generation background image that obtains;
Detect the motor image vegetarian refreshments in the input picture that from described video flowing, obtains according to described background image, generate movement destination image;
The movement destination image frame number that statistics is generated, and, add up the number of times that each pixel belongs to the motor image vegetarian refreshments respectively according to the motor image vegetarian refreshments in each frame movement destination image;
When the movement destination image frame number that is generated reaches the setting frame number, determine the moving region of statistics number greater than the pixel component movement target of first threshold, and according to background image and the moving region generation pavement image of determining, described first threshold is the numerical value of determining according to the setting frame number, and first threshold is less than setting frame number.
In this road image extraction method, the input picture generation background image that described basis is obtained comprises:
Set up the initialization background image, the pixel value of each pixel is 0 in the initialization background image;
Present frame input picture and its former frame input picture are carried out absolute calculus of differences, obtain first difference image;
Described first difference image is carried out thresholding handle and Filtering Processing, obtain the two-value foreground image;
Determine the still image vegetarian refreshments according to each frame two-value foreground image, add up the number of times that each pixel belongs to the still image vegetarian refreshments respectively, and, in the initialization background image, upgrade the pixel value of corresponding pixel points when the statistics number of pixel during greater than second threshold value set;
After the pixel value of each pixel in the initialization background image all is updated, with the pixel value of each pixel in the initialization background image divided by update times, the generation background image.
Pixel value after described pixel upgrades is: the pixel value sum of this pixel in pixel value before this pixel upgrades and the present frame input picture.
This road image extraction method also comprises:
According to described movement destination image and input picture background image updating.
Wherein, described according to movement destination image and input picture background image updating, specifically comprise:
Movement destination image according to each frame input picture correspondence is determined the still image vegetarian refreshments;
The pixel value of each still image vegetarian refreshments in the background image updating.
Pixel value after each still image vegetarian refreshments upgrades in the described background image is: the pixel value of this pixel in the present frame input picture multiply by first weight and the pixel value in the former frame input picture multiply by the second weight sum, and described first weight and the second weight sum are 1.
In this road image extraction method, the described motor image vegetarian refreshments that detects according to background image in the input picture that obtains from described video flowing generates movement destination image, comprising:
The input picture and the background image that obtain are carried out absolute calculus of differences, obtain second difference image;
Described second difference image is carried out thresholding handle and Filtering Processing, detect the motor image vegetarian refreshments, generate movement destination image.
The invention provides the pavement image extraction element in a kind of intelligent video monitoring, comprising:
Image collection module: the input picture that is used for obtaining video flowing;
Background modeling module: be used for according to the input picture generation background image that obtains;
Motion detection block: be used for generating movement destination image according to the motor image vegetarian refreshments of described background image detection from the input picture that described video flowing obtains;
Pavement image synthesis module: be used to add up the movement destination image frame number that is generated, and according to the motor image vegetarian refreshments in each frame movement destination image, add up the number of times that each pixel belongs to the motor image vegetarian refreshments respectively, when the movement destination image frame number that is generated reaches the setting frame number, determine the moving region of statistics number greater than the pixel component movement target of first threshold, and according to background image and the moving region generation pavement image of determining, described first threshold is the numerical value of determining according to the setting frame number, and first threshold is less than setting frame number.
This pavement image extraction element also comprises:
Context update module: be used for background image according to movement destination image and input picture renewal background modeling module.
Road image extraction method in the intelligent video monitoring provided by the invention and device, at first determine background image according to input picture, again according to the motor image vegetarian refreshments in the background image detection input picture of determining, the movement destination image that utilizes motion detection to obtain is determined the moving region of moving target, thereby generate pavement image according to moving region and background image, can accurately determine the moving region of moving target in the monitoring scene, successfully manage the situation of moving region more complicated, improve the degree of accuracy of the pavement image of determining.
Embodiment
The embodiment of the invention provides road image extraction method and the device in a kind of intelligent video monitoring, in order to accurately to determine the moving region of moving target in the monitoring scene.
At first the several basic conceptions that the embodiment of the invention is related to defines.Video flowing is meant the continuous videos image that is extracted by camera from monitoring scene, video flowing can be regarded as by some two field pictures continuous in time and form; Input picture is meant the image that obtains from video flowing; Background image is meant the image that static background in the input picture is formed, and for example house of the highway in the intelligent transportation monitoring, highway both sides, trees etc. comprise the moving region and the non-moving region of moving target in the background image; Pavement image is meant the image that the moving region of moving target in the monitoring scene is formed, and " road surface " is a relative generalized concept herein, in concrete application scenarios concrete implication arranged, and for example is meant the highway of vehicle ' in the intelligent transportation monitoring.Accurately extract the pavement image in the monitoring scene, could distinguish the moving region and the non-moving region of moving target, thus for moving object detection, statistics, monitoring etc. provide the basis.
The embodiment of the invention provides the road image extraction method in a kind of intelligent video monitoring, as shown in Figure 3, comprising:
S301, obtain the input picture in the video flowing, according to the input picture generation background image that obtains;
S302, detect the motor image vegetarian refreshments in the input picture from video flowing, obtain according to background image, generate movement destination image;
The movement destination image frame number that S303, statistics are generated, and, add up the number of times that each pixel belongs to the motor image vegetarian refreshments respectively according to the motor image vegetarian refreshments in each frame movement destination image;
S304, when the movement destination image frame number that is generated reaches when setting frame number, determine the moving region of statistics number, and generate pavement image according to background image and the moving region determined greater than the pixel component movement target of first threshold.
Road image extraction method in the intelligent video monitoring that the embodiment of the invention provides, according to the motor image vegetarian refreshments in the background image detection input picture, also promptly detect moving target, the moving region that the movement destination image that utilizes motion detection to obtain extracts moving target, thereby further determine pavement image, can accurately determine the moving region of moving target in the monitoring scene, successfully manage the situation of moving region more complicated, improve the degree of accuracy of the pavement image of determining.
Describe this road image extraction method in detail with specific embodiment below, at first according to the input picture generation background image that obtains from video flowing; Behind the generation background image, according to background image the input picture that obtains in the video flowing is carried out motion detection, detect the motor image vegetarian refreshments in the input picture, promptly moving target generates movement destination image; Determine the moving region of moving target again according to movement destination image, thereby generate pavement image according to moving region and background image.More excellent, according to movement destination image and input picture background image updating, more accurate to adapt to the variation of background environment in the monitoring scene, to make the pavement image that extracts.As shown in Figure 4, treatment scheme comprises:
S401, from camera video captured stream, obtain input picture, according to the input picture generation background image that obtains;
S402, determine that is set a frame number N, parameter i is initialized as 1;
For example setting frame number is 100 frames, then follow-uply carries out circular treatment since the 1st frame input picture successively, end loop when handling the 100th frame input picture;
S403, obtain input picture, detect the motor image vegetarian refreshments of this input picture according to background image, promptly moving target generates movement destination image;
S404, according to this movement destination image and input picture background image updating, be in order to adapt to the variation of background environment in the monitoring scene to the renewal of background image;
S405, add up the number of times of each pixel, according to the motor image vegetarian refreshments in the movement destination image, the statistics number of corresponding pixel points is added 1, the statistics number of each pixel is initialized as 0;
The movement destination image frame number that S406, statistics are generated, concrete statistical method is parameter i+1, and judge that whether i is greater than N, if not, illustrate that then the movement destination image frame number that is generated does not reach the setting frame number, then return and carry out S403, if, illustrate that then the movement destination image frame number that is generated has reached the setting frame number, then carry out S407;
S407, determine the moving region of statistics number greater than the pixel component movement target of first threshold, and according to moving region of determining and background image generation pavement image, first threshold is the numerical value of determining according to the setting frame number, and first threshold is less than setting frame number;
Because the expression mode of binaryzation is adopted in the moving region of determining, be that pixel value is 1 to be expressed as the moving region, pixel value is 0 to be expressed as non-moving region, it is the scope that the moving region just shows pavement image, and do not show the concrete pixel value of each pixel in this scope, so need could accurately definite pavement image according to moving region of determining and background image.
In above-mentioned flow process, can after the number of times of statistical pixel point, carry out the renewal of background image, promptly S404 carries out after S405; Perhaps, the renewal of background image and the number of times of statistical pixel point are carried out simultaneously, promptly S404 and S405 carry out simultaneously.
Road image extraction method in the intelligent video monitoring that the embodiment of the invention provides based on the frame-to-frame differences point-score, estimates background image, and then detects moving target, has improved the degree of accuracy that image extracts; The movement destination image that utilizes motion detection to obtain is estimated the moving region, can successfully manage the moving region complicated situation, for example the multilane situation in the traffic monitoring; The pavement image that utilization extracts can simple and effectively carry out subsequent operations such as velocity to moving target statistics, Based Intelligent Control, moving target number statistical, is widely used.
The embodiment of the invention provides a kind of pavement image extraction element simultaneously, as shown in Figure 5, comprising:
Image collection module 501: the input picture that is used for obtaining video flowing;
Background modeling module 502: be used for according to the input picture generation background image that obtains;
Motion detection block 503: be used for generating movement destination image according to the motor image vegetarian refreshments of background image detection from the input picture that video flowing obtains;
Pavement image synthesis module 504: be used to add up the movement destination image frame number that is generated, and according to the motor image vegetarian refreshments in each frame movement destination image, add up the number of times that each pixel belongs to the motor image vegetarian refreshments respectively, when the movement destination image frame number that is generated reaches the setting frame number, determine the moving region of statistics number, and generate pavement image according to moving region of determining and background image greater than the pixel component movement target of first threshold.
More excellent, as shown in Figure 6, this device also comprises context update module 505, wherein:
Context update module 505: be used for background image according to movement destination image and input picture renewal background modeling module 502.
Realization principle and concrete disposal route to each module in the embodiment of the invention describes in detail below.
At first introduce the realization principle of background modeling module.
Moving target in the intelligent video monitoring generally all moves, in long video flowing of a period of time, for each pixel, always in a few frame input pictures, belong to non-motor point, this moment, the pixel value of this pixel was exactly the pixel value of correspondence position in the background image.The embodiment of the invention utilizes the background modeling module to extract the background image of monitoring scene according to this basic thought.
At first set up a width of cloth initialization background image, be expressed as [I
B(x, y)]
W * h, wherein w and h represent the width and the height of this initialization background image respectively, the pixel value initialization of each pixel is 0; Structural matrix [N (x, y)]
W * h[C (x, y)]
W * h, wherein (x, y) (x y) belongs to the number of times of still image vegetarian refreshments to the remarked pixel point to N, C (x, y) remarked pixel point (x, update times y), and all be initialized as complete 0 matrix.
Some frame input pictures to extracting successively from one section video flowing repeat following operation:
For each frame input picture I
t, with its former frame input picture I
T-1Carry out absolute calculus of differences, promptly calculate the absolute value of the difference of each pixel corresponding pixel value in the two frame input pictures, obtain the difference image of these adjacent two frames,, be called first difference image herein in order to distinguish with the difference image of follow-up appearance; Again each first difference image is carried out the thresholding processing and obtain binary image, binary image is meant that the pixel value of each pixel in the image is 0 or 1, wherein the motor image vegetarian refreshments is 1, the still image vegetarian refreshments is 0, and thresholding is handled and each first difference image can be divided into two classes that do not comprise mutually;
Adopt morphological method that binary image is carried out Filtering Processing, obtain two-value foreground image [B (x, y)]
W * h, wherein the pixel value of still image vegetarian refreshments is 0, the pixel value of motor image vegetarian refreshments is 1;
On this two-value foreground image, if B (x, y)=0, then N (x y) adds 1, if B (x, y)=1, then N (x, y) constant.Setting threshold is T, and in order to distinguish with first threshold above, threshold value T is called second threshold value herein; When N (x, y)>during T, executable operations: I then
B(x y) adds I
t(x, y), (x y) adds 1 to C;
Through after the processing to some frame input pictures, (x, y) all greater than 0 o'clock, (x, pixel value y) is carried out the operation shown in formula [1], promptly obtains background image [I to any pixel in the initialization background image as all C
B' (x, y)]
W * h:
I
B′(x,y)=I
B(x,y)/C(x,y) [1]
Formula [1] is meant that the pixel value of each pixel in the initialization background image after the pixel value of each pixel equals to upgrade in the background image is divided by update times.
To adopting morphological method in the embodiment of the invention binary image is carried out Filtering Processing, simply introduce, morphological method comprises dilation operation, erosion operation, opening operation, pass computing etc., binary image is carried out Filtering Processing, mainly be the cavity of filling in the foreground area, remove the less isolated area of area, non-connected region simultaneously, only keep the connected component of the area of connected region greater than given threshold value, threshold value can be called the 3rd threshold value herein, specifically comprises the steps:
A, binary image is carried out medium filtering,, for example carry out 3 * 3 medium filtering to remove isolated noise spot;
B, the image that step a is obtained carry out the morphology expansive working, for example carry out 5 * 5 morphology expansive working;
C, the image that step b is obtained carry out border tracking (Bound Tracking), perhaps marginal point connects (Edge Point Linking), obtain the border of each connected region in the image, thereby obtain the relevant information of each connected region, as size, area etc., remove area then less than the 3rd threshold value or the connected region in irregular shape set, can set flexibly as required;
The pixel of the profile inside that obtains among d, the step c is set to the foreground point, to fill the cavity that wherein may exist.
Then introduce the realization principle of motion detection block.
Motion detection algorithm commonly used at present comprises optical flow method, frame-to-frame differences point-score, background subtraction point-score or the like.The embodiment of the invention adopts the background subtraction point-score, and promptly (x, y), the absolute value of the difference of the respective pixel value of calculating input image and background image obtains difference image [Δ (x, y)] at each pixel
W * h,, be called second difference image herein for the ease of distinguishing; Again second difference image is carried out thresholding and handle, distinguish motor image vegetarian refreshments and still image vegetarian refreshments, obtain binary image, the motor image vegetarian refreshments is the pixel of component movement target; Use Mathematical Morphology Method that binary image is carried out Filtering Processing then, fill the cavity in the foreground area, remove the less isolated area of area, non-connected region simultaneously, only keep the connected component of the area of connected region, obtain movement destination image greater than given threshold value.Movement destination image also is a binary image, and wherein the pixel value of still image vegetarian refreshments is 0, and the pixel value of motor image vegetarian refreshments is 1;
Then introduce the realization principle of context update module.
Background image is upgraded, can adopt accomplished in many ways, the implementation method that embodiment of the invention introduction is wherein a kind of, shown in formula [2]:
I
B(t,x,y)=(1-α)I
t-1(x,y)+αI
t(x,y) [2]
If t constantly, input picture is I
t, the movement destination image that obtains after motion detection block is handled is F
t, then each pixel (x, the pixel value I that y) locates in the background image updating
B(t, x, y), shown in formula [3]:
Wherein, condition F
t(x is meant that y)=0 pixel value in the movement destination image is 0 pixel, corresponding still image vegetarian refreshments, and α is first weight, is greater than 0 less than 1 constant, and 1-α is second weight, and α can set as required flexibly.
Introduce the realization principle of pavement image synthesis module at last.
Image is synthetic mainly to be moving region and the non-moving region of distinguishing moving target, is example with the intelligent transportation monitoring, mainly be the Highway house that determines various vehicles operations the position, to distinguish non-road surface, for example house of both sides, road, trees etc.
The specific implementation flow process is as follows: structural matrix [R (x, y)]
W * h, wherein arbitrary element R (x, y) expression (x, the pixel of y) locating belongs to the statistics number of motor image vegetarian refreshments in the movement destination image, is initialized as complete 0 matrix; Input picture to extracting from one section video flowing repeats following operation to each frame:
To each pixel (x y), if the pixel value of this pixel is 1 on the detected movement destination image of motion detection block, also promptly is defined as the motor image vegetarian refreshments, then with R (x, value y) adds 1, otherwise R (x, value y) remains unchanged.
When having detected the input picture of setting frame number, also promptly generated and set after the movement destination image of frame number, the method of using thresholding to handle is divided into two classes with all pixels among the matrix R, be the moving region and the non-moving region of moving target, generate binary image, if the statistics number of pixel correspondence is greater than the first threshold of setting, judge that then this pixel belongs to the moving region of moving target, the pixel corresponding pixel value is 1 in the moving region, otherwise belong to non-moving region, the pixel corresponding pixel value is 0 in the non-moving region.
More excellent, can also use Mathematical Morphology Method that the binary image that obtains is carried out Filtering Processing, to remove the flase drop zone, further improve the accuracy of extracting.For example extract for the road surface in the intelligent transportation monitoring, generally speaking, every road can utilize this hypothesis to remove most flase drop zone to I haven't seen you for ages through two limits of image; Certainly also have different discrimination principles for different actual scenes, can determine according to actual conditions.
At last, can generate pavement image according to background image and the moving region of determining, because each pixel corresponding pixel value is 1 in the moving region, each pixel corresponding pixel value is 0 in the non-moving region, so the scope of pavement image just can be delimited by the moving region.After the scope of pavement image was delimited, the pixel value of each pixel can be determined according to background image in this scope, thereby generated pavement image.
For the ease of understanding, be that example is introduced with several sub-pictures.
Seeing also Fig. 7 a, is a frame input picture that obtains from one section video flowing, and the moving target in this frame input picture is an automobile; Static background is a highway, and vegetation of highway both sides, soil etc.
Seeing also Fig. 7 b, is the background image that is generated according to the some frame input pictures that obtain from this section video flowing, and as can be seen, the moving target automobile is removed in background image, has only kept static background.The moving region of moving target is a highway in this background image, and non-moving region is vegetation, soil of highway both sides etc.Purpose of the present invention will accurately be extracted the image that the moving region highway is formed just.
See also Fig. 7 c, the road image extraction method that adopts the embodiment of the invention to provide has accurately been determined moving region and non-moving region by motion detection, and wherein non-moving region is the zone that indicates with " x " in the jaggies.Can obtain pavement image after from background image, removing the non-moving region of this part.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.