A method and system for detecting line defects in industrial products

Through image processing technology and robust algorithms, it solves the problem that deep learning models are difficult to detect line defects in real time on industrial production lines, achieves high-accuracy and high-real-time detection of industrial products, and improves the automation of product quality control. level and efficiency.

CN118334033BActive Publication Date: 2024-08-23CHENGDU TURING VISION TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410765993.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-08-23
Estimated Expiration
2044-06-14

Smart Images

  • Figure CN118334033B
    Figure CN118334033B
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting line defects based on industrial product defects, and relates to the technical field of product defect detection, including: obtaining an image of a region to be detected, performing defect enhancement processing on the image of the region to be detected based on the image of the region to be detected, obtaining a defect enhanced image, excluding pixels in abnormal regions of the image through binarization and morphological operations based on the defect enhanced image, and patching and filling to obtain a line defect detection image, determining linear defects in bright and dark regions based on the line defect detection image, enhancing bright and dark defect features, performing fitting analysis based on the enhanced bright and dark defect features through a RANSAC algorithm, obtaining a line defect difference map, and judging whether the lines in the line defect difference map are in a normal range based on the line defect difference map through a card control line threshold, if so, judging that there is no defect, if not, judging that there is a defect. The advantages of the present invention are: meeting the real-time and accuracy of line defect detection of a display screen, and having strong anti-interference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of product defect detection, and in particular to a method and system for detecting line defects in industrial product defects. Background Art

[0002] In the field of industrial manufacturing, line defects of display screens refer to a series of visual or physical abnormalities that appear in the display area of ​​the screen, including broken lines, bright lines, dark lines, color stripes, vertical or horizontal lines, dead pixels, bright or dark spots, uneven lines, and physical or electrical damage. These defects may affect the appearance quality, performance and reliability of the product.

[0003] The existing detection technologies with high accuracy include machine learning and deep learning technologies, which can learn the specific line defect features in the image through modeling. However, deep learning models usually require a lot of computing resources, which makes it difficult to apply them on industrial production lines with high real-time requirements. In addition, the training samples are targeted, which makes it difficult to iterate the model later. Summary of the invention

[0004] In order to solve the above technical problems, a method and system for detecting line defects in industrial product defects are provided. This technical solution solves the above existing detection accuracy problems, such as machine learning and deep learning technologies, which can learn specific line defect features in images through modeling. However, deep learning models usually require a lot of computing resources, which makes it difficult to apply them on industrial production lines with high real-time requirements, and the training samples are targeted, which makes it difficult to iterate the model later.

[0005] In order to achieve the above purpose, the technical solution adopted by the present invention is:

[0006] A line defect detection method based on industrial product defects, comprising:

[0007] Acquire an image of the area to be detected;

[0008] Based on the image of the area to be inspected, defect enhancement processing is performed on the image of the area to be inspected to obtain a defect enhanced image;

[0009] Based on the defect enhancement image, through binarization and morphological operations, the pixels in the abnormal area of ​​the image are excluded, and the image is filled and repaired to obtain the line defect detection image;

[0010] According to the line defect detection image, the linear defects in the bright and dark areas are determined, and the bright and dark defect characteristics are enhanced;

[0011] Based on the enhanced bright and dark defect features, the RANSAC algorithm is used for fitting analysis to obtain the line defect difference map;

[0012] Based on the line defect difference map, the card control line threshold is used to determine whether the lines in the line defect difference map are within the normal range. If so, it is determined to be defect-free, otherwise, it is determined to be defective.

[0013] Preferably, based on the image of the area to be inspected, performing defect enhancement processing on the image of the area to be inspected, and obtaining the defect enhanced image specifically includes:

[0014] Based on the expected direction of the current image of the area to be detected, the average gray value of the gray image target is obtained;

[0015] Convert the image of the area to be detected into a grayscale image, and perform grayscale average stretching to obtain a grayscale image of the area to be detected;

[0016] Based on the grayscale image of the area to be detected, the grayscale image of the area to be detected is evenly divided into several sub-areas, and each pixel in each sub-area is power-converted according to the LUT lookup table to obtain the power-converted grayscale image of the area to be detected;

[0017] According to the power conversion of the gray value of each pixel in the gray image of the area to be detected, the average gray value of the gray image is calculated by the average gray value formula;

[0018] According to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, the brightness adjustment factor is determined, and the grayscale value of each pixel in the power conversion grayscale image of the area to be inspected is adjusted through the brightness adjustment formula to obtain a defect enhanced image;

[0019] The average gray value formula is:

[0020] In the formula, is the average grayscale value of the grayscale image, W is the image width, H is the image height, x and y are the pixel coordinates, is the gray value of the i-th row and j-th column in the area where the pixel is located;

[0021] The brightness adjustment formula is:

[0022] In the formula, The gray value of the i-th row and j-th column in the pixel area is adjusted. is the average gray value of the gray image target, is the brightness adjustment factor.

[0023] Preferably, based on the defect enhancement image, pixels in abnormal areas of the image are excluded through binarization and morphological operations, and repaired and filled to obtain a line defect detection image, which specifically includes:

[0024] Based on the image binarization operation, a global threshold is set to divide the defect enhancement image into black and white binary images to obtain a set of black and white binary images;

[0025] Using morphological opening and closing operations, the noise and connection breaks in the black and white binary image are removed, the connected areas are determined, and a unique label is assigned to each connected area.

[0026] Visualize each label of each connected area to obtain a blob area map;

[0027] According to the blob area image, noise suppression and deviation suppression are performed, and filling and patching processing is performed to obtain a line defect detection image;

[0028] Among them, the image binarization operation is specifically as follows:

