A method for detecting out-of-focus of video surveillance equipment

CN116152175BActive Publication Date: 2025-09-02CHINA FORESTRY STAR BEIJING TECH INFORMATION CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202211676112.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2025-09-02
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

[0004]为了解决现有基于图像的虚焦检测方法存在的上述诸多问题,本发明提供一种视频监控设备虚焦检测方法

Benefits of technology

[0033] The present invention provides a method for detecting defocus in video surveillance equipment, which implements defocus detection by measuring image clarity. This method involves capturing two images taken at different times, performing mean normalization on each image to remove the effects of scene lighting changes on image clarity, performing a Fourier transform on the mean-normalized image, removing high-frequency information through the Fourier transform, and then analyzing the difference between the image and the mean-normalized image. The two difference images and changes in high-frequency information are then comprehensively analyzed to determine whether defocus is present.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116152175B_ABST
    Figure CN116152175B_ABST
Patent Text Reader

Abstract

A method for detecting defocus in video surveillance equipment relates to the field of image processing. The method comprises: obtaining an image at a first moment, performing mean normalization processing on the image to obtain a mean normalized image at the first moment; performing Fourier transform and high-pass and low-pass filtering on the mean normalized image at the first moment, and then performing inverse Fourier transform on the mean normalized image at the first moment to obtain a first low-frequency information image and a first high-frequency information image; performing difference processing on the mean normalized image and the first low-frequency information image to obtain a first difference image; repeating steps S1-S3 to obtain an image at a second moment, a mean normalized image at a second moment, a second low-frequency information image, a second high-frequency information image, and a second difference image; and analyzing the two difference images and the high-frequency information image to detect whether defocus is present. The method has the advantages of a small amount of historical data, a small amount of computation, strong noise immunity, wide scene adaptability, and high detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for detecting out-of-focus of video surveillance equipment. Background Art

[0002] Video surveillance equipment has been widely used in various public places, such as shopping malls, hospitals, and train stations. Its widespread adoption has helped better protect people's lives and public property. Continuous technological innovation and development have also led to higher demands for video surveillance equipment's image quality. However, in actual use, blurry or unclear images often occur due to loose lenses or fluctuating ambient temperatures, impacting surveillance effectiveness. Furthermore, video surveillance equipment typically uses automatic focus at regular intervals, controlling the lens focus based on a focus search strategy. This automatic focus method can hinder user experience and introduce a risk of focus failure. When back focus is abnormal, focus loss can occur. Therefore, timely and accurate detection of out-of-focus conditions in video surveillance equipment is of great practical significance to the security industry. Out-of-focus detection technology can avoid the problem of delayed manual inspections, reduce the impact on the lifespan of video surveillance equipment caused by frequent automatic focus, and even detect out-of-focus conditions caused by back focus.

[0003] With the development of image processing technology, image-based defocus detection methods have become increasingly mature. Due to their advantages of high accuracy, low cost, and easy maintenance, they have become the preferred method for defocus detection in video surveillance equipment. For example, Chinese patent publication number CN113301324A discloses a defocus detection method, device, equipment, and medium based on a camera device. The patent proposes a defocus detection method, which includes: obtaining the clarity value of the current monitoring video of the camera device; determining whether the clarity value of the current monitoring video meets a preset clarity threshold; if the clarity value of the current monitoring video meets the preset clarity threshold, then determining that the camera device has defocus. This method determines whether defocus exists by determining whether the clarity value of the current monitoring video meets a preset clarity threshold. The clarity value can be directly obtained from the gradient information of the monitoring scene. However, this method directly obtains gradient information from the image, which is easily affected by scene differences and light differences. It is not universal and is generally only applicable to calibration scenes. For non-calibrated scenes, due to the large difference in gradient information of non-calibrated scenes, the thresholds involved in the clarity measurement are generally empirical values ​​and need to be set in advance. When the scene changes, there is a non-optimal threshold problem, which makes the threshold unable to adapt. For example, the Chinese patent with publication number CN111275657A discloses "Defocus Detection Method, Device and Computer-readable Medium". The patent proposes a defocus detection method based on boundary points, which includes: determining a set of strong boundary points from the image to be detected, where the strong boundary point set includes multiple strong boundary points; using a height retraction algorithm to calculate the boundary width of the strong boundary point; determining the narrow boundary points and wide boundary points in the strong boundary point set based on the boundary width of the strong boundary point; and determining whether the image to be detected is a focused image or a defocused image based on the first proportion of the narrow boundary points in the strong boundary point set and the second proportion of the wide boundary points in the strong boundary point set. The wide and narrow boundaries extracted by this method in complex outdoor environments or low-light scenes are unstable and have poor robustness. Another example is Chinese patent publication CN107240092A, titled "A Method and Apparatus for Image Blur Detection." This patent proposes an image blur detection method that divides an image into n blocks and calculates a clarity evaluation function and brightness weight values ​​across multiple frequency bands for each block to obtain a blur estimation for the entire image. This method improves blur judgment accuracy in low-light scenes, but high-frequency information in typical images is concentrated in a small area, and extracting frequency band information from multiple blocks increases the computational complexity. Summary of the Invention

