A stripe anomaly detection method and device, electronic equipment and storage medium

CN119648612BActive Publication Date: 2026-08-18NANJING ILUVATAR COREX TECH CO LTD (DBA ILUVATAR COREX INC NANJING)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411427423.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2026-08-18
Estimated Expiration
2044-10-14

AI Technical Summary

Technical Problem

一些格式转换工具在对图像进行格式转换后,可能使得格式转换后的图像出现异常像素群,如马赛克、条纹,影响图像的使用

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648612B_ABST
    Figure CN119648612B_ABST
Patent Text Reader

Abstract

The application provides a stripe abnormality detection method and device, electronic equipment and storage medium, and relates to the field of image processing. The stripe abnormality detection method comprises the following steps: acquiring a first binarized image corresponding to a to-be-detected image; calculating a first difference value image and a second difference value image of the first binarized image respectively; the first direction is the pixel arrangement direction of the to-be-detected image when the to-be-detected image is generated; extracting first stripe data in the first direction in the to-be-detected image based on the first difference value image and the second difference value image; the first stripe data comprises pixel points of stripe abnormality of the to-be-detected image in the first direction; calculating the ratio of the number of pixel points representing stripe abnormality in the first stripe data to the number of all pixel points in the to-be-detected image; if the ratio exceeds a preset threshold value, it is determined that the to-be-detected image has stripe abnormality. The stripe abnormality detection method can improve the detection effect of stripe detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and more specifically, to a method, apparatus, electronic device, and storage medium for detecting stripe anomalies. Background Technology

[0002] Images come in various formats, and format conversion may be necessary for different scenarios. Some format conversion tools may cause abnormal pixel clusters, such as mosaics or stripes, in the converted image, affecting its usability.

[0003] In existing technologies, boundary detection and block detection are usually performed on the converted image. Such detection can effectively detect block-format mosaics, but it is not suitable for detecting non-block-format stripes, and the detection effect of stripes is poor. Summary of the Invention

[0004] In view of this, this application aims to provide a stripe anomaly detection method, apparatus, electronic device, and storage medium to improve the detection effect of abnormal stripes in images.

[0005] In a first aspect, embodiments of this application provide a stripe anomaly detection method, comprising: acquiring a first binarized image corresponding to an image to be detected; calculating 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 the pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction and the second direction are perpendicular; extracting first stripe data in the image to be detected in the first direction based on the first difference map and the second difference map; the first stripe data includes pixels in the image to be detected that exhibit stripe anomalies in the first direction; calculating the ratio of the number of pixels in the first stripe data that characterize stripe anomalies to the total number of pixels in the image to be detected; if the ratio exceeds a preset threshold, determining that the image to be detected exhibits stripe anomalies.

[0006] Image stripe anomalies are typically generated by arranging and saving the pixels of an image, with the stripe direction consistent with the pixel arrangement direction. In this embodiment, the first direction is the pixel arrangement direction of the image to be detected when generating the image to be detected, i.e., the direction of the stripes. The pixel values ​​of the pixels where stripe anomalies occur vary significantly. Therefore, in this embodiment, the binarized image corresponding to the image to be detected can be obtained for stripe detection. For normal images, the difference maps in different directions show unknown similar noise. For stripe pixels, they appear empty in the first direction and horizontal stripes in the second direction. Therefore, the first and second difference maps can be used to extract the pixels with stripe anomalies, and then it can be determined whether the pixels exceed a preset threshold representing the presence of image anomalies. If they exceed the threshold, a stripe anomaly is confirmed. Compared to boundary detection and block detection, the above method has a better detection effect on stripes, helping to improve the accuracy of stripe detection.

[0007] In one embodiment, obtaining the first binarized image corresponding to the image to be detected includes: obtaining the range of pixel values ​​of stripe abnormal pixels in the image to be detected; determining the boundary point of binarization based on the range of pixel values ​​of the abnormal pixels; and performing binarization processing on each pixel in the image to be detected based on the boundary point of binarization to obtain the first binarized image in different images.

[0008] Pixels with stripe anomalies typically have pixel values ​​within a certain range. If the existing method of distinguishing them using pixel values ​​of 128 is used, it may lead to incorrect detection of some stripe pixels. Therefore, in the embodiments of this application, the boundary point of binarization is determined by the color of the stripes in the image to be detected, so that the first binarized image can more accurately represent the pixels that may be stripes, thereby improving the detection accuracy of stripes.

[0009] In one embodiment, calculating the first difference map and the second difference map of the first binarized image includes: traversing all pixels of the image to be detected along the first direction and calculating the pixel difference between all adjacent pixels in the first direction to obtain the first difference map; traversing all pixels of the image to be detected along the second direction and calculating the pixel difference between all adjacent pixels in the second direction to obtain the second difference map.

[0010] In the embodiments of this application, if points with large pixel differences are extracted by subtracting the previous pixel from the subsequent pixel, these points with large differences will appear as stripes on the overall image. Therefore, the stripes can be determined using the pixel differences. By traversing all pixels, the number of pixels in the first difference map and the second difference map can be matched with the number of pixels in the first binarized image, reducing the possibility of abnormal detection results due to the stripe anomaly 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 total number of pixels in the image to be detected, the method further includes: obtaining the resolution of a target image; the target image is one of the first binarized image and the image to be detected; and calculating the total number of pixels in the image to be detected based on the resolution of the target image.

