Sawn timber surface defect image processing method and sawn timber sorting system

Through iterative algorithms and morphological processing combined with BP neural networks, automatic recognition and classification of sawn timber surface defects are achieved, which solves the problem of low automation level in sawn timber sorting and improves sorting efficiency and recognition accuracy.

CN120733997AActive Publication Date: 2025-10-03MINJIANG NORMAL COLLEGE
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511220952.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-10-03
Estimated Expiration
2045-08-29

AI Technical Summary

Technical Problem

The automation level of sawn timber sorting is low, manual sorting is inefficient and has a high error rate, making it difficult to accurately judge surface defects in sawn timber.

Method used

The optimal global threshold segmentation based on iterative algorithm and morphological processing combined with BP neural network are used to realize automatic recognition and classification of sawn timber surface defect images.

Benefits of technology

It improves the efficiency and recognition rate of sawn timber sorting, reduces the intensity of manual labor and the error rate, and promotes the development of the sawn timber processing industry towards high efficiency, precision and intelligence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120733997A_ABST
    Figure CN120733997A_ABST
Patent Text Reader

Abstract

The invention provides a sawn timber surface defect image processing method and a sawn timber sorting system. The sawn timber sorting system comprises a rack, a sawn timber conveying module, a sawn timber detection module, a sawn timber automatic turn-over module and an automatic sorting module and further comprises sawn timber machine vision detection and whole machine motion control. According to the method, surface defects such as movable joints, dead joints and wormholes of sawn timber are recognized by collecting and processing images on the surface of the sawn timber, a sorting movement system is controlled according to an image analysis result, and real-time graded sorting operation on the sawn timber is achieved. According to the technical scheme, the sawn timber sorting efficiency and the recognition rate are improved, the labor intensity and the error rate of manual sorting are reduced, therefore, the labor cost is saved, the production period is shortened, and reliable data support is provided for follow-up refined processing and quality control of sawn timber.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automatic and rapid sorting of sawn timber, in particular to a method for processing images of surface defects of sawn timber and a sawn timber sorting system. Background Art

[0002] To save costs and improve log processing efficiency, most factories use multi-blade saws to initially process wood to obtain solid sawn timber. This solid sawn timber then requires subsequent sorting, quality inspection, and sorting based on its surface condition. Currently, the level of automation in sawn timber sorting is generally low, with most factories still using manual labor. This not only results in low processing efficiency but also makes it difficult to accurately assess timber quality.

[0003] After generations of refinements and improvements, current research algorithms based on image recognition technology have become increasingly stable and mature. They have achieved widespread application in object sorting operations within the fields of industrial robots, computer vision, and hand-eye vision. However, applications in woodworking equipment are generally still in the R&D or rollout stages. Surface defect detection in sawn timber typically relies on human visual identification of defects, such as color, texture, and shape, to determine and classify them. However, relying solely on the human eye can lead to misjudgments and omissions. Furthermore, the proficiency and work attitude of the inspector can also affect the results. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a sawn timber surface defect image processing method and a sawn timber sorting system, so as to improve the sawn timber sorting efficiency and recognition rate and reduce the labor intensity and error rate of manual sorting.

[0005] To achieve the above object, the present invention adopts the following technical solution: a method for processing an image of sawn timber surface defects, comprising the following steps:

[0006] Step 1: Collect sawn timber surface images and perform preprocessing;

[0007] Step 2: According to the different properties of each part of the sawn timber surface image, the sawn timber surface image information is segmented to extract the region of interest, and then the image segmentation and morphological processing are performed; The specific segmentation of the sawn timber surface image information includes: using the best global threshold segmentation based on the iterative algorithm to segment the entire sawn timber surface image; iteratively obtaining the best threshold process: the total gray level of the 8-bit image is 256 levels; setting the initial threshold is equal to the average gray value of the image, and the iteration starts according to formula (1); at the first iteration , when the iteration reaches The iteration is terminated when , and the threshold obtained at this time is the optimal threshold;