[0004] In order to solve the above-mentioned problems existing in the existing image-based defocus detection method, the present invention provides a defocus detection method for video surveillance equipment.

[0005] The technical solutions adopted by the present invention to solve the technical problems are as follows:

[0006] A method for detecting out-of-focus of a video surveillance device according to the present invention comprises the following steps:

[0007] Step S1: Acquire an image at a first moment, perform mean normalization on the image, and obtain a mean normalized image at the first moment;

[0008] Step S2: performing edge information extraction and Fourier transform on the mean-normalized image at the first moment, and performing low-pass filtering and high-pass filtering on the transformed image respectively;

[0009] Step S3: performing inverse transformation after filtering to obtain a first low-frequency information image and a first high-frequency information image, performing difference processing between the first moment mean-normalized image and the first low-frequency information image to obtain a first difference image;

[0010] Step S4, repeating steps S1 to S3 to obtain the second moment image, the second moment mean normalized image, the second low-frequency information image, the second high-frequency information image, and the second difference image;

[0011] Step S5: Analyze the image feature differences to detect whether there is a defocus phenomenon.

[0012] Furthermore, the specific operation steps of step S1 are as follows:

[0013] S1.1 Obtaining the first moment image I clr ;

[0014] S1.2 First moment image I clr Perform grayscale transformation to obtain grayscale image I gray ;

[0015] S1.3 calculates the mean of the grayscale image, Where M and N are the number of rows and columns of the grayscale image, respectively. gray (i, j) is the grayscale value of the i-th row and j-th column of the grayscale image; the mean normalized image at the first moment is obtained through mean normalization processing Right now Where, is the mean normalized image at the first moment The pixel value of the i-th row and j-th column.

[0016] Furthermore, the specific operation steps of step S2 are as follows:

[0017] S2.1 Normalize the image by the mean at the first moment Perform discrete Fourier transform to obtain the transformed image F. The formula of discrete Fourier transform is as follows:

[0018]

[0019] Where M and N are the number of rows and columns of the grayscale image respectively; is the mean normalized image at the first moment The pixel value of the i-th row and j-th column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number;

[0020] S2.2 performs low-pass filtering on the image F to obtain the low-pass filtered image G low , that is, G low (u,v)=H low (u,v)*F(u,v), where D(u,v) represents the distance between the point (u,v) in the frequency domain and the center of the frequency domain rectangle, σ = 50;

[0021] S2.3 performs high-pass filtering on image F to obtain high-pass filtered image G high , that is, G high (u,v)=H high (u,v)*F(u,v), where D(u,v) represents the distance between the point (u,v) in the frequency domain and the center of the frequency domain rectangle, σ=100.

[0022] Furthermore, the specific operation steps of step S3 are as follows:

[0023] S3.1 Low-pass filtered image G low Perform inverse Fourier transform to obtain the first low-frequency information image The first low-frequency information image Represents the original image (mean normalized image at the first moment ) after removing the low-frequency information image of the high-frequency information, that is, Where, is the first low-frequency information image The pixel value of the xth row and yth column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number;

[0024] S3.2 High-pass filtered image G high Perform inverse Fourier transform to obtain the second high-frequency information image The second high-frequency information image Represents the original image (mean normalized image at the first moment ) after removing the low-frequency information, that is, Where, The first high-frequency information image The pixel value of the xth row and yth column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number;

[0025] S3.3 Perform differential processing on the first moment mean normalized image and the first low-frequency information image to obtain a first differential image, that is, the first moment mean normalized image Image with the first low-frequency information The difference between