[0029] In the formula, for Gray value at pixel coordinates, T is the global threshold, if If the gray value at the pixel coordinate is greater than T, the pixel is assigned 255 and classified as a white binary image. If the gray value at the pixel coordinate is less than T, the pixel is assigned 0 and classified as a black binary image;

[0030] Among them, the morphological opening and closing operations include:

[0031] In the formula, is a set of black and white binary images, B is a black and white binary image structure element, is the x, y pixel coordinates in the black and white binary image structure element, is the erosion operation of the morphological operation, The dilation operation is a morphological operation.

[0032] Preferably, determining the linear defects in the bright and dark areas according to the line defect detection image and enhancing the bright and dark defect features specifically include:

[0033] Create a one-dimensional projection matrix of the same size as the line defect inspection image;

[0034] Based on the addition and subtraction calculation of each pixel in the line defect detection image and the detection area image, the linear defect is taken as the foreground and the normal pixel point is taken as the background to obtain the linear defect binary image;

[0035] Using vertical edge summation, based on the linear defect binary image, the pixel values ​​in each x direction are summed in the y direction, and added to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional row projection matrix;

[0036] Using vertical edge summation, based on the linear defect binary image, the pixel values ​​in each y direction are summed in the x direction, and added to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional column projection matrix;

[0037] Based on the one-dimensional row projection matrix and the one-dimensional column projection matrix, the matrix is ​​filtered and feature enhanced through a filtering algorithm to obtain the bright and dark defect features;

[0038] Among them, the vertical edge summation algorithm expression is:

[0039] In the formula, is a one-dimensional row projection matrix, is a one-dimensional column projection matrix, is the pixel value of the jth column and the ith row in the linear defect binary image, is the pixel value of the i-th row and j-th column in the linear defect binary image, n is the total number of rows, and m is the total number of columns;

[0040] Among them, the filtering algorithm expression is:

[0041] In the formula, represents the value in the i-th row, represents the value in the jth column, min is the minimum function, max is the maximum function, is the filter kernel, is the size of the structure element of the filter.

[0042] Preferably, based on enhancing the bright and dark defect features, a fitting analysis is performed through a RANSAC algorithm to obtain a line defect difference map, specifically including:

[0043] The one-dimensional row projection matrix and the one-dimensional column projection matrix are divided according to the specified sub-areas, and pixel points are sampled according to the preset intervals. The sampled data are cleaned and screened by the principal component analysis method;

[0044] Based on the cleaned sampling data, the variance and covariance are calculated and combined into a covariance matrix;

[0045] Perform eigendecomposition based on the covariance matrix to obtain the eigenvector matrix and diagonal matrix;

[0046] Based on the rotation angle of the eigenvector matrix, the intercept is calculated using the slope calculation formula;

[0047] Based on the eigenvector matrix and the average value of the sampled data, the slope is calculated using the intercept formula;

[0048] Based on the RANSAC algorithm, fitting analysis is performed according to the slope and intercept to obtain the parameters of the fitting curve;

[0049] By traversing the pixel values ​​of the sub-regions, the fitting values ​​are calculated according to the parameters of the fitting curve to obtain a row fitting line set and a column fitting line set;

[0050] The row fitting line set is feature-fused with the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected;

[0051] The column fitting line set is feature-fused with the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected;

[0052] Among them, the variance and covariance of the one-dimensional row projection matrix and the one-dimensional column projection matrix are calculated as follows:

[0053] In the formula, is the average value of the pixels in the sampled data row, is the average value of the pixels in the sampled data column, , are the row variance and column variance, is the covariance, vxx, vxy, vyy are the eigenvalues ​​of the covariance matrix, and θ is the direction angle of the principal axis;

[0054] Among them, the row fitting line set and column fitting line set are specifically:

[0055] In the formula, is the intercept, is the slope, is the updated row fitting value, is the updated column fitted value, is the product of the slope and the x-row, is the product of the slope and the y row.

[0056] Furthermore, a linear defect detection system based on industrial product defects is proposed, which is used to implement the linear defect detection method based on industrial product defects as described above, including:

[0057] The module to be detected is used to obtain an image of the area to be detected;

[0058] A defect enhancement module, the defect enhancement module is electrically connected to the module to be detected, and the defect enhancement module is used to perform defect enhancement processing on the image of the area to be detected based on the image of the area to be detected to obtain a defect enhanced image;

[0059] An image processing module, the image processing module is electrically connected to the defect enhancement module, and the image processing module is used to exclude pixels in abnormal areas of the image through binarization and morphological operations based on the defect enhancement image, and to repair and fill the pixels to obtain a line defect detection image;

[0060] A feature analysis module, the feature analysis module is electrically connected to the image processing module, and is used to extract linear defects in bright and dark areas according to the line defect detection image, and obtain bright and dark defect features;

[0061] A difference map module, the difference map module is electrically connected to the feature analysis module, and the difference map module is used to obtain a line defect difference map by performing fitting analysis based on the bright and dark defect features through the RANSAC algorithm;

[0062] The defect judgment module is electrically connected to the difference map module. The defect judgment module is used to judge whether the lines in the line defect difference map are within the normal range based on the line defect difference map and the card control line threshold. If so, it is judged that there is no defect, otherwise, it is judged that there is a defect.

[0063] Optionally, the defect enhancement module includes:

[0064] The target unit obtains the average gray value of the gray image target based on the expected direction of the current image of the area to be detected;

[0065] A grayscale conversion unit converts the image of the area to be detected into a grayscale image, and performs grayscale average stretching to obtain a grayscale image of the area to be detected;

[0066] A power conversion unit, based on the grayscale image of the area to be detected, evenly divides the grayscale image of the area to be detected into a plurality of sub-areas, and performs power conversion on each pixel in each sub-area according to the LUT lookup table to obtain a power conversion grayscale image of the area to be detected;

