A method and system for visually detecting surface defects of quartz stone slabs
The method and system for quartz stone panel inspection utilize edge detection and gradient analysis to accurately differentiate between crack and pattern edges, addressing the misjudgment issues in traditional methods and enhancing defect detection accuracy.
Patent Information
- Application Number
- CN202411287121.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-09-13
AI Technical Summary
Traditional image detection algorithms for stone materials, such as quartz stone panels, struggle to accurately differentiate between normal patterns and defects due to similar color representations, leading to misjudgments in quality assessment.
A visual inspection method and system that employs edge detection, threshold segmentation, and gradient analysis to calculate features like roughness, curvature, and gray-scale entropy, generating a 'crack discrimination value' to distinguish between pattern and defect edges.
Enhances the accuracy of defect detection on quartz stone panels by evaluating the uniformity and curvature of edges, effectively differentiating between crack and pattern features, thereby improving the precision of surface inspection.
Smart Images

Figure CN119180803B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image detection technology, and in particular to a method and system for visually detecting surface defects of quartz stone slabs. Background Art
[0002] Quartz slabs are a new type of stone material that is artificially synthesized from more than 90% quartz crystals, resin and other trace elements. Quartz slabs have the advantages of wear resistance, fire resistance, acid and alkali resistance, and high hardness. They are widely used in the construction field for floor paving, wall decoration and kitchen countertops.
[0003] Quartz slabs may have various quality problems during the production process. In order to ensure that the quality of quartz slabs meets the standards, all slabs need to be inspected for physical properties, chemical properties, appearance, splicing performance, etc. when leaving the factory. When inspecting the appearance of the slabs, the main focus is on whether there are cracks on the surface of the slabs. There are some normal ribbon-like patterns on the quartz slabs, and the color of these normal patterns is similar to the cracks on the quartz slabs. In traditional image detection algorithms, only the color difference of the image is used for image detection, which is prone to misjudgment and cannot accurately detect the qualified status of the quartz slabs. Summary of the invention
[0004] In order to solve the above technical problems, the purpose of this application is to provide a method and system for visually detecting surface defects of quartz stone plates. The technical solutions adopted are as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for visually detecting surface defects of a quartz stone plate, the method comprising the following steps:
[0006] Get the grayscale image of the surface of the quartz slab;
[0007] Based on the edge detection algorithm and edge tracking algorithm, the edge feature points and edge contours of the grayscale image are obtained; based on the segmentation of the grayscale image after threshold segmentation and the distribution of the edge feature points, the target pixel segment of each edge feature point is obtained;
[0008] Based on the average discreteness of the number of pixels in the target pixel segment of each edge feature point on the edge contour and the difference between the pixels in the target pixel segment of the local edge feature point, the thickness uniformity of each edge contour is obtained;
[0009] Based on the gradient features of the edge feature points and the differences between the gradient features, the contour tortuosity of each edge contour is obtained; based on the average grayscale values of the target pixel segments of all edge feature points on the edge contour, the average grayscale sequence of the point segments of each edge contour is obtained;
[0010] Based on the average of the elements in the grayscale average sequence of the point segment and the uncertainty of the grayscale value in the target pixel point segment, the grayscale shape distinction of each edge contour is obtained; based on the thickness uniformity, contour tortuosity and grayscale shape distinction, the crack discrimination value of each edge contour is obtained;
[0011] Detect surface defects of quartz stone slabs based on crack discrimination values.
[0012] Furthermore, the edge contour is obtained by:
[0013] Use edge detection algorithm to process grayscale image to obtain edge feature points;
[0014] The edge tracking algorithm is used to process the edge feature points to obtain the edge contours.
[0015] Furthermore, the method for acquiring the target pixel segment is:
[0016] Use the threshold segmentation algorithm to obtain the optimal segmentation threshold of the grayscale image, and take the pixel points in the grayscale image whose grayscale value is less than the optimal segmentation threshold as the target pixel points;
[0017] For each row of pixels in the grayscale image, a region consisting of target pixels whose number of consecutively adjacent target pixels is greater than a preset constant is taken as a continuous target pixel segment;
[0018] For each edge feature point on each edge contour, a continuous target pixel segment adjacent to the edge feature point in the pixel row where the edge feature point is located in the grayscale image is used as the target pixel segment of each edge feature point.
[0019] Furthermore, the method for obtaining the thickness uniformity is:
[0020] The sequence consisting of the number of pixel points in the target pixel point segment of all edge feature points in each edge contour is used as the pixel number sequence of each edge contour;
[0021] Obtaining a first-order difference sequence of the pixel number sequence of each edge contour;
[0022] The calculation formula of the thickness uniformity is: In the formula, C i is the thickness uniformity of the i-th edge contour; h i is the pixel number sequence of the i-th edge contour; D() is the variance function; δ1 i,+ and δ1 i,- are pixel number sequences h i The number of data greater than 0 and the number of data less than 0 in the first half of the first-order difference sequence; δ2 i,+ and δ2 i,- are pixel number sequences hi The number of data greater than 0 and the number of data less than 0 in the second half of the first-order difference sequence; It is the preset parameter factor.
[0023] Further, the method for obtaining the contour tortuosity is:
[0024] Use edge detection algorithm to obtain the gradient direction of each edge feature point;
[0025] The calculation formula of the profile tortuosity is: L i =sum(|σ i |)+D(θ i );where L i is the contour tortuosity of the i-th edge contour; θ i is a sequence of gradient directions of all edge feature points in the i-th edge profile; σ i is the sequence θ i The first-order difference sequence of |σ i | is the sequence σ i is a sequence composed of the absolute values of each data in ; sum() is the sum function; D() is the variance function.
[0026] Furthermore, the method for obtaining the average grayscale sequence of the point segments is:
[0027] For each edge contour, a sequence consisting of average grayscale values of target pixel segments of all edge feature points on the edge contour is used as the average grayscale sequence of the segment of each edge contour.
[0028] Furthermore, the grayscale shape distinction is obtained by:
[0029] For the point segment grayscale average sequence of each edge contour, the first preset number of data in the point segment grayscale average sequence is used as the starting data of the point segment grayscale average sequence, and the last preset number of data is used as the end data of the point segment grayscale average sequence;
[0030] For each edge feature point of each edge contour, a sequence composed of the grayscale values of all pixels in the target pixel segment of the edge feature point is used as the target pixel grayscale sequence of each edge feature point; the information entropy of the target pixel grayscale sequence of each edge feature point of each edge contour is calculated, and the average value of the information entropy of the target pixel grayscale sequence of all edge feature points in the edge contour is used as the average information entropy of each edge contour;
[0031] The calculation formula of the grayscale shape distinction is: In the formula, K i is the grayscale shape distinction of the i-th edge contour; is the average grayscale sequence of the point segments of the i-th edge contour; is the average value of the starting data and the ending data in the grayscale average sequence of the i-th edge contour; is the average value of other data in the grayscale average sequence of the i-th edge contour, excluding the starting data and the ending data; exp is an exponential function with a natural constant as the base; is the average information entropy of the i-th edge profile; It is the preset parameter factor.
[0032] Furthermore, the method for obtaining the crack discrimination value is:
[0033] For each edge contour, the sum of the thickness uniformity and contour tortuosity of the edge contour is calculated, and the ratio of the sum to the grayscale shape distinction is used as the crack discrimination value of each edge contour.
[0034] Further, the detection of surface defects of the quartz stone plate based on the crack discrimination value includes:
[0035] The edge contour whose crack discrimination value is less than the preset crack discrimination threshold is taken as the crack contour;
[0036] Calculate the crack discrimination values of all edge contours in the grayscale image. If the crack discrimination values of all edge contours are greater than or equal to the crack discrimination threshold, the grayscale image does not contain crack defects; if the crack discrimination value of an edge contour is less than the crack discrimination threshold, the grayscale image contains crack defects.
[0037] In a second aspect, an embodiment of the present application further provides a quartz stone slab surface defect visual inspection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of any one of the above-mentioned methods when executing the computer program.
[0038] This application has at least the following beneficial effects:
[0039] Based on the uniformity of texture and the change information of connected domain width, the uniformity of thickness of each contour is constructed, and the uniformity of contour width at different positions on each contour is evaluated to distinguish the crack contour from the original contour on the quartz stone slab; based on the tortuosity of the contour, the contour tortuosity of each contour is constructed to distinguish the crack contour from the pattern contour; based on the grayscale distribution characteristics of the pattern and crack and the spot characteristics inside the connected domain, the grayscale shape distinction is constructed to distinguish the crack contour from the pattern contour; based on the above three indicators, the crack discrimination value is constructed to determine whether a contour is a crack contour or a pattern contour, and whether the image contains cracks is determined by judging whether the image contains crack contours; the detection accuracy of surface cracks in quartz stone slabs is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0041] Figure 1 A flowchart of a method for visually detecting surface defects of a quartz stone plate provided in one embodiment of the present application;
[0042] Figure 2 A schematic diagram of the difference in crack pattern contours provided for an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the following is a detailed description of a quartz stone plate surface defect visual detection method and system proposed in the present application, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0044] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0045] The following is a detailed description of a method and system for visually detecting surface defects of quartz stone slabs provided by the present application in conjunction with the accompanying drawings.
[0046] See also Figure 1 , which shows a flowchart of a method for visually detecting surface defects of a quartz stone plate provided by an embodiment of the present application, the method comprising the following steps:
[0047] Step S1, obtaining a grayscale image of the surface of a quartz stone plate.
[0048] The CMOS camera is fixed above the conveyor belt of the quartz stone production line to collect the surface image of the quartz stone on the conveyor belt. During the collection process, the light source is ensured to be stable and evenly illuminated on the surface of the quartz stone. The collected image is an RGB image. The median filter technology is used to remove the noise in the image. The median filter technology is a well-known technology and the specific process will not be repeated.
[0049] The filtered RGB image is converted into a grayscale image, and thus a grayscale image of the surface of the quartz stone slab is obtained.
[0050] Step S2, based on the edge detection algorithm and the edge tracking algorithm, obtain each edge feature point and each edge contour of the grayscale image; based on the segmentation of the grayscale image after the threshold segmentation algorithm, combined with the distribution of the edge feature points, obtain the target pixel segment of each edge feature point; based on the average discrete degree of the number of pixel points in the target pixel segment of each edge feature point on the edge contour and the difference between the pixel points in the target pixel segment of the local edge feature point, obtain the uniformity of the thickness of each edge contour; based on the gradient characteristics of the edge feature points and the difference between the gradient characteristics, obtain the contour tortuosity of each edge contour.
[0051] There are various patterns on the surface of quartz slabs, including ribbon-like and granular patterns. When inspecting defects on quartz slabs, it is easy to misdetect ribbon-like patterns as cracks or misjudge cracks as ribbon-like patterns because crack-like defects are similar to ribbon-like patterns. Further analysis distinguishes ribbon-like patterns from cracks. Among them, ribbon-like patterns are hereinafter referred to as patterns.
[0052] The gray value of each pixel in the gray image is used as the input of the image threshold segmentation algorithm to obtain the optimal segmentation threshold. Usually, the color of the pattern or crack is darker, and it is manifested as a pixel with a smaller gray value in the gray image. Therefore, the pixel whose gray value in the gray image is less than the optimal segmentation threshold is used as the target pixel. The target pixel contains pattern pixels and may also contain crack pixels. Among them, the image threshold segmentation algorithm includes a global threshold segmentation algorithm, an adaptive threshold segmentation algorithm, an Otsu threshold segmentation algorithm, etc. The present embodiment selects the Otsu threshold segmentation algorithm, wherein the Otsu threshold segmentation algorithm is a known technology, and this application will not repeat it in detail. The implementer can select other image segmentation algorithms according to actual conditions.
[0053] Furthermore, the grayscale image is used as the input of the edge detection algorithm, and the edges in the image are detected to obtain edge feature points and the gradient direction of each edge feature point; wherein the edge detection algorithm includes the Sobel edge detection algorithm, the Canny edge detection algorithm, the Prewitt edge detection algorithm, the Laplace edge detection algorithm, etc. In this embodiment, the Canny edge detection algorithm is selected as a well-known technology, and the specific process is not repeated here.
[0054] Furthermore, the edge feature point is used as the initial point of the edge tracking algorithm, and the eight neighborhood directions of the initial point are searched in a clockwise direction to obtain each edge contour. The edge tracking algorithm is a well-known technology, and the specific process is not repeated. In the edge contour, while it must contain a pattern contour, it may also contain a crack contour. Therefore, it is necessary to further distinguish the edge contour to determine whether the edge contour contains a crack contour.
[0055] Specifically, there will be coarser patterns and finer patterns on the quartz stone slabs, among which the thickness of a single pattern is relatively uniform; while the thickness of a single crack is uneven, with the middle area being coarser and the two end areas being finer, or one end being coarser and the other end being thinner. At the same time, the width of a single crack is smaller than the width of most single patterns.
[0056] For each row of pixels in the grayscale image, the area consisting of target pixels whose number of consecutive adjacent target pixels is greater than p is taken as a continuous target pixel segment. In this embodiment, the value of p is 3, and the implementer can select other values according to actual conditions.
[0057] For each edge feature point on each edge contour, the continuous target pixel segment adjacent to the edge feature point in the pixel row where the edge feature point is located in the grayscale image is used as the target pixel segment of each edge feature point. It should be noted that the target pixel segment adjacent to the edge feature point represents the area where the pattern or crack is located in the pixel row where the edge feature point is located.
[0058] The sequence consisting of the number of pixels in the target pixel segment of all edge feature points in the i-th edge contour is taken as the pixel number sequence h of the i-th edge contour i =[h i,1 ,h i,2 ,…,h i,n ] and calculate the first-order difference sequence of the pixel number sequence of the i-th edge contour.
[0059] If the edge contour is a crack contour, the pixel number sequence h of the contour i There are three trends in the change of: from small to large, from large to small, and first increasing and then decreasing. It should be noted that the sequence is divided into the first half and the second half because the characteristics of the crack area are: one end is thick and the other end is thin, or both ends are thick and the middle is thin. Whether it is a pattern or a crack, their shapes cannot be thick at both ends and thin in the middle. Therefore, there are three trends in the change of the sequence of the number of pixels of the crack outline.
[0060] Further, according to the above analysis, the pixel number sequence h i The first half and second half of the first-order difference sequence will show the following pattern: the data greater than 0 will be much more than the data less than 0, or the data less than 0 will be much more than the data greater than 0; if the edge contour is a pattern contour, then the pixel number sequence h of the contour i If the changing trend is relatively stable, then in the first-order difference sequence of the pixel number sequence, no matter in the first half or the second half of the data, the difference between the number of data greater than 0 and the number of data less than 0 is small.
[0061] According to the above analysis, the thickness uniformity of each edge contour is constructed to characterize whether the thickness of the region composed of the target pixel segments of all edge feature points of each edge contour is uniform. The calculation formula is: In the formula, C i is the thickness uniformity of the i-th edge contour; h i is the pixel number sequence of the i-th edge contour; D() is the variance function, which is used to calculate the variance of all elements in the input sequence; δ1 i,+ and δ1 i,- are pixel number sequences h i The number of data greater than 0 and the number of data less than 0 in the first half of the first-order difference sequence; δ2 i,+ and δ2 i,- are pixel number sequences h i The number of data greater than 0 and the number of data less than 0 in the second half of the first-order difference sequence; To preset the parameter adjustment factor and prevent the denominator from being 0, the value is 1 in this embodiment.
[0062] It should be noted that when the elements in the first-order difference sequence of the pixel number sequence are odd numbers and cannot be scored as the first half data and the second half data, the middle element in the first-order difference sequence and all the previous elements are divided into the first half data, and the data after the middle element is divided into the second half data.
[0063] It should be noted that when D(h i ) is larger, it represents the pixel data sequence h i The data difference in the i-th contour is relatively large, and the area composed of the target pixel segments representing all edge feature points of the i-th contour is more uneven; |δ1 i,+ -δ1 i,- | and |δ2 i,+ -δ2 i,- |The larger the size, the pixel data sequence h i The difference between the number of data greater than 0 and the number of data less than 0 in the first half and the second half of the first-order difference sequence of is large, which means that the i-th contour is more likely to be a crack contour; C i The smaller the value of , the more uneven the thickness of the region composed of the target pixel segments representing all edge feature points of the i-th contour, and the more likely the i-th contour is to be a crack contour.
[0064] Furthermore, since the edge of the crack is relatively smooth, the gradient direction of all edge feature points in the crack contour will be relatively consistent; while the edge of the pattern is relatively tortuous, the gradient direction of all edge feature points in the pattern will be relatively messy. Specifically, the schematic diagram of the difference between the crack pattern contours is as follows: Figure 2As shown, the dotted box 21 is the crack outline, and the outline 22 of the connected domain is the pattern outline. Compared with the gradient direction of the pixel points on the crack outline, the gradient direction of the pixel points on the pattern outline is more unevenly distributed. It should be noted that since quartz stone slabs often contain impurities of transition elements, different colors will appear in the crack area, resulting in the same color as the adjacent area, and there is a discontinuity between the crack outlines.
[0065] Based on the above analysis, the contour tortuosity is constructed to characterize the degree of tortuosity of each edge contour. The calculation formula is: L i =sum(|σ i |)+D(θ i );where L i is the contour tortuosity of the i-th edge contour; θ i is a sequence of gradient directions of all edge feature points in the i-th edge profile; σ i is the sequence θ i The first-order difference sequence of |σ i | is the sequence σ i is a sequence composed of the absolute values of each data in ; sum() is a summation function; D() is a variance function, which is used to calculate the variance of the input sequence.
[0066] It should be noted that when sum(|σ i |) is large, indicating that the gradient directions of the two adjacent edge feature points in the i-th contour are quite different, which means that the i-th contour is relatively tortuous; when D(θ i ) is large, which means that the gradient directions of all edge feature points in the i-th contour are quite different, which means that the i-th contour is relatively tortuous.
[0067] Step S3, based on the average grayscale values of the target pixel segments of all edge feature points on the edge contour, obtain the average grayscale sequence of the segment of each edge contour; based on the average of the elements in the average grayscale sequence of the segment and the uncertainty of the grayscale value in the target pixel segment, obtain the grayscale shape distinction of each edge contour; based on the thickness uniformity, contour tortuosity and grayscale shape distinction, obtain the crack discrimination value of each edge contour.
[0068] Furthermore, the overall color distribution of each pattern is relatively uniform, while the overall color of the cracks is darker in the middle and lighter at the ends.
[0069] For each edge contour, a sequence consisting of average grayscale values of target pixel segments of all edge feature points on the edge contour is used as the average grayscale sequence of the segment of each edge contour.
[0070] For each edge contour point segment grayscale average sequence, the first The data is used as the starting data of the grayscale average sequence of the segment. The data is used as the end data of the grayscale average sequence of the segment, n is the number of edge feature points in the edge profile, norm() is a rounding function, and the value of x in this embodiment is 8. The implementer can select other values according to the actual situation. If the edge profile is a crack profile, the value of the start data or the end data of the grayscale average sequence of the segment is larger.
[0071] Some patterns usually contain small granular spots, which are lighter in color and evenly distributed in the pattern area, while there are no small spots inside the cracks.
[0072] For each edge feature point of each edge contour, the sequence composed of the grayscale values of all pixels in the target pixel segment of the edge feature point is used as the target pixel grayscale sequence of each edge feature point. If the row of pixels where the edge feature point is located in the grayscale image contains small spots, then the information entropy of the target pixel grayscale sequence will be larger; the information entropy of the target pixel grayscale sequence of each edge feature point of each edge contour is calculated, and the average of the information entropy of the target pixel grayscale sequence of all edge feature points in the edge contour is used as the average information entropy of each edge contour.
[0073] Based on the above features, in order to characterize the grayscale changes between the target pixel segments of each edge feature point in each edge contour, the grayscale shape distinction of each contour is constructed, and the calculation formula is: In the formula, K i is the grayscale shape distinction of the i-th edge contour; is the average grayscale sequence of the point segments of the i-th edge contour; is the average value of the starting data and the ending data in the grayscale average sequence of the i-th edge contour; is the average value of other data in the grayscale average sequence of the i-th edge contour, excluding the starting data and the ending data; exp() is an exponential function with a natural constant as the base; is the average information entropy of the i-th edge profile; To preset the parameter adjustment factor and prevent the denominator from being 0, the value in this embodiment is 1.
[0074] It should be noted that The larger the value of is, the more likely the i-th edge contour is to be the contour of a crack with larger grayscale values at both ends and smaller grayscale value in the middle. The larger the value of K is, the more likely it is that the target pixel segment adjacent to the ith edge contour contains small spots, which means that the ith edge contour is more likely to be a pattern contour. i The larger the value of , the more likely the i-th edge contour is to be a crack contour.
[0075] Furthermore, in order to determine whether a contour is a crack contour, a crack discrimination value is constructed according to the thickness uniformity, contour tortuosity and grayscale shape distinction of the edge contour. The calculation formula is: In the formula, B i is the crack discrimination value of the i-th edge profile; C i is the thickness uniformity of the i-th edge contour, L i is the contour tortuosity of the i-th edge contour, K i is the grayscale shape distinction of the i-th edge contour.
[0076] It should be noted that the thickness uniformity C of the i-th edge contour i and profile tortuosity L i The smaller the value, the grayscale shape distinction K i The larger the value of is, the more likely the contour is a crack contour. i The smaller the value of , the more likely the i-th edge contour is a crack contour.
[0077] At this point, the crack discrimination value of each edge contour is obtained.
[0078] Step S4, detecting the surface defects of the quartz stone slabs based on the crack discrimination value, adjusting the direction of the conveyor belt, and separating the defective quartz stone slabs from the non-defective quartz stone slabs.
[0079] Furthermore, when the crack discrimination value B i When it is less than a preset crack discrimination threshold, the i-th edge contour is taken as a crack contour. In this embodiment, the preset crack discrimination threshold is set to 1.5.
[0080] Calculate the crack discrimination values of all edge contours in the grayscale image. If the crack discrimination values of all edge contours are greater than or equal to the preset crack discrimination threshold, the grayscale image does not contain crack defects; if the crack discrimination value of an edge contour is less than the preset crack discrimination threshold, the grayscale image contains crack defects.
[0081] When defect detection is performed on processed quartz slabs, the quartz slabs to be tested must first be placed on the conveyor belt on the assembly line. The CCD camera device fixed above the conveyor belt collects the surface image of the quartz slab, detects whether the quartz slab image contains crack defects, and sends a signal to the control system of the conveyor belt to control the conveying direction of the conveyor belt. If there is a crack defect, the quartz slab will be transported to the unqualified area; if there is no crack defect, the quartz slab will be transported to the qualified area.
[0082] Based on the same inventive concept as the above method, an embodiment of the present application also provides a quartz stone slab surface defect visual detection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the steps of any one of the above-mentioned quartz stone slab surface defect visual detection methods are implemented.
[0083] It should be noted that the above sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above is a description of a specific embodiment of this specification. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0084] The various embodiments in the present application are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0085] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for visually detecting surface defects of quartz stone plates, characterized in that: The method comprises the following steps: Get the grayscale image of the surface of the quartz slab; Based on the edge detection algorithm and edge tracking algorithm, the edge feature points and edge contours of the grayscale image are obtained; based on the segmentation of the grayscale image after threshold segmentation and the distribution of the edge feature points, the target pixel segment of each edge feature point is obtained; Based on the average discreteness of the number of pixels in the target pixel segment of each edge feature point on the edge contour and the difference between the pixels in the target pixel segment of the local edge feature point, the thickness uniformity of each edge contour is obtained; Based on the gradient features of the edge feature points and the differences between the gradient features, the contour tortuosity of each edge contour is obtained; based on the average grayscale values of the target pixel segments of all edge feature points on the edge contour, the average grayscale sequence of the point segments of each edge contour is obtained; Based on the average of the elements in the grayscale average sequence of the point segment and the uncertainty of the grayscale value in the target pixel point segment, the grayscale shape distinction of each edge contour is obtained; based on the thickness uniformity, contour tortuosity and grayscale shape distinction, the crack discrimination value of each edge contour is obtained; Detect surface defects of quartz stone slabs based on crack discrimination values; The method for obtaining the thickness uniformity is: The sequence consisting of the number of pixel points in the target pixel point segment of all edge feature points in each edge contour is used as the pixel number sequence of each edge contour; Obtaining a first-order difference sequence of the pixel number sequence of each edge contour; The calculation formula of the thickness uniformity is: In the formula, C i is the thickness uniformity of the i-th edge contour; h i is the pixel number sequence of the i-th edge contour; D() is the variance function; δ1 i,+ and δ1 i,- are pixel number sequences h i The number of data greater than 0 and the number of data less than 0 in the first half of the first-order difference sequence; δ2 i,+ and δ2 i,- are pixel number sequences h i The number of data greater than 0 and the number of data less than 0 in the second half of the first-order difference sequence; θ is the preset parameter adjustment factor; The method for obtaining the contour tortuosity is: Use edge detection algorithm to obtain the gradient direction of each edge feature point; The calculation formula of the profile tortuosity is: L i =sum(|σ i |)+D(θ i );where L i is the contour tortuosity of the i-th edge contour; θ i is a sequence of gradient directions of all edge feature points in the i-th edge profile; σ i is the sequence θ i The first-order difference sequence of |σ i | is the sequence σ i A sequence composed of the absolute values of each data in; sum() is the sum function; D() is the variance function; The grayscale shape distinction is obtained by: For the point segment grayscale average sequence of each edge contour, the first preset number of data in the point segment grayscale average sequence is used as the starting data of the point segment grayscale average sequence, and the last preset number of data is used as the end data of the point segment grayscale average sequence; For each edge feature point of each edge contour, a sequence composed of the grayscale values of all pixels in the target pixel segment of the edge feature point is used as the target pixel grayscale sequence of each edge feature point; the information entropy of the target pixel grayscale sequence of each edge feature point of each edge contour is calculated, and the average value of the information entropy of the target pixel grayscale sequence of all edge feature points in the edge contour is used as the average information entropy of each edge contour; The calculation formula of the grayscale shape distinction is: In the formula, K i is the grayscale shape distinction of the i-th edge contour; is the average grayscale sequence of the point segments of the i-th edge contour; is the average value of the starting data and the ending data in the grayscale average sequence of the i-th edge contour; is the average value of other data in the grayscale average sequence of the i-th edge contour, excluding the starting data and the ending data; exp is an exponential function with a natural constant as the base; is the average information entropy of the i-th edge profile; is the preset parameter adjustment factor; The method for obtaining the crack discrimination value is: For each edge contour, the sum of the thickness uniformity and contour tortuosity of the edge contour is calculated, and the ratio of the sum to the grayscale shape distinction is used as the crack discrimination value of each edge contour.
2. A method for visually detecting surface defects of a quartz stone plate as claimed in claim 1, characterized in that: The method for obtaining the edge contour is: Use edge detection algorithm to process grayscale image to obtain edge feature points; The edge tracking algorithm is used to process the edge feature points to obtain the edge contours.
3. A method for visually detecting surface defects of a quartz stone plate as claimed in claim 2, characterized in that: The method for acquiring the target pixel segment is: Use the threshold segmentation algorithm to obtain the optimal segmentation threshold of the grayscale image, and take the pixel points in the grayscale image whose grayscale value is less than the optimal segmentation threshold as the target pixel points; For each row of pixels in the grayscale image, a region consisting of target pixels whose number of consecutively adjacent target pixels is greater than a preset constant is taken as a continuous target pixel segment; For each edge feature point on each edge contour, a continuous target pixel segment adjacent to the edge feature point in the pixel row where the edge feature point is located in the grayscale image is used as the target pixel segment of each edge feature point.
4. A method for visually detecting surface defects of a quartz stone plate as claimed in claim 1, characterized in that: The method for obtaining the grayscale average sequence of the point segments is: For each edge contour, a sequence consisting of average grayscale values of target pixel segments of all edge feature points on the edge contour is used as the average grayscale sequence of the segment of each edge contour.
5. A method for visually detecting surface defects of a quartz stone plate as claimed in claim 1, characterized in that: The detection of surface defects of quartz stone plates based on crack discrimination values includes: The edge contour whose crack discrimination value is less than the preset crack discrimination threshold is taken as the crack contour; Calculate the crack discrimination values of all edge contours in the grayscale image. If the crack discrimination values of all edge contours are greater than or equal to the crack discrimination threshold, the grayscale image does not contain crack defects; if the crack discrimination value of an edge contour is less than the crack discrimination threshold, the grayscale image contains crack defects.
6. A quartz stone plate surface defect visual inspection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of a method for visually detecting surface defects of a quartz stone plate as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Quartz stone surface defect detection method, system and equipment based on machine vision
CN118279283A
Image processing method and apparatus, readable medium and electronic device
WO2021139372A1