[0008] (1)

[0009] Where: is the threshold obtained in the next iteration; is the threshold obtained in the previous iteration; is the current grayscale value; The gray value is equal to The number of pixels;

[0010] The first iteration is performed using the initially generated approximate threshold, and the next iteration is performed using the new threshold generated by the iteration; each threshold divides the image into two categories;

[0011] The segmentation of sawn timber surface image information includes: adopting the best global threshold segmentation based on iterative algorithm and obtaining the best threshold through iteration;

[0012] Morphological processing after image segmentation includes: step 21, closing the small disconnected areas in the defect area by dilating the target area; step 22, filling operation; step 23, eliminating small particles by opening operation; step 24: flooding operation;

[0013] Step 3: Detect defects on the sawn timber surface image based on BP neural network.

[0014] In a preferred embodiment, the step 1 specifically includes:

[0015] Step 11: Establish a defect image sample library. Based on the characteristics of each defect, collect sawn timber surface images and perform post-processing to obtain 100 512×512 pixel samples of live knots, dead knots, and insect holes. Use the RGB model as the color space model. The red plane with the largest standard deviation among the live knots, dead knots, and insect holes samples is selected, and the grayscale image of the red plane with the largest contrast is extracted.

[0016] Step 12: Use histogram equalization to further process the obtained red plane; after histogram equalization processing, the grayscale values ​​of the image pixels of the live knot, dead knot, and insect eye defect samples are evenly distributed in the entire grayscale range, the number of grayscale value types of pixels is reduced, and the total number of pixels of each grayscale value is increased.

[0017] In a preferred embodiment, the morphological processing after image segmentation in step 2 specifically includes the following steps:

[0018] Step 21: The small disconnected areas in the defective area are closed by dilating the target area through the dilation operation. The dilation operation is obtained by the correlation operation between the object to be processed A and the structural element B. The symbol of the dilation operation is ⊕, and the dilation of the object to be processed A through the structural element B is defined as follows:

[0019] (2)

[0020] In the formula, x represents the structural element Center reference point position, Indicates that the structural elements The result of reversing and translating the elements of The set of x that intersects with A after translation is the result of the expansion of the object A to be processed. A cross structuring element B is used, and the cross in its center represents its reference point. The cross structuring element B has a symmetrical structure, so the cross structuring element B is consistent with the inverted cross structuring element B. Based on the expansion principle, the position that the reference point can reach is added to the original binary image to obtain the expanded binary image.

[0021] Step 22: Filling operation, that is, setting all pixels with pixel values ​​of 1 in the closed area inside the defect to 0, so that the defect area becomes a whole without holes;

[0022] Step 23: Use opening operation to eliminate small particles, first erosion and then expansion; the symbol of the corrosion operation is , then the object A to be processed is defined as follows through the corrosion of the structural element B:

[0023] (3)

[0024] In the formula, x represents the structural element Center reference point position; structural element When the structural element can still be completely contained in A after moving, The set of reference point positions in the image is the result of image corrosion; the symbol of the opening operation is , the object to be processed A is defined as follows through the structure element B:

[0025] (4)

[0026] Step 24: Through the flooding operation, the binary image of the defect area obtained after the small area removal operation is multiplied by the grayscale image of the defect area obtained after the median filter, that is, the filtered grayscale image of the defect area is obtained. Equation (5) is the principle of image multiplication operation:

[0027] (5)

[0028] Where, represents the image obtained after flooding the model, represents the binary image of the defect area, Filtered grayscale image representing the defect area.

[0029] In a preferred embodiment, step 3 specifically includes: training 150 defect samples with a BP neural network classifier and testing the remaining 150 defect samples to obtain the recognition rate when the number of neurons in each hidden layer is selected; when the number of neurons in the hidden layer is 8, the recognition rate is the highest, thereby determining the theoretical recognition rate of this network classifier.