[0012] In this embodiment, the first binarized image is obtained by converting the image to be detected. The number of pixels in the image to be detected, the first binarized image, the first difference image, and the second difference image is the same. Therefore, the total number of pixels in the image can be calculated directly using the resolution of the image to be detected or the first binarized image. Compared to counting the number of pixels in the first stripe data, calculating the total number of pixels in the image to be detected using resolution is easier to implement and can improve the efficiency of determining the total number of pixels.

[0013] In one embodiment, before obtaining the first binarized image corresponding to the image to be detected, the method further includes: scaling the image to be detected to adjust the image to be detected to a third preset size.

[0014] In this embodiment, the image to be detected is scaled to a third preset size. Performing stripe detection on an image of the same size helps to reduce the complexity of stripe detection and improve its efficiency.

[0015] In one embodiment, before calculating the ratio of the number of pixels included in the first stripe data to the total number of pixels in the image to be detected, the method further includes: calculating the total number of pixels in the image to be detected based on the third preset size.

[0016] In this embodiment, 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 using the third preset size, without having to calculate the number of pixels for each stripe anomaly detection, thus improving the efficiency of 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 the image accuracy requirement, a third correspondence between the preset image accuracy requirement and the detection threshold.

[0018] In this embodiment, different image precision requirements can be set for different image precision needs, and then different preset thresholds can be set. This allows the stripe anomaly detection method to be applied to different scenarios, and can achieve stripe anomaly detection that meets the requirements of the current scenario in different scenarios, thus expanding the applicability of the stripe anomaly detection method.

[0019] In one embodiment, the image to be detected is an image obtained by preprocessing an unprocessed original image; after determining that the image to be detected has a stripe anomaly, the method further includes: acquiring the original image corresponding to the image to be detected; acquiring the second binarized image corresponding to the original image; calculating a first original image difference map and a second original image difference map in a second direction respectively for 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 threshold, then determining that the preprocessing has an anomaly.

[0020] In this embodiment, a second stripe image is extracted from the original image, 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 likely caused by preprocessing. Therefore, it is possible to determine whether the preprocessing process of converting the original image into the image to be detected is abnormal, and thus whether the preprocessing tools or methods are abnormal, which helps to investigate the cause of the stripes.

[0021] In one embodiment, extracting the 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: subtracting the first difference map from the second difference map to obtain the first stripe data.

[0022] In this embodiment, normal graphics appear as noise points with similar positions on the difference maps in different directions. That is, the same pixel has the same value on the first and second difference maps. However, pixels with stripe anomalies have different values ​​on the first and second difference maps. If the value of the same pixel in the second difference map minus the value in the first difference map is not 0, it indicates that the pixel has stripe anomalies. Therefore, pixels with stripe anomalies 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 achieving stripe detection, which is beneficial for reducing power consumption and improving detection efficiency.

[0023] In one embodiment, the first stripe data includes first stripe sub-data. 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 a dilated first difference map; subtracting the first difference map from the second difference map includes: subtracting the dilated first difference map 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 total number of pixels in the image to be detected with a preset threshold includes: calculating the ratio of the number of pixels representing stripe anomalies in the first stripe sub-data to the total number of pixels in the image to be detected.

[0024] In general, a normal image exhibits a distance difference of multiple pixels in the difference maps of the first and second directions. Dilation processing can enlarge bright or connected regions in an image, making the edges or shapes of objects more pronounced. In this embodiment, dilation processing is applied to the first difference map in the first direction, which can enlarge the pixels with stripe abnormalities in the first direction, reducing the impact of distance differences. This allows the second difference map to effectively remove pixels of normal graphics while retaining pixels with stripe abnormalities, thereby improving the accuracy of stripe detection.

[0025] In one embodiment, before dilating the first difference image using a convolution kernel of a first preset size, the method further includes: obtaining an image accuracy requirement; and determining the first preset size based on the image accuracy requirement, a first correspondence between the preset image accuracy requirement and the size of the dilated convolution kernel.

[0026] In this embodiment, the larger the size of the convolution kernel for dilation processing, the better the amplification effect on abnormal pixels. Therefore, when the second difference image is subtracted from the first difference image after dilation processing, it is easier to remove pixels of normal graphics. However, the larger the convolution kernel size, the higher the power consumption required. Therefore, the first preset size can be configured according to the image accuracy requirements to meet the accuracy and precision requirements of stripe anomaly detection in different scenarios while reducing excessive power consumption.

[0027] In one embodiment, the first stripe data includes second stripe sub-data. After subtracting the first difference map from the second difference map to obtain the first stripe data, the method further includes: performing erosion processing on the first stripe data based on a convolution kernel of a second preset size to obtain the second stripe sub-data; comparing the ratio of the number of pixels included in the first stripe data to the total number of pixels in the image to be detected with a preset threshold includes: comparing the ratio of the number of pixels representing stripe anomalies in the second stripe sub-data to the total number of pixels in the image to be detected with the preset threshold.

[0028] Erosion processing can shrink the boundary inward to separate different targets that are stuck together, and can remove small particle noise. In the embodiments of this application, by eroding the first stripe data, noise of normal patterns in the first stripe data can be further removed, thereby retaining the values ​​of abnormal pixels and further improving the accuracy of stripe anomaly detection.

[0029] In one embodiment, before performing erosion processing on the first stripe data using a convolution kernel of a second preset size, the method further includes: obtaining image accuracy requirements; and determining the second preset size based on the image accuracy requirements, a second correspondence between the preset image accuracy requirements and the size of the erosion processing convolution kernel.

