An intelligent generation method for socks pattern making files based on image processing

Through image preprocessing, texture analysis and contour refinement technologies, the problems of inaccurate contour positioning and insufficient shape refinement in sock plate making are solved, and more accurate sock plate making file generation is achieved, which improves production efficiency and product quality.

CN119313768BActive Publication Date: 2025-06-06ZHUJI ZUFEI KNITTING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411838066.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-06-06
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

The prior art has problems such as inaccurate contour positioning, insufficient shape refinement and poor adaptability in the process of sock plate making, which affects the accuracy of sock plate making documents.

Method used

By obtaining the standard images of the socks, image preprocessing and texture hierarchy analysis, positioning the groove position and adjusting the edge profile; using automatic threshold segmentation and brightness difference detection, the rough contour of the socks area is extracted and local curvature analysis is performed to refine the contour shape; the socks area is divided into multiple sub-regions, and feature points are adjusted to achieve a smooth transition to the rectangular boundary.

Benefits of technology

It realizes more accurate positioning and shape adjustment of the sock tube profile, improves the accuracy and production efficiency of sock plate making documents, and reduces manual intervention and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313768B_ABST
    Figure CN119313768B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and specifically to an intelligent generation method for socks plate-making files based on image processing. Obtain the front and back standard images of socks, perform image preprocessing, and enhance the contrast of different areas. Use the texture hierarchy analysis method to locate the cuff position, and perform gradual boundary adjustment on the edge contour to obtain the precise cuff position. Use the automatic threshold segmentation method to segment and crop the front and back standard images of socks, and retain the sock region. Use brightness difference detection on the sock region to extract the rough contour of the sock, track the local curvature of the rough contour, and adjust the shape of the sock contour. Correct the shape deviation of the sock contour, obtain the front and back sock segmentation images, and divide them into multiple sub-regions, adjust the region according to the feature points of the contour of each sub-region, deform the entire region, and obtain the front and back sock rectangular images. The present invention can obtain more accurate cuff positions and sock contours, and thus obtain more accurate socks plate-making files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to an intelligent generation method of socks plate-making files based on image processing. Background Art

[0002] Sock pattern files are technical drawings or data files generated through the design and manufacturing process, representing the shape, size, cutting path and other information of the socks for use by production machines.

[0003] In traditional methods, obtaining sock plate-making files usually relies on manual drawing or design through two-dimensional drawing software. Workers or designers measure the size, determine the outline and make plate-making drawings based on the sample socks. Some companies use automated scanning equipment or laser scanning equipment to obtain sock shape data, and then convert it into plate-making files through special software. Although these methods can achieve relatively accurate plate-making, they have high process requirements, high labor consumption, long production cycle, and are easily affected by human factors.

[0004] The existing technology mainly uses image processing, computer vision and deep learning algorithms to automatically extract the shape and size of socks. By collecting, preprocessing and detecting the contours of sock images, the system can automatically identify the structural features of socks, such as the sock tube and sock opening, and generate corresponding plate-making files. These methods have a high degree of automation, can quickly generate relatively accurate plate-making files, and adapt to different design requirements, reducing manual intervention and errors. However, these methods still have some difficulties in dealing with complex backgrounds or deformed socks, especially the accurate positioning of the sock opening and the extraction of the sock tube contour. The existing technology has problems such as inaccurate contour positioning, insufficient shape refinement and poor adaptability in the sock plate-making process, which affects the accuracy of the sock plate-making files.

[0005] Therefore, an intelligent generation method of socks pattern making files based on image processing was proposed. Summary of the invention

[0006] The purpose of the present invention is to provide an intelligent generation method for socks plate-making files based on image processing, which is used to obtain more accurate cuff positions and sock tube contours, and thus obtain more accurate socks plate-making files. The specific steps are: obtaining the front and back standard images of socks, performing image preprocessing, and enhancing the contrast of different areas. Using the texture hierarchy analysis method, the cuff position is located, and the edge contour is gradually adjusted to obtain the precise cuff position. Using the automatic threshold segmentation method, the front and back standard images of socks are segmented and cropped to retain the sock tube area. Brightness difference detection is used for the sock tube area to extract the rough contour of the sock tube, track the local curvature of the rough contour, and adjust the shape of the sock tube contour. Correct the shape deviation of the sock tube contour to obtain the front and back sock tube segmentation images, and divide them into multiple sub-areas, adjust the area according to the feature points of the contour of each sub-area, deform the entire area, and obtain the front and back sock tube rectangular images.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A method for intelligently generating socks pattern making files based on image processing, comprising:

[0009] Obtain standard images of the front and back of socks;

[0010] Performing image preprocessing on the front and back standard images of the socks to enhance the contrast of different regions; using a texture hierarchy analysis method to locate the cuff position; performing a gradual boundary adjustment on the edge contour of the cuff position to obtain the precise cuff position, and obtaining a dimension annotation therefrom;

