A sawn timber surface defect image processing method and a sawn timber sorting system

The sawn timber surface defect detection method, which combines iterative algorithms and BP neural networks, solves the problem of low automation level in sawn timber sorting. It realizes automatic identification and classification of sawn timber surface defects, improves sorting efficiency and recognition rate, and reduces human error rate.

CN120733997BActive Publication Date: 2025-11-21MINJIANG NORMAL COLLEGE
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The current level of automation in sawn timber sorting is low, and reliance on manual sorting leads to low efficiency, difficulty in accurately controlling quality, and a high rate of human error.

Method used

A method combining optimal global threshold segmentation based on iterative algorithms and morphological processing with a BP neural network is used to detect and classify defects in sawn timber surface images. This method is combined with an industrial camera and an automatic flipping module to achieve automatic identification and sorting of sawn timber surface defects.

Benefits of technology

It enables automatic identification and classification of surface defects in sawn timber, improves sorting efficiency and recognition rate, reduces manual labor intensity and 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 CN120733997B_ABST
    Figure CN120733997B_ABST
Patent Text Reader

Abstract

The application provides a sawing material surface defect image processing method and a sawing material sorting system, which comprises a rack, a sawing material conveying module, a sawing material detection module, a sawing material automatic turning module, an automatic sorting module, and further comprises sawing material machine vision detection and whole machine motion control. Through image acquisition and processing on the surface of the sawing material, surface defects such as knots, dead knots and insect eyes of the sawing material are identified, and the sorting motion system is controlled according to the image analysis result, so that real-time grading and sorting operation of the sawing material is realized. The technical scheme aims to improve the sawing material sorting efficiency and recognition rate, reduce the labor intensity and error rate of manual sorting, thereby saving labor cost, shortening the production cycle, and providing reliable data support for subsequent fine processing and quality control of the sawing material.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated and rapid sorting technology for sawn timber, and in particular to a method for image processing of surface defects in sawn timber and a sawn timber sorting system. Background Technology

[0002] To save costs and improve log processing efficiency, most factories use multi-blade saws for initial processing of timber to obtain solid lumber. The obtained solid lumber needs to undergo subsequent finishing, quality inspection, and sorting based on its surface condition. Currently, the level of automation in lumber sorting is generally low, and most factories still use manual labor, which not only results in low processing efficiency but also makes it difficult to accurately control the quality of the timber.

[0003] Current image recognition algorithms, after generations of modification and refinement, have become increasingly stable and mature, and are widely used in target sorting operations within the field of industrial robots + computer vision / hand-eye vision. However, their application in woodworking equipment is generally still in the research and development or promotion stage. Surface defect detection in sawn timber typically relies on manual identification of defects by the human eye, using features such as color, texture, and shape for judgment and classification. However, relying solely on human visual identification can easily lead to misjudgments and omissions. Furthermore, the skill level and working condition of the inspectors can also affect the inspection results. Summary of the Invention

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

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

[0006] Step 1: Acquire images of the sawn timber surface and perform preprocessing;

[0007] Step 2: Based on the different properties of each region in the sawn timber surface image, the sawn timber surface image information is segmented to extract the region of interest, and then morphological processing is performed after image segmentation.

[0008] The segmentation of the sawn timber surface image information specifically includes: segmenting the acquired entire sawn timber surface image using an optimal global threshold segmentation based on an iterative algorithm; iteratively determining the optimal threshold: the total gray levels of the 8-bit image are 256; setting an initial threshold... The value is equal to the average gray value of the image, and the iteration begins according to formula (1); during the first iteration... When the iteration proceeds to The iteration terminates when the threshold obtained at this point is the optimal threshold.

[0009] (1)

[0010] In the formula: The threshold obtained in the next iteration; The threshold obtained from the previous iteration; This is the current grayscale value; For grayscale value equal to The number of pixels;

[0011] The first iteration uses an initially generated approximate threshold, and the next iteration uses a new threshold generated by the overlay; each threshold divides the image into two categories.

[0012] Segmentation of sawn timber surface image information includes: using optimal global threshold segmentation based on an iterative algorithm, and obtaining the optimal threshold through iteration;

[0013] Morphological processing after image segmentation includes: Step 21, closing the small broken areas in the defect area by dilating the target area; Step 22, filling operation; Step 23, eliminating small particles by opening operation; Step 24, overmolding operation.

[0014] Step 3: Defect detection is performed on the surface image of the sawn timber based on a BP neural network.

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

