Image occlusion intelligent detection method and device
By using frame difference method and Bach distance fusion technology to dynamically adjust weights, the problem of misjudgment in occlusion detection under changing lighting conditions is solved, achieving efficient and low-cost occlusion detection and improving the accuracy and adaptability of the monitoring system.
Patent Information
- Application Number
- CN202511686096.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-11-18
AI Technical Summary
Existing occlusion detection technologies have shortcomings in terms of environmental adaptability and judgment accuracy, especially when the lighting changes, they are prone to misjudgment, and the deployment cost is high and the generalization ability is limited.
The background region is determined by the frame difference method. The processing cycle is divided by video sequence, the fused Bach distance is calculated and the threshold is adaptively applied. The weights are dynamically adjusted by combining grayscale and texture features to achieve occlusion detection.
It improves the accuracy and environmental robustness of occlusion detection, reduces deployment costs, and can output occlusion location and level information, thereby enhancing the practical value and operational efficiency of the monitoring system.
Smart Images

Figure CN121147533B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and in particular to an intelligent method and apparatus for detecting image occlusion. Background Technology
[0002] Surveillance cameras are increasingly used in security, traffic management, and other fields, and the integrity of their field of view is a fundamental prerequisite for their functionality. However, in actual deployment environments, camera lenses are often partially or completely obstructed due to intentional human intervention, accidental attachment of foreign objects, or natural factors (such as snow or mud), severely impacting monitoring effectiveness. Therefore, automatic and accurate obstruction detection technology is crucial.
[0003] Existing occlusion detection schemes mainly suffer from two drawbacks: First, methods based on single-image grayscale pixel statistics, while computationally simple, are extremely sensitive to changes in ambient lighting (such as day-night cycles and changes in weather conditions), and are prone to misjudgments when uniform lighting changes, exhibiting poor robustness. Second, while deep learning-based schemes can adapt to complex scenes, they generally rely on large amounts of scene data for model training and optimization, resulting in high deployment costs and limited generalization capabilities.
[0004] In summary, existing technologies struggle to balance environmental adaptability with ease of deployment and accuracy of judgment. There is an urgent need for an intelligent image occlusion detection method that does not rely on extensive training and can effectively resist lighting interference. Summary of the Invention
[0005] Therefore, it is necessary to provide an intelligent image occlusion detection method and device to address the aforementioned technical problems.
[0006] In a first aspect, the present invention provides an intelligent image occlusion detection method, the method comprising:
[0007] Based on the video sequence, the frame difference method is used to determine the region with no pixel change in the first N1 consecutive frames as the initial background region;
[0008] The video sequence following the first consecutive N1 frames is divided into multiple consecutive processing cycles, each processing cycle including a preset number of video frames; wherein, for the first processing cycle, the initial background region is taken as the effective background region of the first processing cycle; for each subsequent processing cycle, the effective background region updated in the previous processing cycle is taken as the effective background region of that processing cycle.
[0009] Within each processing cycle, the following steps are performed: Based on the video frames in the current processing cycle, calculate the pixel change region of the current processing cycle, update the effective background region of the current processing cycle according to the pixel change region, and use it as the effective background region of the next processing cycle; calculate the fused Bach distance between the effective background region of the current processing cycle and the reference frame.
[0010] Calculate the mean and standard deviation of the fused Bach distance corresponding to the processing cycle of the first N2 video frames in the video sequence, and calculate the adaptive threshold based on the mean and standard deviation;
[0011] The fused Bach distance for each processing cycle is compared sequentially with an adaptive threshold. Based on the comparison results, it is determined whether there is occlusion in the video frame within the corresponding processing cycle.
[0012] Optionally, based on the video sequence, the region with no pixel change in the first N1 consecutive frames is determined as the initial background region using the frame difference method, including:
[0013] Starting from the first frame of the video sequence, the frame difference method is used to detect N1 consecutive video frames sequentially;
[0014] If a region with pixel changes is detected in the current N1 consecutive video frames, slide one video frame backward and use the slid-back video frame as the starting frame for the next detection. Continue to detect the next N1 consecutive video frames using the frame difference method until a region with no pixel changes is detected in the first N1 consecutive frames. This region is then determined as the initial background region.
[0015] Optionally, based on the video frames within the current processing cycle, the pixel change region of the current processing cycle is calculated, and the effective background region of the current processing cycle is updated according to the pixel change region, and used as the effective background region of the next processing cycle, including:
[0016] According to the preset division rules, each video frame in the current processing cycle is divided into regions to obtain the sub-regions of each video frame in the current processing cycle.
[0017] The frame difference method is used to compare corresponding sub-regions in adjacent video frames within the current processing cycle and mark the sub-regions where pixel changes occur.
[0018] At the end of the current processing cycle, all sub-regions marked with pixel changes during the current processing cycle are removed from the effective background region of the current processing cycle to obtain the updated effective background region, which is then used as the effective background region for the next processing cycle.
[0019] Optionally, after comparing corresponding sub-regions in adjacent video frames within the current processing cycle using the frame difference method and marking the sub-regions where pixel changes have occurred, the process further includes:
[0020] If, within the current processing cycle, a sub-region currently marked as having undergone pixel changes does not show any pixel changes in the subsequent N3 consecutive frames, the marking of that sub-region is removed, allowing it to continue processing until the end of the current processing cycle.
[0021] Optionally, the fused Bach distance between the effective background region and the reference frame in the current processing cycle is calculated, including:
[0022] Extract the grayscale histogram of the effective background region in the current processing cycle, and normalize the statistical values of the grayscale histogram to obtain the first probability distribution;
[0023] Extract the LBP texture histogram of the effective background region in the current processing cycle, and normalize the statistical values of the LBP texture histogram to obtain the second probability distribution;
[0024] Based on the first probability distribution and the reference frame, calculate the Bartlett distance in the grayscale dimension between the effective background region and the reference frame in the current processing cycle.
[0025] Based on the second probability distribution and the reference frame, calculate the Bartlett distance in the texture dimension between the effective background region and the reference frame in the current processing cycle.
[0026] Based on the amplitude of illumination change, the weights of the Bahland distance in the grayscale and texture dimensions are dynamically adjusted, and the fused Bahland distance is obtained by weighted fusion based on the adjusted weights.
[0027] Optionally, the weights of the Bach distances in the grayscale and texture dimensions are dynamically adjusted according to the amplitude of illumination changes, and the fused Bach distance is obtained by weighted fusion based on the adjusted weights, including:
[0028] Calculate the illumination variation amplitude of the first 5 video frames in the current processing cycle;
[0029] When the change in illumination is less than the preset illumination threshold, the weights of the Bach distance in the grayscale dimension and the texture dimension are adjusted to the first weight and the second weight, respectively, wherein the first weight is greater than the second weight and the sum of the first weight and the second weight is equal to 1.
[0030] When the change in illumination is greater than or equal to the preset illumination threshold, the weights of the Bach distance in the grayscale dimension and the texture dimension are adjusted to the third weight and the fourth weight, respectively. The third weight is less than the fourth weight and the sum of the third weight and the fourth weight is equal to 1.
[0031] Optionally, the fused Bach distance for each processing cycle is compared sequentially with an adaptive threshold. Based on the comparison results, it is determined whether there is occlusion in the video frames within the corresponding processing cycle, including:
[0032] The fused Bach distance for each processing cycle is compared sequentially with the adaptive threshold;
[0033] If the fused Bach distance of the current processing cycle is less than or equal to the adaptive threshold, the video frame in the current processing cycle is determined to be occluded, and the reference frame update detection is triggered.
[0034] If the fused Bach distance in the current processing cycle is greater than the adaptive threshold, the effective background region in the current processing cycle is divided into blocks for detailed analysis to determine whether there is occlusion, the location of occlusion, the level of occlusion, and processing suggestions.
[0035] Optionally, the effective background area in the current processing cycle is further segmented and analyzed to determine whether occlusion exists, the location of occlusion, the level of occlusion, and processing suggestions, including:
[0036] The effective background region of the current processing cycle is uniformly divided into multiple sub-blocks, and the fused Bach distance of each sub-block is calculated.
[0037] The fused Baccarat distance of each sub-block is compared with the adaptive threshold, and the number of sub-blocks with a fused Baccarat distance greater than the adaptive threshold and the percentage of such sub-blocks are counted.
[0038] Based on the number of sub-blocks whose fused Bhattachary distance is greater than the adaptive threshold, the proportion of such sub-blocks, and the fused Bhattachary distance of each sub-block, we determine whether occlusion exists, the location of the occlusion, the level of occlusion, and processing suggestions.
[0039] Optionally, after triggering the reference frame update detection, the method further includes:
[0040] Determine whether the reference frame update condition is met. The update condition is: there is no occlusion in the N4 consecutive video frames before the current video frame and the fluctuation amplitude of the fused Bach distance corresponding to the processing cycle of the N4 consecutive video frames before the current video frame is less than or equal to the preset fluctuation threshold.
[0041] If the update conditions are met, the reference frame is updated in layers, including:
[0042] The preset edge regions in the reference frame are directly replaced with the corresponding regions in the current video frame;
[0043] For the preset core region in the reference frame, a weighted fusion method is used for updating, with the formula: Ref new =α×Ref old +(1-α)×Current, where Ref newFor the updated core region, Ref old The core region before the update is defined as Current, the corresponding region of the current video frame is defined as Current, and α is a preset weight coefficient.
[0044] After the reference frame is updated, the mean and standard deviation of the fused Bach distance for the subsequent processing cycle are recalculated, and the adaptive threshold is updated based on the recalculated mean and standard deviation for occlusion determination in the next processing cycle.
[0045] Optionally, the adaptive threshold is calculated using the following formula: T=μ+k'σ, where T is the adaptive threshold; μ is the mean; σ is the standard deviation; and k' is the threshold coefficient, with the value of k' ranging from [1.8, 2.2].
[0046] Secondly, the present invention provides an intelligent image occlusion detection device, comprising:
[0047] An initialization module is used to determine the region with no pixel change in the first N1 consecutive frames as the initial background region based on the video sequence using the frame difference method; and to divide the video sequence after the first N1 consecutive frames into multiple consecutive processing cycles, each processing cycle including a preset number of video frames; wherein, for the first processing cycle, the initial background region is used as the effective background region of the first processing cycle; for each subsequent processing cycle, the effective background region updated in the previous processing cycle is used as the effective background region of that processing cycle.
[0048] The calculation and processing module, connected to the initialization module, is used to perform the following within each processing cycle: based on the video frames in the current processing cycle, calculate the pixel change region of the current processing cycle, update the effective background region of the current processing cycle according to the pixel change region, and use it as the effective background region of the next processing cycle; calculate the fused Bach distance between the effective background region of the current processing cycle and the reference frame; and calculate the mean and standard deviation of the fused Bach distance corresponding to the processing cycles of the first N2 video frames in the video sequence, and calculate the adaptive threshold according to the mean and the standard deviation.
[0049] The comparison and judgment module, connected to the calculation and processing module, is used to compare the fused Bach distance of each processing cycle with the adaptive threshold in turn, and determine whether there is occlusion in the video frame within the corresponding processing cycle based on the comparison result.
[0050] The intelligent image occlusion detection method and device provided by this invention effectively overcomes the misjudgment problem caused by sudden changes in ambient lighting (such as day-night cycles and weather changes) by using dynamic background region filtering and dual-dimensional Bach distance fusion calculation, significantly improving the accuracy and environmental robustness of occlusion detection. Simultaneously, by employing an adaptive threshold and block-based hierarchical verification mechanism, it eliminates the need to rely on large amounts of scene data for model training, greatly reducing deployment costs and complexity, and enabling rapid deployment and stable operation on edge devices. Furthermore, it can output occlusion location and level information, greatly enhancing the practical value and operational efficiency of monitoring systems. Attached Figure Description
[0051] Figure 1a This is a schematic flowchart of an image occlusion intelligent detection method provided in an embodiment of the present invention;
[0052] Figure 1b This is another schematic diagram of the image occlusion intelligent detection method provided in an embodiment of the present invention;
[0053] Figure 1c This is another flowchart illustrating the intelligent image occlusion detection method provided in this embodiment of the invention;
[0054] Figure 2 This is a schematic diagram of a circuit module structure of the intelligent image occlusion detection device provided in an embodiment of the present invention;
[0055] Figure 3 This is an internal structural diagram of a computer device according to one embodiment of the present invention. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0057] like Figure 1a As shown, the present invention provides an intelligent image occlusion detection method, the method comprising:
[0058] Step S11: Based on the video sequence, the frame difference method is used to determine the region with no pixel change in the first N1 consecutive frames as the initial background region;
[0059] In one optional embodiment of the present invention, such as Figure 1b As shown, step S11 specifically includes:
[0060] Step S111: Starting from the first frame of the video sequence, use the frame difference method to detect N1 consecutive video frames in sequence;
[0061] Step S112: If a region with pixel changes is detected in the current N1 consecutive video frames, slide one video frame backward and use the slid-back video frame as the starting frame for the next detection. Continue to detect the next N1 consecutive video frames using the frame difference method until a region with no pixel changes is detected in the first N1 consecutive frames. This region is then determined as the initial background region.
[0062] In this invention, the frame difference method is the existing frame difference method, and N1 is a positive integer greater than or equal to 2. For example, the value of N1 is 3. Those skilled in the art can flexibly choose the frame difference method and the value of N1 according to actual needs, and there is no limitation here.
[0063] For example, if N1 is 3, starting from the first frame of the video sequence, the frame difference method is used to detect frames 1, 2, and 3. It is found that there are pixel changes between these three frames (such as a vehicle passing by), which does not meet the condition. At this time, slide one frame forward and continue to detect frames 2, 3, and 4. It is found that there are still pixel changes between these three frames (the vehicle has not completely left), which still does not meet the condition. Continue to slide forward and detect frames 3, 4, and 5 in sequence, frames 4, 5, and 6, and so on. Suppose that when frames 7, 8, and 9 are detected, it is found that there are no pixel changes between these three frames (the vehicle has completely left and the scene has returned to stillness). At this time, the area with no pixel changes shared by frames 7, 8, and 9 is determined as the initial background area.
[0064] Step S12: Divide the video sequence after the first consecutive N1 frames into multiple consecutive processing cycles, each processing cycle including a preset number of video frames; wherein, for the first processing cycle, the initial background region is taken as the effective background region of the first processing cycle; for each subsequent processing cycle, the effective background region updated in the previous processing cycle is taken as the effective background region of that processing cycle.
[0065] The preset number can be 10, and those skilled in the art can flexibly set it according to actual needs; no limitation is made here. In other words, if the preset number is 10, each processing cycle includes 10 video frames. It should be noted that when dividing the processing cycle, if the number of video frames included in the last processing cycle is less than the preset number, these video frames can be deleted. That is, only the complete processing cycle is divided, or processing is performed according to the actual number of video frames included in the last processing cycle.
[0066] Step S13: Perform the following within each processing cycle: Based on the video frames in the current processing cycle, calculate the pixel change region of the current processing cycle, update the effective background region of the current processing cycle according to the pixel change region, and use it as the effective background region of the next processing cycle; calculate the fused Bach distance between the effective background region of the current processing cycle and the reference frame.
[0067] In one optional embodiment of the present invention, such as Figure 1c As shown, step S13, which involves calculating the pixel change region based on the video frames within the current processing cycle, updating the effective background region of the current processing cycle according to the pixel change region, and using it as the effective background region for the next processing cycle, specifically includes:
[0068] Step S131: According to the preset division rules, divide each video frame in the current processing cycle into regions to obtain the sub-regions of each video frame in the current processing cycle.
[0069] For the preset division rules, those skilled in the art can flexibly choose according to actual needs, and there is no limitation here. For example, each video frame can be divided into regions according to the division rules of 2x2, 3×3, 4×4, 8×8, etc., to obtain the corresponding sub-regions of 4, 9, 16, and 64 video frames.
[0070] Step S132: Using the frame difference method, compare the corresponding sub-regions in adjacent video frames within the current processing cycle and mark the sub-regions where pixel changes occur;
[0071] In an optional embodiment of the present invention, after step S132, the method further includes:
[0072] Step S132': If, within the current processing cycle, a sub-region currently marked as having undergone pixel changes does not show any pixel changes in the subsequent N3 consecutive frames, the marking of the sub-region is removed, allowing the sub-region to continue processing until the end of the current processing cycle.
[0073] Step S133: At the end of the current processing cycle, remove all sub-regions marked with pixel changes during the current processing cycle from the effective background region of the current processing cycle to obtain the updated effective background region, and use the updated effective background region as the effective background region of the next processing cycle.
[0074] Assume a processing cycle consists of 5 consecutive video frames, F1 to F5. Each video frame is divided into a 2x2 grid, resulting in 4 sub-regions (sub-region 1 to sub-region 4). In the first processing cycle, the initial background region is used as its effective background region, encompassing all 4 sub-regions. N3 is set to 3 (meaning if no pixel change is detected for 3 consecutive frames, the sub-region is unmarked, allowing it to continue processing until the current processing cycle ends). In the first processing cycle, when comparing adjacent frames F1 and F2, a pixel change is found in sub-region 2 due to a car entering the frame, and sub-region 2 is marked. Then, when comparing adjacent frames F2 and F3, the car is still moving, and sub-region 2 remains marked. However, when comparing adjacent frames F3 and F4, and F4 and F5, the car has stopped, and sub-region 2 shows no change in these two consecutive comparisons, meaning no pixel change is detected for 3 consecutive frames. At this point, the marking of sub-region 2 is immediately canceled. At the end of this processing cycle, since all sub-regions have been restored, the complete background region is preserved. Therefore, the effective background region of the first processing cycle is equal to the effective background region updated from the effective background region of the first processing cycle. Other cases follow the same principle and will not be elaborated here.
[0075] This implementation accurately distinguishes between transient disturbances (such as pedestrians and vehicles) and genuine occlusions in the scene, effectively avoiding the problem of misjudging temporarily stationary objects as occlusions. By restoring stable sub-regions in real time and only removing continuously changing sub-regions, it ensures a consistently clean and reliable background benchmark, thereby providing a high-quality data foundation for subsequent occlusion determination and improving the accuracy and environmental adaptability of detection from the source.
[0076] Optionally, the calculation of the fused Bach distance between the effective background region and the reference frame in step S13 includes:
[0077] Step S134: Extract the grayscale histogram of the effective background region in the current processing cycle, and normalize the statistical values of the grayscale histogram to obtain the first probability distribution;
[0078] In one specific embodiment of step S134, firstly, the effective background region of the current processing cycle is converted into a grayscale image using an existing weighted average method; secondly, the grayscale image is converted into a grayscale histogram using the existing OpenCV function cv2.calcHist, and the statistical values of the grayscale histogram are obtained. Then, calculate the total number of pixels. ,in, The grayscale value is The total number of pixels; finally, the statistical values of the grayscale histogram. Normalization: Calculate the probability of each grayscale value appearing. ,in, Indicates grayscale value The probability values of the pixels appearing in the image are used to obtain the first probability distribution. .
[0079] Step S135: Extract the LBP texture histogram of the effective background region in the current processing cycle, and normalize the statistical values of the LBP texture histogram to obtain the second probability distribution;
[0080] In one specific embodiment of step S135, firstly, each pixel within the effective background region of the current processing cycle is traversed; for each center pixel, its grayscale value is compared with the grayscale values of its 8 neighboring pixels; if the neighboring pixel value is greater than or equal to the center pixel value, it is marked as 1, otherwise it is marked as 0; these 8 binary bits (e.g., arranged clockwise starting from the top left pixel) are combined into an 8-bit binary number (e.g., 11010011); this binary number is converted to a decimal number, and this value (e.g., 211) is the LBP texture value of the center pixel; after traversal, an LBP feature map with the same size as the effective background region of the current processing cycle is obtained, where each pixel value is no longer grayscale, but its LBP texture value. Secondly, for the 8 neighbors, the LBP texture value typically ranges from 0 to 255. The total number of pixels with each LBP texture value (from 0 to 255) appearing in this LBP feature map is counted, ultimately resulting in an array of length 256. ,in, This indicates that the LBP texture value is stored. The total number of pixels, and the array This refers to the statistical values of the LBP texture histogram. Finally, the total number of pixels in the valid background region that participated in the LBP statistics is calculated for the current processing cycle. (That is, the total number of pixels in the effective background region during the current processing cycle, usually equal to the image height multiplied by the width); statistical values of the LBP texture histogram. Normalize the data and calculate the probability of each LBP texture value occurring: ,in, Indicates LBP texture value The probability values of the pixels appearing in the image are used to obtain the second probability distribution. .
[0081] Step S136: Based on the first probability distribution and the reference frame, calculate the Bartlett distance in the grayscale dimension between the effective background region and the reference frame in the current processing cycle;
[0082] In this invention, the Bach distance in the texture dimension is calculated using the following formula: ,in, This indicates the grayscale value in the valid background area of the current processing cycle. The probability value of the pixel. This indicates that the grayscale value in the reference frame is... The probability value of the pixel.
[0083] Step S137: Based on the second probability distribution and the reference frame, calculate the Bach distance in the texture dimension between the effective background region and the reference frame in the current processing cycle;
[0084] In this invention, the Bach distance in the texture dimension is calculated using the following formula: ,in, This indicates that the LBP texture value in the effective background region during the current processing cycle is [value missing]. The probability value of the pixel. This indicates that the LBP texture value in the reference frame is... The probability value of the pixel.
[0085] In this invention, the reference frame can be any one of the video frames in the first consecutive N1 frames in step S11. Those skilled in the art can choose flexibly according to actual needs, and no limitation is made here. Furthermore, the third and fourth probability distributions of the reference frame in the grayscale and texture dimensions can be referred to in steps S134 and S135, and will not be elaborated here. The corresponding probability distributions can be obtained based on the third and fourth probability distributions. and .
[0086] Step S138: Based on the amplitude of illumination change, dynamically adjust the weights of the Bach distance in the grayscale and texture dimensions, and perform weighted fusion based on the adjusted weights to obtain the fused Bach distance.
[0087] Optionally, step S138 specifically includes:
[0088] Step S1381: Calculate the illumination change amplitude of the first 5 video frames in the current processing cycle;
[0089] The amplitude of illumination change can be measured by the change in the average grayscale value. For example, if the current processing cycle includes video frames F1 to F10, the amplitude of illumination change can be calculated using the average grayscale values of video frames F1 to F5. If the average grayscale values of video frames F1 to F5 are 85, 86, 84, 85, and 86 respectively, then the amplitude of illumination change ΔL = |86-85| + |84-86| + |85-84| + |86-85| = 1 + 2 + 1 + 1 = 5. At this point, ΔL = 5, the amplitude of illumination change fluctuates, and step S1383 is executed.
[0090] Step S1382: When the illumination change amplitude is less than the preset illumination threshold, adjust the weights of the Bach distance in the grayscale dimension and texture dimension to the first weight and the second weight, respectively, wherein the first weight is greater than the second weight and the sum of the first weight and the second weight is equal to 1.
[0091] Step S1383: When the illumination change amplitude is greater than or equal to the preset illumination threshold, adjust the weights of the Bach distance in the grayscale dimension and texture dimension to the third weight and the fourth weight, respectively, wherein the third weight is less than the fourth weight and the sum of the third weight and the fourth weight is equal to 1.
[0092] The preset illumination threshold, first weight, second weight, third weight, and fourth weight can be flexibly set by those skilled in the art according to actual needs, and are not limited here. Specifically, when the illumination variation amplitude is stable (i.e., ΔL < 5), the fused Bavarian distance is... At this point, the focus is on grayscale dimension features; when the illumination variation amplitude fluctuates (i.e., ΔL≥5), the Bach distance is fused. At this point, the focus is on texture dimension features, unaffected by lighting. Among these, The Bach distance in the grayscale dimension, is the Bach distance in the texture dimension.
[0093] In this invention, Bach distance quantifies the degree of difference in brightness distribution between two images. A larger value indicates a more significant difference between the images, suggesting the possibility of occlusion. If Bach distance is calculated solely based on grayscale histograms, misjudgments can occur when the scene experiences a "uniform lighting change" (e.g., a shift from cloudy to sunny weather, resulting in an overall increase in image grayscale). While the grayscale histograms show significant differences, there may be no actual occlusion, leading to potential misjudgments. The dual-dimensional (grayscale and texture) fusion calculation overcomes the limitations of a single grayscale dimension, combining texture features to reduce lighting interference and generate more reliable difference quantification indicators.
[0094] Step S14: Calculate the mean and standard deviation of the fused Bach distance corresponding to the processing cycle of the first N2 video frames in the video sequence, and calculate the adaptive threshold based on the mean and standard deviation;
[0095] Wherein, N2 is a positive integer greater than or equal to 2, for example, N2 can be 100. Those skilled in the art can flexibly choose the value of N2 according to actual needs, and there is no limitation here. In addition, the calculation method of mean and standard deviation can adopt the calculation method of mean and standard deviation in the prior art. Those skilled in the art can flexibly choose according to actual needs, and there is no limitation here.
[0096] In this invention, the adaptive threshold is calculated using the following formula: T = μ + k'σ, where T is the adaptive threshold; μ is the mean; σ is the standard deviation; and k' is the threshold coefficient, with a value range of [1.8, 2.2]. It should be noted that in the first processing cycle, the adaptive threshold k' is 2. In subsequent processing cycles, if the adaptive threshold k' needs to be updated, it can be adjusted within its value range of [1.8, 2.2]. For example, when the illumination variation fluctuates, the adaptive threshold k' is set to 2.2, while when the illumination variation is stable, the adaptive threshold k' is set to 1.8.
[0097] Step S15: Compare the fused Bach distance of each processing cycle with the adaptive threshold in turn, and determine whether there is occlusion in the video frame within the corresponding processing cycle based on the comparison result.
[0098] Optionally, step S15 specifically includes:
[0099] Step S151: Compare the fused Bach distance of each processing cycle with the adaptive threshold sequentially;
[0100] Step S152: If the fused Bach distance of the current processing cycle is less than or equal to the adaptive threshold, determine that the video frame in the current processing cycle is occluded and trigger the reference frame update detection.
[0101] Optionally, after triggering the reference frame update detection, the following is also included:
[0102] Step S1521: Determine whether the reference frame update condition is met. The update condition is: the N4 consecutive video frames before the current video frame are unobstructed and the fluctuation amplitude of the fused Bach distance corresponding to the processing cycle of the N4 consecutive video frames before the current video frame is less than or equal to the preset fluctuation threshold.
[0103] Wherein, N4 is a positive integer, for example, N4 can be 50. Those skilled in the art can flexibly choose the value of N4 according to actual needs, and there is no limitation here. It should be noted that if there are less than 50 frames before the current video frame, it is directly determined that the reference frame update condition is not met. The preset fluctuation threshold can also be flexibly chosen by those skilled in the art according to actual needs, for example, the preset fluctuation threshold is 0.1, and there is no limitation here.
[0104] Assuming F1 to F3 are the first consecutive N1 frames; and F4 to F13 are the 10 video frames in the first processing cycle, their corresponding fused Bach distance is: F14 to F23 represent 10 video frames within the second processing cycle, and their corresponding fused Bach distances are: F24 to F33 represent 10 video frames within the third processing cycle, and their corresponding fused Bach distances are: F34 to F43 represent 10 video frames within the fourth processing cycle, and their corresponding fused Bach distances are: F44 to F53 represent 10 video frames within the fifth processing cycle, and their corresponding fused Bach distances are: The current video frame is F54. At this point, the fluctuation range of the fused Bach distance corresponds to the processing cycles of the N4 consecutive video frames preceding the current video frame. .
[0105] It should be noted that this embodiment uses the mean method to calculate the fluctuation range of the fused Bach distance corresponding to the processing cycle of the N4 consecutive video frames preceding the current video frame. The standard deviation and range methods can also be used for calculation, and there is no limitation here.
[0106] If the update conditions are met, the reference frame is updated in layers, including:
[0107] Step S1522: Replace the preset edge region in the reference frame with the corresponding region in the current video frame;
[0108] Step S1523: Update the preset core region in the reference frame using a weighted fusion method, with the formula: Ref new =α×Ref old +(1-α)×Current, where Ref new For the updated core region, Ref old The core region before the update is defined as Current, the corresponding region of the current video frame is defined as Current, and α is a preset weight coefficient, preferably 0.5.
[0109] Assume that the reference frame Ref_old is a core region with two pixels, namely pixel (1,1) and pixel (1,2), and the pixel values corresponding to the two pixels are (100,110,120) and (150,140,130) respectively.
[0110] The pixel values of pixel (1,1) in the current video frame are (120,130,125), and those of pixel (1,2) are (140,135,140); according to formula Ref new =α×Ref old The new values for each channel of each pixel are calculated using +(1-α)×Current, as follows:
[0111] The new values for pixel (1,1) are: R: 0.5×100+0.5×120=50+60=110; G: 0.5×110+0.5×130=55+65=120; B: 0.5×120+0.5×125=60+62.5=122.5; The integer value of the new value for pixel (1,1) is (110,120,123).
[0112] The new values for pixel (1,2) are: R: 0.5×150+0.5×140=75+70=145; G: 0.5×140+0.5×135=70+67.5=137.5; B: 0.5×130+0.5×140=65+70=135; The new values for pixel (1,2) are rounded down to the nearest integer as (145,138,135).
[0113] Therefore, the corresponding regions of the updated reference frame Ref_new are pixels (1,1): (110,120,123) and pixels (1,2): (145,138,135).
[0114] Step S1524: After the reference frame is updated, the mean and standard deviation of the fused Bhattacharyya distance for the subsequent processing cycle are recalculated, and the adaptive threshold is updated based on the recalculated mean and standard deviation for occlusion determination in the next processing cycle. It is important to note that the adaptive threshold used in the next processing cycle for subsequent determinations should be the updated adaptive threshold.
[0115] Step S153: If the fused Bach distance of the current processing cycle is greater than the adaptive threshold, the effective background area of the current processing cycle is divided into blocks for detailed judgment to determine whether there is occlusion, the occlusion location, the occlusion level, and processing suggestions.
[0116] Optionally, step S153 involves segmenting the effective background area of the current processing cycle into smaller blocks for detailed analysis to determine whether occlusion exists, the location of the occlusion, the level of occlusion, and processing suggestions, including:
[0117] Step S1531: Divide the effective background area of the current processing cycle into multiple sub-blocks evenly, and calculate the fused Bach distance of each sub-block;
[0118] The effective background region for the current processing cycle can be evenly divided into 8×8=64 sub-blocks. The calculation method for the fused Bach distance of each sub-block can refer to the calculation method for the fused Bach distance of the effective background region for each processing cycle, and will not be repeated here.
[0119] Step S1532: Compare the fused Bach distance of each sub-block with the adaptive threshold, and count the number of sub-blocks whose fused Bach distance is greater than the adaptive threshold and the percentage of such sub-blocks.
[0120] Step S1533: Based on the number of sub-blocks whose fused Bhattachary distance is greater than the adaptive threshold, the proportion of such sub-blocks, and the fused Bhattachary distance of each sub-block, determine whether occlusion exists, the location of occlusion, the level of occlusion, and processing suggestions.
[0121] Specifically, if the number of sub-blocks is less than or equal to 6 and the fused Bach distance of each sub-block is less than or equal to 0.6, or if the proportion of sub-blocks is less than or equal to 10% and the fused Bach distance of each sub-block is less than or equal to 0.6, it is judged as mild occlusion;
[0122] If the number of sub-blocks is greater than 6 and less than or equal to 19, or the proportion of sub-blocks is greater than 10% and less than or equal to 30%, or the fused Bach distance of any sub-block is greater than 0.6 and less than or equal to 0.8, it is judged as moderate occlusion;
[0123] If the number of sub-blocks is greater than 19, or the proportion of the number of blocks is greater than 30%, or the fused Bach distance of any sub-block is greater than 0.8, it is judged as severe occlusion;
[0124] If the number of sub-blocks is greater than 19 and the fused Bach distance of all sub-blocks is less than or equal to 0.5, it is judged as a sudden change in illumination, occlusion is excluded, and no alarm is triggered.
[0125] Table 1. Output results of block-based fine-tuning
[0126] Is there any obstruction? Obstruction position Obstruction level Handling suggestions yes Occlusion sub-block coordinates Mild obstruction Continuous monitoring without alarms yes Occluded sub-block coordinates and proportions Moderate occlusion Triggering low-priority alarms yes Occluded sub-block coordinates and proportions Severe occlusion Trigger high-priority alarm + device check no none Sudden change in light Update adaptive threshold
[0127] It should be noted that the occlusion levels and processing suggestions in the block-by-block detailed judgment output results in Table 1 can be flexibly set by those skilled in the art according to actual needs, and are not limited here.
[0128] The intelligent image occlusion detection method of this invention effectively overcomes the misjudgment problem caused by sudden changes in ambient lighting (such as day-night cycles and weather changes) by using dynamic background region filtering and dual-dimensional Bach distance fusion calculation, significantly improving the accuracy and environmental robustness of occlusion detection. Simultaneously, by employing an adaptive threshold and block-based hierarchical verification mechanism, it eliminates the need to rely on large amounts of scene data for model training, greatly reducing deployment costs and complexity, and enabling rapid deployment and stable operation on edge devices. Furthermore, it can output occlusion location and level information, greatly enhancing the practical value and operational efficiency of the monitoring system.
[0129] Based on the same inventive concept, this invention also provides an image occlusion intelligent detection device for implementing the image occlusion intelligent detection method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the image occlusion intelligent detection device provided below can be found in the limitations of the image occlusion intelligent detection method described above, and will not be repeated here.
[0130] like Figure 2 As shown, the present invention provides an intelligent image occlusion detection device, which includes: an initialization module 20, a calculation and processing module 21, and a comparison and judgment module 22; wherein,
[0131] The initialization module 20 is used to determine the region with no pixel change in the first consecutive N1 frames as the initial background region based on the video sequence using the frame difference method; and to divide the video sequence after the first consecutive N1 frames into multiple consecutive processing cycles, each processing cycle including a preset number of video frames; wherein, for the first processing cycle, the initial background region is used as the effective background region of the first processing cycle; for each subsequent processing cycle, the effective background region updated in the previous processing cycle is used as the effective background region of that processing cycle.
[0132] The calculation and processing module 21, connected to the initialization module 20, is used to perform the following in each processing cycle: based on the video frames in the current processing cycle, calculate the pixel change region of the current processing cycle, update the effective background region of the current processing cycle according to the pixel change region, and use it as the effective background region of the next processing cycle; calculate the fused Bach distance between the effective background region of the current processing cycle and the reference frame; and calculate the mean and standard deviation of the fused Bach distance corresponding to the processing cycles of the first N2 video frames in the video sequence, and calculate the adaptive threshold according to the mean and the standard deviation.
[0133] The comparison and judgment module 22, connected to the calculation and processing module 21, is used to compare the fused Bach distance of each processing cycle with the adaptive threshold in turn, and determine whether there is occlusion in the video frame within the corresponding processing cycle based on the comparison result.
[0134] Optionally, the initialization module 20 is used to: starting from the first frame of the video sequence, sequentially detect N1 consecutive video frames using the frame difference method; if a region with pixel changes is detected in the current N1 consecutive video frames, slide one video frame backward, use the slid-back video frame as the starting frame for the next detection, and continue to detect the next N1 consecutive video frames using the frame difference method until a region with no pixel changes in the first N1 consecutive frames is detected, and determine the region as the initial background region.
[0135] Optionally, the calculation and processing module 21 is used to: divide each video frame in the current processing cycle into regions according to a preset division rule to obtain sub-regions of each video frame in the current processing cycle; compare corresponding sub-regions in adjacent video frames in the current processing cycle using the frame difference method to mark sub-regions that have undergone pixel changes; at the end of the current processing cycle, remove all marked sub-regions that have undergone pixel changes from the effective background region of the current processing cycle to obtain the updated effective background region, and use the updated effective background region as the effective background region of the next processing cycle.
[0136] Optionally, the frame difference method is used to compare the corresponding sub-regions in adjacent video frames within the current processing cycle. After marking the sub-regions where pixel changes occur, the calculation and processing module 21 is further used to: if, within the current processing cycle, a sub-region currently marked as having pixel changes does not show any pixel changes in the subsequent N3 consecutive frames, cancel the marking of the sub-region and allow the sub-region to continue subsequent processing until the end of the current processing cycle.
[0137] Optionally, the calculation and processing module 21 is used to: extract the grayscale histogram of the effective background region in the current processing cycle, and normalize the statistical values of the grayscale histogram to obtain a first probability distribution; extract the LBP texture histogram of the effective background region in the current processing cycle, and normalize the statistical values of the LBP texture histogram to obtain a second probability distribution; calculate the Barcol distance between the effective background region in the current processing cycle and the reference frame in the grayscale dimension based on the first probability distribution and the reference frame; calculate the Barcol distance between the effective background region in the current processing cycle and the reference frame in the texture dimension based on the second probability distribution and the reference frame; dynamically adjust the weights of the Barcol distances in the grayscale dimension and the texture dimension according to the illumination change amplitude, and perform weighted fusion based on the adjusted weights to obtain the fused Barcol distance.
[0138] Optionally, the weights of the Bach distances in the grayscale and texture dimensions are dynamically adjusted according to the amplitude of illumination changes, and the fused Bach distance is obtained by weighted fusion based on the adjusted weights, including:
[0139] Calculate the illumination variation amplitude of the first 5 video frames in the current processing cycle;
[0140] When the change in illumination is less than the preset illumination threshold, the weights of the Bach distance in the grayscale dimension and the texture dimension are adjusted to the first weight and the second weight, respectively, wherein the first weight is greater than the second weight and the sum of the first weight and the second weight is equal to 1.
[0141] When the change in illumination is greater than or equal to the preset illumination threshold, the weights of the Bach distance in the grayscale dimension and the texture dimension are adjusted to the third weight and the fourth weight, respectively. The third weight is less than the fourth weight and the sum of the third weight and the fourth weight is equal to 1.
[0142] Optionally, the comparison and judgment module 22 is used to: compare the fused Bach distance of each processing cycle with the adaptive threshold sequentially; if the fused Bach distance of the current processing cycle is less than or equal to the adaptive threshold, determine that the video frame in the processing cycle is occluded and trigger the reference frame update detection; if the fused Bach distance of the current processing cycle is greater than the adaptive threshold, perform block-by-block judgment on the effective background area of the current processing cycle to determine whether there is occlusion, the occlusion location, the occlusion level and processing suggestions.
[0143] Optionally, the effective background area in the current processing cycle is further segmented and analyzed to determine whether occlusion exists, the location of occlusion, the level of occlusion, and processing suggestions, including:
[0144] The effective background region of the current processing cycle is uniformly divided into multiple sub-blocks, and the fused Bach distance of each sub-block is calculated.
[0145] The fused Baccarat distance of each sub-block is compared with the adaptive threshold, and the number of sub-blocks with a fused Baccarat distance greater than the adaptive threshold and the percentage of such sub-blocks are counted.
[0146] Based on the number of sub-blocks whose fused Bhattachary distance is greater than the adaptive threshold, the proportion of such sub-blocks, and the fused Bhattachary distance of each sub-block, we determine whether occlusion exists, the location of the occlusion, the level of occlusion, and processing suggestions.
[0147] Optionally, after triggering the reference frame update detection, the comparison and judgment module 22 is further configured to: determine whether the reference frame update condition is met, wherein the update condition is: the N4 consecutive video frames preceding the current video frame are unobstructed and the fluctuation amplitude of the fused Bach distance corresponding to the processing cycle of the N4 consecutive video frames preceding the current video frame is less than or equal to a preset fluctuation threshold; if the update condition is met, perform layered updates on the reference frame, including: directly replacing the preset edge regions in the reference frame with the corresponding regions of the current video frame; updating the preset core regions in the reference frame using a weighted fusion method, with the formula: Ref new =α×Ref old +(1-α)×Current, where Ref new For the updated core region, Ref oldThe core region before the update is defined as Current, the corresponding region of the current video frame is defined as Current, and α is a preset weight coefficient. After the reference frame is updated, the mean and standard deviation of the fused Bach distance for the subsequent processing cycle are recalculated, and the adaptive threshold is updated based on the recalculated mean and standard deviation for occlusion determination in the next processing cycle.
[0148] Optionally, the adaptive threshold is calculated using the following formula: T=μ+k'σ, where T is the adaptive threshold; μ is the mean; σ is the standard deviation; and k' is the threshold coefficient, with the value of k' ranging from [1.8, 2.2].
[0149] The intelligent image occlusion detection device of this invention effectively overcomes the misjudgment problem caused by sudden changes in ambient lighting (such as day-night cycles and weather changes) by using dynamic background region filtering and dual-dimensional Bach distance fusion calculation, significantly improving the accuracy and environmental robustness of occlusion detection. Simultaneously, by employing an adaptive threshold and block-based hierarchical verification mechanism, it eliminates the need to rely on large amounts of scene data for model training, greatly reducing deployment costs and complexity, and enabling rapid deployment and stable operation on edge devices. Furthermore, it can output occlusion location and level information, greatly enhancing the practical value and operational efficiency of the monitoring system.
[0150] It should be noted that "multiple" in this invention includes two or more.
[0151] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0152] Each module in the devices of this invention can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0153] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data required for or generated by the aforementioned intelligent image occlusion detection method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an intelligent image occlusion detection method.
[0154] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements an intelligent image occlusion detection method. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0155] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0156] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0157] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0158] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0159] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this invention are all information and data authorized by the user or fully authorized by all parties.
[0160] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided by this invention may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided by this invention may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0161] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0162] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. An intelligent image occlusion detection method, characterized in that, The method includes: Based on the video sequence, the frame difference method is used to determine the region with no pixel change in the first N1 consecutive frames as the initial background region; The video sequence following the first consecutive N1 frames is divided into multiple consecutive processing cycles, each processing cycle including a preset number of video frames; wherein, for the first processing cycle, the initial background region is taken as the effective background region of the first processing cycle; for each subsequent processing cycle, the effective background region updated in the previous processing cycle is taken as the effective background region of that processing cycle. Within each processing cycle, the following steps are performed: Based on the video frames in the current processing cycle, calculate the pixel change region of the current processing cycle, update the effective background region of the current processing cycle according to the pixel change region, and use it as the effective background region of the next processing cycle; calculate the fused Bach distance between the effective background region of the current processing cycle and the reference frame. Calculate the mean and standard deviation of the fused Bach distance corresponding to the processing cycle of the first N2 video frames in the video sequence, and calculate the adaptive threshold based on the mean and standard deviation; The fused Bach distance of each processing cycle is compared with the adaptive threshold in turn. Based on the comparison results, it is determined whether there is occlusion in the video frame within the corresponding processing cycle. The calculation of the fused Bach distance between the effective background region and the reference frame in the current processing cycle includes: Extract the grayscale histogram of the effective background region in the current processing cycle, and normalize the statistical values of the grayscale histogram to obtain the first probability distribution; Extract the LBP texture histogram of the effective background region in the current processing cycle, and normalize the statistical values of the LBP texture histogram to obtain the second probability distribution; Based on the first probability distribution and the reference frame, calculate the Bartlett distance in the grayscale dimension between the effective background region and the reference frame in the current processing cycle. Based on the second probability distribution and the reference frame, calculate the Bartlett distance in the texture dimension between the effective background region and the reference frame in the current processing cycle. Based on the amplitude of illumination change, the weights of the Bahland distance in the grayscale and texture dimensions are dynamically adjusted, and the fused Bahland distance is obtained by weighted fusion based on the adjusted weights.
2. The method according to claim 1, characterized in that, The step of determining the region with no pixel change in the first N1 consecutive frames as the initial background region based on the video sequence and using the frame difference method includes: Starting from the first frame of the video sequence, the frame difference method is used to detect N1 consecutive video frames sequentially; If a region with pixel changes is detected in the current N1 consecutive video frames, slide one video frame backward and use the slid-back video frame as the starting frame for the next detection. Continue to detect the next N1 consecutive video frames using the frame difference method until a region with no pixel changes is detected in the first N1 consecutive frames. This region is then determined as the initial background region.
3. The method according to claim 1, characterized in that, The step of calculating the pixel change region of the current processing cycle based on video frames within the current processing cycle, updating the effective background region of the current processing cycle according to the pixel change region, and using it as the effective background region of the next processing cycle includes: According to the preset division rules, each video frame in the current processing cycle is divided into regions to obtain the sub-regions of each video frame in the current processing cycle. The frame difference method is used to compare corresponding sub-regions in adjacent video frames within the current processing cycle and mark the sub-regions where pixel changes occur. At the end of the current processing cycle, all sub-regions marked with pixel changes during the current processing cycle are removed from the effective background region of the current processing cycle to obtain the updated effective background region, which is then used as the effective background region for the next processing cycle.
4. The method according to claim 3, characterized in that, The step of using the frame difference method to compare corresponding sub-regions in adjacent video frames within the current processing cycle and marking sub-regions where pixel changes have occurred also includes: If, within the current processing cycle, a sub-region currently marked as having undergone pixel changes does not show any pixel changes in the subsequent N3 consecutive frames, the marking of that sub-region is removed, allowing it to continue processing until the end of the current processing cycle.
5. The method according to claim 1, characterized in that, The process of dynamically adjusting the weights of the Bach distances in the grayscale and texture dimensions based on the amplitude of illumination changes, and then performing weighted fusion based on the adjusted weights to obtain the fused Bach distance, includes: Calculate the illumination variation amplitude of the first 5 video frames in the current processing cycle; When the change in illumination is less than the preset illumination threshold, the weights of the Bach distance in the grayscale dimension and the texture dimension are adjusted to the first weight and the second weight, respectively, wherein the first weight is greater than the second weight and the sum of the first weight and the second weight is equal to 1. When the change in illumination is greater than or equal to the preset illumination threshold, the weights of the Bach distance in the grayscale dimension and the texture dimension are adjusted to the third weight and the fourth weight, respectively. The third weight is less than the fourth weight and the sum of the third weight and the fourth weight is equal to 1.
6. The method according to claim 1, characterized in that, The step of comparing the fused Bach distance of each processing cycle with an adaptive threshold sequentially, and determining whether there is occlusion in the video frame within the corresponding processing cycle based on the comparison result, includes: The fused Bach distance for each processing cycle is compared sequentially with the adaptive threshold; If the fused Bach distance of the current processing cycle is less than or equal to the adaptive threshold, the video frame in the current processing cycle is determined to be occluded, and the reference frame update detection is triggered. If the fused Bach distance in the current processing cycle is greater than the adaptive threshold, the effective background region in the current processing cycle is divided into blocks for detailed analysis to determine whether there is occlusion, the location of occlusion, the level of occlusion, and processing suggestions.
7. The method according to claim 6, characterized in that, The process of dividing the effective background area of the current processing cycle into blocks for detailed analysis to determine whether occlusion exists, the location of occlusion, the level of occlusion, and processing suggestions includes: The effective background region of the current processing cycle is uniformly divided into multiple sub-blocks, and the fused Bach distance of each sub-block is calculated. The fused Baccarat distance of each sub-block is compared with the adaptive threshold, and the number of sub-blocks with a fused Baccarat distance greater than the adaptive threshold and the percentage of such sub-blocks are counted. Based on the number of sub-blocks whose fused Bhattachary distance is greater than the adaptive threshold, the proportion of such sub-blocks, and the fused Bhattachary distance of each sub-block, we determine whether occlusion exists, the location of the occlusion, the level of occlusion, and processing suggestions.
8. The method according to claim 6, characterized in that, Following the triggering of the reference frame update detection, the following is also included: Determine whether the reference frame update condition is met. The update condition is: there is no occlusion in the N4 consecutive video frames before the current video frame and the fluctuation amplitude of the fused Bach distance corresponding to the processing cycle of the N4 consecutive video frames before the current video frame is less than or equal to the preset fluctuation threshold. If the update conditions are met, the reference frame is updated in layers, including: The preset edge regions in the reference frame are directly replaced with the corresponding regions in the current video frame; For the preset core region in the reference frame, a weighted fusion method is used for updating, with the formula: Ref new =α×Ref old +(1-α)×Current, where Ref new For the updated core region, Ref old The core region before the update is defined as Current, the corresponding region of the current video frame is defined as Current, and α is a preset weight coefficient. After the reference frame is updated, the mean and standard deviation of the fused Bach distance for the subsequent processing cycle are recalculated, and the adaptive threshold is updated based on the recalculated mean and standard deviation for occlusion determination in the next processing cycle.
9. The method according to any one of claims 1-8, characterized in that, The adaptive threshold is calculated using the following formula: T = μ + k'σ, where T is the adaptive threshold; μ is the mean; σ is the standard deviation; and k' is the threshold coefficient, with the value of k' ranging from [1.8, 2.2].
10. An intelligent image occlusion detection device, characterized in that, include: The initialization module is used to determine the region with no pixel change in the first N1 consecutive frames as the initial background region based on the video sequence and using the frame difference method. The video sequence following the first consecutive N1 frames is divided into multiple consecutive processing cycles, each processing cycle including a preset number of video frames; wherein, for the first processing cycle, the initial background region is taken as the effective background region of the first processing cycle; for each subsequent processing cycle, the effective background region updated in the previous processing cycle is taken as the effective background region of that processing cycle. The calculation and processing module, connected to the initialization module, is used to perform the following within each processing cycle: Based on the video frames in the current processing cycle, calculate the pixel change region of the current processing cycle, update the effective background region of the current processing cycle according to the pixel change region, and use it as the effective background region of the next processing cycle; calculate the fused Bartholomew's distance between the effective background region of the current processing cycle and the reference frame; and calculate the mean and standard deviation of the fused Bartholomew's distance corresponding to the processing cycles of the first N2 video frames in the video sequence, and calculate an adaptive threshold based on the mean and standard deviation; wherein, calculating the fused Bartholomew's distance between the effective background region of the current processing cycle and the reference frame includes: extracting the effective background region of the current processing cycle... The grayscale histogram of the background region is extracted, and the statistical values of the grayscale histogram are normalized to obtain a first probability distribution. The LBP texture histogram of the effective background region in the current processing cycle is extracted, and the statistical values of the LBP texture histogram are normalized to obtain a second probability distribution. Based on the first probability distribution and the reference frame, the Barthold distance between the effective background region in the current processing cycle and the reference frame in the grayscale dimension is calculated. Based on the second probability distribution and the reference frame, the Barthold distance between the effective background region in the current processing cycle and the reference frame in the texture dimension is calculated. Based on the illumination change amplitude, the weights of the Barthold distances in the grayscale and texture dimensions are dynamically adjusted, and the weighted fusion is performed based on the adjusted weights to obtain the fused Barthold distance. The comparison and judgment module, connected to the calculation and processing module, is used to compare the fused Bach distance of each processing cycle with the adaptive threshold in turn, and determine whether there is occlusion in the video frame within the corresponding processing cycle based on the comparison result.
Citation Information
Patent Citations
Method and system for detecting whether camera is covered or not
CN104240235A
Detection method and detection device for shielding of video frames and video pictures
CN104637068A