[0030] The present invention also provides a sawn timber sorting system, comprising a frame, a sawn timber conveying module, a sawn timber detection module, a sawn timber automatic turning module, and an automatic sorting module; it also adopts the aforementioned sawn timber surface defect image processing method; the sawn timber is transported by the sawn timber conveying module, and after the first industrial camera installed above the sawn timber conveying module collects the defect image of the first side of the sawn timber, the sawn timber whose first side image has been collected is automatically turned over during movement by the sawn timber automatic turning module, and the defect image of the second side is collected by the second industrial camera; the two sides of the images of the same piece of sawn timber are analyzed by the sawn timber surface defect image processing method in the upper computer to obtain processing results, and the types of defects on the sawn timber surface are distinguished and transmitted to the lower computer automatic sorting module through the serial port, so as to control the sawn timber to fall into the corresponding collection area for sorting.

[0031] Compared with the existing technology, the present invention has the following beneficial effects: the present invention can realize automatic turning over of sawn timber, and combined with high-performance image acquisition, it can identify and classify defects such as live knots, dead knots, and worm holes on the surface of sawn timber during sorting operations. Matlab is used for image analysis, and the obtained results are communicated with the serial port of Arduino Mega2560 to control the sorting structure motion system to realize online automatic sorting of sawn timber, aiming to improve the sorting efficiency and recognition rate of sawn timber, reduce the labor intensity and error rate of manual sorting, thereby saving labor costs and shortening the production cycle, and provide reliable data support for the subsequent refined processing and quality control of sawn timber, thereby promoting the development of the sawn timber processing industry towards high efficiency, precision, and intelligence. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a structural diagram of a sawn timber sorting system according to a preferred embodiment of the present invention;

[0033] Figure 2 A schematic diagram of the structure of a machine vision system according to a preferred embodiment of the present invention;

[0034] Figure 3 A schematic diagram of a motion control system flow chart of a preferred embodiment of the present invention;

[0035] Figure 4 This is the GUI interface of the automatic sorting module in the preferred embodiment of the present invention;

[0036] Figure 5Schematic diagram of the preprocessing process of three types of defect sample images in a preferred embodiment of the present invention, where (a) is the original sample image, (b) is the image after taking the red plane, and (c) is the image after equalization;

[0037] Figure 6 Schematic diagram of the image segmentation and post-segmentation morphological processing flow of three types of defect samples in a preferred embodiment of the present invention, wherein (a) is the image after segmentation, (b) is the dilation image, (c) is the image after the opening operation, and (d) is the regional grayscale image;

[0038] Figure 7 Schematic diagram of the dilation principle of a preferred embodiment of the present invention, wherein (a) is the binary image A to be dilated, (b) is the structuring element B, (c) is the inverted structuring element B, and (d) is the binary image after dilation;

[0039] Figure 8 Schematic diagram of the etching principle of a preferred embodiment of the present invention, wherein (a) is the binary image A to be etched, (b) is the structural element B, and (c) is the binary image after etching;

[0040] Figure 9 Schematic diagram of the opening operation principle of a preferred embodiment of the present invention, wherein (a) is the binary image A to be operated, (b) is the structural element B, (c) is AΘB, and (d) is (AΘB)⊕B;

[0041] Figure 10 A schematic diagram of the BP neural network training process according to a preferred embodiment of the present invention;

[0042] Reference numerals: 1 sunshade; 21 first industrial camera; 22 second industrial camera; 3 sawn timber conveying module; 4 automatic sorting module; 5 sawn timber; 6 sawn timber automatic turning module; 7 sawn timber detection module. DETAILED DESCRIPTION

[0043] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0044] It should be noted that the following detailed description is illustrative and is intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meaning as commonly understood by those skilled in the art to which the present application belongs.

[0045] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application; as used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form, and it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or their combinations.

