Stripe anomaly detection method and device, electronic equipment and storage medium
By calculating the difference map of the image and extracting the stripe data, the problem of poor detection of non-block format stripe anomaly in the prior art is solved, and more efficient stripe detection accuracy is achieved.
Patent Information
- Application Number
- CN202411427423.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-10-14
AI Technical Summary
The prior art has poor effect when detecting abnormal non-cube format stripes in images after format converted.
By acquiring the first binarized image of the image to be detected, the first difference map and the second difference map are calculated, the first fringe data in the first direction is extracted based on these difference maps, and the ratio between the number of pixel points of the stripe abnormality and the total number of pixel points is calculated. If the ratio exceeds the preset threshold, it is determined that there is a fringe abnormality.
The detection effect of abnormal fringes of images is improved, and it has better detection effect than boundary detection and block detection, and the accuracy of fringes is improved.
Smart Images

Figure CN119648612A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a stripe anomaly detection method, device, electronic device and storage medium. Background Art
[0002] Images have multiple formats, and they may need to be converted between formats when used in different scenarios. Some format conversion tools may cause abnormal pixel groups, such as mosaics and stripes, to appear in the converted images after converting them, affecting the use of the images.
[0003] In the prior art, boundary detection and block detection are usually performed on the converted image. Such detection can effectively detect mosaics in a block format, but is not suitable for detecting stripes in a non-block format, and the detection effect on stripes is relatively poor. Summary of the invention
[0004] In view of this, the present application aims to provide a stripe anomaly detection method, device, electronic device and storage medium to improve the detection effect of abnormal stripes in an image.
[0005] In a first aspect, an embodiment of the present application provides a stripe anomaly detection method, comprising: obtaining a first binary image corresponding to an image to be detected; respectively calculating a first difference map and a second difference map of the first binary image; the first difference map includes pixel differences between all adjacent pixels in a first direction, and the second difference map includes pixel differences between all adjacent pixels in a second direction; the first direction is a pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction is perpendicular to the second direction; based on the first difference map and the second difference map, extracting first stripe data in the first direction from the image to be detected; the first stripe data includes pixel points of stripe anomalies in the image to be detected in the first direction; calculating the ratio of the number of pixel points representing stripe anomalies in the first stripe data to the number of all pixel points in the image to be detected; if the ratio exceeds a preset threshold, it is determined that there is a stripe anomaly in the image to be detected.
[0006] The stripe anomaly of the image is usually generated by arranging and saving the pixels of the image, and the stripe direction is consistent with the arrangement direction of the pixels. In the embodiment of the present application, the first direction is the pixel arrangement direction of the image to be detected when generating the image to be detected, that is, the direction of the stripes. The pixel values of the pixels where the stripe anomaly is located vary greatly. Therefore, in the embodiment of the present application, the binary image corresponding to the image to be detected can be obtained to detect the stripes. For a normal image, the difference map in different directions shows unknown similar noise points. The pixels of the stripes are empty in the first direction of the difference map and horizontal bars in the second direction. Therefore, the first difference map and the second difference map can be used to extract the pixels that the stripes will give you, and then it can be determined whether the pixel exceeds the preset threshold value representing the existence of image anomalies. If it exceeds, it is determined that there is a stripe anomaly. Compared with boundary detection, block detection, etc., the above method has a better detection effect on stripes, which helps to improve the accuracy of stripe detection.
[0007] In one embodiment, the method of obtaining a first binary image corresponding to an image to be detected includes: obtaining a range of pixel values of abnormal stripe pixels in the image to be detected; determining a binarization demarcation point based on the range of pixel values of the abnormal pixels; and binarizing each pixel in the image to be detected based on the binarization demarcation point to obtain the first binary image in different images.
[0008] The pixel values of pixels with stripe anomalies are usually within a range. If the existing method of distinguishing by pixel value 128 is adopted, it is possible that the pixel detection of some stripes will be erroneous. Therefore, in an embodiment of the present application, the binarization dividing point is determined by the chromaticity of the stripes in the image to be detected, so that the first binary image can more accurately reflect the pixel points that may be stripes, thereby improving the detection accuracy of stripes.
[0009] In one embodiment, respectively calculating the first difference map and the second difference map of the first binary image includes: traversing all pixel points of the image to be detected along the first direction, and calculating the pixel differences between all adjacent pixel points in the first direction, to obtain the first difference map; traversing all pixel points of the image to be detected along the second direction, and calculating the pixel differences between all adjacent pixel points in the second direction, to obtain the second difference map.
[0010] In the embodiment of the present application, if the latter pixel is subtracted from the former pixel to extract points with large pixel differences, the performance of these points with large differences on the overall image is stripes, so the stripes can be determined by pixel differences. By traversing all the pixel points, the number of pixel points in the first difference map and the second difference map can be matched with the pixel points of the first binary image, reducing the possibility of abnormal detection results due to the stripe abnormality detection method.
[0011] In one embodiment, the image to be detected is an image obtained by preprocessing an unprocessed original image, or the image to be detected is an unprocessed original image; before calculating the ratio of the number of pixels included in the first stripe data to the number of all pixels in the image to be detected, the method also includes: obtaining the resolution of the target image; the target image is one of the first binary image and the image to be detected; and calculating the number of all pixels in the image to be detected based on the resolution of the target image.
[0012] In the embodiment of the present application, the first binary image is converted from the image to be detected, and the number of pixels in the image to be detected, the first binary image, the first difference map, and the second difference map are consistent, so the resolution of the image to be detected or the first binary image can be directly used to calculate the number of all pixels in the image. Compared with counting the number of all pixels in the first stripe data, the method of calculating the number of all pixels in the image to be detected using resolution is easier to implement and can improve the efficiency of determining the number of all pixels.
[0013] In one embodiment, before acquiring the first binarized image corresponding to the image to be detected, the method further includes: performing image scaling on the image to be detected to adjust the image to be detected to a third preset size.
[0014] In the embodiment of the present application, the image to be detected is scaled to a uniform third preset size, and stripe detection is performed on the image of the uniform size, which helps to reduce the complexity of stripe detection and improve the efficiency of stripe detection.
[0015] In one embodiment, before calculating the ratio of the number of pixels included in the first stripe data to the number of all pixels in the image to be detected, the method further includes: calculating the number of all pixels in the image to be detected based on the third preset size.
[0016] In the embodiment of the present application, since the image to be detected is adjusted to a uniform size, the number of its pixels is fixed. Therefore, the number of all pixels can be directly calculated by the third preset size without calculating the pixels each time a stripe anomaly detection is performed, thereby improving the efficiency of the stripe anomaly detection.
[0017] In one embodiment, before comparing the ratio with a preset threshold, the method further includes: obtaining an image accuracy requirement; and determining the preset threshold based on a third corresponding relationship among the image accuracy requirement, a preset image accuracy requirement and a detection threshold.
[0018] In the embodiments of the present application, different image accuracy requirements can be set according to different image accuracy requirements, and then different preset thresholds can be set. As a result, the stripe anomaly detection method can be applied to different scenarios, and stripe anomaly detection that meets the current scenario can be achieved in different scenarios, thereby expanding the scope of application of the stripe anomaly detection method.
[0019] In one embodiment, the image to be detected is an image obtained after preprocessing an unprocessed original image; after determining that the image to be detected has a stripe abnormality, the method also includes: obtaining the original image corresponding to the image to be detected; obtaining a second binarized image corresponding to the original image; calculating a first original image difference map in a first direction and a second original image difference map in a second direction of the second binarized image; extracting second stripe data in the first direction from the original image based on the first original image difference map and the second original image difference map; comparing the second stripe data with the first stripe data; if the similarity between the second stripe data and the first stripe data of the image to be detected is less than a preset pixel point threshold, determining that the preprocessing has an abnormality.
[0020] In the embodiment of the present application, the second stripe image of the original image is extracted, and the second stripe image is compared with the first stripe image. If the original image itself has stripe anomalies, the similarity between the two is high. If the original image does not have stripe anomalies, the stripe anomalies are large and may be caused by preprocessing. Therefore, it can be determined whether the preprocessing process of converting the original image to the image to be detected is abnormal, and then it can be determined whether the preprocessing tools or means are abnormal, which can assist in troubleshooting the cause of the stripes.
[0021] In one embodiment, extracting the first stripe data in the first direction of the image to be detected based on the first difference map and the second difference map includes: subtracting the first difference map from the second difference map to obtain the first stripe data.
[0022] In the embodiment of the present application, the normal pattern is shown as noise points with similar positions on the difference maps in different directions, that is, the same pixel point has the same value on the first difference map and the second difference map, while the pixel point with abnormal stripes has different values on the first difference map and the second difference map. If the value of the same pixel point in the second difference map minus the value of the first difference map is not 0, it indicates that the pixel point has abnormal stripes. Therefore, the pixel point with abnormal stripes can be extracted by subtracting the first difference map from the second difference map. This method is easy to implement and effectively reduces the complexity of stripe detection while realizing stripe detection, which is conducive to reducing power consumption and improving detection efficiency.
[0023] In one embodiment, the first stripe data includes first stripe sub-data, and before subtracting the first difference map from the second difference map, the method further includes: dilating the first difference map based on a convolution kernel of a first preset size to obtain the first difference map after dilation; subtracting the first difference map from the second difference map includes: subtracting the first difference map after dilation from the second difference map to obtain the first stripe sub-data; comparing the ratio of the number of pixels included in the stripe data to the number of all pixels in the image to be detected with a preset threshold includes: calculating the ratio of the number of pixels in the first stripe sub-data that characterize stripe abnormalities to the number of all pixels in the image to be detected.
[0024] Generally, there is a distance difference of multiple pixels between the difference map of a normal image in the first direction and the second direction. Dilation processing can expand the bright area or connected area in the image, making the edge or shape of the object more obvious. In the embodiment of the present application, the first difference map in the first direction is dilated to expand the pixel points of the stripe abnormality in the first direction, reduce the influence of the distance difference, so that the second difference map can effectively remove the pixel points of the normal image and retain the pixel points of the stripe abnormality, thereby improving the accuracy of stripe detection.
[0025] In one embodiment, before the first difference map is expanded using a convolution kernel based on a first preset size, the method further includes: obtaining an image accuracy requirement; and determining the first preset size based on a first corresponding relationship between the image accuracy requirement, a preset image accuracy requirement and a size of a convolution kernel for expansion processing.
[0026] In the embodiment of the present application, the larger the convolution kernel size of the expansion processing is, the better the amplification effect of the abnormal pixel points is. Therefore, when the second difference map is subtracted from the first difference map after the expansion processing, it is easier to remove the pixels of the normal pattern. The larger the convolution sum size is, the higher the power consumption required. Therefore, the first preset size can be configured according to the image accuracy requirements to meet the requirements of accuracy and precision of stripe anomaly detection in different scenarios while reducing the generation of excessive power consumption.
[0027] In one embodiment, the first stripe data includes second stripe sub-data, and after the first stripe data is obtained by subtracting the first difference map from the second difference map, the method further includes: corroding the first stripe data based on a convolution kernel of a second preset size to obtain second stripe sub-data; comparing the ratio of the number of pixels included in the first stripe data to the number of all pixels in the image to be detected with a preset threshold, including: comparing the ratio of the number of pixels representing stripe abnormalities in the second stripe sub-data to the number of all pixels in the image to be detected with the preset threshold.
[0028] The corrosion process can shrink the boundary inward to separate different targets that are stuck together, and can remove small particle noise. In the embodiment of the present application, by performing corrosion processing on the first stripe data, the noise points of the normal pattern in the first stripe data can be further removed, thereby retaining the values of the abnormal pixel points and further improving the accuracy of stripe anomaly detection.
[0029] In one embodiment, before the convolution kernel based on the second preset size performs corrosion processing on the first stripe data, the method also includes: obtaining image accuracy requirements; and determining the second preset size based on a second corresponding relationship between the image accuracy requirements, the preset image accuracy requirements and the corrosion processing convolution kernel size.
[0030] In the embodiment of the present application, the convolution kernel size of the corrosion processing affects the effect of the corrosion processing on removing normal graphic noise. Configuring the convolution kernel size of the corrosion processing according to the image accuracy requirements can improve the detection of stripe anomalies while reducing the excessive power consumption caused by the corrosion processing.
[0031] In a second aspect, an embodiment of the present application provides a stripe anomaly detection device, comprising: an image processing module, used to obtain a first binary image corresponding to an image to be detected; a difference map calculation module, used to respectively calculate a first difference map and a second difference map of the first binary image; the first difference map includes pixel differences between all adjacent pixels in a first direction, and the second difference map includes pixel differences between all adjacent pixels in a second direction; the first direction is a pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction is perpendicular to the second direction; a stripe extraction module, used to extract first stripe data in the first direction from the image to be detected based on the first difference map and the second difference map; the first stripe data includes pixel points of stripe anomalies in the image to be detected in the first direction; an anomaly detection module, used to calculate the ratio of the number of pixel points characterizing stripe anomalies in the first stripe data to the number of all pixel points in the image to be detected; the ratio is compared with a preset threshold, and if the ratio exceeds the preset threshold, it is determined that there is a stripe anomaly in the image to be detected.
[0032] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the stripe anomaly detection method as described in any one of the first aspects.
[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium. When the computer program runs on a computer, the computer executes the stripe anomaly detection method as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 A flowchart of a stripe anomaly detection method provided in one embodiment of the present application;
[0036] Figure 2 A first schematic diagram of first stripe data provided by an embodiment of the present application;
[0037] Figure 3 A second schematic diagram of first stripe data provided by an embodiment of the present application;
[0038] Figure 4 A schematic diagram of the entire process of a stripe anomaly detection method provided in an embodiment of the present application;
[0039] Figure 5 A schematic diagram of a stripe anomaly detection device provided in one embodiment of the present application;
[0040] Figure 6 A schematic diagram of an electronic device provided according to an embodiment of the present application.
[0041] Icon: stripe anomaly detection device 300; image processing module 310; difference map calculation module 320; stripe extraction module 330; anomaly detection module 340; electronic device 400; processor 410; memory 420. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] See also Figure 1 , Figure 1 A flowchart of a stripe anomaly detection method provided in an embodiment of the present application, the stripe anomaly detection method comprising:
[0044] S110, obtaining a first binarized image corresponding to the image to be detected.
[0045] In the embodiment of the present application, the image to be detected can be an image in any format except a binary image. For example, the image to be detected can be a JPEG (Joint Photographic Experts Group, a standard for continuous tone static image compression) format, an RGB (Red Green Blue, red green blue channel) image, a YUV (Luminance Chrominance, brightness, chroma) image, an HSV (Hue, Saturation, Value, hexagonal pyramid model) image, etc., without limitation.
[0046] At present, images of various formats can usually be converted into each other. In this embodiment, the image to be detected can be an original image that has not been converted into a format, or an image that has been converted into a format.
[0047] In one embodiment of the present application, obtaining a first binary image corresponding to the image to be detected may include: obtaining a grayscale image of the image to be detected; binarizing the grayscale image to obtain a first binary image; wherein the binarization includes: adjusting the pixel values of pixels whose pixel values are greater than 128 in the image to be detected to 1, and adjusting the pixel values of pixels whose pixel values are less than 128 to 0. The method for converting the image to be detected into a grayscale image may refer to the prior art. The acquisition of the binary image may also refer to other existing methods, which are not limited here.
[0048] In one embodiment of the present application, obtaining a first binary image corresponding to an image to be detected may include: obtaining a range of pixel values of abnormal pixel points of stripes in the image to be detected; determining a binarization dividing point based on the range of pixel values of the abnormal pixel points; and binarizing each pixel in the image to be detected based on the binarization dividing point to obtain a first binary image in different images.
[0049] In different images to be detected with stripes, the pixel values of pixels corresponding to the stripes may be different. For example, the pixel values of the pixels of the stripes in one image are all less than 50, and the pixel values of the pixels of the stripes in another image are all less than 128. Therefore, if 128 is uniformly used as the dividing point for binarization processing, some non-striped pixels may be determined as pixels with stripe abnormalities. Therefore, in an embodiment of the present application, the pixel value of each pixel can be used to determine the binarization dividing point.
[0050] In some embodiments of the present application, the pixel value of each pixel in the image to be detected can be obtained in advance, and the pixel value range of the pixel points with stripe anomalies can be counted, and the demarcation point is determined based on the pixel value range, so that the demarcation point can effectively distinguish the pixel points that are likely to be stripes, thereby correctly assigning a value to each pixel point.
[0051] For example, in a certain scenario, the pixel value of the stripe abnormality pixel is a black stripe fixed less than 50, then 50 can be used as the dividing point for binarization, and the pixel value less than 50 is adjusted to 0, and the pixel value greater than 50 is adjusted to 1.
[0052] In some scenarios, the pixel difference between two adjacent pixels of the overall image will not exceed a preset value. If it exceeds the preset value, the subsequent pixel may be a pixel of a stripe. Therefore, in an embodiment of the present application, the dividing point can also be determined based on the pixel change of adjacent pixels.
[0053] For example, in the embodiments of the present application, the binarization process is not limited to the values of 0 and 1, but can also be other values, for example, represented by 0, 128 and 255, where 0 represents black, 128 represents gray, and 255 represents white. The pixel value ranges of black, gray, and white are set respectively. If the difference between two pixels of the overall image in an image to be detected does not exceed 86, then a three-point process can be performed, and the values of pixels with pixel values less than 86 are returned to 0, the values of pixels with pixel values in the range of 86>x>178 are changed to 128, and the values of pixels with pixel values greater than 178 are changed to 255, thereby obtaining a first binarized image including three values of 0, 128, and 256. If the pixel difference between two adjacent pixels exceeds 128, the latter pixel is likely to be a stripe pixel with a high probability.
[0054] In an embodiment of the present application, after obtaining the first binary image corresponding to the image to be detected, the image to be detected can also be resized to adjust the image to be detected to a third preset size. The image scaling method can refer to the prior art, such as the resize function in some image processing tools, which will not be expanded here.
[0055] In an embodiment of the present application, by scaling the image to be detected before detecting stripe anomalies, the image to be detected can be unified into a third preset size. Compared with realizing stripe detection in images of different sizes, it is easier to realize stripe detection in images of uniform size, which helps to reduce the difficulty of realizing stripe anomaly detection and improve the efficiency of stripe anomaly detection.
[0056] S120, respectively calculating a first difference map and a second difference map of the first binarized image.
[0057] In this embodiment, the first direction is a pixel arrangement direction of the image to be detected when the image to be detected is generated.
[0058] Stripe anomalies are caused by abnormal arrangement of pixels in the image. For example, in some image conversion tools, after converting the original image, the pixels of the image will be arranged in a predetermined direction. During the arrangement, there may be problems with the image conversion tool, which may cause problems in the arrangement of pixels, resulting in abnormal pixel values at various positions. For example, if the pixel value is 0, it will appear black, and multiple consecutive pixel anomalies will form stripes. Therefore, the reverse direction of the stripes is the pixel arrangement direction of the image to be detected when generating the image to be detected. In the embodiment of the present application, the stripe direction is also the first direction.
[0059] In this embodiment, the first direction is perpendicular to the second direction. For example, in a two-dimensional coordinate system, if the first direction is the x-axis direction, the second direction is the y-axis direction. Conversely, if the first direction is the y-axis direction, the second direction is the x-axis direction. If the first direction is the x-axis direction, the corresponding stripe anomaly is a horizontal stripe. Conversely, if the first direction is the y-axis direction, the corresponding stripe anomaly is a vertical stripe.
[0060] In this embodiment, the first difference map includes pixel differences between all adjacent pixels in a first direction, and the second difference map includes pixel differences between all adjacent pixels in a second direction.
[0061] In one embodiment of the present application, respectively calculating a first difference map and a second difference map of a first binary image includes: traversing all pixels of the image to be detected along the first direction, and calculating the pixel differences between all adjacent pixels in the first direction, to obtain the first difference map. Correspondingly, traversing all pixels of the image to be detected along the second direction, and calculating the pixel differences between all adjacent pixels in the second direction, to obtain the second difference map.
[0062] In this embodiment, in the same direction, the pixel value of the next pixel can be subtracted from the pixel value of the current pixel. For example, if the first direction is the x-axis direction, the coordinates of the current pixel are (h, w), and the coordinates of the next pixel are (h, w+1), wherein h represents height, corresponding to the y-axis direction, and w represents width, corresponding to the x-axis direction. The pixel value of the pixel (h, w+1) can be subtracted from the pixel value of the pixel (h, w), and two adjacent differences can be obtained. For each pixel on each row, the difference is calculated to obtain the difference of the pixel in the row, and then the difference is calculated for the second row, until all the row pixels of the image to be detected are traversed to obtain the difference map of the image to be detected in the x-axis direction. Similarly, the pixel in the y-axis direction is calculated, and the pixel value of the pixel (h+1, w) is subtracted from the pixel value of the pixel (h, w), and the difference corresponding to the pixel (h, w) in the y-axis direction is obtained. All pixels are traversed to obtain the second difference map. Since the difference is calculated for the pixel points on the binary image, the value corresponding to each pixel point on the first difference map and the second difference map is 1 or 0.
[0063] S130, extracting first stripe data in a first direction from the image to be detected based on the first difference map and the second difference map.
[0064] In this embodiment, the stripe data includes pixel points of the first image to be detected with abnormal stripes in the first direction.
[0065] A normal pattern appears as noise points with similar positions in the first difference image and the second difference image of the binary image, that is, the values of the same pixel in the first difference image and the second difference image are all 1 or all 0, and the difference between the two is 0. On the contrary, horizontal stripes appear as horizontal stripes in the y-axis direction, that is, the difference between adjacent pixels is 1, and appear as empty in the x-axis direction, that is, the difference between adjacent pixels is 0. For horizontal stripes, the first direction is the x-axis direction, and the second direction is the y-axis direction. Since the values of the same pixel in the first difference image and the second difference image are different, the difference between the value of the same pixel in the second difference image and the value of the first difference image is 1.
[0066] Therefore, in one embodiment of the present application, extracting first stripe data in the first direction of the image to be detected based on the first difference map and the second difference map may include: subtracting the first difference map from the second difference map to obtain the first stripe data.
[0067] Among them, since the first difference map and the second difference map are obtained by processing the same first binary image, each pixel in the first difference map and the second difference map corresponds to each other, for example, the pixel (h, w) in the first difference map corresponds to the pixel (h, w) in the second difference map. In this embodiment, the second difference map is subtracted from the first difference map, which can be the value of the same pixel in the second difference map minus the value of the first pixel, for example, the value of the pixel (h, w) in the first difference map is 0, the value of the pixel (h, w) in the second difference map is 1, and the difference between the pixel (h, w) in the second difference map and the first difference map is 1, indicating that the pixel (h, w) is a pixel corresponding to the stripe anomaly.
[0068] Therefore, by subtracting the value of each pixel point in the first difference map from the value of each pixel point in the second difference map, the result can represent whether the pixel point is a pixel point corresponding to the stripe anomaly. Accordingly, after subtracting each corresponding pixel point from the second difference map and the first difference map, the first stripe data can be obtained. In the first stripe data, all pixel points with a value of 1 are pixel points with stripe anomalies.
[0069] In one embodiment of the present application, before subtracting the first difference map from the second difference map, the first difference map may be dilated based on a convolution kernel of a first preset size to obtain the dilated first difference map. Accordingly, subtracting the first difference map from the second difference map may include: subtracting the dilated first difference map from the second difference map to obtain the first stripe sub-data.
[0070] Dilation processing is mainly used to increase or highlight the boundaries of objects in the image. It is achieved by filling holes in the image, expanding the size of objects, and connecting similar objects. It can blend pixels into the background and expand outward, thereby merging broken targets to facilitate their overall extraction.
[0071] There is a distance difference of several pixels in the x and y difference map coordinates of the normal figure. Therefore, by dilating the first difference map, some pixels with stripe anomalies can be enlarged. When the second difference map is subtracted from the first difference map, the second difference map can better subtract the pixels of the normal figure, that is, the pixels with a value of 1, and retain the pixels with a value of 0, thereby more accurately extracting the pixels with stripe anomalies.
[0072] The specific method of the expansion process can refer to the prior art and will not be expanded here. In some embodiments, the convolution kernel can also be called a dilation kernel, a structural element, etc. The first preset size of the convolution kernel affects the dilation size of each pixel. Generally, the larger the dilation, the more obvious the amplification of the abnormal pixel. Accordingly, the detection efficiency of the stripe anomaly is also affected to a certain extent.
[0073] Therefore, in one embodiment of the present application, before the first difference map is expanded based on a convolution kernel of a first preset size, an image accuracy requirement can also be obtained; based on a first correspondence between the image accuracy requirement, the preset image accuracy requirement and the size of the expansion convolution kernel, the first preset size is determined.
[0074] In this embodiment, the image accuracy requirement in the first corresponding relationship is proportional to the size of the dilation processing convolution kernel. The higher the image accuracy requirement, the larger the convolution kernel size. In the case of no image accuracy requirement, the first preset size can be 2×2, and when the image accuracy requirement has higher requirements, the first preset size can be increased according to the image accuracy requirement, for example, increased to 3×3, 4×4 or larger size, which can be configured according to the actual scene. The above is only an example and is not limited here.
[0075] The opposite process to the dilation process is the erosion process. The erosion process has the opposite function to the dilation process. The erosion process is used to eliminate connected boundaries and shrink the boundaries inward to separate different targets that are stuck together, and can remove small particle noise.
[0076] Therefore, in one embodiment of the present application, after obtaining the first stripe data or the first stripe sub-data, the first stripe data may be corroded based on a convolution kernel of a second preset size to obtain the second stripe sub-data. The corrosion process may refer to the prior art and will not be expanded here.
[0077] The first stripe data may include stripe data extracted from a difference map without expansion processing, or first stripe sub-data, or one of the second stripe sub-data. The second stripe sub-data is obtained by corroding the first stripe data. The first stripe data without corrosion processing can be regarded as a coarsely extracted stripe data. Through corrosion processing, the noise points of the normal pattern in the first stripe data can be further removed, so that the value of the pixel point of the normal pattern becomes 0, thereby retaining the value of the pixel point of the stripe abnormality, thereby improving the accuracy of stripe detection.
[0078] Similarly, in an embodiment of the present application, before the first stripe data is corroded based on a convolution kernel of a second preset size, an image accuracy requirement can also be obtained; based on a second correspondence between the image accuracy requirement, the preset image accuracy requirement and the size of the corrosion processing convolution kernel, the second preset size is determined.
[0079] Excessive corrosion processing can eliminate noise points, thereby eliminating abnormal pixels of the stripes. Therefore, in an embodiment of the present application, the image accuracy requirement can be obtained, and the corresponding second preset size can be determined according to the image accuracy requirement, wherein the second corresponding relationship can be configured according to the actual scene The specific size and the image accuracy requirement have a corresponding relationship, which is not limited here.
[0080] In some other embodiments of the present application, the second preset size may be determined based on the first preset size. For example, in one embodiment of the present application, if the first preset size is a×a, the second preset size may be (a-1)×(a+1).
[0081] The effects of corrosion processing and dilation processing are opposite. Using corrosion processing to process the stripe data after dilation processing can eliminate the situation where the dilation processing causes too many abnormal pixels in the stripes to a certain extent, thereby improving the accuracy of stripe detection.
[0082] See also Figure 2 and Figure 3 In the embodiment of the present application, the grayscale image of the image to be detected is as follows: Figure 2 and Figure 3 As shown in the left figure, after processing, it can be extracted as follows Figure 2 and Figure 3 The first stripe data is shown in the right figure. Since a binary image is used, 1 is an abnormal pixel of the stripe, which appears in white, and the value of the pixel of the normal image is 0, which appears in black.
[0083] S140, calculating the ratio of the number of pixels representing stripe anomalies in the first stripe data to the number of all pixels in the image to be detected.
[0084] If there are too many pixels with stripe abnormalities, it is likely that the image to be detected has stripe abnormalities. Therefore, in an embodiment of the present application, the number of pixels representing stripe abnormalities in the first stripe data can be calculated, and the number of all pixels in the image to be detected can be calculated. Finally, the two can be compared to determine whether the image to be detected is abnormal through the ratio.
[0085] In this embodiment, the second difference map corresponding to the pixels included in the first stripe data is the difference between the second difference map and the first difference map as detailed below, where 0 represents a normal pixel and 1 represents an abnormal pixel. Therefore, the number of pixels with a value of 1 in the first stripe data can be counted to obtain the number of pixels representing abnormal stripes.
[0086] If the difference map is dilated or the first stripe is eroded during the detection process, the ratio of the number of pixels representing the stripe anomaly in the first stripe sub-data to the number of all pixels in the image to be detected is calculated, or the ratio of the number of pixels representing the stripe anomaly in the second stripe sub-data to the number of all pixels in the image to be detected is calculated.
[0087] In one embodiment of the present application, the resolution of the target image may also be acquired, and the number of all pixels in the image to be detected may be calculated based on the resolution of the target image.
[0088] In this embodiment, the target image is one of the first binary image and the image to be detected, and the image to be detected can be an original image without preprocessing or an image after preprocessing. The first binary image is obtained by converting the image to be detected, so the number of pixels of the first binary image and the image to be detected is the same.
[0089] Compared with counting the number of all pixels of the first stripe data, it is easier to implement and more efficient to directly calculate the number of all pixels in the image to be detected by using the resolution. The method of calculating the number of pixels by using the resolution can refer to the prior art and will not be expanded here.
[0090] In other embodiments of the present application, if the image to be detected is adjusted to a third preset size through image scaling, and the third preset size is a known fixed size, the third preset size can be obtained in advance and the number of all pixels in the image to be detected can be calculated directly based on the third preset size.
[0091] In this embodiment, since different images to be detected are all adjusted to the third preset size through image scaling, on this basis, after the number of all pixels is calculated through the third preset size, there is no need to recalculate the number of images to be detected, which can improve the efficiency of image stripe anomaly detection.
[0092] In an embodiment of the present application, if during the process of stripe detection, the first difference map is dilated and / or the first stripe data is eroded, then, accordingly, the number of all pixel points of the image to be detected can be enlarged or reduced by a first preset size of the dilation process and a second preset size of the corrosion process, so that the number of all pixel points used to calculate the ratio matches the number of pixel points of the first stripe data.
[0093] S150: If the ratio exceeds a preset threshold, it is determined that there is a stripe anomaly in the image to be detected.
[0094] In an embodiment of the present application, the ratio is the proportion of stripe abnormality pixels. If the ratio is too large, there is a high possibility that the image to be detected has stripe abnormality. Therefore, it can be determined whether the ratio exceeds the preset threshold. If it exceeds the preset threshold, it is determined that the image to be detected has stripe abnormality.
[0095] In an embodiment of the present application, the preset threshold can be configured according to actual needs. For example, in one embodiment, before comparing the ratio with the preset threshold, the image accuracy requirement can be obtained; based on the third corresponding relationship between the image accuracy requirement, the preset image accuracy requirement and the detection threshold, the preset threshold is determined.
[0096] In some scenes with low precision requirements, a larger preset threshold can be configured, so that some images with fewer stripe abnormal pixels can be ignored and determined as normal images. In some scenes with higher precision requirements, such as industrial scenes, a smaller preset threshold can be configured to determine some images with fewer stripe abnormal pixels as images with stripe abnormalities.
[0097] The reason why the image to be detected has stripe anomalies may be that the original image has anomalies in the process of converting to the image to be detected, for example, the conversion tool has anomalies. In the embodiment of the present application, the stripe anomaly detection method can also be used to determine whether the conversion tool has anomalies.
[0098] In this embodiment, after determining that there is a stripe abnormality in the image to be detected, the method may also include: obtaining an original image corresponding to the image to be detected; obtaining a second binarized image corresponding to the original image; calculating a first original image difference map in a first direction and a second original image difference map in a second direction of the second binarized image; extracting second stripe data in the first direction from the original image based on the first original image difference map and the second original image difference map; comparing the second stripe data with the first stripe data; if the similarity between the second stripe data and the first stripe data of the image to be detected is less than a preset similarity threshold, determining that there is an abnormality in the preprocessing.
[0099] In this embodiment, since the purpose is to detect whether the preprocessing is normal, the original image is the image before the preprocessing, the image to be detected is the image after the preprocessing, and the original image is an image that can be directly obtained for testing. The second binarized image refers to the binarized image of the original image. The method for obtaining the second binarized image can refer to the aforementioned process of obtaining the first binarized image or to the prior art, which will not be expanded here.
[0100] The second stripe data is the stripe data of the original image. Similarly, the difference map of the second binary image of the original image in the first direction and the difference map in the second direction can be calculated respectively with reference to the aforementioned method of extracting the first stripe data of the image to be detected. For the original image, the difference map in the first direction is called the first original difference map, and the difference map in the second direction is called the second original difference map. After obtaining the first original difference map and the second original difference map, the second original difference map can be used to subtract the first original difference map to obtain the second stripe data of the original image.
[0101] In some embodiments, if the first difference map is dilated when extracting the first stripe data from the image to be detected, the first original difference map can be dilated accordingly, and then the first original difference map after dilation can be subtracted from the second original difference map. Correspondingly, if the first stripe data is eroded, the second stripe data can also be eroded accordingly. In this way, the consistency of the stripe data extraction process is maintained, and the accuracy of the final judgment result is improved.
[0102] If there is no abnormality in the preprocessing process such as format conversion, the second stripe data and the first stripe data have a high similarity, or both are guaranteed to have no stripe abnormality. On the contrary, if the stripe abnormality is caused by the preprocessing process, the number of pixels with stripe abnormality in the first stripe data will be much larger than the number of pixels with stripe abnormality in the second stripe data, and the similarity between the two will be low. Therefore, if the similarity between the second stripe data and the first stripe data of the image to be detected is less than the preset similarity threshold, it is determined that there is an abnormality in the preprocessing. The calculation of similarity can refer to the prior art and will not be expanded here.
[0103] In an embodiment of the present application, the above-mentioned stripe anomaly detection method can be configured in a video or image transcoding tool to perform stripe anomaly detection on the output of the transcoding tool, and timely determine whether there is a stripe anomaly in the output video or image.
[0104] For ease of understanding, an example is provided here to illustrate the stripe anomaly detection method provided in this application.
[0105] In this example, the first direction is the x-axis direction, the second direction is the y-axis direction, and the type of stripe anomaly is horizontal stripes. Figure 4 , Figure 4A schematic diagram of the entire process of a stripe anomaly detection method provided in one embodiment of the present application.
[0106] First, for the image to be detected, the image to be detected can be adjusted to a third preset size, then the image to be detected is converted into a grayscale image, and then the grayscale image is converted into a first binary image.
[0107] Then, the first difference map and the second difference map are calculated using the first binary image, which can be done by traversing all pixels of the first binary image, subtracting the pixel value of the current pixel from the pixel value of the next pixel in the same direction, to obtain the pixel difference of the current pixel.
[0108] The first difference image may be expanded with a first preset size to amplify the noise points of the normal image and the abnormal image, so as to better remove the noise points of the normal image and retain the noise points of the stripe abnormality (that is, the value of the pixel point of the stripe abnormality is 1). The first difference image after the expansion is subtracted from the second difference image to obtain the first stripe sub-data. The first stripe sub-data is then eroded with a second preset size to further remove the noise points of the normal image and obtain the second stripe sub-data.
[0109] Finally, the ratio of the number of pixels representing stripe anomalies in the second stripe sub-data to the number of all pixels in the image to be detected is counted, and the ratio is compared with a preset threshold to determine whether it exceeds the preset threshold. If it exceeds the preset threshold, it is determined that the image to be detected has stripe anomalies.
[0110] Based on the same inventive concept, the present application also provides a stripe anomaly detection device. Figure 5 , Figure 5 The present invention is a schematic diagram of a stripe anomaly detection device provided by an embodiment of the present invention. The stripe anomaly detection device 300 comprises: an image processing module 310 , a difference map calculation module 320 , a stripe extraction module 330 and an anomaly detection module 340 .
[0111] The image processing module 310 is used to obtain a first binary image corresponding to the image to be detected.
[0112] The difference map calculation module 320 is used to calculate a first difference map and a second difference map of the first binary image respectively; the first difference map includes pixel differences between all adjacent pixels in a first direction, and the second difference map includes pixel differences between all adjacent pixels in a second direction; the first direction is a pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction is perpendicular to the second direction;
[0113] A stripe extraction module 330 is used to extract first stripe data in the first direction from the image to be detected based on the first difference map and the second difference map; the first stripe data includes pixel points of the image to be detected with stripe abnormalities in the first direction;
[0114] The anomaly detection module 340 is used to calculate the ratio of the number of pixels representing the stripe anomaly in the first stripe data to the number of all pixels in the image to be detected; compare the ratio with a preset threshold, and if the ratio exceeds the preset threshold, determine that the image to be detected has a stripe anomaly.
[0115] The difference map calculation module 320 is used to traverse all pixel points of the image to be detected along the first direction, and calculate the pixel differences between all adjacent pixel points in the first direction to obtain the first difference map; traverse all pixel points of the image to be detected along the second direction, and calculate the pixel differences between all adjacent pixel points in the second direction to obtain the second difference map.
[0116] The anomaly detection module 340 is used to obtain the resolution of a target image; the target image is one of the first binarized image and the image to be detected; and calculate the number of all pixels in the image to be detected based on the resolution of the target image.
[0117] The image processing module 310 is used to perform image scaling on the image to be detected, so as to adjust the image to be detected to a third preset size.
[0118] The anomaly detection module 340 is used to calculate the number of all pixels in the image to be detected based on the third preset size.
[0119] The anomaly detection module 340 is further configured to obtain an image accuracy requirement; and determine the preset threshold based on a third corresponding relationship between the image accuracy requirement, the preset image accuracy requirement and the detection threshold.
[0120] The abnormality detection module 340 is also used to obtain the original image corresponding to the image to be detected; obtain the second binarized image corresponding to the original image; calculate the first original image difference map in the first direction and the second original image difference map in the second direction of the second binarized image; extract the second stripe data in the first direction from the original image based on the first original image difference map and the second original image difference map; compare the second stripe data with the first stripe data; if the similarity between the second stripe data and the first stripe data of the image to be detected is less than a preset similarity threshold, it is determined that there is an abnormality in the preprocessing.
[0121] The stripe extraction module 330 is used to subtract the first difference map from the second difference map to obtain the first stripe data.
[0122] The stripe extraction module 330 is further configured to dilate the first difference image using a convolution kernel based on a first preset size to obtain a first difference image after dilation; and to subtract the first difference image after dilation from the second difference image to obtain the first stripe sub-data. The anomaly detection module is further configured to calculate the ratio of the number of pixel points representing stripe anomalies in the first stripe sub-data to the number of all pixel points in the image to be detected.
[0123] The stripe extraction module 330 is further used to obtain image accuracy requirements; and determine the first preset size based on a first corresponding relationship between the image accuracy requirements, a preset image accuracy requirement and a dilation processing convolution kernel size.
[0124] The stripe extraction module 330 is also used to perform corrosion processing on the first stripe data based on a convolution kernel of a second preset size to obtain second stripe sub-data; the anomaly detection module is also used to compare the ratio of the number of pixel points representing stripe anomalies in the second stripe sub-data to the number of all pixel points in the image to be detected with the preset threshold.
[0125] The stripe extraction module 330 is also used to obtain image accuracy requirements; based on the second corresponding relationship between the image accuracy requirements, the preset image accuracy requirements and the corrosion processing convolution kernel size, determine the second preset size.
[0126] The functions used by the above-mentioned stripe anomaly detection device 300 are the same as those implemented by the above-mentioned stripe anomaly detection method. For details, please refer to the contents of the above-mentioned stripe anomaly detection method, which will not be expanded here.
[0127] Based on the same inventive concept, the present application embodiment also provides an electronic device. Figure 6 , Figure 6 A schematic diagram of an electronic device 400 is also provided for an embodiment of the present application, which can serve as an executor of the aforementioned stripe anomaly detection method, including: a processor 410 and a memory 420, and the processor 410 and the memory 420 are communicatively connected.
[0128] The memory 420 stores computer-readable instructions that can be executed by the processor 410 , and the computer-readable instructions can be executed by the processor 410 , so that the processor 410 can execute the stripe anomaly detection method in the aforementioned embodiment.
[0129] The processor 410 and the memory 420 are connected, including but not limited to, via a communication bus.
[0130] The processor 410 may be an integrated circuit chip with signal processing capabilities. The processor 410 may be a general-purpose processor, including a CPU (Central Processing Unit), a NP (Network Processor), etc.; it may also be a digital signal processor, an application-specific integrated circuit, a readily available programmable gate array, or other programmable logic devices or transistor logic devices, or discrete hardware components. It may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0131] The memory 420 may include, but is not limited to, RAM (Random Access Memory), ROM (Read Only Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0132] It can be understood that the electronic device 400 may also include more common modules required by itself, which are not introduced one by one in the embodiments of the present application.
[0133] Based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program runs on a computer, the computer executes the stripe anomaly detection method provided in the above embodiment.
[0134] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD (digital video disc)), or a semiconductor medium (e.g., an SSD (Solid State Disk)).
[0135] If the stripe anomaly detection method is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0136] In the embodiments provided in the present application, it should be understood that the disclosed methods and devices can also be implemented in other ways. The device embodiments described above are merely illustrative. The functional modules in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0137] The above embodiments can be freely combined without conflict, and the embodiments obtained by the combination are included in the protection scope of this application.
[0138] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0139] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
Claims
1. A stripe anomaly detection method, characterized in that: include: Obtaining a first binary image corresponding to the image to be detected; Respectively calculating a first difference map and a second difference map of the first binary image; the first difference map includes pixel differences between all adjacent pixels in a first direction, and the second difference map includes pixel differences between all adjacent pixels in a second direction; the first direction is a pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction is perpendicular to the second direction; Extracting first stripe data in the first direction from the image to be detected based on the first difference map and the second difference map; The first stripe data includes pixel points of the image to be detected with abnormal stripes in the first direction; Calculating the ratio of the number of pixels representing stripe anomalies in the first stripe data to the number of all pixels in the image to be detected; If the ratio exceeds a preset threshold, it is determined that there is stripe abnormality in the image to be detected.
2. The stripe anomaly detection method according to claim 1, characterized in that: The step of obtaining a first binary image corresponding to the image to be detected includes: Obtaining a range of pixel values of abnormal stripe pixels in the image to be detected; Determine the binarization point based on the range of pixel values of the abnormal pixel points; Binarization processing is performed on each pixel in the image to be detected based on the binarization dividing point to obtain the first binarized image.
3. The stripe anomaly detection method according to claim 1, characterized in that: The step of respectively calculating a first difference map and a second difference map of the first binarized image comprises: Traversing all pixel points of the image to be detected along the first direction, and calculating pixel differences between all adjacent pixel points in the first direction to obtain the first difference map; All pixel points of the image to be detected are traversed along the second direction, and pixel differences between all adjacent pixel points in the second direction are calculated to obtain the second difference map.
4. The stripe anomaly detection method according to claim 1, characterized in that: The image to be detected is an image obtained by preprocessing an unprocessed original image, or the image to be detected is an unprocessed original image; Before calculating the ratio of the number of pixels included in the first stripe data to the number of all pixels in the image to be detected, the method further includes: Acquiring the resolution of a target image; the target image is one of the first binarized image and the image to be detected; The number of all pixels in the image to be detected is calculated based on the resolution of the target image.
5. The stripe anomaly detection method according to claim 1, characterized in that: Before obtaining the first binary image corresponding to the image to be detected, the method further includes: Perform image scaling on the image to be detected to adjust the image to be detected to a third preset size.
6. The stripe anomaly detection method according to claim 5, characterized in that: Before calculating the ratio of the number of pixels included in the first stripe data to the number of all pixels in the image to be detected, the method further includes: The number of all pixels in the image to be detected is calculated based on the third preset size.
7. The stripe anomaly detection method according to claim 1, characterized in that: Before comparing the ratio with a preset threshold, the method further includes: Obtain image accuracy requirements; The preset threshold is determined based on a third corresponding relationship between the image accuracy requirement, the preset image accuracy requirement and the detection threshold.
8. The stripe anomaly detection method according to claim 1, characterized in that: The image to be detected is an image obtained by preprocessing an unprocessed original image; After determining that the image to be detected has stripe anomalies, the method further includes: Acquire an original image corresponding to the image to be detected; Acquire a second binarized image corresponding to the original image; Calculate a first original image difference map in a first direction and a second original image difference map in a second direction of the second binarized image respectively; Extracting second stripe data in the first direction from the original image based on the first original image difference map and the second original image difference map; comparing the second stripe data with the first stripe data; If the similarity between the second stripe data and the first stripe data of the image to be detected is less than a preset similarity threshold, it is determined that an abnormality exists in the preprocessing.
9. The stripe anomaly detection method according to any one of claims 1 to 8, characterized in that: The extracting first stripe data of the image to be detected in the first direction based on the first difference map and the second difference map includes: The first fringe data is obtained by subtracting the first difference map from the second difference map.
10. The stripe anomaly detection method according to claim 9, characterized in that: The first stripe data includes first stripe sub-data, and before subtracting the first difference map from the second difference map, the method further includes: Performing dilation processing on the first difference map based on a convolution kernel of a first preset size to obtain a first difference map after dilation processing; The step of subtracting the first difference map from the second difference map comprises: Subtracting the first difference image after the dilation process from the second difference image to obtain the first stripe sub-data; The comparing the ratio of the number of pixels included in the stripe data to the number of all pixels in the image to be detected with a preset threshold value includes: The ratio of the number of pixel points characterizing the stripe anomaly in the first stripe sub-data to the number of all pixel points in the image to be detected is calculated.
11. The stripe anomaly detection method according to claim 10, characterized in that: Before the first difference map is expanded based on the convolution kernel of the first preset size, the method further includes: Obtain image accuracy requirements; The first preset size is determined based on a first corresponding relationship between the image accuracy requirement, the preset image accuracy requirement and the dilation processing convolution kernel size.
12. The stripe anomaly detection method according to claim 9, characterized in that: The first stripe data includes second stripe sub-data, and after the first stripe data is obtained by subtracting the first difference map from the second difference map, the method further includes: Performing corrosion processing on the first stripe data based on a convolution kernel of a second preset size to obtain second stripe sub-data; The comparing the ratio of the number of pixels included in the first stripe data to the number of all pixels in the image to be detected with a preset threshold value includes: The ratio of the number of pixel points representing the stripe anomaly in the second stripe sub-data to the number of all pixel points in the image to be detected is compared with the preset threshold.
13. The stripe anomaly detection method according to claim 12, characterized in that: Before the first stripe data is corroded by the convolution kernel based on the second preset size, the method further includes: Obtain image accuracy requirements; Based on the second corresponding relationship between the image accuracy requirement, the preset image accuracy requirement and the corrosion processing convolution kernel size, the second preset size is determined.
14. A stripe anomaly detection device, characterized in that: include: An image processing module, used for obtaining a first binary image corresponding to the image to be detected; A difference map calculation module, used to calculate a first difference map and a second difference map of the first binarized image respectively; the first difference map includes pixel differences between all adjacent pixels in a first direction, and the second difference map includes pixel differences between all adjacent pixels in a second direction; the first direction is a pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction is perpendicular to the second direction; A stripe extraction module, configured to extract first stripe data in the first direction from the image to be detected based on the first difference map and the second difference map; The first stripe data includes pixel points of the image to be detected with abnormal stripes in the first direction; An anomaly detection module, used to calculate the ratio of the number of pixel points representing the stripe anomaly in the first stripe data to the number of all pixel points in the image to be detected; The ratio is compared with a preset threshold value, and if the ratio exceeds the preset threshold value, it is determined that there is a stripe anomaly in the image to be detected.
15. An electronic device, characterized in that: It includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the stripe anomaly detection method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is run on a computer, the computer is enabled to execute the stripe anomaly detection method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Infrared image stripe noise processing method and device, medium and electronic equipment
CN112465707A
Image anomaly detection method and device, computer equipment and storage medium
CN114693946A
Code stream anomaly detection method and device and computer readable storage medium
CN114897766A
Method and apparatus for detecting streak defect of screen
JP2004219072A