Method for extracting OSB processing contour based on image feature extraction
Through the method based on image feature extraction, combined with curvature change and edge distribution difference analysis, adaptive connection of the Oxon board images is solved, and the problem of low accuracy of the Oxon board image processing contour extraction in the existing technology is achieved. Extraction accuracy.
Patent Information
- Application Number
- CN202411337953.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-09-25
AI Technical Summary
The prior art has problems with poor accuracy in the extraction of Oxon plate image processing profiles, especially due to edge connection errors caused by complex textures and burrs.
Using an image feature extraction method, through edge detection, curvature change analysis, edge distribution difference analysis and adaptive connection probability calculation, strong contour edges and weak edges are screened and connected to form a more accurate processing contour.
It improves the accuracy of the processing profile extraction of Oxon board image, reduces interference with internal texture and burr information, and enhances the ability to identify the processing profile.
Smart Images

Figure CN118864514B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image feature extraction, and in particular to a method for extracting an OSB processing contour based on image feature extraction. Background Art
[0002] OSB board is a common building material, widely used in building structures such as floors, walls, and ceilings. In the manufacturing and processing of OSB boards, accurate contour extraction is crucial to ensure product quality and production efficiency. At present, edge detection is usually used to extract contours, and the more commonly used edge detection algorithm is the Canny edge detection algorithm. Among them, the edge detection algorithm is a more common algorithm implemented by image feature extraction. For example, the gradient in the edge detection algorithm is a more common image feature.
[0003] However, when the Canny edge detection algorithm is directly used to extract the processing contour of OSB images, the following technical problems often occur:
[0004] Since the internal texture of OSB is complex and there may be burrs at the processed contour, the Canny edge detection algorithm often directly connects the strong edge and its adjacent weak edge to achieve contour extraction. Since the detected strong edge and its adjacent weak edge may be internal texture edges or burr edges, there may be more internal texture information or burr information in the final extracted contour, resulting in poor accuracy in processing contour extraction of OSB images. Summary of the invention
[0005] The content of the present invention is used to introduce the concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of the present invention is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0006] In order to solve the technical problem of poor accuracy in extracting processing contours of OSB board images, the present invention proposes an OSB board processing contour extraction method based on image feature extraction.
[0007] The present invention provides a method for extracting the processing contour of OSB board based on image feature extraction, the method comprising:
[0008] Acquire a target OSB image, perform edge detection on the target OSB image, determine each strong edge and each weak edge detected as an initial edge, and obtain an initial edge set;
[0009] Performing curvature change analysis processing on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge;
[0010] Perform edge distribution difference analysis on the areas on both sides of each initial edge to obtain edge distribution difference index corresponding to each initial edge;
[0011] Determine the target contour index corresponding to each initial edge according to the curvature change index and edge distribution difference index corresponding to each initial edge;
[0012] According to the target contour index, strong contour edges are screened out from the initial edge set, and initial edges other than the strong contour edges in the initial edge set are determined as target weak edges;
[0013] Determine the target connection probability between each strong contour edge and each adjacent target weak edge according to the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge;
[0014] According to the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected to obtain a target edge contour set.
[0015] Optionally, performing curvature change analysis processing on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge includes:
[0016] Record any pixel point on the initial edge as a marked pixel point, select a preset number of pixel points closest to the marked pixel point from the initial edge as reference pixels, and obtain a preset number of reference pixels;
[0017] Performing curve fitting according to the positions corresponding to the marked pixel point and a preset number of reference pixel points to obtain a fitting curve corresponding to the marked pixel point;
[0018] Determine the curvature of the marked pixel point on the corresponding fitting curve as the target curvature corresponding to the marked pixel point;
[0019] According to the target curvature corresponding to all the pixel points on the initial edge, a curvature change index corresponding to the initial edge is determined.
[0020] Optionally, determining a curvature change index corresponding to the initial edge according to target curvatures corresponding to all pixel points on the initial edge includes:
[0021] The variance of the target curvature corresponding to all the pixels on the initial edge is determined as the curvature change index corresponding to the initial edge.
[0022] Optionally, performing edge distribution difference analysis processing on the areas on both sides of each initial edge to obtain an edge distribution difference index corresponding to each initial edge includes:
[0023] Any initial edge is recorded as a marked edge, and the marked edge is expanded to obtain a connected region, and the connected region corresponds to the region in the target OSB image and is determined as a candidate region corresponding to the marked edge;
[0024] Determine an area in the candidate area except the marked edge as a reference area corresponding to the marked edge;
[0025] Using the marked edge as a dividing line, dividing the reference area into two sub-areas;
[0026] According to the length and curvature change indexes corresponding to the initial edge in each sub-region, the edge disorder degree corresponding to each sub-region is determined;
[0027] The edge distribution difference index corresponding to the marked edge is determined according to the absolute value of the difference between the edge chaos degrees corresponding to the two sub-regions, wherein the absolute value of the difference between the edge chaos degrees corresponding to the two sub-regions is positively correlated with the edge distribution difference index.
[0028] Optionally, the formula corresponding to the edge disorder degree of the sub-region is:
[0029] ; Where H is the edge disorder degree corresponding to the sub-region; is a logarithmic function with a as the base; a is a preset value greater than 1; S is the area of the sub-region; N is the number of initial edges in the sub-region; b is the sequence number of the initial edge in the sub-region; is the length corresponding to the bth initial edge in the sub-region; It is the curvature change index corresponding to the bth initial edge in the sub-region.
[0030] Optionally, the formula corresponding to the target contour index corresponding to the initial edge is:
[0031] ;in, is the target contour index corresponding to the kth initial edge in the initial edge set; k is the sequence number of the initial edge in the initial edge set; is the length corresponding to the kth initial edge in the initial edge set; It is the mean of the gradient values corresponding to all pixels on the kth initial edge in the initial edge set; It is an exponential function with a natural constant as base; It is the curvature change index corresponding to the kth initial edge in the initial edge set; is the hyperbolic tangent function; is the absolute value function; is the edge disorder degree corresponding to the first sub-region in the reference region corresponding to the kth initial edge in the initial edge set; is the edge disorder degree corresponding to the second sub-region in the reference region corresponding to the kth initial edge in the initial edge set; is the minimum value function; is the edge distribution difference index corresponding to the kth initial edge in the initial edge set; is a pre-set factor greater than 0.
[0032] Optionally, the step of selecting strong contour edges from the initial edge set according to the target contour index includes:
[0033] Initial edges whose target contour index is greater than a preset contour threshold are screened out from the initial edge set as strong contour edges.
[0034] Optionally, determining the target connection probability between each strong contour edge and each adjacent target weak edge according to the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge, comprises:
[0035] Any target weak edge adjacent to the strong contour edge is recorded as a reference edge, and the target connection probability between the strong contour edge and the reference edge is determined according to the angle between the strong contour edge and the reference edge, the mean of the target curvature corresponding to all pixels on the strong contour edge, the mean of the target curvature corresponding to all pixels on the reference edge, the curvature change index corresponding to the reference edge, and the target contour index.
[0036] Optionally, the formula corresponding to the target connection probability between a strong contour edge and its adjacent target weak edge is:
[0037] ;in, is the target connection probability between the mth strong contour edge and its adjacent nth target weak edge; m is the sequence number of the strong contour edge; n is the sequence number of the target weak edge adjacent to the mth strong contour edge; is the cosine function; is the angle between the mth strong contour edge and its adjacent nth target weak edge; It is an exponential function with a natural constant as base; is the curvature change index corresponding to the nth target weak edge adjacent to the mth strong contour edge; It is the absolute value function; is the mean of the target curvature corresponding to all pixels on the edge of the mth strong contour; is the mean of the target curvatures corresponding to all pixels on the nth target weak edge adjacent to the mth strong contour edge; is the target contour index corresponding to the nth target weak edge adjacent to the mth strong contour edge.
[0038] Optionally, the step of adaptively connecting the strong contour edges and the target weak edges according to the target connection probability between all the strong contour edges and all the adjacent target weak edges to obtain the target edge contour set includes:
[0039] Filter out target weak edges whose target connection probability is greater than a preset connection threshold from all target weak edges adjacent to the strong contour edge as edges to be connected, and obtain a set of edges to be connected corresponding to the strong contour edge;
[0040] Connect the strong contour edge and all the edges to be connected in its corresponding set of edges to be connected to obtain the target edge contour corresponding to the strong contour edge;
[0041] All the obtained target edge contours are combined into a target edge contour set.
[0042] The present invention has the following beneficial effects:
[0043] The present invention is based on the extraction of the processing contour of the European pine board of the image feature extraction method, through the image feature extraction, realizes the extraction of the processing contour of the European pine board, solves the technical problem of the poor accuracy of the extraction of the processing contour of the European pine board image, and improves the accuracy of the extraction of the processing contour of the European pine board image. First, the target European pine board image obtained is subjected to edge detection, and each strong edge and each weak edge detected are determined as the initial edge, which can facilitate the subsequent analysis of the processing contour feature of the European pine board for each initial edge, and can avoid the subsequent misconnection of the strong edge and the weak edge or the misextraction of the processing contour edge caused by directly using the connected edge as the processing contour edge to a certain extent. Then, because the processing contour of the European pine board is often regular, the curvature change on the processing contour of the European pine board is often relatively small, so the initial edge is subjected to the curvature change analysis process, and the larger the curvature change index corresponding to the quantified initial edge is, the more likely it is that the initial edge is not the edge on the processing contour of the European pine board. Then, since OSB is often composed of wood chips, sawdust and adhesive, the internal texture of the OSB processing contour in the target OSB image is often relatively complex, while the outer side of the OSB processing contour is often a monotonous background. Therefore, the edge distribution difference between the two sides of the OSB processing contour is relatively large. Therefore, the edge distribution difference analysis is performed on the two sides of the initial edge. The larger the edge distribution difference index corresponding to the quantified initial edge is, the more likely the initial edge is to be an edge on the OSB processing contour. Continuing, by comprehensively considering the curvature change index and edge distribution difference index corresponding to the initial edge, the accuracy of determining the target contour index corresponding to the initial edge can be improved, and the larger the target contour index corresponding to the initial edge is, the more likely the initial edge is to be an edge on the OSB processing contour. Afterwards, based on the target contour index, the strong contour edge selected from the initial edge set is often an edge with relatively obvious OSB processing contour features, and the target weak edge is often an edge with relatively less obvious OSB processing contour features. Then, since the processing contour of OSB is often regular, when the directions of the strong contour edge and its adjacent target weak edge are closer, that is, the angle between the strong contour edge and its adjacent target weak edge is smaller, and the characteristics of the target weak edge are more consistent with the processing contour characteristics, that is, the target contour index corresponding to the target weak edge is larger, it often indicates that the strong contour edge and its adjacent target weak edge should be more connected. Therefore, based on the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge, the target connection probability between each strong contour edge and each adjacent target weak edge can be quantified, and the larger the value, the more likely the strong contour edge and the target weak edge should be connected.Finally, based on the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected, and the target edge contours in the obtained target edge contour set are often the edge contours on the processing contour of the European pine board, which realizes the extraction of the processing contour of the European pine board. Secondly, compared with directly using the Canny edge detection algorithm to extract the processing contour of the European pine board image, the present invention comprehensively considers multiple features related to the processing contour of the European pine board, such as curvature change index, edge distribution difference index and target contour index, etc., which can improve the probability that the extracted strong contour edge is the edge on the processing contour of the European pine board to a certain extent. And the present invention comprehensively considers the connection features related to strong and weak edges, such as the angle between the two and the target contour index corresponding to the target weak edge, and the strong contour edge and the target weak edge are adaptively connected, which can reduce the interference of information such as internal texture and burrs to a certain extent, thereby improving the accuracy of processing contour extraction of the European pine board image. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 The present invention is a flow chart of the method for extracting the contour of OSB processing based on image feature extraction. DETAILED DESCRIPTION
[0046] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0047] 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.
[0048] The present invention provides a method for extracting the contour of OSB board processing based on image feature extraction, the method comprising the following steps:
[0049] Acquire a target OSB image, perform edge detection on the target OSB image, determine each strong edge and each weak edge detected as an initial edge, and obtain an initial edge set;
[0050] Performing curvature change analysis on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge;
[0051] Perform edge distribution difference analysis on the areas on both sides of each initial edge to obtain edge distribution difference index corresponding to each initial edge;
[0052] Determine the target contour index corresponding to each initial edge according to the curvature change index and edge distribution difference index corresponding to each initial edge;
[0053] According to the target contour index, strong contour edges are screened out from the initial edge set, and initial edges other than the strong contour edges in the initial edge set are determined as target weak edges;
[0054] Determine the target connection probability between each strong contour edge and each adjacent target weak edge according to the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge;
[0055] According to the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected to obtain a target edge contour set.
[0056] The following is a detailed explanation of each of the above steps:
[0057] refer to Figure 1 , shows the process of some embodiments of the OSB processing contour extraction method based on image feature extraction according to the present invention. The OSB processing contour extraction method based on image feature extraction includes the following steps:
[0058] Step S1, obtaining a target OSB image, and performing edge detection on the target OSB image, determining each strong edge and each weak edge obtained by detection as an initial edge, and obtaining an initial edge set.
[0059] In some embodiments, a target OSB image may be acquired, and edge detection may be performed on the target OSB image. Each strong edge and each weak edge detected may be determined as an initial edge to obtain an initial edge set.
[0060] The target OSB image may be an image to be subjected to OSB processing contour extraction. The processing contour often refers to the outer contour formed by cutting a workpiece into a desired shape and size by a tool. The processing contour of OSB is often a rectangular contour. The initial edge in the initial edge set may be an edge obtained by edge detection of the target OSB image.
[0061] It should be noted that edge detection is performed on the acquired target OSB image, and each strong edge and each weak edge detected is determined as an initial edge. This can, to a certain extent, avoid the subsequent misconnection of strong edges and weak edges or the misextraction of machining contour edges caused by directly taking the connected edges as machining contour edges.
[0062] As an example, this step may include the following steps:
[0063] The first step is to obtain the target OSB image.
[0064] For example, an image of the OSB board may be captured from directly above by a camera, and the captured OSB board image may be grayscaled, and the grayscaled OSB board image may be used as a target OSB board image.
[0065] In the second step, edge detection is performed on the target OSB image, and each strong edge and each weak edge detected is determined as an initial edge to obtain an initial edge set.
[0066] For example, the Canny edge detection algorithm can be used to perform edge detection on the target OSB image, and each detected strong edge and each target weak edge can be used as an initial edge to obtain an initial edge set.
[0067] Step S2, performing curvature change analysis processing on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge.
[0068] In some embodiments, a curvature change analysis process may be performed on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge.
[0069] It should be noted that since the processing contour of OSB board is often regular, the curvature change on the processing contour of OSB board is often relatively small. Therefore, the curvature change analysis is performed on the initial edge. The larger the curvature change index corresponding to the quantified initial edge, the more likely it is that the initial edge is not an edge on the processing contour of OSB board.
[0070] As an example, this step may include the following steps:
[0071] In the first step, any pixel point on the above initial edge is recorded as a marked pixel point, and a preset number of pixel points closest to the marked pixel point are selected from the above initial edge as reference pixels to obtain a preset number of reference pixels.
[0072] The preset number may be a preset number, for example, 5.
[0073] In the second step, curve fitting is performed according to the positions corresponding to the above-mentioned marked pixel points and a preset number of reference pixel points to obtain a fitting curve corresponding to the above-mentioned marked pixel points.
[0074] For example, according to the positions corresponding to the marked pixel point and a preset number of reference pixel points, a curve fitting can be performed on the marked pixel point and a preset number of reference pixel points through quadratic polynomial fitting, and the obtained fitting curve can be used as the fitting curve corresponding to the marked pixel point.
[0075] In the third step, the curvature of the marked pixel point on its corresponding fitting curve is determined as the target curvature corresponding to the marked pixel point.
[0076] For example, the method for obtaining the curvature of the marked pixel on its corresponding fitting curve may be: determining the absolute value of the second-order derivative of the fitting curve at the marked pixel as the curvature of the marked pixel on its corresponding fitting curve.
[0077] The fourth step is to determine the curvature change index corresponding to the initial edge according to the target curvature corresponding to all the pixels on the initial edge.
[0078] For example, the formula corresponding to determining the variance of the target curvature corresponding to all the pixels on the initial edge as the curvature change index corresponding to the initial edge may be:
[0079] ;in, is the curvature change index corresponding to the kth initial edge in the initial edge set. k is the sequence number of the initial edge in the initial edge set. is the number of pixels on the kth initial edge. is the target curvature corresponding to the i-th pixel on the k-th initial edge. i is the serial number of the pixel on the k-th initial edge. It is the mean of the target curvature corresponding to all pixels on the kth initial edge.
[0080] It should be noted that, since the processing profile of OSB boards is often regular, the curvature change on the processing profile of OSB boards is often relatively small. The larger it is, the greater the degree of change of the curvature on the kth initial edge is, the more chaotic the change of the curvature on the kth initial edge is, and the more likely the kth initial edge is not an edge on the processing contour of the OSB.
[0081] Step S3, performing edge distribution difference analysis processing on the areas on both sides of each initial edge to obtain an edge distribution difference index corresponding to each initial edge.
[0082] In some embodiments, edge distribution difference analysis processing may be performed on the regions on both sides of each initial edge to obtain an edge distribution difference index corresponding to each initial edge.
[0083] It should be noted that, since OSB is often composed of wood chips, sawdust and adhesives, the internal texture of the OSB processing contour in the target OSB image is often relatively complex, while the outer side of the OSB processing contour is often a monotonous background. Therefore, the edge distribution difference between the two side regions of the OSB processing contour is relatively large. Therefore, the edge distribution difference analysis is performed on the two side regions of the initial edge. The larger the edge distribution difference index corresponding to the quantified initial edge is, the more likely the initial edge is to be an edge on the OSB processing contour.
[0084] As an example, this step may include the following steps:
[0085] In the first step, any initial edge is recorded as a marked edge, and the marked edge is expanded to obtain a connected area, and the connected area corresponds to the area in the target OSB image and is determined as the candidate area corresponding to the marked edge.
[0086] For example, a 5×5 expansion kernel can be used to perform an expansion operation on the marked edge, iterated 3 times, and the connected domain obtained after the expansion operation is used as the connected area. Since this step is mainly to select the position of the connected area, and does not need to change its corresponding features, such as grayscale values, the area corresponding to the connected area in the target OSB image, that is, the area at the same position where the features are not changed, can be determined as the candidate area corresponding to the marked edge. Among them, the area corresponding to the connected area in the target OSB image can be the area in the target OSB image that is covered by the connected area due to the expansion operation.
[0087] In the second step, the area in the candidate area except the marked edge is determined as the reference area corresponding to the marked edge.
[0088] The third step is to divide the reference area into two sub-areas using the marked edge as a dividing line.
[0089] The two sub-regions obtained by segmentation can represent the two side regions of the marked edge.
[0090] For example, since the length of the marked edge may be shorter than the length of the reference area, when the length of the marked edge is smaller than the length of the reference area, the marked edge can be extended to obtain an extended line of the marked edge. The extended line of the marked edge is used as a dividing line to divide the reference area, and the divided area is used as a sub-area to obtain two sub-areas.
[0091] Optionally, the reference region is segmented using the fitted straight line marking the edge as a segmentation line, and the segmented region is used as a sub-region, so that two sub-regions can be obtained.
[0092] The fourth step is to determine the edge disorder degree corresponding to each sub-region according to the length and curvature change index corresponding to the initial edge in each sub-region.
[0093] The length corresponding to the initial edge can be represented by the maximum value of the distances between all pixels on the initial edge.
[0094] For example, the formula for determining the edge disorder degree corresponding to the sub-region can be:
[0095] ; Where H is the edge chaos degree corresponding to the sub-region. is a logarithmic function with a as the base. a is a preset value greater than 1, for example, a can be 2. S is the area of the subregion. The area of the subregion can be represented by the number of pixels in the subregion. N is the number of initial edges in the subregion. b is the sequence number of the initial edge in the subregion. is the length corresponding to the bth initial edge in the sub-region. It is the curvature change index corresponding to the bth initial edge in the sub-region.
[0096] It should be noted that when When is larger, it often means that the curvature change on the bth initial edge is greater, and it often means that the curvature change on the bth initial edge is more chaotic. The larger it is, the longer the bth initial edge is. Can be used as When When the value is larger, it often means that there are relatively more initial edges with chaotic curvature changes in the sub-region, which often means that the edges in the sub-region are relatively more chaotic, and the sub-region is more likely to be located inside the OSB. Since the areas of the divided sub-regions may be different, considering the area of the sub-region can reduce the interference of the area to a certain extent. When H is larger, it often indicates that the proportion of initial edges with chaotic curvature changes in the sub-region is relatively larger, which often indicates that the edges in the sub-region are relatively more chaotic. Therefore, when H is larger, it often indicates that the edges in the sub-region are relatively more chaotic, which often indicates that there are more likely to be messy texture edges in the sub-region, which often indicates that the sub-region is more likely to be located inside the OSB. When H is smaller, it often indicates that there are relatively fewer or no edges in the sub-region, which often indicates that the sub-region is more likely to be located in the background area outside the OSB. The logarithmic function with a as the base can be used to adjust the value range of the data.
[0097] In the fifth step, the edge distribution difference index corresponding to the marked edge is determined according to the absolute value of the difference between the edge disorder degrees corresponding to the two sub-regions.
[0098] Among them, the absolute value of the difference between the edge disorder degrees corresponding to the two sub-regions can be positively correlated with the edge distribution difference index.
[0099] Step S4, determining the target contour index corresponding to each initial edge according to the curvature change index and the edge distribution difference index corresponding to each initial edge.
[0100] In some embodiments, the target contour index corresponding to each initial edge may be determined according to the curvature change index and the edge distribution difference index corresponding to each initial edge.
[0101] Among them, the gradient value is also called gradient amplitude or gradient size.
[0102] It should be noted that the comprehensive consideration of the curvature change index and the edge distribution difference index corresponding to the initial edge can improve the accuracy of determining the target contour index corresponding to the initial edge, and the larger the target contour index corresponding to the initial edge, the more likely the initial edge is to be the edge on the OSB processing contour.
[0103] As an example, the formula for determining the target contour index corresponding to the initial edge can be:
[0104] ;in, is the target contour index corresponding to the kth initial edge in the initial edge set. k is the sequence number of the initial edge in the initial edge set. It is the length corresponding to the kth initial edge in the initial edge set. It is the mean of the gradient values corresponding to all pixels on the kth initial edge in the initial edge set. It is an exponential function with a natural constant as its base. It is the curvature change index corresponding to the kth initial edge in the initial edge set. is the hyperbolic tangent function. is the absolute value function. It is the edge disorder degree corresponding to the first sub-region in the reference region corresponding to the kth initial edge in the initial edge set. It is the degree of edge chaos corresponding to the second sub-region in the reference region corresponding to the kth initial edge in the initial edge set. is the minimum value function. It is the edge distribution difference index corresponding to the kth initial edge in the initial edge set. 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.
[0105] It should be noted that when When the value is larger, it often indicates that the kth initial edge is relatively longer, which often indicates that the kth initial edge is more likely to be the edge on the processing contour of OSB. When is larger, it often indicates that the gradient value of the pixel point on the kth initial edge is larger, which often indicates that the kth initial edge is more likely to be the edge on the processing contour of OSB. The smaller it is, the smaller the curvature change on the kth initial edge is, the more regular the curvature change on the kth initial edge is, and the more likely the kth initial edge is to be the edge on the OSB processing contour. When it is larger, it often means that the edge distribution difference between the two sides of the k-th initial edge is relatively larger, which often means that the sub-regions on both sides of the k-th initial edge are more likely to be the inner part of the OSB with chaotic texture edge distribution and the background area with fewer edges, which often means that the k-th initial edge is more likely to be the edge on the processing contour of the OSB. The smaller it is, the more likely it is that one side of the kth initial edge is a background area with relatively few or no edges, and the more likely it is that the kth initial edge is an edge on the processing contour of OSB. When the value is larger, it often indicates that the kth initial edge is more likely to be an edge on the processed contour of OSB.
[0106] Step S5, based on the target contour index, strong contour edges are screened out from the initial edge set, and initial edges other than the strong contour edges in the initial edge set are determined as target weak edges.
[0107] In some embodiments, strong contour edges may be screened out from the initial edge set according to a target contour index, and initial edges other than the strong contour edges in the initial edge set may be determined as target weak edges.
[0108] It should be noted that, based on the target contour index, the strong contour edges selected from the initial edge set are often the edges with relatively obvious contour features of OSB board processing. The initial edges other than the strong contour edges in the initial edge set are often the edges with relatively less obvious contour features of OSB board processing, that is, the initial edges other than the strong contour edges in the initial edge set often include: OSB board internal texture edges, burr edges and relatively less obvious edges on the OSB board processing contour that need to be connected.
[0109] As an example, this step may include the following steps:
[0110] In the first step, the initial edges whose target contour index is greater than a preset contour threshold are selected from the above initial edge set as strong contour edges.
[0111] The preset contour threshold may be a preset threshold, for example, the preset contour threshold may be 0.7.
[0112] In the second step, the initial edges in the above initial edge set except the strong contour edges are determined as target weak edges.
[0113] Step S6, determining the target connection probability between each strong contour edge and each adjacent target weak edge according to the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge.
[0114] In some embodiments, the target connection probability between each strong contour edge and each adjacent target weak edge can be determined based on the angle between each strong contour edge and each adjacent target weak edge and the target contour index corresponding to the target weak edge.
[0115] Among them, the target weak edge adjacent to the strong contour edge can be a target weak edge that overlaps with the adjacent area corresponding to the strong contour edge. The adjacent area corresponding to the strong contour edge can be the union of the preset neighborhoods corresponding to all pixel points on the strong contour edge. The preset neighborhood can be a pre-set neighborhood. For example, the preset neighborhood can be a 5×5 area. The angle between the strong contour edge and the target weak edge adjacent to it can be represented by the angle between the fitting straight line of the strong contour edge and the fitting straight line of the target weak edge.
[0116] It should be noted that, since the processing contour of OSB is often regular, when the directions of the strong contour edge and its adjacent target weak edge are closer, that is, the angle between the strong contour edge and its adjacent target weak edge is smaller, and the characteristics of the target weak edge are more consistent with the processing contour characteristics, that is, the target contour index corresponding to the target weak edge is larger, it often indicates that the strong contour edge and its adjacent target weak edge should be more connected. Therefore, based on the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge, the target connection probability between each strong contour edge and each adjacent target weak edge can be quantified, and the larger the value, the more likely the strong contour edge and the target weak edge should be connected.
[0117] As an example, any target weak edge adjacent to the above-mentioned strong contour edge can be recorded as a reference edge, and the target connection probability between the above-mentioned strong contour edge and the above-mentioned reference edge can be determined based on the angle between the above-mentioned strong contour edge and the above-mentioned reference edge, the mean of the target curvature corresponding to all pixels on the above-mentioned strong contour edge, the mean of the target curvature corresponding to all pixels on the above-mentioned reference edge, the curvature change index corresponding to the above-mentioned reference edge, and the target contour index.
[0118] For example, the formula corresponding to the target connection probability between a strong contour edge and its adjacent target weak edge can be:
[0119] ;in, is the target connection probability between the mth strong contour edge and its adjacent nth target weak edge. m is the sequence number of the strong contour edge. n is the sequence number of the target weak edge adjacent to the mth strong contour edge. is the cosine function. It is the angle between the mth strong contour edge and its adjacent nth target weak edge. It is an exponential function with a natural constant as its base. It is the curvature change index corresponding to the nth target weak edge adjacent to the mth strong contour edge. It is the absolute value function. It is the mean of the target curvature corresponding to all pixels on the mth strong contour edge. It is the mean of the target curvatures corresponding to all pixels on the nth target weak edge adjacent to the mth strong contour edge. It is the target contour index corresponding to the nth target weak edge adjacent to the mth strong contour edge.
[0120] It should be noted that due to The value range of is [0°, 90°], so when The more hours, The larger the value is, the closer the direction of the mth strong contour edge is to its adjacent nth target weak edge, which means that the nth target weak edge is more likely to be the edge on the OSB processing contour that needs to be connected, and the mth strong contour edge should be connected to its adjacent nth target weak edge. The smaller it is, the more regular the curvature change on the nth target weak edge is, which often means that the nth target weak edge is more likely to be the edge on the OSB processing contour. The smaller it is, the closer the curvature characteristics of the mth strong contour edge and its adjacent nth target weak edge are, the closer the regular distribution of the mth strong contour edge and its adjacent nth target weak edge is, the more likely the nth target weak edge is to be connected to the OSB processing contour, and the more likely the mth strong contour edge and its adjacent nth target weak edge should be connected. The larger the value is, the more likely the nth target weak edge is to be the edge on the OSB processing contour. When it is larger, it often means that the nth target weak edge is more likely to be an edge on the OSB processing contour that needs to be connected, and it often means that the mth strong contour edge should be connected to its adjacent nth target weak edge.
[0121] Step S7, according to the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected to obtain a target edge contour set.
[0122] In some embodiments, the strong contour edges and the target weak edges may be adaptively connected according to the target connection probability between all the strong contour edges and all the adjacent target weak edges to obtain a target edge contour set.
[0123] It should be noted that based on the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected. The target edge contours in the obtained target edge contour set are often the edge contours on the processing contour of the OSB, thereby realizing the extraction of the processing contour of the OSB.
[0124] As an example, this step may include the following steps:
[0125] In the first step, a target weak edge whose target connection probability is greater than a preset connection threshold is selected from all target weak edges adjacent to the strong contour edge as an edge to be connected, and a set of edges to be connected corresponding to the strong contour edge is obtained.
[0126] The preset connection threshold may be a preset threshold, for example, 0.6. The set of edges to be connected corresponding to the strong contour edge may include: all target weak edges adjacent to the strong contour edge whose target connection probability is greater than the preset connection threshold.
[0127] In the second step, the strong contour edge is connected to all the edges to be connected in its corresponding set of edges to be connected, so as to obtain the target edge contour corresponding to the strong contour edge.
[0128] The method of connecting the strong contour edge and the edge to be connected may be: connecting the strong contour edge and two pixel points on the edge to be connected that are closest to each other.
[0129] In the third step, all the obtained target edge contours are combined into a target edge contour set.
[0130] In summary, compared to directly using the Canny edge detection algorithm to extract the processing contour of the OSB image, the present invention comprehensively considers multiple features related to the processing contour of the OSB, such as the curvature change index, the edge distribution difference index and the target contour index, etc., which can improve the probability that the extracted strong contour edge is the upper edge of the OSB processing contour to a certain extent. In addition, the present invention comprehensively considers the connection features related to the strong and weak edges, such as the angle between the two and the target contour index corresponding to the target weak edge, and adaptively connects the strong contour edge and the target weak edge, which can reduce the interference of information such as internal texture and burrs to a certain extent, thereby improving the accuracy of the processing contour extraction of the OSB image.
[0131] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. 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 protection scope of the present invention.
Claims
1. A method for extracting the contour of OSB board processing based on image feature extraction, characterized in that: The following steps are involved: Acquire a target OSB image, perform edge detection on the target OSB image, determine each strong edge and each weak edge detected as an initial edge, and obtain an initial edge set; Performing curvature change analysis processing on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge; Perform edge distribution difference analysis on the areas on both sides of each initial edge to obtain edge distribution difference index corresponding to each initial edge; Determine the target contour index corresponding to each initial edge according to the curvature change index and edge distribution difference index corresponding to each initial edge; According to the target contour index, strong contour edges are screened out from the initial edge set, and initial edges other than the strong contour edges in the initial edge set are determined as target weak edges; Determine the target connection probability between each strong contour edge and each adjacent target weak edge according to the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge; According to the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected to obtain a target edge contour set; The performing curvature change analysis processing on each initial edge in the initial edge set to obtain a curvature change index corresponding to each initial edge includes: Record any pixel point on the initial edge as a marked pixel point, select a preset number of pixel points closest to the marked pixel point from the initial edge as reference pixels, and obtain a preset number of reference pixels; Performing curve fitting according to the positions corresponding to the marked pixel point and a preset number of reference pixel points to obtain a fitting curve corresponding to the marked pixel point; Determine the curvature of the marked pixel point on the corresponding fitting curve as the target curvature corresponding to the marked pixel point; Determining a curvature change index corresponding to the initial edge according to target curvatures corresponding to all pixel points on the initial edge; The formula corresponding to the target contour index corresponding to the initial edge is: ;in, is the target contour index corresponding to the kth initial edge in the initial edge set; k is the sequence number of the initial edge in the initial edge set; is the length corresponding to the kth initial edge in the initial edge set; It is the mean of the gradient values corresponding to all pixels on the kth initial edge in the initial edge set; It is an exponential function with a natural constant as base; It is the curvature change index corresponding to the kth initial edge in the initial edge set; is the hyperbolic tangent function; is the absolute value function; is the edge disorder degree corresponding to the first sub-region in the reference region corresponding to the kth initial edge in the initial edge set; is the edge disorder degree corresponding to the second sub-region in the reference region corresponding to the kth initial edge in the initial edge set; is the minimum value function; is the edge distribution difference index corresponding to the kth initial edge in the initial edge set; is a pre-set factor greater than 0; The method of determining the target connection probability between each strong contour edge and each adjacent target weak edge according to the angle between each strong contour edge and each adjacent target weak edge, and the target contour index corresponding to the target weak edge, comprises: Any target weak edge adjacent to the strong contour edge is recorded as a reference edge, and the target connection probability between the strong contour edge and the reference edge is determined according to the angle between the strong contour edge and the reference edge, the mean of the target curvature corresponding to all pixels on the strong contour edge, the mean of the target curvature corresponding to all pixels on the reference edge, the curvature change index corresponding to the reference edge, and the target contour index; The formula corresponding to the target connection probability between a strong contour edge and its adjacent target weak edge is: ;in, is the target connection probability between the mth strong contour edge and its adjacent nth target weak edge; m is the sequence number of the strong contour edge; n is the sequence number of the target weak edge adjacent to the mth strong contour edge; is the cosine function; is the angle between the mth strong contour edge and its adjacent nth target weak edge; It is an exponential function with a natural constant as base; is the curvature change index corresponding to the nth target weak edge adjacent to the mth strong contour edge; It is the absolute value function; is the mean of the target curvature corresponding to all pixels on the mth strong contour edge; is the mean of the target curvatures corresponding to all pixels on the nth target weak edge adjacent to the mth strong contour edge; is the target contour index corresponding to the nth target weak edge adjacent to the mth strong contour edge.
2. The method for extracting OSB processing contour based on image feature extraction according to claim 1, characterized in that: The step of determining the curvature change index corresponding to the initial edge according to the target curvature corresponding to all the pixels on the initial edge includes: The variance of the target curvature corresponding to all the pixels on the initial edge is determined as the curvature change index corresponding to the initial edge.
3. The method for extracting OSB processing contour based on image feature extraction according to claim 1, characterized in that: The edge distribution difference analysis process is performed on the areas on both sides of each initial edge to obtain the edge distribution difference index corresponding to each initial edge, including: Any initial edge is recorded as a marked edge, and the marked edge is expanded to obtain a connected region, and the connected region corresponds to the region in the target OSB image and is determined as a candidate region corresponding to the marked edge; Determine an area in the candidate area except the marked edge as a reference area corresponding to the marked edge; Using the marked edge as a dividing line, dividing the reference area into two sub-areas; According to the length and curvature change indexes corresponding to the initial edge in each sub-region, the edge disorder degree corresponding to each sub-region is determined; The edge distribution difference index corresponding to the marked edge is determined according to the absolute value of the difference between the edge chaos degrees corresponding to the two sub-regions, wherein the absolute value of the difference between the edge chaos degrees corresponding to the two sub-regions is positively correlated with the edge distribution difference index.
4. The method for extracting OSB processing contour based on image feature extraction according to claim 3 is characterized in that: The formula corresponding to the edge chaos degree of the sub-region is: ; Where H is the edge disorder degree corresponding to the sub-region; is a logarithmic function with a as the base; a is a preset value greater than 1; S is the area of the sub-region; N is the number of initial edges in the sub-region; b is the sequence number of the initial edge in the sub-region; is the length corresponding to the bth initial edge in the sub-region; It is the curvature change index corresponding to the bth initial edge in the sub-region.
5. The method for extracting OSB processing contour based on image feature extraction according to claim 1, characterized in that: The step of selecting strong contour edges from the initial edge set according to the target contour index includes: Initial edges whose target contour index is greater than a preset contour threshold are screened out from the initial edge set as strong contour edges.
6. The method for extracting OSB processing contour based on image feature extraction according to claim 1, characterized in that: According to the target connection probability between all strong contour edges and all adjacent target weak edges, the strong contour edges and the target weak edges are adaptively connected to obtain a target edge contour set, including: Filter out target weak edges whose target connection probability is greater than a preset connection threshold from all target weak edges adjacent to the strong contour edge as edges to be connected, and obtain a set of edges to be connected corresponding to the strong contour edge; Connect the strong contour edge and all the edges to be connected in its corresponding set of edges to be connected to obtain the target edge contour corresponding to the strong contour edge; All the obtained target edge contours are combined into a target edge contour set.