[0067] The average grayscale calculation unit calculates the average grayscale value of the grayscale image by the average grayscale value formula according to the grayscale value of each pixel in the grayscale image of the area to be detected according to the power conversion;

[0068] The defect enhancement unit determines the brightness adjustment factor according to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, and adjusts the grayscale value of each pixel in the power conversion grayscale image of the area to be detected through the brightness adjustment formula to obtain a defect enhanced image.

[0069] Optionally, the image processing module includes:

[0070] The binary image collection unit sets a global threshold based on the image binarization operation, divides the defect enhancement image into black and white binary images, and obtains a black and white binary image collection;

[0071] The label assignment unit uses morphological opening and closing operations to remove noise and connection breaks in black and white binary images, determine connected areas, and assign a unique label to each connected area;

[0072] The region map unit visualizes each label of each connected region to obtain a blob region map;

[0073] The defect detection image unit performs noise suppression and deviation suppression according to the blob area image, and performs filling and patching processing to obtain a line defect detection image.

[0074] Optionally, the feature analysis module includes:

[0075] A projection matrix unit, which creates a one-dimensional projection matrix of the same size as the line defect detection image;

[0076] The linear defect binary image unit performs addition and subtraction calculations based on each pixel in the linear defect detection image and the detection area image, takes the linear defect as the foreground and the normal pixel points as the background, and obtains the linear defect binary image;

[0077] The row projection matrix unit uses vertical edge summation to sum the pixel values ​​in each x direction in the y direction based on the linear defect binary image, and adds them to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional row projection matrix;

[0078] The column projection matrix unit uses vertical edge summation to sum the pixel values ​​in each y direction in the x direction based on the linear defect binary image, and adds them to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional column projection matrix;

[0079] The feature enhancement unit filters and enhances the features of the matrix based on the one-dimensional row projection matrix and the one-dimensional column projection matrix through a filtering algorithm to obtain the bright and dark defect features.

[0080] Optionally, the difference map module internally includes:

[0081] A data cleaning unit divides the one-dimensional row projection matrix and the one-dimensional column projection matrix according to the specified sub-areas, samples the pixels according to the preset intervals, and cleans and screens the sampled data by principal component analysis;

[0082] The covariance matrix unit calculates the variance and covariance based on the cleaned sample data and combines them into a covariance matrix;

[0083] An eigendecomposition unit performs eigendecomposition based on the covariance matrix to obtain an eigenvector matrix and a diagonal matrix;

[0084] The intercept unit calculates the intercept based on the rotation angle of the eigenvector matrix using the slope calculation formula;

[0085] The slope unit calculates the slope based on the eigenvector matrix and the average value of the sampled data using the intercept formula;

[0086] The fitting curve unit, based on the RANSAC algorithm, performs fitting analysis according to the slope and intercept to obtain the parameters of the fitting curve;

[0087] The fitting unit traverses the pixel values ​​of the sub-regions, calculates the fitting values ​​according to the parameters of the fitting curve, and obtains a row fitting line set and a column fitting line set;

[0088] The row difference map unit performs feature fusion on the row fitting line set and the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected;

[0089] The column difference map unit performs feature fusion on the column fitting line set and the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected.

[0090] Compared with the prior art, the present invention has the following beneficial effects:

[0091] The present invention proposes a line defect detection scheme based on industrial product defects. Through image processing technology and robust algorithms, it realizes high real-time and high accuracy detection of obvious and weak line defects in the luminous area of ​​display screen products in industrial manufacturing. It has strong anti-interference ability and is suitable for line defect detection of various array lighting screens, which significantly improves the automation level and efficiency of product quality control. BRIEF DESCRIPTION OF THE DRAWINGS

[0092] Figure 1 It is a flow chart of a method for detecting line defects based on industrial product defects;

[0093] Figure 2 A flow chart of a method for obtaining defect enhanced images;

[0094] Figure 3 A flow chart of a method for obtaining line defect detection images;

[0095] Figure 4 Flowchart of the method for enhancing the characteristics of bright and dark defects;

[0096] Figure 5 A flow chart of a method for obtaining a line defect difference map;

[0097] Figure 6 This is a framework diagram of a line defect detection system based on industrial product defects. DETAILED DESCRIPTION

[0098] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art may think of other obvious variations.

[0099] Reference Figure 1As shown, a method for detecting line defects in industrial product defects includes:

[0100] Acquire an image of the area to be detected;

[0101] Based on the image of the area to be inspected, defect enhancement processing is performed on the image of the area to be inspected to obtain a defect enhanced image;

[0102] Based on the defect enhancement image, through binarization and morphological operations, the pixels in the abnormal area of ​​the image are excluded, and the image is filled and repaired to obtain the line defect detection image;

[0103] According to the line defect detection image, the linear defects in the bright and dark areas are determined, and the characteristics of the bright and dark defects are enhanced;

[0104] Based on the enhanced bright and dark defect features, the RANSAC algorithm is used for fitting analysis to obtain the line defect difference map;

[0105] Based on the line defect difference map, the card control line threshold is used to determine whether the lines in the line defect difference map are within the normal range. If so, it is determined to be defect-free, otherwise, it is determined to be defective.

[0106] Through image processing technology and computer vision algorithms, this solution realizes the rapid identification and classification of bright lines, dark lines, weak bright lines and weak dark lines in the luminous area of ​​the display screen, effectively improving the efficiency and accuracy of display screen product quality inspection in industrial production.

[0107] Reference Figure 2 As shown, based on the image of the area to be inspected, defect enhancement processing is performed on the image of the area to be inspected, and obtaining the defect enhanced image specifically includes:

[0108] Based on the expected direction of the current image of the area to be detected, the average gray value of the gray image target is obtained;

