A method for detecting a cutting line of a wood board based on mask coding
By using a mask coding method, the color information of the color image and the RGB model are used for binary mask processing, which solves the problems of low efficiency and insufficient accuracy in the detection of cutting lines in non-trunk areas of wooden boards, realizes high-precision automated cutting line detection, and reduces labor costs.
Patent Information
- Application Number
- CN202311025848.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-08-15
AI Technical Summary
The detection of cutting lines in non-trunk areas of wooden boards is inefficient and lacks standardized methods. Existing deep learning-based methods have low accuracy, and traditional methods rely on expert experience, making it difficult to achieve automated and high-precision cutting line detection.
A mask-based coding method is adopted, which uses color information of color image and RGB color model to perform binary mask processing to remove noise. Cutting lines are found by connecting region area and edge pixel difference to determine whether the trunk area penetrates the wood and output the cutting line or the middle line.
It improves the accuracy and real-time performance of cutting line detection, reduces labor costs in the production process, optimizes the workflow, and increases work efficiency.
Smart Images

Figure CN117291976B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of wood cutting line detection technology, and particularly relates to a wood cutting line detection method based on mask coding. Background Technology
[0002] The cutting of non-trunk areas of wood planks in the woodworking machinery industry has always relied on manual line drawing, which faces problems of low efficiency and inconsistent standards. In order to improve the efficiency and accuracy of wood plank cutting, the primary goal is to automatically detect non-trunk areas of wood planks, provide boundary cutting lines, and guide the saw blade to automatically cut non-trunk areas. There are three main problems that need to be solved in accurately finding non-trunk areas of wood planks: (1) The edges at the junction of non-trunk areas and trunk areas are blurred, making it difficult to effectively separate the two; (2) The front and back areas of the wood planks are irregularly shaped, interfering with the search of cutting lines on both sides of the wood planks; (3) The pressure device on the wood planks causes a lack of overall integrity of the wood plank target.
[0003] In recent years, many AI-based detection algorithms have been applied to industrial inspection tasks. These defect detection algorithms can be divided into two categories: deep learning-based detection methods and traditional image processing-based detection methods. Comparing these two algorithms, on the one hand, deep learning-based methods rely on detailed wood plank contour information for template cutting line detection, while traditional image processing methods only require expert experience; on the other hand, due to the inherent characteristics of the algorithms, the target contour accuracy obtained by deep learning-based wood plank cutting line detection methods is lower than that of traditional image processing-based detection methods. Therefore, considering the advantages of traditional image processing in terms of data and detection accuracy, this invention proposes a mask coding-based wood plank cutting line detection method, which effectively solves the problem of cutting line detection in non-trunk areas of wood planks. Summary of the Invention
[0004] To overcome the problems of low efficiency and inconsistent standards in the traditional woodworking machinery industry, which relies primarily on manual line drawing for cutting non-trunk areas of wood planks, this invention proposes a mask-encoded method for detecting wood plank cutting lines. This method first uses prior knowledge of different colors combined with an RGB color model to perform binary masking on the acquired color image. Then, by dividing the region of interest (ROI) and using the area of connected components, noise in the binary masking result is removed. Further, based on the left and right pixel differences of edge pixels, the inner boundary of the ROI is found. Finally, it is determined whether the trunk region penetrates the entire wood. If it does, the cutting lines on both sides are output; otherwise, the center line of the trunk region is output. This invention utilizes traditional image processing algorithms to find wood plank cutting lines, and based on prior knowledge such as color mask segmentation and noise removal in the ROI, it accurately extracts the trunk and non-trunk regions. When the trunk region penetrates the entire wood, the coordinates of the board cutting line are output; otherwise, the coordinates of the center line of the trunk region are output. This invention significantly improves the accuracy and real-time performance of cutting line detection, effectively reducing labor costs in the production process.
[0005] The present invention provides a method for detecting cutting lines on wooden boards based on membrane encoding of color information. The method detects cutting lines on the trunk region of a wooden board target based on the color information difference between the trunk region and non-trunk regions and prior knowledge of the region of interest.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for detecting wood cutting lines based on mask coding, comprising:
[0007] A color image of the tree trunk is acquired, and the acquired color image is processed by a binary mask using prior knowledge of different colors combined with the RGB color model.
[0008] By dividing the region of interest and utilizing the area of the connected components, noise in the binarization masking results is eliminated;
[0009] Based on the difference between the left and right pixels of the edge pixels, find the inner boundary of the region of interest;
[0010] Determine whether the trunk area runs through the entire piece of wood. If it does, output the cutting lines on both sides; otherwise, output the center line of the trunk area.
[0011] Furthermore, the steps of performing binary masking on the acquired color image include: firstly, using the color difference between the tree trunk area and the non-tree trunk area, performing binary encoding in the RGB color space; , , These represent the red, green, and blue color channels of the acquired color image, respectively, and the binary representation is set for different channels; encoding threshold. , , Under the red channel, if Pixel value greater than If the pixel is not visible, its encoding value is 1; otherwise, it is 0. In the green and blue channels, if... or Pixel value correspondingly greater than or If the pixel's color channel is not specified, its encoding value is 0; otherwise, it is 1. The binary encoding results from different color channels are ANDed together to obtain the final binary encoded image, denoted as [image 1]. As shown in Equation 4;
[0012]
[0013]
[0014]
[0015] In the formula, , , They represent , , The first under the channel i Line number j List the pixel values.
[0016]
[0017] In the formula, , , They represent , , The binary encoding result, It represents the "AND" operation.
[0018] Furthermore, the specific steps for removing noise from the binarized mask result include:
[0019] In the results In this study, considering the influence of the two pressure devices on the surface of the wooden board on the connectivity of the tree trunk area and to reduce processing time, three regions of interest on the tree trunk were selected, denoted as . , , Set the connected component area threshold. If the three tree trunks are regions of interest , , The sum of connected pixels in the array is greater than If the area of the noise points is positive, the connected component is retained; otherwise, it is removed. , , There is one and only one connected component that belongs to the trunk region.
[0020] Furthermore, the specific steps for finding the inner boundary of the region of interest include:
[0021] For the left boundary point, the boundary point satisfies three conditions: the encoded pixel value of the boundary point is equal to 1; the encoded pixel value of the left side of the boundary point is equal to 0; the encoded pixel value of the left side of the boundary point is equal to 0.
[0022] For the right boundary point, the boundary point satisfies three conditions: the encoded pixel value of the boundary point is equal to 1; the encoded pixel value of the left side of the boundary point is equal to 1; and the encoded pixel value of the left side of the boundary point is equal to 1.
[0023] Because the irregular shapes at both ends of the wooden board can interfere with the search for the cutting boundary, it is necessary to define the region of interest. , Boundary lines; during the search for cutting lines, for regions of interest , Only search the regions below and above the boundary line, skipping irregular regions outside the boundary line; finding the inner cutting point requires sequential traversal. , , Find three regions of interest from all encoded values. , , Set of left boundary points The set of right boundary points ,in M , N These represent the number of left and right boundary points, respectively.
[0024] Comparison Sets All column coordinate values yield the rightmost point of the left boundary. Comparison sets All column coordinate values yield the leftmost point of the right boundary. ,in and These represent the row and column coordinates of the point, respectively.
[0025] Further steps to determine whether the trunk area extends through the entire piece of wood include:
[0026] Set area threshold and If you are interested in the area , The sum of connected pixels in the array is greater than the area threshold. and If the area of interest is a wood region, then the type of wood plank is determined to be penetrated; if the area of interest is... , The sum of connected pixels in the region has one element less than or equal to the area threshold. and If so, then the wooden board is determined to be of the type where the wood area is not penetrated;
[0027] Calculate the centroid coordinates of the marker point and output the position information of the left and right cutting lines or the center line relative to the marker point.
[0028] The beneficial effects of this invention are:
[0029] 1. This invention combines color information with prior knowledge of the region of interest. It effectively segments the wood area and marker points of the wooden board by using color information, and effectively detects the cutting line by utilizing the difference in encoding values on the left and right sides of the boundary point.
[0030] 2. This invention first utilizes prior knowledge of different colors combined with the RGB color model to perform binary masking on the acquired color image. Then, by dividing the region of interest (ROI) and using the area of connected components, noise in the binary masking result is removed. Furthermore, based on the left and right pixel differences of edge pixels, the inner boundary of the ROI is found. It is then determined whether the trunk region penetrates the entire piece of wood. If it does, the cutting lines on both sides are output; otherwise, the center line of the trunk region is output. Based on prior knowledge such as color mask segmentation and ROI noise removal, this invention can accurately extract the trunk region and non-trunk regions, greatly improving the accuracy and real-time performance of cutting line detection (average processing time of 25ms for Intel i7-9700K CPU), effectively reducing labor costs in the production process.
[0031] Optimize work processes and improve work efficiency.
[0032] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0033] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0034] Figure 1 This is a simplified flowchart of the mask coding-based wood cutting line detection method of the present invention;
[0035] Figure 2 This is a flowchart illustrating the specific process of the wood cutting line detection method based on mask coding of the present invention.
[0036] Figure 3This is a schematic diagram of the region of interest and the boundary line used in this invention. Detailed Implementation
[0037] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0038] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, 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 pertains.
[0039] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. 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.
[0040] In this invention, terms such as "upper," "lower," "left," "right," "front," "back," "vertical," "horizontal," "side," and "bottom" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used only to facilitate the description of the structural relationships of the various components or elements of this invention and do not specifically refer to any component or element in this invention. They should not be construed as limiting the invention.
[0041] In this invention, terms such as "fixed connection," "connected," and "linked" should be interpreted broadly, indicating a fixed connection, an integral connection, or a detachable connection; a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can determine the specific meaning of these terms in this invention based on the specific circumstances, and they should not be construed as limitations on the invention.
[0042] Example
[0043] like Figures 1-3 As shown, this embodiment provides a method for detecting wood cutting lines based on mask coding, including:
[0044] (1) Colored wooden board image
[0045] Since the cutting line of the wooden board is at the boundary between the wood and non-wood areas, and there is a significant difference in color information between the two, this invention requires the acquisition of a color image of the wooden board target. To reduce the time consumption of subsequent processing, the acquired color image is first normalized to a certain size. .
[0046] (2) Binarization
[0047] For a normalized color image, the color difference between the tree trunk region and the non-tree trunk region is first used to perform binary encoding in the RGB color space. Specifically: , , These represent the red, green, and blue color channels of the acquired color image, respectively, and the binary representation is set for different channels.
[0048] Encoding threshold , , Under the red channel, if Pixel value greater than If the pixel code is 1, then the code value is 1; otherwise, the code value is 0 (as shown in Equation 7). In the green and blue channels, if... or Pixel value correspondingly greater than or If the pixel's color is true, its encoding value is 0; otherwise, it is 1 (as shown in equations 8 and 9). The binary encoding results from different color channels are ANDed together to obtain the final binary encoded image, denoted as... As shown in Equation 10.
[0049]
[0050]
[0051]
[0052] In the formula, , , They represent , , The first under the channel i Line number j List the pixel values.
[0053]
[0054] In the formula, , , They represent , , The binary encoding result, It represents the "AND" operation.
[0055] (3) Region of Interest Denoising
[0056] Due to interference from the background color information of the wooden planks, noise will exist in non-trunk areas in the binary encoding result. Therefore, it is necessary to... Interference areas are removed from the results. In this study, considering the influence of the two pressure devices on the surface of the wooden board on the connectivity of the tree trunk area and to reduce processing time, three regions of interest on the tree trunk were selected, denoted as . , , Set the connected component area threshold. If the three tree trunks are regions of interest , , The sum of connected pixels in the array is greater than If the area of the noise is positive, the connected component is retained; otherwise, it is removed. After area filtering of the noise points... , , There is one and only one connected component that belongs to the trunk region.
[0057] (4) Locate the inner point
[0058] Find the regions of interest in three tree trunks , , The inner cutting points are defined. For the left boundary point, three conditions must be met: the coded pixel value of the boundary point is equal to 1; the coded pixel value on the left side of the boundary point is equal to 0; and the coded pixel value on the left side of the boundary point is equal to 0. For the right boundary point, three conditions must be met: the coded pixel value of the boundary point is equal to 1; the coded pixel value on the left side of the boundary point is equal to 1; and the coded pixel value on the left side of the boundary point is equal to 1. Since the irregular shapes at both ends of the wooden board can interfere with the finding of the cutting boundaries, it is necessary to define a region of interest. , The dividing line. During the search for the cutting line, the region of interest... , Only search the regions above and below the boundary line; skip irregular regions outside the boundary line. Finding the inner test cut point requires sequential traversal. , , Find three regions of interest from all encoded values. , , Set of left boundary points The set of right boundary points ,in M , N These represent the number of points on the left and right boundaries, respectively. (Compare sets) All column coordinate values yield the rightmost point of the left boundary. Comparison sets All column coordinate values yield the leftmost point of the right boundary. ,in and These represent the row and column coordinates of the point, respectively.
[0059] (5) Determination of whether the board material is penetrated or not
[0060] Based on the area of the tree trunk in the region of interest, determine the type of plank. According to the area of the wood region, the planks to be cut can be divided into two categories: planks with the wood region penetrated and planks with the wood region not penetrated. Therefore, this part requires consideration of the region of interest. , The area of the binary encoded planks is used for plank classification. An area threshold is set. and If you are interested in the area , The sum of connected pixels in the array is greater than the area threshold. and If the area of interest is a wood region, then the type of wood plank is determined to be penetrated; if the area of interest is... , The sum of connected pixels in the region has one element less than or equal to the area threshold. and If so, then the wooden board is determined to be of the type where the wood area is not penetrated.
[0061] (6) Output the center line and cutting line of the cutting board.
[0062] Calculate the centroid coordinates of the marker points and output the position information of the left and right cutting lines or the center line relative to the marker points. After binary encoding the captured color image in step one, the centroid coordinates of marker point 1 and marker point 2 can be calculated and denoted as follows: and If the plank to be cut is a through-type wood area, then calculate the distance between the left cutting line and marker point 1. (As shown in Formula 11) Calculate the distance between the right cutting line and marker point 2. (as shown in Formula 12), and will and Send the data to the lower-level machine for plate cutting;
[0063]
[0064]
[0065] In the formula, This represents absolute value operations.
[0066] If the plank to be cut is a non-through wood region, then follow step three to find the region of interest in the tree trunk. The inner cutting points, where the set of left boundary points is... The set of right boundary points is Comparison sets All column coordinate values yield the rightmost point of the left boundary. Comparison sets All column coordinate values yield the leftmost point of the right boundary. According to the rightmost point of the left boundary The leftmost point of the right boundary Calculate the column coordinate information of the median line. ; Calculate the distance between the median line and marker point 1. (As shown in Formula 13) Calculate the distance between the center line and marker point 2. (as shown in Formula 14), and will and Send the data to the lower-level machine for plate cutting.
[0067]
[0068]
[0069] This embodiment utilizes prior knowledge of different colors combined with the RGB color model to perform binary masking on the acquired color image. Then, by dividing the region of interest (ROI) and using the area of connected components, noise in the binary masking result is removed. Furthermore, based on the left and right pixel differences of edge pixels, the inner boundary of the ROI is found. It is then determined whether the trunk region penetrates the entire piece of wood; if so, the cutting lines on both sides are output; otherwise, the center line of the trunk region is output. Based on prior knowledge such as color mask segmentation and ROI noise removal, this invention can accurately extract the trunk region and non-trunk regions, greatly improving the accuracy and real-time performance of cutting line detection (average processing time of 25ms for Intel i7-9700K CPU), effectively reducing labor costs in the production process.
[0070] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting wood cutting lines based on mask coding, characterized in that, include: A color image of the tree trunk is acquired, and the acquired color image is processed by a binary mask using prior knowledge of different colors combined with the RGB color model. By dividing the region of interest, denoted as... , , ,in lie in , Between; using the area of connected components, noise in the binarization mask results is removed; Based on the left and right pixel differences of edge pixels, the inner boundary of the region of interest is found; wherein, finding the inner boundary of the region of interest includes: sequentially traversing , , Using all pixel values, find three regions of interest respectively. , , Set of left boundary points The set of right boundary points Where M and N represent the number of left and right boundary points, respectively; compare sets All column coordinate values yield the rightmost point of the left boundary. Comparison sets All column coordinate values yield the leftmost point of the right boundary. ,in and Represent the row and column coordinates of the point, respectively; Determine if the trunk area penetrates the entire piece of wood. If it does, output the cutting lines on both sides; otherwise, output the center line of the trunk area, specifically including: If the plank to be cut is a wood region through-type, then search for the region of interest in the tree trunk. , , Given the inner boundary, obtain the rightmost point of the left boundary and the leftmost point of the right boundary, and output the cutting lines on both sides; If the plank to be cut is a non-through wood region, then only the region of interest in the trunk will be searched. From the inner boundary, obtain the rightmost point of the left boundary and the leftmost point of the right boundary; using the rightmost point of the left boundary and the leftmost point of the right boundary, calculate the column coordinate information of the middle line. Output the center line of the tree trunk region.
2. The method for detecting wood cutting lines based on mask coding as described in claim 1, characterized in that, The steps for performing binary masking on the acquired color image include: firstly, using the color difference between the tree trunk area and the non-tree trunk area, performing binary encoding in the RGB color space; , , These represent the red, green, and blue color channels of the acquired color image, respectively, and the binary representation is set for different channels; encoding threshold. , , Under the red channel, if Pixel value greater than If the pixel value is 1, then the pixel value is 1; otherwise, the pixel value is 0. In the green channel, if... Pixel value greater than If the pixel value is 0, then the pixel value is 0; otherwise, the pixel value is 1. In the blue channel, if... Pixel value greater than If the pixel value is 0, then the pixel value is 0; otherwise, the pixel value is 1. The binary encoding results from different color channels are ANDed together to obtain the final binary encoded image, denoted as . ;in, In the formula, , , They represent , , The first under the channel i Line number j List the pixel values; In the formula, , , They represent , , The binary encoding result, Representation and operation.
3. The method for detecting wood cutting lines based on mask coding as described in claim 2, characterized in that, The specific steps for removing noise from the binarized mask results include: In the results In this study, considering the influence of the two pressure devices on the surface of the wooden board on the connectivity of the tree trunk area and to reduce processing time, three regions of interest on the tree trunk were selected, denoted as . , , Set the connected component area threshold. If the three tree trunks are regions of interest , , The sum of connected pixels in the array is greater than If the area of the noise points is positive, the connected component is retained; otherwise, it is removed. , , There is one and only one connected component that belongs to the trunk region.
4. The method for detecting wood cutting lines based on mask coding as described in claim 1, characterized in that, Finding the inner boundary of the region of interest also includes: For the left boundary point, the boundary point satisfies three conditions: the encoded pixel value of the boundary point is equal to 1; the encoded pixel value to the left of the boundary point is equal to 0; and the encoded pixel value to the right of the boundary point is equal to 1. For the right boundary point, the boundary point satisfies three conditions: the encoded pixel value of the boundary point is equal to 1; the encoded pixel value of the left side of the boundary point is equal to 1; and the encoded pixel value of the right side of the boundary point is equal to 0. Because the irregular shape at both ends of the wooden board can interfere with the search for the cutting boundary, a region of interest is defined. , Boundary lines; during the search for cutting lines, for regions of interest , It only searches for areas below and above the boundary line, while skipping irregular areas outside the boundary line.
5. The method for detecting wood cutting lines based on mask coding as described in claim 1, characterized in that, The steps to determine whether the trunk area runs through the entire piece of wood include: Set area threshold and If you are interested in the area , The sum of connected pixels in the array is greater than the area threshold. and If the area of interest is a wood region, then the type of wood plank is determined to be penetrated; if the area of interest is... , The sum of connected pixels in the region has one element less than or equal to the area threshold. and If so, then the wooden board is determined to be of the type where the wood area is not penetrated.
Citation Information
Patent Citations
Filling algorithm for rapidly matching pair of left and right boundary point
CN101201938A
Image processing method and system
CN107248158A