Quality inspection method and system for roadbed reinforcement wood materials
By performing threshold iterative segmentation and comprehensive analysis of wood surface images, the edges of crack defects are screened out, which solves the problem of misjudgment of wood surface texture and improves the accuracy and reliability of crack defect detection.
Patent Information
- Application Number
- CN202510828445.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-20
AI Technical Summary
The existing iterative threshold segmentation algorithm easily misjudged the wood surface texture as a crack defect in the detection of wood crack defects, resulting in low detection accuracy.
By performing threshold iterative segmentation of wood surface images, the edges to be detected are obtained, gradient distribution analysis and texture grayscale change analysis are carried out, and crack defect edges are selected, and gradient characteristics, texture indexes and grayscale change characteristics are comprehensively considered to distinguish texture and cracks.
It improves the accuracy of wood crack defect detection, accurately screens out the edges of crack defects, reduces misjudgment, and improves the reliability of detection.
Smart Images

Figure CN120339288B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image threshold segmentation, and in particular to a quality inspection method and system for roadbed reinforcement wood materials. Background Art
[0002] Wood materials for roadbed reinforcement are a common material in civil engineering and are widely used in the construction of infrastructure such as roads and bridges. Their quality is directly related to the safety and durability of the project. Wood is often used as a roadbed reinforcement material due to its natural renewability and excellent mechanical properties. However, wood is prone to various defects during its growth and processing. Cracks are the most common and have the greatest impact on wood strength. The presence of cracks can significantly reduce the load-bearing capacity of the wood, shorten its service life, and may even cause the roadbed reinforcement to fail, leading to engineering accidents.
[0003] Therefore, effective crack detection in roadbed reinforcement timber is crucial for ensuring project quality. Currently, visual inspection technology has become an important tool for timber defect detection, with iterative threshold segmentation being a common image processing method. This method uses iterative calculation to determine the optimal threshold, segmenting the image into foreground and background, thereby identifying defect areas.
[0004] However, in practical applications, directly performing iterative threshold segmentation on captured wood images often encounters the following technical difficulties: the grayscale distribution of the natural wood surface texture often overlaps with the grayscale distribution of crack defects. This grayscale similarity causes the iterative threshold segmentation algorithm to easily misidentify textured areas as crack defects, thereby reducing the accuracy of crack defect detection.
[0005] In order to improve the accuracy and reliability of crack defect detection in roadbed reinforcement wood materials, it is necessary to develop a new quality inspection method and system. This method should be able to effectively distinguish between the texture and crack defects on the wood surface, overcome the limitations of the existing iterative threshold segmentation algorithm, and achieve accurate identification and positioning of crack defects in roadbed reinforcement wood materials, providing reliable technical support for engineering quality control. Summary of the Invention
[0006] The Summary of the Present Invention is intended to briefly introduce concepts that will be described in detail in the Detailed Description of the Present Invention. The Summary of the Present Invention is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0007] In order to solve the technical problem of poor accuracy in crack defect detection of wood, the present invention proposes a quality inspection method and system for roadbed reinforcement wood materials.
[0008] In a first aspect, the present invention provides a method for quality inspection of wood materials for roadbed reinforcement, the method comprising:
[0009] Acquire a target surface image corresponding to the wood to be detected, perform threshold iterative segmentation on the target surface image to obtain an edge to be detected, and determine each threshold in the threshold iterative segmentation process as a target threshold;
[0010] Performing gradient distribution analysis on each edge to be detected at each target threshold to obtain the target gradient feature of each edge to be detected at each target threshold;
[0011] Filter out the target similar edge set corresponding to each edge to be detected from all edges to be detected;
[0012] Determine the wood texture index of each edge to be detected at each target threshold according to the distance between each edge to be detected and all target similar edges in the corresponding target similar edge set, and the target gradient characteristics of each edge to be detected and all target similar edges in the corresponding target similar edge set at each target threshold;
[0013] Perform texture grayscale change analysis on each edge to be detected under all target thresholds to obtain the texture grayscale change features corresponding to each edge to be detected;
[0014] Determine the texture change difference index corresponding to each edge to be detected according to the wood texture index of each edge to be detected under all target thresholds;
[0015] According to the texture change difference index and texture grayscale change characteristics corresponding to all edges to be detected, crack defect edges are screened out from all edges to be detected.
[0016] Optionally, performing gradient distribution analysis processing on each edge to be detected at each target threshold to obtain a target gradient feature of each edge to be detected at each target threshold includes:
[0017] Determine any edge to be detected as a marked edge, and determine any target threshold as a marked threshold, perform threshold segmentation on the marked edge according to the marked threshold, determine the pixel points of the marked edge located in the foreground area during the threshold segmentation as reference pixels, and obtain a reference pixel set of the marked edge under the marked threshold;
[0018] Determine the target gradient feature of the marked edge at the marking threshold based on the number of pixels on the marked edge, the number of reference pixels in the reference pixel set of the marked edge at the marking threshold, and the gradient direction corresponding to the reference pixels in the reference pixel set of the marked edge at the marking threshold.
[0019] Optionally, the formula corresponding to the target gradient feature of the edge to be detected under the target threshold is:
[0020] ;in, is the target gradient feature of the i-th edge to be detected under the j-th target threshold; i is the serial number of the edge to be detected; j is the serial number of the target threshold; is the number of pixels on the i-th edge to be detected; is the number of reference pixels in the reference pixel set of the i-th edge to be detected under the j-th target threshold; a is the sequence number of the reference pixel in the reference pixel set of the i-th edge to be detected under the j-th target threshold; It is the absolute value function; is the gradient direction corresponding to the ath reference pixel in the set of reference pixels of the i-th edge to be detected under the j-th target threshold; is the gradient direction corresponding to the a+1th reference pixel in the set of reference pixels of the i-th edge to be detected under the j-th target threshold; is a pre-set factor greater than 0.
[0021] Optionally, the step of filtering out a target similar edge set corresponding to each edge to be detected from all edges to be detected includes:
[0022] Any edge to be detected is determined as a marked edge, and a preset number of edges to be detected whose fitting straight line direction is the same as that of the marked edge and are closest to the marked edge are screened out from all edges to be detected as target similar edges, thereby obtaining a target similar edge set corresponding to the marked edge.
[0023] Optionally, the formula corresponding to the wood texture index of the edge to be detected under the target threshold is:
[0024] ;in, is the wood texture index of the i-th edge to be detected under the j-th target threshold; i is the serial number of the edge to be detected; j is the serial number of the target threshold; is the target gradient feature of the i-th edge to be detected under the j-th target threshold; is the number of target similar edges in the target similar edge set corresponding to the i-th edge to be detected; b is the sequence number of the target similar edge in the target similar edge set corresponding to the i-th edge to be detected; It is the target gradient feature of the bth target similar edge under the jth target threshold in the target similar edge set corresponding to the i-th edge to be detected; It is the distance between the i-th edge to be detected and the b-th target similar edge in its corresponding target similar edge set.
[0025] Optionally, performing texture grayscale change analysis processing on each edge to be detected under all target thresholds to obtain texture grayscale change features corresponding to each edge to be detected includes:
[0026] Any edge to be detected is determined as a marked edge, and the texture grayscale change characteristics corresponding to the marked edge are determined according to the grayscale values corresponding to all pixels within the circumscribed rectangle of the marked edge and their grayscale values under all target thresholds, wherein the grayscale value corresponding to the pixel is the grayscale value of the pixel in the target surface image; if the grayscale value corresponding to the pixel is greater than the target threshold, the first preset grayscale value is used as the grayscale value of the pixel under the target threshold; if the grayscale value corresponding to the pixel is less than or equal to the target threshold, the second preset grayscale value is used as the grayscale value of the pixel under the target threshold.
[0027] Optionally, the formula corresponding to the texture grayscale change feature corresponding to the edge to be detected is:
[0028] ; ;in, is the texture grayscale change feature corresponding to the i-th edge to be detected; i is the serial number of the edge to be detected; N is the number of target thresholds; j is the serial number of the target threshold; It is the absolute value function; is the grayscale difference index of the i-th edge to be detected under the j-th target threshold; is the grayscale difference index of the i-th edge to be detected under the j+1-th target threshold; is the number of pixels in the bounding rectangle of the i-th edge to be detected; c is the sequence number of the pixel in the bounding rectangle of the i-th edge to be detected; is the grayscale value corresponding to the cth pixel point in the bounding rectangle of the i-th edge to be detected; It is the gray value of the cth pixel in the bounding rectangle of the i-th edge to be detected under the j-th target threshold.
[0029] Optionally, determining the texture change difference index corresponding to each edge to be detected based on the wood texture index of each edge to be detected under all target thresholds includes:
[0030] Determine any edge to be detected as a marked edge, determine the absolute value of the difference between the wood texture indexes of the marked edge under each two adjacent target thresholds as a texture difference factor, and obtain a set of texture difference factors corresponding to the marked edge;
[0031] The cumulative sum of all texture difference factors in the texture difference factor set corresponding to the marked edge is determined as the texture change difference index corresponding to the marked edge.
[0032] Optionally, screening crack defect edges from all edges to be detected according to texture change difference indicators and texture grayscale change characteristics corresponding to all edges to be detected includes:
[0033] Determine the wood possibility index corresponding to each edge to be detected based on the texture change difference index and texture grayscale change characteristics corresponding to each edge to be detected, wherein the texture grayscale change characteristics are positively correlated with the wood possibility index, and the texture change difference index is negatively correlated with the wood possibility index;
[0034] If the wood possibility index corresponding to the edge to be detected is less than or equal to the preset possibility threshold, the edge to be detected is determined to be a crack defect edge.
[0035] In a second aspect, the present invention provides a quality inspection system for roadbed reinforcement wood materials, comprising a processor and a memory, wherein the processor is configured to process instructions stored in the memory to implement the quality inspection method for roadbed reinforcement wood materials.
[0036] The present invention has the following beneficial effects:
[0037] The quality inspection method for roadbed reinforcement timber materials of the present invention implements timber surface defect detection by performing image processing on a target surface image, thereby resolving the technical issue of poor accuracy in timber crack defect detection and improving the accuracy of timber crack defect detection. First, the acquired target surface image is subjected to iterative threshold segmentation to determine whether the edge to be detected is often a timber surface texture edge or a crack defect edge. Next, because the gradient distributions of timber surface texture edges and crack defect edges often differ, a gradient distribution analysis is performed on each edge to be detected at each target threshold. The quantified target gradient feature of each edge to be detected at each target threshold can, to a certain extent, distinguish between timber surface texture edges and crack defect edges. Then, the distance between each edge to be detected and all target similar edges in its corresponding target similar edge set, as well as the target gradient features of each edge to be detected and all target similar edges in its corresponding target similar edge set at each target threshold, are comprehensively considered. The larger the quantified wood texture index of the edge to be detected at each target threshold, the more likely the edge to be detected is a timber surface texture edge. Afterwards, since the texture grayscale changes and texture change differences of the wood surface texture edges and crack defect edges are often different, the quantified texture grayscale change characteristics and texture change difference indicators corresponding to the edges to be detected can distinguish the wood surface texture edges and crack defect edges to a certain extent. Finally, by comprehensively considering the texture change difference indicators and texture grayscale change characteristics corresponding to all the edges to be detected, the crack defect edge screened out from all the edges to be detected can be the edge of the crack defect area, thereby realizing the detection of crack defects. Compared with directly using the edges to be detected obtained by threshold iterative segmentation as crack defect edges, the present invention comprehensively considers the distinguishing features of multiple wood surface textures and crack defects, such as target gradient features, wood texture indicators, texture grayscale change characteristics and texture change difference indicators, etc., and relatively accurately screens out the crack defect edges from the edges to be detected obtained by threshold iterative segmentation, thereby improving the accuracy of crack defect detection on the wood to be detected. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 The present invention is a flow chart of the quality inspection method for roadbed reinforcement wood materials. DETAILED DESCRIPTION
[0040] To further illustrate the technical means and effects employed by the present invention to achieve its intended objectives, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementations, structures, features, and effects of the technical solutions proposed by the present invention. In the following description, references to "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
[0041] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0042] The present invention provides a quality inspection method for roadbed reinforcement wood materials, the method comprising the following steps:
[0043] Obtain a target surface image corresponding to the wood to be detected, perform threshold iterative segmentation on the target surface image to obtain an edge to be detected, and determine each threshold in the threshold iterative segmentation process as a target threshold;
[0044] Performing gradient distribution analysis on each edge to be detected at each target threshold to obtain the target gradient feature of each edge to be detected at each target threshold;
[0045] Filter out the target similar edge set corresponding to each edge to be detected from all edges to be detected;
[0046] Determine the wood texture index of each edge to be detected at each target threshold according to the distance between each edge to be detected and all target similar edges in the corresponding target similar edge set, and the target gradient characteristics of each edge to be detected and all target similar edges in the corresponding target similar edge set at each target threshold;
[0047] Perform texture grayscale change analysis on each edge to be detected under all target thresholds to obtain the texture grayscale change features corresponding to each edge to be detected;
[0048] Determine the texture change difference index corresponding to each edge to be detected according to the wood texture index of each edge to be detected under all target thresholds;
[0049] According to the texture change difference index and texture grayscale change characteristics corresponding to all edges to be detected, crack defect edges are screened out from all edges to be detected.
[0050] The following is a detailed explanation of each of the above steps:
[0051] refer to Figure 1, shows the process of some embodiments of the quality inspection method for roadbed reinforcement wood materials of the present invention. The quality inspection method for roadbed reinforcement wood materials includes the following steps:
[0052] Step S1, obtaining a target surface image corresponding to the wood to be detected, performing threshold iterative segmentation on the target surface image to obtain an edge to be detected, and determining each threshold in the threshold iterative segmentation process as a target threshold.
[0053] In some embodiments, a target surface image corresponding to the roadbed reinforcement timber to be detected may be obtained, and threshold iterative segmentation may be performed on the target surface image to obtain edges to be detected, and each threshold in the threshold iterative segmentation process may be determined as a target threshold.
[0054] The wood to be inspected may be roadbed reinforcement wood to be inspected for crack defects, and the target surface image may be a grayscaled surface image of the wood to be inspected.
[0055] It should be noted that the edges to be detected obtained by performing iterative threshold segmentation on the acquired target surface image are often the edges of wood surface textures or crack defect edges.
[0056] As an example, this step may include the following steps:
[0057] The first step is to obtain the surface image of the wood to be inspected as the initial image.
[0058] For example, a surface image of the wood to be inspected may be captured by a camera as an initial image.
[0059] In the second step, the initial image is grayscaled and the obtained grayscale image is used as the target surface image.
[0060] The third step is to perform iterative threshold segmentation on the target surface image, and take each edge in the foreground area segmented by the final iterative threshold segmentation as the edge to be detected.
[0061] The foreground area segmented after the final threshold iterative segmentation can be the area where the pixels with grayscale values less than or equal to the final threshold are located in the target surface image. At this time, the foreground area is often the area where the wood texture and cracks are located.
[0062] It should be noted that, generally speaking, the grayscale corresponding to wood texture and cracks is often lower than that of other areas of the wood. Therefore, the foreground area in the embodiment of the present invention can be an area composed of pixels with grayscale values less than or equal to the corresponding threshold.
[0063] The fourth step is to use each threshold in the threshold iterative segmentation process as the target threshold.
[0064] Step S2: performing gradient distribution analysis on each edge to be detected at each target threshold to obtain a target gradient feature of each edge to be detected at each target threshold.
[0065] In some embodiments, a gradient distribution analysis process may be performed on each edge to be detected at each target threshold to obtain a target gradient feature of each edge to be detected at each target threshold.
[0066] It should be noted that since the gradient distributions of wood surface texture edges and crack defect edges are often different, a gradient distribution analysis is performed on each edge to be detected at each target threshold. The quantified target gradient features of each edge to be detected at each target threshold can distinguish between wood surface texture edges and crack defect edges to a certain extent.
[0067] As an example, this step may include the following steps:
[0068] In the first step, any edge to be detected is determined as a marked edge, and any target threshold is determined as a marked threshold. According to the above-mentioned marked threshold, the above-mentioned marked edge is threshold segmented, and the pixel points of the above-mentioned marked edge located in the foreground area in this threshold segmentation are determined as reference pixel points, and the reference pixel point set of the above-mentioned marked edge under the above-mentioned marked threshold is obtained.
[0069] For example, performing threshold segmentation on the marked edge based on the marked threshold may include: using pixels on the marked edge whose grayscale values are less than or equal to the marked threshold as reference pixels, and combining all reference pixels on the marked edge obtained by the threshold segmentation at this time into a reference pixel set. Pixels on the marked edge whose grayscale values are less than or equal to the marked threshold, that is, pixels on the marked edge that are located within the foreground area during the threshold segmentation of the marked edge based on the marked threshold, may be an area consisting of pixels whose grayscale values are less than or equal to the marked threshold.
[0070] In the second step, the target gradient feature of the marked edge under the above-mentioned marking threshold is determined based on the number of pixels on the marked edge, the number of reference pixels in the reference pixel set of the marked edge under the above-mentioned marking threshold, and the gradient direction corresponding to the reference pixels in the reference pixel set of the marked edge under the above-mentioned marking threshold.
[0071] The gradient direction can range from 0° to 360°.
[0072] For example, the formula corresponding to the target gradient feature of the edge to be detected under the target threshold can be:
[0073] ;in, is the target gradient feature of the i-th edge to be detected at the j-th target threshold. i is the number of the edge to be detected. j is the number of the target threshold. is the number of pixels on the i-th edge to be detected. is the number of reference pixels in the reference pixel set of the i-th edge to be detected under the j-th target threshold. a is the sequence number of the reference pixel in the reference pixel set of the i-th edge to be detected under the j-th target threshold. It is the absolute value function. It is the gradient direction corresponding to the ath reference pixel in the set of reference pixels of the i-th edge to be detected under the j-th target threshold. It is the gradient direction corresponding to the a+1th reference pixel in the reference pixel set of the i-th edge to be detected under the j-th target threshold. It is a pre-set factor greater than 0, mainly used to prevent the denominator from being 0, for example, It can be 0.001.
[0074] It should be noted that the wood surface texture is often greatly affected by different thresholds. For example, the pixel points in the wood surface texture may appear as pixels in the foreground area under a certain target threshold, and may also appear as pixels in the background area under other target thresholds. Relatively speaking, the pixels in the crack defect are relatively less affected by different thresholds. When is larger, it often means that the number of pixels of the i-th edge to be detected that changes to the background under the j-th target threshold is relatively larger, which often means that the i-th edge to be detected is relatively more affected by different thresholds, which often means that the i-th edge to be detected is more likely to be the edge of the wood surface texture. Since the wood surface texture often appears as smooth thin lines, the gradient directions of the pixels on the edge of the wood surface texture are often similar. Since cracks often have a certain width and irregular shape, and may have bifurcations, the gradient directions of the pixels on the crack edge are often relatively chaotic. When When the value is larger, it often indicates that the gradient distribution of the i-th edge to be detected under the j-th target threshold is relatively chaotic, which often indicates that the i-th edge to be detected is more likely to be a crack edge. When it is larger, it often means that the i-th edge to be detected is more consistent with the edge characteristics of the wood surface texture under the j-th target threshold, which often means that the i-th edge to be detected is more likely to be the edge of the wood surface texture.
[0075] Step S3: Filter out a target similar edge set corresponding to each edge to be detected from all edges to be detected.
[0076] In some embodiments, a target similar edge set corresponding to each edge to be detected may be screened from all edges to be detected.
[0077] As an example, any edge to be detected can be determined as a marked edge, and a preset number of edges to be detected whose fitting straight line direction is the same as that of the marked edge and are closest to the marked edge are screened out from all edges to be detected as target similar edges, thereby obtaining a target similar edge set corresponding to the marked edge. The preset number may be a pre-set number that is not 0. For example, the preset number may be 2. The target similar edge set corresponding to the marked edge may include: a preset number of edges to be detected whose fitting straight line direction is the same as that of the marked edge and are closest to the marked edge. The same fitting straight line direction may mean the same slope of the fitting straight line. The slope of the fitting straight line corresponding to the marked edge may be equal to the slope of the fitting straight line corresponding to the target similar edge of the marked edge. The fitting straight line corresponding to the marked edge is also the fitting straight line of the marked edge. The fitting straight line corresponding to the target similar edge is also the fitting straight line of the target similar edge.
[0078] It should be noted that wood surface texture often consists of smooth, thin lines, and the texture direction is often the same on the same wood surface. Therefore, there are often multiple edges with the same texture direction on the wood surface texture edge. Therefore, the number of target similar edges in the target similar edge set corresponding to the wood surface texture edge is often a preset number. However, cracks often have a certain width and irregular shape. Therefore, cracks may not have any edges with the same texture direction, or may have few edges with the same texture direction. Therefore, the number of target similar edges in the target similar edge set corresponding to the crack edge may be zero.
[0079] Step S4, determining the wood texture index of each edge to be detected at each target threshold based on the distance between each edge to be detected and all target similar edges in the corresponding target similar edge set, and the target gradient characteristics of each edge to be detected and all target similar edges in the corresponding target similar edge set at each target threshold.
[0080] In some embodiments, the wood texture index of each edge to be detected at each target threshold can be determined based on the distance between each edge to be detected and all target similar edges in its corresponding target similar edge set, and the target gradient characteristics of each edge to be detected and all target similar edges in its corresponding target similar edge set at each target threshold.
[0081] The distance between the edge to be detected and the target similar edge may be: the distance between the fitting straight line corresponding to the edge to be detected and the fitting straight line corresponding to the target similar edge.
[0082] It should be noted that, by comprehensively considering the distances between each edge to be detected and all target similar edges in its corresponding target similar edge set, as well as the target gradient characteristics of each edge to be detected and all target similar edges in its corresponding target similar edge set at each target threshold, the larger the quantified wood texture index of the edge to be detected at each target threshold, the more likely it is that the edge to be detected is a wood surface texture edge.
[0083] As an example, the formula corresponding to the wood texture index of the edge to be detected under the target threshold can be:
[0084] ;in, is the wood texture index of the i-th edge to be detected at the j-th target threshold. i is the number of the edge to be detected. j is the number of the target threshold. is the target gradient feature of the i-th edge to be detected under the j-th target threshold. is the number of target similar edges in the target similar edge set corresponding to the i-th edge to be detected. b is the sequence number of the target similar edge in the target similar edge set corresponding to the i-th edge to be detected. It is the target gradient feature of the bth target similar edge under the jth target threshold in the target similar edge set corresponding to the i-th edge to be detected. It is the distance between the i-th edge to be detected and the b-th target similar edge in its corresponding target similar edge set.
[0085] It should be noted that It can represent the possibility that the i-th edge to be detected is the edge of the wood surface texture. The larger its value is, the more likely it is that the i-th edge to be detected is the edge of the wood surface texture. Since the number of target similar edges in the target similar edge set corresponding to the crack edge may be 0, when When , it often indicates that the i-th edge to be detected may be a crack edge, and it often indicates that the possibility that the i-th edge to be detected is a wood surface texture edge is not necessary to increase. Since the number of target similar edges in the target similar edge set corresponding to the wood surface texture edge is often greater than 0, when When , it often means that the i-th edge to be detected is more likely to be a wood surface texture edge, and it often means that the possibility that the i-th edge to be detected is a wood surface texture edge needs to be increased. Since the distance between adjacent wood surface texture edges is often relatively close, when The smaller it is, the more likely the i-th edge to be detected is the edge of the wood surface texture. When the value is larger, it often means that the i-th edge to be detected is more consistent with the edge characteristics of the wood surface texture under the j-th target threshold, and it often means that the i-th edge to be detected is more likely to be the edge of the wood surface texture. The larger the value is, the more likely the i-th edge to be detected is the edge of the wood surface texture. When As The weight of is used to increase the possibility that the i-th edge to be detected is the edge of the wood surface texture.
[0086] Step S5: performing texture grayscale change analysis on each edge to be detected under all target thresholds to obtain texture grayscale change features corresponding to each edge to be detected.
[0087] In some embodiments, texture grayscale change analysis processing may be performed on each edge to be detected under all target thresholds to obtain texture grayscale change features corresponding to each edge to be detected.
[0088] It should be noted that since the texture grayscale changes of the wood surface texture edge and the crack defect edge are often different, the texture grayscale change analysis of the edge to be detected is performed under all target thresholds. The quantified texture grayscale change characteristics corresponding to the edge to be detected can distinguish the wood surface texture edge and the crack defect edge to a certain extent.
[0089] As an example, any edge to be detected can be determined as a marked edge, and the texture grayscale change characteristics corresponding to the marked edge can be determined based on the grayscale values corresponding to all pixels within the circumscribed rectangle of the marked edge and their grayscale values under all target thresholds, wherein the grayscale value corresponding to the pixel is the grayscale value of the pixel in the target surface image. If the grayscale value corresponding to the pixel is greater than the target threshold, the first preset grayscale value is used as the grayscale value of the pixel under the target threshold. If the grayscale value corresponding to the pixel is less than or equal to the target threshold, the second preset grayscale value is used as the grayscale value of the pixel under the target threshold. The first preset grayscale value and the second preset grayscale value can be different preset grayscale values. For example, the first preset grayscale value can be 255. The second preset grayscale value can be 0.
[0090] For example, the formula corresponding to the texture grayscale change feature corresponding to the edge to be detected can be:
[0091] ; ;in, is the texture grayscale change feature corresponding to the i-th edge to be detected. i is the serial number of the edge to be detected. N is the number of target thresholds. j is the serial number of the target threshold. It is the absolute value function. It is the grayscale difference index of the i-th edge to be detected under the j-th target threshold. It is the grayscale difference index of the i-th edge to be detected under the j+1-th target threshold. is the number of pixels in the bounding rectangle of the i-th edge to be detected. c is the sequence number of the pixels in the bounding rectangle of the i-th edge to be detected. It is the grayscale value corresponding to the cth pixel point in the bounding rectangle of the i-th edge to be detected. It is the gray value of the cth pixel in the bounding rectangle of the i-th edge to be detected under the j-th target threshold.
[0092] It should be noted that when When the value is larger, it often indicates that the grayscale change difference of the circumscribed rectangular area of the i-th edge to be detected under the j-th target threshold is greater, which often indicates that the i-th edge to be detected is more likely to be the edge of the wood surface texture. When the value is larger, it often indicates that the grayscale change of the circumscribed rectangular area of the i-th edge to be detected is greater under two different target thresholds, which often indicates that the i-th edge to be detected is more likely to be a wood surface texture edge. When the value is larger, it often indicates that the i-th edge to be detected is more likely to be the edge of the wood surface texture.
[0093] Step S6: determining a texture change difference index corresponding to each edge to be detected according to the wood texture index of each edge to be detected under all target thresholds.
[0094] In some embodiments, a texture change difference index corresponding to each edge to be detected may be determined based on the wood texture index of each edge to be detected under all target thresholds.
[0095] It should be noted that, since the texture change differences of the wood surface texture edge and the crack defect edge are often different, the quantified texture change difference index corresponding to the edge to be detected can distinguish the wood surface texture edge and the crack defect edge to a certain extent.
[0096] As an example, this step may include the following steps:
[0097] In the first step, any edge to be detected is determined as a marked edge, and the absolute value of the difference between the wood texture indicators of the marked edge under each two adjacent target thresholds is determined as the texture difference factor, thereby obtaining a set of texture difference factors corresponding to the marked edge.
[0098] In the second step, the cumulative sum of all texture difference factors in the texture difference factor set corresponding to the marked edge is determined as the texture change difference index corresponding to the marked edge.
[0099] For example, the formula for determining the texture change difference index corresponding to the edge to be detected can be:
[0100] ;in, is the texture change difference index corresponding to the i-th edge to be detected. i is the index of the edge to be detected. N is the number of target thresholds. j is the index of the target threshold. It is the absolute value function. It is the wood texture index of the i-th edge to be detected under the j-th target threshold, which can characterize the smoothness of the i-th edge to be detected under the j-th target threshold. is the wood texture index of the i-th edge to be detected under the j+1-th target threshold. It is the texture difference factor, which can characterize the smoothness of the i-th edge to be detected under the j+1-th target threshold.
[0101] It should be noted that during the change of the foreground area, that is, during the iterative threshold segmentation process, its smoothness often also changes. The smoothness of the wood texture itself remains basically unchanged during the threshold change process due to its periodicity and growth cycle, while the cracks often change significantly. During the calculation of the threshold update process, the smaller the change in the smoothness of the texture, the greater the possibility that the edge is the texture of the wood itself. The smaller it is, the smaller the change in the smoothness of the i-th edge to be detected under different target thresholds is, which often means that the i-th edge to be detected is more likely to be a wood surface texture edge.
[0102] Step S7: Screening out crack defect edges from all edges to be detected based on the texture change difference index and texture grayscale change characteristics corresponding to all edges to be detected.
[0103] In some embodiments, crack defect edges may be screened out from all edges to be detected based on texture change difference indicators and texture grayscale change characteristics corresponding to all edges to be detected.
[0104] It should be noted that, by comprehensively considering the texture change difference index and texture grayscale change characteristics corresponding to all edges to be detected, the crack defect edge screened out from all edges to be detected can be the edge of the crack defect area, thereby realizing the detection of crack defects.
[0105] As an example, this step may include the following steps:
[0106] In the first step, the wood possibility index corresponding to each edge to be detected is determined according to the texture change difference index and texture grayscale change characteristics corresponding to each edge to be detected.
[0107] Among them, the texture grayscale change characteristics are positively correlated with the wood possibility index, while the texture change difference index is negatively correlated with the wood possibility index.
[0108] For example, the formula for determining the wood likelihood index corresponding to the edge to be detected can be:
[0109] ;in, is the wood likelihood index corresponding to the i-th edge to be detected. i is the serial number of the edge to be detected. is the normalization function. is the texture grayscale change feature corresponding to the i-th edge to be detected. It is the texture change difference index corresponding to the i-th edge to be detected. It is a pre-set factor greater than 0, mainly used to prevent the denominator from being 0, for example, It can be 0.001.
[0110] It should be noted that when The smaller it is, the smaller the change in the smoothness of the i-th edge to be detected under different target thresholds is, which often means that the i-th edge to be detected is more likely to be the edge of the wood surface texture. The larger the value is, the more likely the i-th edge to be detected is the edge of the wood surface texture. When the value is larger, it often indicates that the i-th edge to be detected is more likely to be the edge of the wood surface texture, and it often indicates that the i-th edge to be detected should not be detected as a crack defect.
[0111] In the second step, if the wood possibility index corresponding to the edge to be detected is less than or equal to the preset possibility threshold, the edge to be detected is determined to be a crack defect edge.
[0112] The preset possible threshold may be a preset threshold, for example, 0.7.
[0113] It should be noted that if the wood possibility index corresponding to the edge to be detected is greater than the preset possibility threshold, it means that the edge to be detected is often the edge of the wood surface texture, and should not be displayed during crack defect detection.
[0114] Optionally, in order to improve the accuracy of crack defect detection, the area enclosed by the screened crack defect edges can be used as the target surface image, and steps S1 to S7 can be repeated to further screen out the crack defect edges. This can be repeated multiple times, for example, 10 times, and the latest screened crack defect edges can be used as the final screened crack defect edges. It can also be repeated until there are no wood surface texture edges.
[0115] Based on the same inventive concept as the above-mentioned method embodiment, the present invention provides a quality inspection system for roadbed reinforcement wood materials, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the above-mentioned computer program is executed by the processor, the steps of the quality inspection method for roadbed reinforcement wood materials are implemented.
[0116] In summary, compared with directly taking the edge to be detected obtained by threshold iterative segmentation as the crack defect edge, the present invention comprehensively considers multiple distinguishing features of wood surface textures and crack defects, such as target gradient features, wood texture indicators, texture grayscale change characteristics and texture change difference indicators, and relatively accurately screens out the crack defect edge from the edge to be detected obtained by threshold iterative segmentation, thereby improving the accuracy of crack defect detection on the wood to be detected.
[0117] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A quality inspection method for roadbed reinforcement wood materials, characterized in that: The following steps are involved: Acquire a target surface image corresponding to the wood to be detected, perform threshold iterative segmentation on the target surface image to obtain an edge to be detected, and determine each threshold in the threshold iterative segmentation process as a target threshold; Performing gradient distribution analysis on each edge to be detected at each target threshold to obtain the target gradient feature of each edge to be detected at each target threshold; Filter out the target similar edge set corresponding to each edge to be detected from all edges to be detected; Determine the wood texture index of each edge to be detected at each target threshold according to the distance between each edge to be detected and all target similar edges in the corresponding target similar edge set, and the target gradient characteristics of each edge to be detected and all target similar edges in the corresponding target similar edge set at each target threshold; Perform texture grayscale change analysis on each edge to be detected under all target thresholds to obtain the texture grayscale change features corresponding to each edge to be detected; Determine the texture change difference index corresponding to each edge to be detected according to the wood texture index of each edge to be detected under all target thresholds; According to the texture change difference index and texture grayscale change characteristics corresponding to all edges to be detected, crack defect edges are screened out from all edges to be detected.
2. The quality inspection method for roadbed reinforcement wood materials according to claim 1, characterized in that: The step of performing gradient distribution analysis on each edge to be detected at each target threshold to obtain a target gradient feature of each edge to be detected at each target threshold includes: Determine any edge to be detected as a marked edge, and determine any target threshold as a marked threshold, perform threshold segmentation on the marked edge according to the marked threshold, determine the pixel points of the marked edge located in the foreground area during the threshold segmentation as reference pixels, and obtain a reference pixel set of the marked edge under the marked threshold; Determine the target gradient feature of the marked edge at the marking threshold based on the number of pixels on the marked edge, the number of reference pixels in the reference pixel set of the marked edge at the marking threshold, and the gradient direction corresponding to the reference pixels in the reference pixel set of the marked edge at the marking threshold.
3. The quality inspection method for roadbed reinforcement wood materials according to claim 2, characterized in that: The formula corresponding to the target gradient feature of the edge to be detected under the target threshold is: ;in, is the target gradient feature of the i-th edge to be detected under the j-th target threshold; i is the serial number of the edge to be detected; j is the serial number of the target threshold; is the number of pixels on the i-th edge to be detected; is the number of reference pixels in the reference pixel set of the i-th edge to be detected under the j-th target threshold; a is the sequence number of the reference pixel in the reference pixel set of the i-th edge to be detected under the j-th target threshold; It is the absolute value function; is the gradient direction corresponding to the ath reference pixel in the set of reference pixels of the i-th edge to be detected under the j-th target threshold; is the gradient direction corresponding to the a+1th reference pixel in the set of reference pixels of the i-th edge to be detected under the j-th target threshold; is a pre-set factor greater than 0.
4. The quality inspection method for roadbed reinforcement wood materials according to claim 1, characterized in that: The step of screening out a target similar edge set corresponding to each edge to be detected from all edges to be detected includes: Any edge to be detected is determined as a marked edge, and a preset number of edges to be detected whose fitting straight line direction is the same as that of the marked edge and are closest to the marked edge are screened out from all edges to be detected as target similar edges, thereby obtaining a target similar edge set corresponding to the marked edge.
5. The quality inspection method for roadbed reinforcement wood materials according to claim 1, characterized in that: The formula corresponding to the wood texture index of the edge to be detected under the target threshold is: ;in, is the wood texture index of the i-th edge to be detected under the j-th target threshold; i is the serial number of the edge to be detected; j is the serial number of the target threshold; is the target gradient feature of the i-th edge to be detected under the j-th target threshold; is the number of target similar edges in the target similar edge set corresponding to the i-th edge to be detected; b is the sequence number of the target similar edge in the target similar edge set corresponding to the i-th edge to be detected; It is the target gradient feature of the bth target similar edge under the jth target threshold in the target similar edge set corresponding to the i-th edge to be detected; It is the distance between the i-th edge to be detected and the b-th target similar edge in its corresponding target similar edge set.
6. The quality inspection method for roadbed reinforcement wood materials according to claim 1, characterized in that: The texture grayscale change analysis process is performed on each edge to be detected under all target thresholds to obtain the texture grayscale change feature corresponding to each edge to be detected, including: Any edge to be detected is determined as a marked edge, and the texture grayscale change characteristics corresponding to the marked edge are determined according to the grayscale values corresponding to all pixels within the circumscribed rectangle of the marked edge and their grayscale values under all target thresholds, wherein the grayscale value corresponding to the pixel is the grayscale value of the pixel in the target surface image; if the grayscale value corresponding to the pixel is greater than the target threshold, the first preset grayscale value is used as the grayscale value of the pixel under the target threshold; if the grayscale value corresponding to the pixel is less than or equal to the target threshold, the second preset grayscale value is used as the grayscale value of the pixel under the target threshold.
7. The quality inspection method for roadbed reinforcement wood materials according to claim 6, characterized in that: The formula corresponding to the texture grayscale change feature of the edge to be detected is: ; ;in, is the texture grayscale change feature corresponding to the i-th edge to be detected; i is the serial number of the edge to be detected; N is the number of target thresholds; j is the serial number of the target threshold; It is the absolute value function; is the grayscale difference index of the i-th edge to be detected under the j-th target threshold; is the grayscale difference index of the i-th edge to be detected under the j+1-th target threshold; is the number of pixels in the bounding rectangle of the i-th edge to be detected; c is the sequence number of the pixel in the bounding rectangle of the i-th edge to be detected; is the grayscale value corresponding to the cth pixel point in the bounding rectangle of the i-th edge to be detected; It is the gray value of the cth pixel in the bounding rectangle of the i-th edge to be detected under the j-th target threshold.
8. The quality inspection method for roadbed reinforcement wood materials according to claim 1, characterized in that: Determining the texture change difference index corresponding to each edge to be detected based on the wood texture index of each edge to be detected under all target thresholds includes: Determine any edge to be detected as a marked edge, determine the absolute value of the difference between the wood texture indexes of the marked edge under each two adjacent target thresholds as a texture difference factor, and obtain a set of texture difference factors corresponding to the marked edge; The cumulative sum of all texture difference factors in the texture difference factor set corresponding to the marked edge is determined as the texture change difference index corresponding to the marked edge.
9. The quality inspection method for roadbed reinforcement wood materials according to claim 1, characterized in that: The method of screening crack defect edges from all edges to be detected based on the texture change difference index and texture grayscale change characteristics corresponding to all edges to be detected includes: Determine the wood possibility index corresponding to each edge to be detected based on the texture change difference index and texture grayscale change characteristics corresponding to each edge to be detected, wherein the texture grayscale change characteristics are positively correlated with the wood possibility index, and the texture change difference index is negatively correlated with the wood possibility index; If the wood possibility index corresponding to the edge to be detected is less than or equal to the preset possibility threshold, the edge to be detected is determined to be a crack defect edge.
10. A quality inspection system for roadbed reinforcement wood materials, characterized in that: The method comprises a processor and a memory, wherein the processor is used to process instructions stored in the memory to implement the quality inspection method for roadbed reinforcement wood materials according to any one of claims 1 to 9.
Citation Information
Patent Citations
Visual inspection system for polishing effect of aluminum alloy surface
CN117173189A
Building structure steel plate defect detection method based on machine vision
CN118587161A