[0109] Convert the image of the area to be detected into a grayscale image, and perform grayscale average stretching to obtain a grayscale image of the area to be detected;

[0110] Based on the grayscale image of the area to be detected, the grayscale image of the area to be detected is evenly divided into several sub-areas, and each pixel in each sub-area is power-converted according to the LUT lookup table to obtain the power-converted grayscale image of the area to be detected;

[0111] According to the power conversion of the gray value of each pixel in the gray image of the area to be detected, the average gray value of the gray image is calculated by the average gray value formula;

[0112] According to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, the brightness adjustment factor is determined, and the grayscale value of each pixel in the power conversion grayscale image of the area to be inspected is adjusted through the brightness adjustment formula to obtain a defect enhanced image;

[0113] The average gray value formula is:

[0114] In the formula, is the average grayscale value of the grayscale image, W is the image width, H is the image height, x and y are the pixel coordinates, is the gray value of the i-th row and j-th column in the area where the pixel is located;

[0115] The brightness adjustment formula is:

[0116] In the formula, The gray value of the i-th row and j-th column in the pixel area is adjusted. is the average gray value of the gray image target, is the brightness adjustment factor.

[0117] It should be noted that the target average grayscale value of the grayscale image is an expected value set in image processing to guide the process of image brightness adjustment. The brightness level of the original image is changed through the algorithm so that the average grayscale value of its pixels is close to this preset target value. The target value is set based on the expected direction. For example, if the expected direction is that the overall brightness of the image is darker, the final image adjustment will have a darker overall brightness, otherwise it will be brighter.

[0118] Reference Figure 3 As shown in the figure, based on the defect enhancement image, through binarization and morphological operations, the pixels in the abnormal area of ​​the image are excluded, and the image is repaired and filled to obtain the line defect detection image, which specifically includes:

[0119] Based on the image binarization operation, a global threshold is set to divide the defect enhancement image into black and white binary images to obtain a set of black and white binary images;

[0120] Using morphological opening and closing operations, the noise and connection breaks in the black and white binary image are removed, the connected areas are determined, and a unique label is assigned to each connected area.

[0121] Visualize each label of each connected area to obtain a blob area map;

[0122] According to the blob area image, noise suppression and deviation suppression are performed, and filling and patching processing is performed to obtain a line defect detection image;

[0123] Among them, the image binarization operation is specifically as follows:

[0124] In the formula, for Gray value at pixel coordinates, T is the global threshold, if If the gray value at the pixel coordinate is greater than T, the pixel is assigned 255 and classified as a white binary image. If the gray value at the pixel coordinate is less than T, the pixel is assigned 0 and classified as a black binary image;

[0125] Among them, the morphological opening and closing operations include:

[0126] In the formula, is a set of black and white binary images, B is a black and white binary image structure element, is the x, y pixel coordinates in the black and white binary image structure element, is the erosion operation of the morphological operation, The dilation operation is a morphological operation.

[0127] This solution uses image binarization and morphological opening and closing operations to effectively remove noise, connect breaks, improve the clarity of defective lines, and fill in missing areas, thereby improving the accuracy and reliability of subsequent defect detection.

[0128] Reference Figure 4 As shown, according to the line defect detection image, the linear defects in the bright and dark areas are determined, and the bright and dark defect features are enhanced, specifically including:

[0129] Create a one-dimensional projection matrix of the same size as the line defect inspection image;

[0130] Based on the addition and subtraction calculation of each pixel in the line defect detection image and the detection area image, the linear defect is taken as the foreground and the normal pixel point is taken as the background to obtain the linear defect binary image;

[0131] Using vertical edge summation, based on the linear defect binary image, the pixel values ​​in each x direction are summed in the y direction, and added to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional row projection matrix;

[0132] Using vertical edge summation, based on the linear defect binary image, the pixel values ​​in each y direction are summed in the x direction, and added to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional column projection matrix;

[0133] Based on the one-dimensional row projection matrix and the one-dimensional column projection matrix, the matrix is ​​filtered and feature enhanced through a filtering algorithm to obtain the bright and dark defect features;

[0134] Among them, the vertical edge summation algorithm expression is:

[0135] In the formula, is a one-dimensional row projection matrix, is a one-dimensional column projection matrix, is the pixel value of the jth column and the ith row in the linear defect binary image, is the pixel value of the i-th row and j-th column in the linear defect binary image, n is the total number of rows, and m is the total number of columns;

[0136] Among them, the filtering algorithm expression is:

[0137] In the formula, represents the value in the i-th row, represents the value in the jth column, min is the minimum function, max is the maximum function, is the filter kernel, is the size of the structure element of the filter;

[0138] This solution uses minimum and maximum filtering techniques to enhance line features in images, remove noise, and connect broken lines, thereby improving image quality and reducing interference for subsequent analysis and processing steps. By adjusting the size of the filter kernel, the algorithm can flexibly adapt to different image characteristics and application requirements, and achieve precise control of the range and degree of feature influence. It helps to achieve more accurate feature extraction and image segmentation, and optimizes the efficiency and accuracy of the entire image processing process.

[0139] Reference Figure 5 As shown in the figure, based on the enhanced bright and dark defect features, the RANSAC algorithm is used for fitting analysis to obtain the line defect difference map, which specifically includes:

[0140] The one-dimensional row projection matrix and the one-dimensional column projection matrix are divided according to the specified sub-areas, and pixel points are sampled according to the preset intervals. The sampled data are cleaned and screened by the principal component analysis method.

[0141] Based on the cleaned sampling data, the variance and covariance are calculated and combined into a covariance matrix;

[0142] Perform eigendecomposition based on the covariance matrix to obtain the eigenvector matrix and diagonal matrix;