[0046] A sawn timber sorting system, reference Figure 1-10 , including machine vision system and motion control system; its overall framework is as follows Figure 1 According to the functions of the various parts of the mechanical structure, it can be divided into: frame, sawn timber conveying module 3, sawn timber detection module 7, sawn timber automatic turning module 6, automatic sorting module 4, etc.

[0047] The lumber is smoothly and orderly transported by the conveyor module. A first industrial camera 21, mounted above the module, captures defect images of the lumber's first side. The automatic lumber flipping module automatically flips the lumber, which has already captured images of the first side, while it's moving. A second industrial camera 22 then captures defect images of the second side. The upper computer analyzes these images of both sides of the same lumber, identifies the type of surface defects, and transmits the results via a serial port to the lower computer's automatic sorting module, which then directs the lumber into the appropriate collection area for sorting.

[0048] The overall structure of the machine vision system is as follows Figure 2 The hardware consists of a light source, a MER-125-30GM / CP industrial digital camera, an image acquisition card, a laser sensor, and a computer. The software consists of LabVIEW and Ni Vision Assistant. The sawn timber surface image undergoes preprocessing, including color plane extraction, median filtering, and histogram equalization. Morphological processing is then performed after segmentation using an iterative algorithm, including optimal global threshold segmentation. The moment of inertia from the gray-level co-occurrence matrix is ​​extracted as defect features. These features are then used to train and test a BP neural network classifier, achieving a theoretical recognition rate. A system, including image acquisition, processing, and storage modules, is developed using LabVIEW as the primary software to detect live knots, dead knots, and insect holes on the sawn timber surface.

[0049] The conveying part of the automatic sorting module is similar in structure to the sawn timber conveying module, except that in the automatic sorting module, the sawn timber is conveyed under the industrial conveyor chain.

[0050] The system's motion control system uses a large number of motors and requires features such as easy parameter setting, automatic sorting counting, automatic stop and alarm when full, and easy operation for operators. A combination of Graphical User Interfaces (GUI) and Arduino is used to control the motion of the automatic plate sorting machine. The overall motion control system process is as follows: Figure 3 shown.

[0051] Upper computer design scheme:

[0052] The host computer uses Matlab to create a graphical user interface to control the communication with the lower computer. The GUI interface of the automatic sorting module is as follows: Figure 4 As shown. By clicking the Start button, the user will enter the full load quantity setting reminder dialog box. After the user completes the parameter setting, the callback function corresponding to the "Start" button will run, automatically complete the parameter initialization and send the "S" run command to the lower computer. If there are special circumstances and it is not necessary to clear all data, the user can click the "Pause" button to pause the current device operation. To resume operation, click "Continue". If you need to reset the parameters and other functions, click the "Reset" button.

[0053] When the automatic sorting module is working normally, if the count quantity of a certain type of sawn timber collection area reaches the full load value, the system will automatically pause and pop up a reminder dialog box to remind the user to clear the sawn timber of the corresponding type of sawn timber collection area. Click the "Continue" button to restore the original operating state.

[0054] Lower computer design:

[0055] The automatic sorting module uses Matlab and an Aridiuno microcontroller as its core control system, controlling the stepper motor and performing image processing. The slave computer hardware includes: an Arduino Mega 2560 motherboard, a GP2D12 infrared ranging sensor, two industrial cameras, six ATK-2MD4850 ​​stepper motor drivers, two 86-series stepper motors, four 57-series stepper motors, and both an AC 220 V power supply and a DC 12-48 V power supply. The slave computer primarily receives start and stop signals from the master computer and responds accordingly. It also sends the master computer the type of sawn timber currently being sorted, which it uses for counting and other purposes.

[0056] The method for processing sawn timber surface defect images is used to process sawn timber surface defect images. Specifically, the method includes the following steps:

[0057] Step 1: Collect sawn timber surface images and perform preprocessing;

[0058] Step 2: According to the different properties of each part of the sawn timber surface image, the sawn timber surface image information is segmented to extract the region of interest, and then the image segmentation and morphological processing are performed;

