A method for knitted label edge profile extraction and optimization
By identifying grayscale abrupt changes and edge interruption features, the broken areas are accurately located and the path connection structure is reconstructed, solving the problem of inaccurate edge recognition in existing technologies and achieving efficient extraction and stable reconstruction of label edge contours.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 泉州职业技术大学
- Filing Date
- 2026-01-06
- Publication Date
- 2026-04-14
Smart Images

Figure CN121458748B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of contour extraction technology, and in particular to a method for extracting and optimizing the edge contour of knitted labels. Background Technology
[0002] The field of contour extraction technology involves the identification and localization of target edges or boundaries in images. It mainly includes core aspects such as image preprocessing, edge detection, contour tracking, and shape segmentation. The overall method is based on image grayscale changes, gradient direction analysis, and pixel adjacency calculation. By extracting significant feature differences between the target and the background in the image, it achieves automatic identification and structural modeling of the target object contour in the image. Among them, the traditional knitted label edge contour extraction and optimization method refers to the edge recognition requirement of the image of the label attached to the knitted fabric. It extracts the boundary lines between the label and the background in the image by combining the image gradient calculation method based on edge operators with threshold setting, and uses polygon fitting method or Bézier curve smoothing algorithm to reconstruct curves and optimize the edges of the initially extracted contour point set.
[0003] Existing technologies for edge extraction in knitted label image processing rely on image gradient calculations and threshold settings using edge operators. However, due to their sensitivity to grayscale changes and background complexity, they often fail to effectively distinguish between real breakpoints and image noise at edge structure interruptions, leading to interrupted or incorrect edge recognition. Polygon fitting and curve smoothing methods lack directional trend analysis capabilities when dealing with jagged or nonlinear boundaries, failing to accurately connect structurally missing areas and causing deviations in the connection path. In areas with strong interference from indentations or printing noise, existing methods lack mechanisms for judging the spatial correlation and directional continuity of edge endpoints, making it difficult to complete the full reconstruction of the boundary structure. For example, in images with printed layer burrs, the boundary path fluctuates frequently, and existing smoothing methods easily misjudge real edge details as noise and remove them, causing distorted boundary extraction. Furthermore, existing methods do not structurally coordinate the fusion relationship between boundary segments and the overall contour, easily causing path breaks or overlaps at label boundary connection areas, further reducing the overall coherence of contour modeling and the realism of the edge structure. Summary of the Invention
[0004] To address the technical problems existing in the prior art, embodiments of the present invention provide a method for extracting and optimizing the edge contour of knitted labels, comprising the following steps:
[0005] S1: Extract the gray-level change trend of the image edge region, determine whether the edge continuity feature is interrupted, identify the location of abrupt changes in edge gradient value, extract the edge distribution location, and obtain the coordinate set of the broken area;
[0006] S2: Extract the edge trajectory associated with the concentrated breakpoints of the fracture area coordinates, analyze the stability of the direction and angle of the label edge jagged edge point column, match the consistency of the direction change structure, extract the path direction that conforms to the trend, and generate the boundary connection guide path;
[0007] S3: Based on the boundary connection guide path, analyze the unconnected edge endpoints around the label bonding indentation interference area, determine the spatial correlation and direction fitting degree, reconstruct the path connection structure, determine the structural continuity change, and output a group of closable boundary paths.
[0008] S4: Perform polar distribution transformation on the path of the rough edge area of the label printing layer in the closed boundary path group, identify the trend of change in direction and length, judge the stability of the path segment, filter out the path sequence that does not meet the continuity judgment range, and form a set of structural closed segments.
[0009] S5: Based on the positional relationship between the boundary segments of the closed segment set and the overall edge chain, establish a set of control nodes near the boundary connection, coordinate the relationship between the path extension direction and the trend at the boundary connection, adjust and merge the boundary structure, and generate the label edge contour structure.
[0010] As a further embodiment of the present invention, the set of coordinates of the fractured region includes the location of the edge continuity interruption, the abrupt gradient segment, and the edge distribution coordinates; the boundary connection guidance path includes the direction change trend path, the structural consistency matching path, and the edge trajectory guidance path; the set of closable boundary paths includes the connection path, the reconstruction path, and the direction fitting path; the set of structural closure segments includes the direction stability path, the length change path, and the continuity conformance path; and the label edge contour structure includes the boundary segment, the overall edge chain, and the set of control nodes.
[0011] As a further aspect of the present invention, the specific steps of S1 are as follows:
[0012] S101: Based on the edge region of the image in the reflective block of the weft-knitted fabric, extract the gray-level difference sequence between adjacent pixels in the image gray-level matrix, call the continuous numerical segments of the sequence in the same row direction, and filter the gray-level change segments with continuous direction and no reversal according to the fluctuation trend of gray-level difference to generate a set of gray-level trend continuous segment values.
[0013] S102: Based on the set of continuous grayscale trend segments, determine the variation range of adjacent grayscale differences in the segments, and by calculating the variation range value, filter out abrupt change locations that exceed the edge continuity benchmark value, establish the gradient range corresponding to the grayscale jump, and obtain the abrupt change gradient interval sequence.
[0014] S103: Call the mutation index position in the mutation gradient interval sequence to locate the pixel coordinate set in the edge region of the original image. Combine the interruption start and end information in the continuous gray-scale change to filter the region segment where the coordinate change trend is interrupted and obtain the coordinate set of the broken region.
[0015] As a further aspect of the present invention, the specific steps of S2 are as follows:
[0016] S201: Based on the edge trajectory associated with the interruption point in the coordinate set of the fractured region, extract the sequence of adjacent pixels in the corresponding direction from the jagged edge point column of the label weave, identify the trend of the arrangement direction change of the points in the coordinate sequence, filter the path segments with continuous direction without reversal, and generate a sequence of direction change trends.
[0017] S202: Call the direction change trend sequence to determine whether the rate of change of direction angle in the path segment is within the direction stability benchmark range. Combine the direction change situation in the coordinate set of the fracture area to filter the path segments with matching direction features and obtain the structurally consistent path segment list.
[0018] S203: Based on the coordinate arrangement order in the structural consistency path segment column, identify the directional vector change characteristics between adjacent path segments, and based on the boundary continuity benchmark value, filter the set of directional paths that meet the connection conditions to obtain the boundary connection guide path.
[0019] As a further aspect of the present invention, the specific steps of S3 are as follows:
[0020] S301: Based on the trend direction of the boundary connection guide path, extract the distance and angle deviation values between the spatial coordinates and the path trend of the edge endpoints that are not involved in the connection in the surrounding area of the label bonding indentation interference area. Based on whether the direction difference falls within the direction association benchmark range, filter the edge endpoint groups with association and generate the direction fitting association degree.
[0021] S302: Call the aforementioned direction fitting correlation degree, and determine whether a continuous coordinate sequence can be formed within the path trend range based on the distance interval and angle distribution between the points in the correlation edge endpoint group. Rearrange the edge point order according to the continuous matching result to obtain the path reconstruction coordinate sequence.
[0022] S303: Based on the trend of change in the connection direction between path segments in the reconstructed coordinate sequence, calculate the magnitude of change in the direction vector between adjacent segments, determine whether it is within the structural continuity threshold range, filter the set of paths with continuous change characteristics, and obtain the path group with closable boundary.
[0023] As a further aspect of the present invention, the specific steps of S4 are as follows:
[0024] S401: Based on the boundary path located in the rough edge area of the label printing layer in the group of closable boundary paths, extract the spatial coordinate values of the path segment, the polar angle value of the center point, and the radius length value, construct the direction sequence and the length sequence, and generate the polar parameter change sequence.
[0025] S402: Call the polar parameter change sequence, calculate the path fluctuation degree value based on the adjacent angle difference of the path segment in the direction sequence and the adjacent length fluctuation value in the length sequence, and judge it with the set fluctuation threshold range to obtain the path segment fluctuation degree;
[0026] S403: Based on the fluctuation degree of the path segment, filter out path segments whose fluctuation degree value exceeds the threshold range for determining structural continuity, extract the set of sequences with directional continuity and length consistency from the remaining path segments, and establish a set of structural closed segments.
[0027] As a further aspect of the present invention, the specific steps of S5 are as follows:
[0028] S501: Based on the positional relationship between the boundary segments and the overall edge chain of the structural closed segment set, obtain the node coordinates of the boundary segments, the sequence of points constituting the edge chain and the boundary direction vector, calculate the positional distance and direction angle difference between the boundary segment nodes and the edge chain, construct the boundary connection identification set of the structural closed segment, and obtain the position offset rate of the local boundary connection.
[0029] S502: Based on the position offset rate at the local boundary connection, extract the topological relationship and direction continuity coefficient of the boundary points of the neighboring grid cells around the identification point at the boundary connection, calculate the trend angle difference between the path extension direction and the direction at the boundary connection, establish a set of control nodes in combination with the continuity coefficient, and obtain the position adjustment weight of the control nodes.
[0030] S503: Adjust the position coordinates of the control nodes in the boundary structure according to the position adjustment weight of the control nodes, and modify the connection structure of the overall boundary path by combining the original boundary connection relationship of the nodes and the boundary order of the structural closed segment, and generate the label edge contour structure.
[0031] As a further aspect of the present invention, the grayscale change trend is a grayscale change sequence formed by the spatial adjacency of pixel grayscale value sequences arranged along the edge direction of the knitted label, and the grayscale change sequence is obtained by the continuous arrangement of the grayscale value differences of adjacent pixels;
[0032] The edge continuity feature is the continuous point sequence state formed by the edge points of the knitted label in the image coordinate system according to the adjacent relationship. The continuous point sequence state is determined by the adjacency relationship between the edge points under the spatial connectivity relationship.
[0033] The coordinate set of the fracture region is a set of coordinates composed of edge pixel coordinates within the edge interruption segment corresponding to the abrupt gradient range. The coordinate set is composed of row and column coordinate pairs in the image coordinate system and is extracted from the edge points.
[0034] As a further embodiment of the present invention, the jagged edge point sequence of the label selvage is a non-linear edge point sequence formed in the image by the selvage area of the knitted label, and the non-linear edge point sequence is represented by the edge undulations caused by the selvage yarn structure in the edge point coordinate sequence.
[0035] The angular stability is a process for evaluating the change in the direction of the line connecting adjacent edge points on the edge trajectory. The change is determined by the sequence of direction angles corresponding to the direction vector formed by the adjacent edge points.
[0036] The structural consistency is a process of determining the correspondence between the edge direction at the breakpoint and the trajectory direction of the adjacent edge on the direction angle sequence. The correspondence is determined by the directional difference between the direction vector of the breakpoint connection line and the direction vector of the adjacent edge.
[0037] The boundary connection guide path is a connection path expression determined by the positions of the breakpoints at both ends of the fracture region and the trajectory direction of the edge adjacent to the breakpoints. The connection path expression is established by the combination relationship between the breakpoint coordinates and the edge trajectory direction vector.
[0038] The label bonding indentation interference area is the texture change area of the indentation generated during the bonding process of the knitted label in the image. The texture change area is formed by the local gray-scale distribution and the change of edge texture direction and is determined by the image texture distribution.
[0039] The spatial association is a process of determining the spatial positional relationship between the edge endpoints and the boundary connection guide path in the image coordinate system. The spatial positional relationship is determined by the distance relationship between the endpoint coordinates and the corresponding position coordinates on the guide path.
[0040] The direction fit is a measure that characterizes the degree of consistency between the edge endpoint direction and the boundary connection guide path direction on the direction angle sequence. The degree of consistency is determined by the direction difference between the endpoint direction vector and the guide path direction vector.
[0041] As a further aspect of the present invention, the polar distribution transformation is a process of converting the coordinate representation of the boundary path points in the planar coordinate system into the angular and radial distance representation of the reference center point, wherein the reference center point is determined by the geometric center of the coordinates of the closed path boundary points.
[0042] The continuity determination range is a determination criterion that limits the range of changes in the direction and length of the boundary path. The determination criterion is formed by the direction change sequence and length change sequence of the path point sequence and is used to eliminate path sequences that do not meet the continuity requirement.
[0043] The control node set is a set of node points set near the boundary connection of the boundary segment for contour fusion adjustment. The node point set is formed by selecting the coordinates of the endpoint of the boundary segment and the edge points adjacent to the endpoint.
[0044] The label edge contour structure is a closed or quasi-closed boundary shape of the knitted label edge represented by a continuous sequence of edge points in the image coordinate system. The boundary shape is formed by the fusion of a set of structural closed segments and the overall edge chain under the constraints of a set of control nodes.
[0045] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0046] In this invention, by identifying grayscale abrupt changes and edge interruption features in the image, the fracture area is accurately located, enhancing the recognition of structural integrity. Spatial correlation and direction fitting are performed on the edge endpoints in the interference area to improve the boundary recovery ability and closure. Abnormal path segments are screened out through polar distribution to suppress the influence of burrs and ensure geometric stability. Control nodes are established based on the positional relationship between boundary segments and the overall chain, and the trend coordination structure at the boundary connection is integrated to improve the contour consistency and robustness in complex backgrounds, and enhance the coherent recognition ability and extraction accuracy. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a schematic diagram of the steps of the present invention;
[0049] Figure 2 This is a detailed schematic diagram of S1 of the present invention;
[0050] Figure 3 This is a detailed schematic diagram of S2 of the present invention;
[0051] Figure 4 This is a detailed schematic diagram of S3 of the present invention;
[0052] Figure 5 This is a detailed schematic diagram of S4 of the present invention;
[0053] Figure 6This is a detailed schematic diagram of S5 of the present invention. Detailed Implementation
[0054] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0055] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0056] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.
[0057] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0058] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0059] Please see Figure 1 This invention provides a method for extracting and optimizing the edge contour of knitted labels, comprising the following steps:
[0060] S1: Based on the edge region of the image in the reflective area of the weft-knitted fabric, the gray-level change trend is extracted to determine whether the edge continuity feature is interrupted, the location segment where the edge gradient value changes abruptly, and the corresponding edge distribution position is extracted as the judgment basis. For the interference area caused by the bonding indentation in the image, the location range is extracted by combining the gray-level change and texture difference features. For the rough edge area formed by the printing process in the image, the high-frequency directional fluctuation and local gray-level disturbance features on the boundary path are detected to identify and mark it as the rough edge area of the label printing layer, and the coordinate set of the broken area is obtained.
[0061] The reflective area of the weft-knitted fabric is a concentrated area of brightness formed by the reflection of the yarn surface of the weft-knitted fabric in the image of the knitted label. The concentrated area of brightness is formed by the continuous spatial distribution of the gray values of the image and can be determined by the continuous pixel area in the grayscale image.
[0062] The grayscale change trend is a grayscale change sequence formed by the sequence of pixel grayscale values arranged along the edge direction of the knitted label under the spatial adjacency relationship. The grayscale change sequence is obtained by the continuous arrangement of the grayscale value differences of adjacent pixels.
[0063] Edge continuity features are the continuous point sequence states formed by the edge points of the knitted label in the image coordinate system according to their adjacent relationships. The continuous point sequence state is determined by the adjacency relationship between the edge points under the spatial connectivity relationship.
[0064] The abrupt gradient range is the pixel interval in the edge point column of the knitted label where the gradient magnitude sequence shows a continuous jump. The pixel interval is determined by the adjacent difference sequence of the gradient values corresponding to the edge pixels.
[0065] The fracture region coordinate set is a set of coordinates composed of edge pixel coordinates within the edge interruption segment corresponding to the abrupt gradient range. The coordinate set is composed of row and column coordinate pairs in the image coordinate system and is extracted from the edge points.
[0066] S2: Based on the edge trajectory associated with the concentrated breakpoints of the fracture area coordinates, extract the adjacent point sequence from the jagged edge point list of the label weave, perform angular stability analysis on the directional change trend of the continuous trajectory, perform structural consistency matching in combination with the directional change of the breakpoints, extract the path direction that conforms to the trend, and generate the boundary connection guide path.
[0067] The jagged edge point sequence of the label selvage is a non-linear edge point sequence formed by the selvage area of the knitted label in the image. The non-linear edge point sequence is represented by the edge undulations caused by the selvage yarn structure in the edge point coordinate sequence.
[0068] Angular stability analysis is a process of evaluating the change in the direction of the line connecting adjacent edge points on the edge trajectory. The change is determined by the sequence of direction angles corresponding to the direction vector formed by the adjacent edge points.
[0069] Structural consistency matching is a process of determining the correspondence between the edge direction at the breakpoint and the trajectory direction of the adjacent edge on the direction angle sequence. The correspondence is determined by the directional difference between the direction vector of the breakpoint connection line and the direction vector of the adjacent edge.
[0070] The boundary connection guide path is a connection path expression determined by the positions of the breakpoints at both ends of the fracture region and the trajectory direction of the edge adjacent to the breakpoint. The connection path expression is established by the combination relationship between the breakpoint coordinates and the edge trajectory direction vector.
[0071] S3: Based on the trend direction of the boundary connection guide path, perform spatial correlation analysis and direction fitting degree judgment on the edge endpoints that are not involved in the connection in the surrounding area of the label bonding indentation interference area, perform path reconstruction processing on the matching results, and judge the changing trend of the connection path structure continuity, and output a group of closable boundary paths.
[0072] The label bonding indentation interference area is the texture change area of the indentation generated during the bonding process of the knitted label in the image. The texture change area is formed by the local gray-scale distribution and the change of edge texture direction and is determined by the image texture distribution.
[0073] Spatial correlation analysis is a process of determining the spatial positional relationship between edge endpoints and boundary connection guide paths in the image coordinate system. The spatial positional relationship is determined by the distance relationship between the endpoint coordinates and the corresponding position coordinates on the guide path.
[0074] Directional fit is a measure that characterizes the degree of consistency between the edge endpoint direction and the boundary connection guide path direction on the direction angle sequence. The degree of consistency is determined by the directional difference between the endpoint direction vector and the guide path direction vector.
[0075] S4: In the group of closable boundary paths, for the boundary paths within the rough edge area of the label printing layer, perform polar distribution transformation processing, identify the path fluctuation degree based on the direction and length change trend, make stability judgment on the path segments, filter out path sequences that exceed the continuity judgment range, and form a set of structural closed segments.
[0076] The polar distribution transformation process is a process of converting the coordinate representation of the boundary path points in the planar coordinate system into the angular and radial distance representation of the reference center point, wherein the reference center point is determined by the geometric center of the coordinates of the closed path boundary points;
[0077] The continuity determination range is a determination criterion that limits the range of changes in the direction and length of the boundary path. The determination criterion is formed by the direction change sequence and length change sequence of the path point sequence and is used to eliminate path sequences that do not meet the continuity requirement.
[0078] The rough edge area of the label printing layer refers to the irregular boundary area formed by the knitted label layer during the printing process. In the image, it appears as a high-frequency disturbance area with rapid changes in path direction or jagged contours. The area is identified and extracted by the boundary path angle change rate and gray-level gradient distribution features.
[0079] S5: Based on the positional relationship between the concentrated boundary segments of the structural closed segments and the overall edge chain, a set of control nodes is established at the location of the adjacent boundary connection. The relationship between the path extension direction and the trend at the boundary connection is coordinated and processed to adjust and merge the overall boundary structure and generate the label edge contour structure.
[0080] The control node set is a set of node points set near the boundary connection of the boundary segment for contour fusion adjustment. The node point set is formed by selecting the coordinates of the endpoint of the boundary segment and the edge points adjacent to the endpoint.
[0081] The label edge contour structure is the closed or quasi-closed boundary shape of the knitted label edge in the image coordinate system, represented by a continuous sequence of edge points. The boundary shape is formed by the fusion of the set of structural closed segments and the overall edge chain under the constraints of the set of control nodes.
[0082] The set of coordinates for the fractured region includes the location of the edge continuity interruption, the abrupt gradient segment, and the edge distribution coordinates. The boundary connection guidance path includes the direction change trend path, the structural consistency matching path, and the edge trajectory guidance path. The set of closable boundary paths includes the connection path, the reconstruction path, and the direction fitting path. The set of structural closure segments includes the direction stability path, the length change path, and the continuity matching path. The label edge contour structure includes the boundary segment, the overall edge chain, and the set of control nodes.
[0083] Please see Figure 2 The specific steps of S1 are as follows:
[0084] S101: Based on the edge region of the image in the reflective block of the weft-knitted fabric, extract the gray-level difference sequence between adjacent pixels in the image gray-level matrix, call the continuous numerical segments of the sequence in the same row direction, and filter the gray-level change segments with continuous direction and no reversal according to the fluctuation trend of gray-level difference to generate a set of gray-level trend continuous segment values.
[0085] From the image of the weft-knitted fabric, the edge regions within the reflective blocks are located. Edge detection methods such as Canny or Sobel are applied to extract pixel coordinates. When the image size is 512×512 pixels, the extracted edge pixels are concentrated in areas of significant texture change. Adjacent pixels to each pixel are selected at these edge coordinates, and the grayscale value changes are recorded sequentially along the row direction, forming a series of grayscale differences. If the grayscale value of a point is 130 and the grayscale value of its right-hand pixel is 135, the difference is 5. Continuous sampling generates a difference sequence such as 5, 6, 6, 5, etc. Continuous value segments, i.e., adjacent differences that are not consecutive, are extracted from this sequence. The parts that change drastically and in the same direction, such as the consecutive 5, 6, 6, 7 in a sequence, constitute an upward trend segment. If the 4 appears later, it indicates a reversal of direction, so recording stops, and the values outside this segment are removed, retaining only the gray-level difference segments that fluctuate in one direction. In this way, multiple continuous gray-level trend segments are extracted from the overall sequence. The length of each segment is between 3 and 10 pixels. The length range is adjusted according to the actual texture complexity of the image. By comparing with the actual weft-knitted fabric image, there are areas with inconsistent reflection intensity. In this way, segments with stable gray-level changes can be effectively extracted, forming multiple data blocks with continuous gray-level trends.
[0086] S102: Based on the value set of continuous grayscale trend segments, determine the change range of adjacent grayscale differences in the segments, and by calculating the change range value, filter out abrupt change locations that exceed the edge continuity benchmark value, establish the gradient range corresponding to grayscale jumps, and obtain the abrupt change gradient interval sequence.
[0087] In a continuous grayscale trend segment, the degree of change of adjacent grayscale differences is compared sequentially, that is, the increase or decrease between two consecutive differences. When the change in the change at certain positions in the continuous segment increases abnormally, that is, the change in the difference exceeds the benchmark value, the position is regarded as a mutation point. The benchmark value is set according to sample statistics. If the average change in the change in 10 stable segments is 1.5, multiplying it by a magnification factor of 1.2 to get 1.8 as the benchmark, then any change in the change between any two consecutive differences in a segment that exceeds 1.8 can be marked as a mutation. In actual data, if a continuous segment... The continuation segment contains differences of 5, 6, 6, and 9. The change from 6 to 9 is 3, which is greater than 1.8, indicating a mutation. The index position of this mutation point is recorded as the mutation start position. Combined with the stable range of the preceding and following segments, such as the small fluctuation from position 18 to 21 and the mutation at position 22, the mutation interval is determined to be from position 18 to 22, which is marked as a mutation gradient interval. Such intervals are screened out in sequence to form a set of mutation gradient intervals. Each interval corresponds to a gray-scale mutation area in the image. Areas with changes in fabric structure or large differences in reflection will be included in this set.
[0088] S103: Call the mutation index position in the mutation gradient interval sequence to locate the pixel coordinate set in the edge region of the original image. Combine the interruption start and end information in the continuous gray-level change to filter the region segment where the coordinate change trend is interrupted and obtain the coordinate set of the broken region.
[0089] By using the index positions of each segment in the set of abrupt gradient intervals, the row and column coordinates of the segment in the original image's grayscale matrix are found. The column coordinate range corresponding to each abrupt segment is located based on the number of columns in the image. Then, the interruption point is found from the grayscale trend. For example, a point where the grayscale value suddenly drops to zero or fluctuates drastically after a stable increase is considered the start or end point of the interruption. For example, if a set of grayscale differences is 6, 6, 6, 20, and the last change is significantly higher than the previous value, then point 4 is the abrupt point with a directional interruption. Its column coordinate is located as column 24 of the image. If it is in row 300, then the pixel coordinate is (24, 300). All similar positions are included in the set of fracture area coordinates. Combined with the start and end points of each abrupt interruption, it is confirmed whether the segment constitutes a complete fracture block. Only when there is a continuous fracture trend around the abrupt point is it considered a valid fracture segment. Multiple fracture area coordinate points are located in the entire image. Each coordinate point corresponds to an actual area of grayscale fluctuation interruption. This method is suitable for analyzing the structural discontinuity phenomenon exhibited by weft-knitted fabrics in the captured image.
[0090] Please see Figure 3 The specific steps of S2 are as follows:
[0091] S201: Based on the edge trajectory associated with the interruption point in the coordinate set of the fracture area, extract the sequence of adjacent pixels in the corresponding direction from the jagged edge point column of the label weave, identify the trend of the change of the arrangement direction of the points in the coordinate sequence, filter the path segments with continuous direction without reversal, and generate the sequence of direction change trend.
[0092] First, locate the set of edge points corresponding to the breakpoints in the original image. Each edge point is located within the jagged edge region. Using row and column coordinates as starting points, extract the sequence of adjacent pixels in their corresponding directions. The direction is determined by dividing the coordinate change direction from the current pixel to its neighboring pixels into eight neighborhood directions, such as horizontal, vertical, or diagonal. By reading the arrangement direction change trend of adjacent pixels in the jagged edge lines point by point, record the direction change between every two adjacent points. The direction change is represented by the angle θ, which can be calculated using the arctangent function. For example, if the difference in the x-direction between two points is 1 and the difference in the y-direction is 1, then θ is approximately 45°. By continuously reading, a direction angle sequence is formed. For example, if the θ sequence is 0°, 45°, 45°, 90°, it indicates a gradual shift in direction. Then, analyze this sequence. The system checks for reversal trends within a sequence, where the directional angle changes from rising to falling or vice versa. For example, in an angle sequence of 0°, 45°, 90°, and 60°, the angle from 90° to 60° is a reversal. Such sequences are discarded, and only path segments with monotonically changing or constant directional angles are retained. This generates a sequence of directional trend segments that do not contain reversals. The direction of angle change remains consistent within each segment. Specifically, if the θ sequence of a jagged edge segment in an image is 30°, 30°, 32°, and 35°, then the entire segment meets the directional consistency condition and is considered a valid path segment. If the angle change trend is 30°, 45°, and 20°, then it contains reversals and does not meet the filtering criteria. This processing method is particularly suitable for detecting the directional extension continuity of label edges, thereby extracting regularly arranged path segments.
[0093] S202: Call the direction change trend sequence to determine whether the rate of change of direction angle in the path segment is within the direction stability benchmark range. Combine the direction change situation in the coordinate set of the fracture area to filter the path segments with matching direction features and obtain the structurally consistent path segment list.
[0094] After calling the direction change trend sequence, it is necessary to determine whether the rate of change of the direction angle of each path segment meets the stability benchmark range. First, calculate the rate of change Δθ / Δs between adjacent angles based on the direction angle sequence, where Δθ is the difference between adjacent angles and Δs is the corresponding pixel distance. If the θ changes sequentially to 30°, 32°, 34°, and 36° in a continuous path, the rate of change is 2° / pixel. Set the direction stability benchmark value β to 3° / pixel. If all rates of change are less than this value, the path direction is considered stable. The benchmark value β can be set by averaging the θ change rates extracted from multi-organization edge path samples and then multiplying by a coefficient γ. If the average rate of change in 10 samples is 2.5° / pixel, and γ is 1.2, then β = 3° / pixel. If the θ sequence of a certain path segment... The columns are 45°, 50°, 60°, and 75°, with a change rate of 5°, 10°, and 15° / pixel, respectively. If the change rate exceeds the set benchmark, the path is considered unstable and is removed. Then, all stable path segments are compared with the directional features in the coordinate set of the fracture area to determine whether their directional angles are close to the directional vector of the fracture area. If the fracture area direction is 45°, the angle of the matching path segment must be between 40° and 50°. This range is the feature matching tolerance δ, which is set to ±5°. Path segments that meet the conditions are classified into the structural consistency path segment column. For example, the edge path extending from the fracture point to the upper right at a 45° direction has continuous angles of 43°, 44°, 45°, and 46°, which are within the structural consistency range. Multiple path segments that match the fracture area direction are generated as the basis for determining the boundary connection.
[0095] S203: Based on the coordinate arrangement order in the structural consistency path segment column, identify the directional vector change characteristics between adjacent path segments, and based on the boundary continuity benchmark value, filter the set of directional paths that meet the connection conditions to obtain the boundary connection guide path;
[0096] Based on the coordinate arrangement order of each path in the structural consistency path segment list, the change in direction vector between every two adjacent path segments is calculated. The direction vector of each path segment is defined as the coordinate difference between the start and end points. For example, path segment P1 starts at (100, 200) and ends at (110, 210), with a vector of (10, 10). P2 starts at (110, 210) and ends at (120, 212), with a vector of (10, 2). The included angle can be calculated using the formula cosθ=(V1·V2) / (‖V1‖×‖V2‖). This angle is then converted to a degree of change to judge its extent. If the included angle is less than the boundary continuity reference value α, the path is considered connectable. The reference value α is generally set to... The angle is set between 10° and 15°, based on the actual texture complexity of the image and the accuracy requirements for directional consistency. α is set to 12°. If the angle between two segments is 8°, the connection condition is met; if the angle is 20°, it is not. Path segments with angles less than the baseline value are selected and further combined to form a set of paths that can be coherently spliced. The paths in this set are sequentially connected to form continuous guiding paths for boundary connectivity analysis. In practical applications, for example, a jagged edge path is composed of multiple short segments spliced together. When restoring the path after identifying the break, it is necessary to determine whether these short segments can be spliced together based on directional stability and smooth connectivity to obtain a set of continuous boundary connection guiding path clues for subsequent structural repair or path reconstruction.
[0097] Please see Figure 4 The specific steps of S3 are as follows:
[0098] S301: Based on the trend direction of the boundary connection guide path, extract the distance and angle deviation values between the spatial coordinates and the path trend of the edge endpoints that are not involved in the connection in the surrounding area of the label bonding indentation interference area. Based on whether the direction difference falls within the direction correlation benchmark range, filter the edge endpoint groups with correlation and generate the direction fitting correlation degree.
[0099] Based on the trend direction of the boundary connection guide path, identify the edge endpoints that are not involved in the connection in the area surrounding the indentation interference patch. Extract the spatial coordinates of each endpoint one by one and compare them with the trend direction of the path. By calculating the spatial straight-line distance between each endpoint and the nearest position on the path and the angle between their directions, determine whether there is a potential connection relationship between the endpoint in terms of direction and position. The direction difference is measured by the angle, and the position deviation is expressed as pixel distance. When the direction difference is within a set reference range, such as within 20 degrees, and the distance is within a specified threshold, such as within 30 pixels, the endpoint is considered to have a possible directional correlation with the path. If multiple endpoints meet the conditions, each endpoint is further assigned a directional fitting correlation. The degree score is calculated by weighting two factors: the degree of directional difference and the spatial distance deviation. The weight ratio can be set to 60% for direction and 40% for distance. For example, if the directional difference of an endpoint is 10 degrees and the distance is 15 pixels, each accounting for 50% of its corresponding threshold, then the directional fitting correlation degree of the endpoint can be calculated as 0.6×50%+0.4×50%, which is 50%. If the correlation degree is higher than the set benchmark value, such as 60%, then the endpoint is classified into the edge endpoint group with correlation. The whole process needs to traverse all endpoints that are not involved in the connection and compare them point by point in space and direction with all key points in the guide path to extract all edge endpoints that meet the conditions of directional consistency and positional proximity for subsequent path reconstruction.
[0100] S302: Call the direction fitting correlation degree, and determine whether a continuous coordinate sequence can be formed within the path trend range based on the distance interval and angle distribution between the points in the correlation edge endpoint group. Rearrange the edge point order according to the continuous matching result to obtain the path reconstruction coordinate sequence.
[0101] After calling the direction fitting correlation results, a combination analysis is performed on the selected edge endpoint groups. Spatial spacing and directional orientation are compared among all endpoint pairs one by one. Whether they can form a valid coordinate sequence is determined by whether they meet the conditions for forming a continuous path. The directional consistency condition is controlled by the main direction of the guiding path. Within the allowable fluctuation range of the main direction, such as angle deviation controlled within ±15 degrees and the straight-line distance between any two endpoints not exceeding 30 pixels, the endpoint pair is considered to meet the continuity requirement. Endpoint pairs that meet the conditions can construct a connection graph. Then, these endpoints are connected using a path search algorithm such as depth-first search to generate a point sequence, which is arranged in coordinate order to form a continuous path coordinate column. If a sudden change in direction or distance is found between an endpoint and the previous endpoint, such as an angle deviation exceeding 20 degrees or a distance exceeding the set upper limit, the path needs to be broken and reordered. In actual operation, if a path extending from the upper left corner contains several points with coordinates such as (100, 100), (110, 108), and (120, 116), the distance between these points is about 12 to 13 pixels. The direction change is stable and continuous, and the angle change is within the specified direction envelope. It can be constructed as a continuous coordinate path. During the entire endpoint reordering process, the direction and spacing need to be judged multiple times, and a continuous path segment that meets the conditions needs to be dynamically maintained. The reconstructed path coordinate sequence is output for further evaluation of whether the structure is coherent.
[0102] S303: Based on the trend of change in the connection direction between path segments in the reconstructed coordinate sequence, calculate the magnitude of change in the direction vector between adjacent segments, determine whether it is within the structural continuity threshold range, filter the set of paths with continuous change characteristics, and obtain the path group with closable boundary.
[0103] Based on the arrangement order of points in the reconstructed coordinate sequence of the path, the direction of each path segment is analyzed. By calculating the directional difference between two consecutive segments, it is determined whether the path exhibits a structurally smooth and continuous trend. The direction of each segment is determined by the difference between the horizontal and vertical coordinates of the starting and ending points. If the angle between two adjacent segments is within the structural continuity threshold, such as less than 18 degrees, it can be considered to meet the structural continuity condition. Such path segments are grouped into a set, forming a continuous segment group. The integrity of the connection between the beginning and end of these segment groups is further analyzed. The straight-line distance between the starting and ending points of the entire path segment group is measured. If this distance does not exceed the set closed boundary threshold, such as 20 pixels, then... The path is considered to have the potential to be closed. In the actual judgment process, for example, if the starting point of a path is (135, 140) and the ending point is (150, 150), the distance between the two points is about 18 pixels, which is less than the closure threshold of 20 pixels. This path segment meets the closure condition and is identified as a set of closable paths. In order to maintain the rationality of the judgment, both the structural continuity threshold and the closure boundary threshold need to be dynamically set according to the complexity of the edge construction in the image. This can be set by multiplying the average value of similar structures in the statistical sample by an adjustment coefficient. Based on the judgment result, the path with continuity and closure characteristics is output for use as the reconstruction input of the path layer in subsequent image processing structural analysis scenarios.
[0104] Please see Figure 5 The specific steps of S4 are as follows:
[0105] S401: Based on the boundary path located in the rough edge area of the label printing layer in the group of closable boundary paths, extract the spatial coordinate values of the path segment, the polar angle value of the center point, and the radius length value, construct the direction sequence and length sequence, and generate the polar parameter change sequence.
[0106] Based on the boundary paths in the rough edge area of the label printing layer within the group of closable boundary paths, each path is processed, and the coordinate point information on each path segment is extracted one by one. The two-dimensional coordinate value of each point is obtained using an image coordinate extraction tool. Then, with the center point of the layer as the origin of the polar coordinate system, polar coordinate transformation is performed on all coordinate points to obtain the polar angle and polar radius values of each point relative to the center point. The polar angle is calculated based on the horizontal direction and defined in a counterclockwise direction, with an angle range of 0 to 360 degrees. The polar radius is the straight-line distance from the point to the center point. If a path segment contains point A(130, 150), and the layer center is C(… If the polar angle of a point is approximately 59 degrees and its polar radius is approximately 58 pixels, then the polar angles of all points on the path segment are arranged in order to form a direction sequence. At the same time, the corresponding polar radius values are arranged into a length sequence, thereby constructing a set of polar parameter variation sequences. This provides a quantitative basis for describing the continuous changes in the path shape. For example, if the direction sequence of a certain boundary path segment is 55, 57, 60, 63, 65 degrees and the length sequence is 58, 59, 61, 60, 59 pixels, it indicates that the direction change of this path segment is small and the radius change is stable within a short distance. This polar parameter variation sequence will be used for subsequent fluctuation determination.
[0107] S402: Call the polar parameter change sequence, calculate the path fluctuation degree value based on the adjacent angle difference of the path segment in the direction sequence and the adjacent length fluctuation value in the length sequence, and compare it with the set fluctuation threshold range to obtain the path segment fluctuation degree;
[0108] The path fluctuation value reflects the directional and length stability of the boundary path in the polar coordinate system. Its value is calculated by weighting and fusing the angular and radial length changes of adjacent path points. Empirical weights (e.g., 0.6 for direction, 0.4 for length) and statistical samples can be used to determine the average range of variation. This value is used to filter out path segments that exhibit drastic changes and lack directional continuity.
[0109] The process involves calling the polar parameter variation sequence to analyze the continuous changes in the direction and length of a path segment. It calculates the direction change by subtracting the angles of any two adjacent points, and simultaneously calculates the length fluctuation by subtracting the lengths of any two adjacent polar diameters. These are defined as the angle difference Δθ and the length difference Δr, respectively. The Δθ and Δr values for each pair of consecutive points are statistically analyzed group by group, and the average or maximum value represents the overall fluctuation of the path segment. For example, if the direction differences of a path segment are 2, 3, 2, 2 degrees, and the length differences are 1, 2, 1, 1 pixel, then the average angle difference is 2.25 degrees and the average length difference is 1.25 pixels. A comprehensive fluctuation value is constructed by combining the angle and length fluctuations, and then weighted by a combination of factors. Assuming the angle fluctuation weight is set to 60% and the length fluctuation weight is set to 40%, the overall fluctuation level is 0.6 × 2.25 + 0.4 × 1.25 = 1.85 units. The fluctuation threshold range is set to 0 to 2 units. The range is set based on the average fluctuation value of the smoothed path in the statistical sample and an empirical coefficient. For example, if the average fluctuation in the sample is 1.5 units and the error coefficient is set to 1.3, then the upper limit of the threshold is 1.5 × 1.3, which is approximately equal to 2 units. The fluctuation level of a certain path segment is determined to be less than or equal to this threshold. If it exceeds the threshold, it is considered to be too large and does not meet the continuity requirement. This operation will be repeated for each path segment to obtain the fluctuation level value of each path segment for the next screening step.
[0110] S403: Based on the degree of fluctuation of the path segment, filter out the path segments whose fluctuation value exceeds the threshold range for determining structural continuity, extract the set of sequences with directional continuity and length consistency from the remaining path segments, and establish a set of structural closed segments.
[0111] Based on the fluctuation level of the path segments, all path segments are traversed and screened. Path segments with fluctuation levels exceeding the structural continuity judgment threshold are excluded, while those with fluctuation levels within the allowable range are retained. The remaining path segments are further analyzed for their relative direction and length changes. If any two consecutive path segments have good directional continuity (i.e., the directional difference between the two segments is less than the set directional continuity threshold, for example, not exceeding 15 degrees) and maintain consistency in length (i.e., the length difference between the two segments is less than the specified length threshold, such as 5 pixels), then these two path segments are considered to belong to a continuous structural segment. This screening operation is continued to perform this process on all path segments that meet the requirements of directional and length consistency. The path segments are combined to form a set of structurally closed segments. For example, if path segment A is 60 degrees in direction and 40 pixels in length, and segment B is 65 degrees in direction and 43 pixels in length, then the direction difference is 5 degrees and the length difference is 3 pixels, both within the set threshold, and can be grouped together. The direction continuity threshold and length consistency threshold are set according to the severity of boundary changes in the image and the sample data. Generally, a reasonable value is obtained by multiplying the average change of continuous path segments in the sample by a correction coefficient. For example, if the average direction difference is 12 degrees and the set coefficient is 1.25, then the threshold is 15 degrees. Through this screening, a set of structurally closed segments is established, which is used as the input for the recognition of label contours in subsequent images.
[0112] Please see Figure 6 The specific steps of S5 are as follows:
[0113] S501: Based on the positional relationship between the boundary segments and the overall edge chain of the structural closed segment, obtain the node coordinates of the boundary segments, the sequence of points constituting the edge chain and the boundary direction vector, calculate the positional distance and direction angle difference between the boundary segment nodes and the edge chain, construct the boundary connection identification set of the structural closed segment, and obtain the position offset rate of the local boundary connection.
[0114] First, the structural geometry and topology are constructed. Then, the node coordinates of each boundary segment are identified using image recognition. For example, when the image resolution is 1000×1000 pixels, the start and end points of a boundary segment are (120, 340) and (160, 410), respectively. Next, the sequence information of the points constituting the overall edge chain is extracted, for example, four consecutive points (110, 330), (130, 360), (150, 390), and (170, 420). Based on the coordinate differences, the spatial distances between the two endpoints of the boundary segment and each point on the chain are calculated. The points with the smallest positional difference are compared one by one. Simultaneously, the direction vectors between the boundary segment's direction and the chain path are obtained, and their included angle is calculated. The angle between the vectors is then used to calculate... The two orientation angles are approximately 60.26° and 56.31° respectively, with an orientation difference of approximately 3.95°. They belong to connection paths with relatively consistent orientations. The combination relationship between all boundary segments and chain points is processed sequentially to form a complete set of boundary connection identifications. Then, the offset rate of each boundary connection is calculated based on the average distance of all identification points and a given reference length. For example, if the average distance is 12 pixels and the reference length is 50 pixels, the offset rate is 24%. By setting the offset rate level classification standard, such as less than 10% is low offset, 10% to 30% is medium offset, and greater than 30% is high offset, the actual deviation between each structural boundary and the overall chain is clarified, and the process of obtaining the position offset rate of local boundary connection is completed.
[0115] S502: Based on the position offset rate at the local boundary connection, extract the topological relationship and orientation continuity coefficient of the boundary points of the neighboring grid cells around the identification point at the boundary connection, calculate the trend angle difference between the path extension direction and the orientation at the boundary connection, and establish a set of control nodes in combination with the continuity coefficient to obtain the position adjustment weight of the control nodes.
[0116] Based on the position offset rate at local boundary connections, each identified boundary connection point is expanded. The topological relationships of boundary points within neighboring grid cells are extracted. For example, boundary points are identified within a 3×3 adjacency range. The directional connectivity between points is analyzed, such as vertical, diagonal, and horizontal types, forming a directional chain sequence. The degree of directional change between each pair of points is calculated sequentially to determine the angle between directions, and a continuity strength coefficient is calculated accordingly. For example, if the directional change between points is 45 degrees, the coefficient is 0.75. A minimum continuity coefficient benchmark of 0.6 is set; points with values higher than this are included in the subsequent control node candidate set. This is combined with the angular difference between the path extension direction and the boundary connection direction. The process involves clarifying the directional trend changes at each boundary connection point. For example, if the current path extends horizontally and the boundary connection point slopes at 45 degrees, the angle difference is 45 degrees. A threshold direction of 30 degrees is then set, and a reference coefficient baseline of 0.6 is established. The adjustment intensity of each candidate node is calculated using a weighting function. For instance, if the current angle difference is greater than the baseline angle by 15 degrees, the continuity coefficient is 0.75, resulting in a control weight value of 1.0. All candidate nodes are processed in this manner, and the calculated control weight value is used as the basis for spatial adjustment intensity. The adjustment intensity is categorized as follows: higher than 0.7 indicates high intensity, between 0.4 and 0.7 indicates medium intensity, and less than 0.4 indicates low intensity. The spatial adjustment intensity values of all control nodes are then obtained.
[0117] S503: Adjust the weights according to the position of the control nodes, adjust the position coordinates of the control nodes in the boundary structure, combine the original boundary connection relationship of the nodes with the boundary order of the structural closed segment, correct the connection structure of the overall boundary path, and generate the label edge contour structure.
[0118] Based on the spatial adjustment intensity value of the control nodes, nodes with intensity values higher than the set threshold are selected for position adjustment. Each node contains original coordinates and adjustment direction information. The adjustment direction can be composed of its continuous boundary direction and offset direction. For example, if the original coordinates are (200, 300), the adjustment direction is to tilt to the upper right, the length of the direction unit vector is 1, and the adjustment range is scaled proportionally according to the control intensity, the maximum adjustment range is set to 10 pixels, the current control intensity is 0.8, and the actual offset distance is 8 pixels. Offset along the adjustment direction, the new coordinates of the node are updated to approximately (207, 296). After updating the coordinates of all nodes that need to be adjusted, the original connection order information between the nodes needs to be combined. For example, if the node numbering order is A, B, C, D, and the connection method is sequential direct connection, the updated boundary path structure is reconstructed, the new boundary path is sorted and spliced, and a complete label edge contour structure graphic is generated.
[0119] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for extracting and optimizing the edge contour of knitted labels, characterized in that, Includes the following steps: S1: Extract the gray-level change trend of the image edge region, determine whether the edge continuity feature is interrupted, identify the location of the edge gradient value change, extract the edge distribution location, for the interference area caused by the bonding indentation in the image, combine the gray-level change and texture difference features to extract the location range, for the rough edge area formed by the printing process in the image, by detecting the high frequency directional fluctuation and local gray-level disturbance features on the boundary path, identify and mark it as the rough edge area of the label printing layer, and obtain the coordinate set of the broken area; S2: Extract the edge trajectory associated with the concentrated breakpoints of the fracture area coordinates, analyze the stability of the direction and angle of the label edge jagged edge point column, match the consistency of the direction change structure, extract the path direction that conforms to the trend, and generate the boundary connection guide path; S3: Based on the boundary connection guide path, analyze the unconnected edge endpoints around the label bonding indentation interference area, determine the spatial correlation and direction fitting degree, reconstruct the path connection structure, determine the structural continuity change, and output a group of closable boundary paths. S4: Perform polar distribution transformation on the path of the rough edge area of the label printing layer in the closed boundary path group, identify the trend of change in direction and length, judge the stability of the path segment, filter out the path sequence that does not meet the continuity judgment range, and form a set of structural closed segments. S5: Based on the positional relationship between the boundary segments of the closed segment cluster and the overall edge chain, establish a set of control nodes near the boundary connection, coordinate the path extension direction and the trend at the boundary connection, adjust and merge the boundary structure, and generate the label edge contour structure. The specific steps of S5 are as follows: S501: Based on the positional relationship between the boundary segments and the overall edge chain of the structural closed segment set, obtain the node coordinates of the boundary segments, the sequence of points constituting the edge chain and the boundary direction vector, calculate the positional distance and direction angle difference between the boundary segment nodes and the edge chain, construct the boundary connection identification set of the structural closed segment, and obtain the position offset rate of the local boundary connection. S502: Based on the position offset rate at the local boundary connection, extract the topological relationship and direction continuity coefficient of the boundary points of the neighboring grid cells around the identification point at the boundary connection, calculate the trend angle difference between the path extension direction and the direction at the boundary connection, establish a set of control nodes in combination with the continuity coefficient, and obtain the position adjustment weight of the control nodes. S503: Adjust the position coordinates of the control nodes in the boundary structure according to the position adjustment weight of the control nodes, and modify the connection structure of the overall boundary path by combining the original boundary connection relationship of the nodes and the boundary order of the structural closed segment, and generate the label edge contour structure.
2. The method for extracting and optimizing the edge contour of knitted labels according to claim 1, characterized in that, The set of coordinates for the fractured region includes the location of the edge continuity interruption, the abrupt gradient segment, and the edge distribution coordinates. The boundary connection guidance path includes the direction change trend path, the structural consistency matching path, and the edge trajectory guidance path. The set of closable boundary paths includes the connection path, the reconstruction path, and the direction fitting path. The set of structural closure segments includes the direction stability path, the length change path, and the continuity matching path. The label edge contour structure includes the boundary segment, the overall edge chain, and the set of control nodes.
3. The method for extracting and optimizing the edge contour of knitted labels according to claim 1, characterized in that, The specific steps of S1 are as follows: S101: Based on the edge region of the knitted label image, extract the gray-level difference sequence between adjacent pixels in the image gray-level matrix, call the continuous numerical segments of the sequence in the same row direction, and filter the gray-level change segments with continuous direction and no reversal according to the fluctuation trend of gray-level difference to generate a set of gray-level trend continuous segment values. S102: Based on the set of continuous grayscale trend segments, determine the variation range of adjacent grayscale differences in the segments, and by calculating the variation range value, filter out abrupt change locations that exceed the edge continuity benchmark value, establish the gradient range corresponding to the grayscale jump, and obtain the abrupt change gradient interval sequence. S103: Call the mutation index position in the mutation gradient interval sequence to locate the pixel coordinate set in the edge region of the original image. Combine the interruption start and end information in the continuous gray-scale change to filter the region segment where the coordinate change trend is interrupted and obtain the coordinate set of the broken region.
4. The method for extracting and optimizing the edge contour of knitted labels according to claim 3, characterized in that, The specific steps of S2 are as follows: S201: Based on the edge trajectory associated with the interruption point in the coordinate set of the fractured region, extract the sequence of adjacent pixels in the corresponding direction from the jagged edge point column of the label weave, identify the trend of the arrangement direction change of the points in the coordinate sequence, filter the path segments with continuous direction without reversal, and generate a sequence of direction change trends. S202: Call the direction change trend sequence to determine whether the rate of change of direction angle in the path segment is within the direction stability benchmark range. Combine the direction change situation in the coordinate set of the fracture area to filter the path segments with matching direction features and obtain the structurally consistent path segment list. S203: Based on the coordinate arrangement order in the structural consistency path segment column, identify the directional vector change characteristics between adjacent path segments, and based on the boundary continuity benchmark value, filter the set of directional paths that meet the connection conditions to obtain the boundary connection guide path.
5. The method for extracting and optimizing the edge contour of knitted labels according to claim 4, characterized in that, The specific steps for S3 are as follows: S301: Based on the trend direction of the boundary connection guide path, extract the distance and angle deviation values between the spatial coordinates and the path trend of the edge endpoints that are not involved in the connection in the surrounding area of the label bonding indentation interference area. Based on whether the direction difference falls within the direction association benchmark range, filter the edge endpoint groups with association and generate the direction fitting association degree. The directional correlation reference range refers to the maximum angle difference threshold between the edge endpoint direction and the boundary connection guide path direction. The range is obtained by statistically analyzing the directional differences of connection paths with strong directional consistency in the sample image, and is dynamically adjusted according to the rate of change of the path extension direction and the structural complexity. S302: Call the aforementioned direction fitting correlation degree, and determine whether a continuous coordinate sequence can be formed within the path trend range based on the distance interval and angle distribution between the points in the correlation edge endpoint group. Rearrange the edge point order according to the continuous matching result to obtain the path reconstruction coordinate sequence. S303: Based on the trend of change in the connection direction between path segments in the reconstructed coordinate sequence, calculate the magnitude of change in the direction vector between adjacent segments, determine whether it is within the structural continuity threshold range, filter the set of paths with continuous change characteristics, and obtain the path group with closable boundary. The structural continuity threshold range refers to the angular range used to determine whether the directional changes of adjacent path segments are smooth during the path reconstruction process. The range is set by the change in the angle between the directional vectors of structurally continuous paths in the statistical sample, using the average value ± tolerance multiple.
6. The method for extracting and optimizing the edge contour of knitted labels according to claim 5, characterized in that, The specific steps of S4 are as follows: S401: Based on the boundary path located in the rough edge area of the label printing layer in the group of closable boundary paths, extract the spatial coordinate values of the path segment, the polar angle value of the center point, and the radius length value, construct the direction sequence and the length sequence, and generate the polar parameter change sequence. S402: Call the polar parameter change sequence, calculate the path fluctuation degree value based on the adjacent angle difference of the path segment in the direction sequence and the adjacent length fluctuation value in the length sequence, and judge it with the set fluctuation threshold range to obtain the path segment fluctuation degree; S403: Based on the fluctuation degree of the path segment, filter out path segments whose fluctuation degree value exceeds the threshold range for determining structural continuity, extract the set of sequences with directional continuity and length consistency from the remaining path segments, and establish a set of structural closed segments.
7. The method for extracting and optimizing the edge contour of knitted labels according to claim 3, characterized in that, The edge continuity benchmark value refers to the upper limit of the average fluctuation value of the change in the gray difference between adjacent gray values in a continuous gray trend segment in the image. It is determined based on the statistical results of stable edge regions and is obtained by multiplying the amplitude of edge gray difference change in the sample image by an adjustment coefficient.
8. The method for extracting and optimizing the edge contour of knitted labels according to claim 4, characterized in that, The directional stability reference range refers to the range of variation in the rate of change of the directional angle of adjacent pixels in a path segment. The range is obtained by statistically analyzing the rate of change of the angle of multiple continuous boundary path segments in the sample image, calculating its average or variance, and multiplying it by a set tolerance coefficient.
9. The method for extracting and optimizing the edge contour of knitted labels according to claim 1, characterized in that, The polar distribution transformation is a process of converting the coordinate representation of the boundary path points in the planar coordinate system into the angular and radial distance representation of the reference center point. The reference center point is determined by the geometric center of the coordinates of the boundary points of the closed path. The continuity determination range is a determination criterion that limits the range of changes in the direction and length of the boundary path. The determination criterion is formed by the direction change sequence and length change sequence of the path point sequence and is used to eliminate path sequences that do not meet the continuity requirement. The control node set is a set of node points set near the boundary connection of the boundary segment for contour fusion adjustment. The node point set is formed by selecting the coordinates of the endpoint of the boundary segment and the edge points adjacent to the endpoint. The label edge contour structure is a closed or quasi-closed boundary shape of the knitted label edge represented by a continuous sequence of edge points in the image coordinate system. The boundary shape is formed by the fusion of a set of structural closed segments and the overall edge chain under the constraints of a set of control nodes.
Citation Information
Patent Citations
E-commerce image dynamic optimization and adjustment method based on market feedback
CN119850462A
Image generation method and system
CN120495106A
Neurosurgery image diagnosis method and system based on image processing
CN120563436A
Cloth turning and sewing alignment control system based on machine vision
CN120765754A