[0030] In this embodiment, the size of the convolution kernel in the erosion process affects the effect of the erosion process in removing noise from normal graphics. By configuring the size of the convolution kernel in the erosion process according to the image accuracy requirements, the erosion process can improve the detection of stripe anomalies while reducing the excessive power consumption caused by the erosion process.

[0031] Secondly, embodiments of this application provide a stripe anomaly detection device, comprising: an image processing module for acquiring a first binarized image corresponding to an image to be detected; a difference map calculation module for calculating 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 the pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction and the second direction are perpendicular; a stripe extraction module for extracting first stripe data in the image to be detected in the first direction based on the first difference map and the second difference map; the first stripe data includes pixels in the image to be detected that exhibit stripe anomalies in the first direction; and an anomaly detection module for calculating the ratio of the number of pixels in the first stripe data that characterize stripe anomalies to the total number of pixels in the image to be detected; comparing the ratio with a preset threshold, and if the ratio exceeds the preset threshold, determining that the image to be detected exhibits stripe anomalies.

[0032] Thirdly, embodiments of this application provide an electronic device, including 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 performs the stripe anomaly detection method as described in any of the first aspects.

[0033] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the stripe anomaly detection method as described in any of the first aspects. Attached Figure Description

[0034] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 A flowchart illustrating a stripe anomaly detection method provided in one embodiment of this application; Figure 2 This is a first schematic diagram of first stripe data provided in an embodiment of this application; Figure 3 A second schematic diagram of first stripe data provided in an embodiment of this application; Figure 4This is a schematic diagram of the entire process of a stripe anomaly detection method provided in an embodiment of this application; Figure 5 This is a schematic diagram of a stripe anomaly detection device provided in an embodiment of this application; Figure 6 This is a schematic diagram of an electronic device provided in one embodiment of this application.

[0036] Icons: 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 Implementation

[0037] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0038] Please see Figure 1 , Figure 1 This application provides a flowchart of a stripe anomaly detection method according to an embodiment of the present application. The stripe anomaly detection method includes: S110, Obtain the first binarized image corresponding to the image to be detected.

[0039] In this embodiment of the application, the image to be detected can be an image of any format other than a binarized image. For example, the image to be detected can be in JPEG (Joint Photographic Experts Group, a standard for compression of continuous tone still images), RGB (Red Green Blue) image, YUV (Luminance Chrominance) image, HSV (Hue, Saturation, Value) image, etc., without limitation.

[0040] Currently, images of various formats can usually be converted to each other. In this embodiment, the image to be detected can be the original image without format conversion or the image obtained after format conversion.

[0041] In one embodiment of this application, obtaining a first binarized image corresponding to an image to be detected may include: obtaining a grayscale image of the image to be detected; performing binarization processing on the grayscale image to obtain a first binarized image; wherein, the binarization processing includes: adjusting the pixel values ​​of pixels with pixel values ​​greater than 128 in the image to be detected to 1, and adjusting the pixel values ​​of pixels with pixel values ​​less than 128 to 0. The method of converting the image to be detected into a grayscale image can refer to existing technologies. Other existing methods can also be used to obtain the binarized image, and no limitation is made here.

[0042] In one embodiment of this application, obtaining a first binarized image corresponding to an image to be detected may include: obtaining the range of pixel values ​​of stripe abnormal pixels in the image to be detected; determining the boundary point of binarization based on the range of pixel values ​​of the abnormal pixels; and performing binarization processing on each pixel in the image to be detected based on the boundary point to obtain the first binarized image in different images.

[0043] In different images to be detected that contain stripes, the pixel values ​​of the pixels corresponding to the stripes may be different. For example, in one image, the pixel values ​​of the stripe pixels are all less than 50, while in another image, the pixel values ​​of the stripe pixels are all less than 128. Therefore, if 128 is uniformly used as the dividing point for binarization, some non-stripe pixels may be identified as pixels with stripe anomalies. Therefore, in the embodiments of this application, the pixel values ​​of each pixel can be used to determine the dividing point for binarization.

[0044] In some embodiments of this application, the pixel values ​​of each pixel in the image to be detected can be obtained in advance, and the range of pixel values ​​of pixels with stripe anomalies can be counted. Based on the range of pixel values, a dividing point can be determined so that the dividing point can effectively distinguish pixels that are likely to be stripes, thereby correctly assigning values ​​to each pixel.

[0045] For example, in a certain scenario, the pixel value of the stripe abnormal pixel is a fixed black stripe less than 50. Then, 50 can be used as the dividing point for binarization. Pixels with a value less than 50 are adjusted to a pixel value of 0, and pixels with a value greater than 50 are adjusted to a pixel value of 1.

[0046] In some scenarios, the pixel difference between two adjacent pixels in the overall image will not exceed a preset value. If it exceeds the preset value, the subsequent pixel may be a striped pixel. Therefore, in the embodiments of this application, the dividing point can also be determined based on the pixel change of adjacent pixels.