[0059] Step 3: Detect defects on the sawn timber surface image based on BP neural network.

[0060] Specifically, in step 1, extracting defect texture features requires a certain number of defect image samples, necessitating the establishment of a defect image sample library. This method collects surface images of sawn Chinese fir timber based on the characteristics of each defect. Through post-processing, the method ultimately generates 100 samples each of live knots, dead knots, and insect holes, each with a resolution of 512×512 pixels. Figure 5 (a) shows three types of defect sample images randomly selected from the sample library. For the convenience of description, these three images are used as processing objects below.

[0061] Using the RGB model as the color space model, we sorted out the distribution of samples in the color space (Table 1). We found that the standard deviation of the red plane of the selected live knots, dead knots, and insect eyes is the largest, that is, the contrast between the defective area and the normal area of ​​this plane is the largest. Therefore, we extracted the grayscale image of the red plane with the largest contrast ( Figure 5 (b)).

[0062] Table 1 Grayscale characteristics of each plane of the sample

[0063]

[0064] In IN Vision Assistant, the lookup table function can transform the grayscale range of an image input into another grayscale range. Specifically, it expands the grayscale of important information in the image and compresses the grayscale of other image areas to a fixed value, thereby highlighting the important information in the image. The grayscale conversion rules of the lookup table function are as follows:

[0065] (1)

[0066] in, is the gray level of the pixel after transformation, is the gray level of the pixel before transformation, is the dynamic minimum gray level, is the dynamic maximum gray level; For the independent variable The output grayscale obtained after the specific operation or mapping rule is processed. is the dynamic minimum gray level threshold, is the dynamic maximum gray level threshold.

[0067] The value of depends on the type of lookup table function selected. The types of lookup table functions provided by IN Vision Assistant include histogram equalization, inversion, logarithm, exponential, square, square root, and power functions. For 8-bit images, The value of is 0, The value of is 255.

[0068] The present invention uses histogram equalization to further process the obtained red plane. The grayscale histogram is a one-dimensional discrete function of the grayscale value of the image. Although it cannot specifically reflect the specific position of each pixel, it can be used to show the distribution, contrast, and brightness of the image grayscale value. Histogram equalization expands a large number of pixels in the original small grayscale range to a larger grayscale range, amplifying the original small grayscale changes and increasing the contrast and clarity of the image. Figure 5 As shown in (c), after histogram equalization, the grayscale values ​​of the three defective samples are more evenly distributed across the entire grayscale range. The number of pixel grayscale values ​​decreases, while the total number of pixels of each grayscale value increases. This processing also increases the contrast of the image, highlighting the defective areas.

[0069] Step 2 specifically includes image segmentation and morphological processing after image segmentation;

[0070] Image segmentation is the process of segmenting image information to extract regions of interest based on the different properties of different regions in the image. The present invention uses an optimal global threshold segmentation based on an iterative algorithm to segment the collected whole sawn timber image. The iterative process for obtaining the optimal threshold is as follows: In the present invention, the total grayscale level of the 8-bit image is 256. Let the initial threshold be is equal to the average grayscale value of the image, and the iteration starts according to formula (2). , when the iteration reaches The iteration is terminated when , and the threshold obtained at this time is the optimal threshold.

[0071] (2)

[0072] Where: is the threshold obtained in the next iteration; is the threshold obtained in the previous iteration; is the current grayscale value; The gray value is equal to The number of pixels.

[0073] The segmentation method uses the initial approximate threshold for the first iteration and uses the new threshold generated by iteration for the next iteration. Each threshold can divide the image into two categories. The three types of defect samples after image segmentation are as follows Figure 6 As shown in (a), a better image processing effect is obtained.

[0074] Post-segmentation morphological processing is a process of performing a series of operations on the image after preprocessing and image segmentation to improve the defect area, further remove particle noise, and finally obtain a grayscale image of the defect area.

