Image detection method and device, storage medium and electronic equipment

By generating multiple periodic sizes to detect images with periodic features, and determining the common preset features as defect features, the problem of difficult to distinguish between real defects and false detection in the prior art is solved, and efficient defect identification and reduction of false detection rates are achieved.

CN119624849APending Publication Date: 2025-03-14SKYVERSE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311149853.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-06
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The prior art is difficult to effectively distinguish between true defects and false detection in images with periodic characteristics, and the false detection rate is high.

Method used

By acquiring an image with periodic features, at least two periodic sizes are generated using periodic features, and the image is detected by detecting preset features according to each periodic size to obtain a feature marking diagram. Then, preset features common to each feature marker graph are obtained and determined as defective features of the image.

Benefits of technology

Effective identification of real defects in images with periodic characteristics is achieved, the error detection rate is reduced, and the defect detection rate is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119624849A_ABST
    Figure CN119624849A_ABST
Patent Text Reader

Abstract

The invention provides an image detection method and device, a storage medium and electronic equipment, and the method comprises the steps: obtaining a to-be-detected image which has a periodic feature; generating at least two periodic dimensions by using the periodic features, wherein the periodic dimensions are integer multiples of the pixel width of the periodic features; performing preset feature detection on the to-be-detected image according to each period size to obtain a corresponding feature mark graph; and obtaining a common preset feature in each feature mark graph, and determining the common preset feature as a defect feature of the to-be-detected image. In the embodiment of the invention, the periodic features of the to-be-detected image are taken as the reference, at least two periodic sizes are generated, and the defect features of the to-be-detected image are screened according to each periodic size, so that not only can the real defect of the to-be-detected image be effectively determined, but also the purposes of controlling the false detection number and reducing the false detection rate can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual detection technology, and in particular to an image detection method and device, a storage medium, and an electronic device. Background Art

[0002] In the field of visual inspection, defect detection on images with periodic features is a common inspection scenario. Because defects are often mixed with the background, it is difficult to distinguish them effectively through effective image processing technology. Therefore, there are two main requirements for defect detection in images with periodic features: one is to detect real defects, and the other is to control the number of false detections.

[0003] Therefore, there is an urgent need for an image defect detection solution that can meet the above two requirements. Summary of the invention

[0004] In view of this, the embodiments of the present invention provide an image detection method and device, a storage medium, and an electronic device to achieve the purpose of detecting real defects and reducing the false detection rate when detecting images with periodic characteristics.

[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0006] A first aspect of an embodiment of the present invention discloses an image detection method, the method comprising:

[0007] Acquire an image to be detected, wherein the image to be detected has a periodic feature;

[0008] Generating at least two periodic sizes using the periodic feature, the periodic size being an integer multiple of a pixel width of the periodic feature;

[0009] Detecting preset features of the image to be detected according to each period size to obtain a corresponding feature marking map;

[0010] The common preset features in each of the feature mark images are obtained, and the common preset features are determined as defect features of the image to be detected.

[0011] Preferably, the periodic feature of the image to be detected includes a plurality of evenly arranged stripes, and the number of pixel rows between two adjacent stripes is configured as the pixel width of the periodic feature.

[0012] Preferably, the step of generating at least two periodic sizes using the periodic feature comprises:

[0013] Expanding the pixel width of the periodic feature by N times to obtain a first period size; and expanding the first period size by M times to obtain a second period size;

[0014] Wherein, the values ​​of N and M are positive integers.

[0015] Preferably, the preset features of the image to be detected are detected respectively according to each period size to obtain a corresponding feature marking map, including:

[0016] Acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a first period size around the target pixel point;

[0017] Calculating the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of the plurality of comparison pixels;

[0018] Compare the variance or mean with a corresponding threshold, and when the variance or mean exceeds the corresponding threshold, mark the target pixel as an abnormal point;

[0019] The image to be detected is traversed and one or more abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the first periodic size.

