An automated grading method and system for construction lumber
By analyzing the continuous distribution and grayscale features of grayscale images of wood surfaces, a clustering algorithm is used to filter burr areas and adjust the segmentation threshold, which solves the problem of inaccurate burr segmentation in existing technologies and achieves more accurate wood grading detection.
Patent Information
- Application Number
- CN202511120621.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-08-12
AI Technical Summary
Existing wood grading detection technologies do not fully consider the complex texture characteristics of the wood surface, resulting in inaccurate burr threshold segmentation and extraction, which affects the accuracy of grading detection.
By acquiring grayscale images of the wood surface, analyzing the continuous distribution index and grayscale distribution frequency of pixels, and using a clustering algorithm to filter out normal areas and suspected burr areas, and combining fiber confidence and feature pixels, adjusting the initial segmentation threshold to perform iterative threshold segmentation, the burr area is accurately segmented.
The segmentation accuracy of the burr area on the wood surface and the accuracy of quality assessment are improved, ensuring the accuracy of wood grading detection.
Smart Images

Figure CN120635073B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of region division, and particularly relates to an automatic grading detection method and system for building timber. BACKGROUND
[0002] Timber needs to be processed through multiple processes from raw materials to meet the actual construction engineering scene requirements, burrs refer to small protrusions or irregular fibers formed on the surface of the timber after cutting, which usually reduces the appearance, texture and processing performance of the timber. Therefore, deburring the cutting surface of the timber is an important process in the timber processing process.
[0003] In the existing timber grading detection technology, the complex texture characteristics of the timber surface are not fully considered, and other characteristic factors such as texture depressions existing on the timber surface are not excluded during analysis, resulting in low accuracy when performing threshold segmentation and extraction on the burrs on the timber surface. At this time, the grading detection accuracy is not high in the automatic grading detection process of the building timber. SUMMARY
[0004] In order to solve the technical problem that the accuracy is relatively low when performing threshold segmentation and extraction on the burrs on the timber surface in the prior art, and thus the quality evaluation of the burrs on the timber surface is inaccurate, the purpose of the present application is to provide an automatic grading detection method and system for building timber, and the technical solution adopted is as follows:
[0005] The present application provides an automatic grading detection method for building timber, which comprises:
[0006] Obtaining a timber surface gray image; obtaining a continuous distribution index of each pixel point in the timber surface gray image according to the continuous change degree of the gray value of each pixel point in different preset directions;
[0007] Clustering the pixel points according to the gray distribution frequency, gray value and continuous distribution index of each pixel point in the timber surface gray image to obtain a cluster; screening out normal area cluster and burr suspected area cluster according to the gray distribution in the cluster; obtaining the fiber confidence of each pixel point in the burr suspected area cluster according to the gray value change complexity of each pixel point in the preset neighborhood range; updating and merging all burr suspected area clusters according to the fiber confidence to obtain a burr area cluster;
[0008] Obtaining feature pixel points in the burr area cluster and the normal area cluster; obtaining an initial segmentation threshold according to the position distribution of the feature pixel points in the burr area cluster and the normal area cluster in the cluster, and the gray value of the feature pixel points; obtaining the burr area in the timber surface gray image by iterative threshold segmentation through the initial segmentation threshold;
[0009] The quality is evaluated by the burr area in the wood surface gray image.
[0010] Further, the method for obtaining the continuous distribution index comprises:
[0011] For any pixel point in the wood surface gray image, each preset direction is sequentially taken as a detection direction, and a preset detection number of pixel points successively adjacent to the pixel point on a straight line corresponding to the detection direction are taken as detection pixel points of the pixel point in the detection direction;
[0012] An average value of the gray values of all the detection pixel points of the pixel point in the detection direction is calculated to obtain an average gray value of the pixel point in the detection direction; and a difference between the gray value of the pixel point and the average gray value is taken as a difference degree value of the pixel point in the detection direction;
[0013] A gray difference between the pixel point and each detection pixel point is calculated to obtain a gray difference value of the pixel point in the detection direction; and a sum value of all the gray difference values of the pixel point in the detection direction is taken as a gray change value of the pixel point in the detection direction;
[0014] A product of the difference degree value and the gray change value of the pixel point in the detection direction is negatively correlated and normalized to obtain a change continuity of the pixel point in the detection direction;
[0015] The change continuities of the pixel point in each preset direction are multiplied and normalized to obtain a continuous change degree of the pixel point; and a product of the continuous change degree of the pixel point and a preset range adjustment value is calculated to obtain a continuous distribution index of the pixel point; the preset range adjustment value is a positive number.
[0016] Further, the method for obtaining the clustering cluster comprises:
[0017] An occurrence probability of the gray value corresponding to each pixel point in all the pixel points in the wood surface gray image is taken as a gray distribution frequency of each pixel point;
[0018] The gray distribution frequency, the gray value and the continuous distribution index of the pixel point are mapped into a three-dimensional space coordinate system to obtain a distribution coordinate of each pixel point; and a clustering algorithm based on division is used to cluster the pixel points according to the distribution coordinates to obtain a clustering cluster.
[0019] Further, the method for screening out a normal area clustering cluster and a burr suspected area clustering cluster according to the gray distribution in the clustering cluster comprises:
[0020] An average value of the gray values in the two clustering clusters with the largest number of pixel points is calculated to obtain a clustering cluster gray average value; and a clustering cluster with the largest clustering cluster gray average value in the two clustering clusters is taken as the normal area clustering cluster;
[0021] The other clustering clusters except the two clustering clusters with the largest number of pixel points are taken as to-be-determined clustering clusters; a clustering cluster gray average value of each to-be-determined clustering cluster is obtained;
[0022] When the clustering cluster gray average value is greater than the clustering cluster gray average value of the normal region clustering cluster, the corresponding clustering cluster is taken as a burr suspected region clustering cluster.
[0023] Further, the fiber confidence value obtaining method comprises:
[0024] For any one pixel point in any burr suspected region clustering cluster, a difference between gradient direction values of the pixel point and each other pixel point in a corresponding preset neighborhood range is calculated to obtain a gradient difference value between the pixel point and the corresponding other pixel point; an accumulated value of gradient difference values between the pixel point and all other pixel points in the corresponding preset neighborhood range is taken as a gradient feature value of the pixel point;
[0025] An average value of gray values of all other pixel points in the corresponding preset neighborhood range of the pixel point is calculated to obtain a local average value corresponding to the pixel point; a difference between the gray value and the local average value of the pixel point is taken as a gray change feature value of the pixel point;
[0026] A product of the gradient feature value and the gray change feature value of the pixel point is negatively correlated and normalized to obtain a fiber confidence value of the pixel point.
[0027] Further, the burr region clustering cluster obtaining method comprises:
[0028] When the fiber confidence value of the pixel point in the burr suspected region clustering cluster is greater than a preset fiber threshold value, the corresponding pixel point is taken as a fiber pixel point;
[0029] The fiber pixel points in each burr suspected region clustering cluster are screened out to obtain new burr suspected region clustering clusters, and all the new burr suspected region clustering clusters are merged as burr region clustering clusters.
[0030] Further, the method for obtaining the feature pixel points in the burr region clustering cluster and the normal region clustering cluster comprises:
[0031] The pixel point with the smallest gray value in the normal region clustering cluster is taken as a feature pixel point corresponding to the normal region clustering cluster; and the pixel point with the largest gray value in the burr region clustering cluster is taken as a feature pixel point corresponding to the burr region clustering cluster.
[0032] Further, the initial segmentation threshold value obtaining method comprises:
[0033] Obtaining the average distance between the pixel points in the normal region clustering cluster as the distribution distance of the normal region clustering cluster;
[0034] Taking the feature pixel points in the normal region clustering cluster as target pixel points in sequence, calculating the distance between the target pixel points and the centroid as the deviation distance of the target pixel points; taking the ratio of the deviation distance of the target pixel points and the average radius of the normal region clustering cluster as the deviation index of the target pixel points;
[0035] Calculating the distance between each other pixel point in the normal region clustering cluster and the target pixel point, and arranging the other pixel points according to the distance from small to large to obtain a distance sequence; taking the first preset number of pixel points in the distance sequence as the local pixel points of the target pixel points; taking the distance between the target pixel points and each local pixel point as the neighbor distance, calculating the average value of the neighbor distances between the target pixel points and all local pixel points to obtain the neighbor average value of the target pixel points; taking the difference between the neighbor average value of the target pixel points and the distribution distance as the distribution index of the target pixel points;
[0036] Normalizing the product of the distribution index and the deviation index of the target pixel points to obtain the local adjustment weight of the target pixel points; taking the product of the local adjustment weight and the gray value of the target pixel points as the local adjustment value corresponding to the target pixel points; taking the average value of the local adjustment values of all feature pixel points in the normal region clustering cluster as the adjustment value of the normal region clustering cluster;
[0037] According to the adjustment value of the normal region clustering cluster, the adjustment value of the burr region clustering cluster is obtained;
[0038] Adding the gray value and the adjustment value of the feature pixel points corresponding to the normal region clustering cluster to obtain the feature gray value of the normal region clustering cluster; taking the difference between the gray value and the adjustment value of the feature pixel points corresponding to the burr region clustering cluster as the feature gray value of the burr region clustering cluster;
[0039] Calculating the average value of the feature gray values corresponding to the burr region clustering cluster and the normal region clustering cluster to obtain the initial segmentation threshold.
[0040] Further, the quality evaluation through the burr region in the wood surface gray image comprises:
[0041] Taking the ratio of the total number of pixel points in the burr region and the total number of pixel points in the wood surface gray image as the quality level index;
[0042] When the quality level index is greater than or equal to the preset quality threshold, the quality of the corresponding wood cutting surface is recorded as unqualified; when the quality level index is less than the preset quality threshold, the quality of the corresponding wood cutting surface is recorded as qualified.
[0043] The application provides an automatic grading detection system for building timber, comprising a memory and a processor, wherein the processor executes a calculation program stored in the memory to realize an automatic grading detection method for building timber.
[0044] The application has the following beneficial effects:
[0045] The application takes into account the complex characteristics of the pixel point distribution of different regions on the surface of the timber, adds the feature of the continuity of the distribution of the pixel points in different directions, clusters the pixel points in combination with the gray scale distribution frequency and the gray scale value, and obtains clustering clusters representing different regions, so as to more accurately segment the required regions. According to the different characteristics of the gray scale distribution characteristics of different regions, the normal region clustering cluster and the burr suspected region clustering cluster are screened out. Since the pixel points of the fiber points and the burr part of the timber itself are relatively similar in the gray scale distribution characteristics, there are also fiber points that do not belong to the burr in the burr suspected region clustering cluster. Further, the fiber confidence is obtained according to the gray scale change complexity of each pixel point in the preset neighborhood range in the burr suspected region clustering cluster, the burr region clustering cluster is obtained by updating and merging the fiber confidence of the pixel points that are fiber points, so that the credibility of the burr region clustering cluster is higher, so as to distinguish the accurate burr region subsequently. The initial segmentation threshold value can be set according to the judgment of the gray scale value of the normal region clustering cluster and the burr region clustering cluster. However, since the gray scale values in the clustering clusters fluctuate to a certain extent, it is necessary to select the feature pixel points that can be judged in the gray scale first, and further consider the representative degree of the feature pixel points in the clustering cluster, that is, adjust the corresponding gray scale value to obtain the initial segmentation threshold value. At this time, the initial segmentation threshold value is more credible, and the segmentation effect is more accurate, and further, more accurate burr regions are obtained by iterative threshold segmentation to perform quality evaluation. The application adjusts the segmentation threshold value by combining the distribution characteristics of the pixel points corresponding to different regions on the surface of the timber, so that the burr region extracted by segmentation is more accurate, and further, the quality evaluation of the burr on the surface of the timber is more accurate. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, and the advantages thereof, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0047] Figure 1 A flow chart of an automatic grading detection method for building timber provided by an embodiment of the application;
[0048] Figure 2A detection pixel point schematic diagram provided by one embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to further illustrate the technical means and effects taken by the present application to achieve the predetermined object of the application, the following describes in detail the specific implementation, structure, features and effects of the automatic grading detection method and system for building timber according to the present application, in combination with the preferred embodiments and the drawings. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.
[0051] The specific scheme of the automatic grading detection method and system for building timber provided by the present application is described in detail below in combination with the drawings.
[0052] An embodiment of the automatic grading detection method and system for building timber:
[0053] Please refer to Figure 1 which shows the flow chart of the automatic grading detection method for building timber provided by one embodiment of the present application, which includes the following steps:
[0054] S1: Obtain a wood surface gray scale image; and obtain a continuous distribution index of each pixel point according to the continuous variation degree of the gray scale value of each pixel point in the wood surface gray scale image in different preset directions.
[0055] In the embodiment of the present application, a high-definition camera is arranged on the production line after wood cutting to collect images of the wood cutting surface, and the collection is illuminated by a light board to ensure that the target cutting surface can present more details. The wood surface gray scale image is obtained by image preprocessing of the collected image, wherein the image preprocessing process can specifically include image gray scale processing, filter denoising processing and background removal processing. It should be noted that the image preprocessing process is a well-known technical means to those skilled in the art, and specific methods such as gray scale weighting, bilateral filter denoising and background difference can be selected for gray scale, filter denoising and background removal, which will not be described here.
[0056] In the analysis of the surface of the wood board after cutting, the surface of the wood board can be roughly divided into the following regions, namely, the texture region, the concave region, the normal wood surface region and the burr region. The burr is a small and sharp protrusion formed in the process of cutting or processing the wood, which is usually located on the surface of the wood board after cutting. Compared with the gray value of the normal region of the surface of the wood board, the burr region usually has a higher gray value, because the burr is a protruding part of the surface of the wood board, which usually reflects more light. The texture of the wood board is related to the growing environment and the type of the tree of the raw material of the wood board, which usually forms a gradually changing stripe on the surface of the wood board. Compared with the gray value of the burr and the normal region of the wood board, the gray value of the texture region is generally lower. Similarly, because the surface of the wood board may also have a concave region due to processing or other reasons, the gray value of the concave region and the color of the texture of the wood board also present a darker region on the surface of the wood board, but the difference between them is the difference in shape.
[0057] In order to be not affected by other regions when extracting the burr region, clustering analysis can be performed according to the characteristics of the pixel points. In order to obtain more accurate clustering regions, the continuous distribution characteristics of each pixel point are added for analysis in combination with the different continuous distribution conditions of the pixel points in different regions. For example, the gray difference of the pixel points in the normal region of the wood board is relatively small, and the continuity thereof is also good. The texture on the wood board often forms a stripe, and the continuity thereof is second to that of the normal region of the wood board. For the small concave region of the wood board, the gray difference of the pixel points at the edge or in the internal region thereof is relatively large, and the continuity of the corresponding pixel points is poor. Similarly, the continuity of the burr point on the wood board is also poor due to its isolated characteristics. Therefore, the continuous distribution index of each pixel point is obtained according to the continuous variation degree of the gray value of each pixel point in the wood surface gray image in different preset directions.
[0058] Preferably, for any pixel point in the wood surface gray image, all the pixel points are subjected to the same analysis, and each preset direction is sequentially taken as a detection direction. The left and right continuous adjacent preset detection number of pixel points on the straight line corresponding to the detection direction of the pixel point are taken as the detection pixel points of the pixel point in the detection direction. In the embodiment of the present application, the preset directions are the horizontal direction, the vertical direction, the 45-degree diagonal direction and the 135-degree diagonal direction, and the preset detection number is set to 3, which can be adjusted by the implementer according to the specific implementation, which is not limited herein. Please refer to Figure 2, which shows a schematic diagram of a pixel detection provided by an embodiment of the present invention, wherein E represents the pixel point, the detection direction is the horizontal direction, and the three pixel points on the left and right of the corresponding straight line of the pixel point E in the horizontal direction are used as the detection pixel points of the pixel point E, that is, E1, E2, E3, E4, E5, and E6 are all the detection pixel points of the pixel point E in the horizontal direction, wherein E1, E2, and E3 are the three pixel points on the right of the pixel point E, and E4, E5, and E6 are the three pixel points on the left of the pixel point E.
[0059] Furthermore, the average grayscale value of all detection pixels of the pixel in the detection direction is calculated to obtain the average grayscale value of the pixel in the detection direction. The average grayscale value is used to reflect the overall grayscale distribution in the detection direction. The difference between the grayscale value of the pixel and the average grayscale value is used as the difference degree value of the pixel in the detection direction. The degree of difference is used to reflect the degree of grayscale deviation of the pixel in the detection direction.
[0060] Calculate the grayscale difference between the pixel and each detection pixel as the grayscale difference value of the pixel in the detection direction. Each grayscale difference value reflects the grayscale change between the pixel and each detection pixel. The sum of all grayscale difference values of the pixel in the detection direction is taken as the grayscale change value of the pixel in the detection direction. The grayscale change value reflects the overall change degree of the pixel in the detection direction.
[0061] The product of the difference value and the grayscale change value of the pixel point in the detection direction is negatively correlated and normalized to obtain the change continuity of the pixel point in the detection direction. The change continuity reflects the grayscale continuity of the pixel point in the detection direction. In this embodiment of the present invention, the specific expression of change continuity is:
[0062]
[0063] Where, Expressed as The pixel at the Continuity of changes in all directions, Expressed as The gray value of a pixel, Expressed as The pixel at the The average gray value in each direction, Expressed as the The total number of detection pixels in each direction, Expressed as The pixel at the The corresponding The gray value of the detection pixel, Expressed as the absolute value extraction function, Expressed as an exponential function with a natural constant as base.
[0064] in, Expressed as The pixel at the The difference value in each direction, Expressed as The pixel and the The corresponding The grayscale difference value of the detection pixel points, Expressed as The pixel at the Grayscale change values in each direction. When the difference value is smaller, the grayscale change value is smaller, indicating that the grayscale distribution is more continuous, and the continuity of the change is greater. It should be noted that all data involved in the calculation in the embodiments of the present invention have been dedimensionalized. Technical means for dedimensionalizing numerical values by those skilled in the art, such as normalization, will not be described in detail later.
[0065] Furthermore, the continuity of the change of the pixel point in each preset direction is cumulatively multiplied and normalized to obtain the continuous change degree of the pixel point. The continuous change degree can characterize the grayscale continuity of the pixel point. In order to facilitate the distinction and reflection of the continuous change feature in the cluster, the embodiment of the present invention adjusts the range of the continuous change degree, calculates the product of the continuous change degree of the pixel point and the preset range adjustment value, and obtains the continuous distribution index of the pixel point. In the embodiment of the present invention, the specific expression of the continuous distribution index is:
[0066]
[0067] Where, Expressed as The continuous distribution index of pixels, Expressed as The pixel at the Continuity of changes in all directions, Expressed as the total number of preset directions, Indicates the preset range adjustment value, It is represented by the multiplication symbol, It is represented as a normalization function. It should be noted that normalization is a technical means well known to those skilled in the art. The normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here.
[0068] in, It is expressed as the cumulative multiplication of the continuity of changes in each preset direction, Expressed as In the embodiment of the present invention, the preset range adjustment value is a positive number, and the preset range adjustment value is set to 100 to amplify the continuous change degree. The specific value can be adjusted by the implementer according to the specific implementation situation.
[0069] At this point, the analysis of the continuous distribution characteristics of each pixel is completed, and the continuous distribution index of each pixel is obtained.
[0070] S2: Cluster the pixels according to the grayscale distribution frequency, grayscale value and continuous distribution index of each pixel in the grayscale image of the wood surface to obtain clusters; screen out normal area clusters and burr suspected area clusters according to the grayscale distribution in the clusters; obtain the fiber confidence of each pixel in each burr suspected area cluster according to the complexity of the grayscale changes of each pixel in each burr suspected area cluster within the preset neighborhood range; update and merge all burr suspected area clusters according to the fiber confidence to obtain the burr area cluster.
[0071] The pixels can be classified according to their characteristics to obtain clusters for each area. The grayscale value, grayscale frequency and continuous distribution index are combined for comprehensive clustering. The pixels are clustered according to the grayscale distribution frequency, grayscale value and continuous distribution index of each pixel in the grayscale image of the wood surface to obtain clusters.
[0072] Preferably, the probability of occurrence of the grayscale value corresponding to each pixel in the grayscale image of the wood surface is used as the grayscale distribution frequency of each pixel. The grayscale distribution frequency can reflect the amount of information of the pixel in the grayscale image of the wood surface. In the embodiment of the present invention, the expression of the grayscale distribution frequency is:
[0073]
[0074] Where, Expressed as The grayscale distribution frequency of each pixel, Represented as the grayscale image of the wood surface The number of pixels corresponding to the same gray value is It is expressed as the total number of pixels in the grayscale image of the wood surface.
[0075] The gray scale distribution frequency, the gray scale value and the continuous distribution index of the pixel points are mapped to a three-dimensional coordinate system to obtain distribution coordinates of each pixel point. In the embodiment of the present application, the x-axis of the three-dimensional coordinate system represents the gray scale value of the pixel point, the y-axis represents the gray scale distribution frequency of the pixel point, and the z-axis represents the continuous distribution index. The distribution coordinates corresponding to the pixel points represent the characteristic positions of the pixel points, and the pixel points belonging to the same characteristic region are closer in distribution position. Therefore, a clustering algorithm based on division is used to cluster the pixel points according to the distribution coordinates, and a clustering cluster is obtained. In the embodiment of the present application, a K-means clustering algorithm is used to cluster the pixel points based on the spatial distribution of the pixel points, and the best clustering number of the clustering is calculated by using the silhouette coefficient. It should be noted that the mapping of the three-dimensional coordinate system, the K-means clustering algorithm and the method of obtaining the best clustering number by the silhouette coefficient are all well-known technical means to those skilled in the art, and other clustering algorithms based on division such as hierarchical clustering can also be selected, which will not be described here.
[0076] The pixel points corresponding to different clustering clusters correspond to different regions. Since the segmentation is based on the normal region and the burr region, the two types of clustering clusters are selected, and the normal region clustering cluster and the burr suspected region clustering cluster are screened out according to the gray scale distribution in the clustering cluster.
[0077] Preferably, considering that the pixel points distributed most widely on the wood cutting surface correspond to normal region pixel points and texture region pixel points, the average value of the gray scale values in the two clustering clusters with the largest number of pixel points is first calculated as the clustering cluster gray scale average value, and based on the feature that the gray scale value of the texture region is darker than that of the normal region, the clustering cluster with the largest clustering cluster gray scale average value in the two clustering clusters is taken as the normal region clustering cluster.
[0078] Further, the other clustering clusters except the two clustering clusters with the largest number of pixel points are taken as the to-be-determined clustering clusters, that is, the other clustering clusters after excluding the normal region clustering cluster and the texture region clustering cluster with the largest number of pixel points. The clustering cluster gray scale average value of each to-be-determined clustering cluster is obtained, and when the clustering cluster gray scale average value is greater than the clustering cluster gray scale average value of the normal region clustering cluster, it is indicated that the corresponding clustering cluster may correspond to a burr region rather than a recessed region with defects, and the corresponding clustering cluster is taken as a burr suspected region clustering cluster.
[0079] The pixel points of the wood board burr region are higher in brightness than the normal region. Since the thickness degree of the wood board burr and the attachment degree of the wood board surface are inconsistent, the shape is also inconsistent. When the burr pixel points are clustered, the pixel points are divided into several small clusters. Therefore, the clustering clusters of the burr suspected region can be preliminarily distinguished by the gray value in the clustering cluster, and there are multiple burr suspected region clustering clusters. However, the fibers on the wood board may also cause relatively bright points on the wood board. Unlike the burr, the fiber is present in the wood itself, and the shape is more regular, generally presenting a straight line.
[0080] Therefore, the fiber confidence of each pixel point in the burr suspected region clustering cluster is obtained according to the gray value change complexity of each pixel point in the preset neighborhood range.
[0081] Preferably, for any pixel point in any burr suspected region clustering cluster, the same analysis is performed on each pixel point, the difference between the gradient direction value of the pixel point and each other pixel point in the corresponding preset neighborhood range is calculated, the gradient difference value between the pixel point and the corresponding other pixel point is obtained, the difference between the gradient direction reflects whether the local pixel point is a regularly distributed region, and the cumulative value of the gradient difference values between the pixel point and all other pixel points in the corresponding preset neighborhood range is taken as the gradient feature value of the pixel point, and the consistency of the local shape distribution of the pixel point is reflected by the comprehensive gradient feature value.
[0082] In the embodiment of the present application, the preset neighborhood range is an eight-neighborhood range, and the implementer can adjust it according to the specific implementation. The gradient direction value is obtained by converting the corresponding gradient direction of each pixel point into the gradient direction value in the radian system, so as to facilitate subsequent calculation. It should be noted that the gradient direction can be obtained by using a Sobel operator, and the Sobel operator and the radian system conversion are both known technical means to those skilled in the art, and will not be described here.
[0083] The average value of the gray values of all other pixel points in the preset neighborhood range corresponding to the pixel point is calculated to obtain the local average value corresponding to the pixel point. The difference between the gray value of the pixel point and the local average value is taken as the gray value change feature value of the pixel point, and the consistency of the local gray distribution of the pixel point is reflected by the gray value change feature value.
[0084] The product of the gradient eigenvalue of the pixel point and the grayscale change eigenvalue is negatively correlated and normalized to obtain the fiber confidence of the pixel point. The grayscale value and shape are comprehensively analyzed. In the embodiment of the present invention, the specific expression of the fiber confidence is:
[0085]
[0086] Where, Indicated as the first cluster in the burr suspected area cluster The fiber confidence of each pixel, Indicated as the first cluster in the burr suspected area cluster The gradient direction value of each pixel, Indicated as the first cluster in the burr suspected area cluster The pixel point corresponds to the The gradient direction values of other pixels, Indicated as the first cluster in the burr suspected area cluster The total number of all other pixels in the preset neighborhood corresponds to each pixel point. Indicated as the first cluster in the burr suspected area cluster The gray value of a pixel, Indicated as the first cluster in the burr suspected area cluster The pixel point corresponds to the Grayscale values of other pixels, Expressed as the absolute value extraction function, Expressed as an exponential function with a natural constant as base.
[0087] in, Indicated as the first cluster in the burr suspected area cluster The pixel point corresponds to the preset neighborhood The gradient difference between other pixels, Indicated as the first cluster in the burr suspected area cluster The gradient eigenvalue of each pixel, Indicated as the first cluster in the burr suspected area cluster The local average value of pixels, Indicated as the first cluster in the burr suspected area cluster The grayscale change eigenvalue of each pixel point. When the gradient eigenvalue is smaller, the grayscale change eigenvalue is smaller, indicating that the complexity of the corresponding pixel point in gradient change and grayscale change is low and consistent, and the pixel point is more likely to be a fiber point. Therefore, the fiber confidence is greater. All burr suspected area clusters can be updated and merged according to the fiber confidence to obtain the burr area cluster.
[0088] Preferably, when the fiber confidence of the pixel point in the burr suspected area clustering cluster is greater than the preset fiber threshold value, it is indicated that the corresponding pixel point is most likely to be a normal fiber point, and the corresponding pixel point is taken as a fiber pixel point. The fiber pixel points in the burr suspected area clustering cluster are screened out, and the remaining pixel points are pixel points corresponding to the burr area, a new burr suspected area clustering cluster is obtained, and all new burr suspected area clustering clusters are combined as a burr area clustering cluster for subsequent analysis between regions combined with the two kinds of clustering cluster representations. The updating process is the process of screening out the fiber pixel points. In the embodiment of the present application, the preset fiber threshold value is set to 0.8, and the implementer can adjust it according to the specific implementation.
[0089] At this point, the burr area clustering cluster capable of clearly representing the burr area and the normal area clustering cluster are obtained, and the initial segmentation threshold value can be obtained according to the gray level between the two clustering clusters.
[0090] S3: obtaining feature pixel points in the burr area clustering cluster and the normal area clustering cluster; obtaining an initial segmentation threshold value according to the position distribution of the feature pixel points in the burr area clustering cluster and the normal area clustering cluster in the clustering cluster and the gray value of the feature pixel points; and obtaining the burr area in the wood surface gray image through iterative threshold segmentation of the initial segmentation threshold value.
[0091] Because in the traditional iterative threshold segmentation, the initial segmentation threshold value is often selected as the maximum and minimum gray values of the pixel points in the background and the target, that is, in the embodiment of the present application, the maximum and minimum gray values in the two clustering clusters can be selected to obtain, but the gray value of the selected pixel point cannot well represent the overall gray situation of the two types of pixel points of the target and the background. When the representativeness of the selected region is weak, the error caused by the selection of the initial threshold value is easily magnified in the subsequent iterative segmentation process, and the calculation amount in the segmentation process is increased. Therefore, the selected pixel point needs to be adjusted according to the representative degree.
[0092] First, the feature pixel points in the burr area clustering cluster and the normal area clustering cluster are obtained. In an embodiment of the present application, the pixel point with the minimum gray value in the normal area clustering cluster is taken as the feature pixel point corresponding to the normal area clustering cluster, and the pixel point with the maximum gray value in the burr area clustering cluster is taken as the feature pixel point corresponding to the burr area clustering cluster. It should be noted that there can be multiple pixel points corresponding to the gray value, so the number of feature pixel points can be multiple. In other embodiments of the present application, the pixel point corresponding to the average value of the gray value in the clustering cluster can also be taken as the feature pixel point of the clustering cluster, which is not limited herein, but the adjustment and correction methods corresponding to different selection methods are not the same.
[0093] Since the feature pixel points selected by different regions are different, the directions to be adjusted are also different, because the selection of the feature pixel points all reflects the selection of the extreme value of a gray value in the clustering cluster, when the representativeness of the feature pixel point corresponding to the normal region clustering cluster is weaker, the gray value of the corresponding feature pixel point only needs to be adjusted to a larger direction, and when the representativeness of the feature pixel point corresponding to the burr region clustering cluster is weaker, the gray value of the corresponding feature pixel point only needs to be adjusted to a smaller direction.
[0094] Further, according to the position distribution of the feature pixel points in the clustering cluster and the gray value of the feature pixel points in the burr region clustering cluster and the normal region clustering cluster, an initial segmentation threshold is obtained. Preferably, the centroid and the average radius of the normal region clustering cluster are obtained, and the average distance between the pixel points in the normal region clustering cluster is taken as the distribution distance of the normal region clustering cluster. In the embodiment of the present application, the calculation of the distribution distance is that the distances between all the pixel points in the normal region clustering cluster are calculated, and the average value is taken as the distribution distance. The distribution distance can be used to measure the closeness between the pixel points in a cluster, that is, when the distribution distance is smaller, it indicates that the pixel points in the cluster are closer. It should be noted that the centroid, the average radius and the distance between the pixel points of the clustering cluster are all known to those skilled in the art, and will not be described here.
[0095] In turn, the feature pixel points in the normal region clustering cluster are taken as target pixel points, the distance between the target pixel point and the centroid is calculated as the deviation distance of the target pixel point, the deviation distance represents the deviation degree of the target pixel point from the centroid, and the ratio of the deviation distance of the target pixel point to the average radius of the normal region clustering cluster is taken as the deviation index of the target pixel point. Since the centroid in the clustering cluster is often more representative, the average radius reflects the overall distribution dispersion of the clustering cluster, therefore, the deviation index reflects the similarity between the distribution dispersion of the target pixel point and the overall distribution dispersion of the clustering cluster.
[0096] The distance between each other pixel point and the target pixel point in the normal region clustering cluster is calculated, and the other pixel points are arranged according to the order from small to large to obtain a distance sequence, and the first preset number of pixel points in the distance sequence are taken as the local pixel points of the target pixel point. In the embodiment of the present application, the preset number is set to 5, and the specific value can be adjusted by the implementer according to the specific embodiment. Here, the distance sequence is used to obtain the local pixel points of the target pixel point, and the nearest 5 pixel points are taken for local distribution analysis.
[0097] The distance between the target pixel and each local pixel is taken as the nearest neighbor distance, and the average of the nearest neighbor distances between the target pixel and all local pixels is calculated to obtain the nearest neighbor average of the target pixel. The nearest neighbor average reflects the local distribution density of the target pixel and the local pixel. The difference between the nearest neighbor average and the distribution distance of the target pixel is taken as the distribution index of the target pixel. The distribution index reflects the similarity between the local density corresponding to the target pixel and the overall cluster.
[0098] The product of the distribution index and the deviation index of the target pixel point is normalized to obtain the local adjustment weight of the target pixel point. When the distribution index is larger and the deviation index is larger, the difference is larger, the similarity is lower, and the representativeness is weaker, so the adjustment weight needs to be larger. The product of the local adjustment weight and the grayscale value of the target pixel point is used as the local adjustment value corresponding to the target pixel point. The local adjustment value is the grayscale value that needs to be adjusted based on the distribution characteristics of the target pixel point. The average value of the local adjustment values of all characteristic pixels in the normal area cluster is used as the adjustment value of the normal area cluster. The adjustment value is the grayscale value that needs to be adjusted based on the position distribution of the characteristic pixels. In an embodiment of the present invention, the expression of the adjustment value is:
[0099]
[0100] Where, Represents the adjusted value of the normal region clustering cluster, Represented as the total number of feature pixels in the normal region cluster, Represents the first cluster in the normal region cluster The gray value of the feature pixel, Expressed as the total number of local pixels, Represents the first cluster in the normal region cluster The feature pixel and The nearest neighbor distance between local pixels, It is expressed as the distribution distance of the normal area clustering cluster, Represents the first cluster in the normal region cluster The deviation distance of the feature pixel point, It is expressed as the average radius of the normal region cluster, Expressed as the absolute value extraction function, Expressed as a normalized function.
[0101] in, Represents the first cluster in the normal region cluster The average value of the neighbors of the feature pixels, Represents the first cluster in the normal region cluster The distribution index of feature pixels, Represents the first cluster in the normal area cluster The deviation index of the feature pixel point, Represents the first cluster in the normal area cluster The local adjustment weight of feature pixels, Represents the first cluster in the normal area cluster The local adjustment value of each feature pixel. The more dissimilar the distribution is, the weaker the representativeness of the feature pixel is, and the greater the degree of increase required. Therefore, the larger the adjustment weight, the greater the degree of adjustment required, and the larger the final adjustment value.
[0102] Since the above adjustment values are obtained by analyzing the distribution of feature pixels and the adjustment values are obtained by analyzing the representativeness of the pixels, the method for obtaining the adjustment values of the burr area clusters is the same as that of the normal area clusters. The adjustment values of the burr area clusters are obtained according to the method for obtaining the adjustment values of the normal area clusters.
[0103] In an embodiment of the present invention, the process of obtaining the adjustment value of a burr region cluster includes: obtaining the centroid and average radius of the burr region cluster, using the average distance between pixels in the burr region cluster as the distribution distance of the burr region cluster. Sequentially using characteristic pixels in the burr region cluster as target pixels, calculating the distance from the target pixel to the centroid as the deviation distance of the target pixel, and using the ratio of the deviation distance of the target pixel to the average radius of the burr region cluster as the deviation index of the target pixel. Calculating the distance between each other pixel in the burr region cluster and the target pixel, arranging the other pixels in ascending order of distance to obtain a distance sequence, and using the first preset number of pixels in the distance sequence as local pixels of the target pixel. Using the distance between the target pixel and each local pixel as the nearest neighbor distance, calculating the average of the nearest neighbor distances between the target pixel and all local pixels to obtain the nearest neighbor average of the target pixel, and using the difference between the nearest neighbor average of the target pixel and the distribution distance as the distribution index of the target pixel. Normalize the product of the target pixel's distribution index and its deviation index to obtain the target pixel's local adjustment weight. The product of the local adjustment weight and the target pixel's grayscale value is used as the local adjustment value for the target pixel. The average of the local adjustment values for all feature pixels in the burr region cluster is used as the adjustment value for the burr region cluster. Since the calculation process is consistent, the specific calculation logic is not repeated here.
[0104] Further, the feature gray value of the normal region cluster is obtained by adding the gray value of the feature pixel point corresponding to the normal region cluster to the adjustment value, and the feature gray value of the burr region cluster is obtained by taking the difference between the gray value of the feature pixel point corresponding to the burr region cluster and the adjustment value as the feature gray value of the burr region cluster. The feature gray value is a representative gray value that can be used for gray division after adjustment based on the pixel point representation of the two clusters.
[0105] The average of the feature gray values of the burr region cluster and the normal region cluster is calculated to obtain an initial segmentation threshold value. In an embodiment of the present application, the expression of the initial segmentation threshold value is as follows:
[0106]
[0107] In the formula, the initial segmentation threshold value is represented as T0, the adjustment value of the normal region cluster is represented as Tn, the adjustment value of the burr region cluster is represented as Tb, the gray value of the feature pixel point corresponding to the normal region cluster is represented as Gn, and the gray value of the feature pixel point corresponding to the burr region cluster is represented as Gb. The initial segmentation threshold value is represented as T0, The adjustment value of the normal region cluster is represented as Tn, The adjustment value of the burr region cluster is represented as Tb, The gray value of the feature pixel point corresponding to the normal region cluster is represented as Gn, The gray value of the feature pixel point corresponding to the burr region cluster is represented as Gb.
[0108] The burr region in the wood surface gray image is obtained by iterative threshold segmentation based on the more accurate initial segmentation threshold value. In an embodiment of the present application, the stop condition of the iterative threshold segmentation is set as follows: when the threshold difference in two consecutive iterations is less than a preset threshold difference value, the iteration is stopped, and the region with a larger average gray value is determined as the burr region. The preset threshold difference value is set to 0.1, and the implementer can adjust it according to the specific implementation. It should be noted that the iterative threshold segmentation is a well-known technical means for those skilled in the art, and will not be described here.
[0109] At this point, the burr region on the wood cutting surface can be screened out.
[0110] S4: Hierarchical detection is performed on the burr region in the wood surface gray image.
[0111] In an embodiment of the present application, the quality hierarchical detection can be performed according to the proportion of the burr region in the wood surface gray image. Preferably, the ratio of the total number of pixel points in the burr region to the total number of pixel points in the wood surface gray image is taken as a quality grade index.
[0112] When the quality grade index is greater than or equal to the preset quality threshold, it indicates that the proportion of the burr region pixel points is high, and the surface burr is more, and the quality of the cutting surface of the wood is recorded as unqualified. When the quality grade index is less than the preset quality threshold, it indicates that the burr region pixel points are within the normal error, and the surface burr is less, and the quality of the cutting surface of the wood is recorded as qualified.
[0113] In the embodiment of the present application, the preset quality threshold is 0.1, and the specific value can be adjusted according to the specific implementation.
[0114] At this point, the quality evaluation of the cutting surface of the wood based on the burr condition is completed.
[0115] In summary, the present application takes into account the complex characteristics of the pixel point distribution of different regions of the wood surface, adds the feature of the continuity of the distribution of the pixel points in different directions, and combines the gray scale distribution frequency and the gray scale value to cluster the pixel points to obtain the clustering cluster representing different regions, so as to more accurately segment the required region. According to the different characteristics of the gray scale distribution characteristics of different regions, the normal region clustering cluster and the burr suspected region clustering cluster are screened out. Since the fiber points and the pixel points of the burr part of the wood itself are similar in gray scale distribution characteristics, there are also fiber points that do not belong to the burr in the burr suspected region clustering cluster. Further, the fiber confidence is obtained according to the gray scale change complexity of each pixel point in the preset neighborhood range in the burr suspected region clustering cluster, and the burr region clustering cluster is obtained by updating and merging the fiber confidence of the pixel points as fiber points, so that the credibility of the burr region clustering cluster is higher, so as to distinguish the accurate burr region in the subsequent. According to the normal region clustering cluster and the burr region clustering cluster, the initial segmentation threshold can be set by judging the gray scale value, but since the gray scale value in the clustering cluster fluctuates, the feature pixel points that can be judged by the gray scale value are selected, and the representative degree of the feature pixel points in the clustering cluster is further considered, that is, the initial segmentation threshold is obtained by adjusting the corresponding gray scale value in combination with the position distribution of the feature pixel points in the clustering cluster. At this time, the initial segmentation threshold is more credible, and the segmentation effect is more accurate, and then a more accurate burr region is obtained by iterative threshold segmentation for quality evaluation. The present application adjusts the segmentation threshold by combining the distribution characteristics of the pixel points corresponding to different regions of the wood surface, so that the burr region extracted by segmentation is more accurate, and the quality evaluation of the burr of the wood surface is more accurate.
[0116] The present application provides an automatic grading detection system for building wood, which comprises a memory and a processor, and the processor executes a calculation program stored in the memory to realize an automatic grading detection method for building wood as described above.
[0117] A wood cutting surface burr region acquisition method embodiment:
[0118] In the existing method for obtaining the burr area in the cutting surface of wood, the characteristics of the complex surface of wood are not considered, the interference of other multi-feature factors such as texture depression is not excluded when analyzing, and the accuracy is relatively low when the burr area on the surface of the wood plate is segmented and extracted by threshold value, and the error of the obtained burr area is large. In order to solve the problem that the accuracy is relatively low when the burr area on the surface of the wood plate is segmented and extracted by threshold value, and the error of the obtained burr area is large, the present application provides a method for obtaining the burr area in the cutting surface of wood, which comprises:
[0119] Step S01: obtaining a wood surface gray image; obtaining a continuous distribution index of each pixel point in the wood surface gray image according to the continuous change degree of the gray value of each pixel point in different preset directions.
[0120] Step S02: clustering the pixel points according to the gray distribution frequency, gray value and continuous distribution index of each pixel point in the wood surface gray image to obtain a cluster; screening out a normal area cluster and a burr suspected area cluster according to the gray distribution in the cluster; obtaining the fiber confidence of each pixel point in the burr suspected area cluster according to the gray value change complexity of each pixel point in the preset neighborhood range; updating and merging all burr suspected area clusters according to the fiber confidence to obtain a burr area cluster.
[0121] Step S03: obtaining the feature pixel points in the burr area cluster and the normal area cluster; obtaining an initial segmentation threshold value according to the position distribution of the feature pixel points in the burr area cluster and the normal area cluster in the cluster and the gray value of the feature pixel points; obtaining the burr area in the wood surface gray image by iterative threshold segmentation through the initial segmentation threshold value.
[0122] Wherein, the steps S01 to S03 have been described in detail in the above embodiment of the automatic grading detection method and system for building wood, and will not be repeated here.
[0123] The present application considers the complex characteristics of pixel distribution in different regions of the wood surface, adds the characteristics of the continuity of pixel distribution in different directions, and combines the gray scale distribution frequency and the gray scale value to cluster the pixels to obtain the clustering clusters representing different regions, so as to more accurately segment the required regions. According to the different characteristics of the gray scale distribution characteristics of different regions, the normal region clustering cluster and the burr suspected region clustering cluster are screened out. Since the fiber points and the pixel points of the burr part of the wood itself are relatively similar in the gray scale distribution characteristics, the fiber points that do not belong to the burr also exist in the burr suspected region clustering cluster. Further, the fiber confidence is obtained according to the gray scale change complexity of each pixel point in the preset neighborhood range in the burr suspected region clustering cluster, the burr region clustering cluster is obtained by updating and merging the fiber confidence of the pixel points that are fiber points, so that the credibility of the burr region clustering cluster is higher, so as to distinguish the accurate burr region subsequently. The initial segmentation threshold can be set according to the gray scale value of the normal region clustering cluster and the burr region clustering cluster, but since the gray scale value in the clustering cluster fluctuates to a certain extent, it is necessary to select the feature pixel points that can be judged by the gray scale first, and further consider the representative degree of the feature pixel points in the clustering cluster, that is, combine the position distribution of the feature pixel points in the clustering cluster to adjust the corresponding gray scale value to obtain the initial segmentation threshold. At this time, the initial segmentation threshold is more credible, the segmentation effect is more accurate, and further, more accurate burr regions are obtained by iterative threshold segmentation.
[0124] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are also possible or can be advantageous.
[0125] Each embodiment in the specification is described in a progressive manner, and the same and similar parts between each embodiment can be referred to each other. Each embodiment mainly describes the differences from other embodiments.
Claims
1. An automated grading and detection method for building timber, characterized in that: The method comprises: Obtaining a grayscale image of the wood surface; obtaining a continuous distribution index of each pixel point based on the degree of continuous change of the grayscale value of each pixel point in the grayscale image of the wood surface in different preset directions; Clustering is performed to obtain clusters based on the grayscale distribution frequency, grayscale value, and continuous distribution index of each pixel in the grayscale image of the wood surface; normal area clusters and burr suspected area clusters are screened out based on the grayscale distribution in the clusters; the fiber confidence of each pixel in each burr suspected area cluster is obtained based on the complexity of the grayscale changes of each pixel in each burr suspected area cluster within a preset neighborhood range; all burr suspected area clusters are updated and merged based on the fiber confidence to obtain a burr area cluster; Acquire characteristic pixel points in the burr region cluster and the normal region cluster; obtain an initial segmentation threshold based on the position distribution of the characteristic pixel points in the burr region cluster and the normal region cluster in the respective clusters, as well as the grayscale value of the characteristic pixel points; perform iterative threshold segmentation using the initial segmentation threshold to obtain the burr region in the grayscale image of the wood surface; Among them, the method for obtaining the initial segmentation threshold includes: obtaining the centroid and average radius of the normal area cluster, and taking the average distance between pixels in the normal area cluster as the distribution distance of the normal area cluster; taking the characteristic pixel points in the normal area cluster as the target pixel points in turn, calculating the distance from the target pixel point to the centroid, as the deviation distance of the target pixel point; taking the ratio of the deviation distance of the target pixel point to the average radius of the normal area cluster as the deviation index of the target pixel point; calculating the distance between each other pixel point in the normal area cluster and the target pixel point, and arranging the other pixel points in order of distance from small to large to obtain a distance sequence; taking the first preset number of pixels in the distance sequence as local pixel points of the target pixel point; taking the distance between the target pixel point and each local pixel point as the neighbor distance, calculating the average of the neighbor distances between the target pixel point and all local pixel points, and obtaining the neighbor average value of the target pixel point; The difference between the average value of the neighboring points of the target pixel and the distribution distance is used as the distribution index of the target pixel; the product of the distribution index of the target pixel and the deviation index is normalized to obtain the local adjustment weight of the target pixel; the product of the local adjustment weight and the grayscale value of the target pixel is used as the local adjustment value corresponding to the target pixel; the average value of the local adjustment values of all characteristic pixels in the normal area cluster is used as the adjustment value of the normal area cluster; according to the acquisition process of the adjustment value of the normal area cluster, the adjustment value of the burr area cluster is obtained; the grayscale value of the characteristic pixel corresponding to the normal area cluster is added to the adjustment value to obtain the characteristic grayscale value of the normal area cluster; the difference between the grayscale value of the characteristic pixel corresponding to the burr area cluster and the adjustment value is used as the characteristic grayscale value of the burr area cluster; the average value of the characteristic grayscale values corresponding to the burr area cluster and the normal area cluster is calculated to obtain the initial segmentation threshold; Quality assessment is performed based on the burr area in the grayscale image of the wood surface.
2. The automated grading and detection method for building timber according to claim 1, characterized in that: The method for obtaining the continuous distribution index includes: For any pixel point in the grayscale image of the wood surface, each preset direction is used as the detection direction in turn, and the preset number of detection pixels adjacent to the pixel point on the straight line corresponding to the detection direction are used as the detection pixels of the pixel point in the detection direction; Calculate the average grayscale value of all detected pixels of the pixel in the detection direction to obtain the average grayscale value of the pixel in the detection direction; the difference between the grayscale value of the pixel and the average grayscale value is used as the difference degree value of the pixel in the detection direction; Calculate the grayscale difference between the pixel and each detection pixel as the grayscale difference value of the pixel in the detection direction; and take the sum of all grayscale difference values of the pixel in the detection direction as the grayscale change value of the pixel in the detection direction; The product of the difference value and the grayscale change value of the pixel point in the detection direction is negatively correlated and normalized to obtain the change continuity of the pixel point in the detection direction; The change continuity of the pixel point in each preset direction is multiplied and normalized to obtain the continuous change degree of the pixel point; the product of the continuous change degree of the pixel point and the preset range adjustment value is calculated to obtain the continuous distribution index of the pixel point; the preset range adjustment value is a positive number.
3. The automated grading and detection method for building timber according to claim 1, characterized in that: The method for obtaining the clusters includes: The probability of occurrence of the grayscale value corresponding to each pixel in the grayscale image of the wood surface is taken as the grayscale distribution frequency of each pixel; The grayscale distribution frequency, grayscale value and continuous distribution index of the pixel points are mapped to the three-dimensional space coordinate system to obtain the distribution coordinates of each pixel point; the partition-based clustering algorithm is used to cluster the pixels according to the distribution coordinates to obtain cluster clusters.
4. The automated grading and detection method for building timber according to claim 1, characterized in that: The method of screening out normal area clusters and burr suspected area clusters according to the grayscale distribution in the clusters includes: Calculate the average grayscale value of the two clusters with the largest number of pixels as the cluster grayscale average; take the cluster with the largest cluster grayscale average among the two clusters as the normal area cluster; The other clusters except the two clusters with the largest number of pixels are taken as clusters to be determined; the average grayscale value of each cluster to be determined is obtained; When the grayscale average of a cluster is greater than the grayscale average of a normal region cluster, the corresponding cluster is regarded as a burr suspected region cluster.
5. The automated grading and detection method for building timber according to claim 1, characterized in that: The method for obtaining the fiber confidence comprises: For any pixel point in any burr suspected area cluster, calculate the difference in gradient direction value between the pixel point and each other pixel point in the corresponding preset neighborhood range to obtain the gradient difference value between the pixel point and the corresponding other pixel points; the accumulated value of the gradient difference value between the pixel point and all other pixels in the corresponding preset neighborhood range is used as the gradient feature value of the pixel point; Calculate the average grayscale value of all other pixels in the preset neighborhood corresponding to the pixel to obtain the local average value corresponding to the pixel; the difference between the grayscale value of the pixel and the local average value is used as the grayscale change characteristic value of the pixel; The product of the gradient eigenvalue of the pixel point and the grayscale change eigenvalue is negatively correlated and normalized to obtain the fiber confidence of the pixel point.
6. The automated grading and detection method for building timber according to claim 1, characterized in that: The method for obtaining the burr region cluster includes: When the fiber confidence of a pixel point in the burr suspected area cluster is greater than the preset fiber threshold, the corresponding pixel point is regarded as a fiber pixel point; The fiber pixels in each suspected burr region cluster are screened out to obtain a new suspected burr region cluster, and all the new suspected burr region clusters are merged as a burr region cluster.
7. The automated grading and detection method for building timber according to claim 1, characterized in that: The obtaining of characteristic pixel points in the burr region clusters and the normal region clusters includes: The pixel with the smallest grayscale value in the normal region cluster is used as the feature pixel corresponding to the normal region cluster; the pixel with the largest grayscale value in the burr region cluster is used as the feature pixel corresponding to the burr region cluster.
8. The automated grading and detection method for building timber according to claim 1, characterized in that: The quality assessment is performed based on the burr area in the grayscale image of the wood surface, including: The ratio of the total number of pixels in the burr area to the total number of pixels in the grayscale image of the wood surface is used as the quality grade indicator; When the quality grade index is greater than or equal to the preset quality threshold, the quality of the corresponding wood cutting surface is recorded as unqualified; when the quality grade index is less than the preset quality threshold, the quality of the corresponding wood cutting surface is recorded as qualified.
9. An automated grading and detection system for building timber, comprising a memory and a processor, characterized in that: The processor executes the computing program stored in the memory to implement the automatic grading and detection method for building timber as claimed in any one of claims 1 to 8.
Citation Information
Patent Citations
Method for detecting surface defects of smart phone panel
CN117351008A
Power adapter quality detection method based on image features
CN117495849A