[0143] Based on the rotation angle of the eigenvector matrix, the intercept is calculated using the slope calculation formula;

[0144] Based on the eigenvector matrix and the average value of the sampled data, the slope is calculated using the intercept formula;

[0145] Based on the RANSAC algorithm, fitting analysis is performed according to the slope and intercept to obtain the parameters of the fitting curve;

[0146] By traversing the pixel values ​​of the sub-regions, the fitting values ​​are calculated according to the parameters of the fitting curve to obtain a row fitting line set and a column fitting line set;

[0147] The row fitting line set is feature-fused with the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected;

[0148] The column fitting line set is feature-fused with the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected;

[0149] Among them, the variance and covariance of the one-dimensional row projection matrix and the one-dimensional column projection matrix are calculated as follows:

[0150] In the formula, is the average value of the pixels in the sampled data row, is the average value of the pixels in the sampled data column, , are the row variance and column variance, is the covariance, vxx, vxy, vyy are the eigenvalues ​​of the covariance matrix, and θ is the direction angle of the principal axis;

[0151] Among them, the row fitting line set and column fitting line set are specifically:

[0152] In the formula, is the intercept, is the slope, is the updated row fitting value, is the updated column fitted value, is the product of the slope and the x-row, is the product of the slope and the y row.

[0153] This solution provides a robust, accurate and flexible method for detecting and quantifying linear structural defects in images through image processing technology, sub-region segmentation, sampling, PCA cleaning, covariance matrix calculation, eigendecomposition, RANSAC fitting and feature fusion. It can handle noise and outliers, reveal the main components of the image, and generate intuitive difference maps to improve the detection accuracy of image line defects.

[0154] Reference Figure 6 As shown, based on a method for detecting line defects in industrial product defects, a system for detecting line defects in industrial product defects is proposed, including:

[0155] The module to be detected is used to obtain an image of the area to be detected;

[0156] A defect enhancement module, the defect enhancement module is electrically connected to the module to be detected, and the defect enhancement module is used to perform defect enhancement processing on the image of the area to be detected based on the image of the area to be detected to obtain a defect enhanced image;

[0157] An image processing module, the image processing module is electrically connected to the defect enhancement module, and the image processing module is used to exclude pixels in abnormal areas of the image through binarization and morphological operations based on the defect enhancement image, and to repair and fill the pixels to obtain a line defect detection image;

[0158] A feature analysis module, the feature analysis module is electrically connected to the image processing module, and is used to extract linear defects in bright and dark areas according to the line defect detection image, and obtain bright and dark defect features;

[0159] A difference map module, the difference map module is electrically connected to the feature analysis module, and the difference map module is used to obtain a line defect difference map by performing fitting analysis based on the bright and dark defect features through the RANSAC algorithm;

[0160] The defect judgment module is electrically connected to the difference map module. The defect judgment module is used to judge whether the lines in the line defect difference map are within the normal range based on the line defect difference map and the card control line threshold. If so, it is judged that there is no defect, otherwise, it is judged that there is a defect.

[0161] The defect enhancement module includes:

[0162] The target unit obtains the average gray value of the gray image target based on the expected direction of the current image of the area to be detected;

[0163] A grayscale conversion unit converts the image of the area to be detected into a grayscale image, and performs grayscale average stretching to obtain a grayscale image of the area to be detected;

[0164] A power conversion unit, based on the grayscale image of the area to be detected, evenly divides the grayscale image of the area to be detected into a plurality of sub-areas, and performs power conversion on each pixel in each sub-area according to the LUT lookup table to obtain a power conversion grayscale image of the area to be detected;

[0165] The average grayscale calculation unit calculates the average grayscale value of the grayscale image by the average grayscale value formula according to the grayscale value of each pixel in the grayscale image of the area to be detected according to the power conversion;

[0166] The defect enhancement unit determines the brightness adjustment factor according to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, and adjusts the grayscale value of each pixel in the power conversion grayscale image of the area to be detected through the brightness adjustment formula to obtain a defect enhanced image.

[0167] The image processing module includes:

[0168] The binary image collection unit sets a global threshold based on the image binarization operation, divides the defect enhancement image into black and white binary images, and obtains a black and white binary image collection;

[0169] The label assignment unit uses morphological opening and closing operations to remove noise and connection breaks in black and white binary images, determine connected areas, and assign a unique label to each connected area;

[0170] The region map unit visualizes each label of each connected region to obtain a blob region map;

[0171] The defect detection image unit performs noise suppression and deviation suppression according to the blob area image, and performs filling and patching processing to obtain a line defect detection image.

[0172] The feature analysis module includes:

[0173] A projection matrix unit, which creates a one-dimensional projection matrix of the same size as the line defect detection image;

[0174] The linear defect binary image unit performs addition and subtraction calculations based on each pixel in the linear defect detection image and the detection area image, takes the linear defect as the foreground and the normal pixel points as the background, and obtains the linear defect binary image;

[0175] The row projection matrix unit uses vertical edge summation to sum the pixel values ​​in each x direction in the y direction based on the linear defect binary image, and adds them to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional row projection matrix;

[0176] The column projection matrix unit uses vertical edge summation to sum the pixel values ​​in each y direction in the x direction based on the linear defect binary image, and adds them to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional column projection matrix;

[0177] The feature enhancement unit filters and enhances the features of the matrix based on the one-dimensional row projection matrix and the one-dimensional column projection matrix through a filtering algorithm to obtain the bright and dark defect features.

[0178] The difference map module internally includes:

[0179] A data cleaning unit divides the one-dimensional row projection matrix and the one-dimensional column projection matrix according to the specified sub-areas, samples the pixels according to the preset intervals, and cleans and screens the sampled data by principal component analysis;