[0020] Preferably, the image to be detected is detected for preset features according to each period size to obtain a corresponding feature marking map, including:

[0021] Acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a second period size around the target pixel point;

[0022] Calculating the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of the plurality of comparison pixels;

[0023] Compare the variance or mean with a corresponding threshold, and when the variance or mean exceeds the corresponding threshold, mark the target pixel as an abnormal point;

[0024] The image to be detected is traversed and a plurality of marked abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the second periodic size.

[0025] Preferably, it also includes:

[0026] In the feature marking map, a marking frame is set for each preset feature, and the marking frame is configured as a rectangular frame of n×n pixels and takes the preset feature in the frame as the center of the rectangle, wherein the value of n is a positive integer less than 100.

[0027] Preferably, obtaining the common preset features in each of the feature mark images, and determining the common preset features as the defect features of the image to be detected, includes:

[0028] Obtaining the marking positions of the preset features in each of the feature marking images, and taking the preset features with the same marking positions as the common preset features;

[0029] The common preset features are used as defect features of the image to be tested.

[0030] A second aspect of an embodiment of the present invention discloses an image detection device, the device comprising:

[0031] An acquisition module, used for acquiring an image to be detected, wherein the image to be detected has a periodic feature;

[0032] A generating module, used for generating at least two periodic sizes by using the periodic feature, wherein the pair of periodic sizes is an integer multiple of the pixel width of the periodic feature;

[0033] A detection module, used to detect preset features of the image to be detected according to each period size, and obtain a corresponding feature marking map;

[0034] The determination module is used to obtain the common preset features in each of the feature mark images, and determine the common preset features as the defect features of the image to be detected.

[0035] Preferably, the generating module is specifically used for:

[0036] The pixel width of the periodic feature is expanded N times to obtain a first period size; and the first period size is expanded M times to obtain a second period size; wherein the values ​​of N and M are positive integers.

[0037] Preferably, the detection module specifically includes:

[0038] A first acquisition unit is used to acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a first period size around the target pixel point;

[0039] A first comparison unit, configured to calculate a variance or a mean between a grayscale value of the target pixel and grayscale values ​​of a plurality of comparison pixels, and compare the variance or the mean with a corresponding threshold;

[0040] A first marking unit is used to mark the target pixel as an abnormal point when the variance or mean exceeds a corresponding threshold; traverse the image to be detected and use one or more abnormal points to form a preset feature, mark each preset feature to obtain a feature marking map corresponding to the first periodic size;

[0041] And / or, the detection module specifically includes:

[0042] A second acquisition unit is used to acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a second period size around the target pixel point;

[0043] A second comparison unit is used to calculate the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of the plurality of comparison pixels; and compare the variance or mean with a corresponding threshold;

[0044] The second marking unit is used to mark the target pixel as a preset feature when the variance or mean exceeds the corresponding threshold; traverse the image to be detected and use one or more abnormal points to form preset features, mark each preset feature to obtain a feature marking map corresponding to the second periodic size.

[0045] Preferably, the device further comprises:

[0046] The third marking unit is used to set a marking frame for each preset feature in the feature marking map; the marking frame is configured as a rectangular frame of n×n pixels and takes the preset feature in the frame as the center of the rectangle, wherein the value of n is a positive integer less than 100.

[0047] Preferably, the determining module is specifically used to:

[0048] The marking positions of the preset features in each of the feature marking images are obtained, and the preset features with consistent marking positions are used as common preset features; and the common preset features are used as defect features of the image to be tested.

[0049] A third aspect of an embodiment of the present invention discloses a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed by a processor, the image detection method disclosed in the first aspect of the embodiment of the present invention is executed.

[0050] A fourth aspect of an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory and a bus; the processor and the memory are connected via the bus;

[0051] The memory is used to store programs, and the processor is used to run programs, wherein the program, when run by the processor, executes the image detection method disclosed in the first aspect of the embodiment of the present invention.