[0047] For example, in the embodiments of this application, the binarization processing is not limited to values ​​of 0 and 1, but can also be other values, such as 0, 128, and 255, where 0 represents black, 128 represents gray, and 255 represents white. The pixel value ranges for black, gray, and white are set respectively. If the difference between two pixels in an image to be detected does not exceed 86, then a three-part processing can be performed: the value of pixels with a pixel value less than 86 is set to 0, the value of pixels with a pixel value in the range of 86 > x > 178 is changed to 128, and the value of pixels with a pixel value greater than 178 is changed to 255, thus obtaining a first binarized image including the three values ​​0, 128, and 256. If the pixel difference between two adjacent pixels exceeds 128, then the subsequent pixel is highly likely to be a striped pixel.

[0048] In the embodiments of this application, after obtaining the first binarized image corresponding to the image to be detected, the image to be detected can also be resized to adjust it to a third preset size. The image scaling method can refer to existing technologies, such as the resize function in some image processing tools, and will not be elaborated here.

[0049] In this embodiment, by scaling the image to be detected before detecting stripe anomalies, the image to be detected can be unified to a third preset size. Compared with stripe detection of images of different sizes, stripe detection of images of uniform size is less difficult, which helps to reduce the difficulty of stripe anomaly detection and improve the efficiency of stripe anomaly detection.

[0050] S120, calculate the first difference map and the second difference map of the first binarized image respectively.

[0051] In this embodiment, the first direction is the pixel arrangement direction of the image to be detected when generating the image to be detected.

[0052] Stripe anomalies are caused by abnormal pixel arrangement in an image. For example, some image conversion tools arrange pixels in a predetermined direction after converting the original image. However, problems with the image conversion tool can cause issues during this arrangement, resulting in abnormal pixel values ​​at various locations, such as a pixel value of 0 (appearing black). Multiple consecutive abnormal pixels form stripes. Therefore, the stripe reversal refers to the pixel arrangement direction of the image to be detected when generating the image to be detected. In the embodiments of this application, the stripe direction is also the first direction.

[0053] In this embodiment, the first direction and the second direction are perpendicular. For example, in a two-dimensional coordinate system, if the first direction is the x-axis direction, then the second direction is the y-axis direction. Conversely, if the first direction is the y-axis direction, then 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.

[0054] In this embodiment, the first difference map includes the pixel difference between all adjacent pixels in the first direction, and the second difference map includes the pixel difference between all adjacent pixels in the second direction.

[0055] In one embodiment of this application, calculating a first difference map and a second difference map of a first binarized image includes: traversing all pixels of the image to be detected along the first direction and calculating the pixel difference between all adjacent pixels along 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 difference between all adjacent pixels along the second direction to obtain the second difference map.

[0056] In this embodiment, in the same direction, the pixel value of the current pixel can be subtracted from the pixel value of the next pixel. For example, if the first direction is the x-axis direction, and the coordinates of the current pixel are (h, w), then the coordinates of the next pixel are (h, w+1), where h represents the height (corresponding to the y-axis direction) and w represents the width (corresponding to the x-axis direction). The pixel value of pixel (h, w+1) can be subtracted from the pixel value of pixel (h, w) to obtain the difference between two adjacent pixels. For each pixel in each row, the difference is calculated to obtain the difference of pixels in that row. The difference is then calculated for the second row, and so on, until all rows of pixels in 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 difference is calculated for pixels in the y-axis direction. The pixel value of pixel (h+1, w) is subtracted from the pixel value of pixel (h, w) to obtain the difference of pixel (h, w) in the y-axis direction. This process is repeated for all pixels to obtain the second difference map. Since the difference is calculated between pixels in the binarized image, the value of each pixel in the first difference image and the second difference image is either 1 or 0.

[0057] S130, extract first stripe data in a first direction from the image to be detected based on the first difference map and the second difference map.

[0058] In this embodiment, the stripe data includes pixels in the first image to be detected that have stripe anomalies in the first direction.

[0059] A normal graphic appears as noise points in close proximity in the first and second difference images of a binarized image. That is, the value of the same pixel in both the first and second difference images is either 1 or 0, and the difference between them is 0. Conversely, horizontal stripes appear as horizontal stripes along the y-axis (where the difference between adjacent pixels is 1) and as empty spaces along the x-axis (where the difference between adjacent pixels is 0). For horizontal stripes, the first direction is the x-axis, and the second direction is the y-axis. Since the values ​​of the same pixel in the first and second difference images are different, the difference between the value in the second difference image and the value in the first difference image is 1.

[0060] Therefore, in one embodiment of this application, extracting the first stripe data of the image to be detected in a first direction 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.

[0061] Since the first and second difference maps are obtained by processing the same first binarized image, each pixel in the first and second difference maps corresponds to each other. For example, pixel (h, w) in the first difference map corresponds to pixel (h, w) in the second difference map. In this embodiment, subtracting the first difference map from the second difference map can be done by subtracting the value of the same pixel in the first difference map from its value in the second difference map. For example, if pixel (h, w) has a value of 0 in the first difference map and a value of 1 in the second difference map, the difference between pixel (h, w) and the first difference map is 1, indicating that pixel (h, w) corresponds to a stripe anomaly.

[0062] Therefore, by subtracting the value of each pixel in the first difference map from the value of each pixel in the second difference map, the result can characterize whether the pixel is a pixel corresponding to the stripe anomaly. Accordingly, after subtracting each corresponding pixel in the second difference map from the first difference map, the first stripe data can be obtained. In the first stripe data, all pixels with a value of 1 are pixels with stripe anomalies.

[0063] In one embodiment of this 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 a dilated first difference map. Correspondingly, 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 first stripe data.

