A kind of camera lens occlusion detection method and device
Technical field
The present invention relates to security monitoring technology, more particularly to a kind of camera lens occlusion detection method and device.
Background technology
At present, the safety defense monitoring system of the various scales of China's every profession and trade is very universal, except public security, finance, silver
Outside the special dimensions such as row, traffic, army and port, community, office building, hotel, public place have also all been mounted with security protection mostly
Monitoring device.When the camera lens in safety monitoring equipment are artificially maliciously blocked, if monitoring personnel fails to find in time,
Monitoring can be then caused to be failed.
The method for solving the camera lens occlusion detection in the prior art be by camera obtain scene RGB (red, green,
Blue, RGB) data, RGB background models are established, count the difference of foreground and background to judge whether camera lens is blocked.By
RGB data in the data that camera lens collects, the image restored is two-dimensional image, can not judge prospect to camera lens away from
From, so cannot be distinguished by foreground pixel change is as caused by blocking camera lens, also it is due to that many objects are made in movement in scene
Into, if for example, when blocking camera lens using the photo of a background, see that scene is no different with real background in camera lens, due to nothing
Method preferably reduces the physical process that camera lens blocks, and is only the conjecture based on panel data change, therefore camera lens can be caused to block
The accuracy rate of detection is relatively low.
The deficiencies in the prior art are:
The method accuracy rate that detector lens are blocked in the prior art is relatively low, does not reach preferable safety monitoring effect.
The content of the invention
A kind of camera lens occlusion detection method and device is provided in the embodiment of the present invention, it is accurate to solve existing detection method
The problem of really rate is relatively low.
A kind of camera lens occlusion detection method, including step are provided in the embodiment of the present invention:
Determine foreground image frame, the foreground image frame includes depth information;
The depth histogram of the foreground image frame is determined according to the depth information;
Determine the difference of the depth histogram of the foreground image frame and the depth histogram of background model, the background mould
Type determines that the background image frame includes depth information according to background image frame;
Determine whether camera lens is blocked according to the difference.
A kind of camera lens occlusion detection device is provided in the embodiment of the present invention, including:
Depth transducer, for determining foreground image frame, the foreground image frame includes depth information;
Histogram determining module, for determining the depth histogram of the foreground image frame according to the depth information;
Difference determining module, for determining the depth histogram of the foreground image frame and the depth histogram of background model
Difference, the background model determines that the background image frame includes depth information according to background image frame;
Camera lens blocks determining module, for determining whether camera lens is blocked according to the difference.
The beneficial effects of the invention are as follows:
In technical solution provided in an embodiment of the present invention, using depth histogram based on depth information come Statistic analysis prospect
Depth and background depth, and then detect whether camera lens is maliciously blocked.Compared with the prior art it is middle to judge camera lens using RGB information
The technical solution being blocked, due to adding depth information, the object of detection is changed into three-dimensional from two dimension, and the content of detection is richer
It is rich comprehensive, it can preferably reduce the essence that camera lens blocks.Using technical solution provided in an embodiment of the present invention, it is possible to increase camera lens
The accuracy of occlusion detection, strong guarantee is provided for security protection work.
Brief description of the drawings
The specific embodiment of the present invention is described below with reference to accompanying drawings, wherein:
Fig. 1 is the flow diagram that camera lens occlusion detection method is implemented in the embodiment of the present invention;
Fig. 2 is the structure diagram of camera lens occlusion detection device in the embodiment of the present invention.
Embodiment
In order to which technical solution in the embodiment of the present invention and advantage is more clearly understood, below in conjunction with attached drawing to the present invention
Exemplary embodiment be described in more detail, it is clear that described embodiment be only the present invention a part implementation
Example, rather than the exhaustion of all embodiments.
Inventor notices during invention:
Existing camera lens occlusion detection technical solution, is all based on plane two-dimensional data and carries out analysis judgement, such as simply
Current picture and the before sometime difference of picture, or RGB background models are established based on RGB data are calculated, counts prospect
Judge whether camera lens is blocked with the difference of background, due to no depth information, can not judge prospect to the distance of camera lens, it is right
The situation that camera lens is blocked in the use of malice with the photo of background striking resemblances cannot judge well, reduce camera lens screening
The accuracy of gear, or even lose the effect of camera lens monitoring.
Meanwhile inventor also found that existing depth transducer has very serious noise, and the point more remote apart from camera lens
Noise is bigger, and this relation is relatively stable, it is possible to model and definite depth histogram is established by statistical method, to obtain
Reliable background and foreground depth are obtained, and then judges whether camera lens is blocked.
In view of the deficiencies of the prior art, a kind of camera lens occlusion detection method and device is provided in the embodiment of the present invention, is come
Improve camera lens occlusion detection accuracy rate.It is illustrated below.
Fig. 1 is the flow diagram that camera lens occlusion detection method is implemented in the embodiment of the present invention, as shown in the figure, can include
Step:
Step 101, determine foreground image frame, and the foreground image frame includes depth information;
Step 102, the depth histogram for determining according to the depth information foreground image frame;
The difference of the depth histogram of step 103, the depth histogram for determining the foreground image frame and background model, institute
State background model to be determined according to background image frame, the background image frame includes depth information;
Step 104, according to the difference determine whether camera lens is blocked.
In specific implementation, the object that can be moved can be known as to prospect, actionless object will be known as carrying on the back for a long time
Scape, in the implementation process of embodiment, can be obtained with depth by the common hardware that the companies such as PrimeSense develop
The picture frame of information, it is, for example, possible to use PrimeSense depth transducers obtain the image that resolution ratio is 640*480 pixels
Frame, is then based on depth information and comes Statistic analysis foreground depth and background depth, and then detects whether camera lens is maliciously blocked.
Furthermore it is possible to compare the difference of depth histogram by way of given threshold, if the difference exceedes certain threshold value, can sentence
The disconnected camera lens is blocked, and certainly, given threshold is a kind of preferred embodiment, only for convenience of skilled artisan understands that and real
Apply, it is without limitation in the embodiment of the present invention.
In technical solution provided in an embodiment of the present invention, due to adding depth information, the object of detection is changed into from two dimension
Three-dimensional, the content of detection is more abundant comprehensive, by judging depth information changing rule, can preferably reduce the sheet that camera lens blocks
Matter.Using technical solution provided in an embodiment of the present invention, it is possible to increase the accuracy of camera lens occlusion detection, provides for security protection work
Strong guarantee.
In implementation, after definite foreground image frame, it may further include:
By the foreground image frame scaled down, and the depth included according to the foreground image frame of the scaled down
Information determines the depth histogram of the foreground image frame.
In specific implementation, the change of details is not generally in the application scenarios of camera lens occlusion detection, in prospect or background
Testing result can be influenced, is insufficient to interfere with to the judgement in camera lens occlusion detection.Due to more focusing on change macroscopical in scene,
So the resolution ratio of picture frame can be suitably reduced, such as can be 20 times by foreground image frame scaled down.
On the premise of detection accuracy is not reduced, the appropriate resolution ratio for reducing picture frame, can save calculation resources, have
Beneficial to the judging efficiency for improving camera lens occlusion detection.
In addition, the depth histogram of the foreground image frame can be determined according to the foreground image frame of scaled down
's.In specific implementation process, to the foreground image frame got, the distribution of depth can be counted according to following rule:Root
6 sections are divided the space into according to the distance of object to camera lens, are evenly dividing in the range of 0 to 2 meters as 5 parts, 2 meters whole in addition
As the 6th section, the statistics of depth is done according to this 6 sections.
The distance of object to camera lens is divided into non-uniform 6 sections, 0 to 2 meters of section more crypto set, is due to mirror
In the range of the blocking and occur mainly in 0 to 2 meters of head, it is more difficult that camera lens is blocked more than 2 meters remote positions.So
Interval division deep statistical is optimized, can more accurately reflect depth information, so camera lens is blocked judgement inspection
Survey and more favourable foundation is provided.
For the foreground image frame of scaled down, the distribution of depth can be still counted using identical rule, no
It can influence the judgement blocked to camera lens.
In implementation, the background image frame can be predetermined in definite foreground image frame.
In specific implementation, before foreground image frame is obtained, the relevant information of background image frame can be first obtained, that is, is carried out
The operation of initialization.For example, it is deep for carrying for 640*480 pixels resolution ratio can be obtained by PrimeSense depth transducers
The background image frame of information is spent, background model is established according to the background image frame, and determine the depth histogram of background model.Will
Foreground image frame and the depth histogram of background model compare and then can determine whether camera lens is blocked.The behaviour of above-mentioned initialization
Make before judging that camera lens blocks, it is possible to reduce the time loss of judgement, improves work efficiency.
Wherein, in embodiments of the present invention, background model can be established using gauss hybrid models.Gauss hybrid models
In, due to the behavior of uncertain noise, that is, think that it is completely random and probability distribution is unclear, therefore can set
Fixed two it is assumed that i.e. (1) had determined that as soon as the distribution of same pixel noise is a fixed distribution when dispatching from the factory, and
And it will not change over time;(2) for same pixel in the different time, observed value is independent mutually.It is false based on the two
If according to central-limit theorem, N number of independent identically distributed stochastic variable summation forms a new stochastic variable, when N is very big
When, new stochastic variable levels off to Gaussian Profile.In specific implementation, it can be that each pixel establishes 3 Gaussian functions, count
The change of their depth within a period of time, after average and variance all settle out, with a most stable of Gaussian function
Average represents the depth of correspondence position.Wherein, the frame per second used can be 30 frames/second, i.e., each pixel can produce in one second
30 observations, can be collected within such a few minutes it is thousands of arrive tens of thousands of a observations, have enough data fitted Gaussian letters
Several parameters, obtains background model.
, can also be according to the depth information and herein of certain point in addition to establishing background model using gauss hybrid models
Correspondence during depth between the numerical value of error establishes background model.Specifically, due to finding noise simultaneously during invention
Completely random, when the point position (depth information for referring mainly to the point) apart from the more remote then noise of camera lens bigger, depth
Information and there may be correspondence between the numerical value of error in this depth, such as shown in table 1, table 1 show few examples
Data, it is only convenient skilled artisan understands that and implement, the use of data is not limited in the embodiment of the present invention.
The mapping table of table 1, depth information and error value under this depth
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 specific implementation, above-mentioned correspondence can be established to form (such as table 1), when establishing background model loading or
The relation table is called, and background model is established according to the table.
Background model is the object for carrying out the foundation of camera lens occlusion detection judgement and being compared with foreground image frame.Background model
Due to have passed through the processing of denoising, background information can be preferably reacted, preferable benchmark can be provided for camera lens occlusion detection,
The accuracy of judgement can be improved.
In implementation, after the background model of depth information is established according to the background image frame, it may further include:
By the background model scaled down, and the depth information included according to the background model of the scaled down
Determine the depth histogram of the background model.
In specific implementation, since the change of details in prospect or background is generally without interference with sentencing in camera lens occlusion detection
It is disconnected, therefore, it is possible to the resolution ratio of picture frame is suitably reduced, such as can be 20 times by background model scaled down.Do not reducing
On the premise of detection accuracy, the appropriate resolution ratio for reducing picture frame, can save calculation resources, be conducive to raising camera lens and block
The judging efficiency of detection.
In addition, the depth histogram of the background model can be determined according to the background model of scaled down.
In implementation process, to background model, the distribution of depth can be counted according to the rule identical with foreground image frame:According to object
Distance to camera lens divides the space into 6 sections, is evenly dividing in the range of 0 to 2 meters as 5 parts, and the is all used as beyond 2 meters
6 sections, the statistics of depth is done according to this 6 sections.
The distance of object to camera lens is divided into non-uniform 6 sections, 0 to 2 meters of section more crypto set, is due to mirror
In the range of the blocking and occur mainly in 0 to 2 meters of head, it is more difficult that camera lens is blocked more than 2 meters remote positions.So
Interval division deep statistical is optimized, can more accurately reflect depth information, so camera lens is blocked judgement inspection
Survey and more favourable foundation is provided.
For the background model of scaled down, the distribution of depth can be still counted using identical rule, will not
Influence the judgement blocked to camera lens.It is corresponding to use scaled down for the background model of scaled down
Foreground image frame be compared.
In implementation, the foreground image frame can be determined according to predetermined period.
In specific implementation, at interval of a period of time, a foreground image frame can be obtained, obtains and goes forward side by side according to predetermined period
Row camera lens occlusion detection, after detecting and being blocked, can send alarm or prompting.
Periodically obtain foreground image frame and carry out camera lens occlusion detection, can effectively judge whether camera lens is hidden
Gear, gives alarm, it is possible to increase the effect of security protection when blocking.
The use of the method provided again with example embodiment below illustrates.
PrimeSense depth transducers are disposed first in the scene for needing to monitor, and are judging whether camera lens is blocked it
Before, the operation that is initialized, including pass through PrimeSense depth transducers and obtain resolution ratio including for 640*480 pixels
The background image frame of depth information, and background model is established using gauss hybrid models according to the depth information, in order to save fortune
Calculate resource, can by 20 times of the background model scaled down, and according to the background model of the scaled down count depth it is straight
Fang Tu, the depth histogram i.e. initial work for obtaining background model are completed.
Then at interval of a period of time, i.e., in predetermined period, obtaining resolution ratio by PrimeSense depth transducers is
The foreground image frame of 640*480 pixels, can be by the foreground image frame scaled down 20 for the purposes of saving calculation resources
Times, and according to the foreground image frame of the scaled down count depth histogram, by the depth histogram of the foreground image frame with
The depth histogram of the background model obtained before is compared, and determines that camera lens is blocked when difference exceedes predetermined threshold value, can
To carry out the prompting such as alarm.
Based on same inventive concept, a kind of camera lens occlusion detection device is additionally provided in the embodiment of the present invention, due to device
The principle solved the problems, such as is similar to a kind of camera lens occlusion detection method, therefore the implementation of device may refer to the implementation of method, weight
Multiple part repeats no more.
Fig. 2 is the structure diagram of camera lens occlusion detection device in the embodiment of the present invention, as shown in the figure, in a device can be with
Including:
Depth transducer 201, for determining foreground image frame, the foreground image frame includes depth information;
Histogram determining module 202, for determining the depth histogram of the foreground image frame according to the depth information;
Difference determining module 203, for determine the foreground image frame depth histogram and background model depth it is straight
The difference of square figure, the background model determine that the background image frame includes depth information according to background image frame;
Camera lens blocks determining module 204, for determining whether camera lens is blocked according to the difference.
In implementation, it may further include:
Module is reduced, for after definite foreground image frame, by the foreground image frame scaled down;
The depth that histogram determining module 202 can be further used for being included according to the foreground image frame of scaled down is believed
Breath determines the depth histogram of the foreground image frame.
In implementation, depth transducer 201 can be further used for before definite foreground image frame, determine background image
Frame;
In implementation, reducing module can be further used for establishing the background mould of depth information according to the background image frame
After type, by the background model scaled down;
Histogram determining module 202 can be further used for the depth information included according to the background model of scaled down
Determine the depth histogram of the background model.
In implementation, the depth transducer 201 can be further used for determining foreground image frame according to predetermined period.
For convenience of description, each several part of apparatus described above is divided into various parts with function or unit describes respectively.
Certainly, the function of each component or unit can be realized in same or multiple softwares or hardware when implementing the present invention.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, apparatus or computer program
Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more
The computer program production that usable storage medium is implemented on (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of product.
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (device) and computer program product
Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram
The combination of flow and/or square frame in journey and/or square frame and flowchart and/or the block diagram.These computer programs can be provided
The processors of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices, which produces, to be used in fact
The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to
Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or
The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or
The instruction performed on other programmable devices is provided and is used for realization in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in a square frame or multiple square frames.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation
Property concept, then can make these embodiments other change and modification.So appended claims be intended to be construed to include it is excellent
Select embodiment and fall into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
God and scope.In this way, if these modifications and changes of the present invention belongs to the scope of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to comprising including these modification and variations.