[0180] The covariance matrix unit calculates the variance and covariance based on the cleaned sample data and combines them into a covariance matrix;

[0181] An eigendecomposition unit performs eigendecomposition based on the covariance matrix to obtain an eigenvector matrix and a diagonal matrix;

[0182] The intercept unit calculates the intercept based on the rotation angle of the eigenvector matrix using the slope calculation formula;

[0183] The slope unit calculates the slope based on the eigenvector matrix and the average value of the sampled data using the intercept formula;

[0184] The fitting curve unit, based on the RANSAC algorithm, performs fitting analysis according to the slope and intercept to obtain the parameters of the fitting curve;

[0185] The fitting unit traverses the pixel values ​​of the sub-regions, calculates the fitting values ​​according to the parameters of the fitting curve, and obtains a row fitting line set and a column fitting line set;

[0186] The row difference map unit performs feature fusion on the row fitting line set and the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected;

[0187] The column difference map unit performs feature fusion on the column fitting line set and the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected.

[0188] Step 1: Obtain the image of the area to be detected;

[0189] Step 2: Based on the expected direction of the current image of the area to be detected, obtain the average grayscale value of the grayscale image target;

[0190] Step 3: Convert the image of the area to be detected into a grayscale image, and perform grayscale average stretching to obtain a grayscale image of the area to be detected;

[0191] Step 4: Based on the grayscale image of the area to be detected, the grayscale image of the area to be detected is evenly divided into several sub-areas, and each pixel in each sub-area is power-converted according to the LUT lookup table to obtain the power-converted grayscale image of the area to be detected;

[0192] Step 5: According to the power conversion of the gray value of each pixel in the gray image of the area to be detected, the average gray value of the gray image is calculated by the average gray value formula;

[0193] Step 6: Determine the brightness adjustment factor according to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, and adjust the grayscale value of each pixel in the power conversion grayscale image of the area to be inspected by using the brightness adjustment formula to obtain a defect enhanced image;

[0194] Step 7: Based on the image binarization operation, a global threshold is set to divide the defect enhanced image into black and white binary images to obtain a set of black and white binary images;

[0195] Step 8: Use morphological opening and closing operations to remove noise and connection breaks in the black and white binary image, determine the connected areas, and assign a unique label to each connected area;

[0196] Step 9: Visualize each label of each connected area to obtain a blob area map;

[0197] Step 10: According to the blob area image, noise suppression and deviation suppression are performed, and filling and patching processing is performed to obtain a line defect detection image;

[0198] Step 11: Create a one-dimensional projection matrix of the same size as the line defect detection image;

[0199] Step 12: Perform addition and subtraction calculations based on each pixel in the line defect detection image and the detection area image, taking the line defect as the foreground and the normal pixel point as the background to obtain a line defect binary image;

[0200] Step 13: Using vertical edge summation, based on the linear defect binary image, sum the pixel values ​​in each x direction in the y direction, add them to the one-dimensional projection matrix according to the x and y pixel coordinates, and obtain a one-dimensional row projection matrix;

[0201] Step 14: Using vertical edge summation, based on the linear defect binary image, sum the pixel values ​​in each y direction in the x direction, add them to the one-dimensional projection matrix according to the x and y pixel coordinates, and obtain a one-dimensional column projection matrix;

[0202] Step 15: Based on the one-dimensional row projection matrix and the one-dimensional column projection matrix, the matrix is ​​filtered and feature enhanced by a filtering algorithm to obtain bright and dark defect features;

[0203] Step 16: Divide the one-dimensional row projection matrix and the one-dimensional column projection matrix according to the specified sub-regions, sample pixels according to the preset intervals, and clean and filter the sampled data by principal component analysis;

[0204] Step 17: Based on the cleaned sampling data, calculate the variance and covariance and combine them into a covariance matrix;

[0205] Step 18: Perform eigendecomposition based on the covariance matrix to obtain the eigenvector matrix and the diagonal matrix;

[0206] Step 19: Based on the rotation angle of the eigenvector matrix, calculate the intercept using the slope calculation formula;

[0207] Step 20: Calculate the slope based on the eigenvector matrix and the average value of the sampled data using the intercept formula;

[0208] Step 21: Based on the RANSAC algorithm, a fitting analysis is performed according to the slope and intercept to obtain the parameters of the fitting curve;

[0209] Step 22: By traversing the pixel values ​​of the sub-regions, the fitting values ​​are calculated according to the parameters of the fitting curve to obtain a row fitting line set and a column fitting line set;

[0210] Step 23: Perform feature fusion on the row fitting line set and the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected;

[0211] Step 24: Perform feature fusion on the column fitting line set and the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected;

[0212] Step 25 determines whether the lines in the line defect difference map are within a normal range based on the line defect difference map and the control line threshold. If so, it is determined that there is no defect; if not, it is determined that there is a defect.

[0213] In summary, the advantages of the present invention are: this solution, through image processing technology and robust algorithms, achieves high real-time and high accuracy detection of obvious and faint line defects in the luminous areas of display screen products in industrial manufacturing, has strong anti-interference ability, is suitable for line defect detection of various array lighting screens, and significantly improves the automation level and efficiency of product quality control.

[0214] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.

Claims