[0011] Using an automatic threshold segmentation method and according to the precise cuff position, the front and back standard images of the socks are segmented and cropped, the cuffs, heels and toes are removed, the sock region is retained, and the rough outline of the sock region is extracted by using brightness difference detection; the local curvature of the rough outline is tracked to adjust the shape of the sock contour; the contour of the sock contour is refined by using expansion and corrosion operations to correct the shape deviation, and the front and back sock segmentation images are obtained; the refined sock contour is used as a basic path to generate stitching lines and cutting lines;

[0012] The front and back sock segmentation images are divided into a plurality of sub-regions, and the regions are adjusted according to the feature points of the contour of each sub-region, so as to deform the entire region and obtain the front and back sock rectangular images.

[0013] Furthermore, the method for obtaining the front and back standard images is: ensuring uniform light in the shooting environment, and using a high-resolution camera to shoot the standard images of the front and back of the socks.

[0014] Furthermore, the image preprocessing step includes: graying the front and back standard images of the socks; and using histogram equalization to enhance the contrast of different areas.

[0015] Furthermore, the specific steps of the texture level analysis method are:

[0016] Using a texture descriptor to capture texture information in the front and back standard images of the socks to obtain a texture feature map;

[0017] Performing multi-scale processing on the texture feature map to obtain a multi-scale feature map, and identifying the details of the sock cuffs and the overall outline of the socks;

[0018] Canny edge detection is used to highlight the boundary area with significant texture difference in the multi-scale feature map to obtain an edge map; the cuff area is segmented according to the edge information and texture difference in the edge map and the texture feature map to obtain the cuff position of the cuff area.

[0019] Furthermore, the specific steps of performing a gradual boundary adjustment on the edge contour of the cuff position to obtain the precise cuff position are as follows:

[0020] Calculating the local gradient of the edge area of ​​the cuff position, determining the edge direction of each pixel based on the local gradient change, and fine-tuning the edge position using an iterative optimization method;

[0021] In each iteration, each pixel point in the region is gradually approached to the correct edge position according to the texture, contrast and gradient information of the region, so as to obtain the precise cuff position;

[0022] The size of the sock opening is calculated through the precise cuff position to obtain the size marking.

[0023] Furthermore, an automatic threshold segmentation method is used, and according to the precise cuff position, the front and back standard images of the socks are cropped to remove the cuff, the heel and the toe, retain the sock region, and brightness difference detection is used to extract the rough outline of the sock region. The specific steps are as follows:

[0024] Using an automatic threshold segmentation method, segmenting and removing the heel and toe regions of the front and back standard images of the socks;

[0025] A rectangular frame is defined according to the precise cuff position, the boundary of the rectangular frame is the precise cuff position, and the front and back standard images of the socks are cropped using the rectangular frame to retain the sock barrel area;

[0026] A local window is defined around each pixel point in the sock region, and a brightness difference value between each pixel in each local window and surrounding pixels is calculated, and the brightness difference value of the local window is obtained by calculating the average brightness value of all pixels in the window;

[0027] According to all the local window brightness difference values, a brightness difference value threshold is used for screening to obtain a rough outline of the sock region.

[0028] Furthermore, the local curvature of the rough outline is tracked to adjust the shape of the sock outline. The specific steps are as follows:

[0029] The local curvature of the rough outline is calculated, irregular parts are identified, and the local convex and concave areas are adjusted using the curvature information.

[0030] Furthermore, the sock contour is subjected to an erosion operation to remove noise points; and the broken contour edges are connected using an expansion operation to obtain the front and back sock segmentation images.

[0031] Furthermore, the front and back sock segmentation images are divided into a plurality of sub-regions, and the regions are adjusted according to the feature points of the contour of each sub-region, so as to deform the entire region and obtain the front and back sock rectangular images. The specific steps are as follows:

[0032] Extracting global information from the sock outline, clarifying the boundary of the sock, and forming a clear outer frame;

[0033] Calculating the gradient difference of the sock outline, specifically including the gradients on both sides of the sock outline boundary; dividing the front and back sock segmentation images into sub-regions of corresponding sizes according to the magnitude of the gradient;

[0034] In each of the sub-regions, the gradient of each point is calculated, and the point with the largest gradient is taken as a feature point;

[0035] In each of the sub-regions, the distance and angle between the feature points are adjusted, and each of the sub-regions is distorted so that the entire sub-region smoothly transitions to a rectangular boundary; and the edges of the smoothed sub-regions are smoothed.

[0036] Further, merging the rectangular boundaries of the sub-regions after smoothing;

