A control method and system for surveillance cameras
Through the image recognition and tracking algorithm of the surveillance camera, the out-of-focus frame judgment mark is detected and generated, the target out-of-focus rate is calculated, and the focus control signal is generated for local automatic focus is solved, which solves the problem of not being able to identify key objects in time in the prior art, and realizes efficient image quality control and intelligent response.
Patent Information
- Application Number
- CN202510787228.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-06-13
AI Technical Summary
When the existing surveillance camera control method handles high-frequency target movement, frequent occlusion or multi-object crossover scenarios, it cannot identify and focus key objects in time, resulting in a decrease in recognition accuracy and frequent algorithm misjudgment.
The key target area is detected through image recognition and tracking algorithms, the spatial feature set is obtained, the fuzzy feature value is extracted, the out-of-focus frame judgment mark is constructed, the target out-of-focus rate is calculated, and the focus control signal is generated for local automatic focus, and the fuzzy feature value is reacquired to evaluate the focus effect.
It effectively alleviates the problem of false triggering caused by temporary interference, improves the imaging clarity response capability of key target areas, enhances the accuracy of image quality judgment and the degree of intelligence of focus control, and avoids resource waste and delay.
Smart Images

Figure CN120343399B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of camera control technology, and in particular to a control method and system for a surveillance camera. Background Art
[0002] In the digital construction of modern cities, security systems have gradually evolved into a complex, interdisciplinary system. Video surveillance technology, a key component, is widely used in a variety of scenarios, including public safety management, traffic order maintenance, retail management, and smart campuses. It is also evolving towards intelligent perception and automated response. Control methods for surveillance cameras are no longer limited to basic functions such as camera initiation, angle rotation, and focal length adjustment. They also point to advanced strategies for optimizing camera image quality, response time, and parameter self-optimization capabilities. Within this strategy, image clarity control, as a fundamental and core element, is crucial. This is especially true in scenarios such as urban intersections, school entrances, bank lobbies, and smart warehouses. The accuracy of recognizing key objects, such as faces, license plates, gestures, and signs, directly impacts the overall system performance and responsiveness. Therefore, real-time control of key object imaging is a key area of control that urgently needs further optimization.
[0003] In existing camera focus control systems, most systems still utilize autofocus mechanisms triggered by fixed intervals or static blur thresholds. While this mechanism maintains basic image quality in most cases, it often fails to recognize and focus on objects that frequently go out of focus when dealing with complex scenes with high-frequency object motion, frequent occlusions, or multiple objects intersecting. This is because traditional control strategies often use blur detection as a criterion for determining "overall image average blur," failing to perform regional or target-specific clarity detection for "key object areas" within the video. Furthermore, even if the system determines a moment's image to be "clear," it may obscure the fact that key objects, such as faces or license plates, are actually partially out of focus. These flaws prevent the focus strategy from effectively linking with the object detection and tracking modules in practice, making out-of-focus a significant contributor to reduced recognition accuracy and frequent algorithmic misjudgments in current video analysis systems. Summary of the Invention
[0004] In view of the deficiencies in the prior art, the present invention provides a control method and system for a surveillance camera, which solves the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions: A control method for a surveillance camera, comprising the following steps:
[0006] S1, detect and track the key target area in the monitoring image through image recognition and tracking algorithms to obtain the target's spatial feature set FTR1;
[0007] S2, based on the spatial feature set FTR1, extract the target fuzzy feature value Blv of the fixed area in each frame image to obtain the fuzzy vector sequence set Ftr2;
[0008] S3, constructing a defocused frame judgment mark set Ftr3 by traversing and comparing the preset blur evaluation threshold Thf with the blur vector sequence set Ftr2;
[0009] S4, performing cumulative statistics on the out-of-focus frame judgment mark set Ftr3, and calculating the target out-of-focus rate Tbd within a fixed time window T;
[0010] S5. Compare the obtained target defocus rate Tbd with a preset defocus threshold Thd, obtain the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculate the focus control signal Foc, and apply the focus control signal Foc to perform local automatic focusing on the target;
[0011] S6. After executing autofocus, the target blur feature value Blv of the target area is collected again to obtain a new post-execution blur vector sequence set Ftr4, which is then compared with the blur vector sequence set Ftr2 collected last time to calculate the focusing effect value Qev and determine the degree of improvement in the image quality after focusing.
[0012] Preferably, said S1 includes S11;
[0013] S11, using a camera to collect image frames Frame(t) at time t in real time, then using an image recognition algorithm to process each image frame Frame(t), detecting key targets in a preset key target list, extracting the spatial position and boundary information of the key targets, generating initial target spatial features, integrating all initial target spatial features of the image frame Frame(t) at time t, and obtaining a target set Ftr11;
[0014] The target set Ftr11 is specifically in the form of target set Ftr11={Bnd(t), Pos(t), Size(t)}; wherein Bnd(t) represents the target bounding box at time t, specifically represents the rectangular box in the coordinates of the image frame Frame(t); Pos(t) represents the coordinates of the center point of the target position at time t, specifically represents the center point of the target bounding box Bnd(t) at time t; Size(t) represents the target size at time t, specifically represents the width and height of the target bounding box Bnd(t) at time t;
[0015] Among them, the list of key targets includes faces, license plates and people.
[0016] Preferably, said S1 includes S12;
[0017] S12. Based on the acquired target set Ftr11, perform object matching between consecutive image frames Frame(t) to achieve consistent recognition of key targets, including using DeepSORT and KCF tracking algorithms to perform consistent recognition and judgment of object matching, and construct a time series tracking record of key targets, which is marked as the target's spatial feature set FTR1.
[0018] The specific form of the spatial feature set FTR1 is the spatial feature set FTR1={Bnd(t), Pos(t), Size(t)|t∈T}, where T represents the time window, specifically representing the continuous recording of the target bounding box Bnd(t), the target position center point coordinates Pos(t) and the target size Size(t) of the key target within the time window T.
[0019] Preferably, said S2 includes S21;
[0020] S21, based on the spatial feature set FTR1, uses the target area defined by the target bounding box Bnd(t) in each image frame Frame(t) as a sampling window, performs normalization processing to eliminate the dimensional differences between different features, extracts the image gradient variance Grd(t), Laplace response variance Lap(t), and high-frequency energy ratio Hfr(t) of the target area image at time t, obtains the target fuzzy feature value Blv(t) at time t through weighted calculation, and integrates all target areas to form a fuzzy vector sequence set Ftr2;
[0021] The specific form of the fuzzy vector sequence set Ftr2 is fuzzy vector sequence set Ftr2={Blv(t), t∈T}, where T represents a time window;
[0022] The target fuzzy eigenvalue Blv(t) is obtained by the following calculation formula:
[0023] ;
[0024] Where A1, A2, and A3 represent the preset weight values of the image gradient variance Grd(t), Laplace response variance Lap(t), and high-frequency energy ratio Hfr(t) at time t, respectively, and A1+A2+A3=1. The specific values are set by the user.
[0025] Preferably, the image gradient variance Grd(t) at time t is obtained by cropping each image frame Frame(t) with the target bounding box Bnd(t) to obtain the target region image Roi(t) at time t, and then performing the Scharr operator on the target region image Roi(t) at time t, calculating the horizontal and vertical gradients of the target region image Roi(t) at time t and then obtaining the variance;
[0026] The Laplace response variance Lap(t) is obtained by applying the Laplace operator to the target region image Roi(t) acquired at time t, performing second-order derivative filtering to capture the edge sharpness in the image, and calculating the variance of its response value;
[0027] The high-frequency energy ratio Hfr(t) is obtained by performing Fourier transform FFT on the target area image Roi(t) acquired at time t, transforming the image from the spatial domain to the frequency domain, and calculating the ratio of the energy of the high-frequency part in the Fourier spectrum to the total energy.
[0028] Preferably, said S3 includes S31;
[0029] S31, based on the obtained blur vector sequence set Ftr2, traverse and compare with the preset blur evaluation threshold Thf, determine whether the target blur feature value Blv(t) at time t in each image frame Frame(t) is in a defocus state, mark it with a Boolean value, obtain the defocus state mark Blf(t) at time t, and construct the defocus frame judgment mark set Ftr3;
[0030] The specific form of the out-of-focus frame judgment mark set Ftr3 is the out-of-focus frame judgment mark set Ftr3={Blf(t)|t∈T}, where T represents the time window;
[0031] The out-of-focus state mark Blf(t) at time t is obtained by the following comparison method:
[0032] When the target blur feature value Blv(t) at time t is less than the blur evaluation threshold Thf, it indicates that there is an out-of-focus area in the frame image Frame(t) at time t, indicating an out-of-focus frame, and the out-of-focus state flag Blf(t) at time t is marked as 1;
[0033] When the target blur feature value Blv(t) at time t ≥ the blur evaluation threshold Thf, it means that there is no out-of-focus area in the frame image frame Frame(t) at time t, indicating a clear frame, and the out-of-focus state mark Blf(t) at time t is marked as 0.
[0034] Preferably, said S4 includes S41;
[0035] S41. Based on the out-of-focus frame judgment mark set Ftr3, the number of frames with the out-of-focus state mark Blf(t)=1 in the time window T is counted, and the proportion of the target area in the time window T that is in the out-of-focus frame is calculated to obtain the out-of-focus rate numerical index Tbd, which reflects the image quality change trend of the target in the time window T and is used to determine whether to trigger focus control;
[0036] Defocus rate index Tbd passed Obtain the calculation formula.
[0037] Preferably, the S5 includes S51;
[0038] S51, comparing the obtained target defocus rate Tbd with a preset defocus threshold Thd, obtaining the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculating a focus control signal Foc, and applying the focus control signal Foc to perform local automatic focusing on the target;
[0039] The comparison results are obtained through the following comparison methods:
[0040] When the target defocus rate Tbd ≥ the defocus threshold Thd, it indicates that the comparison result triggers the execution, and the local autofocus operation is performed, including obtaining the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1, and calculating the focus control signal Foc;
[0041] When the target defocus rate Tbd is less than the defocus threshold Thd, it means that the comparison result does not trigger the execution result, and the local autofocus operation is not performed;
[0042] The focus control signal Foc is obtained by the following calculation formula:
[0043] ;
[0044] Where Foc(t) represents the focus control signal generated by the camera at time t, which is used to perform automatic focusing processing on the local image of the area where the average position PosAvg is located and the size is the average size SizeAvg. GenerateFocus represents the local automatic focusing function;
[0045] The average position PosAvg is obtained by the following calculation formula:
[0046] ;
[0047] Where T represents the time window, Pos(t) represents the coordinates of the center point of the target position at time t;
[0048] The average size SizeAvg is obtained by the following calculation formula:
[0049] ;
[0050] Where Size(t) represents the target size at time t.
[0051] Preferably, the S6 includes S61;
[0052] S61. After executing automatic focusing, the target blur feature value Blv of the target area within the time window T is collected again to obtain a new post-execution blur vector sequence set Ftr4, and then compared frame by frame with the blur vector sequence set Ftr2 collected last time, and the value difference between the post-execution blur vector sequence set Ftr4 and the blur vector sequence set Ftr2 is accumulated to obtain the focus effect value Qev, and then compared with the preset focus effect improvement evaluation threshold Qth to determine the degree of improvement in the image quality after focusing.
[0053] The specific form of the post-execution fuzzy vector sequence set Ftr4 is the post-execution fuzzy vector sequence set Ftr4={Blv(t), t∈T}, where T represents the time window;
[0054] The degree of improvement in image quality after focusing is judged by:
[0055] When the focusing effect value Qev ≥ the focusing effect improvement evaluation threshold Qth, it indicates that the focusing behavior is effective and the image quality is improved;
[0056] When the focusing effect value Qev is less than the focusing effect improvement evaluation threshold Qth, it indicates that the focusing action is invalid and the image quality is not improved, and local autofocus is performed again.
[0057] A control system for a surveillance camera, comprising a camera image detection module, an image feature extraction module, an image out-of-focus judgment module, an out-of-focus evaluation module, a focus decision module, and an iterative optimization module;
[0058] The camera image detection module detects and tracks the key target areas in the monitoring image through image recognition and tracking algorithms, and obtains the target's spatial feature set FTR1;
[0059] The image feature extraction module extracts the target fuzzy feature value Blv of a fixed area in each frame image based on the spatial feature set FTR1 and obtains the fuzzy vector sequence set Ftr2;
[0060] The image defocus judgment module constructs the defocus frame judgment mark set Ftr3 by traversing and comparing the preset blur evaluation threshold Thf with the blur vector sequence set Ftr2;
[0061] The defocus assessment module accumulates statistics on the defocus frame judgment mark set Ftr3 and calculates the target defocus rate Tbd within a fixed time window T;
[0062] The focus decision module compares the obtained target defocus rate Tbd with the preset defocus threshold Thd, obtains the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculates the focus control signal Foc, and applies the focus control signal Foc to perform local automatic focusing on the target;
[0063] After executing autofocus, the iterative optimization module collects the target blur feature value Blv of the target area again, obtains the new post-execution blur vector sequence set Ftr4, compares it with the blur vector sequence set Ftr2 collected last time, calculates the focusing effect value Qev, and determines the degree of improvement in the image quality after focusing.
[0064] The present invention provides a control method and system for a surveillance camera, which has the following beneficial effects:
[0065] (1) By calculating the target defocus rate Tbd within the time window T, the blur state no longer depends on instantaneous image judgment, but has statistical trend characteristics, effectively alleviating the problem of false triggering caused by occasional factors such as temporary interference and occlusion. Furthermore, the target defocus rate Tbd is compared with the defocus rate judgment threshold Thd to generate a focus control signal Foc, completing the automatic focusing of the key target area, avoiding the resource waste and focus delay caused by the fixed periodic focusing of the traditional system, and re-collecting the blur features of the focused image to construct a new fuzzy vector sequence set Ftr4, which is compared with the fuzzy vector sequence set Ftr2 to calculate the focus effect value Qev, realizing the closed-loop evaluation and optimization adjustment of the quality of the focusing behavior, overcoming the problem of the lack of feedback verification mechanism in the focus control of the existing technology.
[0066] (2) Based on the obtained spatial feature set FTR1, a fusion calculation is performed to obtain the target blur feature value Blv(t) at time t, and the blur feature values of all frames are integrated within the time window T to construct a blur vector sequence set Ftr2. This processing method not only fully characterizes the essential characteristics of image quality through blur measurement methods of different dimensions, but also eliminates the dimensional inconsistency problem between different blur features through normalization and weighting processing. Compared with the existing technology that relies on a single blur algorithm or the average blur index of the entire image, the image gradient variance Grd(t), Laplace response variance Lap(t) and high-frequency energy ratio Hfr(t) are synergistically integrated to significantly improve the expression accuracy and robustness of blur extraction, making the blur calculation result Blv(t) more discriminative and sensitive to local areas, providing more reliable and fine-grained input data support for subsequent defocus judgment and focusing decisions.
[0067] (3) Generate a focus control signal Foc(t) to drive the camera to perform local autofocus on the corresponding area. After the focus is completed, re-collect the new fuzzy feature value Blv(t) within the time window T, construct the post-execution fuzzy vector sequence set Ftr4, and compare it frame by frame with the fuzzy vector sequence set Ftr2 of the previous stage. Calculate the focus effect value Qev to quantify the improvement in image clarity and ensure that the image quality is truly improved. A focus quality closed-loop control logic with the focus effect value Qev as the final state verification standard is constructed. Compared with the existing technology that only triggers autofocus with fuzzy judgment but lacks result verification feedback, this method not only realizes the evaluability of focusing behavior, but also gives the system the ability to adaptively iterate for invalid focusing situations, effectively avoiding problems such as repeated invalid focusing, waste of resources, and unverifiable image quality improvement, thereby improving the intelligence level and reliability of camera imaging quality control. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 A schematic diagram of the steps of a control method for a surveillance camera according to the present invention;
[0069] Figure 2 This is a schematic block diagram of a control system for a surveillance camera according to the present invention;
[0070] Figure 3 Schematic diagram of the change of the blur eigenvalue Blv(t) in the image frame before and after focusing. DETAILED DESCRIPTION
[0071] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0072] Example 1
[0073] The present invention provides a control method for a surveillance camera, see Figure 1 , including the following steps:
[0074] S1, detect and track the key target area in the monitoring image through image recognition and tracking algorithms to obtain the target's spatial feature set FTR1;
[0075] S2, based on the spatial feature set FTR1, extract the target fuzzy feature value Blv of the fixed area in each frame image to obtain the fuzzy vector sequence set Ftr2;
[0076] S3, constructing a defocused frame judgment mark set Ftr3 by traversing and comparing the preset blur evaluation threshold Thf with the blur vector sequence set Ftr2;
[0077] S4, performing cumulative statistics on the out-of-focus frame judgment mark set Ftr3, and calculating the target out-of-focus rate Tbd within a fixed time window T;
[0078] S5. Compare the obtained target defocus rate Tbd with a preset defocus threshold Thd, obtain the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculate the focus control signal Foc, and apply the focus control signal Foc to perform local automatic focusing on the target;
[0079] S6. After executing autofocus, the target blur feature value Blv of the target area is collected again to obtain a new post-execution blur vector sequence set Ftr4, which is then compared with the blur vector sequence set Ftr2 collected last time to calculate the focusing effect value Qev and determine the degree of improvement in the image quality after focusing.
[0080] In this embodiment, an image recognition and tracking algorithm is used to obtain a spatial feature set FTR1 of key targets, providing a stable and trackable image region foundation for subsequent blur feature extraction. Based on the bounding box region corresponding to the spatial feature set FTR1, the target blur feature value Blv is extracted, and a blur vector sequence set Ftr2 is constructed. Combined with a preset blur evaluation threshold Thf, the image is judged to be out of focus, resulting in a set of out-of-focus frame judgment markers Ftr3. This overcomes the problem of traditional cameras that rely on the average blur of the entire image, resulting in inability to timely identify out-of-focus key areas. By calculating the target's defocus rate Tbd within a time window T, the blur state no longer relies on instantaneous image judgment, but instead reflects statistical trends, effectively mitigating false triggering caused by occasional factors such as temporary interference and occlusion. Furthermore, the target's defocus rate Tbd is compared with the defocus rate judgment threshold Thd, and the target's average position PosAvg and average size SizeAvg are calculated based on the spatial feature set FTR1. This generates a focus control signal Foc, completing automatic focusing on the key target area and avoiding the resource waste and focus delays associated with the fixed periodic focus method of traditional systems. Finally, step S6 reacquires the blurred features of the focused image, constructs a new fuzzy vector sequence set Ftr4, and compares it with the fuzzy vector sequence set Ftr2 to calculate the focusing effect value Qev. This achieves closed-loop quality assessment and optimization of focusing behavior, overcoming the lack of feedback verification mechanisms in existing focus control techniques. Therefore, this method effectively improves the surveillance camera's ability to accurately image key targets while maintaining the same hardware structure. It also enhances the system's ability to accurately determine changes in image blur and the intelligence of focus control.
[0081] Example 2
[0082] Specifically: the S1 includes S11;
[0083] S11, using a camera to collect image frames Frame(t) at time t in real time, then using an image recognition algorithm to process each image frame Frame(t), detecting key targets in a preset key target list, extracting the spatial position and boundary information of the key targets, generating initial target spatial features, integrating all initial target spatial features of the image frame Frame(t) at time t, and obtaining a target set Ftr11;
[0084] The target set Ftr11 is specifically in the form of target set Ftr11={Bnd(t), Pos(t), Size(t)}; wherein Bnd(t) represents the target bounding box at time t, specifically represents the rectangular box in the coordinates of the image frame Frame(t); Pos(t) represents the coordinates of the center point of the target position at time t, specifically represents the center point of the target bounding box Bnd(t) at time t; Size(t) represents the target size at time t, specifically represents the width and height of the target bounding box Bnd(t) at time t;
[0085] Among them, the list of key targets includes faces, license plates and people.
[0086] Said S1 includes S12;
[0087] S12. Based on the acquired target set Ftr11, perform object matching between consecutive image frames Frame(t) to achieve consistent recognition of key targets, including using DeepSORT and KCF tracking algorithms to perform consistent recognition and judgment of object matching, and construct a time series tracking record of key targets, which is marked as the target's spatial feature set FTR1.
[0088] The specific form of the spatial feature set FTR1 is the spatial feature set FTR1={Bnd(t), Pos(t), Size(t)|t∈T}, where T represents the time window, specifically representing the continuous recording of the target bounding box Bnd(t), the target position center point coordinates Pos(t) and the target size Size(t) of the key target within the time window T.
[0089] In this embodiment, a camera captures image frames Frame(t) in real time. Each frame is analyzed using an image recognition algorithm to accurately detect targets in a preset list of key targets and extract their corresponding spatial locations and boundary features to form a target set Ftr11. This ensures that the spatial information of the targets in each frame is fully extracted and represented. Furthermore, algorithms such as DeepSORT and KCF object tracking are used to achieve cross-frame matching and consistent recognition of targets between consecutive image frames Frame(t). A time-series tracking record of the targets is then constructed, forming a target spatial feature set FTR1. This not only maintains the coherence of the spatial structure of key targets within the time window T but also provides a precise and stable regional reference for subsequent modules such as blur extraction and dynamic focus control. Compared to existing approaches that rely solely on instantaneous image frame analysis and lack inter-frame semantic continuity, the spatial feature set FTR1 established by this solution significantly improves the structured understanding of key targets, fundamentally enhancing the regional positioning accuracy and response consistency of subsequent image processing algorithms. This approach is particularly suitable for the continuous tracking and determination of key targets in dynamic scenes.
[0090] Example 3
[0091] Specifically: S2 includes S21;
[0092] S21, based on the spatial feature set FTR1, uses the target area defined by the target bounding box Bnd(t) in each image frame Frame(t) as a sampling window, performs normalization processing to eliminate the dimensional differences between different features, extracts the image gradient variance Grd(t), Laplace response variance Lap(t), and high-frequency energy ratio Hfr(t) of the target area image at time t, obtains the target fuzzy feature value Blv(t) at time t through weighted calculation, and integrates all target areas to form a fuzzy vector sequence set Ftr2;
[0093] The specific form of the fuzzy vector sequence set Ftr2 is fuzzy vector sequence set Ftr2={Blv(t), t∈T}, where T represents a time window;
[0094] The target fuzzy eigenvalue Blv(t) is obtained by the following calculation formula:
[0095] ;
[0096] Where A1, A2, and A3 represent the preset weight values of the image gradient variance Grd(t), Laplace response variance Lap(t), and high-frequency energy ratio Hfr(t) at time t, respectively, and A1+A2+A3=1. The specific values are set by the user.
[0097] Among them, the image gradient variance Grd(t) at time t is obtained by cropping each frame Frame(t) with the target bounding box Bnd(t) to obtain the target region image Roi(t) at time t, and then performing the Scharr operator on the target region image Roi(t) at time t, calculating the horizontal and vertical gradients of the target region image Roi(t) at time t and then calculating the variance;
[0098] The Laplace response variance Lap(t) is obtained by applying the Laplace operator to the target region image Roi(t) acquired at time t, performing second-order derivative filtering to capture the edge sharpness in the image, and calculating the variance of its response value;
[0099] The high-frequency energy ratio Hfr(t) is obtained by performing Fourier transform FFT on the target area image Roi(t) acquired at time t, transforming the image from the spatial domain to the frequency domain, and calculating the ratio of the energy of the high-frequency part in the Fourier spectrum to the total energy.
[0100] In this embodiment, based on the obtained spatial feature set FTR1, the target region image Roi(t) is cropped from each image frame Frame(t) using the region defined by the target bounding box Bnd(t) as a sampling window. Feature extraction is then performed on this region image. This includes using the Scharr operator to obtain image gradient information and calculate its variance to form the image gradient variance Grd(t); using the Laplace operator to perform second-order edge filtering and calculate the response variance to form the Laplace response variance Lap(t); and using the Fourier transform (FFT) to obtain the high-frequency energy fraction to form the high-frequency energy ratio Hfr(t). After completing the calculation of these three sub-features, a fusion calculation is performed to obtain the target blur feature value Blv(t) at time t. The blur feature values of all frames within the time window T are then integrated to construct the blur vector sequence set Ftr2. This processing approach not only fully characterizes the essential characteristics of image quality through blur measurement methods in different dimensions, but also eliminates dimensional inconsistencies between different blur features through normalization and weighting. Compared with the existing technology that relies on a single blur algorithm or the average blur index of the entire image, the expression accuracy and robustness of blur extraction are significantly improved by synergistically fusing the image gradient variance Grd(t), Laplace response variance Lap(t) and high-frequency energy ratio Hfr(t), making the blur calculation result Blv(t) more discriminative and sensitive to local areas, providing more reliable and fine-grained input data support for subsequent defocus judgment and focusing decisions.
[0101] Example 4
[0102] Specifically: S3 includes S31;
[0103] S31, based on the obtained blur vector sequence set Ftr2, traverse and compare with the preset blur evaluation threshold Thf, determine whether the target blur feature value Blv(t) at time t in each image frame Frame(t) is in a defocus state, mark it with a Boolean value, obtain the defocus state mark Blf(t) at time t, and construct the defocus frame judgment mark set Ftr3;
[0104] The specific form of the out-of-focus frame judgment mark set Ftr3 is the out-of-focus frame judgment mark set Ftr3={Blf(t)|t∈T}, where T represents the time window;
[0105] The out-of-focus state mark Blf(t) at time t is obtained by the following comparison method:
[0106] When the target blur feature value Blv(t) at time t is less than the blur evaluation threshold Thf, it indicates that there is an out-of-focus area in the frame image Frame(t) at time t, indicating an out-of-focus frame, and the out-of-focus state flag Blf(t) at time t is marked as 1;
[0107] When the target blur feature value Blv(t) at time t ≥ the blur evaluation threshold Thf, it means that there is no out-of-focus area in the frame image frame Frame(t) at time t, indicating a clear frame, and the out-of-focus state mark Blf(t) at time t is marked as 0.
[0108] Said S4 includes S41;
[0109] S41. Based on the out-of-focus frame judgment mark set Ftr3, the number of frames with the out-of-focus state mark Blf(t)=1 in the time window T is counted, and the proportion of the target area in the time window T that is in the out-of-focus frame is calculated to obtain the out-of-focus rate numerical index Tbd, which reflects the image quality change trend of the target in the time window T and is used to determine whether to trigger focus control;
[0110] Defocus rate index Tbd passed Obtain the calculation formula.
[0111] In this embodiment, based on the constructed blur vector sequence set Ftr2, a frame-by-frame comparison is performed with the preset blur evaluation threshold Thf to determine whether the target blur feature value Blv(t) corresponding to time t in each image frame Frame(t) is less than the blur evaluation threshold Thf, and then a defocus state mark Blf(t) is generated, and a defocus frame judgment mark set Ftr3 is constructed. On this basis, the number of frames with all defocus state marks Blf(t)=1 is accumulated and counted, and combined with the total number of frames in the time window T, the defocus rate numerical index Tbd is calculated as a blur trend in a continuous time dimension. The trend index not only reflects the cumulative state of the target image based on single-frame blur recognition, but also overcomes the limitation of traditional systems that rely on instantaneous frame results for blur judgment and are easily affected by short-term interference factors such as local occlusion and motion jitter. By using the out-of-focus state mark Blf(t) to establish a Boolean representation and perform statistical aggregation over the time window T, this method realizes the transformation of blur perception from "instantaneous decision-making" to "trend judgment", making the triggering basis of the system focus control strategy more stable, temporally reasonable and anti-interference capable, and significantly improving the robustness of the overall imaging clarity judgment and the rationality of the response logic.
[0112] Example 5
[0113] See also Figure 1 and Figure 3 Specifically: the S5 includes S51;
[0114] S51, comparing the obtained target defocus rate Tbd with a preset defocus threshold Thd, obtaining the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculating a focus control signal Foc, and applying the focus control signal Foc to perform local automatic focusing on the target;
[0115] The comparison results are obtained through the following comparison methods:
[0116] When the target defocus rate Tbd ≥ the defocus threshold Thd, it indicates that the comparison result triggers the execution, and the local autofocus operation is performed, including obtaining the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1, and calculating the focus control signal Foc;
[0117] When the target defocus rate Tbd is less than the defocus threshold Thd, it means that the comparison result does not trigger the execution result, and the local autofocus operation is not performed;
[0118] The focus control signal Foc is obtained by the following calculation formula:
[0119] ;
[0120] Where Foc(t) represents the focus control signal generated by the camera at time t, which is used to perform automatic focusing processing on the local image of the area where the average position PosAvg is located and the size is the average size SizeAvg. GenerateFocus represents the local automatic focusing function;
[0121] The average position PosAvg is obtained by the following calculation formula:
[0122] ;
[0123] Where T represents the time window, Pos(t) represents the coordinates of the center point of the target position at time t;
[0124] The average size SizeAvg is obtained by the following calculation formula:
[0125] ;
[0126] Where Size(t) represents the target size at time t.
[0127] Said S6 includes S61;
[0128] S61. After executing automatic focusing, the target blur feature value Blv of the target area within the time window T is collected again to obtain a new post-execution blur vector sequence set Ftr4, and then compared frame by frame with the blur vector sequence set Ftr2 collected last time, and the value difference between the post-execution blur vector sequence set Ftr4 and the blur vector sequence set Ftr2 is accumulated to obtain the focus effect value Qev, and then compared with the preset focus effect improvement evaluation threshold Qth to determine the degree of improvement in the image quality after focusing.
[0129] The specific form of the post-execution fuzzy vector sequence set Ftr4 is the post-execution fuzzy vector sequence set Ftr4={Blv(t), t∈T}, where T represents the time window;
[0130] The degree of improvement in image quality after focusing is judged by:
[0131] When the focusing effect value Qev ≥ the focusing effect improvement evaluation threshold Qth, it indicates that the focusing behavior is effective and the image quality is improved;
[0132] When the focusing effect value Qev is less than the focusing effect improvement evaluation threshold Qth, it indicates that the focusing action is invalid and the image quality is not improved, and local autofocus is performed again.
[0133] Example of improvement effect of image blur characteristics before and after focusing:
[0134] The time window T contains 5 frames of images, numbered from t=1 to 5. The target blur eigenvalues Blv(t) before and after focusing of the corresponding frames are shown as follows:
[0135] Time t: 1; target blur eigenvalue Blv(t) before focusing: 0.31; target blur eigenvalue Blv(t) after focusing: 0.43; difference in time t: 0.12;
[0136] Time t: 2; target blur eigenvalue Blv(t) before focusing: 0.28; target blur eigenvalue Blv(t) after focusing: 0.41; difference in time t: 0.13;
[0137] Time t: 3; target blur eigenvalue Blv(t) before focusing: 0.30; target blur eigenvalue Blv(t) after focusing: 0.42; difference in time t: 0.12;
[0138] Time t: 4; target blur eigenvalue Blv(t) before focusing: 0.29; target blur eigenvalue Blv(t) after focusing: 0.44; difference in time t: 0.15;
[0139] Time t: 5; target blur eigenvalue Blv(t) before focusing: 0.27; target blur eigenvalue Blv(t) after focusing: 0.39; difference in time t: 0.12;
[0140] According to the above difference, the focusing effect value Qev is obtained:
[0141] Qev=1 / 5*(0.12+0.13+0.12+0.15+0.12)=0.128;
[0142] The preset focus effect improvement evaluation threshold Qth is 0.05;
[0143] Obtaining a focusing effect value Qev ≥ a focusing effect improvement evaluation threshold Qth indicates that the focusing behavior is effective and the image quality is improved.
[0144] In this embodiment, based on the target defocus rate Tbd, a logical comparison is performed with the preset defocus threshold Thd, and the target position center point coordinates Pos(t) and the target size Size(t) of the target in the time window T are automatically extracted from the spatial feature set FTR1. The average position PosAvg and the average size SizeAvg are calculated respectively as the basis for regional control, and then the focus control signal Foc(t) is generated through the local automatic focusing function GenerateFocus to drive the camera to perform local automatic focusing operation on the corresponding area. After the focus execution is completed, the new blur feature value Blv(t) in the time window T is re-collected to construct the post-execution blur vector sequence set Ftr4, and it is compared frame by frame with the blur vector sequence set Ftr2 of the previous stage to calculate the focus effect value Qev, which is used to quantify the improvement in image clarity and ensure that the image quality is truly improved. A focus quality closed-loop control logic with the focus effect value Qev as the final state verification standard is constructed. Compared with the existing technology that only triggers autofocus based on blur judgment but lacks result verification feedback, this method not only realizes the evaluability of focusing behavior, but also gives the system the ability to adaptively iterate in the event of invalid focusing, effectively avoiding problems such as repeated invalid focusing, waste of resources, and unverifiable image quality improvement, thereby improving the intelligence level and reliability of camera imaging quality control.
[0145] Example 6
[0146] A control system for surveillance cameras, please refer to Figure 2 Specifically: it includes camera image detection module, image feature extraction module, image out-of-focus judgment module, out-of-focus evaluation module, focus decision module and iterative optimization module;
[0147] The camera image detection module detects and tracks the key target areas in the monitoring image through image recognition and tracking algorithms, and obtains the target's spatial feature set FTR1;
[0148] The image feature extraction module extracts the target fuzzy feature value Blv of a fixed area in each frame image based on the spatial feature set FTR1 and obtains the fuzzy vector sequence set Ftr2;
[0149] The image defocus judgment module constructs the defocus frame judgment mark set Ftr3 by traversing and comparing the preset blur evaluation threshold Thf with the blur vector sequence set Ftr2;
[0150] The defocus assessment module accumulates statistics on the defocus frame judgment mark set Ftr3 and calculates the target defocus rate Tbd within a fixed time window T;
[0151] The focus decision module compares the obtained target defocus rate Tbd with the preset defocus threshold Thd, obtains the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculates the focus control signal Foc, and applies the focus control signal Foc to perform local automatic focusing on the target;
[0152] After executing autofocus, the iterative optimization module collects the target blur feature value Blv of the target area again, obtains the new post-execution blur vector sequence set Ftr4, compares it with the blur vector sequence set Ftr2 collected last time, calculates the focusing effect value Qev, and determines the degree of improvement in the image quality after focusing.
[0153] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A control method for a surveillance camera, characterized in that: The following steps are involved: S1, detect and track the key target area in the monitoring image through image recognition and tracking algorithms to obtain the target's spatial feature set FTR1; S2, based on the spatial feature set FTR1, extract the target fuzzy feature value Blv of the fixed area in each frame image to obtain the fuzzy vector sequence set Ftr2; S3, constructing a defocused frame judgment mark set Ftr3 by traversing and comparing the preset blur evaluation threshold Thf with the blur vector sequence set Ftr2; S4, performing cumulative statistics on the out-of-focus frame judgment mark set Ftr3, and calculating the target out-of-focus rate Tbd within a fixed time window T; S5. Compare the obtained target defocus rate Tbd with a preset defocus threshold Thd, obtain the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculate the focus control signal Foc, and apply the focus control signal Foc to perform local automatic focusing on the target; S6. After executing autofocus, the target blur feature value Blv of the target area is collected again to obtain a new post-execution blur vector sequence set Ftr4, which is then compared with the blur vector sequence set Ftr2 collected last time to calculate the focusing effect value Qev and determine the degree of improvement in the image quality after focusing.
2. The control method for a surveillance camera according to claim 1, characterized in that: Said S1 includes S11; S11, using a camera to collect image frames Frame(t) at time t in real time, then using an image recognition algorithm to process each image frame Frame(t), detecting key targets in a preset key target list, extracting the spatial position and boundary information of the key targets, generating initial target spatial features, integrating all initial target spatial features of the image frame Frame(t) at time t, and obtaining a target set Ftr11; The target set Ftr11 is specifically in the form of target set Ftr11={Bnd(t), Pos(t), Size(t)}; wherein Bnd(t) represents the target bounding box at time t, specifically represents the rectangular box in the coordinates of the image frame Frame(t); Pos(t) represents the coordinates of the center point of the target position at time t, specifically represents the center point of the target bounding box Bnd(t) at time t; Size(t) represents the target size at time t, specifically represents the width and height of the target bounding box Bnd(t) at time t; Among them, the list of key targets includes faces, license plates and people.
3. The control method for a surveillance camera according to claim 2, characterized in that: Said S1 includes S12; S12. Based on the acquired target set Ftr11, perform object matching between consecutive image frames Frame(t) to achieve consistent recognition of key targets, including using DeepSORT and KCF tracking algorithms to perform consistent recognition and judgment of object matching, and construct a time series tracking record of key targets, which is marked as the target's spatial feature set FTR1. The specific form of the spatial feature set FTR1 is the spatial feature set FTR1={Bnd(t), Pos(t), Size(t)|t∈T}, where T represents the time window, specifically representing the continuous recording of the target bounding box Bnd(t), the target position center point coordinates Pos(t) and the target size Size(t) of the key target within the time window T.
4. The control method for a surveillance camera according to claim 3, characterized in that: Said S2 includes S21; S21, based on the spatial feature set FTR1, uses the target area defined by the target bounding box Bnd(t) in each image frame Frame(t) as a sampling window, performs normalization processing to eliminate the dimensional differences between different features, extracts the image gradient variance Grd(t), Laplace response variance Lap(t), and high-frequency energy ratio Hfr(t) of the target area image at time t, obtains the target fuzzy feature value Blv(t) at time t through weighted calculation, and integrates all target areas to form a fuzzy vector sequence set Ftr2; The specific form of the fuzzy vector sequence set Ftr2 is fuzzy vector sequence set Ftr2={Blv(t), t∈T}, where T represents a time window; The target fuzzy eigenvalue Blv(t) is obtained by the following calculation formula: ; Where A1, A2, and A3 represent the preset weight values of the image gradient variance Grd(t), Laplace response variance Lap(t), and high-frequency energy ratio Hfr(t) at time t, respectively, and A1+A2+A3=1. The specific values are set by the user.
5. The control method for a surveillance camera according to claim 4, characterized in that: in, The image gradient variance Grd(t) at time t is obtained by cropping each frame Frame(t) with the target bounding box Bnd(t) to obtain the target region image Roi(t) at time t, and then performing the Scharr operator on the target region image Roi(t) at time t, calculating the horizontal and vertical gradients of the target region image Roi(t) at time t and then calculating the variance; The Laplace response variance Lap(t) is obtained by applying the Laplace operator to the target region image Roi(t) acquired at time t, performing second-order derivative filtering to capture the edge sharpness in the image, and calculating the variance of its response value; The high-frequency energy ratio Hfr(t) is obtained by performing Fourier transform FFT on the target area image Roi(t) acquired at time t, transforming the image from the spatial domain to the frequency domain, and calculating the ratio of the energy of the high-frequency part in the Fourier spectrum to the total energy.
6. The control method for a surveillance camera according to claim 5, characterized in that: Said S3 includes S31; S31, based on the obtained blur vector sequence set Ftr2, traverse and compare with the preset blur evaluation threshold Thf, determine whether the target blur feature value Blv(t) at time t in each image frame Frame(t) is in a defocus state, mark it with a Boolean value, obtain the defocus state mark Blf(t) at time t, and construct the defocus frame judgment mark set Ftr3; The specific form of the out-of-focus frame judgment mark set Ftr3 is the out-of-focus frame judgment mark set Ftr3={Blf(t)|t∈T}, where T represents the time window; The out-of-focus state mark Blf(t) at time t is obtained by the following comparison method: When the target blur feature value Blv(t) at time t is less than the blur evaluation threshold Thf, it indicates that there is an out-of-focus area in the frame image Frame(t) at time t, indicating an out-of-focus frame, and the out-of-focus state flag Blf(t) at time t is marked as 1; When the target blur feature value Blv(t) at time t ≥ the blur evaluation threshold Thf, it means that there is no out-of-focus area in the frame image frame Frame(t) at time t, indicating a clear frame, and the out-of-focus state mark Blf(t) at time t is marked as 0.
7. The control method for a surveillance camera according to claim 6, characterized in that: Said S4 includes S41; S41. Based on the out-of-focus frame judgment mark set Ftr3, the number of frames with the out-of-focus state mark Blf(t)=1 in the time window T is counted, and the proportion of the target area in the time window T that is in the out-of-focus frame is calculated to obtain the out-of-focus rate numerical index Tbd, which reflects the image quality change trend of the target in the time window T and is used to determine whether to trigger focus control; Defocus rate index Tbd passed Obtain the calculation formula.
8. The control method for a surveillance camera according to claim 7, characterized in that: The S5 includes S51; S51, comparing the obtained target defocus rate Tbd with a preset defocus threshold Thd, obtaining the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculating a focus control signal Foc, and applying the focus control signal Foc to perform local automatic focusing on the target; The comparison results are obtained through the following comparison methods: When the target defocus rate Tbd ≥ the defocus threshold Thd, it indicates that the comparison result triggers the execution, and the local autofocus operation is performed, including obtaining the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1, and calculating the focus control signal Foc; When the target defocus rate Tbd is less than the defocus threshold Thd, it means that the comparison result does not trigger the execution result, and the local autofocus operation is not performed; The focus control signal Foc is obtained by the following calculation formula: ; Where Foc(t) represents the focus control signal generated by the camera at time t, which is used to perform automatic focusing processing on the local image of the area where the average position PosAvg is located and the size is the average size SizeAvg. GenerateFocus represents the local automatic focusing function; The average position PosAvg is obtained by the following calculation formula: ; Where T represents the time window, Pos(t) represents the coordinates of the center point of the target position at time t; The average size SizeAvg is obtained by the following calculation formula: ; Where Size(t) represents the target size at time t.
9. The control method for a surveillance camera according to claim 8, characterized in that: Said S6 includes S61; S61. After executing autofocus, the target blur feature value Blv of the target area within the time window T is collected again to obtain a new post-execution blur vector sequence set Ftr4. This is then compared frame by frame with the previously collected blur vector sequence set Ftr2. The difference between the post-execution blur vector sequence set Ftr4 and the blur vector sequence set Ftr2 is accumulated to obtain a focus effect value Qev. This is then compared with a preset focus effect improvement evaluation threshold Qth to determine the degree of improvement in the image quality after focusing. The specific form of the post-execution fuzzy vector sequence set Ftr4 is the post-execution fuzzy vector sequence set Ftr4={Blv(t), t∈T}, where T represents the time window; The degree of improvement in image quality after focusing is judged by: When the focusing effect value Qev ≥ the focusing effect improvement evaluation threshold Qth, it indicates that the focusing behavior is effective and the image quality is improved; When the focusing effect value Qev is less than the focusing effect improvement evaluation threshold Qth, it indicates that the focusing action is invalid and the image quality is not improved, and local autofocus is performed again.
10. A control system for a surveillance camera, applied to the control method for a surveillance camera according to any one of claims 1 to 9, characterized in that: It includes camera image detection module, image feature extraction module, image out-of-focus judgment module, out-of-focus assessment module, focus decision module and iterative optimization module; The camera image detection module detects and tracks the key target areas in the monitoring image through image recognition and tracking algorithms, and obtains the target's spatial feature set FTR1; The image feature extraction module extracts the target fuzzy feature value Blv of a fixed area in each frame image based on the spatial feature set FTR1 and obtains the fuzzy vector sequence set Ftr2; The image defocus judgment module constructs the defocus frame judgment mark set Ftr3 by traversing and comparing the preset blur evaluation threshold Thf with the blur vector sequence set Ftr2; The defocus assessment module accumulates statistics on the defocus frame judgment mark set Ftr3 and calculates the target defocus rate Tbd within a fixed time window T; The focus decision module compares the obtained target defocus rate Tbd with the preset defocus threshold Thd, obtains the average position PosAvg and average size SizeAvg of the target in the spatial feature set FTR1 based on the comparison result, calculates the focus control signal Foc, and applies the focus control signal Foc to perform local automatic focusing on the target; After executing autofocus, the iterative optimization module collects the target blur feature value Blv of the target area again, obtains the new post-execution blur vector sequence set Ftr4, compares it with the blur vector sequence set Ftr2 collected last time, calculates the focusing effect value Qev, and determines the degree of improvement in the image quality after focusing.
Citation Information
Patent Citations
Automatic focusing and locating method
CN103945126A
Image focusing method and device for surveillance camera
CN104639894A