1. A method for detecting line defects in industrial product defects, characterized in that: include: Acquire an image of the area to be detected; Based on the image of the area to be inspected, defect enhancement processing is performed on the image of the area to be inspected to obtain a defect enhanced image; Based on the defect enhancement image, through binarization and morphological operations, the pixels in the abnormal area of ​​the image are excluded, and the image is filled and repaired to obtain the line defect detection image; According to the line defect detection image, the linear defects in the bright and dark areas are determined, and the characteristics of the bright and dark defects are enhanced; Based on the enhanced bright and dark defect features, the RANSAC algorithm is used for fitting analysis to obtain the line defect difference map; Based on the line defect difference map, the card control line threshold is used to determine whether the lines in the line defect difference map are within the normal range. If so, it is determined that there is no defect; if not, it is determined that there is a defect; According to the line defect detection image, the linear defects in the bright and dark areas are determined, and the characteristics of the bright and dark defects are enhanced, including: Create a one-dimensional projection matrix of the same size as the line defect inspection image; Based on the addition and subtraction calculation of each pixel in the line defect detection image and the detection area image, the linear defect is taken as the foreground and the normal pixel point is taken as the background to obtain the linear defect binary image; Using vertical edge summation, based on the linear defect binary image, the pixel values ​​in each x direction are summed in the y direction, and added to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional row projection matrix; Using vertical edge summation, based on the linear defect binary image, the pixel values ​​in each y direction are summed in the x direction, and added to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional column projection matrix; Based on the one-dimensional row projection matrix and the one-dimensional column projection matrix, the matrix is ​​filtered and feature enhanced through a filtering algorithm to obtain the bright and dark defect features; Among them, the vertical edge summation algorithm expression is: In the formula, is a one-dimensional row projection matrix, is a one-dimensional column projection matrix, is the pixel value of the jth column and the ith row in the linear defect binary image, is the pixel value of the i-th row and j-th column in the linear defect binary image, n is the total number of rows, and m is the total number of columns; Among them, the filtering algorithm expression is: In the formula, represents the value in the i-th row, represents the value in the jth column, min is the minimum function, max is the maximum function, is the filter kernel, is the size of the structure element of the filter; Based on the enhanced bright and dark defect features, the RANSAC algorithm is used for fitting analysis to obtain the line defect difference map, which specifically includes: The one-dimensional row projection matrix and the one-dimensional column projection matrix are divided according to the specified sub-areas, and pixel points are sampled according to the preset intervals. The sampled data are cleaned and screened by the principal component analysis method. Based on the cleaned sampling data, the variance and covariance are calculated and combined into a covariance matrix; Perform eigendecomposition based on the covariance matrix to obtain the eigenvector matrix and diagonal matrix; Based on the rotation angle of the eigenvector matrix, the intercept is calculated using the slope calculation formula; Based on the eigenvector matrix and the average value of the sampled data, the slope is calculated using the intercept formula; Based on the RANSAC algorithm, fitting analysis is performed according to the slope and intercept to obtain the parameters of the fitting curve; By traversing the pixel values ​​of the sub-regions, the fitting values ​​are calculated according to the parameters of the fitting curve to obtain a row fitting line set and a column fitting line set; The row fitting line set is feature-fused with the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected; The column fitting line set is feature-fused with the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected; Among them, the variance and covariance of the one-dimensional row projection matrix and the one-dimensional column projection matrix are calculated as follows: In the formula, is the average value of the pixels in the sampled data row, is the average value of the pixels in the sampled data column, , are the row variance and column variance, is the covariance, vxx, vxy, vyy are the eigenvalues ​​of the covariance matrix, and θ is the direction angle of the principal axis; Among them, the row fitting line set and column fitting line set are specifically: In the formula, is the intercept, is the slope, is the updated row fitting value, is the updated column fitted value, is the product of the slope and the x-row, is the product of the slope and the y row.

2. A method for detecting line defects in industrial product defects according to claim 1, characterized in that: Based on the image of the area to be inspected, defect enhancement processing is performed on the image of the area to be inspected, and obtaining the defect enhanced image specifically includes: Based on the expected direction of the current image of the area to be detected, the average gray value of the gray image target is obtained; Convert the image of the area to be detected into a grayscale image, and perform grayscale average stretching to obtain a grayscale image of the area to be detected; Based on the grayscale image of the area to be detected, the grayscale image of the area to be detected is evenly divided into several sub-areas, and each pixel in each sub-area is power-converted according to the LUT lookup table to obtain the power-converted grayscale image of the area to be detected; According to the power conversion of the gray value of each pixel in the gray image of the area to be detected, the average gray value of the gray image is calculated by the average gray value formula; According to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, the brightness adjustment factor is determined, and the grayscale value of each pixel in the power conversion grayscale image of the area to be inspected is adjusted through the brightness adjustment formula to obtain a defect enhanced image; The average gray value formula is: In the formula, is the average grayscale value of the grayscale image, W is the image width, H is the image height, x and y are the pixel coordinates, is the gray value of the i-th row and j-th column in the area where the pixel is located; The brightness adjustment formula is: In the formula, The gray value of the i-th row and j-th column in the pixel area is adjusted. is the average gray value of the gray image target, is the brightness adjustment factor.

3. A method for detecting line defects in industrial product defects according to claim 2, characterized in that: Based on the defect enhancement image, through binarization and morphological operations, the pixels in the abnormal area of ​​the image are excluded, and the image is filled and repaired to obtain the line defect detection image, which specifically includes: Based on the image binarization operation, a global threshold is set to divide the defect enhancement image into black and white binary images to obtain a set of black and white binary images; Using morphological opening and closing operations, the noise and connection breaks in the black and white binary image are removed, the connected areas are determined, and a unique label is assigned to each connected area. Visualize each label of each connected area to obtain a blob area map; According to the blob area image, noise suppression and deviation suppression are performed, and filling and patching processing is performed to obtain a line defect detection image; Among them, the image binarization operation is specifically as follows: In the formula, for Gray value at pixel coordinates, T is the global threshold, if If the gray value at the pixel coordinate is greater than T, the pixel is assigned 255 and classified as a white binary image. If the gray value at the pixel coordinate is less than T, the pixel is assigned 0 and classified as a black binary image; Among them, the morphological opening and closing operations include: In the formula, is a set of black and white binary images, B is a black and white binary image structure element, is the x, y pixel coordinates in the black and white binary image structure element, is the erosion operation of the morphological operation, The dilation operation is a morphological operation.