[0037] During the merging process, the edge information of all the sub-regions is fine-tuned to obtain the front and back rectangular images of the socks.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] 1. The present invention can accurately locate the true edge of the cuff by calculating the local gradient of the edge area of ​​the cuff position and performing iterative optimization, avoiding positioning errors caused by lighting or texture interference. The edge accuracy is ensured by gradual fine-tuning, thereby obtaining accurate cuff position and dimension marking. This provides accurate dimension data for subsequent sock plate making, reduces manual measurement errors, and improves plate making accuracy and production efficiency. At the same time, the optimized edge processing helps to better extract the contour of the sock tube and ensure the overall quality of the plate making image.

[0040] 2. The present invention can effectively extract the rough outline of the sock area and identify irregular parts by using brightness difference detection and local curvature analysis. Brightness difference detection can accurately distinguish the sock area from other parts through the brightness difference value of pixels in the local window, thereby achieving accurate regional segmentation. Based on local curvature analysis, the convex or concave parts in the sock outline can be identified and corrected, and the outline shape can be optimized. This process greatly improves the accuracy of the sock outline, reduces the plate-making error caused by irregular outlines, and ensures that the subsequent sock plate-making files generated are more accurate.

[0041] 3. The present invention can accurately identify the key features of the sock contour through gradient difference and feature point analysis, and then divide the contour area into multiple sub-areas, which helps to fine-tune the shape and position of each sub-area. By adjusting the distance and angle between the feature points, a smooth transition of the sub-areas is achieved, so that the entire sock area can seamlessly transition to the rectangular boundary. This process optimizes the accuracy of the contour through smoothing and least squares fine-tuning, ensuring that the final generated sock rectangular image has higher accuracy and consistency when making plates. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is a diagram showing the structure of the socks of the present invention;

[0043] Figure 2 A method flow chart of a method for intelligently generating a socks plate-making file based on image processing according to the present invention;

[0044] Figure 3 It is a schematic diagram of the grayscale conversion of the front and back standard images of socks of the present invention;

[0045] In the figure: 1. cuff; 2. upper sock shaft; 3. lower sock shaft; 4. heel; 5. toe. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] In order to obtain more accurate cuff positions and sock tube contours, and further obtain more accurate sock pattern-making files, the present invention provides an intelligent generation method for sock pattern-making files based on image processing. In order to illustrate the function of the present invention, the effectiveness of the present invention will be illustrated from the following examples.

[0048] Embodiment 1

[0049] As a professional socks manufacturer, A socks company is committed to refined production. Figure 1 The diagram below shows the structure of socks, which include cuffs 1, upper socks 2, lower socks 3, heels 4 and toes 5. In order to achieve more accurate plate making, improve production efficiency, shorten production cycles, and reduce the waste of raw materials, sock company A uses an intelligent method for generating sock plate files based on image processing. The image processing technology is used to adjust the contour of the socks, accurately obtain the size and cutting line of the socks, and thus obtain accurate sock plate files. Figure 2 , a method flow chart of an intelligent generation method for socks pattern making files based on image processing is presented.

[0050] Reference Figure 1 In step S01, the front and back standard images of the socks are obtained. Specifically, the method for obtaining the front and back standard images is: ensuring uniform light in the shooting environment, and using a high-resolution camera to shoot the front and back standard images of the socks. The high quality and comprehensiveness of the sock images are ensured, the errors caused by the differences in lighting and angles are reduced, and accurate image data is provided for subsequent processing.

[0051] Further, refer to Figure 1 In step S02, the front and back standard images of the socks are preprocessed to enhance the contrast of different areas; the cuff position is located using a texture hierarchy analysis method; the edge contour of the cuff position is gradually adjusted to obtain the precise cuff position, and the size annotation is obtained from it.

[0052] Specifically, the image preprocessing step includes: graying the front and back standard images of the socks, and the graying formula used is: ,in, , and Represents the values ​​of the red, green, and blue channels of each pixel in the front and back standard images of the socks, respectively. Represents the grayscale value after conversion. The weights of this formula (0.299, 0.587, 0.114) are based on the sensitivity of the human eye to different colors. Green contributes the most to vision, followed by red, and blue the least. Therefore, green has the highest weight and blue has the lowest weight. The schematic diagram of the grayscale conversion of the front and back standard images of socks is as follows Figure 3 This method effectively retains the brightness information of the original image, and at the same time converts the RGB image into a grayscale image based on the difference in color perception of the human eye. Furthermore, histogram equalization is used to make the grayscale distribution of the image as uniform as possible, thereby enhancing the contrast and making the edges of the cuffs and socks more obvious, which facilitates subsequent positioning and contour extraction.

[0053] Furthermore, the specific steps of the texture level analysis method are:

[0054] The grayscaled front and back standard images of socks are recorded as , Gao Wei , width is The texture descriptor GLCM is used to capture the texture information in the front and back standard images of the socks to obtain a texture feature map. The formula of the texture descriptor GLCM is as follows:

[0055] ;