[0064] Dilation is mainly used to enlarge or highlight the boundaries of objects in an image. It is achieved by filling holes in the image, enlarging the size of objects, and connecting nearby objects. It can blend pixels into the background and expand outward, thereby merging broken objects and making it easier to extract them as a whole.

[0065] A normal graphic has a distance difference of several pixels in the x and y difference map coordinates. Therefore, by dilating the first difference map, some pixels with stripe anomalies can be enlarged. When subtracting the first difference map from the second difference map, the second difference map can better subtract the pixels of the normal graphic, 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.

[0066] The specific methods of dilation processing can be found in existing technologies and will not be elaborated here. In some embodiments, the convolution kernel may also be referred to as a dilation kernel, structuring 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 abnormal pixels, and correspondingly, it also has a certain impact on the detection efficiency of stripe anomalies.

[0067] Therefore, in one embodiment of this application, before dilating the first difference image based on a convolution kernel of a first preset size, an image accuracy requirement can be obtained; based on the image accuracy requirement, a first correspondence between the preset image accuracy requirement and the size of the dilation processing convolution kernel, the first preset size is determined.

[0068] In this embodiment, the image accuracy requirement in the first correspondence is directly proportional to the size of the dilated convolution kernel; the higher the image accuracy requirement, the larger the convolution kernel size. When there is no image accuracy requirement, the first preset size can be 2×2. However, when there is a higher image accuracy requirement, the first preset size can be increased according to the image accuracy requirement, for example, to 3×3, 4×4, or a larger size. This can be configured according to the actual scenario; the above is merely an example and is not intended to limit the scope.

[0069] The opposite of expansion is corrosion. Corrosion is the opposite of expansion and is used to eliminate connected boundaries, causing the boundaries to shrink inward to separate different targets that are stuck together, and can also remove small particle noise.

[0070] Therefore, in one embodiment of this application, after obtaining the first stripe data or the first stripe sub-data, the first stripe data can be eroded based on a convolution kernel of a second preset size to obtain the second stripe sub-data. The erosion process can be referred to the prior art and will not be elaborated here.

[0071] The first stripe data may include stripe data extracted from the difference map without dilation processing, or one of the first stripe sub-data or the second stripe sub-data. The second stripe sub-data is obtained by eroding the first stripe data. The first stripe data without erosion processing can be regarded as a coarsely extracted stripe data. Through erosion processing, noise of normal graphics in the first stripe data can be further removed, so that the pixel value of normal graphics becomes 0, thereby retaining the value of the pixel of stripe abnormality. This can improve the accuracy of stripe detection.

[0072] Similarly, in the embodiments of this application, before performing erosion processing on the first stripe data based on the convolution kernel of the second preset size, the image accuracy requirement can also be obtained; based on the image accuracy requirement, the second correspondence between the preset image accuracy requirement and the size of the erosion processing convolution kernel, the second preset size is determined.

[0073] Over-processing of the erosion process can eliminate noise, thereby eliminating abnormal pixels in the stripes. Therefore, in the embodiments of this application, the image accuracy requirement can be obtained, and the corresponding second preset size can be determined according to the image accuracy requirement. The second correspondence can be configured according to the actual scene to determine the specific correspondence between the size and the image accuracy requirement, which is not limited here.

[0074] In other embodiments of this application, the second preset size can also be determined based on the first preset size. For example, in one embodiment of this application, if the first preset size is a×a, then the second preset size can be (a-1)×(a+1).

[0075] Erosion and dilation have opposite effects. Using erosion to process the stripe data after dilation can, to some extent, eliminate the excessive number of abnormal pixels in the stripes caused by dilation, thereby improving the accuracy of stripe detection.

[0076] Please see Figure 2 and Figure 3 In the embodiments of this application, the grayscale image of the image to be detected is as follows: Figure 2 and Figure 3 As shown in the left image, after processing, the following can be extracted: Figure 2 and Figure 3 The first stripe data shown in the right figure uses a binarized image. Therefore, a value of 1 indicates an abnormal pixel point, which is represented as white, while a value of 0 indicates a normal pixel point, which is represented as black.

[0077] S140, calculate the ratio of the number of pixels representing stripe anomalies in the first stripe data to the total number of pixels in the image to be detected.

[0078] If there are too many abnormal pixels, it is highly likely that the image to be detected has an abnormal stripe pattern. Therefore, in the embodiments of this application, the number of pixels in the first stripe data that represent the abnormal stripe pattern can be calculated, and the total number of 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.

[0079] In this embodiment, the difference between the second difference map corresponding to the pixels included in the first stripe data and the first difference map is detailed. Here, 0 indicates that the pixel is normal and 1 indicates that the stripe is abnormal. Therefore, the number of pixels with a value of 1 in the first stripe data can be counted to obtain the number of pixels that represent stripe abnormality.

[0080] If the difference map is dilated or the first stripe is eroded during the detection process, the ratio of the number of pixels representing stripe anomalies in the first stripe sub-data to the total number of pixels in the image to be detected is calculated, or the ratio of the number of pixels representing stripe anomalies in the second stripe sub-data to the total number of pixels in the image to be detected is calculated.

[0081] In one embodiment of this application, the resolution of the target image can also be obtained, and the number of all pixels in the image to be detected can be calculated based on the resolution of the target image.

[0082] In this embodiment, the target image is one of a first binarized image and an image to be detected. The image to be detected can be the original image without preprocessing or the image after preprocessing. The first binarized image is obtained by converting the image to be detected; therefore, the number of pixels in the first binarized image and the image to be detected is the same.