[0052] Based on the above-mentioned embodiment of the present invention, a periodic image detection method and device are provided. The method obtains an image to be detected, and the image to be detected has periodic characteristics; uses the periodic characteristics to generate at least two periodic sizes, and the periodic sizes are integer multiples of the pixel width of the periodic characteristics; detects the preset features of the image to be detected according to each periodic size, and obtains a corresponding feature marking map; obtains the common preset features in each of the feature marking maps, and determines the common preset features as the defect features of the image to be detected. In the embodiment of the present invention, by taking the periodic characteristics of the image to be detected as a reference, generating at least two periodic sizes, and screening the defect features of the image to be detected according to each periodic size, not only can the real defects of the image to be detected be effectively determined, but also the number of false detections can be controlled and the purpose of reducing the false detection rate can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0054] Figure 1 A schematic diagram of a flow chart of an image detection method disclosed in an embodiment of the present invention;

[0055] Figure 2 A schematic diagram of a flow chart of another image detection method disclosed in an embodiment of the present invention;

[0056] Figure 3 The image to be detected disclosed in the embodiment of the present invention;

[0057] Figure 4 A first characteristic marking diagram disclosed in an embodiment of the present invention;

[0058] Figure 5 A second characteristic marking diagram disclosed in an embodiment of the present invention;

[0059] Figure 6 The intersection graph disclosed in the embodiment of the present invention;

[0060] Figure 7 The present invention is a schematic diagram of the structure of an image detection device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0061] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0062] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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 "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0063] As can be seen from the background technology, there are two main requirements for defect detection of images with periodic features. One is to detect real defects, and the other is to control the number of false detections. Therefore, an embodiment of the present invention discloses an image detection method and device, which generates at least two periodic sizes based on the periodic features of the image to be detected, and screens the defect features of the image to be detected according to each periodic size. In the embodiment of the present invention, multiple periodic sizes are used to detect the image to be detected, and the common preset features are used as defect features, so that the real defects of the image to be detected can be effectively determined, and the real defect detection rate can be improved while controlling the number of false detections and reducing the false detection rate.

[0064] like Figure 1 FIG. 1 is a flow chart of a periodic image detection method disclosed in an embodiment of the present invention, which mainly includes the following steps:

[0065] S101: Acquire an image to be detected.

[0066] In S101, the image to be detected has a periodic feature.

[0067] Specifically, an image with periodic characteristics refers to an image with a repetitive pattern. The pattern of the image is repetitive in the horizontal direction, the vertical direction, or a combination of the two directions, and can be repeated by translation.

[0068] In a specific implementation, the image with periodic characteristics may be one-dimensional, such as a sine wave or a pulse sequence; or two-dimensional, such as a checkerboard or a periodic texture.

[0069] In one embodiment of the present invention, the image to be detected has a plurality of stripes arranged evenly, and the number of pixel rows between two adjacent stripes is configured as the pixel width of the periodic feature of the image to be detected. Usually, the number of pixel rows is more than 5 rows.

[0070] S102: Generate at least two periodic dimensions using periodic features.

[0071] In S102 , the period size is an integer multiple of the pixel width of the periodic feature.

[0072] It should be noted that the number of periodic sizes is not limited in the embodiment of the present invention, and is preferably 2, and may also be 3, 4, etc.

[0073] In the specific process of executing S102, taking the periodic features of the image to be detected as a reference, a plurality of integer multiples of the pixel widths of the periodic features can be obtained as needed to generate a periodic size including different integer multiples of the pixel widths of the periodic features.

[0074] For example, if the pixel width of the periodic feature of the image to be detected is 5, periodic sizes of 2 and 4 times the pixel width are generated as needed, a periodic size A including a 2×5 pixel width, and a periodic size including a 4×5 pixel width are generated.