[0056] in, and represents the gray level, represents the direction of the pixel pair, represents the distance between pixel pairs, represents the Dirac function, Represents the pixel coordinates in the grayscaled standard image of the front and back of the socks. The above formula is used to capture the spatial relationship and texture features between pixel pairs in the image to obtain the texture feature map , the size is .

[0057] The texture feature map Perform multi-scale processing to obtain a multi-scale feature map. The specific formula used is:

[0058] ;

[0059] in, Indicates Layer images, Indicates Gaussian filtering and downsampling of the image. Indicates the number of scales. Through multi-scale processing, a multi-scale feature map is obtained , each scale contains texture feature information at different resolutions.

[0060] Canny edge detection is used to highlight the boundary areas with significant texture differences in the multi-scale feature map. Specifically, for each scale, the corresponding edge map is obtained. , so we get a multi-scale edge map , and The same size; using an image segmentation algorithm, including but not limited to a watershed algorithm or a threshold segmentation algorithm, segmenting the cuff area to obtain the cuff position of the cuff area .

[0061] The texture information in the front and back images of the socks is captured by texture descriptors, and the position of the sock cuffs is effectively identified by using multi-scale processing and Canny edge detection. By accurately locating the cuff boundaries, the accuracy of sock pattern making can be improved, errors can be avoided, and the final pattern making file can accurately reflect the actual contour and size of the socks, thereby optimizing subsequent segmentation, cutting and design work.

[0062] Further, the local gradient of the edge area of ​​the cuff position is calculated using the Sobel operator or the Prewitt operator. , based on the local gradient change, determine the edge direction of each pixel The iterative optimization method is used to fine-tune the edge position. The specific method is to calculate an offset for each pixel based on the gradient change in its neighborhood. and , and fine-tune the edge position to obtain the adjusted edge position .

[0063] In each iteration, let the step size of each iteration be For each pixel, use the gradient descent method to calculate the new edge position:

[0064] ;

[0065] in, Represents the number of iterations, the maximum value is ; Represents the error function of edge detection, defined as the difference between the gradient of edge pixels and the image brightness: ,in, represents the error function, represents the adjusted edge position target, Represents the ideal edge position target. The final precise edge position, i.e., the precise cuff position, is obtained through iteration. .

[0066] By the precise cuff position Calculate the size of the sock cuff, specifically, find the two edge points with the largest distance on the cuff edge and , the distance between these two points is the size of the sock opening.

[0067] Through local gradient analysis and iterative optimization, the cuff edge position is precisely fine-tuned, overcoming the errors and ambiguity problems in traditional methods and ensuring the accuracy of the cuff position.

[0068] Further, refer to Figure 1 In step S03, the front and back standard images of the socks are segmented and cropped using an automatic threshold segmentation method according to the precise cuff position, the cuff, heel and toe are removed, the sock region is retained, and the rough outline of the sock region is extracted using brightness difference detection; the local curvature of the rough outline is tracked to adjust the shape of the sock contour; the contour of the sock contour is refined using dilation and erosion operations to correct the shape deviation, and the front and back sock segmentation images are obtained; the refined sock contour is used as the basic path to generate stitching lines and cutting lines.

[0069] Specifically, the automatic threshold segmentation method is used to convert the grayscale values ​​of the front and back standard images of the socks into Set between [0, 255], the pixel distribution of the image is , select a threshold T to maximize the between-class variance :

[0070] ;

[0071] in, and The weights of the foreground (sock tube) and background (sock heel and toe area) are the pixel ratios of the foreground and background respectively:

[0072] , ;

[0073] and Represents the mean of foreground and background respectively:

[0074] , ;

[0075] Find the value The largest , this value is the optimal threshold, which is used to segment the front and back standard images of socks, remove the heel and toe areas of the front and back standard images of socks, and obtain the segmented binary image .

[0076] Define a rectangular frame based on the exact cuff position ,in, , , and The coordinates of the four corners of the precise cuff position are respectively used. The front and back standard images of the socks are cropped using the rectangular frame to retain the sock area. , the formula is .

[0077] In the sock area A local window is defined around each pixel , calculate the brightness difference between each pixel in each local window and the surrounding pixels , the calculation formula is:

[0078] ;

[0079] in, Represents a local window, including surrounding pixels .

[0080] By calculating the average brightness of all pixels in the window, the local window brightness difference value is obtained , using the brightness difference threshold Screening is performed to obtain a rough outline of the sock area , the screening formula is:

[0081] ;

[0082] Through automatic threshold segmentation and brightness difference detection, the heel and toe areas of the socks are accurately removed, and the sock tube part is retained, reducing irrelevant interference in the processing process. By calculating the local brightness difference value, the rough outline of the sock tube area can be extracted, ensuring the accuracy of contour extraction. This method effectively improves the accuracy of segmentation and lays the foundation for subsequent contour refinement and shape adjustment.