4. A line defect detection system based on industrial product defects, characterized in that: Used to implement a method for detecting line defects in industrial product defects as described in any one of claims 1 to 3, comprising: The module to be detected is used to obtain an image of the area to be detected; A defect enhancement module, the defect enhancement module is electrically connected to the module to be detected, and the defect enhancement module is used to perform defect enhancement processing on the image of the area to be detected based on the image of the area to be detected to obtain a defect enhanced image; An image processing module, the image processing module is electrically connected to the defect enhancement module, and the image processing module is used to exclude pixels in abnormal areas of the image through binarization and morphological operations based on the defect enhancement image, and to repair and fill the pixels to obtain a line defect detection image; A feature analysis module, the feature analysis module is electrically connected to the image processing module, and is used to extract linear defects in bright and dark areas according to the line defect detection image, and obtain bright and dark defect features; A difference map module, the difference map module is electrically connected to the feature analysis module, and the difference map module is used to obtain a line defect difference map by performing fitting analysis based on the bright and dark defect features through a RANSAC algorithm; The defect judgment module is electrically connected to the difference map module. The defect judgment module is used to judge whether the lines in the line defect difference map are within the normal range based on the line defect difference map and the card control line threshold. If so, it is judged that there is no defect, otherwise, it is judged that there is a defect.

5. A linear defect detection system based on industrial product defects according to claim 4, characterized in that: The defect enhancement module includes: The target unit obtains the average gray value of the gray image target based on the expected direction of the current image of the area to be detected; A grayscale conversion unit converts the image of the area to be detected into a grayscale image, and performs grayscale average stretching to obtain a grayscale image of the area to be detected; A power conversion unit, based on the grayscale image of the area to be detected, evenly divides the grayscale image of the area to be detected into a plurality of sub-areas, and performs power conversion on each pixel in each sub-area according to the LUT lookup table to obtain a power conversion grayscale image of the area to be detected; The average grayscale calculation unit calculates the average grayscale value of the grayscale image by the average grayscale value formula according to the grayscale value of each pixel in the grayscale image of the area to be detected according to the power conversion; The defect enhancement unit determines the brightness adjustment factor according to the average grayscale value of the grayscale image and the average grayscale value of the grayscale image target, and adjusts the grayscale value of each pixel in the power conversion grayscale image of the area to be detected through the brightness adjustment formula to obtain a defect enhanced image.

6. A linear defect detection system based on industrial product defects according to claim 4, characterized in that: The image processing module includes: The binary image collection unit sets a global threshold based on the image binarization operation, divides the defect enhancement image into black and white binary images, and obtains a black and white binary image collection; The label assignment unit uses morphological opening and closing operations to remove noise and connection breaks in black and white binary images, determine connected areas, and assign a unique label to each connected area; The region map unit visualizes each label of each connected region to obtain a blob region map; The defect detection image unit performs noise suppression and deviation suppression according to the blob area image, and performs filling and patching processing to obtain a line defect detection image.

7. The linear defect detection system based on industrial product defects according to claim 4 is characterized in that: The feature analysis module includes: A projection matrix unit, which creates a one-dimensional projection matrix of the same size as the line defect detection image; The linear defect binary image unit performs addition and subtraction calculations based on each pixel in the linear defect detection image and the detection area image, takes the linear defect as the foreground and the normal pixel points as the background, and obtains the linear defect binary image; The row projection matrix unit uses vertical edge summation to sum the pixel values ​​in each x direction in the y direction based on the linear defect binary image, and adds them to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional row projection matrix; The column projection matrix unit uses vertical edge summation to sum the pixel values ​​in each y direction in the x direction based on the linear defect binary image, and adds them to the one-dimensional projection matrix according to the x and y pixel coordinates to obtain a one-dimensional column projection matrix; The feature enhancement unit filters and enhances the features of the matrix based on the one-dimensional row projection matrix and the one-dimensional column projection matrix through a filtering algorithm to obtain the bright and dark defect features.

8. The linear defect detection system based on industrial product defects according to claim 4 is characterized in that: The difference map module internally includes: A data cleaning unit divides the one-dimensional row projection matrix and the one-dimensional column projection matrix according to the specified sub-areas, samples the pixels according to the preset intervals, and cleans and screens the sampled data by principal component analysis; The covariance matrix unit calculates the variance and covariance based on the cleaned sample data and combines them into a covariance matrix; An eigendecomposition unit performs eigendecomposition based on the covariance matrix to obtain an eigenvector matrix and a diagonal matrix; The intercept unit calculates the intercept based on the rotation angle of the eigenvector matrix using the slope calculation formula; The slope unit calculates the slope based on the eigenvector matrix and the average value of the sampled data using the intercept formula; The fitting curve unit, based on the RANSAC algorithm, performs fitting analysis according to the slope and intercept to obtain the parameters of the fitting curve; The fitting unit traverses the pixel values ​​of the sub-regions, calculates the fitting values ​​according to the parameters of the fitting curve, and obtains a row fitting line set and a column fitting line set; The row difference map unit performs feature fusion on the row fitting line set and the one-dimensional row projection matrix to obtain a difference map of row line defects of the image to be detected; The column difference map unit performs feature fusion on the column fitting line set and the one-dimensional column projection matrix to obtain a difference map of column line defects of the image to be detected.

Citation Information

Patent Citations

  • Liquid crystal screen defect detection method based on local pixel values

    CN104978748A

  • Multi-type defect detection system and method for glass panel

    CN114937003A

  • Image contrast enhancement method and apparatus, and device and storage medium

    WO2020038124A1