A code stream anomaly detection method, device and computer readable storage medium
By performing horizontal histogram statistics and numerical fluctuation range analysis on the surveillance video images, the abnormal bitstream can be accurately located and identified, solving the problem of accuracy in bitstream abnormality detection in the monitoring system and achieving efficient abnormality type identification.
Patent Information
- Application Number
- CN202210217484.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-03-07
AI Technical Summary
Existing technologies are unable to accurately detect abnormal bitstreams in surveillance videos, leading to vulnerabilities in surveillance systems.
By performing horizontal histogram statistical processing on the image to be detected, an array of first pixel values is generated. The range of numerical fluctuations is used to locate abnormal regions in the image and identify solid color and striped code stream anomalies.
It improves the accuracy of bitstream anomaly detection, reduces false positives, and can identify different types of bitstream anomalies.
Smart Images

Figure CN114897766B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to a method, apparatus, and computer-readable storage medium for detecting abnormal bitstreams. Background Technology
[0002] Environmental electromagnetic interference or encoding / decoding failures can cause abnormal video stream bitrates, resulting in the loss of bitrate information in the video surveillance footage and creating large-scale monitoring blind spots. If these abnormal bitrates are not detected in time, they may lead to vulnerabilities in the entire monitoring system. Currently, it is essential to detect whether abnormal bitrates are occurring in the video surveillance footage in real time. Therefore, how to intuitively and accurately detect abnormal bitrate phenomena and their types has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a method, apparatus, and computer-readable storage medium for detecting abnormal bitstreams, which can improve the accuracy of bitstream anomaly detection.
[0004] To solve the above-mentioned technical problems, the technical solution adopted in this application is: to provide a method for detecting abnormal bitstreams, the method comprising: performing horizontal histogram statistical processing on the image to be detected to obtain a first pixel value array; each numerical data in the first pixel value array is determined based on the pixel value representing each row region in the image to be detected; determining the numerical fluctuation range corresponding to the first pixel value array based on at least two numerical data contained in the first pixel value array; and locating the abnormal region image from the image to be detected using the numerical fluctuation range, the abnormal region image being an image with abnormal bitstream phenomena.
[0005] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a bitstream anomaly detection device, which includes a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the bitstream anomaly detection method in the above-mentioned technical solution.
[0006] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium for storing a computer program, which, when executed by a processor, is used to implement the bitstream anomaly detection method in the above-mentioned technical solution.
[0007] The beneficial effects of this application through the above scheme are as follows: First, the image to be detected is subjected to horizontal histogram statistical processing to obtain a first pixel value array. Each numerical data in the first pixel value array is determined based on the pixel value representing each row region in the image to be detected. Then, based on at least two numerical data contained in the first pixel value array, the numerical fluctuation range corresponding to the first pixel value array is determined, thereby using the numerical fluctuation range to locate the abnormal region image with bitstream anomaly in the image to be detected. This application accurately locates the abnormal region image by using the pixel value features of the image to be detected in the horizontal direction, thereby improving the accuracy of bitstream anomaly detection. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0009] Figure 1 This is a flowchart illustrating an embodiment of the bitstream anomaly detection method provided in this application;
[0010] Figure 2(a) is the image to be detected that has a solid color bitstream anomaly provided in this application;
[0011] Figure 2(b) is the image to be detected that has a striped bitstream anomaly provided in this application;
[0012] Figure 3 This is a flowchart illustrating another embodiment of the bitstream anomaly detection method provided in this application;
[0013] Figure 4 This is a flowchart illustrating another embodiment of the bitstream anomaly detection method provided in this application;
[0014] Figure 5(a) is a schematic diagram of the horizontal histogram of the image to be detected provided in this application;
[0015] Figure 5(b) is another schematic diagram of the horizontal histogram of the image to be detected provided in this application;
[0016] Figure 6 This is a schematic diagram of an embodiment of the bitstream anomaly detection device provided in this application;
[0017] Figure 7 This is a schematic diagram of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0018] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be particularly noted that the following embodiments are for illustrative purposes only and do not limit the scope of the application. Similarly, the following embodiments are only some, not all, embodiments of the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0019] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0020] It should be noted that the terms "first," "second," and "third" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0021] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the bitstream anomaly detection method provided in this application. The method includes:
[0022] Step 11: Perform horizontal histogram statistical processing on the image to be detected to obtain the first pixel value array.
[0023] A frame of image can be extracted from the video data collected by the camera device, and then the image is processed to obtain the image to be detected. Specifically, the image to be detected can be a grayscale image. The image to be detected can be subjected to horizontal histogram statistical processing to obtain a first pixel value array. The horizontal histogram can be used to represent the brightness distribution of the image to be detected in the horizontal direction (i.e., the row direction). The first pixel value array can include the pixel values of each row region in the horizontal direction of the image to be detected.
[0024] Specifically, the first pixel value array may contain at least two numerical data. Each numerical data in the first pixel value array may be determined based on the pixel value representing each row region in the image to be detected. The first pixel value array may be the mean or median of the pixel values of each row region in the image to be detected, etc., without limitation.
[0025] Step 12: Determine the range of numerical fluctuations corresponding to the first pixel value array based on at least two numerical data contained in the first pixel value array.
[0026] Based on at least two numerical data contained in the first pixel value array, the numerical fluctuation range corresponding to the first pixel value array can be determined, thereby using the numerical fluctuation range to locate the abnormal area image.
[0027] Step 13: Locate the abnormal region image from the image to be detected using the numerical fluctuation range.
[0028] First, the mode of all numerical data in the first pixel value array can be calculated. Then, based on the mode and the preset fluctuation value, a numerical fluctuation range can be generated. The numerical data falling within the numerical fluctuation range can be filtered to obtain multiple fluctuation data. Based on the starting point and ending point of multiple fluctuation data, an abnormal area image can be obtained.
[0029] Specifically, the abnormal region image is an image with a bitstream anomaly. The main reason for the bitstream anomaly is the loss of pixel information in the image. After the pixel information is lost, the visualization results of the encoded abnormal region image are different due to different image decoding methods. In this embodiment, the abnormality type of the abnormal region image can be divided into striped bitstream anomaly and solid color bitstream anomaly: the striped bitstream anomaly starts from the pixel point where the pixel information is lost and fills the pixel values of the subsequent pixels with a default value, thereby filling the entire pixel loss area image (i.e., the abnormal region image) with a color block, as shown in Figure 2(a); the solid color bitstream anomaly is based on rows, starting from the pixel point where the pixel information is lost, copying the pixel values of all row areas to the pixel values of the row areas before the bitstream anomaly, thereby presenting a striped abnormal region image, as shown in Figure 2(b).
[0030] Furthermore, the brightness distribution (i.e., pixel values) in the horizontal and vertical directions of normal region images without any bitstream anomalies varies randomly. However, based on the two types of anomalies in the abnormal region images proposed in this example, the common feature of the two types of abnormal region images is that the images displayed in each row are the same, that is, the pixel values in the horizontal direction are roughly the same. Therefore, normal region images and abnormal region images can be distinguished based on the first pixel value array, and the abnormal region images in the image to be detected can be located by the data features in the first pixel value array.
[0031] In this embodiment, a horizontal histogram statistical processing is first performed on the image to be detected to obtain a first pixel value array. Each value in the first pixel value array is determined based on the pixel value representing each row region in the image to be detected. Then, based on at least two values contained in the first pixel value array, the numerical fluctuation range corresponding to the first pixel value array is determined. Thus, the abnormal region image with bitstream anomalies is located from the image to be detected using the numerical fluctuation range. This application accurately locates the abnormal region image by using the pixel value features of the image to be detected in the horizontal direction, thereby improving the accuracy of bitstream anomaly detection.
[0032] Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the bitstream anomaly detection method provided in this application. The method includes:
[0033] Step 31: Perform horizontal histogram statistical processing on the image to be detected to obtain the first pixel value array.
[0034] Step 32: Determine the range of numerical fluctuations corresponding to the first pixel value array based on at least two numerical data contained in the first pixel value array.
[0035] Step 33: Locate the abnormal region image from the image to be detected by using the numerical fluctuation range.
[0036] Steps 31 to 33 are the same as steps 11 to 13 in the above embodiments, and will not be repeated here.
[0037] Step 34: Perform identification processing on the abnormal region image to obtain the abnormality type of the abnormal region image.
[0038] After locating the abnormal region image in the image to be detected using the first pixel value array, the abnormal region image can be identified to obtain the abnormality type of the abnormal region image. Specifically, the abnormal region image in the image to be detected can be segmented, and then the abnormal region image can be identified. It can be first determined whether there is a misjudgment of the abnormal region image. If there is a misjudgment, it means that the located abnormal region image is a normal region image and there is no bitstream abnormality. At this time, there is no need to identify the type of the abnormal region image. If there is no misjudgment, then the abnormality type of the abnormal region image can be identified.
[0039] This embodiment utilizes the pixel value features of the image under test in the horizontal direction to perform preliminary localization of abnormal regions. Furthermore, it uses a two-step method of localization followed by identification to determine whether the image under test has any abnormal bitstream conditions, verifying the accuracy of the abnormal region images and avoiding misjudgments. It can also identify the abnormal type of the abnormal region images, thereby improving the accuracy of bitstream anomaly detection.
[0040] Please see Figure 4 , Figure 4 This is a flowchart illustrating another embodiment of the bitstream anomaly detection method provided in this application. The method includes:
[0041] Step 41: Perform horizontal histogram statistical processing on the image to be detected to obtain the first pixel value array.
[0042] First, a first original image can be obtained. Then, the image format of the first original image can be adjusted to a preset image format to obtain a second original image. Then, the pixel value of one channel of the second original image can be extracted to obtain the pixel value of the image to be detected. The first original image can be a frame of video data, which can be acquired by a camera device.
[0043] Furthermore, the preset image format can be YUV format. By preprocessing the first original image, a second original image in YUV format is obtained, and then the Y channel image in the second original image is extracted to generate the image to be detected. It can be understood that this embodiment only uses the image to be detected as a Y channel image as an example for explanation. In other embodiments, the preset image format and the format of the image to be detected can be selected according to the actual situation. For example, the preset image format can also be RGB format, and the corresponding image to be detected is a three-channel image in RGB format. This is not limited here.
[0044] After acquiring the image to be detected, a first pixel value array can be obtained by performing horizontal histogram statistical processing on the image to be detected. Specifically, the image to be detected can be divided into at least two consecutive row regions, and then the mean value of all pixel values in each row region is calculated to obtain the first pixel value array. The width of each row region is the same as the width of the image to be detected, and the height of each row region is a second preset window value. The width of the row region is the number of columns of pixels in the row region, and the height of the row region is the number of rows of all pixels in the row region. That is, a window with a window size of the second preset window value can be set to smooth the image to be detected in the vertical direction to obtain at least two consecutive row regions. For example, if the second preset window value is set to 3 and the image size of the image to be detected is 9*9, then the image to be detected can be divided into three consecutive row regions. The first row region is the image region from the first to the third row, the second row region is the image region from the fourth to the sixth row, and the third row region is the image region from the seventh to the ninth row. It is understood that in other embodiments, the second preset window value can be set according to the actual application and the image size of the image to be detected, and is not limited here.
[0045] In one embodiment, the calculation formula for the first pixel value array can be as shown in the following formula (1):
[0046]
[0047] In formula (1) above, d2 is the second preset window value, the image size of the image to be detected is h*w, h is the height of the image to be detected, w is the width of the image to be detected, n is the index of the row region, and P y (row,col) represents the pixel value corresponding to the pixel at position (row,col) in the row region. hor [n] represents the mean pixel value of the nth row region, where the minimum value of n is 1, and the maximum value of n is the total number of row regions. max =h / d2, the first pixel value array can contain the mean of all pixel values in each row region, i.e., H hor [1]~H hor [n max ].
[0048] Step 42: Determine the range of numerical fluctuations corresponding to the first pixel value array based on at least two numerical data contained in the first pixel value array.
[0049] Step 43: Locate the abnormal region image from the image to be detected using the numerical fluctuation range.
[0050] The first pixel value array may contain at least one numerical data. The abnormal region image can be located from the image to be detected based on the first pixel value array. The numerical data is H obtained using the above formula (1). hor [n]; Specifically, the mode of all numerical data in the first pixel value array can be calculated first, and then a numerical fluctuation range can be generated based on the mode and the preset fluctuation value. Then, the numerical data falling within the numerical fluctuation range can be filtered to obtain multiple fluctuation data. Thus, based on the starting point and the ending point of multiple fluctuation data, an abnormal area image can be obtained.
[0051] As shown in Figures 5(a) and 5(b), these are horizontal histograms of two images to be detected containing bitstream anomalies. The vertical axis of the horizontal histogram represents the numerical value of the data in the first pixel value array, i.e., the average pixel value of each row region. The horizontal axis represents the number of data in the first pixel value array, i.e., the row region number. Taking a preset fluctuation value of ±1 as an example, as shown in Figure 5(a), the mode of all data in the first pixel value array is 70, and the fluctuation range is […]. [69,71] The numerical data corresponding to the 28th row region to the 145th row region are all within the numerical fluctuation range of [69,71], indicating that the average pixel value fluctuation of the image region composed of the 28th row region to the 145th row region is small. Therefore, it can be identified as a bitstream abnormal region. Then, the starting row number of the 28th row region is determined as the starting row number of the bitstream abnormal region, and the ending row number of the 145th row region is determined as the ending row number of the bitstream abnormal region, thereby realizing the location of the bitstream abnormal region.
[0052] Similarly, as shown in Figure 5(b), the mode of all numerical data in the first pixel value array is 115, and the numerical fluctuation range is [114, 116]. The numerical values from the 13th row region to the 145th row region are all within the numerical fluctuation range of [114, 116]. This indicates that the average pixel value fluctuation of the image region composed of the 13th row region to the 145th row region is small, so it can be identified as a bitstream abnormal region. Then, the starting row number of the 13th row region is determined as the starting row number of the bitstream abnormal region, and the ending row number of the 145th row region is determined as the ending row number of the bitstream abnormal region, thereby realizing the location of the bitstream abnormal region.
[0053] In one specific implementation, the largest continuous region can be obtained based on the starting point and the ending point of multiple fluctuating data. Since normal region images also have multiple consecutive rows whose corresponding values are within the range of numerical fluctuation, but the continuous regions that appear in normal region images are generally relatively small, the largest continuous region can be selected from multiple continuous regions as the abnormal region of the bitstream. The row containing the starting data in the largest continuous region is taken as the starting row of the abnormal region image, and the row containing the ending data in the largest continuous region is taken as the ending row of the abnormal region image, thereby ensuring the accuracy of bitstream abnormal region location.
[0054] Furthermore, after obtaining the maximum continuous region based on the starting point and ending point of multiple fluctuation data, the ratio of the height of the maximum continuous region to the height of the image to be detected can be calculated to obtain a second ratio; it is then determined whether the second ratio is greater than a second preset ratio; if the second ratio is greater than the second preset ratio, the abnormal region image is determined based on the maximum continuous region.
[0055] The second ratio is the ratio of the height of the maximum continuous region to the height of the image to be detected. It can be used to represent the proportion of the maximum continuous region in the entire image to be detected. Generally, the proportion of abnormal region images in the entire image to be detected is not too small. The accuracy of the maximum continuous region can be checked by comparing the size of the second ratio, thereby effectively avoiding false alarms and improving the accuracy of abnormal region detection. Understandably, the second preset ratio can be set according to the actual situation or experience. It can generally be set to 20%. That is, when the ratio of the height of the maximum continuous region to the height of the image to be detected is greater than 20%, the maximum continuous region is identified as an abnormal region image. If the ratio of the height of the maximum continuous region to the height of the image to be detected is less than or equal to 20%, it means that the maximum continuous region is not an abnormal region image, and abnormal region detection continues for the next frame of the image to be detected.
[0056] Step 44: Generate a second pixel value array based on the vertical histogram of the abnormal region image.
[0057] Based on the vertical histogram of the abnormal region image, the projection of the abnormal region image in the vertical direction is statistically analyzed to generate a second pixel value array. Specifically, the abnormal region image can be divided into at least two consecutive column regions, and then the mean of all pixel values in each column region is calculated to obtain the second pixel value array. The height of each column region is the same as the height of the image to be detected, the width of each column region is a first preset window value, the width of the column region is the number of columns of pixel blocks in the column region, and the height of the column region is the number of rows of pixel blocks in the column region. In other words, by setting a window with a size of the first preset window value, the image to be detected is smoothed in the horizontal direction to obtain at least two consecutive column regions. Taking a first preset window value of 3 and an image size of 6*9 for the abnormal region image as an example, the abnormal region image can be divided into three consecutive column regions: the first column region is the image of the first to third columns, the second column region is the image of the fourth to sixth columns, and the third column region is the image of the seventh to ninth columns. It is understood that in other embodiments, the first preset window value can be set according to the actual application and the image size of the abnormal region image, and is not limited here.
[0058] In one embodiment, the formula for calculating the second pixel value array is as follows:
[0059]
[0060] In formula (2) above, d1 is the first preset window value, h' is the height of the abnormal region image, n is the column region number, and P y'(row,col) represents the pixel value corresponding to the pixel at position (row,col) in the column region, H ver [n] represents the average pixel value of the nth column region, where the minimum value of n is 1, and the maximum value of n is the total number of column regions. max =h' / d1, the second pixel value array can contain the mean of all pixel values in each column region, i.e., H ver [1]~H ver [n max ].
[0061] Step 45: Based on the second pixel value array, perform identification processing on the abnormal region image to obtain the abnormal type.
[0062] In one specific implementation, when the anomaly type includes a solid color bitstream anomaly (which has been described in detail in the previous embodiment and will not be repeated here), step 34 may include: performing vertical histogram statistical processing on the anomaly region image to obtain a second pixel value array; and determining the anomaly type as a solid color bitstream anomaly in response to the second pixel value array satisfying a first preset condition, wherein the first preset condition may be that the variance of all numerical data in the second pixel value array is less than a first preset threshold.
[0063] In another specific implementation, when the anomaly type includes a striped bitstream anomaly (which has been described in detail in the previous embodiment and will not be repeated here), step 34 may include: performing edge detection processing and binarization processing on the image of the anomaly region, and performing vertical histogram statistical processing on the image obtained by binarization processing to obtain a second pixel value array; in response to the second pixel value array satisfying a second preset condition, determining the anomaly type as a striped bitstream anomaly, wherein the ratio of the second statistical quantity to the total number of numerical data in the second pixel value array is greater than a first preset ratio, and the second statistical quantity is the statistical quantity obtained by counting the number of numerical data in the second pixel value array that are greater than a second preset threshold.
[0064] In other implementations, when the anomaly type includes striped bitstream anomalies and solid-color bitstream anomalies, the second pixel value array includes a first array and a second array. The first array is the vertical histogram result of the anomaly region image, and the second array is the vertical histogram result of the image after binarization of the anomaly region image. Specifically, after locating the anomaly region image, the anomaly region image can be segmented from the image to be detected, and then the vertical histogram of the anomaly region image can be statistically processed to obtain the corresponding first array and second array. Thus, the first array and the second array are used to identify solid-color bitstream anomalies and striped bitstream anomalies, respectively. This will be explained in detail below:
[0065] (1) Perform vertical histogram statistical processing on the abnormal region image to obtain the first array; in response to the first array satisfying the first preset condition, determine the abnormal type as a solid color code stream abnormality.
[0066] The image to be detected is the image corresponding to the Y channel (denoted as the Y channel image). The abnormal region image segmented from the image to be detected is also a Y channel image. The first array is the vertical histogram result of the Y channel image. At this time, the first preset condition can be that the variance of all numerical data in the first array is less than the first preset threshold. Specifically, the vertical histogram statistical processing of the abnormal region image can be performed using the above formula (2) to obtain the first array containing at least one numerical data. The numerical data is the H calculated using the above formula (2). hor [n], then calculate the variance of all numerical data in the first array, and determine whether the variance is less than the first preset threshold; if the variance is less than the first preset threshold, then determine that the first array meets the first preset condition.
[0067] Furthermore, the variance value of the first array can be used to determine its type. If the variance value of the first array is less than the first preset threshold, it indicates that the mean pixel values of each column region in the abnormal region image are almost the same, which is consistent with the data characteristic of a solid color stream abnormality with a very small variance value in the vertical histogram. It can be determined that the abnormal region image does indeed have a stream abnormality, and the abnormality type is a solid color stream abnormality. If the variance value of the first array is greater than or equal to the first preset threshold, it indicates that the pixel value difference between each column region in the abnormal region image is large, which is inconsistent with the data characteristic of a solid color stream abnormality in the vertical histogram. It can be determined that the abnormality type of the abnormal region image is not a solid color stream abnormality.
[0068] Understandably, the method for calculating the variance of the first array can be the variance algorithm in the field of mathematical statistics, which is not limited here. The first preset threshold can be set according to the actual situation. Generally, in order to ensure the accuracy of the judgment of the solid color code stream anomaly, the first preset threshold can be set in the numerical range of [0.1, 0.2].
[0069] (2) Perform edge detection and binarization on the abnormal region image, and perform vertical histogram statistical processing on the binarized image to obtain the second pixel value array; in response to the second pixel value array satisfying the second preset condition, determine the abnormal type as striped code stream abnormality.
[0070] The second array may contain at least one numerical data point. The second array is the vertical histogram result of the processed image. In this case, the second preset condition may include the ratio of the first statistical quantity to the total number of numerical data in the second array being greater than the first preset ratio. The first statistical quantity is the statistical quantity obtained by counting the number of numerical data in the second array that are greater than the second preset threshold. Specifically, the statistical quantity is obtained by counting the number of numerical data in the second array that are greater than the second preset threshold; the ratio of the statistical quantity to the total number of numerical data in the second array is calculated to obtain the first ratio; it is determined whether the first ratio is greater than the first preset ratio; if the first ratio is greater than the first preset ratio, it is determined that the second array satisfies the second preset condition.
[0071] Furthermore, in the abnormal region image where the anomaly type is striped bitstream anomaly, there is a significant difference in the mean pixel value between column regions, which manifests as multiple "bar-shaped protrusions" in the vertical histogram, meaning that the pixel value far exceeds the average of the mean pixel value. At this time, the number of "bar-shaped protrusions" in the second array can be counted. When the number of counts is large, the anomaly type is determined to be striped bitstream anomaly. The second preset threshold and the first preset ratio can be set according to the actual situation and experience. Generally, the second preset threshold can be set to 100 and the first preset ratio can be set to 20%.
[0072] (3) In response to the first array not meeting the first preset condition and the second array not meeting the second preset condition, generate false alarm information.
[0073] When the vertical histogram of the abnormal region image does not conform to the data characteristics of either the solid color stream abnormality or the striped stream abnormality, it indicates that there is no abnormal region image in the image to be detected. At this time, false alarm information can be generated to indicate that there is no abnormal region image in the image to be detected, so as to feed back the abnormal region image as a normal image.
[0074] Understandably, the above methods (1), (2), and (3) do not restrict the order of the steps for judging solid color stream abnormalities and judging striped stream abnormalities. The steps for judging striped stream abnormalities can be performed after the steps for judging solid color stream abnormalities, or after the steps for judging striped stream abnormalities, or both can be performed simultaneously.
[0075] The scheme adopted in this embodiment can classify abnormal regions into two types of anomalies—striped and solid-color—based on the characteristics of the abnormal regions in the encoded bitstream anomaly image. First, the horizontal histogram of the image to be detected is used to initially locate the abnormal regions. Then, the vertical histogram of the abnormal regions is used to verify them, thereby reducing false positives in anomaly detection. Next, the vertical histograms of the Y-channel image and the binarized edge image are used to specifically detect the two anomaly types separately, improving the accuracy and efficiency of bitstream anomaly detection. Furthermore, by increasing the window value when calculating the horizontal and vertical histograms, noise interference during data statistics can be effectively reduced, greatly improving data accuracy and anti-interference capability.
[0076] Please see Figure 6 , Figure 6 This is a schematic diagram of an embodiment of the bitstream anomaly detection device provided in this application. The bitstream anomaly detection device 60 includes a memory 61 and a processor 62 connected to each other. The memory 61 is used to store a computer program. When the computer program is executed by the processor 62, it is used to implement the bitstream anomaly detection method in the above embodiment.
[0077] Please see Figure 7 , Figure 7 This is a schematic diagram of an embodiment of a computer-readable storage medium provided in this application. The computer-readable storage medium 70 is used to store a computer program 71. When the computer program 71 is executed by a processor, it is used to implement the bitstream anomaly detection method in the above embodiment.
[0078] The computer-readable storage medium 70 can be any medium capable of storing program code, such as a server, USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0079] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0080] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0081] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0082] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for detecting abnormal bitstreams, characterized in that, The method comprises the following steps: horizontal histogram statistics processing is performed on the to-be-detected image to obtain a first pixel value array; each numerical data in the first pixel value array is determined based on a pixel value representing each row region in the to-be-detected image; a numerical fluctuation range corresponding to the first pixel value array is determined based on at least two numerical data contained in the first pixel value array; an abnormal region image is located from the to-be-detected image by using the numerical fluctuation range, and the abnormal region image is an image in which a code stream abnormal phenomenon exists; the step of performing horizontal histogram statistics processing on the to-be-detected image to obtain a first pixel value array comprises the following steps: the to-be-detected image is divided into at least two continuous row regions, the width of each row region is the same as the width of the to-be-detected image, and the height of each row region is a second preset window value; the mean or median of all pixel values in each row region is calculated to obtain the first pixel value array; the step of locating the abnormal region image from the to-be-detected image by using the numerical fluctuation range comprises the following steps: numerical data falling within the numerical fluctuation range in the first pixel value array is screened to obtain a plurality of fluctuation data; the abnormal region image is obtained based on the starting point of the plurality of fluctuation data and the ending point of the plurality of fluctuation data.
2. The method of claim 1, wherein, The method further comprises: performing identification processing on the abnormal region image to obtain an abnormal type of the abnormal region image.
3. The method of claim 2, wherein the method further comprises: The step of performing identification processing on the abnormal region image to obtain an abnormal type of the abnormal region image comprises the following steps: a second pixel value array is generated based on a vertical histogram of the abnormal region image; the abnormal region image is identified based on the second pixel value array to obtain the abnormal type.
4. The method of claim 3, wherein, The step of generating a second pixel value array based on a vertical histogram of the abnormal region image comprises the following steps: the abnormal region image is divided into at least two continuous column regions, the height of each column region is the same as the height of the to-be-detected image, and the width of each column region is a second preset window value; the mean of all pixel values in each column region is calculated to obtain the second pixel value array.
5. The method of claim 3, wherein the method further comprises: The abnormal type includes a solid color code stream abnormality, and the method further comprises: performing vertical histogram statistics processing on the abnormal region image to obtain the second pixel value array; and in response to the second pixel value array satisfying a first preset condition, determining that the abnormal type is the solid color code stream abnormality.
6. The method of claim 3, wherein the method further comprises: The abnormal type includes a stripe code stream abnormality, and the method further comprises: performing edge detection processing and binarization processing on the abnormal region image, and performing vertical histogram statistics processing on an image obtained through the binarization processing to obtain the second pixel value array; and in response to the second pixel value array satisfying a second preset condition, determining that the abnormal type is the stripe code stream abnormality.
7. The method of claim 3, wherein the method further comprises: The abnormal type includes a solid color code stream abnormality and a stripe code stream abnormality, the second pixel value array includes a first array and a second array, and the method further comprises: The vertical histogram of the abnormal region image is counted to obtain the first array; and in response to the first array satisfying a first preset condition, the abnormal type is determined as the pure color stream abnormality. The edge of the abnormal region image is detected and binarized, and the vertical histogram of the image obtained by the binarization is counted to obtain the second array; and in response to the second array satisfying a second preset condition, the abnormal type is determined as the stripe stream abnormality.
8. The method of claim 7, wherein the method further comprises: The method further comprises: In response to the first array not satisfying the first preset condition and the second array not satisfying the second preset condition, a false alarm information is generated, and the false alarm information is used to indicate that the abnormal region image does not exist in the image to be detected.
9. The method of claim 5, 7 or 8, wherein, The second pixel value array comprises at least one numerical data, the first array is obtained by counting the vertical histogram of the abnormal region image, and the first array comprises at least one numerical data; The first preset condition comprises that the variance value of all numerical data in the first array is less than a first preset threshold value; Or, the variance value of all numerical data in the second pixel value array is less than the first preset threshold value.
10. The method of any one of claims 6-8, wherein, The second pixel value array comprises at least one numerical data, the second array is obtained by counting the vertical histogram of the image obtained by the binarization of the edge of the abnormal region image, and the second array comprises at least one numerical data; The second preset condition comprises that the ratio of a first statistical quantity to the total number of numerical data in the second array is greater than a first preset ratio, and the first statistical quantity is obtained by counting the number of numerical data greater than a second preset threshold value in the second array; Or, the ratio of a second statistical quantity to the total number of numerical data in the second pixel value array is greater than the first preset ratio, and the second statistical quantity is obtained by counting the number of numerical data greater than the second preset threshold value in the second pixel value array.
11. The method of any of claims 1-8, wherein, The step of determining the numerical fluctuation range corresponding to the first pixel value array based on at least two numerical data included in the first pixel value array comprises: Determining the numerical fluctuation range based on the mode of the at least two numerical data in the first pixel value array and a preset fluctuation value.
12. The method of claim 11, wherein The step of obtaining the abnormal region image based on the starting point of the plurality of fluctuation data and the ending point of the plurality of fluctuation data comprises: Obtaining a maximum continuous region based on the starting point of the plurality of fluctuation data and the ending point of the plurality of fluctuation data; Calculating the ratio of the height of the maximum continuous region to the height of the image to be detected to obtain a second ratio; In response to whether the second ratio is greater than a second preset ratio, determining the abnormal region image based on the maximum continuous region.
13. The method of claim 1, wherein The method further comprises: Obtaining a first original image; Adjusting the image format of the first original image to a preset image format to obtain a second original image; Extracting pixel values of one of the channels of the second original image to obtain pixel values of the to-be-detected image.
14. A bitstream anomaly detection apparatus, characterized by, A computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor, is configured to implement the code stream anomaly detection method according to any one of claims 1-13.
15. A computer readable storage medium for storing a computer program, characterized in that, The computer program, when executed by a processor, is configured to implement the code stream anomaly detection method according to any one of claims 1-13.
Citation Information
Patent Citations
Blurred screen detection method and device, electronic equipment and readable storage medium
CN110120039A
Monochrome screen detection method and device in video file
CN111951244A