[0083] Furthermore, the local curvature of the rough outline is calculated to identify irregular parts. The identification of irregular parts requires setting a threshold to determine. Irregular parts are areas with large curvature values ​​or sharp changes in curvature. The curvature information is used to adjust the local convex and concave areas. The methods used include but are not limited to smoothing functions or interpolation methods. Finally, the adjusted sock outline is obtained. .

[0084] By calculating the local curvature and identifying irregularities in the rough outline, the shape of the sock can be precisely adjusted to correct local protrusions and depressions. Using curvature information to optimize the shape ensures that the sock contour is smoother and in line with the actual structure, reducing shape errors. This adjustment helps improve the accuracy of sock pattern making and ensures the accuracy of subsequent cutting and sewing.

[0085] Furthermore, the sock contour is eroded to remove noise points; the broken contour edges are connected using dilation operations to obtain the front and back sock segmentation images. The erosion and dilation operations effectively optimize the sock contour and improve the coherence and accuracy of the segmentation image. Suppose the sock contour point set in the front and back sock segmentation images is ,in, is the number of points. Let the starting point of the suture line be , the end point is . The shortest path is calculated by Dijkstra algorithm to obtain the path point set of the suture line. ,in, Indicates the number of points. The cutting line is above or below the outline of the sock, and generates parallel lines at a certain distance. Set the distance from the bottom of the sock to , translating outward through each point of the parallel contour For each contour point, translate along the vertical direction to obtain the cutting line point set ,in, Indicates the number of points.

[0086] Socks company A used this method when generating the pattern-making files for socks of category B and obtained the position data of the stitching lines and cutting lines, as shown in Table 1.

[0087] Table 1 Data of stitching and cutting lines for category B socks

[0088]

[0089] Among them, (0,0) is the position of the center of the sock opening.

[0090] Further, refer to Figure 1 In step S04, the front and back sock segmentation images are divided into a plurality of sub-regions, and the region is adjusted according to the feature points of the contour of each sub-region, thereby deforming the entire region to obtain the front and back sock rectangular images.

[0091] Specifically, an edge detection algorithm is used to extract the outline of the sock from the sock. Extract global information, clarify the boundary of the sock, and form a clear outline ;

[0092] Calculate the gradient difference of the sock outline , specifically including the gradients on both sides of the sock outline boundary, and the calculation formula is:

[0093] ;

[0094] in, Represents the gradient operator.

[0095] According to the gradient The front and back sock segmentation images are divided into sub-regions of corresponding sizes according to the size of , the calculation formula is ,in, represents the gradient threshold, represents the gradient threshold of each sub-region, Indicates the number of sub-regions;

[0096] In each of the sub-regions, the gradient of each point is calculated, and the point with the largest gradient is taken as a feature point to form a feature point set. ,in Represents the number of feature points. The formula for selecting feature points is:

[0097] ;

[0098] Among them, max represents the maximum value; arg represents the argument of the complex number.

[0099] In each of the sub-areas, the distance between the feature points is adjusted and angle , distort each of the sub-regions so that the entire sub-region smoothly transitions to the rectangular boundary. Specifically, the distance between the feature points and angle Make adjustments: ,in, and They are feature points Two points in a set; , where arctan represents the inverse tangent function, and Corresponding points and Point The coordinates of and angle , deform each sub-region to achieve a smooth transition:

[0100] ;

[0101] in, Represents the deformed sub-region information; Indicates smoothing operation; The edge of the sub-region after smoothing is smoothed, and a Gaussian filter or other smoothing algorithm may be used.

[0102] By accurately extracting the global information of the sock contour and refining the gradient difference, the sock image can be segmented into multiple sub-regions to ensure that the contour features of each sub-region are accurately extracted and adjusted. Through distortion and smoothing, each sub-region smoothly transitions to a rectangular boundary, and finally a clear and accurate rectangular image of the front and back socks is obtained. This process effectively improves the shape accuracy of the sock plate making.

[0103] The rectangular boundaries of the sub-regions after the smoothing process are merged.

[0104] During the merging process, the edge information of all the sub-regions is fine-tuned. In this embodiment, filtering techniques are used, including but not limited to Gaussian blur and mean filtering. The pixel values ​​of the merged region are adjusted using a weighted average method to ensure the continuity of the color, brightness and other information of the merged region, and finally the front and back rectangular images of the socks are obtained.

[0105] By merging the smoothed sub-region rectangular boundaries and fine-tuning the edge information of all sub-regions, the edge irregularities and errors can be effectively reduced, making the contour of the sock image smoother and more accurate. This process ensures a smooth transition between multiple sub-regions and reduces visual discontinuity, thereby generating more accurate front and back sock rectangular images and improving the quality of plate-making files.

[0106] Socks company A used this method to obtain socks pattern-making file data, among which the socks pattern-making file data of category B is shown in Table 2.

[0107] Table 2 B category socks pattern making file data

[0108]

