Intermittent scribe detection method and system based on bidirectional region growing and curve fitting
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-23
- Publication Date
- 2026-08-11
AI Technical Summary
但其性能高度依赖于大规模高质量标注数据,在样本不足或多样性欠缺时易产生过拟合,且模型训练与推断过程计算成本较高,限制了在资源受限的工业场景中的应用
本发明通过划痕的尾部生长和头部生长提取双向区域生长划痕、通过划痕的尾部生长提取单向区域生长划痕,并通过拟合迭代曲线和去除离群点优化提取到的划痕得到有效划痕段,在此基础上通过端点延伸与方向一致性验证实现短划痕合并得到最终的断续划痕,实现了断续划痕的有效连接,在不同环境背景以及不同形态下提高划痕检测的完整性与准确率。
Smart Images

Figure CN122550459A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of liquid crystal panel scratch detection technology, and in particular to a method and system for detecting discontinuous scratches based on bidirectional region growth and curve fitting. Background Technology
[0002] LCD panels are prone to various defects during the manufacturing process, among which scratches are a common type of defect. Severe scratches can affect product quality and reliability, therefore, it is necessary to inspect LCD panels for scratches.
[0003] Traditional scratch detection methods rely on manual visual inspection, which suffers from low efficiency, fatigue, and poor consistency. To address these issues, existing technologies employ machine vision for automated inspection. Common machine vision techniques include morphological closing operations, frequency domain analysis, and deep learning. However, scratches on panel surfaces exhibit diverse morphologies, especially when they are discontinuous. Their appearance in images resembles point defects, making accurate identification and extraction difficult for machine vision, particularly when detecting discontinuous scratches, which presents the following limitations: 1. Morphological closing operations-based methods extract scratch points through preprocessing, and then use specific structuring elements to perform dilation and closing operations on these points to connect adjacent regions and fill gaps. However, this method has limited effectiveness when dealing with long-distance discontinuous structures. Multiple dilations can easily lead to distortion of scratch morphology, increased width, and potential misconnection of irrelevant regions. Furthermore, the structuring elements are difficult to adapt to scratches of different widths and curvatures and are quite sensitive to noise.
[0004] 2. Frequency domain analysis methods enhance scratch features in specific directions using techniques such as Fourier transform and Gabor filtering, and identify high-frequency components corresponding to discontinuous scratches in the frequency domain. However, discontinuous scratches exhibit dispersed energy in the frequency domain, making it difficult to form significant peaks. This results in difficulty in effectively distinguishing breakpoints from isolated noise, leading to insufficient detection robustness.
[0005] 3. Deep learning methods can automatically learn multi-level features from raw image data, possessing the ability to identify complex discontinuous patterns and infer the attribution of fracture intervals based on contextual information. However, their performance is highly dependent on large-scale, high-quality labeled data, and they are prone to overfitting when samples are insufficient or lack diversity. Furthermore, the computational cost of model training and inference is high, limiting their application in resource-constrained industrial scenarios. Summary of the Invention
[0006] Therefore, the technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a method and system for detecting discontinuous scratches based on bidirectional region growth and curve fitting, which can achieve stable detection of discontinuous scratch defects with different environmental backgrounds and different morphologies.
[0007] To address the aforementioned technical problems, this invention provides a method for detecting discontinuous scratches based on bidirectional region growing and curve fitting, comprising: The image of the liquid crystal panel to be detected is acquired and preprocessed. The preprocessing includes contour detection of the image and constructing a candidate point set of discontinuous scratches by calculating the centroid of the contour. For all candidate points in the candidate point set, the main scratch segments are extracted by the growth of the tail and head of the scratch. In the process of extracting the main scratch segments, the main scratch segments are optimized by fitting the iterative curve and removing outliers to obtain the effective scratch segments with bidirectional growth. Traverse the removed outliers and points that are not in the scratch in the candidate point set, extract points in the same scratch by the growth of the tail of the scratch, and optimize the extraction by the fitting iterative curve to obtain the effective scratch segment with unidirectional growth. By merging the effective scratch segments of bidirectional growth and unidirectional growth through endpoint extension and direction consistency verification, the final discontinuous scratch is obtained.
[0008] Furthermore, the preprocessing specifically includes: The image of the LCD panel to be tested is converted into a grayscale image, and a Gaussian filter is used to smooth the grayscale image. The smoothed image is converted into a binary image using an adaptive threshold segmentation algorithm, and contour detection is then performed on the binary image. Calculate the centroid of the contour, use all centroids as the candidate point set for the discontinuous scratch, and establish an access state marker matrix corresponding to the candidate point set. The access state marker matrix records the processing status of each candidate point in the candidate point set.
[0009] Furthermore, the extraction of the main scratch segments through tail and head growth of the scratches, and the optimization of the main scratch segments by fitting iterative curves and removing outliers during the extraction process to obtain effective scratch segments with bidirectional growth, includes: The main scratch segments are extracted by the tail growth and head growth of the scratch. The singular value decomposition least squares method is used to perform curve fitting on the points detected as the same scratch. At the same time, the fitting error is calculated based on the cumulative chord length. The fitting error includes the mean error, the mean square error and the standard deviation. The average error is judged. If the average error is less than the set threshold, the points on the scratch are considered to belong to the same scratch and a valid scratch segment with bidirectional growth is obtained. Otherwise, the mean square error is judged. When determining the mean square error, it is determined whether the mean square error is greater than a set threshold and whether there are any points whose fitting error is greater than multiple standard deviations. If so, outliers are considered to exist and are removed. After removing outliers, the process returns to re-execute the step of using singular value decomposition least squares to perform curve fitting on points detected as having the same scratch. Otherwise, it is considered that the order of the fitting is insufficient, resulting in a large fitting error. The polynomial order is increased, and the process returns to re-execute the step of using singular value decomposition least squares to perform curve fitting on points detected as having the same scratch. After the curve is refitted, the process returns to execute the step of determining the average error until the average error is less than a set threshold, thus obtaining a valid scratch segment with bidirectional growth.
[0010] Furthermore, the extraction of the main scratch segments through tail growth and head growth of the scratch includes: When extracting the scratch segment growing at the tail, for the currently growing scratch segment, the tangent direction of the end point of the detected scratch segment is used as the reference direction to search for candidate points that are spatially close to the end point; for each neighboring candidate point, the similarity between the candidate point and the scratch is judged by the consistency between the direction of the neighboring candidate point and the tangent direction of the end point, and the candidate point with high similarity is selected and incorporated into the tail of the current scratch segment. When extracting the scratch segment from the head, the tangent direction of the starting point after the scratch segment from the tail is extracted is used as the reference direction. Candidate points with high similarity are selected and incorporated into the head of the current scratch segment using the same method as when extracting the scratch segment from the tail.
[0011] Furthermore, the step of determining the similarity between candidate points and scratches by comparing the consistency of the directions of neighboring candidate points with the tangent direction of the end point, and selecting candidate points with high similarity to be incorporated into the tail of the current scratch segment, specifically involves: Calculate the distance score and direction score between the direction of each neighboring candidate point and the tangent direction of the end point. Combine the distance score and direction score to calculate the score for whether a candidate point belongs to the tail of the scratch: , In the formula, The score represents whether a candidate point belongs to the tail of a scratch, where α and β are preset coefficients. Rate the distance. Rate the direction; like If the threshold is exceeded, the current candidate point will be merged into the end of the current scratch segment.
[0012] Furthermore, the distance score and direction score are calculated as follows: , , In the formula, For distance scoring, e is the natural constant. Here, d is the distance decay coefficient, and d is the Euclidean distance between the current endpoint and the candidate point. The preset maximum connection distance; Rate the direction. The tangent direction at the current endpoint. The direction from the current endpoint to the candidate point. The direction sensitivity coefficient, This represents the dot product of vectors.
[0013] Furthermore, the step of using singular value decomposition least squares method to perform curve fitting on the detected points that belong to the same scratch includes: The cumulative chord length parameterization method assigns parameter values to each discrete point on the scratch, such that the chord length between two adjacent points is proportional to the cumulative length of the entire scratch curve. Specifically: The chord length between two adjacent points is calculated using the Euclidean distance formula. Starting from the starting point, the chord lengths of each segment are accumulated sequentially to obtain the cumulative chord length for each point: , In the formula, Let be the cumulative chord length at the k-th point. Let n be the chord length between the k-th point and the (k-1)-th point, and n be the total number of points. Calculate the total chord length of the entire scratch curve, normalize the cumulative chord length, and obtain the parameter value for each point: , ; In the formula, This refers to the parameter value at the k-th point; The design matrix is constructed based on the parameter values of each point as follows: , In the formula, A is the design matrix. express The j-th power, j=1,2,…,k1, where k1 is the highest power; The observation vector is constructed as follows: ; In the formula, Let x be a column vector consisting of the x-coordinates of all points. Let be a column vector consisting of the y-coordinates of all points. Let x be the x-coordinate of the k-th point in the image. Let be the y-coordinate of the k-th point in the image; Construct the singular value decomposition formula: , It is a left singular matrix. It is a diagonal matrix. Let T be a right singular matrix; The fitting coefficients are obtained by solving the singular value decomposition formula, and the polynomial fitting curve equation is obtained from the fitting coefficients.
[0014] Furthermore, the fitting coefficients obtained according to the singular value decomposition formula are: , ; In the formula, , These are the fitting coefficients. Let x be the r-th order coefficient of the polynomial. Let be the r-th order coefficients of the polynomial in y. Let V be the i-th column vector. Let U be the i-th column vector. for The i-th diagonal element, The order of the polynomial fitting is denoted by . Based on the fitting coefficients, the equation of the polynomial fitting curve is: , ; In the formula, Let t be the x-coordinate of the curve point corresponding to parameter t. Let y be the curve point corresponding to parameter t. Let x be the p-th order coefficient of the polynomial. Let be the p-th order coefficient of the polynomial in y, where p = 0, 1, ..., r.
[0015] Furthermore, the process of merging the effective scratch segments from bidirectional growth and unidirectional growth through endpoint extension and direction consistency verification to obtain the final discontinuous scratch includes: Traverse each effective scratch segment of bidirectional growth and effective scratch segment of unidirectional growth, check if there are any unconnected points near the start and end points, add unconnected points with consistent tangent directions to the start or end point of the existing scratch segment, and then perform iterative curve fitting again; finally, traverse all found scratch segments and merge them with other found scratch segments through various topological connection methods.
[0016] This invention also provides a discontinuous scratch detection system based on bidirectional region growth and curve fitting, comprising: Image acquisition module, used to acquire images of the LCD panel to be inspected; The candidate point set construction module is used to preprocess the liquid crystal panel image to be detected. The preprocessing includes contour detection of the image and constructing a candidate point set for discontinuous scratches by calculating the centroid of the contour. The bidirectional region scratch extraction module is used to extract the main scratch segments for all candidate points in the candidate point set by the growth of the tail and head of the scratch. In the process of extracting the main scratch segments, the main scratch segments are optimized by fitting the iterative curve and removing outliers to obtain the effective scratch segments with bidirectional growth. The unidirectional region scratch extraction module traverses the removed outliers and points determined not to be in the scratch in the candidate point set, extracts points in the same scratch by the growth of the scratch tail, and optimizes the extraction by the fitting iterative curve to obtain the effective scratch segment with unidirectional growth. The scratch merging module is used to merge the effective scratch segments that grow bidirectionally and those that grow unidirectionally by verifying endpoint extension and directional consistency, to obtain the final discontinuous scratch.
[0017] Compared with the prior art, the above-described technical solution of the present invention has the following advantages: This invention extracts bidirectional region-grown scratches by observing the growth at the tail and head of the scratch, and extracts unidirectional region-grown scratches by observing the growth at the tail of the scratch. It then optimizes the extracted scratches by fitting iterative curves and removing outliers to obtain effective scratch segments. Based on this, short scratches are merged to obtain the final discontinuous scratches through endpoint extension and direction consistency verification, thus achieving effective connection of discontinuous scratches and improving the integrity and accuracy of scratch detection under different environmental backgrounds and morphologies. Attached Figure Description
[0018] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein: Figure 1 This is a flowchart of a method in a preferred embodiment of the present invention.
[0019] Figure 2 This is an example image of the original image of the liquid crystal panel to be tested obtained in a preferred embodiment of the present invention.
[0020] Figure 3 The conversion obtained in the preferred embodiment of the present invention Figure 2 Example image of the corresponding binary image.
[0021] Figure 4 The diagram illustrates the specific steps of fitting the iterative curve and removing outliers in a preferred embodiment of the present invention.
[0022] Figure 5 This is an example diagram of the final discontinuous scratches obtained in a preferred embodiment of the present invention. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.
[0024] Reference Figure 1 As shown, this invention discloses a method for detecting discontinuous scratches based on bidirectional region growing and curve fitting, comprising the following steps: S1: Acquire an image of the liquid crystal panel to be detected and perform preprocessing. The preprocessing includes contour detection of the image and constructing a set of candidate points (i.e., data points) for discontinuous scratches by calculating the centroid of the contour.
[0025] S1-1: Acquire an image of the liquid crystal panel to be inspected.
[0026] S1-2: Convert the image of the LCD panel to be tested into a grayscale image, and use Gaussian filtering to smooth the grayscale image and suppress background noise.
[0027] S1-3: Convert the smoothed image into a binary image using an adaptive threshold segmentation algorithm to extract potential defect areas; Figure 2 This is an example image of the original image of the liquid crystal panel to be inspected. Figure 3 For the conversion Figure 2 Example image of the corresponding binary image. Contour detection is performed on the binary image, and preliminary screening is conducted based on contour area and aspect ratio.
[0028] S1-4: Calculate the centroid of the contour using the moments of the image, take all centroids as the candidate point set of the discontinuous scratch, and establish the access state marking matrix corresponding to the candidate point set. The access state marking matrix records the processing state of each candidate point in the candidate point set.
[0029] S2: For all candidate points in the candidate point set, the main scratch segments are extracted by bidirectional region growth control of scratch tail growth and head growth. In the process of extracting the main scratch segments, the effective scratch segments with bidirectional growth are obtained by fitting the iterative curve and removing outliers.
[0030] The detected scratch segments are iteratively fitted using the least squares method to remove outliers. The length of the scratch is calculated based on the fitted curve to determine if it is indeed a scratch; if not, these points are released. Figure 4 As shown, it includes:
[0031] S2-1: Extract the main scratch segments by the growth of the tail and head of the scratch. Use the Singular Value Decomposition (SVD) least squares method to perform curve fitting on the points detected as the same scratch. At the same time, calculate the fitting error based on the cumulative chord length. The fitting error includes the mean error, mean square error and standard deviation. The polynomial order of the initial curve fitting is 3.
[0032] Traverse all candidate points in the candidate point set. For candidate points that have not yet been assigned to any scratch segment (i.e., the corresponding access status is marked as unvisited), start a new scratch segment extraction process. That is, dynamically expand the scratch segment through bidirectional region growth control of scratch tail growth and head growth to ensure that both major and minor scratches are detected.
[0033] When extracting the scratch segment growing at the tail, for the currently growing scratch segment, the tangent direction of the end point of the detected scratch segment is used as the reference direction to search for candidate points that are spatially adjacent to the end point (the spatial proximity distance of the candidate points is adjusted according to the actual situation); for each candidate point, the similarity between the candidate point and the scratch is judged by the consistency between the direction of the candidate point and the tangent direction of the end point, and the candidate point with high similarity is selected and incorporated into the tail of the current scratch segment.
[0034] The similarity between candidate points and scratches is determined by the consistency between the directions of neighboring candidate points and the tangent direction of the end point. Candidate points with high similarity are selected and merged into the tail of the current scratch segment. Specifically:
[0035] The distance score and direction score between the direction of each neighboring candidate point and the tangent direction of the endpoint are calculated as follows: , , In the formula, For distance scoring, e is the natural constant. Here, d is the distance decay coefficient, and d is the Euclidean distance between the current endpoint and the candidate point. The preset maximum connection distance ( The value should be adjusted according to the actual situation. Rate the direction. This represents the tangent direction (unit vector) at the current endpoint. This is the direction (unit vector) from the current endpoint to the candidate point. The direction sensitivity coefficient, Represents the dot product of vectors;
[0036] The score for determining whether a candidate point belongs to the tail of the scratch is calculated by combining the distance score and the direction score: , In the formula, The score determines whether a candidate point belongs to the end of the scratch. α and β are preset coefficients used for weighted distance and direction scoring. α + β = 1; in this embodiment, α = 0.6 and β = 0.4. If the threshold is exceeded, the current candidate point will be merged into the end of the current scratch segment.
[0037] When extracting the scratch segment from the head, the tangent direction of the starting point after the scratch segment from the tail is extracted is used as the reference direction. Candidate points with high similarity are selected and incorporated into the head of the current scratch segment using the same method as when extracting the scratch segment from the tail.
[0038] Singular value decomposition least squares method is used to fit curves to points detected as belonging to the same scratch. Based on the cumulative chord length parameterization method, parameter values are assigned to each discrete point on the scratch, ensuring that the chord length between adjacent points is proportional to the cumulative length of the entire scratch curve to guarantee the stability of the fitting. Specifically: The chord length between two adjacent points is calculated using the Euclidean distance formula. Starting from the starting point, the chord lengths of each segment are accumulated sequentially to obtain the cumulative chord length for each point: , In the formula, Let be the cumulative chord length at the k-th point. Let n be the chord length between the k-th point and the (k-1)-th point, and n be the total number of points. Calculate the total chord length of the entire scratch curve, normalize the cumulative chord length to the [0,1] interval, and obtain the parameter value for each point: , ; In the formula, The parameter value at the k-th point (i.e., the normalized cumulative chord length parameter at the n-th point); The design matrix is constructed based on the parameter values of each point as follows: , In the formula, A is the design matrix. express The j-th power, j=1,2,…,k1, where k1 is the highest power, and the value of k1 is adjusted according to the actual situation; The observation vector is constructed as follows: ; In the formula, Let x be a column vector consisting of the x-coordinates of all points. Let be a column vector consisting of the y-coordinates of all points. Let x be the x-coordinate of the k-th point in the image. Let be the y-coordinate of the k-th point in the image; Construct the singular value decomposition formula: , It is a left singular matrix (representing rotations in the original space). It is a diagonal matrix (representing stretching and scaling). is a right singular matrix (representing a rotation in parameter space), and T is the transpose; The fitting coefficients, obtained using the singular value decomposition formula, are: , ; In the formula, , These are the fitting coefficients. Let x be the r-th order coefficient of the polynomial. Let be the r-th order coefficients of the polynomial in y. Let V be the i-th column vector (right singular vector). Let be the i-th column vector (left singular vector) of U. for The i-th diagonal element (singular value); i = 0, 1, ..., r, The order of the polynomial fitting is usually preset according to the degree of scratch curvature (e.g., r=3 or r=5); Based on the fitting coefficients, the equation of the polynomial fitting curve is: , ; In the formula, Let t be the x-coordinate of the curve point corresponding to parameter t. Let y be the curve point corresponding to parameter t. Let x be the p-th order coefficient of the polynomial. Let be the p-th order coefficient of the polynomial in y, where p = 0, 1, ..., r.
[0039] S2-2: Determine the average error. If the average error is less than the set threshold, the points on the scratch are considered to belong to the same scratch, and S2-5 is executed; otherwise, S2-3 is executed.
[0040] S2-3: When judging the mean square error, determine whether the mean square error is greater than the set threshold and whether there is a point fitting error greater than multiple standard deviations (in this embodiment, it is set to 3 standard deviations). If so, outliers are considered to exist and are removed. If the number of candidate outliers exceeds the preset threshold, only a certain percentage of the points with the largest errors are removed (to avoid removing too many at once). After removing outliers, return to S2-1 and re-execute the step of using singular value decomposition least squares method to curve fit the detected points that are the same scratch (order remains unchanged). Otherwise, it is considered that the fitting order is insufficient, resulting in a large fitting error. After increasing the polynomial order, return to S2-1 and re-execute the step of using singular value decomposition least squares method to perform curve fitting on the points detected as the same scratch. In this embodiment, the highest polynomial order is set to 8. If the error does not meet the stopping condition when the highest polynomial order is reached, these points are released, and it is considered that these points do not belong to the same scratch.
[0041] S2-4: After the curve is refitted, return to S2-2 and iterate continuously until the average error is less than the set threshold.
[0042] S2-5: Obtain effective scratch segments with bidirectional growth.
[0043] S3: Traverse the removed outliers and points that are not in the scratch in the candidate point set. Extract points in the same scratch by controlling the unidirectional region growth of the scratch tail. After extraction, optimize the unidirectional growth effective scratch segment by fitting the iterative curve.
[0044] S4: By verifying endpoint extension and directional consistency, merge the effective scratch segments of the bidirectional growth and the effective scratch segments of the unidirectional growth to obtain the following: Figure 5 The final discontinuous scratches are shown.
[0045] The process iterates through each bidirectional and unidirectional effective scratch segment, checking for unconnected points near the start and end points. Unconnected points with consistent tangent directions are added to the start or end point of existing scratch segments, and then the iterative curve fitting is performed again. Finally, all found scratch segments are traversed and merged with other found scratch segments using various topological connection methods. In this embodiment, there are four topological connection methods to adapt to complex scratch patterns: head-to-tail connection (standard connection), tail-to-head connection (reverse connection), head-to-head connection (reverse + connection), and tail-to-tail connection (reverse + connection).
[0046] This invention also discloses a discontinuous scratch detection system based on bidirectional region growing and curve fitting, comprising: Image acquisition module, used to acquire images of the LCD panel to be inspected; The candidate point set construction module is used to preprocess the liquid crystal panel image to be detected. The preprocessing includes contour detection of the image and constructing a candidate point set for discontinuous scratches by calculating the centroid of the contour. The bidirectional region scratch extraction module is used to extract the main scratch segments for all candidate points in the candidate point set by the growth of the tail and head of the scratch. In the process of extracting the main scratch segments, the main scratch segments are optimized by fitting the iterative curve and removing outliers to obtain the effective scratch segments with bidirectional growth. The unidirectional region scratch extraction module traverses the removed outliers and points determined not to be in the scratch in the candidate point set, extracts points in the same scratch by the growth of the scratch tail, and optimizes the extraction by the fitting iterative curve to obtain the effective scratch segment with unidirectional growth. The scratch merging module is used to merge the effective scratch segments that grow bidirectionally and those that grow unidirectionally by verifying endpoint extension and directional consistency, to obtain the final discontinuous scratch.
[0047] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a discontinuous scratch detection method based on bidirectional region growth and curve fitting.
[0048] The present invention also discloses an apparatus including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a discontinuous scratch detection method based on bidirectional region growth and curve fitting.
[0049] This invention extracts bidirectional region-grown scratches by observing the growth at the tail and head of the scratch, and extracts unidirectional region-grown scratches by observing the growth at the tail of the scratch. It then optimizes the extracted scratches by fitting iterative curves and removing outliers to obtain effective scratch segments. Based on this, short scratches are merged to obtain the final discontinuous scratches through endpoint extension and direction consistency verification, thus achieving effective connection of discontinuous scratches and improving the integrity and accuracy of scratch detection under different environmental backgrounds and morphologies.
[0050] Furthermore, this invention combines distance scoring and direction scoring mechanisms with iterative curve fitting to effectively connect discontinuous scratches, improving the accuracy of the connection. It can effectively solve the common problem of discontinuous scratch identification in industrial inspection. By combining geometric features and curve fitting technology, it can effectively process complex-shaped scratches while ensuring accuracy.
[0051] This invention has been applied in practice. Compared with existing methods based on morphological closing operations, this invention can improve the scratch recognition rate by 18% and reduce the false detection rate by about 25% in complex backgrounds.
[0052] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0053] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0054] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0055] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0056] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A method for detecting discontinuous scratches based on bidirectional region growing and curve fitting, characterized in that, include: The image of the liquid crystal panel to be detected is acquired and preprocessed. The preprocessing includes contour detection of the image and constructing a candidate point set of discontinuous scratches by calculating the centroid of the contour. For all candidate points in the candidate point set, the main scratch segments are extracted by the growth of the tail and head of the scratch. In the process of extracting the main scratch segments, the main scratch segments are optimized by fitting the iterative curve and removing outliers to obtain the effective scratch segments with bidirectional growth. Traverse the removed outliers and points that are not in the scratch in the candidate point set, extract points in the same scratch by the growth of the tail of the scratch, and optimize the extraction by the fitting iterative curve to obtain the effective scratch segment with unidirectional growth. By merging the effective scratch segments of bidirectional growth and unidirectional growth through endpoint extension and direction consistency verification, the final discontinuous scratch is obtained.
2. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 1, characterized in that: The preprocessing specifically includes: The image of the LCD panel to be tested is converted into a grayscale image, and a Gaussian filter is used to smooth the grayscale image. The smoothed image is converted into a binary image using an adaptive threshold segmentation algorithm, and contour detection is then performed on the binary image. Calculate the centroid of the contour, use all centroids as the candidate point set for the discontinuous scratch, and establish an access state marker matrix corresponding to the candidate point set. The access state marker matrix records the processing status of each candidate point in the candidate point set.
3. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 1, characterized in that: The process involves extracting the main scratch segments through tail and head growth of the scratches. During this extraction, the main scratch segments are optimized by fitting iterative curves and removing outliers to obtain effective scratch segments with bidirectional growth, including: The main scratch segments are extracted by the tail growth and head growth of the scratch. The singular value decomposition least squares method is used to perform curve fitting on the points detected as the same scratch. At the same time, the fitting error is calculated based on the cumulative chord length. The fitting error includes the mean error, the mean square error and the standard deviation. The average error is judged. If the average error is less than the set threshold, the points on the scratch are considered to belong to the same scratch and a valid scratch segment with bidirectional growth is obtained. Otherwise, the mean square error is judged. When determining the mean square error, it is determined whether the mean square error is greater than a set threshold and whether there are any points whose fitting error is greater than multiple standard deviations. If so, outliers are considered to exist and are removed. After removing outliers, the process returns to re-execute the step of using singular value decomposition least squares to perform curve fitting on points detected as having the same scratch. Otherwise, it is considered that the order of the fitting is insufficient, resulting in a large fitting error. The polynomial order is increased, and the process returns to re-execute the step of using singular value decomposition least squares to perform curve fitting on points detected as having the same scratch. After the curve is refitted, the process returns to execute the step of determining the average error until the average error is less than a set threshold, thus obtaining a valid scratch segment with bidirectional growth.
4. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 1, characterized in that: The extraction of the main scratch segments through tail and head growth of the scratches includes: When extracting the scratch segment growing at the tail, for the currently growing scratch segment, the tangent direction of the end point of the detected scratch segment is used as the reference direction to search for candidate points that are spatially close to the end point; for each neighboring candidate point, the similarity between the candidate point and the scratch is judged by the consistency between the direction of the neighboring candidate point and the tangent direction of the end point, and the candidate point with high similarity is selected and incorporated into the tail of the current scratch segment. When extracting the scratch segment from the head, the tangent direction of the starting point after the scratch segment from the tail is extracted is used as the reference direction. Candidate points with high similarity are selected and incorporated into the head of the current scratch segment using the same method as when extracting the scratch segment from the tail.
5. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 4, characterized in that: The similarity between candidate points and scratches is determined by the consistency between the directions of neighboring candidate points and the tangent direction of the end point. Candidate points with high similarity are selected and incorporated into the tail of the current scratch segment. Specifically: Calculate the distance score and direction score between the direction of each neighboring candidate point and the tangent direction of the end point. Combine the distance score and direction score to calculate the score for whether a candidate point belongs to the tail of the scratch: , In the formula, The score represents whether a candidate point belongs to the tail of a scratch, where α and β are preset coefficients. Rate the distance. Rate the direction; like If the threshold is exceeded, the current candidate point will be merged into the end of the current scratch segment.
6. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 5, characterized in that: The distance score and direction score are calculated as follows: , , In the formula, For distance scoring, e is the natural constant. Here, d is the distance decay coefficient, and d is the Euclidean distance between the current endpoint and the candidate point. The preset maximum connection distance; Rate the direction. The tangent direction at the current endpoint. The direction from the current endpoint to the candidate point. The direction sensitivity coefficient, This represents the dot product of vectors.
7. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 3, characterized in that: The step of using singular value decomposition least squares method to perform curve fitting on detected points that belong to the same scratch includes: The cumulative chord length parameterization method assigns parameter values to each discrete point on the scratch, such that the chord length between two adjacent points is proportional to the cumulative length of the entire scratch curve. Specifically: The chord length between two adjacent points is calculated using the Euclidean distance formula. Starting from the starting point, the chord lengths of each segment are accumulated sequentially to obtain the cumulative chord length for each point: , In the formula, Let be the cumulative chord length at the k-th point. Let n be the chord length between the k-th point and the (k-1)-th point, and n be the total number of points. Calculate the total chord length of the entire scratch curve, normalize the cumulative chord length, and obtain the parameter value for each point: , ; In the formula, This refers to the parameter value at the k-th point; The design matrix is constructed based on the parameter values of each point as follows: , In the formula, A is the design matrix. express The j-th power, j=1,2,…,k1, where k1 is the highest power; The observation vector is constructed as follows: ; In the formula, Let x be a column vector consisting of the x-coordinates of all points. Let be a column vector consisting of the y-coordinates of all points. Let x be the x-coordinate of the k-th point in the image. Let be the y-coordinate of the k-th point in the image; Construct the singular value decomposition formula: , It is a left singular matrix. It is a diagonal matrix. Let T be a right singular matrix; The fitting coefficients are obtained by solving the singular value decomposition formula, and the polynomial fitting curve equation is obtained from the fitting coefficients.
8. The discontinuous scratch detection method based on bidirectional region growth and curve fitting according to claim 7, characterized in that: The fitting coefficients obtained according to the singular value decomposition formula are: , ; In the formula, , These are the fitting coefficients. Let x be the r-th order coefficient of the polynomial. Let be the r-th order coefficients of the polynomial in y. Let V be the i-th column vector. Let U be the i-th column vector. for The i-th diagonal element, The order of the polynomial fitting is denoted by . Based on the fitting coefficients, the equation of the polynomial fitting curve is: , ; In the formula, Let t be the x-coordinate of the curve point corresponding to parameter t. Let y be the curve point corresponding to parameter t. Let x be the p-th order coefficient of the polynomial. Let be the p-th order coefficient of the polynomial in y, where p = 0, 1, ..., r.
9. The discontinuous scratch detection method based on bidirectional region growing and curve fitting according to any one of claims 1-8, characterized in that: The process of merging the effective scratch segments from bidirectional growth and unidirectional growth through endpoint extension and directional consistency verification yields the final discontinuous scratch, including: Traverse each effective scratch segment of bidirectional growth and effective scratch segment of unidirectional growth, check if there are any unconnected points near the start and end points, add unconnected points with consistent tangent directions to the start or end point of the existing scratch segment, and then perform iterative curve fitting again; finally, traverse all found scratch segments and merge them with other found scratch segments through various topological connection methods.
10. A discontinuous scratch detection system based on bidirectional region growing and curve fitting, characterized in that, include: Image acquisition module, used to acquire images of the LCD panel to be inspected; The candidate point set construction module is used to preprocess the liquid crystal panel image to be detected. The preprocessing includes contour detection of the image and constructing a candidate point set for discontinuous scratches by calculating the centroid of the contour. The bidirectional region scratch extraction module is used to extract the main scratch segments for all candidate points in the candidate point set by the growth of the tail and head of the scratch. In the process of extracting the main scratch segments, the main scratch segments are optimized by fitting the iterative curve and removing outliers to obtain the effective scratch segments with bidirectional growth. The unidirectional region scratch extraction module traverses the removed outliers and points determined not to be in the scratch in the candidate point set, extracts points in the same scratch by the growth of the scratch tail, and optimizes the extraction by the fitting iterative curve to obtain the effective scratch segment with unidirectional growth. The scratch merging module is used to merge the effective scratch segments that grow bidirectionally and those that grow unidirectionally by verifying endpoint extension and directional consistency, to obtain the final discontinuous scratch.