[0016] Step 11: Establish a defect image sample library; based on the characteristics of various defects, collect images of the sawn timber surface, and through post-image processing, finally obtain 100 samples each of live knots, dead knots, and wormhole defects with a resolution of 512×512 pixels; using the RGB model as the color space model, the red plane has the largest standard deviation among the live knot, dead knot, and wormhole samples, and extract the red plane grayscale image with the highest contrast.

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

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

[0019] Step 21: The small breaks in the defect area are closed by expanding the target area through the expansion operation. The expansion operation is obtained through the correlation operation between the object to be processed A and the structuring element B. Let the symbol of the expansion operation be ⊕, then the expansion of the object to be processed A through the structuring element B is defined as follows:

[0020] (2)

[0021] In the formula, x represents the structuring element. Central reference point location, Indicates that the structural element The result of reversing and translating the elements; all The set of x that intersect with A after translation is the result of the dilated object A; a cross-shaped structural element B is used, with the cross in its center representing its reference point; the cross-shaped structural element B has a symmetrical structure, so the cross-shaped structural element B is consistent with the inverted cross-shaped structural element B; based on the dilation principle, the position that the reference point can reach is added to the original binary image to obtain the dilated binary image.

[0022] Step 22: Fill operation, which sets all pixels with a value of 1 in the closed area inside the defect to 0, so that the defect area becomes a hole-free whole;

[0023] Step 23: Use opening operations to eliminate fine particles, performing corrosion followed by expansion; denoted by the symbol for the corrosion operation is... Then, the object A to be processed is defined as follows through erosion using structuring element B:

[0024] (3)

[0025] In the formula, x represents the structuring element. Reference point position; structural element When a structure element can still be completely contained within A after being moved, The set of reference point locations is the result of image erosion; the symbol for the opening operation is denoted as . The object A to be processed is defined using the structure element B as follows:

[0026] (4)

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

[0028] (5)

[0029] In the formula, This represents the image obtained after flooding. Represents a binary image of the defect region. The filtered grayscale image representing the defect area.

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

[0031] This invention also provides a sawn timber sorting system, including a frame, a sawn timber conveying module, a sawn timber detection module, a sawn timber automatic flipping module, and an automatic sorting module; it also employs the aforementioned sawn timber surface defect image processing method; the sawn timber is conveyed by the sawn timber conveying module, and after a first industrial camera installed above the sawn timber conveying module captures a defect image of the first side of the sawn timber, the sawn timber with the first side image captured is automatically flipped during transport by the sawn timber automatic flipping module, and a second industrial camera captures a defect image of the second side; the two side images of the same sawn timber are analyzed by the sawn timber surface defect image processing method in the host computer to obtain the processing result, identify the type of defect on the sawn timber surface, and transmit the result to the lower computer automatic sorting module via serial port, controlling the sawn timber to fall into the corresponding collection area for sorting.

[0032] Compared with existing technologies, this invention has the following beneficial effects: This invention can realize automatic flipping of sawn timber. Combined with high-performance image acquisition, it identifies and classifies defects such as live knots, dead knots, and wormholes on the surface of sawn timber during sorting operations. It uses Matlab for image analysis and communicates the results with an Arduino Mega2560 serial port to control the sorting structure motion system to achieve online automatic sorting of sawn timber. The aim is to improve the efficiency and recognition rate of sawn timber sorting, reduce the labor intensity and error rate of manual sorting, thereby saving labor costs, shortening the production cycle, and providing reliable data support for subsequent fine processing and quality control of sawn timber, thus promoting the development of the sawn timber processing industry towards high efficiency, precision, and intelligence. Attached Figure Description

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

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

[0035] Figure 3 This is a schematic diagram of the motion control system according to a preferred embodiment of the present invention;

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

[0037] Figure 5This is a schematic diagram of the image preprocessing process for three types of defect samples according to a preferred embodiment of the present invention, wherein (a) is the original image of the sample, (b) is the image after taking the red plane, and (c) is the image after equalization;

[0038] Figure 6 The diagram below illustrates the process of segmenting three types of defect sample images and performing morphological processing after segmentation, according to a preferred embodiment of the present invention. In this diagram, (a) is the segmented image, (b) is the dilated image, (c) is the image after the opening operation, and (d) is the region grayscale image.

[0039] Figure 7 This is a schematic diagram of the dilation principle of a preferred embodiment of the present invention, wherein (a) is a binary image A to be dilated, (b) is a structuring element B, (c) is a reversed structuring element B, and (d) is a binary image after dilation.