[0109] This method uses image processing technology to accurately locate the contours of the sock cuffs and sock tubes, and automatically generates sock pattern files. Through image preprocessing, texture analysis, threshold segmentation and contour refinement, the design accuracy and efficiency are effectively improved. The automatically generated stitching lines and cutting lines can accurately reflect the actual shape of the socks, reduce manual intervention, reduce errors, and improve production consistency and product quality.

[0110] Embodiment 2

[0111] C Sports Brand focuses on improving the accuracy and comfort of its products in sock design and production. Therefore, C Sports Brand adopts an intelligent generation method for sock pattern files based on image processing to accurately obtain the position of the cuffs and the contour of the sock tube, ensuring the accurate generation of the pattern files, thereby improving production efficiency, reducing manual intervention, and improving product consistency and quality.

[0112] First, obtain the front and back standard images of the socks. Specifically, the method for obtaining the front and back standard images is: ensure that the shooting environment light is uniform, and use a high-resolution camera to shoot the front and back standard images of the socks.

[0113] Furthermore, the front and back standard images of the socks are preprocessed to enhance the contrast of different areas; the texture hierarchy analysis method is used to locate the cuff position; the edge contour of the cuff position is gradually adjusted to obtain the precise cuff position, and the size annotation is obtained from it.

[0114] Specifically, the image preprocessing step includes: graying the front and back standard images of the socks, and the graying formula used is: ,in , and Represents the values ​​of the red, green, and blue channels of each pixel in the front and back standard images of the socks, respectively. Represents the grayscale value after conversion. The weights of this formula (0.299, 0.587, 0.114) are based on the sensitivity of the human eye to different colors. Green contributes the most to vision, followed by red, and blue the least. Therefore, green has the highest weight and blue has the lowest weight. Furthermore, histogram equalization is used to make the grayscale distribution of the image as uniform as possible, thereby enhancing the contrast.

[0115] Furthermore, the specific steps of the texture level analysis method are:

[0116] The grayscaled front and back standard images of socks are recorded as , Gao Wei , width is The texture descriptor GLCM is used to capture the texture information in the front and back standard images of the socks to obtain a texture feature map. The formula of the texture descriptor GLCM is as follows:

[0117] ;

[0118] in , and represents the gray level, represents the direction of the pixel pair, represents the distance between pixel pairs, Denotes the Dirac function, and denotes the pixel coordinates in the grayscaled standard images of the front and back of the socks. The above formula is used to capture the spatial relationship and texture features between pixel pairs in the image to obtain the texture feature map , the size is .

[0119] The texture feature map Perform multi-scale processing to obtain a multi-scale feature map. The specific formula used is:

[0120] ;

[0121] in, Indicates Layer images, Indicates Gaussian filtering and downsampling of the image. Indicates the number of scales. Through multi-scale processing, a multi-scale feature map is obtained , each scale contains texture feature information at different resolutions.

[0122] Canny edge detection is used to highlight the boundary areas with significant texture differences in the multi-scale feature map. Specifically, for each scale, the corresponding edge map is obtained. , so we get a multi-scale edge map , and The same size; using an image segmentation algorithm, including but not limited to a watershed algorithm or a threshold segmentation algorithm, segmenting the cuff area to obtain the cuff position of the cuff area .

[0123] Further, the local gradient of the edge area of ​​the cuff position is calculated using the Sobel operator or the Prewitt operator. , based on the local gradient change, determine the edge direction of each pixel The iterative optimization method is used to fine-tune the edge position. The specific method is to calculate an offset for each pixel based on the gradient change in its neighborhood. and , and fine-tune the edge position to obtain the adjusted edge position .

[0124] In each iteration, let the step size of each iteration be For each pixel, use the gradient descent method to calculate the new edge position:

[0125] ;

[0126] in, Represents the number of iterations, the maximum value is ; Represents the error function of edge detection, defined as the difference between the gradient of edge pixels and the image brightness: ,in, represents the error function, represents the adjusted edge position target, Represents the ideal edge position target. The final precise edge position, i.e., the precise cuff position, is obtained through iteration. .

[0127] By the precise cuff position Calculate the size of the sock cuff, specifically, find the two edge points with the largest distance on the cuff edge and , the distance between these two points is the size of the sock opening.

[0128] Furthermore, an automatic threshold segmentation method is used, and according to the precise cuff position, the front and back standard images of the socks are segmented and cropped, the cuffs, heels and toes are removed, the sock area is retained, and the rough outline of the sock area is extracted using brightness difference detection; the local curvature of the rough outline is tracked to adjust the shape of the sock outline; the sock outline is refined by dilation and erosion operations to correct the shape deviation and obtain the front and back sock segmentation images; the refined sock outline is used as the basic path to generate stitching lines and cutting lines.