[0075] In one embodiment of the present invention, the integer multiple may be 1, 2, 3, ..., N. N is a positive integer greater than 1. However, it should be noted that the generated period size N*a shall not exceed the image size of the image to be detected, and a refers to the pixel width of the periodic feature of the image to be detected.

[0076] In one embodiment of the present invention, the process of generating at least two periodic sizes using periodic features includes:

[0077] The pixel width of the periodic feature is expanded N times to obtain a first period size; and the first period size is expanded M times to obtain a second period size; wherein the values ​​of N and M are positive integers. For example, if the pixel width of the periodic feature of the image to be detected is 5 pixels, the first period size can be set to 10 pixels, and the second period size can be set to 30 pixels.

[0078] S103: Detect preset features of the image to be detected according to each periodic size to obtain a corresponding feature marking map.

[0079] In the specific process of executing S103, the image to be detected can be compared with multiple period sizes based on an image detection algorithm to detect preset features and obtain a feature marking image marking the preset features. The image detection algorithm can be a template matching algorithm, a cycle to cycle algorithm or a neighborhood grayscale comparison algorithm.

[0080] In one embodiment of the present invention, a neighborhood grayscale comparison algorithm is used to detect and obtain a feature mark map, and then the preset features of the image to be detected are detected according to each period size to obtain a corresponding feature mark map, which specifically includes:

[0081] First, a target pixel of the image to be detected and a plurality of comparison pixels within each period size around the target pixel are obtained.

[0082] It should be noted that the target pixel points of the image to be detected can be obtained as required. Preferably, all pixels in the image to be detected are used as target pixel points one by one. Of course, a certain number of pixels can also be selected at intervals or arbitrarily as target pixel points one by one. The specific number of pixels is not specifically limited in the present invention, and the number of pixels to be detected can be determined by technicians according to the size of the image to be detected.

[0083] According to the determined target pixel point, multiple comparison pixel points within each period size around it are calculated.

[0084] For example, if the period size is 1 pixel, there are 3 contrasting pixels around the target pixel at the top corner of the image; there are 5 contrasting pixels around the target pixel at the edge of the image; there are 8 contrasting pixels around the target pixel in the middle of the image. For another example, if the period size is 2 pixels, there are 24 contrasting pixels around the target pixel in the middle of the image.

[0085] Secondly, for each period size, the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of multiple comparison pixels is calculated.

[0086] Secondly, the calculated variance or mean is compared with the corresponding threshold. When the calculated variance or mean exceeds the corresponding threshold, the target pixel is marked as an outlier.

[0087] Finally, the image to be detected is traversed and one or more abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the current period size.

[0088] It should be noted that for each periodic size, the variance or mean between the grayscale values ​​of all contrasting pixels in the current periodic size and the grayscale values ​​of the target pixel is calculated, and the calculated variance or mean is compared with the threshold. If both exceed the threshold, the target pixel in the image to be detected is marked as an abnormal point. Finally, the image to be detected is traversed, and one or more abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the current periodic size.

[0089] In another embodiment of the present invention, the preset features of the image to be detected are detected according to each period size to obtain a corresponding feature marking map, which specifically includes:

[0090] First, a target pixel of the image to be detected and a plurality of comparison pixels within each period size around the target pixel are obtained.

[0091] It should be noted that the pixels to be detected of the image to be detected can be obtained as required. Preferably, all pixels in the image to be detected can be used as target pixels one by one, or a certain number of pixels can be selected at intervals or arbitrarily as target pixels one by one. The specific numerical value of the pixel is not specifically limited in the present invention, and the number of pixels to be detected can be determined by the technician according to the size of the image to be detected.

[0092] Secondly, for each period size, the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of multiple comparison pixels is calculated. In other words, the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of all comparison pixels within the current period size is calculated.

[0093] Secondly, the calculated variance or mean is compared with the corresponding threshold value, and when the calculated variance or mean exceeds the corresponding threshold value, the target pixel point is marked as an abnormal point.