[0083] Compared to counting all pixels in the first stripe data, directly calculating the number of all pixels in the image to be detected using resolution is easier to implement and more efficient. Existing techniques can be referenced for methods of calculating the number of pixels using resolution, which will not be elaborated upon here.

[0084] In some other embodiments of this application, if the image to be detected is scaled to a third preset size, 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.

[0085] In this embodiment, since all different images to be detected are scaled to a third preset size, the number of all pixels is calculated based on the third preset size, so there is no need to recalculate the number of images to be detected, which can improve the efficiency of image stripe anomaly detection.

[0086] In the embodiments of this application, if the first difference map is dilated and / or the first stripe data is eroded during the stripe detection process, then, correspondingly, the first preset size of the number of all pixels in the image to be detected after dilation and the second preset size of the number of pixels after erosion can be enlarged or reduced, so that the number of all pixels used to calculate the ratio matches the number of pixels in the first stripe data.

[0087] S150, if the ratio exceeds the preset threshold, it is determined that there is a stripe anomaly in the image to be detected.

[0088] In the embodiments of this application, the ratio is the proportion of stripe abnormal pixels. If the ratio is too large, it is highly likely that the image to be detected has stripe abnormalities. Therefore, it can be determined whether the ratio exceeds a preset threshold. If it exceeds the preset threshold, it is determined that the image to be detected has stripe abnormalities.

[0089] In the embodiments of this 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 image accuracy requirement, the third correspondence between the preset image accuracy requirement and the detection threshold, the preset threshold is determined.

[0090] In scenarios with lower precision requirements, a larger preset threshold can be configured, thus ignoring images with fewer abnormal stripe pixels and classifying them as normal. Conversely, in scenarios with higher precision requirements, such as industrial applications, a smaller preset threshold can be configured to classify images with fewer abnormal stripe pixels as having stripe anomalies.

[0091] The stripe anomaly in the image to be detected may be caused by an anomaly occurring during the conversion of the original image into the image to be detected, for example, by a malfunction in the conversion tool. In embodiments of this application, the stripe anomaly detection method can also be used to determine whether the conversion tool is malfunctioning.

[0092] In this embodiment, after determining that the image to be detected has a stripe anomaly, the method may further include: acquiring the original image corresponding to the image to be detected; acquiring the second binarized image corresponding to the original image; calculating the first original image difference map and the second original image difference map of the second binarized image respectively in the first direction and the second original image difference map in the second direction; extracting 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; 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, then determining that there is an anomaly in the preprocessing.

[0093] In this embodiment, since the detection is to check whether the preprocessing is normal, the original image is the image before preprocessing, the image to be detected is the image after preprocessing, and the original image is a test image that can be directly obtained. The second binarized image refers to the binarized image of the original image. The method of obtaining the second binarized image can refer to the aforementioned process of obtaining the first binarized image or refer to existing technology, and will not be elaborated here.

[0094] The second stripe data is the stripe data of the original image. Similarly, referring to the method described above for extracting the first stripe data of the image to be detected, the difference map in the first direction and the difference map in the second direction of the second binarized image of the original image can be calculated respectively. 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 first original difference map can be subtracted from the second original difference map to obtain the second stripe data of the original image.

[0095] In some embodiments, if the first difference map of the image to be detected has been dilated during the extraction of the first stripe data, then the first original difference map can be dilated accordingly, and the dilated first original difference map can be subtracted from the second original difference map. Similarly, if the first stripe data has been eroded, the second stripe data can also be eroded accordingly. This maintains consistency in the stripe data extraction process and improves the accuracy of the final judgment result.

[0096] If the preprocessing, such as format conversion, is error-free, the second stripe data and the first stripe data will have high similarity, or both will be free of stripe anomalies. Conversely, if the stripe anomalies are caused by the preprocessing, the number of pixels with stripe anomalies in the first stripe data will be much greater than the number of pixels with stripe anomalies in the second stripe data, resulting in lower similarity. Therefore, 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 anomaly in the preprocessing. The calculation of similarity can refer to existing technologies and will not be elaborated here.

[0097] In the embodiments of this application, the above-described stripe anomaly detection method can be configured into a video or image transcoding tool to perform stripe anomaly detection on the output of the transcoding tool and promptly determine whether the output video or image has stripe anomalies.

[0098] For ease of understanding, an example is provided here to illustrate the stripe anomaly detection method provided in this application.

[0099] In this example, the first direction is the x-axis, the second direction is the y-axis, and the type of stripe anomaly is horizontal stripes. Please refer to [link / reference]. Figure 4 , Figure 4This is a schematic diagram of the entire process of a stripe anomaly detection method provided in an embodiment of this application.

[0100] First, for the image to be detected, the image 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 binarized image.

[0101] Then, by using the first difference map and the second difference map of the first binarized image, it is possible to traverse all pixels of the first binarized image and subtract 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.

[0102] The process can further involve dilating the first difference image by a first preset size to amplify the noise in both the normal and abnormal images, thereby better removing noise from the normal image while retaining the noise from the stripe anomaly (i.e., setting the value of the pixels in the stripe anomaly to 1). Then, the first difference image after dilation is subtracted from the second difference image to obtain the first stripe sub-data. Finally, the first stripe sub-data is subjected to erosion processing by a second preset size to further remove noise from the normal image, resulting in the second stripe sub-data.