[0040] Figure 8 This is a schematic diagram of the corrosion 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 corrosion;

[0041] Figure 9 This is a 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 on, (b) is the structuring element B, (c) is AΘB, and (d) is (AΘB)⊕B;

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

[0043] Figure reference numerals: 1. Light shield; 21. First industrial camera; 22. Second industrial camera; 3. Sawn timber conveying module; 4. Automatic sorting module; 5. Sawn timber; 6. Automatic sawn timber flipping module; 7. Sawn timber detection module. Detailed Implementation

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

[0045] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0046] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application; as used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise; furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0047] A sawn timber sorting system, reference Figure 1-10 It includes machine vision systems and motion control systems; its overall framework is as follows: Figure 1 As shown. Based on the function of each part of the mechanical structure, it can be divided into: frame, sawn timber conveying module 3, sawn timber detection module 7, sawn timber automatic flipping module 6, automatic sorting module 4, etc.

[0048] The sawn timber is smoothly and orderly conveyed by the conveyor module. After the first industrial camera 21, installed above the module, captures defect images of the first side of the sawn timber, the sawn timber is automatically flipped during transport by the automatic sawn timber flipping module, and then the second industrial camera 22 captures defect images of the second side. The images of both sides of the same sawn timber are analyzed by the host computer to obtain processing results, identify the types of defects on the sawn timber surface, and transmit them to the lower-level automatic sorting module via serial port to control the sawn timber to fall into the corresponding collection area for sorting.

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

[0050] The automatic sorting module conveyor section is similar in structure to the sawn timber conveyor module, except that in this automatic sorting module, the sawn timber is conveyed below the industrial conveyor chain.

[0051] The motion control system of this system uses a large number of motors and is required to achieve functions such as easy parameter setting, automatic counting during sorting, automatic stop and alarm when the count is full, and ease of operation for the operator. A combination of a graphical user interface (GUI) and Arduino is used to implement the motion control of the automatic board sorting machine. The overall motion control system flow is as follows: Figure 3 As shown.

[0052] Host computer design scheme:

[0053] The host computer part uses a graphical user interface created with Matlab to communicate and control the slave computer. The GUI interface of the automatic sorting module is shown below. Figure 4 As shown. When the user clicks the Start button, a dialog box will appear reminding them to set the full load quantity. After the user completes the parameter setting, the callback function corresponding to the Start button will run, automatically initializing the parameters and sending an "S" run command to the lower-level machine. In special cases where 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 it is necessary to reset the parameters, click the Reset button.

[0054] When the automatic sorting module is working normally, if the count 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 empty the sawn timber in the corresponding type of sawn timber collection area. Clicking the "Continue" button will restore the original running state.

[0055] Lower-level machine design scheme:

[0056] The automatic sorting module uses Matlab and Arduino microcontrollers as its core control system to control stepper motors and perform image processing. The required hardware for the lower-level unit includes: one Arduino Mega 2560 motherboard, one GP2D12 infrared rangefinder sensor, two industrial cameras, six ATK-2MD4850 ​​stepper motor drivers, two 86-series stepper motors, four 57-series stepper motors, AC 220V power supply, and DC 12-48V power supply. The lower-level unit primarily receives start / stop signals from the upper-level unit and performs corresponding actions based on these signals; it also sends the current type of sawn timber being sorted to the upper-level unit for counting purposes.

[0057] A method for processing surface defects in sawn timber includes the following steps:

[0058] Step 1: Acquire images of the sawn timber surface and perform preprocessing;

[0059] Step 2: Based on the different properties of each region in the sawn timber surface image, the sawn timber surface image information is segmented to extract the region of interest, and then morphological processing is performed after image segmentation.

[0060] Step 3: Defect detection is performed on the surface image of the sawn timber based on a BP neural network.

[0061] In step 1, specifically, extracting defect texture features requires a certain number of defect image samples, thus necessitating the establishment of a defect image sample library. Based on the characteristics of various defects, this invention collects surface images of cedar sawn timber and, through post-processing, ultimately obtains 100 samples each of live knots, dead knots, and wormhole defects, each measuring 512×512 pixels. Figure 5 (a) shows three types of defect sample images randomly selected from the sample library. For ease of description, these three images will be used as the processing objects below.

[0062] Using the RGB model as the color space model, the distribution of samples in the color space (Table 1) revealed that the selected live, dead, and insect-eye samples all had the largest standard deviation in the red plane, indicating the highest contrast between the defective and normal areas in this plane. Therefore, the grayscale image of the red plane with the highest contrast was extracted. Figure 5 (b)