[0094] Secondly, the detection image is traversed and one or more abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the current period size.

[0095] Finally, in order to accurately display each preset feature in the feature marking map, a marking frame is set for each preset feature in the feature marking map, and the marking frame is configured as a rectangular frame of n×n pixels, and the preset feature is used as the center of the rectangle. Among them, the value of n is a positive integer less than 100.

[0096] That is, the preset feature can be used as the center of the rectangle, and a rectangular frame of n×n pixels can be marked to obtain a feature marking image in which the preset feature is marked by the rectangular frame. Preferably, the value of n can be 50 or 30.

[0097] In one embodiment of the present invention, for each periodic size, the variance or mean between the grayscale values ​​of all contrasting pixels in the current periodic size and the grayscale value of the target pixel can be calculated, and the calculated variance or mean can be compared with the threshold. If both exceed the threshold, the target pixel is marked as an abnormal point. Then, the image to be detected is traversed, and one or more abnormal points are used to form a preset feature, and then the preset feature is used as the center of the rectangle to obtain a rectangular frame of n×n pixels. Finally, a feature marking map with a rectangular frame marking the preset feature is obtained.

[0098] S104: Acquire common preset features in each feature mark map, and determine the common preset features as defect features of the image to be detected.

[0099] In S104, the common preset features refer to the preset features with the same marking position in each feature marking map.

[0100] In the specific process of executing S104, the multiple feature mark images obtained by executing S103 are compared to obtain the common preset features in the multiple feature mark images, and the common preset features are determined to be the defect features of the image to be detected. That is, the common preset features are the real defects of the image to be detected, and other non-common defect features are false defects on the image to be detected.

[0101] In one embodiment of the present invention, the common preset features in each of the feature mark images are obtained, and the common preset features are determined as defect features of the image to be detected. The specific process includes:

[0102] First, the marking positions of the preset features in each of the feature marking images are obtained, and the preset features with the same marking positions are taken as the common preset features.

[0103] Then, the common preset features are used as defect features of the image to be tested.

[0104] In the image detection method provided in the embodiment of the present invention, at least two periodic sizes are generated based on the periodic features of the image to be detected, and the defect features of the image to be detected are screened according to each periodic size. In the embodiment of the present invention, multiple periodic sizes are used to detect the image to be detected, and the common preset features are used as defect features, which can not only effectively determine the real defects of the image to be detected, but also control the number of false detections and reduce the false detection rate.

[0105] like Figure 2 As shown, the embodiment of the present invention also discloses another periodic image detection method, which mainly includes the following steps:

[0106] S201: Acquire an image to be detected and periodic features of the image to be detected.

[0107] It should be noted that the specific implementation process and principle of S201 are the same as Figure 1 The S101 shown is the same and will not be described again here.

[0108] like Figure 3 The image to be detected disclosed in the embodiment of the present invention is shown in FIG. The gray lines are periodic features.

[0109] S202: Expand the pixel width of the periodic feature by N times to obtain a first periodic size.

[0110] In S202, the first cycle size is N. N is a positive integer. If N is 2, then the first cycle size is 2.

[0111] S203: Expand the first period size M times to obtain a second period size.

[0112] In S203, the second period size is M×N. N and M are positive integers. If N is 2 and M is 3, then the second period size is 3×2=6.

[0113] S204: Detect preset features of the image to be detected according to the first periodic size and the second periodic size respectively to obtain a corresponding feature marking map.

[0114] Specifically, the preset features of the image to be detected are detected respectively according to the first period size to obtain a corresponding feature marking map, including:

[0115] Obtain the target pixel of the image to be detected and multiple contrasting pixels within the first period size around the target pixel. Secondly, calculate the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of multiple contrasting pixels. Secondly, compare the calculated variance or mean with the corresponding threshold value, and when the calculated variance or mean exceeds the corresponding threshold value, mark the target pixel as an abnormal point. Traverse the image to be detected and use one or more abnormal points to form preset features, mark each preset feature to obtain a feature marking map corresponding to the first period size.