[0129] Specifically, the automatic threshold segmentation method is used to convert the grayscale values ​​of the front and back standard images of the socks into Set between [0, 255], the pixel distribution of the image is , select a threshold T to maximize the between-class variance :

[0130] ;

[0131] in, and The weights of the foreground (sock tube) and background (sock heel and toe area) are the pixel ratios of the foreground and background respectively:

[0132] , ;

[0133] and Represents the mean of foreground and background respectively:

[0134] , ;

[0135] Find the value The largest , this value is the optimal threshold, which is used to segment the front and back standard images of socks, remove the heel and toe areas of the front and back standard images of socks, and obtain the segmented binary image .

[0136] Define a rectangular frame based on the exact cuff position ,in, , , and The coordinates of the four corners of the precise cuff position are respectively used. The front and back standard images of the socks are cropped using the rectangular frame to retain the sock area. , the formula is .

[0137] In the sock area A local window is defined around each pixel , calculate the brightness difference between each pixel in each local window and the surrounding pixels , the calculation formula is:

[0138] ;

[0139] in, Represents a local window, including surrounding pixels .

[0140] By calculating the average brightness of all pixels in the window, the local window brightness difference value is obtained , using the brightness difference threshold Screening is performed to obtain a rough outline of the sock area , the screening formula is:

[0141] .

[0142] Furthermore, the local curvature of the rough outline is calculated to identify irregular parts. The identification of irregular parts requires setting a threshold to determine. Irregular parts are areas with large curvature values ​​or sharp changes in curvature. The curvature information is used to adjust the local convex and concave areas. The methods used include but are not limited to smoothing functions or interpolation methods. Finally, the adjusted sock outline is obtained. .

[0143] Furthermore, the sock contour is subjected to an erosion operation to remove noise points; and the broken contour edges are connected using an expansion operation to obtain the front and back sock segmentation images.

[0144] Suppose the sock contour point set in the front and back sock segmentation images is ,in, is the number of points. Let the starting point of the suture line be , the end point is . The shortest path is calculated by Dijkstra algorithm to obtain the path point set of the suture line. ,in, Indicates the number of points. The cutting line is above or below the outline of the sock, and generates parallel lines at a certain distance. Set the distance from the bottom of the sock to , translating outward through each point of the parallel contour For each contour point, translate along the vertical direction to obtain the cutting line point set ,in, Indicates the number of points.

[0145] Furthermore, the front and back sock segmentation images are divided into a plurality of sub-regions, and the region is adjusted according to the feature points of the contour of each sub-region, so as to deform the entire region and obtain the front and back sock rectangular images.

[0146] Specifically, an edge detection algorithm is used to extract the outline of the sock from the sock. Extract global information, clarify the boundary of the sock, and form a clear outline ;

[0147] Calculate the gradient difference of the sock outline , specifically including the gradients on both sides of the sock outline boundary, and the calculation formula is:

[0148] ;

[0149] in, Represents the gradient operator.

[0150] According to the gradient The front and back sock segmentation images are divided into sub-regions of corresponding sizes according to the size of , the calculation formula is ,in, represents the gradient threshold, represents the gradient threshold of each sub-region, Indicates the number of sub-regions;

[0151] In each of the sub-regions, the gradient of each point is calculated, and the point with the largest gradient is taken as a feature point to form a feature point set. ,in Represents the number of feature points. The formula for selecting feature points is:

[0152] ;

[0153] Among them, max represents the maximum value; arg represents the argument of the complex number.

[0154] In each of the sub-areas, the distance between the feature points is adjusted and angle , distort each of the sub-regions so that the entire sub-region smoothly transitions to the rectangular boundary. Specifically, the distance between the feature points and angle Make adjustments: ,in, and They are feature points Two points in a set; , where arctan represents the inverse tangent function, and Corresponding points and Point The coordinates of and angle , deform each sub-region to achieve a smooth transition:

[0155] ;

[0156] in, Represents the deformed sub-region information; Indicates smoothing operation; The edge of the sub-region after smoothing is smoothed, and a Gaussian filter or other smoothing algorithm may be used.

[0157] The rectangular boundaries of the sub-regions after the smoothing process are merged.

[0158] During the merging process, the edge information of all the sub-regions is fine-tuned. In this embodiment, filtering techniques are used, including but not limited to Gaussian blur and mean filtering. The pixel values ​​of the merged region are adjusted using a weighted average method to ensure the continuity of the color, brightness and other information of the merged region, and finally the front and back rectangular images of the socks are obtained.

