Video mosaic detection method based on proportional gradient algorithm
Through the video mosaic detection method based on proportional gradient algorithm, the problem of difficult to detect video image mosaics in the prior art is solved, efficient and accurate mosaic detection is achieved, and the working quality and efficiency of the TV monitoring system are improved.
Patent Information
- Application Number
- CN202411782753.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to detect mosaic failures in video images quickly and accurately, resulting in the impact of the work efficiency and quality of the TV monitoring system.
The video mosaic detection method based on the proportional gradient algorithm is adopted, and the fast and accurate detection of video mosaics is achieved through steps such as image preprocessing, proportional gradient calculation, mosaic region positioning and threshold setting.
It improves the accuracy and speed of video mosaic detection, can effectively distinguish the mosaic areas in the video image, realize real-time detection, and improves the working efficiency and quality of the TV monitoring system.
Smart Images

Figure CN119648520A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing and computer vision, and in particular to a video mosaic detection method based on a proportional gradient algorithm. Background Art
[0002] In the information age, video programs can be seen everywhere in the daily life of residents. The broadcast of digital TV is related to the bit stream (TS stream). From recording to user viewing, video programs must go through multiple encoding and decoding processes such as recording, storage, transmission and reception. It is inevitable that errors will occur in the video signal, affecting user viewing. Therefore, it is necessary to take necessary measures to monitor the bit stream reception and broadcast, make timely fault judgment and solve the problem, and provide users with high-quality video programs.
[0003] Common digital image faults include black field, still frame, mosaic, etc. The first two faults are relatively simple and easy to identify and handle. Black field fault is a pure color screen on the video interface. It is only necessary to perform grayscale analysis on the pictures frame by frame to determine whether the grayscale value of each point is similar, and then the black field can be detected and determined. Still frame refers to the phenomenon that the picture stops in the video interface. Generally, the current picture is compared with the previous frame to see if there is a large change in the pixel value of any area. At present, the recognition technology of these two problems is relatively mature and has been widely used in some TV detection systems.
[0004] Mosaic faults are relatively difficult to detect and identify because of their complex causes, large variations in location, size, and shape, and a high degree of randomness in the time of occurrence. Although there are some methods for detecting mosaics, the detection effect is not ideal and mosaic faults in the video cannot be accurately detected in real time. Therefore, seeking a method to quickly and accurately detect and identify mosaics in video images is undoubtedly of great significance to improving the work efficiency and quality of the TV monitoring system.
[0005] The present invention aims to solve the problem that it is difficult to detect mosaics in video images quickly and accurately, and proposes a video mosaic detection method based on a proportional gradient algorithm, which effectively improves the detection efficiency, thereby providing users with the required high-quality television programs. Summary of the invention
[0006] The purpose of the present invention is to provide a method for quickly and accurately detecting and identifying mosaics in video images, so as to solve the problems raised in the above-mentioned background technology. In order to achieve the above-mentioned purpose, the present invention proposes a proportional gradient algorithm, which is applied to the detection and identification of video mosaics, so as to solve the problem that the existing mosaic detection method cannot quickly and accurately detect and identify the video mosaic area, effectively improve the detection efficiency, and meet the needs of providing users with high-quality TV programs.
[0007] The present invention provides the following technical solution: a video mosaic detection method based on a proportional gradient algorithm, the specific steps of the technical solution adopted are as follows:
[0008] Step 1: Perform image preprocessing, convert the image into a grayscale image, and perform preliminary denoising on the image to obtain a preprocessed image.
[0009] Step 2: Calculate the proportional gradient through the proportional gradient algorithm to extract the edge information of the image.
[0010] Step 3: traverse the image, detect the characteristic areas of the mosaic, and locate the mosaic area.
[0011] Step 4: By setting a threshold, the detected mosaic area is further distinguished, and the final detected mosaic area is displayed.
[0012] Furthermore, in the step 1, the image preprocessing first converts the RGB color image into a grayscale image format to obtain a grayscale image in order to obtain a better effect, and then performs image smoothing filtering, and uses Gaussian filtering to smooth the image to remove the influence of noise. After image conversion and preliminary image preprocessing such as Gaussian filtering, a better edge effect can be achieved.
[0013] Furthermore, in step 2, a video mosaic detection method based on a proportional gradient algorithm is used to extract image edge information through a proportional gradient algorithm. The specific steps of the proportional gradient algorithm include:
[0014] Step 21: Calculate the edge information in the horizontal and vertical directions of the image through the proposed proportional gradient algorithm to achieve fast extraction. The specific calculation process is as follows:
[0015]
[0016] Among them, dx i,j Represents the horizontal proportional gradient at the pixel position (i, j), dy i,j Represents the vertical proportional gradient at the pixel position (i, j), v i,j Indicates the size of the pixel gray value.
[0017] Step 22. The general range of image grayscale values is 0-255. The change of image grayscale value from 0 to 1 will not have much impact on the recognition of image mosaic edge information. The grayscale value of pixels with a grayscale value of 0 in the image is set to 1 to prevent the denominator of the proportional gradient algorithm calculation formula from being 0, resulting in an error in the calculation result.
[0018] Step 23, set the threshold value T or 1 / T. Since the pixel value inside the mosaic is small, while the pixel value of the external image is large, the calculated results of the edge position of the mosaic area after the proportional gradient calculation are all large or small. However, the pixel value distribution inside the mosaic is relatively uniform, and the result obtained by the proportional gradient should be around 1. By setting the threshold value, if the calculated value is greater than T or less than 1 / T, it can be preliminarily identified as the edge of the video image mosaic, and it is marked with different colors to distinguish it.
[0019] Furthermore, in step 3, the mosaic area positioning is realized by traversing the image. Since the mosaic areas are all rectangular, the entire rectangular area can be determined as long as the coordinates of the diagonal points of the rectangle are known. The specific steps of mosaic area positioning include:
[0020] Step 31, find an appropriate template for matching and locate the mosaic area;
[0021] Step 32: Mark the detected mosaic area, and skip this area in the next feature detection process.
[0022] Step 33: Some mosaic areas are difficult to match using templates due to the uncertainty of the distance between them, and image search is required.
[0023] Furthermore, the detected mosaic area is further distinguished in step 4 by setting a threshold T1 and calculating the proportion of points with values in the found suspected mosaic area to further distinguish the mosaic area from the non-mosaic area.
[0024] Through the above steps, the present invention realizes fast and accurate detection of mosaic areas of video images through proportional gradient algorithm. The present invention has the following advantages:
[0025] (1) The algorithm has high accuracy: the algorithm will not falsely report video images without mosaics. For video images with mosaics, it can effectively detect most of the clear edges and can better distinguish and detect the mosaic areas appearing in the video images.
[0026] (2) The algorithm has a fast detection speed: the algorithm only calculates the edge information in the horizontal and vertical directions of the image. The running time for a single image is short, and it can achieve the purpose of quickly detecting the mosaic area of the video image, thereby achieving the purpose of real-time detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly and easily explain the embodiments of the present invention or the technical solutions in the prior art, I will now briefly introduce the drawings required to be used in the examples or the description of the prior art.
[0028] Figure 1This is a flow chart of the video mosaic method based on the proportional gradient algorithm of the present invention.
[0029] Figure 2 It is a schematic diagram of the mosaic area template characteristics of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is clearly and detailed described below with reference to the accompanying drawings and specific examples.
[0031] like Figure 1 As shown, the present invention discloses a video mosaic detection method based on a proportional gradient algorithm, which is used to quickly and accurately detect mosaic faults that may occur during video signal transmission, so as to provide users with high-quality programs.
[0032] Combination Figure 1 The solution adopted by the present invention to solve the problem is divided into four parts as follows:
[0033] Part 1: When using the proportional gradient algorithm for mosaic area detection, in order to achieve better edge effects, image smoothing, edge extraction and other processes based on grayscale images can achieve better results and the processing process is easier.
[0034] Then, the image is smoothed by using Gaussian filtering to smooth the image to remove the influence of noise. After image conversion and early image preprocessing such as Gaussian filtering, better edge effects can be achieved.
[0035] In the second part, in order to take into account both speed and effect, based on the characteristics that the edges of the mosaic area are all horizontal or vertical line segments, the horizontal and vertical edges of the image are detected, and the other curved edges are ignored. When the edge information is reduced, the speed is significantly improved. At the same time, in order to take into account the effect, according to the characteristics that the pixel values of the mosaic edge and the background image are greatly different, the proportional gradient algorithm proposed in the present invention is used to achieve fast and accurate detection of the mosaic area. The specific algorithm is as follows:
[0036]
[0037] Among them, dx i,j Represents the horizontal proportional gradient at the pixel position (i, j), dy i,j Represents the vertical proportional gradient at the pixel position (i, j), v i,j Indicates the size of the pixel gray value.
[0038] In addition, the general range of image grayscale values is 0-255. The change of image grayscale value from 0 to 1 will not have much impact on the recognition of image mosaic edge information. The grayscale value of pixels with a grayscale value of 0 in the image is set to 1 to prevent the denominator of the proportional gradient algorithm calculation formula from being 0, resulting in an error in the calculation result.
[0039] Finally, set the threshold T or 1 / T. Since the pixel values inside the mosaic are small, while the pixel values of the external image are large, the calculated results of the edge position of the mosaic area after the proportional gradient calculation are large or small. However, the pixel values inside the mosaic are evenly distributed, and the result of the proportional gradient should be around 1. Therefore, by setting the threshold T, if the calculated value is greater than T or less than 1 / T, it can be preliminarily identified as the edge of the video image mosaic, and marked with different colors to distinguish them.
[0040] The third part is to realize the mosaic area positioning and find the appropriate template for matching, such as Figure 2 As shown, the mosaic area is located; the detected mosaic area is marked, and the next feature detection process skips this area to improve the detection efficiency.
[0041] In addition, combined Figure 2 For the right-angle templates (a)-(d), the right-angle points can be easily obtained. To this end, the distance transform is first used to process the edge image, and the corner points of the mosaic area are well detected. From this right-angle point, search on both sides to find the end point of the right-angle edge. This area can be considered as a suspected mosaic area. The distance transform calculates the distance between each pixel in the image and the nearest edge to find the mosaic area. The calculation process of the nearest distance transform cutting algorithm is as follows:
[0042] At the beginning, the boundary pixel values are set to 0 and the non-boundary pixel values are set to the maximum. The Chamfer algorithm only needs to loop twice. The first loop is from left to right and from top to bottom.
[0043] v i,j =min(v i-1,j-1 +4, v i-1,j +3, v i,j ,v i-1,j+1 +4, v i,j-1 +3)
[0044] Here i goes from 2 to rows-1, and j goes from 2 to columns-1.
[0045] The second time, do it in reverse, from right to left, top to bottom:
[0046] v i,j =min(v i,j+1 +3, v i+1,j-1 +4, vi,j , v i+1,j+1 +4, v i+1,j +3)
[0047] Here i goes from rows-1 to 2, and j goes from columns-1 to 2.
[0048] For (e) and (f), some mosaic areas are difficult to match with templates due to the uncertainty of the distance in the middle, and image search is required. The search steps are as follows: First, find the position coordinates of the starting point (x1, y1), and search to the right until the last point (x1, y2). If the length of the straight line is greater than a certain threshold, it is considered that the edge of the mosaic has been found. In addition, since the mosaic area has a certain width, it is also possible to detect from the third row of pixels under the found line segment to confirm whether there is a corresponding line segment of similar length. If this line segment exists, the row coordinates can be determined to be x2. At this time, the rectangular area between the point (x1, y1) and the point (x2, y2) is considered to be a suspected mosaic area. Otherwise, it is considered that there is no mosaic here. In addition, when searching for line segments, the line segments are not necessarily continuous. If there are still line segments after two pixels, the line segments can be considered to be continuous. Combining the above, the positioning of the mosaic area is achieved.
[0049] The fourth part is to confirm the detected mosaic area, which is to further distinguish the mosaic area from the non-mosaic area by setting the threshold T1. Since the proportional gradient algorithm only focuses on the horizontal edge and vertical edge information, the detected rectangular area is not necessarily all mosaic areas. According to the relatively uniform characteristics of the pixels inside the mosaic, the proportion of points with values in these areas can be calculated, and the threshold T1 can be set to further distinguish the accurate mosaic area.
Claims
1. A video mosaic detection method based on proportional gradient algorithm, characterized in that: The detection method comprises the following steps: Step 1: Perform image preprocessing, convert the image into a grayscale image, and perform preliminary denoising on the image to obtain a preprocessed image; Step 2: Calculate the proportional gradient through the proportional gradient algorithm to extract the edge information of the image; Step 3, traverse the image, detect the characteristic area of the mosaic, and realize the positioning of the mosaic area; Step 4: By setting a threshold, the detected mosaic area is further distinguished and confirmed, and the final detected mosaic area is displayed.
2. A video mosaic detection method based on proportional gradient algorithm as claimed in claim 1, characterized in that: In the step 1, the image preprocessing first converts the RGB color image into a grayscale image format, and then uses Gaussian filtering to smooth the grayscale image.
3. A video mosaic detection method based on proportional gradient algorithm as claimed in claim 1, characterized in that: In step 2, the image edge information is extracted by using a proportional gradient algorithm, and the specific steps of the proportional gradient algorithm include: Step 21: Calculate the edge information of the image in the horizontal and vertical directions by using the proposed proportional gradient algorithm. The specific calculation is as follows: Among them, dx i,j Represents the horizontal proportional gradient at the pixel position (i, j), dy i,j Represents the vertical proportional gradient at the pixel position (i, j), v i,j Indicates the size of the pixel gray value; Step 22, setting the gray value of the pixel with gray value 0 in the image to 1, so as to prevent the denominator in the proportional gradient algorithm calculation formula from being 0, resulting in an error in the calculation result; Step 23, setting a threshold T or 1 / T. When the calculated gradient value is greater than T or less than 1 / T, it can be preliminarily identified as a mosaic edge of the video image and marked with different colors to distinguish it.
4. A video mosaic detection method based on proportional gradient algorithm as claimed in claim 1, characterized in that: In step 3, the mosaic area positioning is achieved by traversing the image, and the specific steps of positioning include: Step 31, find an appropriate template for matching and locate the mosaic area; Step 32: Mark the detected mosaic area, and skip this area in the next feature detection process; Step 33: Some mosaic areas are difficult to match using templates due to the uncertainty of the distance between them, and image search is required.
5. The video mosaic detection method based on proportional gradient algorithm as claimed in claim 1, characterized in that: The step 4 is to further distinguish and confirm the detected mosaic area by setting a threshold T1 and calculating the proportion of points with values in the suspected mosaic area to further distinguish the mosaic area from the non-mosaic area.
Citation Information
Patent Citations
Crack edge detection method based on fuzzy theory
CN105046705A
Self-adapting edge detection calculating method based on combination of mask film and canny algorithm
CN105069773A
Human body security check method and device for realizing artificial intelligence area shielding
CN108648204A
Molten pool contour image extraction method for realizing closed connected domain
CN111696107A
Aluminum electrolytic capacitor outgoing line abnormity identification method
CN115880285A