Terminal LCD surface defect detection method based on image processing
By combining local grayscale fitting and Dijkstra's algorithm, the Otsu threshold segmentation was optimized, which solved the misidentification problem of the OTU method in detecting fine scratches on the surface of LCD panels, and achieved high-precision and efficient defect detection.
Patent Information
- Application Number
- CN202411068559.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-08-06
AI Technical Summary
The existing OTU method is prone to missing important defect information or misidentifying background areas in the detection of minor scratches on the surface of LCD panels, which affects the accuracy and reliability of the detection.
A terminal LCD surface defect detection method based on image processing is adopted. Suspected scratch pixels are screened by local gray-scale fitting, Dijkstra algorithm is used to find the shortest path to measure continuity, and the degree of defect performance is calculated by combining the fitting loss mean and continuity, and the Otsu threshold segmentation is optimized.
It significantly improves the accuracy and efficiency of surface defect detection in terminal LCDs, effectively identifies minute scratches, filters noise interference, improves the precision and reliability of detection, and avoids over- or under-segmentation problems.
Smart Images

Figure CN118587216B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for detecting surface defects of a terminal liquid crystal based on image processing. Background Art
[0002] With the rapid development of information technology, the application of LCD panels in terminal equipment such as smart energy meters, concentrators, integrated terminals, energy controllers, etc. is becoming more and more widespread, which brings with it higher requirements for panel quality control in large-scale production. However, the defects that are difficult to avoid in the production process, such as cracks and scratches, have become a key factor affecting product quality. Traditional manual inspection methods are gradually unable to meet the needs of industry development due to their low efficiency and high false detection rate, making the application of image processing technology in the field of panel defect detection an inevitable trend.
[0003] Among them, Otsu (Otsu method), as a classic image binarization segmentation method, is widely used in preliminary attempts to solve such defect detection problems. It determines the optimal threshold by maximizing the inter-class variance to achieve effective separation of foreground and background. For example, the patent document with publication number CN110942457B discloses a solar panel defect detection method based on digital image processing technology, including: correcting the angle tilt image deformity of the solar panel; performing image preprocessing; extracting the battery cells on the battery panel, and the segmented battery cell image is represented by F; detecting cracks and black spot defects: according to the characteristics of obvious contrast changes, canny edge detection or Otsu binarization processing is performed to detect cracks and black spot defects; detecting cold soldering defects: enhancing the image contrast through histogram equalization, and then performing defect detection through Otsu binarization to find the cold soldering area; performing hidden crack defect detection on the battery cell image.
[0004] In the above scheme, although the Otsu method can perform defect detection, it exposes its limitations when it comes to detecting subtle scratch defects on the surface of the LCD panel. The core problem is that the grayscale difference between the scratch area and the surrounding background is very small, and sometimes even highly similar. If the threshold of the Otsu method is not set properly, it is easy to cause the omission of important defect information or the misidentification of the background area, thereby affecting the accuracy and reliability of defect detection. Summary of the invention
[0005] In order to solve the problem that when the OSTU method is used to detect fine scratch defects on the surface of the liquid crystal panel, it is easy to cause omission of important defect information or misidentification of the background area, thereby affecting the accuracy and reliability of defect detection, the present invention proposes a terminal liquid crystal surface defect detection method based on image processing, which specifically adopts the following scheme:
[0006] The present invention provides a terminal liquid crystal surface defect detection method based on image processing, comprising:
[0007] Taking any pixel point in the terminal liquid crystal surface image as the target pixel point, fitting the grayscale values of the pixel points in the local range of the target pixel point, and taking the pixel points whose fitting loss of the grayscale value in the local range is greater than a preset loss threshold as suspected scratch pixel points;
[0008] If the number of the suspected scratch pixel points is less than a preset number threshold, the continuity of all the suspected scratch pixel points in the local range is 1; otherwise, a shortest path including all the suspected scratch pixel points in the local range is found by using the Dijkstra algorithm, and the continuity of all the suspected scratch pixel points in the local range is calculated according to the ratio of the length of the shortest path to the number of all the suspected scratch pixel points; the continuity is negatively correlated with the ratio;
[0009] Calculating the defect performance degree of the target pixel point according to the continuity of all suspected scratch pixel points in the local range and the mean value of fitting loss of all pixel points, wherein the defect performance degree is positively correlated with the mean value of fitting loss and the continuity;
[0010] The terminal liquid crystal surface image is segmented by Otsu threshold according to the defect performance degree of all target pixels to obtain the defect detection result of the terminal liquid crystal surface.
[0011] The above scheme significantly improves the accuracy and efficiency of terminal liquid crystal surface defect detection, which is specifically reflected in: through grayscale fitting in a local range, it can effectively identify pixels that are significantly different from the surrounding environment, that is, suspected scratch pixels. This process filters out tiny noise interference by setting a preset threshold, ensuring that the initial identification of suspected scratches is both sensitive and has a certain anti-interference ability. Furthermore, the concept of continuity is introduced, and the shortest path is found through the Dijkstra algorithm to measure the coherence of suspected scratch pixels. This not only takes into account the length of the scratch, but also indirectly measures the morphological characteristics of the scratch, improving the recognition ability of scratches with long continuity or regular morphology. At the same time, setting a quantity threshold avoids misjudging a small number of isolated pixels as scratches, thereby improving the accuracy of detection. Furthermore, the defect is comprehensively evaluated. The defect expression degree of the target pixel is calculated by combining the fitting loss mean and continuity. This comprehensive evaluation method can more comprehensively reflect the true situation of the defect. The loss mean reflects the severity of the grayscale deviation in the local range, while the continuity gives the continuity and integrity information of the scratch from the spatial distribution. The combination of the two makes the judgment of the defect more accurate and comprehensive. Furthermore, the segmentation strategy is optimized, and the defect expression degree of all target pixels is used for Otsu threshold segmentation. This strategy ensures that the segmentation process not only considers the characteristics of a single pixel, but also integrates the overall performance of defects in the entire image, thereby improving the accuracy and robustness of the segmentation, effectively avoiding the problem of over-segmentation or under-segmentation caused by improper selection of local thresholds, and improving the accuracy and reliability of defect detection.
[0012] Preferably, performing Otsu threshold segmentation on the terminal liquid crystal surface image further includes:
[0013] Correcting the defect performance degree of the target pixel point, and performing Otsu threshold segmentation on the terminal liquid crystal surface image based on the corrected defect performance degree;
[0014] The method for correcting the defect level of the target pixel is as follows:
[0015] Performing Fourier transform on a local range of the target pixel point to obtain a frequency spectrum of the local range, and performing a frequency spectrum centering operation on the frequency spectrum to obtain a frequency spectrum with a low frequency in the center and a high frequency at the edge;
[0016] The ratio of the area of the pixel points with grayscale values greater than 0 in the spectrum graph to the total area of the spectrum graph in the local range is used as the degree of disorder in the local range;
[0017] The product of the disorder degree and the defect manifestation degree is used as the defect manifestation degree of the target pixel after correction.
[0018] The above scheme, by introducing spectrum analysis and correction strategy, can further consider the texture complexity (degree of chaos) of the local range before Otsu threshold segmentation, effectively deal with the interference of high-frequency noise or complex texture on defect judgment, and improve the accuracy and robustness of defect recognition. Specifically, by utilizing Fourier transform and spectrum centering technology, it can not only accurately quantify the structural order of the image, but also objectively reflect the chaotic state of the local image through the area ratio, providing a quantitative basis for the fine adjustment of the defect manifestation degree, enhancing the adaptability of detection, so that the corrected defect manifestation degree comprehensively considers the original grayscale deviation and the newly added texture features. This multi-dimensional evaluation method significantly improves the accuracy of segmentation, effectively avoids misjudgment caused by image complexity, and ensures the efficiency and reliability of terminal liquid crystal surface defect detection.
[0019] Preferably, the defect detection result of the terminal liquid crystal surface includes:
[0020] The Otsu threshold divides a plurality of connected domains on the terminal liquid crystal surface image;
[0021] A defect manifestation degree threshold is preset. If the average value of the defect manifestation degrees of all pixels in a connected domain after correction exceeds the defect manifestation degree threshold, the connected domain is a scratch defect area. Otherwise, the connected domain is a normal area.
[0022] The above scheme, through connected domain analysis combined with the corrected defect manifestation degree mean judgment, can not only grasp the overall characteristics of the defect area at a macro level, but also ensure the accurate identification of tiny connected areas, avoid misjudgment caused by local abnormal pixels, and automatically distinguish defects from normal areas, thereby improving the efficiency of the defect detection process.
[0023] Preferably, the defect level of the target pixel is , is the mean value of the fitting loss of all pixels in the local range of the target pixel, is the continuity of all suspected scratch pixels within the local area.
[0024] The above scheme achieves accurate quantification of the degree of defect manifestation by comprehensively considering the local fitting loss of pixels and the continuity of suspected scratches. Specifically, the mean of the fitting loss directly reflects the degree of grayscale deviation around the pixels and quantifies the degree of abnormality in the local range, while the introduction of continuity takes into account the spatial distribution characteristics of the defects. The comprehensive consideration of the two results in a defect manifestation degree that can more comprehensively reflect the severity and scope of the defects.
[0025] Preferably, the continuity of all suspected scratch pixels within the local range satisfies the following relationship:
[0026] , where is the continuity of all suspected scratch pixels within the local area, is the natural exponential function, is the length of the shortest path, is the number of all suspected scratch pixels.
[0027] The above scheme effectively quantifies the continuity of suspected scratch pixels through the natural exponential function, and can accurately reflect the spatial distribution characteristics. If the target pixel is a pixel of a scratch defect, the suspected scratch pixels in its local range should be continuous in morphology to show a scratch shape. When the D value is large and the R value is small, it means that within the local range of the target pixel, the suspected scratch pixels have a large spacing, a relatively discrete distribution, and poor continuity. The target pixel is less likely to be a scratch defect pixel. Otherwise, it means that the suspected scratch defect pixels in the local range are compactly and continuously distributed. The better the continuity, the more likely the target pixel is to be a pixel at the defect.
[0028] Preferably, performing grayscale fitting on pixel points in a local range of the target pixel point includes:
[0029] Taking the upper left corner of the local range as the origin, the position of the pixel points in the local range as the horizontal axis, and the grayscale value of the pixel points in the local range as the vertical axis, a polynomial is used to fit the grayscale value of the pixel points at each coordinate in the local range to obtain a grayscale fitting curve.
[0030] The above scheme adopts the polynomial relationship between the grayscale value and position of local pixels for fitting, which can flexibly capture complex and changeable grayscale distribution patterns. Compared with simple linear fitting, it more accurately reflects the grayscale change trend in the local range, adapts to defect characteristics of various shapes and sizes, and enhances the noise suppression ability. Through the grayscale fitting curve, abnormal pixels that deviate greatly from the overall trend can be effectively distinguished. These points are often grayscale mutations caused by defects such as scratches, and are thus screened out as suspected defective pixels in subsequent analysis, while reducing the impact of image noise on defect recognition.
[0031] Preferably, the shortest path takes the suspected scratch pixel point closest to the origin within the local range as a starting point.
[0032] Preferably, the fitting loss is equal to the absolute value of the difference between the actual grayscale value of the pixel and the fitting value.
[0033] Preferably, the method for obtaining the length of the shortest path is:
[0034] The shortest path includes a plurality of suspected scratch pixel points, and the Euclidean distance between every two adjacent suspected scratch pixel points is obtained, and the sum of the Euclidean distances is used as the length of the shortest path.
[0035] Preferably, the local range of the target pixel is centered on the target pixel. Window size range, is the default value.
[0036] The present invention has the following effects:
[0037] This method achieves high-sensitivity recognition of tiny scratches through fine local grayscale fitting and intelligent screening, while effectively filtering out noise to ensure high precision and stability of detection. The introduction of continuity analysis and shortest path algorithm enhances the understanding of scratch morphological characteristics, optimizes the accurate recognition of defects with long continuity or regular morphology, and improves the reliability and accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0039] Figure 1 It is a schematic flow chart of the method of the present invention;
[0040] Figure 2 is a schematic diagram of a surface image of a liquid crystal terminal of the present invention;
[0041] Figure 3 is a schematic diagram of a scratch defect obtained after the traditional Otsu threshold segmentation of the present invention;
[0042] Figure 4 It is a schematic diagram of scratch defects obtained after performing Otsu threshold segmentation based on the defect manifestation degree of all pixel points of the present invention. DETAILED DESCRIPTION
[0043] 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 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0044] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0045] Reference Figure 1The terminal liquid crystal surface defect detection method based on image processing includes steps S1-S3, which are as follows:
[0046] S1: Collect the terminal LCD surface image.
[0047] In the field of intelligent manufacturing such as energy meter and electricity consumption information collection, in order to ensure the quality of the terminal LCD screen, this step first takes the following precise image processing steps: Image acquisition and initialization processing: Use high-performance industrial cameras to capture the image of the terminal LCD surface in real time on the production line, such as Figure 2 As shown in , the image is used as the basis for subsequent analysis and processing. In order to facilitate subsequent analysis, this step grayscales the acquired image and converts it into a grayscale image, because the grayscale image is directly related to the brightness information of the pixel points, which is crucial for identifying subtle grayscale differences.
[0048] In the detection of the surface of the LCD screen, especially for the imperceptible defects such as tiny scratches, a significant difficulty is that the grayscale value of the scratched part is very close to that of the surrounding background, which is almost indistinguishable to the naked eye. In this case, directly applying the traditional threshold segmentation method, such as the OSTU method, which is based on a simple global threshold or fixed threshold segmentation, is often difficult to effectively identify these subtle defect features. Therefore, a more sophisticated strategy will be adopted in this embodiment, that is, to guide the OSTU threshold segmentation by obtaining the defect performance degree of each pixel point to obtain accurate segmentation results, and then accurately identify the scratch defects on the terminal LCD surface, so as to improve the accuracy and reliability of defect detection and ensure the quality of terminal products.
[0049] S2: Calculate the defect level of each pixel in the image.
[0050] During the production process, if there is a scratch defect in the terminal liquid crystal surface image, the change of the grayscale value in the local range of the pixel point at the scratch defect is irregular, while in the normal area of the terminal liquid crystal surface image, the change of the grayscale value in the local range of the pixel point shows a certain regularity. Therefore, whether the change of the grayscale value in the local range of each pixel point shows regularity can be used to preliminarily characterize the degree of defect performance of the pixel point.
[0051] Specifically, the operations of this step include:
[0052] S21: Set the local range of the target pixel:
[0053] Any pixel in the image is taken as the target pixel, and subsequent analysis is performed. Then, the target pixel is centered on the The window size range is the local range of the target pixel point. It is a preset value, which is set to 9 in this embodiment.
[0054] S22: Filter suspected scratch pixels within the local range of the target pixel:
[0055] Taking the upper left corner of the local range as the origin, the position of the pixel point in the local range as the horizontal axis, and the grayscale value of the pixel point in the local range as the vertical axis, a polynomial is used to fit the grayscale value of the pixel point at each coordinate in the local range to obtain a grayscale fitting curve. The grayscale value of the pixel point at each position in the local range corresponds to a fitting value in the grayscale fitting curve. The difference between the fitting value of the grayscale value of the pixel point at each position in the local range and the actual value of the grayscale value is calculated, and the absolute value is obtained, and the obtained value is used as the fitting loss of the pixel point at that position.
[0056] The preset loss threshold is 0.4 (empirical value), and the pixels with fitting loss greater than 0.4 in the local range are regarded as suspected scratch pixels. The specific reasons are:
[0057] By fitting the grayscale values of the local range with a polynomial, the fitting loss (i.e., the difference between the actual grayscale value and the corresponding grayscale value on the fitting curve) can be regarded as an indicator to measure whether the grayscale changes in the area are smooth or regular. Under normal circumstances, if there is no obvious abnormal change in the local range (such as scratches, stains, etc.), the change in the grayscale value should be relatively continuous and smooth, and the fitting loss will be relatively small; when there are defects such as scratches in the local range, these defects will cause sudden changes or discontinuities in the grayscale value, thereby producing a large deviation in the fitting process, that is, the fitting loss increases. This is because defects such as scratches break the smooth transition of the grayscale value in the local range, making it difficult for the fitting curve to accurately describe the grayscale distribution of this local range.
[0058] Setting a reasonable loss threshold is to distinguish pixels that significantly deviate from the normal situation from the fitting loss. When the fitting loss of a pixel exceeds this threshold, it is considered that the pixel is likely to be an abnormal pixel, that is, it may be caused by defects such as scratches. The selection of the threshold is usually based on experiments and experience to ensure that defects can be effectively identified while avoiding too many false positives.
[0059] In summary, this step screens out suspected scratch pixel points in the local area because the gray value changes of these points significantly deviate from the regular changes in the surrounding normal areas. This is a direct manifestation of the existence of defects. In this way, possible scratch locations can be effectively identified from complex image data, providing accurate targets for further analysis and processing.
[0060] S23: Evaluate the continuity of all suspected scratch pixels within the local range of the target pixel:
[0061] Since scratch defects are often a continuous curve, the continuity of the morphology of pixels within a local range can be used to characterize the degree of defect performance of the pixel. The better the morphological continuity of the suspected scratch pixel within the local range of a certain pixel, the more likely the pixel is to be a scratch defect pixel.
[0062] Therefore, in order to evaluate the continuity of all suspected scratch pixels in the local range, the number of suspected scratch pixels in the local range is first determined. If the number of suspected scratch pixels is less than the preset number threshold, it means that the grayscale value error of the pixels in the local range is small and there is almost no scratch defect. In this case, the continuity of all suspected scratch pixels in the local range is set to 1.
[0063] If the number of the suspected scratch pixels is greater than or equal to the preset number threshold, it means that there is a large gray value error in the pixels within the local range, and it is necessary to perform continuity analysis on the suspected scratch pixels within the local range, specifically including:
[0064] Taking the suspected scratch pixel point closest to the origin (the upper left corner of the local range) in the local range as the starting point, the Dijkstra algorithm is used to find a shortest path containing all suspected scratch pixels in the local range. The shortest path contains multiple suspected scratch pixels, and the Euclidean distance between every two adjacent suspected scratch pixels is obtained. If there are A suspected scratch pixels, there are A-1 Euclidean distances in total, and the sum of A-1 Euclidean distances is taken as the length of the shortest path.
[0065] Calculate the continuity of all suspected scratch pixels in the local area. The calculation formula is:
[0066]
[0067] In this formula, is the continuity of all suspected scratch pixels within the local area, is the natural exponential function, is the length of the shortest path, is the number of all suspected scratch pixels.
[0068] If the target pixel is a scratch defect pixel, the better the morphological continuity of the suspected scratch pixel in its local range, when the D value is large and the R value is small, it means that within the local range of the target pixel, the suspected scratch pixel spacing is large, the distribution is more discrete, and the continuity is poor. The target pixel is less likely to be a scratch defect pixel. Otherwise, it means that the suspected scratch defect pixel in the local range is compactly and continuously distributed. The better the continuity, the more likely the target pixel is to be a pixel at the defect.
[0069] S24: Calculate the defect level of the target pixel:
[0070] Since the fitting loss of the grayscale values of all pixels in the local range of the target pixel can reflect the regularity of the grayscale change of the pixels in the local range, the worse the regularity of the grayscale change, the more likely the target pixel is to be a defective pixel, and the better the morphological continuity of the suspected scratch pixels in the local range, the more likely the target pixel is to be a defective pixel. Therefore, the mean of the fitting loss of the grayscale values of all pixels in the local range and the continuity of all suspected scratch pixels in the local range can be combined to calculate the defect manifestation degree of the target pixel. The defect manifestation degree is positively correlated with the fitting loss and the continuity. That is, the greater the fitting loss of the grayscale value in the local range of the target pixel and the better the continuity of the suspected scratch pixels, the more likely the target pixel is to be a scratch defective pixel. It can be seen that the defect manifestation degree is positively correlated with the fitting loss and the continuity.
[0071] Therefore, the defect performance degree of the target pixel is calculated according to the following formula:
[0072]
[0073] In the formula, is the defect performance degree of the target pixel, is the mean value of the fitting loss of all pixels in the local range of the target pixel, is the continuity of all suspected scratch pixels within the local area.
[0074] S3: Perform Otsu threshold segmentation based on the defect performance level of all pixels to obtain the defect detection result of the terminal liquid crystal surface.
[0075] This step provides two methods, the first one is:
[0076] According to the defect performance degree of all target pixels calculated in S2, the surface image of the liquid crystal terminal is directly segmented by Otsu threshold. The difference from the traditional Otsu threshold segmentation is that the traditional Otsu threshold segmentation is based on the gray value of the pixel. The segmentation result of the scratch defect is as follows: Figure 3 As shown in , this step is based on the degree of defect expression of the pixel point, that is, the gray value of each pixel point is replaced by the degree of defect expression, and the Otsu threshold segmentation is performed. Finally, the surface image of the liquid crystal terminal is segmented into a foreground image and a background image (i.e., a binary image, the foreground gray value is 1, and the background gray value is 0). The segmentation result is shown in Figure 4As shown in the figure, the black one is the background image, the white one is the foreground image, the foreground image includes multiple connected domains, the defect manifestation degree threshold is set to 0.57, and the mean of the defect manifestation degree of all pixels in each connected domain is calculated. If the mean exceeds the defect manifestation degree threshold, the connected domain is a scratch defect area, otherwise, the connected domain is a normal area, thereby realizing scratch defect detection on the surface of the liquid crystal terminal.
[0077] Another preferred solution is:
[0078] S31: Correcting the defect level of the target pixel, including:
[0079] S311: Calculate the degree of disorder in the local range according to the spectrum diagram of the local range of the target pixel point. Specifically, obtain the spectrum diagram of the local range of the target pixel point by using Fourier transform and spectrum centering. The pixels with grayscale values greater than 0 in the spectrum diagram can reflect the high-frequency components in the image. These high-frequency components are usually related to the detail information, edges, textures and noise of the image. After Fourier transform, the frequency information of the image is converted into the spectrum domain, wherein the low-frequency part usually corresponds to the smooth area or large structural features of the image, while the high-frequency part corresponds to the details, textures and potential noise in the image.
[0080] S312: The ratio of the area of the pixels with grayscale values greater than 0 in the spectrum graph to the total area of the spectrum graph in the local range is used as the degree of disorder in the local range. The significance of this is that when calculating the area ratio of the pixels with grayscale values greater than 0, it is actually evaluating the proportion of high-frequency information in the image to the total spectrum information. In a pure image with a simple structure, if it is mainly composed of low-frequency components, the grayscale values of most areas in the spectrum graph may be close to or equal to 0, indicating that these areas represent relatively smooth structures without obvious details or noise. On the contrary, if the image contains more details, textures or is affected by noise, the image complexity is high, and it is more likely to have defects. There will be more pixels with grayscale values greater than 0 in the spectrum graph, indicating that the high-frequency information is rich. Therefore, by calculating the area ratio of this part of pixels, the "degree of chaos" or texture complexity of the local area of the image can be quantified, that is, the richness of details in the area and the possibility of potential defects. This method is particularly useful in image processing and defect detection because it can help distinguish between real structural details (such as subtle scratches or defects) and artifacts caused by noise, thereby improving the stability and accuracy of the detection algorithm in complex backgrounds and reducing misjudgments and missed judgments.
[0081] S32: Calculate the defect manifestation degree of the target pixel after correction. Specifically, the product of the confusion degree and the defect manifestation degree is used as the defect manifestation degree of the target pixel after correction.
[0082] In the process of correcting the degree of defect manifestation, the original defect manifestation degree and the newly introduced local chaos degree are combined, and a comprehensive evaluation is performed by multiplying the two. This not only takes into account the severity of grayscale deviation, but also incorporates the influence of local texture features, making the identification of defects more comprehensive and accurate, and effectively reducing false alarms and missed detections.
[0083] S33: Threshold segmentation, specifically, performing Otsu threshold segmentation on the terminal liquid crystal surface image based on the corrected defect manifestation degree to obtain a defect detection result of the terminal liquid crystal surface (the same as the first solution) to achieve defect detection of the terminal liquid crystal surface.
[0084] Since the degree of defect expression after correction is more in line with the actual defect characteristics, the Otsu threshold segmentation based on this can more accurately distinguish the defect area from the normal area, improve the accuracy and specificity of the segmentation, and improve the accuracy of detection.
[0085] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0086] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A terminal liquid crystal surface defect detection method based on image processing, characterized in that: include: Taking any pixel point in the terminal liquid crystal surface image as the target pixel point, fitting the grayscale values of the pixel points in the local range of the target pixel point, and taking the pixel points whose fitting loss of the grayscale value in the local range is greater than a preset loss threshold as suspected scratch pixel points; If the number of the suspected scratch pixel points is less than a preset number threshold, the continuity of all the suspected scratch pixel points in the local range is 1; otherwise, a shortest path including all the suspected scratch pixel points in the local range is found by using the Dijkstra algorithm, and the continuity of all the suspected scratch pixel points in the local range is calculated according to the ratio of the length of the shortest path to the number of all the suspected scratch pixel points; the continuity is negatively correlated with the ratio; Calculating the defect performance degree of the target pixel point according to the continuity of all suspected scratch pixel points in the local range and the mean fitting loss of all pixel points, wherein the defect performance degree is positively correlated with the mean fitting loss and the continuity; The terminal liquid crystal surface image is segmented by Otsu threshold according to the defect performance degree of all target pixels to obtain the defect detection result of the terminal liquid crystal surface.
2. The terminal liquid crystal surface defect detection method based on image processing according to claim 1 is characterized in that: Performing Otsu threshold segmentation on the terminal liquid crystal surface image also includes: Correcting the defect performance degree of the target pixel point, and performing Otsu threshold segmentation on the terminal liquid crystal surface image based on the corrected defect performance degree; The method for correcting the defect level of the target pixel is as follows: Performing Fourier transform on a local range of the target pixel point to obtain a frequency spectrum of the local range, and performing a spectrum centering operation on the frequency spectrum to obtain a frequency spectrum with a low frequency in the center and a high frequency at the edge; The ratio of the area of the pixel points with grayscale values greater than 0 in the spectrum graph to the total area of the spectrum graph in the local range is used as the degree of disorder in the local range; The product of the disorder degree and the defect manifestation degree is used as the defect manifestation degree of the target pixel after correction.
3. The terminal liquid crystal surface defect detection method based on image processing according to claim 2 is characterized in that: The defect detection result of the terminal liquid crystal surface includes: The Otsu threshold divides a plurality of connected domains on the terminal liquid crystal surface image; A defect manifestation degree threshold is preset. If the average value of the defect manifestation degrees of all pixels in a connected domain after correction exceeds the defect manifestation degree threshold, the connected domain is a scratch defect area. Otherwise, the connected domain is a normal area.
4. The terminal liquid crystal surface defect detection method based on image processing according to claim 2 is characterized in that: The defect level of the target pixel , is the mean value of the fitting loss of all pixels in the local range of the target pixel, is the continuity of all suspected scratch pixels within the local area.
5. The terminal liquid crystal surface defect detection method based on image processing according to claim 4 is characterized in that: The continuity of all suspected scratch pixels within the local area satisfies the following relationship: , where is the continuity of all suspected scratch pixels within the local area, is the natural exponential function, is the length of the shortest path, is the number of all suspected scratch pixels.
6. The terminal liquid crystal surface defect detection method based on image processing according to claim 4 is characterized in that: Grayscale fitting is performed on pixel points in a local range of the target pixel point, including: Taking the upper left corner of the local range as the origin, the position of the pixel points in the local range as the horizontal axis, and the grayscale value of the pixel points in the local range as the vertical axis, a polynomial is used to fit the grayscale value of the pixel points at each coordinate in the local range to obtain a grayscale fitting curve.
7. The terminal liquid crystal surface defect detection method based on image processing according to claim 4 is characterized in that: The shortest path takes the suspected scratch pixel point closest to the origin within the local range as a starting point.
8. The terminal liquid crystal surface defect detection method based on image processing according to claim 4 is characterized in that: include: The fitting loss is equal to the absolute value of the difference between the actual grayscale value of the pixel and the fitting value.
9. The terminal liquid crystal surface defect detection method based on image processing according to claim 5 is characterized in that: The method for obtaining the length of the shortest path is: The shortest path includes a plurality of suspected scratch pixel points, and the Euclidean distance between every two adjacent suspected scratch pixel points is obtained, and the sum of the Euclidean distances is used as the length of the shortest path.
10. The terminal liquid crystal surface defect detection method based on image processing according to claim 6, characterized in that: The local range of the target pixel is centered on the target pixel. Window size range, is the default value.
Citation Information
Patent Citations
A Defect Detection Method for Solar Panels Based on Digital Image Processing Technology
CN110942457B
Scratch defect detection method and device, computing equipment and storage medium
CN111444921A
Systems and methods for image processing
WO2023050422A1