[0159] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for intelligently generating socks plate-making files based on image processing, characterized in that: include: Obtain standard images of the front and back of socks; Performing image preprocessing on the front and back standard images of the socks to enhance the contrast of different areas; Using a texture hierarchy analysis method to locate the cuff position; performing a gradual boundary adjustment on the edge contour of the cuff position to obtain the precise cuff position, and obtaining a dimension annotation therefrom; Using an automatic threshold segmentation method and according to the precise cuff position, the front and back standard images of the socks are segmented and cropped, the cuffs, heels and toes are removed, the sock region is retained, and the rough outline of the sock region is extracted by using brightness difference detection; the local curvature of the rough outline is tracked to adjust the shape of the sock contour; the contour of the sock contour is refined by using expansion and corrosion operations to correct the shape deviation, and the front and back sock segmentation images are obtained; the refined sock contour is used as a basic path to generate stitching lines and cutting lines; The front and back sock segmentation images are divided into a plurality of sub-regions, and the regions are adjusted according to the feature points of the contour of each sub-region, so as to deform the entire region and obtain the front and back sock rectangular images; The specific steps of the texture level analysis method are: Using a texture descriptor to capture texture information in the front and back standard images of the socks to obtain a texture feature map; Performing multi-scale processing on the texture feature map to obtain a multi-scale feature map, and identifying the details of the sock cuffs and the overall outline of the socks; Use Canny edge detection to highlight the boundary area with significant texture difference in the multi-scale feature map to obtain an edge map; segment the cuff area according to the edge information and texture difference in the edge map and the texture feature map to obtain the cuff position of the cuff area; Track the local curvature of the rough outline and adjust the shape of the sock outline. The specific steps are: Calculating the local curvature of the rough outline, identifying irregular parts, and adjusting local convex and concave areas using the curvature information; The front and back sock segmentation images are divided into a plurality of sub-regions, and the regions are adjusted according to the feature points of the contour of each sub-region, so as to deform the entire region and obtain the front and back sock rectangular images. The specific steps are as follows: Extracting global information from the sock outline, clarifying the boundary of the sock, and forming a clear outer frame; Calculating the gradient difference of the sock outline, specifically including the gradients on both sides of the sock outline boundary; dividing the front and back sock segmentation images into sub-regions of corresponding sizes according to the magnitude of the gradient; In each of the sub-regions, the gradient of each point is calculated, and the point with the largest gradient is taken as a feature point; In each of the sub-regions, the distance and angle between the feature points are adjusted, and each of the sub-regions is distorted so that the entire sub-region smoothly transitions to a rectangular boundary; and the edges of the smoothed sub-regions are smoothed.

2. The method for intelligently generating socks plate-making files based on image processing according to claim 1, characterized in that: The method for obtaining the front and back standard images is: ensuring uniform light in the shooting environment, and using a high-resolution camera to shoot the standard images of the front and back of the socks.

3. The method for intelligently generating socks plate-making files based on image processing according to claim 1, characterized in that: The image preprocessing step includes: graying the front and back standard images of the socks; and using histogram equalization to enhance the contrast of different areas.

4. The method for intelligently generating socks plate-making files based on image processing according to claim 1, characterized in that: The specific steps of performing a gradual boundary adjustment on the edge contour of the cuff position to obtain a precise cuff position are as follows: Calculating the local gradient of the edge area of ​​the cuff position, determining the edge direction of each pixel based on the local gradient change, and fine-tuning the edge position using an iterative optimization method; In each iteration, each pixel point in the region is gradually approached to the correct edge position according to the texture, contrast and gradient information of the region, so as to obtain the precise cuff position; The size of the sock opening is calculated through the precise cuff position to obtain the size marking.

5. The method for intelligently generating socks plate-making files based on image processing according to claim 1, characterized in that: Using the automatic threshold segmentation method and according to the precise cuff position, the front and back standard images of the socks are cropped to remove the cuff, the heel and the toe, retain the sock region, and use brightness difference detection to extract the rough outline of the sock region. The specific steps are as follows: Using an automatic threshold segmentation method, segmenting and removing the heel and toe regions of the front and back standard images of the socks; A rectangular frame is defined according to the precise cuff position, the boundary of the rectangular frame is the precise cuff position, and the front and back standard images of the socks are cropped using the rectangular frame to retain the sock barrel area; A local window is defined around each pixel point in the sock region, and a brightness difference value between each pixel in each local window and surrounding pixels is calculated, and the brightness difference value of the local window is obtained by calculating the average brightness value of all pixels in the window; According to all the local window brightness difference values, a brightness difference value threshold is used for screening to obtain a rough outline of the sock region.

6. The method for intelligently generating socks plate-making files based on image processing according to claim 1, characterized in that: The sock contour is subjected to an erosion operation to remove noise points; and the broken contour edges are connected using an expansion operation to obtain the front and back sock segmentation images.

7. The method for intelligently generating socks plate-making files based on image processing according to claim 1, characterized in that: Merging the rectangular boundaries of the sub-regions after smoothing; During the merging process, the edge information of all the sub-regions is fine-tuned to obtain the front and back rectangular images of the socks.

Citation Information

Patent Citations

  • Fluorescence image segmentation method and system for mitochondria and storage medium

    CN118608546A