[0103] Finally, the ratio of the number of pixels representing stripe anomalies in the second stripe sub-data to the total number of pixels in the image to be detected is calculated, and the ratio is compared with a preset threshold to determine whether it exceeds the preset threshold. If it does, the image to be detected is determined to have stripe anomalies.

[0104] Based on the same inventive concept, embodiments of this application also provide a stripe anomaly detection device. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of a stripe anomaly detection device provided in one embodiment of this application. The stripe anomaly detection device 300 includes: an image processing module 310, a difference map calculation module 320, a stripe extraction module 330, and an anomaly detection module 340.

[0105] Image processing module 310 is used to acquire the first binarized image corresponding to the image to be detected.

[0106] The difference map calculation module 320 is used to calculate a first difference map and a second difference map of the first binarized image respectively; the first difference map includes the pixel difference between all adjacent pixels in a first direction, and the second difference map includes the pixel difference between all adjacent pixels in a second direction; the first direction is the pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction and the second direction are perpendicular; The 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 pixels in the image to be detected that have stripe anomalies in the first direction. The anomaly detection module 340 is used to calculate the ratio of the number of pixels representing stripe anomalies in the first stripe data to the total number of 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 stripe anomalies.

[0107] The difference map calculation module 320 is used to traverse all pixels of the image to be detected along the first direction and calculate the pixel difference between all adjacent pixels in the first direction to obtain the first difference map; and to traverse all pixels of the image to be detected along the second direction and calculate the pixel difference between all adjacent pixels in the second direction to obtain the second difference map.

[0108] An 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; the number of all pixels in the image to be detected is calculated based on the resolution of the target image.

[0109] The image processing module 310 is used to scale the image to be detected to adjust it to a third preset size.

[0110] 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.

[0111] The anomaly detection module 340 is also used to obtain image accuracy requirements; and to determine the preset threshold based on the image accuracy requirements, the third correspondence between the preset image accuracy requirements and the detection threshold.

[0112] The anomaly detection module 340 is further configured to: acquire the original image corresponding to the image to be detected; acquire the second binarized image corresponding to the original image; calculate the first original image difference map and the second original image difference map in the second binarized image respectively in the first direction and the second original image difference map in the second direction; extract the second stripe data in the first direction in 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, then determine that there is an anomaly in the preprocessing.

[0113] The stripe extraction module 330 is used to subtract the first difference map from the second difference map to obtain the first stripe data.

[0114] The stripe extraction module 330 is further configured to dilate the first difference map using a convolution kernel of a first preset size to obtain a dilated first difference map; and to subtract the dilated first difference map from the second difference map to obtain the first stripe sub-data. The anomaly detection module is further configured to calculate the ratio of the number of pixels representing stripe anomalies in the first stripe sub-data to the total number of pixels in the image to be detected.

[0115] The stripe extraction module 330 is also used to obtain the image accuracy requirement; and to determine the first preset size based on the image accuracy requirement, the first correspondence between the preset image accuracy requirement and the size of the dilated convolution kernel.

[0116] The stripe extraction module 330 is further configured to perform erosion 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 further configured to compare the ratio of the number of pixels representing stripe anomalies in the second stripe sub-data to the total number of pixels in the image to be detected with the preset threshold.

[0117] The stripe extraction module 330 is also used to obtain the image accuracy requirements; and to determine the second preset size based on the image accuracy requirements, the second correspondence between the preset image accuracy requirements and the size of the erosion processing convolution kernel.

[0118] The function of the stripe anomaly detection device 300 is the same as that of the stripe anomaly detection method described above. For details, please refer to the content of the stripe anomaly detection method described above, which will not be elaborated here.

[0119] Based on the same inventive concept, this application also provides an electronic device. Please refer to... Figure 6 , Figure 6 This application also provides a schematic diagram of an electronic device 400, which can serve as the execution subject of the aforementioned stripe anomaly detection method, including: a processor 410 and a memory 420, wherein the processor 410 and the memory 420 are communicatively connected.

[0120] The memory 420 stores computer-readable instructions that can be executed by the processor 410, enabling the processor 410 to perform the stripe anomaly detection method in the foregoing embodiments.

[0121] The processor 410 and memory 420 are connected, but are not limited to, via a communication bus.

[0122] Processor 410 can be an integrated circuit chip with signal processing capabilities. Processor 410 can be a general-purpose processor, including a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a digital signal processor, application-specific integrated circuit, off-the-shelf programmable gate array, or other programmable logic device or transistor logic device, or discrete hardware component. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.

[0123] 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.

[0124] It is understood that the electronic device 400 may also include more general modules required by itself, which will not be described one by one in the embodiments of this application.

[0125] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when run on a computer, causes the computer to execute the stripe anomaly detection method provided in the above embodiments.

[0126] The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs (digital video discs)), or semiconductor media (e.g., SSDs (solid state disks)).

[0127] If the stripe anomaly detection method is implemented as a software functional 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 this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, external hard drives, ROM, RAM, magnetic disks, or optical disks.

[0128] In the embodiments provided in this application, it should be understood that the disclosed methods and apparatus can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. The functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0129] The above embodiments can be freely combined without conflict, and the resulting embodiments are covered within the protection scope of this application.