[0075] In step 2, the morphological processing dilation operation after image segmentation includes dilation operation, filling operation, removal of small areas and grayscale image extraction of defect areas;

[0076] Step 21: The dilation operation specifically includes: The binary image obtained through image segmentation may contain some defective areas that should be closed but are not, affecting the subsequent filling operation. The dilation operation can close the small disconnected areas in the defective area by dilating the target area. The dilation operation is performed by performing a correlation operation on the object to be processed A and the structuring element B. The symbol for the dilation operation is ⊕. The dilation of the object to be processed A by the structuring element B can be defined as follows:

[0077] (3)

[0078] In the formula, x represents the structure Center reference point position, Indicates that the structure The result after the elements of are reversed and translated a certain distance. The meaning of this formula is that all The set of x that intersects A after translation is the result of the expansion of the object A to be processed. Figure 7 This process is described from a graphical perspective.

[0079] The present invention adopts a cross structure element B, the cross in the center of which represents its reference point. The cross structure element B has a symmetrical structure, so Figure 7 The structural element B in (b) is Figure 7 Based on the above expansion principle, the position that the reference point can reach is added to the original binary image to obtain Figure 7 The expanded binary image shown in (d) is shown in Figure 3. Obviously, compared with the original binary image, this image has an extra circle of pixels on the outer layer, which has the effect of expansion. The expanded images of the three types of defect samples in the present invention are shown in Figure 3. Figure 6 as shown in (b).

[0080] Step 22: The filling operation involves filling the holes in the closed area so that they become one with the target particle. Due to the pixel grayscale characteristics of the dead node sample itself, the image segmentation generally presents a "ring shape," meaning that there are a large number of pixels with a value of 1 in the middle of the defect. At the same time, live nodes and insect holes may also have a small number of pixels with a value of 1 remaining in the defect area. The ultimate goal of the present invention is to extract the grayscale image of the defect area, so all pixels with a value of 1 in the closed area within the defect must be set to 0, making the defect area a hole-free whole.

[0081] Step 23: Removing Small Areas

[0082] After completing all of the above operations, a certain number of small particles will generally still exist around the target area. To eliminate the impact of these particles on the grayscale image extraction of the defect area, the present invention uses an opening operation to eliminate small particles while also smoothing the contours of the defect area. In image morphological operations, the operation of performing erosion followed by dilation is called an opening operation. The principle of image dilation has been introduced above; the principles of image erosion and opening operations will be described below.

[0083] Like the dilation operation, the erosion operation is also obtained by the correlation operation between the object to be processed A and the structural element B. The symbol of the erosion operation is , then the object A to be processed can be defined as follows through the corrosion of the structural element B:

[0084] (4)

[0085] In the formula, x represents the structure The meaning of this formula is After moving, it can still be completely contained in A The set of reference point positions in is the result of image erosion. The erosion operation is described graphically as follows: Figure 8 shown.

[0086] The opening operation is the process of first corroding and then dilating. The symbol of the opening operation is , the object to be processed A can be defined as follows through the structure element B to open the operation:

[0087] (5)

[0088] For a specific binary image, the operation principle of the opening operation is as follows Figure 9 shown.

[0089] Depend on Figure 9 It can be seen that the opening operation can remove some isolated points in the binary image. Generally speaking, the opening operation can also remove burrs in the binary image, while the shape and position of the target body remain unchanged. Therefore, the present invention uses the opening operation to remove some small particles outside the defect area and soften the outline of the defect area to a certain extent. The effects of the three types of defects after the opening operation (removal of small areas) are as follows Figure 6 As shown in (c).

[0090] Step 24: Grayscale image extraction of defect area

[0091] The present invention performs a multiplication operation on the binary image of the defective area obtained after the small area removal operation and the grayscale image of the defective area obtained after the median filtering through the flooding operation, and thus obtains the filtered grayscale image of the defective area. Figure 6 (c). Formula (6) is the principle of image multiplication operation.

