A method and system for improving background modeling quality
Patent Information
- Application Number
- CN202211642386.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2042-12-20
AI Technical Summary
[0005]本发明针对现有技术中在运动物体的移动速度较慢时,对应数据段的像素会参与算法中的滑动运算,造成背景中鬼影的现象,难以形成清晰的背景图像,对后续的视频编码产生影响的问题,提供了一种提升背景建模质量的方法和系统
[0029]本发明每个像素点的有效数据段的均值之间存在联系,即在运动物体较慢时,尽管这一段的数据段均值异常,但在整个训练序列中大部分数据段均值是符合背景的,即是接近的。因此本方法单独创立两个数据段,用来存放符合背景的数据段均值,并记录对应段长。其次在滑动计算过程中进行数据段融合和数据段更新。在算法结束时通过对背景模型值进行修正,使得背景像素值更加偏向正确的值,从而改善鬼影现象。
Smart Images

Figure CN116248831B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of video surveillance, and in particular to a method and system for improving the quality of background modeling. Background Technology
[0002] With the increasing demand for public safety monitoring and intelligent data analysis in modern society, video surveillance systems are being used more and more widely in social life, providing full protection for public safety and intelligent data analysis.
[0003] Unlike traditional video sequences, surveillance videos possess unique characteristics, often containing a large amount of regular or long-term unchanging background information. Therefore, in addition to traditional spatial redundancy, temporal redundancy, and information entropy redundancy, surveillance videos also contain background redundancy. Video coding algorithms based on background generation models can effectively eliminate redundant information, thereby improving the coding efficiency of surveillance videos.
[0004] For example, in the existing technical paper "Research on Surveillance Video Coding Based on Background Model", the research on this technology, especially when the moving object moves at a slow speed, will cause the pixels of the corresponding data segment to participate in the sliding operation in the algorithm, resulting in ghosting in the background, making it difficult to form a clear background image, which will affect the subsequent video coding. Summary of the Invention
[0005] This invention addresses the problem in existing technologies where, when a moving object moves at a slow speed, pixels in the corresponding data segment participate in the sliding operation in the algorithm, causing ghosting in the background and making it difficult to form a clear background image, which affects subsequent video encoding. The invention provides a method and system to improve the quality of background modeling.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] A method for improving the quality of background modeling, the method comprising:
[0008] The data segment is established to store the average value and length of the background data segment;
[0009] Data segment fusion and updating: The background calculation involves data segment fusion and updating during the sliding process.
[0010] Background correction is performed by adjusting the fused and updated data segments using the mean of the data segments and the background model value AVG, thereby determining the background.
[0011] As a preferred approach, the establishment of the data segment determines two effective data lengths, len. p1 and len p2 and the mean value (avg) corresponding to that length.p1 and avg p2 ;
[0012] Wherein, data length len p1 The length of the first data point greater than the threshold th1, len. p2 The length of the second data that is greater than the threshold for distinguishing th1.
[0013] As a preferred option, the fusion of data segments includes:
[0014] The length of the valid data segment is len. k The mean of the effective data segment is avg k ,
[0015] The average value of the data segment (avg) k and avg p2 The data segments are compared with a fusion threshold. If the data is less than the fusion threshold, the data segments are fused using a formula.
[0016]
[0017] len p1 =len p1 +len k ;
[0018] When the mean of the valid data segment |avg k -avg p1 |>th3 and|avg k -avg p2 When |>th3, if |len p1 -len k |<|len p2 -len k |, then len p1 =len k .
[0019] As a preferred option, the background is modified by setting the mean threshold th4 and the segment length threshold th5 based on empirical values;
[0020] Compare len p2 and len p1 When len p2 >len p1 Then take len p =len p2 Otherwise len p =len p1 len p The maximum length of the data segment; the mean value corresponding to the maximum length of the data segment is avg. p ;
[0021] when|avg p -AVG|<th4, and|len p1 -len p2 |<th5, then AVG is corrected, where AVG=avg p .
[0022] To solve the above technical problem, the present invention further provides a system for improving background modeling quality, which is a system implemented by the aforementioned method for improving background modeling quality, comprising:
[0023] a data segment establishing module, configured to establish a data segment for storing the data segment mean value and data segment length of the background;
[0024] a data segment fusing and updating module, configured to perform fusion and update of data segments in the sliding process calculation of the background;
[0025] a background correcting module, configured to correct the fused and updated data segment through the mean value of the data segment and the background model value AVG, so as to determine the background.
[0026] To solve the above technical problem, the present invention further provides an electronic device, which includes a memory and a processor, where the memory is configured to store one or more computer instructions, and the one or more computer instructions are executed by the processor to implement the aforementioned method for improving background modeling quality.
[0027] To solve the above technical problem, the present invention further provides a computer-readable storage medium storing a computer program, where the computer program, when executed by a computer, implements the aforementioned method for improving background modeling quality.
[0028] The present invention adopts the above technical solutions and has remarkable technical effects as follows:
[0029] In the present invention, there is a correlation between the mean values of valid data segments of each pixel point, that is, when a moving object moves slowly, although the mean value of the data segment in this period is abnormal, most of the data segment mean values in the entire training sequence conform to the background, i.e., are close to the background. Therefore, the present method separately creates two data segments for storing the data segment mean values conforming to the background and recording the corresponding segment lengths. Secondly, data segment fusion and data segment update are performed in the sliding calculation process. At the end of the algorithm, the background model value is corrected, so that the background pixel value is more inclined to a correct value, thereby improving the ghosting phenomenon.
[0030] By optimizing the sliding average background algorithm model, the present invention improves the ghosting phenomenon, enhances the quality of the background modeling image, and makes the background modeling image more reasonable. Brief Description of the Drawings
[0031] Figure 1 This is a flowchart of the present invention;
[0032] Figure 2 This is a data segment differentiation diagram of the present invention;
[0033] Figure 3-1 Original background Figure 1 , Figure 3-2 Background of the improved algorithm of this invention Figure 1 ;
[0034] Figure 4-1 Original background Figure 2 , Figure 4-2 Background of the improved algorithm of this invention Figure 2 ; Detailed Implementation
[0035] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0036] Example 1
[0037] In the existing technology, the background value AVG and the corresponding weight value W of each pixel are initialized to 0, and the first data segment is created with the corresponding segment length len1 and mean avg1 set to 0.
[0038] When dividing data segments, the segmentation threshold can be derived from the properties of the normal distribution, that is, the probability that |f(x)-μ|>2σ is less than 4%, where f(x) represents the sample value, μ represents the mean, and σ represents the standard deviation.
[0039] Therefore, 2σ can be used as the temporal domain segmentation threshold th1, initialized to 14. During the calculation of the k-th data segment, if the change in adjacent pixels in the temporal domain exceeds the threshold th1, a new data segment is created with a length len. k+1 =0, otherwise, the current data segment length continues to increase. The effect of data segmentation is as follows: Figure 2 As shown.
[0040] Fast-moving objects will form short data segments in the background training sequence. Discarding these short segments will lead to more accurate calculation results. Empirically, 1 / 20 of the training sequence length is used as the discrimination threshold th2. If the length of a completed data segment is less than the threshold th2, the segment is considered invalid and its final mean is not calculated; otherwise, the length len of the current data segment is calculated using a sliding method. k =len k +1;
[0041] mean avg k =(avg k ×len k +len k / 2) / (lenk +1); then update the model mean AVG and the corresponding weights W, W = W + Lenk 2 ;
[0042] Repeat the above steps until the training set is completed, at which point you will obtain the final modeling result AVG for each pixel position.
[0043] In the above steps, although the algorithm assigns higher weights to larger data segments when calculating background pixel values, so that the final mean is similar to the content that appears most frequently, some slower-moving objects still participate in the final calculation of background pixel values, resulting in ghosting and making it difficult to form a clear background image.
[0044] Example 2
[0045] The difference between this embodiment and Embodiment 1 is that this embodiment provides a method for improving the quality of background modeling, the method including:
[0046] The data segment is established to store the average value and length of the background data segment;
[0047] Data segment fusion and updating: The background calculation involves data segment fusion and updating during the sliding process.
[0048] Background correction is performed by adjusting the fused and updated data segments using the mean of the data segments and the background model value AVG, thereby determining the background.
[0049] The data segment is established, and two valid data lengths (len) are determined. p1 and len p2 and the mean value (avg) corresponding to that length. p1 and avg p2 ;
[0050] Wherein, data length len p1 The length of the first data item greater than the threshold th1, which is 14; data length len p2 The length of the second data that is greater than the threshold for distinguishing th1.
[0051] The merging of data segments includes:
[0052] The length of the valid data segment is len. k The mean of the effective data segment is avg k ;
[0053] The average value of the data segment (avg) k and avg p2 The data segments are compared with a fusion threshold. If the data is less than the fusion threshold, the data segments are fused using a formula.
[0054]
[0055] len p1 =len p1 +len k ;
[0056] When the absolute value of the difference between the mean values of valid data segments |avg k -avg p1 |>th3 and |avg k -avg p2 |>th3, if |len p1 -len k |<|len p2 -len k |, then len p1 =len k . The threshold th3 is set to 6;
[0057] For background correction, the mean threshold th4 and the segment length threshold th5 are set according to empirical values;
[0058] Compare len p2 and len p1 ; when len p2 >len p1 , then take len p =len p2 , otherwise len p =len p1 , where len p is the maximum segment length of the data segments; the mean value corresponding to the maximum segment length of the data segments is avg p ;
[0059] When |avg p -AVG|<th4, and |len p1 -len p2 |<th5, AVG is corrected, where AVG=avg p . Herein, the mean threshold th4 is set to 10, and the segment length threshold th5 is set to 12.
[0060] Comparing the effect diagrams, Figure 3-1 and Figure 3-2 , it can be clearly seen that the ghosting of a slowly moving person in the box in Figure 3-1 is well eliminated in Figure 3-2 ; comparing Figure 4-1 and Figure 4-2 , it can be seen that the ghosting formed by a slowly moving vehicle in the box in Figure 4-1 is present, while in Figure 4-2The afterimage effect has been greatly eliminated or improved; it can be seen that a clearer background image can be formed after the algorithm of this invention.
[0061] Example 3
[0062] Based on Example 2, this example is a system for improving the quality of background modeling. The system is implemented through the aforementioned method for improving the quality of background modeling, and includes...
[0063] The data segment creation module creates data segments to store the background data segment mean and data segment length;
[0064] The data segment fusion and update module performs data segment fusion and update during the sliding process calculation.
[0065] The background correction module corrects the merged and updated data segments using the mean of the data segments and the background model value AVG, thereby determining the background.
[0066] Example 4
[0067] Based on Embodiment 2, this embodiment is an electronic device that includes a memory and a processor. The memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a method for improving the quality of background modeling as described above.
[0068] Example 5
[0069] Based on Embodiment 2, this embodiment is a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer, implements the method for improving background modeling quality as described above.
Claims
1. A method for improving the quality of background modeling, the method comprising: The data segment is established to store the average value and length of the background data segment; Data segment fusion and updating: The background calculation involves data segment fusion and updating during the sliding process. Background correction involves adjusting the merged and updated data segments using the mean of the data segments and the background model value AVG, thereby determining the background. The data segment creation process involves acquiring the video sequence, creating two data segments for each pixel in the video image, and initializing the effective data length of the two data segments to be len. p1 and len p2 And the mean average value corresponding to the effective data length. p1 and avg p2 ; When creating a data segment, for each pixel, if the change in the value of adjacent pixels in the time domain exceeds the th1 distinction threshold, a new data segment is created and the data length len is initialized. k and data mean Among them, the effective data length len p1 The length of the first data point greater than the th1 threshold, and the effective data length len. p2 The length of the second data that is greater than the threshold for distinguishing th1; If a data segment is valid, the data segments are merged; otherwise, the data segments with shorter data lengths are removed. The merging of data segments includes: Data fusion is performed on valid data segments. Data fusion includes: By the mean of the data segment and The data is compared with a fusion threshold to determine whether data fusion should be performed. If data fusion is determined to be performed, the data segments are fused using a formula. ; ; When the mean of the valid data segment and At that time, if ,but ; Background correction, The mean threshold th4 and the segment length threshold th5 are set based on empirical values. Compare and ;when Then take ,otherwise len p This represents the maximum length of the data segment; the mean value corresponding to the maximum length of the data segment is avg. p ; when ,and Then for Make corrections. .
2. A system for improving the quality of background modeling, characterized in that: The system implemented by the method for improving background modeling quality as described in claim 1 includes: The data segment creation module creates data segments to store the background data segment mean and data segment length; The data segment fusion and update module performs data segment fusion and update during the sliding process calculation. The background correction module corrects the merged and updated data segments using the mean of the data segments and the background model value AVG, thereby determining the background.
3. An electronic device, characterized in that, The system includes a memory and a processor, the memory being used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a method for improving background modeling quality as described in claim 1.
4. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the computer, it implements the method for improving the quality of background modeling as described in claim 1.
Citation Information
Patent Citations
Video encoding / decoding method and system based on background modeling and optional differential mode
CN101883284A
Background frame generating and updating method, system and device and medium
CN110062235A