[0063] Table 1. Gray-scale characteristics of each plane of the sample

[0064]

[0065] In IN Vision Assistant, lookup table functions can transform the grayscale range of an input image to another grayscale range. Specifically, they expand the grayscale levels containing important information while compressing the grayscale levels of other image regions, thereby highlighting important information in the image. The grayscale conversion rules of lookup table functions are as follows:

[0066] (1)

[0067] in, The gray level of the transformed pixel. The pixel gray level before transformation. The minimum gray level is dynamic. Maximum gray level; For the independent variable The output grayscale level obtained after specific operations or mapping rules are performed. This is the dynamic minimum gray level threshold. This is the dynamic maximum gray level threshold.

[0068] The value of depends on the type of lookup table function selected. IN Vision Assistant offers lookup table functions such as histogram equalization, inversion, logarithmic, exponential, square, square root, and power functions. For 8-bit images, The value is 0. The value is 255.

[0069] This invention employs histogram equalization to further process the obtained red plane. A grayscale histogram is a one-dimensional discrete function of image grayscale values. While it doesn't specifically reflect the location of each pixel, it reveals the distribution of grayscale values, contrast, and brightness. Histogram equalization expands a large number of pixels within a small original grayscale range to a larger grayscale range, amplifying subtle grayscale changes and increasing image contrast and sharpness. Figure 5 As shown in (c), after histogram equalization, the gray values ​​of the image pixels of the three types of defect samples are more evenly distributed across the entire gray level range. The number of gray value types of pixels decreases while the total number of pixels of each gray value increases. The image contrast is increased after processing, highlighting the defect areas.

[0070] Step 2 specifically includes image segmentation and post-segmentation morphological processing;

[0071] Image segmentation is the process of dividing an image into regions of interest based on the different properties of different regions within the image. This invention employs optimal global threshold segmentation based on an iterative algorithm to segment the acquired image of a whole piece of sawn timber. The iterative process for obtaining the optimal threshold is as follows: In this invention, the total gray levels of the 8-bit image are 256. Let the initial threshold be... The value is equal to the average gray value of the image, and the iteration begins according to formula (2). During the first iteration... When the iteration proceeds to The iteration terminates when the threshold is reached, and the threshold obtained at this point is the optimal threshold.

[0072] (2)

[0073] In the formula: The threshold obtained in the next iteration; The threshold obtained from the previous iteration; This is the current grayscale value; For grayscale value equal to The number of pixels.

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

[0075] Post-segmentation morphological processing is a process of refining defect regions and removing particle noise from the pre-processed and segmented image, ultimately obtaining a grayscale image of the defect region.

[0076] In step 2, the morphological processing dilation operation after image segmentation includes dilation operation, filling operation, removal of small regions, and extraction of grayscale images of defective regions;

[0077] Step 21: The dilation operation specifically includes: In the binarized image obtained after image segmentation, there may be some defective regions that should be closed but are not, affecting subsequent filling operations. The dilation operation can close these small breaks in the defective regions by dilating the target region. The dilation operation is obtained through the correlation operation between the object to be processed A and the structuring element B. Let the symbol for the dilation operation be ⊕, then the dilation of object A through structuring element B can be defined as follows:

[0078] (3)

[0079] In the formula, x represents the structure Central reference point location, Indicates the structure The result of reversing and translating the elements by a certain distance. The meaning of this expression is: all The set of x that intersect with A after translation is the result of the expansion of the object A. Figure 7 This process can be described from a visual perspective.

[0080] In this invention, a cross-shaped structural element B is used, with a cross at its center representing a reference point. The cross-shaped structural element B has a symmetrical structure, therefore… Figure 7 Structural element B in (b) and Figure 7 The inverted structuring element B in (c) is consistent. Based on the above dilation principle, adding the positions reachable by the reference point to the original binary image yields the result. Figure 7 The dilated binary image shown in (d) is clearly an image with an outer ring of pixels compared to the original binary image, achieving the dilation effect. The dilated images of the three types of defect samples in this invention are shown below. Figure 6 As shown in (b).

[0081] Step 22: The filling operation involves filling the holes in the closed area to integrate it with the target particle. Due to the pixel grayscale characteristics of dead knot samples, they generally present a "ring-shaped" appearance after image segmentation, meaning there are a large number of pixels with a value of 1 in the center of the defect. Meanwhile, live knots and wormholes may also retain a small number of pixels with a value of 1 in the defect area. The ultimate goal of this invention is to extract the grayscale image of the defect area; therefore, it is necessary to set all pixels with a value of 1 in the closed area inside the defect to 0, making the defect area a hole-free whole.

