Method and system for quality classification of wood-based panels based on machine vision
By obtaining the grayscale image of the surface of the artificial board, calculating the difference and contrast of the grayscale value, and combining the grayscale gradient feature vector to determine the defect area, the problems of low efficiency and poor accuracy of the traditional method are solved, and the accurate classification of the quality of the artificial board is achieved and Optimized use of resources.
Patent Information
- Application Number
- CN202210432051.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-22
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-04-22
AI Technical Summary
The traditional method of detecting defects of artificial boards is inefficient and cannot accurately detect small bubble defects, so it is impossible to effectively evaluate the quality of artificial boards.
By obtaining the grayscale image of the surface of the artificial board, the difference between the grayscale value of each pixel point and the background pixel is calculated, the degree of abnormality is obtained based on the contrast, the grayscale gradient feature vector is used to judge the defect probability, and the area proportion of the defect area is performed. Quality classification.
The accuracy of detection of bubble defects on the surface of artificial boards is improved, and the accurate classification of the quality of artificial boards is achieved, and resource waste is reduced.
Smart Images

Figure CN114913365B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for classifying wood-based panel quality based on machine vision. Background Art
[0002] Veneer is one of the important raw materials for the production of wooden furniture. It is a thin wooden sheet material used for veneer or edge banding. Veneer is divided into natural and artificial. Artificial veneer is also called technical veneer. Natural veneer generally uses precious wood as raw material and is limited by tree species and resources. Therefore, artificial veneer is more valued. When using artificial veneer to veneer furniture, it can not only achieve the texture of solid wood appearance and reflect the texture of natural wood, but also enhance the taste of furniture.
[0003] However, various defects often occur during the process of veneer processing; among them, "veneer blistering" is the most common and most difficult problem.
[0004] The traditional way to detect defects in artificial boards and classify their quality is usually through manual observation. However, the detection process is easily affected by the state of the staff and has low efficiency. Some methods that use machine vision for defect detection usually use threshold segmentation, but this method can only detect bubble defects with obvious characteristics. The accuracy of detecting small bubbles is very low, and it is impossible to accurately evaluate the quality of artificial boards. Summary of the invention
[0005] In order to solve the above technical problems, the purpose of the present invention is to provide a method and system for classifying wood-based panel quality based on machine vision. The technical solutions adopted are as follows:
[0006] In a first aspect, an embodiment of the present invention provides a method for classifying wood-based panel quality based on machine vision, the method comprising the following steps:
[0007] Acquire a grayscale image of a surface of an artificial board, wherein the surface of the artificial board includes a background and a pattern;
[0008] Calculating the difference between the grayscale values of all pixels in the grayscale image and the grayscale values of the background pixels, and assigning a degree of attention to each pixel according to whether the difference falls within a normal range; the normal range is the difference range between the grayscale values of the pattern pixels and the grayscale values of the background pixels;
[0009] Obtaining the contrast of each pixel in the grayscale image; taking the attention degree of each pixel as a weight, multiplying it by the contrast of the corresponding pixel to obtain the abnormality degree of the corresponding pixel, and obtaining the suspected abnormal area according to the abnormality degree;
[0010] Obtaining a grayscale gradient feature vector of each pixel point in the suspected abnormal area; obtaining a defect probability of the suspected abnormal area according to the grayscale gradient feature vector, and when the defect probability is greater than a preset threshold, the suspected abnormal area corresponding to the defect probability is a defect area;
[0011] The influence degree is obtained according to the proportion of the area of all the defective regions in the area of the grayscale image, and the quality of the artificial board is classified according to the influence degree.
[0012] Preferably, the step of acquiring the grayscale value of the background pixel comprises:
[0013] Obtain the grayscale mean of the grayscale image and the first grayscale value with the highest frequency of occurrence in the grayscale image; select all the grayscale values with grayscale values between the grayscale mean and the first grayscale value as standard grayscale values, and calculate the standard mean and standard variance based on all the standard grayscale values; construct a Gaussian model based on the standard mean and the standard variance, and the maximum value corresponding to the Gaussian model is the grayscale value of the background pixel.
[0014] Preferably, the step of allocating a degree of attention to each pixel point according to whether the difference value belongs to a normal range comprises:
[0015] When the difference is within a normal range, the degree of concern is negatively correlated with the difference;
[0016] When the difference is not within the normal range, the degree of concern is positively correlated with the difference.
[0017] Preferably, the step of obtaining the contrast of each pixel in the grayscale image includes:
[0018] Taking any pixel in the grayscale image as the central pixel, forming a window according to the central pixel and its neighborhood pixels, obtaining the grayscale co-occurrence matrix of the window, and obtaining the contrast of the window according to the grayscale co-occurrence matrix, wherein the contrast is the pixel value of the central pixel.
[0019] Preferably, the step of obtaining a suspected abnormal area according to the abnormality degree includes:
[0020] An abnormality degree threshold is set. When the abnormality degree corresponding to the pixel point is greater than the abnormality degree threshold, the pixel point is a suspected abnormal point, and the suspected abnormal area is obtained based on all the suspected abnormal points.
[0021] Preferably, the step of obtaining the grayscale gradient feature vector of each pixel in the suspected abnormal area includes:
[0022] A sliding window is constructed with any pixel point in the suspected abnormal area as the center point, and the grayscale gradient change direction is obtained according to the gradient change of the grayscale value of the pixel point in the sliding window. The unit vector of the grayscale gradient change direction is the grayscale gradient change vector.
[0023] Preferably, the step of obtaining the defect probability of the suspected abnormal area according to the gray gradient feature vector includes:
[0024] Obtaining a unit vector for each pixel in the suspected defect area, wherein the unit vector is a unit vector starting from the center point of the suspected defect area and in the direction of a line connecting all pixels in the suspected defect area;
[0025] The cosine similarity between the grayscale gradient feature vector corresponding to each pixel and the unit vector is obtained, and the average cosine similarity of all pixels in the suspected defect area is the defect probability.
[0026] Preferably, after the step of determining that the suspected abnormal area corresponding to the defect probability is a defect area, the method further includes:
[0027] Acquire all the defect areas in the grayscale image, acquire the distance between all the defect areas, and when the distance is less than a preset distance, acquire the principal component directions of the two defect areas corresponding to the distance;
[0028] The cosine similarity between the principal component directions corresponding to the two defect regions is calculated, and the extension probability is obtained according to the distance between the two defect regions and the cosine similarity. When the extension probability is greater than a preset threshold, the corresponding two defect regions are a large defect region.
[0029] In the second aspect, another embodiment of the present invention provides a machine vision-based wood-based panel quality classification system, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0030] The present invention has the following beneficial effects: firstly, a grayscale image of the surface of an artificial board is obtained, and the grayscale value of the background pixel in the grayscale image is calculated to avoid the influence of the noise pixel and the texture of the artificial board in the grayscale image, and the attention level corresponding to each pixel is obtained according to the difference between the grayscale value of each pixel in the grayscale image and the grayscale value of the background pixel. Further, the contrast within each pixel and its neighborhood is calculated, and the abnormal probability of the pixel is obtained according to the attention level and contrast corresponding to each pixel, and a suspected abnormal area is obtained. The abnormal probability is obtained according to the unit vector and grayscale gradient feature vector corresponding to each pixel in each suspected abnormal area, and it is judged whether the suspected abnormal area is a defective area; the accuracy of bubble defect detection on the surface of the artificial board is improved. Further, the influence level is obtained according to the proportion of the area of the sum of all defective areas finally obtained in the grayscale image of the surface of the artificial board, so that the quality of the artificial board is divided according to the influence level, and the quality of the artificial board can be accurately classified, reducing resource waste. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A flow chart of a method for quality classification of artificial boards based on machine vision provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a method and system for classifying wood-based panels based on machine vision according to the present invention, its specific implementation, structure, features and effects, in conjunction 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.
[0034] 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 invention belongs.
[0035] The embodiment of the present invention is mainly applicable to the quality classification of artificial veneer wood, especially to the judgment of bubble defect areas in the "veneer blistering" phenomenon. By obtaining the grayscale image of the surface of the artificial board, the degree of attention is assigned to each pixel according to the difference between the grayscale value of all pixels in the grayscale image and the grayscale value of the background pixel, and the abnormality of each pixel is obtained in combination with the contrast of the pixel itself, thereby obtaining a suspected abnormal area, and judging whether the suspected abnormal area is a defective area according to the grayscale gradient change characteristics of each pixel in the suspected abnormal area. The degree of influence is obtained according to the proportion of all defective areas, and then the quality of the artificial board is classified. The defective area on the surface of the artificial board is judged more accurately, so as to accurately classify the quality of the artificial board and reduce resource waste.
[0036] The following is a detailed description of a method and system for classifying wood-based panels based on machine vision provided by the present invention in conjunction with the accompanying drawings.
[0037] See also Figure 1 , which shows a flow chart of a method for quality classification of artificial boards based on machine vision provided by an embodiment of the present invention, the method comprising the following steps:
[0038] Step S100, obtaining a grayscale image of the surface of the artificial board, where the surface of the artificial board includes a background and a pattern.
[0039] The general operation of the existing artificial board production process is: selecting veneer, cutting veneer, splicing veneer, gluing, veneer, hot pressing, sanding, trimming, spraying primer, spraying topcoat. After the artificial board is produced, the formed artificial board is imaged for quality classification of the formed artificial board.
[0040] A camera is set up directly above the conveyor belt to shoot the artificial board on the conveyor belt from a bird's-eye view. The surface of the artificial board includes irregular patterns and textures. The conveyor belt speed and the camera sampling frequency are adjusted to ensure that the camera can capture a clear RGB image containing only the surface of the artificial board. The RGB image of the artificial board surface is converted into a grayscale image for subsequent analysis of the quality of the artificial board.
[0041] Step S200, calculate the difference between the grayscale value of all pixels in the grayscale image and the grayscale value of the background pixels, and assign a degree of attention to each pixel based on whether the difference falls within a normal range; the normal range is the difference range between the grayscale value of the pattern pixel and the grayscale value of the background pixel.
[0042] In the process of veneer manufacturing of artificial boards, the phenomenon of "wood veneer blistering" is often caused by uneven glue coating or poor temperature control. When collecting images of the surface of artificial boards, if there are bubbles on the surface, the pixel grayscale value of the bubble area will be different from the pixel grayscale value of the bubble-free area under the influence of light. However, due to the influence of the wood board texture, the method of determining the bubble defect area based on the difference between the grayscale values is not accurate. Therefore, it is necessary to avoid the influence of texture features as much as possible.
[0043] Preferably, in order to avoid the influence of noise pixels and its own pattern texture in the grayscale image of the surface of the artificial board, the grayscale values of the background pixels of the grayscale image are selected to obtain the grayscale mean of the grayscale image and the first grayscale value with the highest frequency of occurrence in the grayscale image; all grayscale values with grayscale values between the grayscale mean and the first grayscale value are selected as standard grayscale values, and the standard mean and standard variance are calculated based on all standard grayscale values; a Gaussian model is constructed based on the standard mean and standard variance, and the maximum value corresponding to the Gaussian model is the grayscale value of the background pixels.
[0044] Specifically, a grayscale histogram is constructed according to the grayscale values corresponding to all pixels in the grayscale image, and the probability of occurrence of each grayscale value in the grayscale histogram is calculated as follows:
[0045]
[0046] Among them, p i Represents the probability of the i-th gray value appearing; A i It represents the number of times the i-th gray value appears in the gray histogram; N represents the number of all pixels in the gray image.
[0047] The grayscale value with the highest frequency in the grayscale image is obtained as the first grayscale value. The grayscale mean corresponding to the grayscale image is calculated as:
[0048]
[0049] in, Represents the grayscale mean corresponding to the grayscale image; i represents the i-th grayscale value; A i It represents the number of times the i-th gray value appears in the gray histogram; N represents the number of all pixels in the gray image.
[0050] In order to make the grayscale value of the background pixel of the obtained grayscale image more accurate, in the embodiment of the present invention, the grayscale value of the relatively ideal background pixel should be between the first grayscale value and the grayscale mean. Assuming that the first grayscale value is less than the grayscale mean, the standard mean is calculated according to the first grayscale value and the grayscale mean:
[0051]
[0052] Among them, μ0 represents the standard mean; i m represents the first gray value; represents the grayscale mean corresponding to the grayscale image; i represents the i-th grayscale value; p i Represents the probability of the i-th gray value appearing.
[0053] Then the standard deviation is obtained according to the standard mean:
[0054]
[0055] σ0 represents the standard deviation; i m represents the first gray value; Represents the grayscale mean corresponding to the grayscale image; i represents the i-th grayscale value; μ0 represents the standard mean.
[0056] A Gaussian model is constructed based on the standard mean and standard variance obtained above. The probability that the grayscale value of each pixel belongs to the background pixel grayscale value is obtained based on the Gaussian model:
[0057]
[0058] Among them, F i It represents the probability that the i-th gray value belongs to the gray value of the background pixel; i represents the i-th gray value; μ0 represents the standard mean; σ0 represents the standard variance; e represents the natural constant.
[0059] Since there is a large difference between the grayscale value of the pattern texture of the artificial board and the grayscale value of the background pixel, and the difference between the grayscale value of the pixel point in the bubble area and the grayscale value of the background pixel is small, more attention should be paid to the pixel points with smaller difference changes.
[0060] The gray value with the highest probability of the pixel is obtained as the gray value of the background pixel, and the difference between the gray value of the background pixel and the gray value of each pixel in the gray image is calculated. The difference range between the gray value of the pattern pixel and the gray value of the background pixel is set as the normal range. When the difference is within the normal range, the degree of attention is negatively correlated with the difference; when the difference is not within the normal range, the degree of attention is positively correlated with the difference. The degree of attention corresponding to each pixel is obtained according to the difference:
[0061]
[0062] Among them, B represents the degree of attention; i1 represents the gray value of the background pixel; ΔA represents the maximum difference of the gray value in the gray image; m represents the difference threshold, and the difference range greater than the difference threshold is the normal range; e represents a natural constant.
[0063] As a preference, the difference threshold in the embodiment of the present invention is an empirical value.
[0064] Step S300, obtaining the contrast of each pixel in the grayscale image; taking the attention level of each pixel as a weight, multiplying it with the contrast of the corresponding pixel to obtain the abnormal probability of the corresponding pixel, and obtaining the suspected abnormal area according to the abnormal probability.
[0065] Furthermore, taking any pixel in the grayscale image as the central pixel, in the embodiment of the present invention, the central pixel and the pixels in its eight neighborhoods form a window, obtaining the grayscale co-occurrence matrix in each window, obtaining the contrast according to the grayscale co-occurrence matrix corresponding to each window, and using the contrast as the pixel value of the central pixel. Similarly, obtaining the contrast corresponding to each pixel in the grayscale image obtains the contrast map corresponding to the grayscale image.
[0066] Then the degree of abnormality of each pixel is obtained based on the degree of attention of each pixel as the weight:
[0067] C j =B j *K j
[0068] Among them, C j Indicates the abnormality degree corresponding to the jth pixel; B j Indicates the degree of attention corresponding to the j-th pixel; K j Indicates the contrast corresponding to the j-th pixel.
[0069] The greater the abnormality degree corresponding to each pixel point, the greater the possibility that the pixel point is a defect point; set an abnormality degree threshold, when the abnormality degree corresponding to the pixel point is greater than the abnormality degree threshold, the pixel point is a suspected abnormal point, and the suspected abnormal area is obtained based on all suspected abnormal points.
[0070] Specifically, the abnormality degree corresponding to all pixel points in the grayscale image is obtained, and when the abnormality degree is greater than a preset abnormality degree threshold, the pixel point corresponding to the abnormality degree is marked as a suspected abnormal point.
[0071] As a preference, in the embodiment of the present invention, the abnormality threshold is set to C j =10.
[0072] Furthermore, the embodiment of the present invention uses the DBSCAN clustering algorithm to cluster all suspected abnormal points to obtain multiple clusters, and further performs contour fitting on the pixel points in each cluster according to the scatter point contour algorithm to obtain the suspected abnormal area corresponding to each cluster.
[0073] Step S400, obtaining the grayscale gradient feature vector of each pixel in the suspected abnormal area; obtaining the defect probability of the suspected abnormal area according to the grayscale gradient feature vector, when the defect probability is greater than a preset threshold, the suspected abnormal area corresponding to the defect probability is a defect area.
[0074] The suspected abnormal area in the grayscale image is obtained in step S300, and each suspected abnormal area is analyzed to obtain an accurate defect area. A sliding window is constructed with any pixel point in the suspected abnormal area as the center point, and the grayscale gradient change direction is obtained according to the gradient change of the grayscale value of the pixel point in the sliding window. The unit vector of the grayscale gradient change direction is the grayscale gradient change vector.
[0075] Specifically, in the embodiment of the present invention, a sliding window of size 3×3 is constructed, each pixel point in the suspected abnormal area is used as the center point of the sliding window, and the grayscale gradient change direction corresponding to the sliding window is obtained according to the grayscale value of each pixel point in the sliding window, and the unit vector of the grayscale gradient change direction is obtained as the grayscale gradient feature vector corresponding to the center point of the sliding window; when there are multiple grayscale gradient change directions in a sliding window, the unit vector of the grayscale gradient change direction with the largest grayscale gradient change amplitude is selected as the corresponding grayscale gradient feature vector. By analogy, the grayscale gradient feature vector corresponding to each pixel point in the suspected abnormal area is obtained.
[0076] Furthermore, the unit vector of each pixel in the suspected defect area is obtained, and the unit vector is a unit vector with the center point of the suspected defect area as the starting point and the direction of the line connecting all the pixels in the suspected defect area; the cosine similarity between the grayscale gradient feature vector corresponding to each pixel and the unit vector is obtained, and the average cosine similarity of all pixels in the suspected defect area is the defect probability; when the defect probability is greater than the preset threshold, the suspected defect area is a defect area.
[0077] Since the grayscale change of the bubble defect area is a decrease from the center of the bubble to the surrounding grayscale value, the greater the cosine similarity between the grayscale gradient feature vector of a pixel and its corresponding unit vector, the greater the possibility that the pixel is a defective point. Therefore, the defect probability of the suspected abnormal area is obtained as:
[0078]
[0079] Among them, P f represents the defect probability of the fth suspected abnormal area; E represents the number of all suspected abnormal points in the suspected abnormal area; v e represents the grayscale change feature vector corresponding to the e-th suspected abnormal point; v e ′ Represents the unit vector corresponding to the e-th suspected outlier point.
[0080] In the embodiment of the present invention, a preset threshold value P is set f =0.8, that is, when the defect probability of the suspected abnormal area is greater than 0.8, the suspected abnormal area is determined to be a defect area.
[0081] Furthermore, due to the influence of external factors, if the bubble defect areas on the artificial board are too close, they are easily extended and merged into a large bubble defect area. All defect areas in the grayscale image are obtained, and the distances between all defect areas are obtained. When the distance is less than the preset distance, the principal component directions of the two defect areas corresponding to the distance are obtained; the cosine similarity between the principal component directions corresponding to the two defect areas is calculated, and the extension probability is obtained according to the distance between the two defect areas and the cosine similarity. When the extension probability is greater than the preset threshold, the corresponding two defect areas are a large defect area.
[0082] Specifically, the distance between all defective areas in the grayscale image is obtained, and the distance is the distance between the edge pixels closest to the two defective areas. When the distance is less than the preset distance threshold, the two corresponding defective areas may extend into a large defective area under the influence of the outside world, so the two defective areas corresponding to the distance are analyzed.
[0083] The shape of the bubble defect area of most artificial boards is approximately elliptical. The gradient information of each pixel point in the defect area is obtained. In the embodiment of the present invention, principal component analysis is used to obtain the principal component direction of the pixel gradient in each defect area. Since the gradient information corresponding to each pixel point is 2D data, including the magnitude and direction of the gradient, each principal component direction is a 2D unit vector, and each principal component direction corresponds to an eigenvalue, wherein the principal component direction with the smallest eigenvalue represents the direction with the smallest projection variance of all unit vectors, that is, the defect extension direction of each defect area.
[0084] Then the extension probability is obtained according to the distance between the two defect areas and the defect extension direction:
[0085]
[0086] Where y1 represents the defect extension direction of the first defect area; y2 represents the defect extension direction of the second defect area; z represents the distance between the first defect area and the second defect area; P 12 represents the extension probability between the first defect area and the second defect area; represents the cosine similarity between the defect extension direction of the first defect area and the defect extension direction of the second defect area; e represents a natural constant.
[0087] When the extension probability between two defect regions is greater than a preset threshold, the two defect regions are judged as a large defect region, which is a minimum circumscribed rectangular region including the two defect regions.
[0088] As a preference, in the embodiment of the present invention, the preset threshold value P 12 =0.7, that is, when the extension probability between two defect areas is not less than 0.7, the two defect areas are a large defect area.
[0089] Step S500, obtaining the influence degree according to the proportion of the area of all defective regions in the grayscale image area, and classifying the quality of the artificial board according to the influence degree.
[0090] The defective area in the grayscale image is obtained in step S400. Since the defective area destroys the surface integrity of the artificial board and affects its use value, it is necessary to analyze the impact degree of each artificial board and carry out targeted repairs on the artificial board according to different impact degrees.
[0091] Specifically, the degree of influence of defective areas on wood-based panels is:
[0092]
[0093] Where T represents the influence of defective area on the wood-based panel; S j represents the area of the jth defective region; J represents the number of defective regions; S 总 Represents the total area of the artificial board corresponding to the grayscale image.
[0094] It should be noted that the number of defects includes the number of large defect areas and the number of defect areas. In specific implementation, implementers can classify the quality of artificial boards into different levels according to the degree of impact, such as qualified products, repairable products and remade products.
[0095] When the impact level is 0, it means that the artificial board does not have defective areas and is a qualified product. When the impact level is small, the defective areas of the artificial board can be repaired, and there is basically no difference between the repaired artificial board and the qualified product. Such artificial boards are repairable products. When the impact level is greater, it means that the quality of the corresponding artificial board is worse, and the repair is more difficult. The artificial board needs to be re-veneered, which consumes more time and is a remade product.
[0096] In summary, the embodiment of the present invention obtains a grayscale image of the surface of an artificial board, obtains the grayscale value of the background pixel in the grayscale image, and obtains the degree of attention corresponding to each pixel according to the difference between the grayscale value of each pixel in the grayscale image and the grayscale value of the background pixel. The contrast of each pixel and its neighborhood is further calculated, and the abnormal probability of the pixel is obtained according to the degree of attention and contrast corresponding to each pixel, and a suspected abnormal area is obtained. The abnormal probability is obtained according to the unit vector and grayscale gradient feature vector corresponding to each pixel in each suspected abnormal area, and it is determined whether the suspected abnormal area is a defective area; the degree of influence is obtained according to the proportion of the area of the sum of all defective areas finally obtained in the grayscale image of the surface of the artificial board, so that the quality of the artificial board is divided according to the degree of influence. The above method can more accurately determine the defective area on the surface of the artificial board, thereby accurately classifying the quality of the artificial board and reducing resource waste.
[0097] Based on the same inventive concept as the above method embodiment, the present invention also provides a system for quality classification of artificial boards based on machine vision, the system comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above method embodiment for quality classification of artificial boards based on machine vision are implemented, for example Figure 1 The method for classifying the quality of artificial boards based on machine vision has been described in detail in the above embodiments and will not be described in detail again.
[0098] It should be noted that the sequence of the embodiments of the present invention described above is for description only and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, 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, multitasking and parallel processing are also possible or may be advantageous.
[0099] The various embodiments in this specification 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.
[0100] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for classifying wood-based panel quality based on machine vision, characterized in that: The method comprises the following steps: Acquire a grayscale image of the surface of the artificial board, wherein the surface of the artificial board includes a background and a pattern, wherein the pattern includes the pattern texture of the artificial board itself and a pattern of the bubble area; Calculate the difference between the grayscale value of all pixels in the grayscale image and the grayscale value of the background pixel, and assign a degree of attention to each pixel according to whether the difference belongs to a normal range; the normal range is the difference range between the grayscale value of the pattern pixel and the grayscale value of the background pixel; wherein, when the difference belongs to the normal range, the degree of attention is negatively correlated with the difference; when the difference does not belong to the normal range, the degree of attention is positively correlated with the difference; wherein, the degree of attention corresponding to each pixel is obtained according to the difference: Where B represents the degree of attention; i1 represents the gray value of the background pixel; ΔA represents the maximum difference in gray values within the gray image; m represents the difference threshold, The difference range greater than the difference threshold is the normal range; e represents a natural constant; Among them, the step of obtaining the grayscale value of the background pixel includes: obtaining the grayscale mean of the grayscale image and the first grayscale value with the highest frequency of occurrence in the grayscale image; selecting all the grayscale values with grayscale values between the grayscale mean and the first grayscale value as standard grayscale values, and calculating the standard mean and standard variance according to all the standard grayscale values; constructing a Gaussian model according to the standard mean and the standard variance, and the maximum value corresponding to the Gaussian model is the grayscale value of the background pixel; Obtaining the contrast of each pixel in the grayscale image; taking the attention degree of each pixel as a weight, multiplying it by the contrast of the corresponding pixel to obtain the abnormality degree of the corresponding pixel, and obtaining the suspected abnormal area according to the abnormality degree; Obtaining a grayscale gradient feature vector of each pixel point in the suspected abnormal area; obtaining a defect probability of the suspected abnormal area according to the grayscale gradient feature vector, and when the defect probability is greater than a preset threshold, the suspected abnormal area corresponding to the defect probability is a defect area; The influence degree is obtained according to the proportion of the area of all the defective regions in the area of the grayscale image, and the quality of the artificial board is classified according to the influence degree.
2. The method according to claim 1, characterized in that The step of obtaining the contrast of each pixel in the grayscale image comprises: Taking any pixel point in the grayscale image as the central pixel point, a window is formed according to the central pixel point and its neighborhood pixels, the grayscale co-occurrence matrix of the window is obtained, and the contrast of the window is obtained according to the grayscale co-occurrence matrix, where the contrast is the pixel value of the central pixel point.
3. The method according to claim 1, characterized in that The step of obtaining a suspected abnormal area according to the abnormality degree comprises: An abnormality degree threshold is set. When the abnormality degree corresponding to the pixel point is greater than the abnormality degree threshold, the pixel point is a suspected abnormal point, and the suspected abnormal area is obtained based on all the suspected abnormal points.
4. The method according to claim 1, characterized in that: The step of obtaining the grayscale gradient feature vector of each pixel in the suspected abnormal area includes: A sliding window is constructed with any pixel point in the suspected abnormal area as the center point, and the grayscale gradient change direction is obtained according to the gradient change of the grayscale value of the pixel point in the sliding window. The unit vector of the grayscale gradient change direction is the grayscale gradient change vector.
5. The method according to claim 1, characterized in that The step of obtaining the defect probability of the suspected abnormal area according to the gray gradient feature vector includes: Obtain a unit vector for each pixel in the suspected abnormal area, where the unit vector is a unit vector starting from the center point of the suspected abnormal area and in the direction of a line connecting all pixels in the suspected abnormal area; The cosine similarity between the grayscale gradient feature vector corresponding to each pixel and the unit vector is obtained, and the average cosine similarity of all pixels in the suspected abnormal area is the defect probability.
6. The method according to claim 1, characterized in that After the step of determining that the suspected abnormal area corresponding to the defect probability is a defect area, the method further includes: Acquire all the defect areas in the grayscale image, acquire the distance between all the defect areas, and when the distance is less than a preset distance, acquire the principal component directions of the two defect areas corresponding to the distance; The cosine similarity between the principal component directions corresponding to the two defect regions is calculated, and the extension probability is obtained according to the distance between the two defect regions and the cosine similarity. When the extension probability is greater than a preset threshold, the corresponding two defect regions are a large defect region.
7. A machine vision-based wood-based panel quality classification system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