[0092] (6)

[0093] Where, represents the image obtained after flooding the model, represents the binary image of the defect area, Filtered grayscale image representing the defect area.

[0094] The surface defect detection of sawn timber based on BP neural network in step 3 specifically includes:

[0095] The defect feature analysis phase of the double-sided defect detection process for sawn timber involves extracting and analyzing various geometric and shape features to identify double-sided defects. This invention uses a BP neural network to identify and classify surface defects in sawn timber. The BP neural network classifier was trained on 150 defect samples and tested on the remaining 150 defect samples. The recognition rates for each number of hidden layer neurons were calculated. As shown in Table 2, the highest recognition rate was achieved when the number of hidden layer neurons was 8, with a relatively low number of iterations. Therefore, the theoretical recognition rate of this network classifier was determined to be 88.67%.

[0096] Table 2 Recognition rates with different numbers of hidden layer neurons

[0097]

[0098] like Figure 10 As shown in the figure, the mean square error decreases with the increase of the number of iterations during the network training process. When the number of iterations reaches 71, the system mean square error reaches the set system error requirement and the training is completed.

[0099] In order to verify the technical effect of the present invention, prototype tests are also included:

[0100] The lumber is placed at the feed end of a conveyor belt, which drives it forward. When it reaches the designated inspection position, the belt stops, and a camera captures and processes the image, displaying the inspection results. Each conveyor stop lasts 3 seconds. When the previously inspected lumber leaves the conveyor belt, the next lumber is loaded. The recognition rate for lumber surface defects is calculated.

[0101] Table 3 shows the number of correctly detected defects and their recognition rates for each defect type, as well as the number of correctly detected defects and their recognition rates for all defects. The experimental results show that in actual operation, the overall recognition accuracy of the sawn timber surface inspection system was approximately 84.44%, slightly lower than the theoretical recognition efficiency of 88.67% for the BP neural network classifier. Among them, the recognition rate for wormholes was the lowest, while live and dead knots had the same recognition rate.

[0102] Table 3 Detection and recognition rate of sawn timber surface defects

[0103]

[0104] Experiments show that this BP neural classifier has good classification stability.

[0105] This modularly designed sawn timber sorting system meets the requirements for surface defect detection. The system operates stably, ensuring accurate sorting results and reliable operation without noticeable vibration or noise. Parameter settings and system startup and shutdown are easily accomplished through a user-friendly graphical user interface.

Claims

1. A method for processing sawn timber surface defect images, characterized in that: The following steps are involved: Step 1: Collect sawn timber surface images and perform preprocessing; Step 2: According to the different properties of each part of the sawn timber surface image, the sawn timber surface image information is segmented to extract the region of interest, and then the image segmentation and morphological processing are performed; Segmenting the sawn timber surface image information specifically includes: using the best global threshold segmentation based on the iterative algorithm to segment the collected whole sawn timber surface image; Iterative process of finding the optimal threshold: the total gray level of the 8-bit image is 256; let the initial threshold is equal to the average gray value of the image, and the iteration starts according to formula (1); at the first iteration , when the iteration reaches The iteration is terminated when , and the threshold obtained at this time is the optimal threshold; (1) Where: is the threshold obtained in the next iteration; is the threshold obtained in the previous iteration; is the current grayscale value; The gray value is equal to The number of pixels; The first iteration is performed using the initially generated approximate threshold, and the next iteration is performed using the new threshold generated by the iteration; each threshold divides the image into two categories; Step 3: Detect defects on the sawn timber surface image based on BP neural network.

2. The method for processing sawn timber surface defect images according to claim 1, characterized in that: The step 1 specifically includes: Step 11: Establish a defect image sample library. Based on the characteristics of each defect, collect sawn timber surface images and perform post-processing to obtain 100 512×512 pixel samples of live knots, dead knots, and insect holes. Use the RGB model as the color space model. The red plane with the largest standard deviation among the live knots, dead knots, and insect holes samples is selected, and the grayscale image of the red plane with the largest contrast is extracted. Step 12: Use histogram equalization to further process the obtained red plane; after histogram equalization processing, the grayscale values ​​of the image pixels of the live knot, dead knot, and insect eye defect samples are evenly distributed in the entire grayscale range, the number of grayscale value types of pixels is reduced, and the total number of pixels of each grayscale value is increased.