[0026] Furthermore, the specific operation steps of step S4 are as follows:

[0027] Repeat the above steps S1 to S3 to obtain the second moment image Mean normalized image at the second moment Second low-frequency information image Second high-frequency information image and a second difference image, which is the mean normalized image at the second moment Image with the first low-frequency information The difference between

[0028] Furthermore, the specific operation steps of step S5 are as follows:

[0029] S5.1 Use the OSTU algorithm to binarize the first difference image and the second difference image to obtain binary images and Statistical binary images and The number of non-zero pixels and

[0030] S5.2 Use the ostu algorithm to analyze the first high frequency information image and the second high-frequency information image Perform binarization to obtain a binary image and Calculate binary image and The union of Statistical binary images and union The number of non-zero pixels and

[0031] S5.3 Determine whether there is a defocus phenomenon based on the above binary image information. and When the image is out of focus, it is determined that there is a defocus phenomenon.

[0032] The beneficial effects of the present invention are:

[0033] The present invention provides a method for detecting defocus in video surveillance equipment, which implements defocus detection by measuring image clarity. This method involves capturing two images taken at different times, performing mean normalization on each image to remove the effects of scene lighting changes on image clarity, performing a Fourier transform on the mean-normalized image, removing high-frequency information through the Fourier transform, and then analyzing the difference between the image and the mean-normalized image. The two difference images and changes in high-frequency information are then comprehensively analyzed to determine whether defocus is present.

[0034] The present invention requires a small amount of historical data: only one piece of historical data is needed as a reference, and the filtered data corresponding to the reference data can be extracted in advance, reducing the amount of calculation. The present invention has strong anti-noise ability: the data preprocessing adds mean normalization, which can remove the interference caused by changes in scene light. The present invention is adaptable to a wide range of scenarios: the image data collected at different times increases the prior knowledge of the scene, and can be applied to any environment such as indoors and outdoors. The present invention has high detection accuracy: the detection method of the present invention combines the fuzzy characteristics of the current scene and the fuzzy changes relative to historical data, which can improve the accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 The present invention is a flowchart of a method for detecting out-of-focus of a video surveillance device. DETAILED DESCRIPTION

[0036] The present invention will be further described in detail below with reference to the accompanying drawings.

[0037] The present invention provides a method for detecting out-of-focus in video surveillance equipment, which determines whether out-of-focus exists by comparing the high-frequency information changes between two images. The method mainly includes the following steps:

[0038] Step S1: Acquire an image at a first moment, perform mean normalization on the image, and obtain a mean normalized image at the first moment;

[0039] Step S2: performing edge information extraction and Fourier transform on the mean-normalized image at the first moment, and performing low-pass filtering and high-pass filtering on the transformed image respectively;

[0040] Step S3: After filtering, perform an inverse transform to obtain a first low-frequency information image and a first high-frequency information image (high-frequency information refers to areas where image intensity (brightness / grayscale) changes dramatically, usually corresponding to image edges (contours)). Perform a difference process between the first moment mean-normalized image and the first low-frequency information image to obtain a first difference image.

[0041] Step S4, repeating steps S1 to S3 to obtain the second moment image, the second moment mean normalized image, the second low-frequency information image, the second high-frequency information image, and the second difference image;

[0042] Step S5: Analyze the difference in image features to detect whether there is a defocus phenomenon (defocus is manifested as a blurred image and reduced high-frequency information in the image).

[0043] like Figure 1 As shown, a method for detecting out-of-focus of a video surveillance device according to the present invention specifically comprises the following steps:

[0044] Step S1: Obtain the image at the first moment and perform mean normalization on the image. The specific operation process is as follows:

[0045] S1.1 Obtaining the first moment image I clr ,The image is generally determined manually and does not have a defocusing phenomenon;

[0046] S1.2 First moment image I clr Perform grayscale transformation to obtain grayscale image I gray ;

[0047] S1.3 Grayscale image I gray Perform mean normalization processing to remove the impact of scene light changes on detection results. The specific operation process is as follows:

[0048] S1.3.1 Calculate the mean of the grayscale image, Where M and N are the number of rows and columns of the grayscale image, respectively. gray (i, j) is the grayscale value of the i-th row and j-th column of the grayscale image;

