Embodiment
Clearly understand to make the technical scheme in the embodiment of the present invention and advantage, below in conjunction with accompanying drawing, exemplary embodiment of the present invention is described in more detail, obviously, described embodiment is only a part of embodiment of the present invention, instead of all embodiments is exhaustive.
Inventor notices in invention process:
Existing camera lens occlusion detection technical scheme, all carry out analysis based on plane two-dimensional data to judge, the difference of such as simple computation current picture and picture sometime before, or set up RGB background model based on RGB data, the difference of statistics prospect and background judges whether camera lens is blocked, owing to there is no depth information, cannot judge that prospect arrives the distance of camera lens, just can not well judge the situation that the use of malice blocks camera lens with the living photo of background, reduce the accuracy that camera lens blocks, even lose the effect of camera lens monitoring.
Simultaneously, inventor also finds that existing depth transducer has very serious noise, and the spot noise far away apart from camera lens is larger, and this relation is comparatively stable, so by statistical method Modling model and degree of depth histogram can be determined, obtain reliable background and foreground depth, and then judge whether camera lens is blocked.
For the deficiencies in the prior art, in the embodiment of the present invention, provide a kind of camera lens occlusion detection method and device, improve camera lens occlusion detection accuracy rate.Be described below.
Fig. 1 is the schematic flow sheet that in the embodiment of the present invention, camera lens occlusion detection method is implemented, and as shown in the figure, can comprise step:
Step 101, determine foreground picture picture frame, described foreground picture picture frame comprises depth information;
Step 102, determine the degree of depth histogram of described foreground picture picture frame according to described depth information;
The histogrammic difference of the degree of depth of step 103, the degree of depth histogram determining described foreground picture picture frame and background model, described background model is determined according to background image frame, and described background image frame comprises depth information;
Step 104, whether to be blocked according to described difference determination camera lens.
In concrete enforcement, the object of movement can will can be called prospect, long-time actionless object is called background, in the implementation process of embodiment, the common hardware can developed by companies such as PrimeSense obtains the picture frame with depth information, such as, PrimeSense depth transducer can be used to obtain the picture frame that resolution is 640*480 pixel, then come Statistic analysis foreground depth and background depth based on depth information, and then detect whether camera lens is maliciously blocked.In addition, the histogrammic difference of the degree of depth can be compared by the mode setting threshold value, if this difference exceedes certain threshold value, then can judge that this camera lens is blocked, certainly, setting threshold value is a kind of preferred implementation, only understands for convenience of those skilled in the art and implements, not limiting in the embodiment of the present invention to this.
In the technical scheme that the embodiment of the present invention provides, owing to adding depth information, the object of detection becomes three-dimensional from two dimension, and the content of detection is more comprehensively abundant, by judging depth information Changing Pattern, and the essence that the camera lens that can better reduce blocks.The technical scheme adopting the embodiment of the present invention to provide, can improve the accuracy of camera lens occlusion detection, for security protection work provides strong guarantee.
In enforcement, after determining foreground picture picture frame, may further include:
By described foreground picture picture frame scaled down, and determine the degree of depth histogram of described foreground picture picture frame according to the depth information that the foreground picture picture frame of described scaled down comprises.
In concrete enforcement, in the application scenarios of camera lens occlusion detection, in prospect or background, the change of details generally can not affect testing result, is not enough to interference to the judgement in camera lens occlusion detection.Owing to more focusing on the change of macroscopic view in scene, so the resolution of picture frame suitably can be reduced, such as can by foreground picture picture frame scaled down 20 times.
Under the prerequisite not reducing detection accuracy, suitably reduce the resolution of picture frame, can calculation resources be saved, be conducive to the judging efficiency improving camera lens occlusion detection.
In addition, the degree of depth histogram of described foreground picture picture frame can be determine according to the foreground picture picture frame of scaled down.In specific implementation process, to the foreground picture picture frame got, the distribution of the degree of depth can be added up: be 6 intervals to the distance of camera lens by spatial division according to object according to following rule, 5 parts are evenly divided in the scope of 0 to 2 meters, all as the 6th interval beyond 2 meters, do the statistics of the degree of depth according to these 6 intervals.
Object is divided into 6 uneven intervals, the interval more crypto set of 0 to 2 meters to the distance of camera lens, is because blocking of camera lens mainly occurs in the scope of 0 to 2 meters, and blocking camera lens in the position far away more than 2 meters is comparatively difficulty.Such interval division is optimized deep statistical, can reflect depth information more accurately, and then provides more favourable foundation to the judgement detection that camera lens blocks.
For the foreground picture picture frame of scaled down, identical rule still can be adopted to add up the distribution of the degree of depth, the judgement that camera lens is blocked can not be affected.
In enforcement, described background image frame can be determined before determining foreground picture picture frame.
In concrete enforcement, before acquisition foreground picture picture frame, can the relevant information of first background extraction picture frame, namely carry out initialized operation.Such as, can obtain by PrimeSense depth transducer the background image frame with depth information that resolution is 640*480 pixel, set up background model according to this background image frame, and determine the degree of depth histogram of background model.The degree of depth histogram of foreground picture picture frame and background model is compared and then can determine whether camera lens is blocked.Above-mentioned initialized operate in judge that camera lens blocks before, the time loss of judgement can be reduced, increase work efficiency.
Wherein, in embodiments of the present invention, gauss hybrid models can be adopted to set up background model.In gauss hybrid models, due to the behavior of uncertain noise, namely think that it is completely random and probability distribution is unclear, therefore two hypothesis can be set, namely the distribution of (1) same pixel noise is a fixing distribution, just determine when dispatching from the factory, and can not change in time; (2) same pixel is in the different time, and observed value is mutually independently.Based on these two hypothesis, according to central limit theorem, the stochastic variable that N number of independent identically distributed stochastic variable summation formation one is new, when N is very large, new stochastic variable levels off to Gaussian distribution.In concrete enforcement, 3 Gaussian functions can be set up for each pixel, add up the change of their degree of depth within a period of time, after average and variance all settle out, represent the degree of depth of correspondence position by the average of the most stable Gaussian function.Wherein, the frame per second of use can be 30 frames/second, and namely each pixel can produce 30 observed readings in one second, just can collect several thousand to several ten thousand observed readings within such a few minutes, has the parameter of enough data fitting Gaussian functions, obtains background model.
Except using gauss hybrid models to set up except background model, background model can also be set up according to the depth information of certain point and the corresponding relation between the numerical value of this degree of depth time error.Particularly, owing to find that in invention process noise is not completely random, when position (mainly referring to the depth information of this point) the distance camera lens then noise far away of this point is larger, depth information and can corresponding relation be there is between the numerical value of this degree of depth time error, such as shown in table 1, table 1 is depicted as few examples data, only facilitates those skilled in the art to understand and implements, the use of not restricting data in the embodiment of the present invention.
Table 1, depth information be the mapping table of error value under the degree of depth therewith
The degree of depth (/mm) |
Error (/mm) |
1 |
0.000005 |
2 |
0.000019 |
3 |
0.000042 |
…… |
…… |
1000 |
4.664 |
1001 |
4.674 |
…… |
…… |
9997 |
447.373 |
9998 |
447.460 |
9999 |
447.548 |
10000 |
447.635 |
In concrete enforcement, above-mentioned corresponding relation can be set up form (as table 1), load when setting up background model or call this relation table, and setting up background model according to this table.
Background model carries out the foundation of camera lens occlusion detection judgement and the object with the comparison of foreground picture picture frame.Background model, owing to have passed through the process of denoising, better can react background information, can provide good benchmark, can improve the accuracy of judgement for camera lens occlusion detection.
In enforcement, after the background model setting up depth information according to described background image frame, may further include:
By described background model scaled down, and determine the degree of depth histogram of described background model according to the depth information that the background model of described scaled down comprises.
In concrete enforcement, the change due to details in prospect or background generally can not disturb the judgement in camera lens occlusion detection, thus, suitably can reduce the resolution of picture frame, such as can by background model scaled down 20 times.Under the prerequisite not reducing detection accuracy, suitably reduce the resolution of picture frame, can calculation resources be saved, be conducive to the judging efficiency improving camera lens occlusion detection.
In addition, the degree of depth histogram of described background model can be determine according to the background model of scaled down.In implementation process, to background model, the distribution of the degree of depth can be added up: be 6 intervals to the distance of camera lens by spatial division according to object according to the rule identical with foreground picture picture frame, 5 parts are evenly divided in the scope of 0 to 2 meters, all as the 6th interval beyond 2 meters, do the statistics of the degree of depth according to these 6 intervals.
Object is divided into 6 uneven intervals, the interval more crypto set of 0 to 2 meters to the distance of camera lens, is because blocking of camera lens mainly occurs in the scope of 0 to 2 meters, and blocking camera lens in the position far away more than 2 meters is comparatively difficulty.Such interval division is optimized deep statistical, can reflect depth information more accurately, and then provides more favourable foundation to the judgement detection that camera lens blocks.
For the background model of scaled down, identical rule still can be adopted to add up the distribution of the degree of depth, the judgement that camera lens is blocked can not be affected.For the background model of scaled down, the foreground picture picture frame of scaled down that can adopt corresponded compares.
In enforcement, described foreground picture picture frame can be determined according to predetermined period.
In concrete enforcement, at interval of a period of time, a foreground picture picture frame can be obtained, obtain according to predetermined period and carry out camera lens occlusion detection, after detecting and being blocked, can give the alarm or point out.
Periodic acquisition foreground picture picture frame and carry out camera lens occlusion detection, effectively can judge that whether camera lens is blocked, and gives alarm when blocking, and can improve the effect of security protection.
Be described with the use of example to the method that embodiment provides again below.
First PrimeSense depth transducer is disposed in the scene needing monitoring, before judging whether camera lens is blocked, carry out initialized operation, comprise and obtain by PrimeSense depth transducer the background image frame comprising depth information that resolution is 640*480 pixel, and adopt gauss hybrid models to set up background model according to this depth information, in order to save calculation resources, can by this background model scaled down 20 times, and add up degree of depth histogram according to the background model of this scaled down, the degree of depth histogram and the initial work that obtain background model complete.
Then at interval of a period of time, namely in predetermined period, the foreground picture picture frame that resolution is 640*480 pixel is obtained by PrimeSense depth transducer, also for ease of saving calculation resources, can by this foreground picture picture frame scaled down 20 times, and add up degree of depth histogram according to the foreground picture picture frame of this scaled down, the degree of depth histogram of the degree of depth histogram of this foreground picture picture frame with the background model obtained before is compared, determine that camera lens is blocked when difference exceedes predetermined threshold value, can the promptings such as alarm be carried out.
Based on same inventive concept, a kind of camera lens occlusion detection device is additionally provided in the embodiment of the present invention, the principle of dealing with problems due to device is similar to a kind of camera lens occlusion detection method, and therefore the enforcement of device see the enforcement of method, can repeat part and repeat no more.
Fig. 2 is the structural representation of camera lens occlusion detection device in the embodiment of the present invention, as shown in the figure, can comprise in a device:
Depth transducer 201, for determining foreground picture picture frame, described foreground picture picture frame comprises depth information
;
Histogram determination module 202, for determining the degree of depth histogram of described foreground picture picture frame according to described depth information;
Difference determination module 203, for the histogrammic difference of the degree of depth of the degree of depth histogram and background model of determining described foreground picture picture frame, described background model is determined according to background image frame, and described background image frame comprises depth information;
Whether camera lens blocks determination module 204, for being blocked according to described difference determination camera lens.
In enforcement, may further include:
Reduce module, for after determining foreground picture picture frame, by described foreground picture picture frame scaled down;
The depth information that histogram determination module 202 can be further used for comprising according to the foreground picture picture frame of scaled down determines the degree of depth histogram of described foreground picture picture frame.
In enforcement, depth transducer 201 can be further used for, before determining foreground picture picture frame, determining background image frame;
In enforcement, reduce module and can be further used for after the background model setting up depth information according to described background image frame, by described background model scaled down;
The depth information that histogram determination module 202 can be further used for comprising according to the background model of scaled down determines the degree of depth histogram of described background model.
In enforcement, described depth transducer 201 can be further used for according to predetermined period determination foreground picture picture frame.
For convenience of description, each several part of the above device is divided into various parts or unit to describe respectively with function.Certainly, the function of each parts or unit can be realized in same or multiple software or hardware when implementing of the present invention.
Those skilled in the art should understand, embodiments of the invention can be provided as method, device or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (device) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.