[0116] Specifically, the preset features of the image to be detected are detected respectively according to the second period size to obtain a corresponding feature marking map, including:

[0117] The target pixel of the image to be detected and multiple contrasting pixels within a second periodic size around the target pixel are obtained; the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of multiple contrasting pixels is calculated; the calculated variance or mean is compared with the corresponding threshold value, and when the calculated variance or mean exceeds the corresponding threshold value, the target pixel is marked as an abnormal point; the image to be detected is traversed and one or more abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the second periodic size.

[0118] In the process of executing S204, the above Figure 1 The two methods shown in S103 are: one is marking the preset feature, and the other is marking the rectangular frame containing the preset feature. The specific marking process can be found in the above S103. No further description will be given here.

[0119] In one embodiment of the present invention, based on Figure 3 The image to be detected shown in the figure can be obtained by using a rectangular frame. Figure 4 and Figure 5 The characteristic marking diagram shown.

[0120] Among them, Figure 4 As shown in FIG. 1 , it is the first characteristic mark diagram disclosed in the embodiment of the present invention. Figure 5 As shown, it is the second characteristic marking diagram disclosed in the embodiment of the present invention.

[0121] S205: Acquire a rectangular frame common to the first feature mark image and the second feature mark image, and determine that a preset feature contained in the common rectangular frame is a defect feature of the image to be detected.

[0122] In S205, the shared rectangular frames refer to the rectangular frames with the same marking positions in the respective feature marking images.

[0123] In the specific process of executing S205, the rectangular frames with the same marking positions in the first feature marking image and the second feature marking image are obtained to obtain a common rectangular frame, and the preset features contained in the common rectangular frame are used as defect features of the image to be detected.

[0124] In one embodiment of the present invention, based on Figure 4 The first characteristic marking diagram shown and Figure 5 The second characteristic mark diagram shown, such as Figure 6 A schematic diagram of determining a common rectangular frame is shown. Figure 6 The position of the shared rectangular frame marked in the figure corresponds to the defect feature of the image to be detected.

[0125] In the periodic image detection method provided in the embodiment of the present invention, different periodic sizes are generated based on the periodic features of the image to be detected, and preset features are detected according to the different periodic sizes to generate a first feature marking image and a second feature marking image of different periodic sizes. After comparing the image to be detected with the first feature marking image and the second feature marking image, the common preset features of the marks are screened out, which can not only effectively determine the real defects of the image to be detected, but also achieve the purpose of controlling the number of false detections and reducing the false detection rate.

[0126] Based on the image detection method disclosed in the above embodiment of the present invention, the embodiment of the present invention also discloses an image detection device, such as Figure 7 As shown, the image detection device includes: an acquisition module 701, a generation module 702, a detection module 703 and a determination module 704.

[0127] The acquisition module 701 is used to acquire an image to be detected, where the image to be detected has a periodic feature.

[0128] The periodic feature of the image to be detected includes a plurality of stripes arranged evenly, and the number of pixel rows between two adjacent stripes is configured as the pixel width of the periodic feature.

[0129] The generating module 702 is used to generate at least two periodic sizes using the periodic feature, and the pair of periodic sizes are integer multiples of the pixel width of the periodic feature.

[0130] The detection module 703 is used to detect preset features of the image to be detected according to each periodic size to obtain a corresponding feature marking map.

[0131] The determination module 704 is used to identify the common preset features in each feature marking image and determine the common preset features as defect features of the image to be detected.

[0132] The generating module 702 is specifically used for:

[0133] The pixel width of the periodic feature is expanded N times to obtain a first period size; and the first period size is expanded M times to obtain a second period size; wherein the values ​​of N and M are positive integers.

[0134] The detection module 703 specifically includes:

[0135] The first acquisition unit is used to acquire a target pixel point of the image to be detected and a plurality of comparison pixels within a first period size around the target pixel point.

[0136] The first comparison unit is used to calculate the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of multiple comparison pixels, and compare the calculated variance or mean with the corresponding threshold.

[0137] The first marking unit is used to mark the target pixel as an abnormal point when the calculated variance or mean exceeds the corresponding threshold; traverse the image to be detected and use one or more abnormal points to form preset features, mark each preset feature to obtain a feature marking map corresponding to the first periodic size.

[0138] And / or, the detection module 703 specifically includes:

[0139] A second acquisition unit is used to acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a second period size around the target pixel point;

[0140] A second comparison unit is used to calculate the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of multiple comparison pixels; and compare the calculated variance or mean with a corresponding threshold;

[0141] The second marking unit is used to mark the target pixel as an abnormal point when the calculated variance or mean exceeds the corresponding threshold; traverse the image to be detected and use one or more abnormal points to form preset features, mark each preset feature to obtain a feature marking map corresponding to the second period size.

[0142] The image detection device also includes: a third marking unit, which is used to set a marking frame for each preset feature in the feature marking map; the marking frame is configured as a rectangular frame of n×n pixels and uses the preset feature in the frame as the center of the rectangle, where the value of n is a positive integer less than 100.

[0143] The determination module 704 is specifically configured to:

[0144] The marking positions of the preset features in each of the feature marking images are obtained, and the preset features with consistent marking positions are used as common preset features; and the common preset features are used as defect features of the image to be tested.

[0145] The image detection device provided in the embodiment of the present invention generates at least two periodic sizes based on the periodic features of the image to be detected, and screens the defect features of the image to be detected according to each periodic size. In the embodiment of the present invention, multiple periodic sizes are used to detect the image to be detected, and the common preset features are used as defect features, which can not only effectively determine the real defects of the image to be detected, but also control the number of false detections and reduce the false detection rate.

[0146] The embodiment of the present invention further discloses a computer-readable storage medium, which includes a stored program, wherein the program, when executed by a processor, executes the image detection method disclosed in the embodiment of the present invention.

[0147] An embodiment of the present invention also discloses an electronic device, which includes: a processor, a memory and a bus; the processor is connected to the memory through the bus; the memory is used to store programs, and the processor is used to run the programs, wherein when the program is run by the processor, the image detection method disclosed in the above embodiment of the present invention is executed.

[0148] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0149] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0150] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An image detection method, characterized in that: The method comprises: Acquire an image to be detected, wherein the image to be detected has a periodic feature; Generating at least two periodic sizes using the periodic feature, the periodic size being an integer multiple of a pixel width of the periodic feature; Detecting preset features of the image to be detected according to each periodic size to obtain a corresponding feature marking map; The common preset features in each of the feature mark images are obtained, and the common preset features are determined as defect features of the image to be detected.

2. The method according to claim 1, characterized in that The periodic feature of the image to be detected includes a plurality of stripes arranged evenly, and the number of pixel rows between two adjacent stripes is configured as the pixel width of the periodic feature.

3. The method according to claim 1 or 2, characterized in that: The step of generating at least two periodic sizes by using the periodic feature comprises: Expanding the pixel width of the periodic feature by N times to obtain a first period size; and expanding the first period size by M times to obtain a second period size; Wherein, the values ​​of N and M are positive integers.

4. The method according to claim 3, characterized in that: According to each periodic size, the image to be detected is respectively detected with preset features to obtain a corresponding feature marking map, including: Acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a first period size around the target pixel point; Calculating the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of the plurality of comparison pixels; Compare the variance or mean with a corresponding threshold, and when the variance or mean exceeds the corresponding threshold, mark the target pixel as an abnormal point; The image to be detected is traversed and one or more abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the first periodic size.