[0049] S1.3.2 Obtaining the mean normalized image at the first moment through mean normalization processing Right now Where, is the mean normalized image at the first moment The pixel value of the i-th row and j-th column.

[0050] Step S2: normalize the first moment mean value image obtained above Perform edge information extraction and Fourier transform, and perform low-pass filtering and high-pass filtering on the transformed image respectively; the specific operation process is as follows:

[0051] S2.1 Normalize the image by the mean at the first moment Perform discrete Fourier transform to obtain the transformed image F. The specific formula of discrete Fourier transform is as follows:

[0052]

[0053] Where M and N are the number of rows and columns of the grayscale image respectively; I gray (i,j) is the mean normalized image at the first moment The pixel value of the i-th row and j-th column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number;

[0054] S2.2 performs low-pass filtering on the image F to obtain the low-pass filtered image G low , that is, G low (u,v)=H low (u,v)*F(u,v), where D(u,v) represents the distance between the point (u,v) in the frequency domain and the center of the frequency domain rectangle, σ = 50;

[0055] S2.3 performs high-pass filtering on image F to obtain high-pass filtered image G high , that is, G high (u,v)=H high (u,v)*F(u,v), where D(u,v) represents the distance between the point (u,v) in the frequency domain and the center of the frequency domain rectangle, σ=100.

[0056] Step S3: After filtering, perform inverse transformation to obtain a first low-frequency information image and a first high-frequency information image, and perform difference processing between the first moment mean-normalized image and the first low-frequency information image to obtain a first difference image. The specific operation process is as follows:

[0057] S3.1 Low-pass filtered image G low Perform inverse Fourier transform to obtain the first low-frequency information image The first low-frequency information image Represents the original image (mean normalized image at the first moment ) after removing the low-frequency information image of the high-frequency information, that is, Where, The first low-frequency information image The pixel value of the xth row and yth column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number;

[0058] S3.2 High-pass filtered image G high Perform inverse Fourier transform to obtain the second high-frequency information image The second high-frequency information image Represents the original image (mean normalized image at the first moment ) after removing the low-frequency information, that is, Where, The first high-frequency information image The pixel value of the xth row and yth column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number;

[0059] S3.3 Perform differential processing on the first moment mean normalized image and the first low-frequency information image to obtain a first differential image, that is, the first moment mean normalized image Image with the first low-frequency information The difference between When out-of-focus occurs, the image difference information is small.

[0060] Step S4: Repeat steps S1 to S3 to obtain the second moment image. Mean normalized image at the second moment Second low-frequency information image Second high-frequency information image And the second difference image, the second difference image is the mean normalized image at the second moment Image with the first low-frequency information The difference between When out-of-focus occurs, the image difference information is small.

[0061] Step S5: Analyze the image feature differences to detect whether there is a defocus phenomenon. The specific operation process is as follows:

[0062] S5.1 Use the OSTU algorithm to binarize the first difference image obtained in step S3 to obtain a binary image At the same time, the second difference image obtained in step S4 is binarized using the OSTU algorithm to obtain a binary image Statistical binary map and binary images The number of non-zero pixels of and

[0063]

[0064] S5.2 calculates the high-frequency information changes at two moments, that is, uses the ostu algorithm to calculate the first high-frequency information image corresponding to the first moment. Perform binarization to obtain a binary image At the same time, the ostu algorithm is used to calculate the second high-frequency information image corresponding to the second moment Perform binarization to obtain a binary image Calculate binary image With binary image The union of Simultaneous statistical binary graph and union The number of non-zero pixels of and

[0065] S5.3 determines whether there is a defocus phenomenon based on the binary image information of step S5.1 and step S5.2, specifically: when and If the image is not in focus, it is determined that the image is out of focus; otherwise, it is determined that the image is not in focus, and steps S4 to S5 are repeated.

[0066] Step S6: When it is determined in step S5 that a defocus phenomenon exists, a defocus alarm may be sent.