[0082] Step 23: Remove small areas

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

[0084] Similar to the dilation operation, the erosion operation is also obtained through correlation operations between the object to be processed, A, and the structuring element, B. The notation for the erosion operation is denoted as [symbol missing]. Then, the object A to be processed can be defined as follows through erosion using structuring element B:

[0085] (4)

[0086] In the formula, x represents the structure The reference point is located in the middle. The meaning of this formula is: When A can still be completely contained after the movement The set of reference point locations represents the result of image erosion. A graphical description of the erosion operation is as follows: Figure 8 As shown.

[0087] The opening operation is a process of erosion followed by dilation. The symbol for the opening operation is denoted as . The object A to be processed can be defined as follows by using structure element B for opening operations:

[0088] (5)

[0089] For a specific binary image, the operational principle of opening is as follows: Figure 9 As shown.

[0090] Depend on Figure 9 As can be seen, the opening operation can remove some isolated points in a binary image. Generally, the opening operation can also remove burrs in a binary image, while the shape and position of the target object remain unchanged. Therefore, this invention uses the opening operation to remove some small particles outside the defect area and softens the contour of the defect area to a certain extent. The effects of the opening operation (removing small areas) on the three types of defects are as follows: Figure 6 As shown in (c).

[0091] Step 24: Extraction of grayscale image of defect area

[0092] This invention obtains the filtered grayscale image of the defect region by multiplying the binary image of the defect region obtained after small-area removal and the grayscale image of the defect region obtained after median filtering through a flooding operation. Figure 6 (c). Equation (6) is the principle of image multiplication.

[0093] (6)

[0094] In the formula, This represents the image obtained after flooding. Represents a binary image of the defect region. The filtered grayscale image representing the defect area.

[0095] Step 3, the surface defect detection of sawn timber based on a BP neural network, specifically includes:

[0096] The defect feature analysis stage of the sawn timber double-sided defect detection process extracts and analyzes different geometric and shape features to identify double-sided defects in the sawn timber. This invention employs a BP neural network (BP) recognition method to identify and classify surface defects in sawn timber. The BP neural network classifier was trained on 150 defect samples and tested on another 150 defect samples to calculate the recognition rate for each number of hidden layer neurons. As shown in Table 2, the recognition rate is highest when the number of hidden layer neurons is 8, and it requires fewer iterations; therefore, the theoretical recognition rate of this network classifier is determined to be 88.67%.

[0097] Table 2 Recognition rates with different numbers of neurons in hidden layers

[0098]

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

[0100] To verify the technical effectiveness of this invention, prototype testing is also included:

[0101] The sawn timber is placed at the feed end of a conveyor belt, which drives it forward. When it reaches the designated inspection position, the conveyor belt stops, the camera captures an image, processes the image, and displays the inspection results. Each conveyor belt stop lasts 3 seconds. As soon as the previous sawn timber that has completed inspection leaves the conveyor belt, the next sawn timber begins to be fed in. The surface defect detection and recognition rate of the sawn timber is calculated.

[0102] Table 3 shows the number of correct detections for each type of defect and its recognition rate, as well as the total number of correct detections 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 is approximately 84.44%, slightly lower than the theoretical recognition efficiency of 88.67% for the BP neural network classifier. Among these, insect holes had the lowest recognition rate, while live and dead knots had the same recognition rate.

[0103] Table 3. Detection and identification rate of surface defects in sawn timber

[0104]

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

[0106] This invention employs a modular design to develop a sawn timber sorting system that meets the requirements for surface defect detection in sawn timber. The sorting system operates stably during operation, with high operational feasibility and accurate sorting results, and produces no significant vibration or noise. Parameter settings and system start / stop can be completed through a GUI interface, making it easy to operate.

Claims

1. A method for processing images of surface defects in sawn timber, characterized in that, Includes the following steps: Step 1: Acquire images of the sawn timber surface and perform preprocessing; Step 2: Based on the different properties of each region in the sawn timber surface image, the sawn timber surface image information is segmented to extract the region of interest, and then morphological processing is performed after image segmentation. The segmentation of the sawn timber surface image information specifically includes: using the best global threshold segmentation based on an iterative algorithm to segment the acquired whole sawn timber surface image; Iterative process for finding the optimal threshold: The total gray levels of an 8-bit image are 256; let the initial threshold be... The value is equal to the average gray value of the image, and the iteration begins according to formula (1); during the first iteration... When the iteration proceeds to The iteration terminates when the threshold obtained at this point is the optimal threshold. (1) In the formula: The threshold obtained in the next iteration; The threshold obtained from the previous iteration; This is the current grayscale value; For grayscale value equal to The number of pixels; The first iteration uses an initially generated approximate threshold, and the next iteration uses a new threshold generated by the overlay; each threshold divides the image into two categories. Step 3: Defect detection is performed on the surface image of the sawn timber based on a BP neural network.