5. The method according to claim 3, characterized in that: According to each periodic size, the image to be detected is detected with preset features to obtain a corresponding feature marking map, including: Acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a second period size around the target pixel point; Calculating the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of the plurality of comparison pixels; Compare the variance or mean with a corresponding threshold, and when the variance or mean exceeds the corresponding threshold, mark the target pixel as an abnormal point; The image to be detected is traversed and a plurality of marked abnormal points are used to form preset features, and each preset feature is marked to obtain a feature marking map corresponding to the second periodic size.

6. The method according to any one of claims 1 to 5, characterized in that Also includes: In the feature marking map, a marking frame is set for each preset feature, and the marking frame is configured as a rectangular frame of n×n pixels and takes the preset feature in the frame as the center of the rectangle, wherein the value of n is a positive integer less than 100.

7. The method according to any one of claims 1 to 5, characterized in that Acquiring the common preset features in each of the feature mark images, and determining the common preset features as defect features of the image to be detected, including: Obtaining the marking positions of the preset features in each of the feature marking images, and taking the preset features with the same marking positions as the common preset features; The common preset features are used as defect features of the image to be tested.

8. An image detection device, characterized in that: The device comprises: An acquisition module, used for acquiring an image to be detected, wherein the image to be detected has a periodic feature; A generating module, used for generating at least two periodic sizes by using the periodic feature, wherein the pair of periodic sizes is an integer multiple of the pixel width of the periodic feature; A detection module, used to detect preset features of the image to be detected according to each period size, and obtain a corresponding feature marking map; The determination module is used to obtain the common preset features in each of the feature mark images, and determine the common preset features as the defect features of the image to be detected.

9. The device according to claim 8, characterized in that The generation module is specifically used for: The pixel width of the periodic feature is expanded N times to obtain a first period size; and the first period size is expanded M times to obtain a second period size; wherein the values ​​of N and M are positive integers.

10. The device according to claim 9, characterized in that The detection module specifically includes: A first acquisition unit, used to acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a first period size around the target pixel point; A first comparison unit, configured to calculate a variance or a mean between a grayscale value of the target pixel and grayscale values ​​of a plurality of comparison pixels, and compare the variance or the mean with a corresponding threshold; A first marking unit is used to mark the target pixel as an abnormal point when the variance or mean exceeds a corresponding threshold; traverse the image to be detected and use one or more abnormal points to form a preset feature, mark each preset feature to obtain a feature marking map corresponding to the first periodic size; And / or, the detection module specifically includes: A second acquisition unit is used to acquire a target pixel point of the image to be detected, and a plurality of comparison pixels within a second period size around the target pixel point; A second comparison unit is used to calculate the variance or mean between the grayscale value of the target pixel and the grayscale values ​​of the plurality of comparison pixels; and compare the variance or mean with a corresponding threshold; The second marking unit is used to mark the target pixel as a preset feature when the variance or mean exceeds the corresponding threshold; traverse the image to be detected and use one or more abnormal points to form preset features, mark each preset feature to obtain a feature marking map corresponding to the second periodic size.

11. The device according to claim 9, characterized in that The device also includes: The third marking unit is used to set a marking frame for each preset feature in the feature marking map; the marking frame is configured as a rectangular frame of n×n pixels and takes the preset feature in the frame as the center of the rectangle, wherein the value of n is a positive integer less than 100.

12. The device according to any one of claims 8 to 11, characterized in that The determination module is specifically used for: The marking positions of the preset features in each of the feature marking images are obtained, and the preset features with consistent marking positions are used as common preset features; and the common preset features are used as defect features of the image to be tested.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program is executed by a processor to perform the image detection method according to any one of claims 1 to 7.

14. An electronic device, characterized in that: include: processor, memory, and bus; The processor is connected to the memory via the bus; The memory is used to store programs, and the processor is used to run programs, wherein the program executes the image detection method according to any one of claims 1 to 7 when the processor runs the program.