[0067] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A method for detecting out-of-focus of a video surveillance device, characterized in that: The following steps are involved: Step S1: Acquire an image at a first moment, perform mean normalization on the image, and obtain a mean normalized image at the first moment; Step S2: performing edge information extraction and Fourier transform on the mean-normalized image at the first moment, and performing low-pass filtering and high-pass filtering on the transformed image respectively; Step S3: performing inverse transformation after filtering to obtain a first low-frequency information image and a first high-frequency information image, performing difference processing between the first moment mean-normalized image and the first low-frequency information image to obtain a first difference image; Step S4, repeating steps S1 to S3 to obtain the second moment image, the second moment mean normalized image, the second low-frequency information image, the second high-frequency information image, and the second difference image; Step S5: Analyze the image feature differences to detect whether there is a defocus phenomenon; S5.1 Use the OSTU algorithm to binarize the first difference image and the second difference image to obtain binary images and Statistical binary images and The number of non-zero pixels and S5.2 Use the ostu algorithm to analyze the first high frequency information image and the second high-frequency information image Perform binarization to obtain a binary image and Calculate binary image and The union of Statistical binary images and union The number of non-zero pixels and S5.3 Determine whether there is a defocus phenomenon based on the above binary image information. and When the image is out of focus, it is determined that there is a defocus phenomenon.

2. A method for detecting out-of-focus of a video surveillance device according to claim 1, characterized in that: The specific steps of step S1 are as follows: S1.1 Obtaining the first moment image I clr ; S1.2 First moment image I clr Perform grayscale transformation to obtain grayscale image I gray ; S1.3 calculates the mean of the grayscale image, Where M and N are the number of rows and columns of the grayscale image, respectively. gray (i, j) is the grayscale value of the i-th row and j-th column of the grayscale image; the mean normalized image at the first moment is obtained through mean normalization processing Right now Where, is the mean normalized image at the first moment The pixel value of the i-th row and j-th column.

3. The method for detecting out-of-focus of a video surveillance device according to claim 2, wherein: The specific steps of step S2 are as follows: S2.1 Normalize the image by the mean at the first moment Perform discrete Fourier transform to obtain the transformed image F. The formula of discrete Fourier transform is as follows: Where M and N are the number of rows and columns of the grayscale image respectively; is the mean normalized image at the first moment The pixel value of the i-th row and j-th column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number; S2.2 performs low-pass filtering on the image F to obtain the low-pass filtered image G low , that is, G low (u,v)=H low (u,v)*F(u,v), where D(u,v) represents the distance between the point (u,v) in the frequency domain and the center of the frequency domain rectangle, σ = 50; S2.3 performs high-pass filtering on image F to obtain high-pass filtered image G high , that is, G high (u,v)=H high (u,v)*F(u,v), where D(u,v) represents the distance between the point (u,v) in the frequency domain and the center of the frequency domain rectangle, σ=100.

4. A method for detecting out-of-focus of a video surveillance device according to claim 3, characterized in that: The specific operation steps of step S3 are as follows: S3.1 Low-pass filtered image G low Perform inverse Fourier transform to obtain the first low-frequency information image The first low-frequency information image Represents the original image (mean normalized image at the first moment ) after removing the low-frequency information image of the high-frequency information, that is, Where, is the first low-frequency information image The pixel value of the xth row and yth column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number; S3.2 High-pass filtered image G high Perform inverse Fourier transform to obtain the second high-frequency information image The second high-frequency information image Represents the original image (mean normalized image at the first moment ) after removing the low-frequency information, that is, Where, The first high-frequency information image The pixel value of the xth row and yth column of ; (u, v) is a point in the frequency domain, u∈{0,2,...,M-1}, v∈{0,2,...,N-1}; x∈{0,2,...,M-1}, y∈{0,2,...,N-1}; a represents an imaginary number; S3.3 Perform differential processing on the first moment mean normalized image and the first low-frequency information image to obtain a first differential image, that is, the first moment mean normalized image Image with the first low-frequency information Difference information between 5. A method for detecting out-of-focus of a video surveillance device according to claim 4, characterized in that: The specific operation steps of step S4 are as follows: Repeat the above steps S1 to S3 to obtain the second moment image Mean normalized image at the second moment Second low-frequency information image Second high-frequency information image and a second difference image, which is the mean normalized image at the second moment Image with the first low-frequency information The difference between

Citation Information

Patent Citations

  • Method and apparatus for detecting image fuzzy degree

    CN107240092A

  • Virtual focus detection method and device and computer readable medium

    CN111275657A

  • Virtual focus detection method and device based on camera device, equipment and medium

    CN113301324A

  • Image definition determination method and device, equipment and storage medium

    CN111833259A

  • Video fuzzy anomaly detection method and system based on frequency domain skewness and frequency domain peak value

    CN114205578A