3. The method for processing sawn timber surface defect images according to claim 1, characterized in that: The morphological processing after image segmentation in step 2 specifically includes the following steps: Step 21: Dilation operation: The small disconnected areas in the defect area are closed by dilating the target area. The dilation operation is obtained by performing a correlation operation between the object to be processed A and the structural element B. The symbol of the dilation operation is ⊕, and the dilation of the object to be processed A by the structural element B is defined as follows: (2) In the formula, x represents the structural element Center reference point position, Indicates that the structural elements The result of reversing and translating the elements of The set of x that intersects with A after translation is the result of the expansion of the object A to be processed. A cross structuring element B is used, and the cross in its center represents its reference point. The cross structuring element B has a symmetrical structure, so the cross structuring element B is consistent with the inverted cross structuring element B. Based on the expansion principle, the position that the reference point can reach is added to the original binary image to obtain the expanded binary image. Step 22: Filling operation, that is, setting all pixels with pixel values ​​of 1 in the closed area inside the defect to 0, so that the defect area becomes a whole without holes; Step 23: Use opening operation to eliminate small particles, first erosion and then expansion; the symbol of the corrosion operation is , then the object A to be processed is defined as follows through the corrosion of the structural element B: (3) In the formula, x represents the structural element Center reference point position; structural element When the structural element can still be completely contained in A after moving, The set of reference point positions in the image is the result of image corrosion; the symbol of the opening operation is , the object to be processed A is defined as follows through the structure element B: (4) Step 24: Through the flooding operation, the binary image of the defect area obtained after the small area removal operation is multiplied by the grayscale image of the defect area obtained after the median filter, that is, the filtered grayscale image of the defect area is obtained. Equation (5) is the principle of image multiplication operation: (5) Where, represents the image obtained after flooding the model, represents the binary image of the defect area, Filtered grayscale image representing the defect area.

4. The method for processing sawn timber surface defect images according to claim 1, characterized in that: The step 3 specifically includes: using the BP neural network classifier to train 150 defect samples and testing the remaining 150 defect samples to obtain the recognition rate when the number of neurons in each hidden layer is set; when the number of neurons in the hidden layer is 8, the recognition rate is the highest, thereby determining the theoretical recognition rate of the network classifier.

5. A sawn timber sorting system, characterized in that: It includes a frame, a sawn timber conveying module, a sawn timber detection module, a sawn timber automatic turning module, and an automatic sorting module; it also adopts a sawn timber surface defect image processing method described in any one of claims 1 to 4 above; the sawn timber is transported by the sawn timber conveying module, and after the first industrial camera installed above the sawn timber conveying module collects the defect image of the first side of the sawn timber, the sawn timber whose first side image has been collected is automatically turned over during movement through the sawn timber automatic turning module, and the defect image of the second side is collected through the second industrial camera; the two sides of the image of the same piece of sawn timber are analyzed by the sawn timber surface defect image processing method in the upper computer to obtain the processing results, and the types of defects on the sawn timber surface are distinguished, and transmitted to the lower computer automatic sorting module through the serial port, so as to control the sawn timber to fall into the corresponding collection area for sorting.

Citation Information

Patent Citations

  • Sawn timber surface defect position positioning method and system

    CN111476779A

  • Wood defect detection method based on improved YOLOX model

    CN115222685A

  • Method, device, and program for inspecting wood

    JP2007147442A

  • Method of evaluating logs to predict properties of lumber or veneer produced from the logs

    US20030093241A1

  • System for imaging sawn timber

    US20140002634A1