2. The method for image processing of surface defects in sawn timber according to claim 1, characterized in that, Step 1 specifically includes: Step 11: Establish a defect image sample library; based on the characteristics of various defects, collect images of the sawn timber surface, and through post-image processing, finally obtain 100 samples each of live knots, dead knots, and wormhole defects with a resolution of 512×512 pixels; using the RGB model as the color space model, the red plane has the largest standard deviation among the live knot, dead knot, and wormhole samples, and extract the red plane grayscale image with the highest contrast. Step 12: Histogram equalization is used to further process the obtained red plane; after histogram equalization, the gray values ​​of the image pixels of the live knot, dead knot, and insect eye defect samples are evenly distributed across the entire gray level range, the number of gray value types of pixels is reduced, and the total number of pixels of each gray value is increased.

3. The method for image processing of surface defects in sawn timber according to claim 1, characterized in that, The post-image segmentation morphological processing in step 2 specifically includes the following steps: Step 21: Expansion operation; The small breaks in the defect area are closed by expanding the target area; the expansion operation is obtained through the correlation operation between the object to be processed A and the structuring element B; Let the symbol for the expansion operation be ⊕, then the expansion of the object to be processed A through the structuring element B is defined as follows: (2) In the formula, x represents the structuring element. Central reference point location, Indicates that the structural element The result of reversing and translating the elements; all The set of x that intersect with A after translation is the result of the dilated object A; a cross-shaped structural element B is used, with the cross in its center representing its reference point; the cross-shaped structural element B has a symmetrical structure, so the cross-shaped structural element B is consistent with the inverted cross-shaped structural element B; based on the dilation principle, the position that the reference point can reach is added to the original binary image to obtain the dilated binary image. Step 22: Fill operation, which sets all pixels with a value of 1 in the closed area inside the defect to 0, so that the defect area becomes a hole-free whole; Step 23: Use opening operations to eliminate fine particles, performing corrosion followed by expansion; denoted by the symbol for the corrosion operation is... Then, the object A to be processed is defined as follows through erosion using structuring element B: (3) In the formula, x represents the structuring element. Reference point position; structural element When a structure element can still be completely contained within A after being moved, The set of reference point locations is the result of image erosion; the symbol for the opening operation is denoted as . The object A to be processed is defined using the structure element B as follows: (4) Step 24: Through the flooding operation, the binary image of the defect area obtained after the small area removal operation is multiplied with the grayscale image of the defect area obtained after median filtering, that is, the filtered grayscale image of the defect area is obtained. Equation (5) is the principle of image multiplication operation: (5) In the formula, This represents the image obtained after flooding. Represents a binary image of the defect region. The filtered grayscale image representing the defect area.

4. The method for image processing of surface defects in sawn timber according to claim 1, characterized in that, Step 3 specifically includes: training 150 defect samples with a BP neural network classifier and testing with the remaining 150 defect samples to obtain the recognition rate for each number of hidden layer neurons; the recognition rate is highest when the number of hidden layer neurons is 8, thus determining the theoretical recognition rate of this network classifier.

5. A sawn timber sorting system, characterized in that, The system includes a frame, a sawn timber conveying module, a sawn timber detection module, a sawn timber automatic flipping module, and an automatic sorting module. It also employs a sawn timber surface defect image processing method as described in any one of claims 1-4. The sawn timber is conveyed by the sawn timber conveying module. After a first industrial camera installed above the sawn timber conveying module captures a defect image of the first side of the sawn timber, the sawn timber automatically flips over during transport using the automatic flipping module. A second industrial camera then captures a defect image of the second side. The images of both sides of the same sawn timber are analyzed by the sawn timber surface defect image processing method in the host computer to obtain the processing results and identify the types of defects on the sawn timber surface. The results are then transmitted via serial port to the lower-level automatic sorting module, which controls the sawn timber to fall into the corresponding collection area for sorting.

Citation Information

Patent Citations

  • Method, device, and program for inspecting wood

    JP2007147442A

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

    US20030093241A1