[0130] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0131] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for detecting stripe anomalies, characterized in that, include: Obtain the first binarized image corresponding to the image to be detected; Calculate a first difference map and a second difference map of the first binarized image respectively; the first difference map includes the pixel difference between all adjacent pixels in a first direction, and the second difference map includes the pixel difference between all adjacent pixels in a second direction; the first direction is the pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction and the second direction are perpendicular; Based on the first difference map and the second difference map, the first stripe data in the first direction is extracted from the image to be detected; The first stripe data includes pixels in the image to be detected that have stripe anomalies in the first direction; Calculate the ratio of the number of pixels representing stripe anomalies in the first stripe data to the total number of pixels in the image to be detected; If the ratio exceeds a preset threshold, it is determined that the image to be detected has stripe anomalies; The step of extracting the 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: subtracting the first difference map from the second difference map to obtain the first stripe data; The first stripe data includes first stripe sub-data. 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 a dilated first difference map; subtracting the first difference map from the second difference map includes: subtracting the dilated first difference map 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 total number of pixels in the image to be detected with a preset threshold includes: calculating the ratio of the number of pixels representing stripe anomalies in the first stripe sub-data to the total number of pixels in the image to be detected.

2. The stripe anomaly detection method according to claim 1, characterized in that, The step of obtaining the first binarized image corresponding to the image to be detected includes: Obtain the range of pixel values ​​of the stripe anomaly pixels in the image to be detected; The binarization boundary point is determined based on the range of pixel values ​​of the abnormal pixels. Based on the binarization boundary points, each pixel in the image to be detected is binarized to obtain the first binarized image.

3. The stripe anomaly detection method according to claim 1, characterized in that, The step of calculating the first difference map and the second difference map of the first binarized image respectively includes: Traverse all pixels of the image to be detected along the first direction and calculate the pixel difference between all adjacent pixels along the first direction to obtain the first difference map; Traverse all pixels of the image to be detected along the second direction and calculate the pixel difference between all adjacent pixels along the second direction 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 total number of pixels in the image to be detected, the method further includes: Obtain the resolution of the 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 binarized image corresponding to the image to be detected, the method further includes: The image to be detected is scaled to adjust it 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 total number of 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: Image accuracy requirements; The preset threshold is determined based on the image accuracy requirement, the third correspondence between 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 the image obtained after preprocessing the original, unprocessed image; After determining that the image to be detected has stripe anomalies, the method further includes: Obtain the original image corresponding to the image to be detected; Obtain the second binarized image corresponding to the original image; Calculate the difference map of the first original image in the first direction and the difference map of the second original image in the second direction for the second binarized image; Based on the first original image difference map and the second original image difference map, the second stripe data in the first direction is extracted from the original image; 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, then it is determined that there is an anomaly in the preprocessing.

9. The stripe anomaly detection method according to claim 1, characterized in that, Before performing dilation processing on the first difference map using a convolution kernel of a first preset size, the method further includes: Image accuracy requirements; Based on the image accuracy requirement, the first correspondence between the preset image accuracy requirement and the dilated convolution kernel size, the first preset size is determined.

10. The stripe anomaly detection method according to claim 1, characterized in that, The first stripe data includes second stripe sub-data. After subtracting the first difference map from the second difference map to obtain the first stripe data, the method further includes: The first stripe data is eroded based on a convolution kernel of a second preset size to obtain the second stripe sub-data; The step of comparing the ratio of the number of pixels included in the first stripe data to the total number of pixels in the image to be detected with a preset threshold includes: The ratio of the number of pixels representing stripe anomalies in the second stripe sub-data to the total number of pixels in the image to be detected is compared with the preset threshold.

11. The stripe anomaly detection method according to claim 10, characterized in that, Before the first stripe data is eroded using a convolution kernel of a second preset size, the method further includes: Image accuracy requirements; Based on the image accuracy requirement, the second correspondence between the preset image accuracy requirement and the erosion processing convolution kernel size, the second preset size is determined.

12. A stripe anomaly detection device, characterized in that, include: The image processing module is used to obtain the first binarized image corresponding to the image to be detected; The difference map calculation module is used to calculate a first difference map and a second difference map of the first binarized image respectively; the first difference map includes the pixel difference between all adjacent pixels in a first direction, and the second difference map includes the pixel difference between all adjacent pixels in a second direction; the first direction is the pixel arrangement direction of the image to be detected when generating the image to be detected, and the first direction and the second direction are perpendicular; A stripe extraction module 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 pixels in the image to be detected that have stripe anomalies in the first direction; An anomaly detection module is used to calculate the ratio of the number of pixels representing stripe anomalies in the first stripe data to the total number of pixels in the image to be detected. The ratio is compared with a preset threshold. If the ratio exceeds the preset threshold, it is determined that the image to be detected has stripe anomalies. The stripe extraction module is used to subtract the first difference map from the second difference map to obtain the first stripe data; The stripe extraction module is further configured to dilate the first difference map based on a convolution kernel of a first preset size to obtain a first difference map after dilation; subtract the first difference map after dilation from the second difference map to obtain first stripe sub-data; the anomaly detection module is further configured to calculate the ratio of the number of pixels representing stripe anomalies in the first stripe sub-data to the total number of pixels in the image to be detected.

13. An electronic device, characterized in that, The device includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, cause the processor to perform the stripe anomaly detection method as described in any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, The readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the stripe anomaly detection method as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Infrared image stripe noise processing method and device, medium and electronic equipment

    CN112465707A

  • Code stream anomaly detection method and device and computer readable storage medium

    CN114897766A