A cutting line generation method and device
By matching and adjusting the overall and local templates in flexible materials, accurate cutting lines are generated, which solves the problem of inaccurate cutting caused by material deformation in the existing technology, improves cutting accuracy and reduces costs.
Patent Information
- Application Number
- CN201910667543.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-23
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2039-07-23
AI Technical Summary
In the prior art, the pre-generated cutting line template has a fixed shape. When cutting in flexible materials, the material is easily deformed, resulting in inaccurate cutting and poor accuracy of the contour line template.
By acquiring the image of the flexible material, matching the preset overall template and partial template, adjusting the position, angle and size of the template, an accurate cutting line is generated to ensure that the cutting line reflects the true outline of the pattern to be cut.
It achieves the generation of more accurate cutting lines in flexible materials, adapts to material deformation, reduces the cost of producing various deformation templates, and improves cutting accuracy.
Smart Images

Figure CN110781907B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a cutting line generation method and device. Background Art
[0002] In the clothing industry or the shoemaking industry, it is usually necessary to cut a preset shape of clothing or shoe pattern from cloth or other flexible materials. In the existing scheme, a contour template of the clothing or shoe pattern is usually generated in advance, and the corresponding clothing or shoe pattern is cut from the flexible material according to the contour template.
[0003] In the above scheme, the shape of the pre-generated cutting line template is fixed, but flexible materials are generally easy to deform, and the deformation conditions are various. The contour line template is not necessarily the true contour of the clothing or shoe pattern in the flexible material, or the contour line template has poor accuracy, which will lead to inaccurate cutting. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a cutting line generation method and device to generate a more accurate cutting line.
[0005] Based on the above purpose, the present invention provides a cutting line generation method, comprising:
[0006] Acquire an image collected for a flexible material as an image to be processed, wherein the flexible material includes a pattern to be cut;
[0007] Matching a preset overall template with the image to be processed, and determining a matching position in the image to be processed according to the matching result; wherein the overall template is a template generated based on the pattern to be cut;
[0008] Obtaining a contour line when the overall template is located at the matching position as a contour line to be processed;
[0009] Match a preset local template with the image area at the matching position, and adjust the contour line to be processed based on the matching result to obtain a cutting line; wherein the local template is a template generated based on a partial pattern in the pattern to be cut; and the relative position relationship between the local template and the overall template is fixed.
[0010] Optionally, after matching the preset overall template with the image to be processed and determining a matching position in the image to be processed according to the matching result, the method further includes:
[0011] Adjusting the overall template at the matching position until the degree of overlap between the overall template and the image area at the matching position meets a preset condition, thereby obtaining an adjusted overall template;
[0012] Obtaining a contour line when the overall template is located at the matching position as a contour line to be processed, including:
[0013] The adjusted contour line of the overall template is obtained as the contour line to be processed.
[0014] Optionally, the adjusting the overall template at the matching position includes:
[0015] Perform any one or more of the following adjustments on the overall template at the matching position: adjust the position, adjust the angle, and adjust the size.
[0016] Optionally, matching the preset local template with the image area at the matching position, and adjusting the contour line to be processed based on the matching result to obtain the cutting line includes:
[0017] For each local template, the local template is matched with the image area where it is located, and the displacement deviation corresponding to the local template is determined according to the matching result;
[0018] According to the displacement deviation corresponding to each local template, the contour line to be processed is adjusted to obtain a cutting line.
[0019] Optionally, the contour line to be processed includes a plurality of control points; and adjusting the contour line to be processed according to the displacement deviation corresponding to each local template to obtain a cutting line includes:
[0020] For each local template, adjusting the control point corresponding to the local template according to the displacement deviation corresponding to the local template;
[0021] The adjusted control points are smoothed to obtain a cutting line composed of the smoothed control points.
[0022] Optionally, the overall template is generated by the following steps:
[0023] Acquire an image captured for the pattern to be cut as a template image;
[0024] Determine the position of the pattern to be cut in the template image as the position to be processed;
[0025] Based on the position to be processed, determining a region to be processed in the template image;
[0026] Modeling is performed based on the area to be processed to obtain the overall template.
[0027] Optionally, determining the area to be processed in the template image based on the position to be processed includes:
[0028] Generating a frame of a preset shape at the position to be processed; determining the inner area of the frame as the area to be processed;
[0029] Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, and an inner area of the edge line is determined as the area to be processed;
[0030] Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, the edge line is expanded, and an inner area of the expanded edge line is determined as the area to be processed;
[0031] Alternatively, the edge line of the pattern to be cut is identified at the position to be processed, the edge line is retracted, and the inner area of the retracted edge line is determined as the area to be processed.
[0032] Optionally, the local template is generated by the following steps:
[0033] sequentially determining a plurality of local areas in the area to be processed along the control points in the contour line of the overall template;
[0034] Modeling is performed based on each determined local area to obtain multiple local templates.
[0035] Based on the above purpose, the present invention also provides a cutting line generating device, comprising:
[0036] A first acquisition module is used to acquire an image collected from a flexible material as an image to be processed, wherein the flexible material includes a pattern to be cut;
[0037] A first matching module, used for matching a preset overall template with the image to be processed, and determining a matching position in the image to be processed according to the matching result; wherein the overall template is a template generated based on the pattern to be cut;
[0038] An obtaining module, used for obtaining a contour line when the overall template is located at the matching position as a contour line to be processed;
[0039] The second matching module is used to match the preset local template with the image area at the matching position, and adjust the contour line to be processed based on the matching result to obtain a cutting line; wherein the local template is a template generated based on a partial pattern in the pattern to be cut; and the relative position relationship between the local template and the overall template is fixed.
[0040] Optionally, the device further comprises:
[0041] An adjustment module, used for adjusting the overall template at the matching position until the degree of overlap between the overall template and the image area at the matching position meets a preset condition, thereby obtaining an adjusted overall template;
[0042] The obtaining module is specifically used to obtain the contour line of the adjusted overall template as the contour line to be processed.
[0043] Optionally, the adjustment module is specifically used to: perform any one or more of the following adjustments to the overall template at the matching position: adjusting the position, adjusting the angle, and adjusting the size.
[0044] Optionally, the second matching module is specifically used to:
[0045] For each local template, the local template is matched with the image area where it is located, and the displacement deviation corresponding to the local template is determined according to the matching result;
[0046] According to the displacement deviation corresponding to each local template, the contour line to be processed is adjusted to obtain a cutting line.
[0047] Optionally, the second matching module is further used to:
[0048] For each local template, adjusting the control point corresponding to the local template according to the displacement deviation corresponding to the local template;
[0049] The adjusted control points are smoothed to obtain a cutting line composed of the smoothed control points.
[0050] Optionally, the device further comprises:
[0051] A second acquisition module is used to acquire an image collected for the pattern to be cut as a template image;
[0052] A first determining module is used to determine the position of the pattern to be cut in the template image as a position to be processed;
[0053] A second determination module, configured to determine a region to be processed in the template image based on the position to be processed;
[0054] The first modeling module is used to perform modeling based on the area to be processed to obtain the overall template.
[0055] Optionally, the second determining module is specifically configured to:
[0056] Generating a frame of a preset shape at the position to be processed; determining the inner area of the frame as the area to be processed;
[0057] Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, and an inner area of the edge line is determined as the area to be processed;
[0058] Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, the edge line is expanded, and an inner area of the expanded edge line is determined as the area to be processed;
[0059] Alternatively, the edge line of the pattern to be cut is identified at the position to be processed, the edge line is retracted, and the inner area of the retracted edge line is determined as the area to be processed.
[0060] Optionally, the device further comprises:
[0061] A third determination module is used to sequentially determine a plurality of local areas in the area to be processed along the control points in the contour line of the overall template;
[0062] The second modeling module is used to perform modeling based on each determined local area to obtain multiple local templates.
[0063] By applying the embodiment shown in the present invention, an overall template and a local template are generated in advance, the overall template is a template generated based on the pattern to be cut, and the local template is a template generated based on a part of the pattern to be cut; the overall template is matched with the image, and the matching position in the image is determined according to the matching result, and the contour line when the overall template is located at the matching position is obtained as the contour line to be processed; the image area at the matching position can be understood as the pattern to be cut, and the image area is matched with the local template, and the contour line to be processed is adjusted based on the matching result to obtain the cutting line; it can be seen that in this scheme, the contour line template is not generated in advance, but a cutting line that matches the pattern to be cut in the image is generated through two template matchings. Even if the flexible material is deformed, the cutting line still reflects the contour of the pattern to be cut, so this scheme generates a more accurate cutting line. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0065] Figure 1 A schematic diagram of a first flow chart of a cutting line generation method provided by an embodiment of the present invention;
[0066] Figure 2 A schematic diagram of a template provided by an embodiment of the present invention;
[0067] Figure 3 A second flow chart of the cutting line generation method provided by an embodiment of the present invention;
[0068] Figure 4 A third flow chart of the cutting line generation method provided by an embodiment of the present invention;
[0069] Figure 5 A schematic structural diagram of a cutting line generating device provided by an embodiment of the present invention;
[0070] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0072] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0073] In order to solve the above technical problems, an embodiment of the present invention provides a cutting line generation method and device, which can be applied to various electronic devices, such as image processing devices, cutting devices, etc., without specific limitation. The cutting line generation method provided by the embodiment of the invention is first introduced below.
[0074] Figure 1 A first flow chart of a cutting line generation method provided by an embodiment of the present invention includes:
[0075] S101: Acquire an image collected from a flexible material as an image to be processed, wherein the flexible material includes a pattern to be cut.
[0076] For example, the flexible material may be a material for making clothes. In this case, the pattern to be cut may be a pattern of clothes that needs to be cut out. The flexible material may include multiple clothes patterns, and multiple clothes patterns can be cut out from the flexible material. To give another example, the flexible material may also be a material for making shoes. In this case, the pattern to be cut may be a shoe pattern, and multiple shoe patterns can be cut out from the flexible material. Alternatively, the flexible material may also include a pattern to be cut, and the number of patterns to be cut is not limited. The image to be processed is an image collected for the flexible material, and the image to be processed may also include one or more patterns to be cut.
[0077] S102: Matching a preset overall template with the image to be processed, and determining a matching position in the image to be processed according to the matching result; wherein the overall template is a template generated based on the pattern to be cut.
[0078] It can be understood that the image to be processed includes one or more patterns to be cut, and the overall template is a template generated based on the patterns to be cut, so the overall template can successfully match the patterns to be cut in the image to be processed. The matching position determined in S102 can be understood as the position of the pattern to be cut in the image.
[0079] S102 can be understood as rough positioning. For example, the matching position of the overall template can be determined in the image to be processed by controlling the matching similarity. In other words, a matching condition can be set in advance. If the similarity between the image area at a certain position and the overall template meets the matching condition, the position is determined as the matching position.
[0080] In the embodiment shown in the present invention, the overall template is generated in advance. In one implementation, the overall template can be generated by the following steps:
[0081] Acquire an image captured for the pattern to be cut as a template image;
[0082] Determine the position of the pattern to be cut in the template image as the position to be processed;
[0083] Based on the position to be processed, determining a region to be processed in the template image;
[0084] Modeling is performed based on the area to be processed to obtain the overall template.
[0085] In order to distinguish the description, the image used when generating the template is called the template image, and the image used when generating the cutting line is called the to-be-processed image.
[0086] In one case, the template image may include a pattern to be cut. The position of the pattern in the template image may be detected by a target detection algorithm or a feature recognition algorithm. For the convenience of description, the position is referred to as the position to be processed. For example, based on the position to be processed, the area to be processed in the template image may be determined in a variety of ways:
[0087] In the first method, a frame of a preset shape is generated at the position to be processed, and the inner area of the frame is determined as the area to be processed. The frame of the preset shape can be a rectangular frame, a circular frame, an elliptical frame, etc., and the specific shape is not limited.
[0088] In one embodiment, the frame of the preset shape may be slightly larger than the pattern to be cut, so that the inner area of the frame (i.e., the area to be processed) also includes some background areas. In some cases, the background area in the template image has little effect on the pattern to be cut, so that even if the area to be processed includes the background area, the accuracy of the template modeled based on the area to be processed is less affected by the background area.
[0089] In another embodiment, the frame of the preset shape may be slightly smaller than the pattern to be cut, so that the inner area of the frame (i.e., the area to be processed) may not include the edge of the pattern to be cut. In some cases, the edge of the pattern to be cut has little effect on the pattern to be cut, so that even if the area to be processed does not include the edge of the pattern to be cut, the accuracy of the template modeled based on the area to be processed is less affected by the background area.
[0090] For example, if more attention is needed to the edge features of the pattern, a frame that completely contains the pattern (larger than the pattern) can be generated, and the area inside the frame is used as the area to be processed. If the edge features of the pattern are not needed to be paid attention to, a frame that is smaller than the pattern can be generated, and the area inside the frame is used as the area to be processed.
[0091] In a second manner, an edge line of the pattern to be cut is identified at the position to be processed, and an inner area of the edge line is determined as the area to be processed.
[0092] In a third manner, an edge line of the pattern to be cut is identified at the position to be processed, the edge line is expanded, and an inner area of the expanded edge line is determined as the area to be processed.
[0093] In this method, the area to be processed also includes some background areas. In some cases, the background areas in the template image have little effect on the pattern to be cut, so that even if the area to be processed includes the background areas, the accuracy of the template modeled based on the area to be processed is less affected by the background areas.
[0094] In a fourth manner, the edge line of the pattern to be cut is identified at the position to be processed, the edge line is retracted, and the inner area of the retracted edge line is determined as the area to be processed.
[0095] In this method, the area to be processed may not include the edge of the pattern to be cut. In some cases, the edge of the pattern to be cut has little effect on the pattern to be cut, so that even if the area to be processed does not include the edge of the pattern to be cut, the accuracy of the template modeled based on the area to be processed is less affected by the background area.
[0096] For example, if you need to pay more attention to the edge features of the pattern, you can expand the edge line of the pattern, and determine the inner area of the expanded edge line as the area to be processed. If you do not need to pay attention to the edge features of the pattern, you can shrink the edge line of the pattern, and determine the inner area of the shrunk edge line as the area to be processed.
[0097] Modeling is performed based on the area to be processed. In one case, modeling can be performed based on various features such as image features and edge features of the area to be processed, so that the overall template can include the contour information and content information of the pattern. Alternatively, in another case, modeling can be performed based only on the edge features of the area to be processed, so that the overall template can include the contour information of the pattern.
[0098] S103: Obtaining the contour line when the whole template is located at the matching position as the contour line to be processed.
[0099] The matching position determined in S102 can be understood as superimposing the overall template on the matching position, and the overall template overlaps with the image area at the matching position. As mentioned above, the similarity between the image area at the matching position and the overall template meets the matching condition, and the image area at the matching position can be understood as the image area where the pattern to be cut is located. In this case, the contour line of the overall template is used as the contour line to be processed, and the contour line to be processed can be understood as the rough contour line of the pattern to be cut, or the contour line that needs further adjustment.
[0100] In one embodiment, after S102, the overall template at the matching position can be adjusted until the degree of overlap between the overall template and the image area at the matching position meets a preset condition, thereby obtaining an adjusted overall template; in this way, S103 may include: obtaining the contour line of the adjusted overall template as the contour line to be processed.
[0101] As described above, S102 can be understood as rough positioning. If the contour line is generated directly based on the rough positioning result, the accuracy of the contour line is low, and the workload of adjusting the contour line to the cutting line is large. In this embodiment, the rough positioning result is adjusted first, and then the contour line is generated. The above preset condition can be greater than the set overlap threshold, that is, in this embodiment, the overall template is adjusted to improve the overlap between the overall template and the image area at the matching position.
[0102] For example, the overall template at the matching position may be adjusted by any one or more of the following: adjusting the position, adjusting the angle, and adjusting the size. After the rough positioning in S102, the overall template at the matching position may be adjusted by translation, rotation, scaling, etc. to improve the overlap between the overall template and the image area at the matching position, that is, to improve the overlap between the overall template and the pattern to be cut in the image.
[0103] For example, assuming that the flexible material is a material for making shoes, and the flexible material includes multiple shoe patterns. In some cases, the rotation angles of the shoe patterns are different, so as to reasonably use the flexible material and reduce material waste; in some cases, the sizes of the shoe patterns are also different, so as to make shoes of different sizes. Assuming that the initial rotation angle of the overall template is 0, the initial size corresponds to a size 39 shoe, the overall template in S102 successfully matches the pattern A to be cut in the image, the rotation angle of the pattern A to be cut is 60 degrees, and the pattern A to be cut corresponds to a size 40 shoe, in this way, the overall template can be rotated and enlarged to make the overall template and the pattern A to be cut have a higher degree of overlap, and then the contour line of the overall template is obtained.
[0104] S104: Matching a preset local template with the image area at the matching position, adjusting the contour line to be processed based on the matching result to obtain a cutting line; wherein the local template is a template generated based on a partial pattern in the pattern to be cut; and the relative position relationship between the local template and the overall template is fixed.
[0105] As described above, the image area at the matching position can be understood as the image area where the pattern to be cut is located, and the local template is a template generated based on a part of the pattern to be cut, so the local template can successfully match a part of the image area at the matching position.
[0106] In one of the above implementations, the overall template is adjusted to improve the degree of overlap between the overall template and the image area at the matching position, while the position and angle of the local template in the overall template are fixed, so the local template is also adjusted accordingly. For example, the overall template is rotated 5 degrees clockwise, the local template is also rotated 5 degrees clockwise, the overall template is scaled 1.5 times, the local template is also scaled 1.5 times, and so on.
[0107] In the embodiment shown in the present invention, a local template is generated in advance. In one implementation, the local template can be generated by the following steps: along the control points in the contour line of the overall template, a plurality of local areas are determined in sequence in the area to be processed; and modeling is performed based on each determined local area to obtain a plurality of local templates.
[0108] refer to Figure 2 , Figure 2 The outermost frame of the middle pattern can be understood as the overall template. Figure 2 The various small boxes in the can be understood as various local templates. Figure 2The hollow dots in the figure can be understood as control points in the outline of the overall template. Some rules can be set around the control points. For example, a rectangular area with a specified length or width centered on the control point can be used as a local area, or a circular area with a specified radius centered on the control point can be used as a local area, and so on. The specific rules are not limited. The outline of the local area can be a rectangle, a circle, a trapezoid, etc., and the specific shape is not limited. You can select a local area around each control point, or you can select some control points and select local areas around these control points. The specific method of selecting control points is not limited. Then, modeling is performed based on the local area to obtain a local template.
[0109] In one case, modeling can be performed based on various features such as image features and edge features of a local area, so that the local template can include contour information and content information of the pattern. Alternatively, in another case, modeling can be performed based only on edge features of a local area, so that the local template can include contour information of the pattern.
[0110] In one implementation, multiple local templates may be matched with the image area at the matching position. In this case, S104 may include: for each local template, matching the local template with the image area at its position, and determining the displacement deviation corresponding to the local template based on the matching result; and adjusting the contour line to be processed based on the displacement deviation corresponding to each local template to obtain a cutting line.
[0111] For example, assuming that the displacement deviation corresponding to local template 1 is 4 pixels to the left, it can be understood that the overlap between local template 1 and the image area is the highest after it is moved 4 pixels to the left. In this case, the contour image to be processed at the location of local template 1 can be shifted 4 pixels to the left to obtain a more accurate cutting line.
[0112] This embodiment can be understood as a more detailed adjustment of the contour line obtained in S103, and the adjusted contour line (that is, the cutting line) can reflect the detail part of the pattern to be cut in the image (the image area part corresponding to the local template).
[0113] In one embodiment, the contour line to be processed includes multiple control points; for each local template, the control points corresponding to the local template can be adjusted according to the displacement deviation corresponding to the local template; the adjusted control points are smoothed to obtain a cutting line composed of the smoothed control points.
[0114] As mentioned above, the area around the control point can be used as a local area, and a local template can be generated based on the local area; assuming that local template 1 is generated based on the area around control point 1, and assuming that the displacement deviation corresponding to local template 1 is: 4 pixels to the left. This can be understood as: the local template 1 has the highest degree of overlap with the image area after moving 4 pixels to the left. In this case, control point 1 can be offset 4 pixels to the left. The control point can be understood as the point that controls the generation of the contour line. Each control point constitutes the contour line. Adjusting the control point is to adjust the contour line.
[0115] In this embodiment, after the control points are adjusted, they are smoothed, so that the obtained cutting line has better smoothness. When a pattern is cut from a flexible material based on the cutting line, the tool is less likely to get stuck.
[0116] After the cutting line is obtained in S104, the cutter can cut a pattern from the flexible material according to the cutting line to obtain a certain shape of clothing or shoe pattern, etc. The cutter can be a laser cutter or other types of cutters, which are not specifically limited.
[0117] By applying the embodiment shown in the present invention, an overall template and a local template are generated in advance, the overall template is a template generated based on the pattern to be cut, and the local template is a template generated based on a part of the pattern to be cut; the overall template is matched with the image, and the matching position in the image is determined according to the matching result, and the contour line when the overall template is located at the matching position is obtained as the contour line to be processed; the image area at the matching position can be understood as the pattern to be cut, and the image area is matched with the local template, and the contour line to be processed is adjusted based on the matching result to obtain the cutting line; it can be seen that in this scheme, the contour line template is not generated in advance, but a cutting line that matches the pattern to be cut in the image is generated through two template matchings. Even if the flexible material is deformed, the cutting line still reflects the contour of the pattern to be cut, so this scheme generates a more accurate cutting line.
[0118] Since flexible materials are generally easy to deform, in some related solutions, various deformed contour templates are pre-generated, and corresponding clothing or shoe patterns are cut out from the flexible materials based on the deformed contour templates. However, the deformation of flexible materials varies. If this solution is adopted, various templates need to be pre-generated, which is costly. In this solution, the overall template and the local template are pre-generated, which reduces the cost compared to producing various deformed templates.
[0119] Figure 3 A second flow chart of the cutting line generation method provided by the embodiment of the present invention includes:
[0120] Step 301: making an overall template of the pattern to be cut, and making a local template for at least one local area of the pattern to be cut;
[0121] Step 302: taking a picture of the flexible material currently containing the pattern to be cut;
[0122] Step 303: superimpose the whole template on the captured image to perform position matching to match the pattern to be cut in the image;
[0123] Step 304: superimpose the local template on the captured image for position matching, match it to the local area of the pattern to be cut in the image, and adjust the local contour so that the local template matches the edge of the local area of the pattern to be cut;
[0124] Step 305: Smoothing the contour line of the overall template and the contour line of the adjusted local template to obtain a cutting line of the pattern to be cut on the flexible material.
[0125] In the embodiment shown in the present invention, a rough contour line is obtained based on the overall template, and then the rough contour line is adjusted based on the local template to obtain a cutting line; the specific implementation method can be Figure 3 In the process, the contour line of the overall template and the contour line of the adjusted local template are fused and smoothed to obtain the cutting line.
[0126] Figure 3 In the embodiment, the local contour is adjusted first, and then the contour line of the overall template is merged with the contour line of the adjusted local template. This is equivalent to the above-mentioned implementation method, in which, for each local template, the local template is matched with the image area where it is located, and the displacement deviation corresponding to the local template is determined according to the matching result; according to the displacement deviation corresponding to each local template, the contour line to be processed is adjusted to obtain the cutting line.
[0127] Optionally, step 303 may include:
[0128] The model searches the overall template, preliminarily matches the pattern position, and makes appropriate adjustments by controlling the similarity of matching the overall template pattern to achieve relatively stable coarse positioning. The model search is explained as follows: the template is modeled based on the image area, and the template may include the contour information and content information of the pattern. Matching the template in the image means matching the contour information and content information of the template.
[0129] Alternatively, the overall template is searched for contours, the pattern position is preliminarily matched, and appropriate adjustments are made by controlling the similarity of matching the overall template to achieve relatively stable coarse positioning. Contour search is explained as follows: the template includes the contour information of the pattern, and matching the template in the image is the contour information of the matching template.
[0130] Optionally, step 304 may include:
[0131] Hierarchical search of local templates: by grading the overall template to the local template, translating and rotating the local template to the candidate position of the overall template, the local template inside the template will fall on the roughly located target position, matching the levels of the local templates one by one, and finding the optimal matching position;
[0132] Alternatively, feature-independent search of local templates is performed. The local template is translated and rotated to the candidate position of the overall template through feature search of patterns near the local template. The local template inside the template will fall at the target position after rough positioning. The patterns near the corresponding positions of the local template are matched one by one to find the optimal matching position.
[0133] Alternatively, the local template is directly searched, translated and rotated to the candidate position of the overall template, and the local template inside the template will fall at the target position after rough positioning. The local template is directly searched to find the optimal matching position.
[0134] Optionally, in the process of feature-inhomogeneous search for local templates, an image in a certain area can be selected as a feature area for template matching, such as selecting a feature area by a rectangular frame, selecting a feature area by a contour line, or forming a feature area based on the expansion / contraction of a contour line.
[0135] Optionally, the local template may be located inside or outside the overall template, and the local template may be arranged in a rectangular arrangement or a trapezoidal arrangement, and the specific arrangement is not limited.
[0136] Optionally, the features of the global template and the local template may be expressed by a cubic spline function.
[0137] Figure 4 A third flow chart of a cutting line generation method provided by an embodiment of the present invention includes:
[0138] Step 401: first obtain an image of clothing material and display it in a CAD (Computer Aided Design) software interactive environment;
[0139] Step 402: Load the contour line into the CAD environment;
[0140] Step 403: aligning the contour line and the pattern;
[0141] Step 404: Select one or more image regions as feature regions for template matching;
[0142] Step 405: Establishing an overall template based on the feature region;
[0143] In step 404, the entire area of the pattern can be used as a feature area, and the overall template of the pattern can be established based on the feature area. In step 404, the pattern can also be divided into multiple areas, and these areas are used as multiple feature areas, and the overall template of the pattern can also be established based on these feature areas.
[0144] Step 406: The control points along the contour (e.g., the control points of the spline function) are divided into small areas according to certain rules, such as symmetrical width and length, to obtain local templates, and the positions of the control points and the positions of the local templates falling in these small areas are recorded;
[0145] Step 407: storing the overall template and the local template;
[0146] Figure 4 In the illustrated embodiment, the local template is a part of the overall template.
[0147] Step 408: The camera captures an image of the flexible material to be positioned;
[0148] Step 409: Search the whole image for the overall template and preliminarily match the pattern position. By controlling the matching similarity and making appropriate adjustments, a relatively stable rough positioning (x, y, θ) can be achieved; x and y represent the horizontal and vertical coordinates in the image coordinate system, and θ represents the rotation angle.
[0149] Step 410: Translate and rotate (if necessary, scale) the template to the candidate position; the local template will fall on the candidate position after rough positioning;
[0150] Step 411: Match the patterns of the local templates near the corresponding positions one by one to find the best matching position;
[0151] Step 412: Based on the matching result of the local template, the contour of the overall template is fused and smoothed;
[0152] Step 413: Obtain the processed contour as a cutting line.
[0153] Optionally, step 409 may include:
[0154] The model searches the overall template, preliminarily matches the pattern position, and makes appropriate adjustments by controlling the similarity of matching the overall template pattern to achieve relatively stable coarse positioning. The model search is explained as follows: the template is modeled based on the image area, and the template may include the contour information and content information of the pattern. Matching the template in the image means matching the contour information and content information of the template.
[0155] Alternatively, the overall template is searched by contour, the pattern position is preliminarily matched, and appropriate adjustments are made by controlling the similarity of matching the overall template contour to achieve relatively stable coarse positioning. In this embodiment, the overall template is searched by model. Contour search is explained as follows: the template includes the contour information of the pattern, and matching the template in the image is the contour information of the matching template.
[0156] Optionally, the manner in which the local template in step 410 and step 411 matches the local edge of the pattern to be cut may include:
[0157] Hierarchical search of local templates: by grading the overall template to the local template, translating and rotating the local template to the candidate position of the overall template, the local template inside the template will fall on the roughly located target position, matching the levels of the local templates one by one, and finding the optimal matching position;
[0158] Alternatively, feature-independent search of local templates is performed. The local template is translated and rotated to the candidate position of the overall template through feature search of patterns near the local template. The local template inside the template will fall at the target position after rough positioning. The patterns near the corresponding positions of the local template are matched one by one to find the optimal matching position.
[0159] Alternatively, the local template is directly searched, translated and rotated to the candidate position of the overall template, and the local template inside the template will fall at the target position after rough positioning. The local template is directly searched to find the optimal matching position.
[0160] Optionally, in the process of feature-inhomogeneous search for local templates, an image in a certain area can be selected as a feature area for template matching, such as selecting a feature area by a rectangular frame, selecting a feature area by a contour line, or forming a feature area based on the expansion / contraction of a contour line.
[0161] Optionally, the local template may be located inside or outside the overall template, and the local template may be arranged in a rectangular arrangement or a trapezoidal arrangement, and the specific arrangement is not limited.
[0162] Optionally, the features of the global template and the local template may be expressed by a cubic spline function.
[0163] It can be seen from the above embodiments that, by performing secondary correction based on the local features around the contour after preliminary matching, more accurate positioning of the elastic deformation of the contour can be achieved to meet the high-precision requirements of high-end brands and increase user favorability.
[0164] Corresponding to the above method embodiment, the embodiment of the present invention further provides a cutting line generating device, such as Figure 5 As shown, including:
[0165] A first acquisition module 501 is used to acquire an image collected from a flexible material as an image to be processed, wherein the flexible material includes a pattern to be cut;
[0166] A first matching module 502 is used to match a preset overall template with the image to be processed, and determine a matching position in the image to be processed according to the matching result; wherein the overall template is a template generated based on the pattern to be cut;
[0167] An acquisition module 503 is used to obtain a contour line when the whole template is located at the matching position as a contour line to be processed;
[0168] The second matching module 504 is used to match the preset local template with the image area at the matching position, and adjust the contour line to be processed based on the matching result to obtain a cutting line; wherein the local template is a template generated based on a partial pattern in the pattern to be cut; and the relative position relationship between the local template and the overall template is fixed.
[0169] As an embodiment, the device further includes:
[0170] An adjustment module (not shown in the figure), used to adjust the overall template at the matching position until the degree of overlap between the overall template and the image area at the matching position meets a preset condition, thereby obtaining an adjusted overall template;
[0171] The obtaining module 503 is specifically used to obtain the contour line of the adjusted overall template as the contour line to be processed.
[0172] As an implementation mode, the adjustment module is specifically used to: perform any one or more of the following adjustments to the overall template at the matching position: adjusting the position, adjusting the angle, and adjusting the size.
[0173] As an implementation manner, the second matching module 504 is specifically used for:
[0174] For each local template, the local template is matched with the image area where it is located, and the displacement deviation corresponding to the local template is determined according to the matching result;
[0175] According to the displacement deviation corresponding to each local template, the contour line to be processed is adjusted to obtain a cutting line.
[0176] As an implementation manner, the second matching module 504 is further configured to:
[0177] For each local template, adjusting the control point corresponding to the local template according to the displacement deviation corresponding to the local template;
[0178] The adjusted control points are smoothed to obtain a cutting line composed of the smoothed control points.
[0179] As an implementation mode, the device further includes: a second acquisition module, a first determination module, a second determination module and a first modeling module (not shown in the figure), wherein:
[0180] A second acquisition module is used to acquire an image collected for the pattern to be cut as a template image;
[0181] A first determining module is used to determine the position of the pattern to be cut in the template image as a position to be processed;
[0182] A second determination module, configured to determine a region to be processed in the template image based on the position to be processed;
[0183] The first modeling module is used to perform modeling based on the area to be processed to obtain the overall template.
[0184] As an implementation manner, the second determining module is specifically configured to:
[0185] Generating a frame of a preset shape at the position to be processed; determining the inner area of the frame as the area to be processed;
[0186] Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, and an inner area of the edge line is determined as the area to be processed;
[0187] Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, the edge line is expanded, and an inner area of the expanded edge line is determined as the area to be processed;
[0188] Alternatively, the edge line of the pattern to be cut is identified at the position to be processed, the edge line is retracted, and the inner area of the retracted edge line is determined as the area to be processed.
[0189] As an implementation mode, the device further includes: a third determination module and a second modeling module (not shown in the figure), wherein:
[0190] A third determination module is used to sequentially determine a plurality of local areas in the area to be processed along the control points in the contour line of the overall template;
[0191] The second modeling module is used to perform modeling based on each determined local area to obtain multiple local templates.
[0192] The apparatus of the above-mentioned embodiment is used to implement the corresponding method in the above-mentioned embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0193] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a memory 602, a processor 601, and a computer program stored in the memory 602 and executable on the processor 601. When the processor 601 executes the program, any of the above-mentioned cutting line generation methods is implemented.
[0194] The electronic device may be an image processing device, a cutting device, etc., without any specific limitation.
[0195] An embodiment of the present invention further provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute any of the above-mentioned cutting line generation methods.
[0196] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Within the scope of the present invention, the above embodiments or technical features in different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity.
[0197] In addition, to simplify the description and discussion, and in order not to obscure the present invention, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the devices may be shown in the form of block diagrams to avoid obscuring the present invention, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the present invention will be implemented (i.e., these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present invention, it will be apparent to those skilled in the art that the present invention may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0198] Although the invention has been described in conjunction with specific embodiments of the invention, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0199] The embodiments of the present invention are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A cutting line generation method, characterized in that: include: Acquire an image collected for a flexible material as an image to be processed, wherein the flexible material includes a pattern to be cut; Matching a preset overall template with the image to be processed, and determining a matching position in the image to be processed according to the matching result, including: determining the matching position of the overall template in the image to be processed by controlling the matching similarity; wherein the overall template is a template generated based on the pattern to be cut; and the matching position is the position of the pattern to be cut in the image; Obtaining a contour line when the overall template is located at the matching position as a contour line to be processed; Matching a preset local template with the image area at the matching position, and adjusting the contour line to be processed based on the matching result to obtain a cutting line, including: for each local template, matching the local template with the image area at its position, and determining the displacement deviation corresponding to the local template according to the matching result; adjusting the contour line to be processed according to the displacement deviation corresponding to each local template to obtain a cutting line; wherein the local template is a template generated based on a partial pattern in the pattern to be cut; and the relative position relationship between the local template and the overall template is fixed; The method further comprises: generating the overall template by the following steps: Acquire an image captured for the pattern to be cut as a template image; Determine the position of the pattern to be cut in the template image as the position to be processed; Based on the position to be processed, determining a region to be processed in the template image; Modeling is performed based on the area to be processed to obtain the overall template; The method further comprises: generating the local template by the following steps: sequentially determining a plurality of local areas in the area to be processed along the control points in the contour line of the overall template; Modeling is performed based on each determined local area to obtain multiple local templates.
2. The method according to claim 1, characterized in that After matching the preset overall template with the image to be processed and determining the matching position in the image to be processed according to the matching result, the method further includes: Adjusting the overall template at the matching position until the degree of overlap between the overall template and the image area at the matching position meets a preset condition, thereby obtaining an adjusted overall template; Obtaining a contour line when the overall template is located at the matching position as a contour line to be processed, including: The adjusted contour line of the overall template is obtained as the contour line to be processed.
3. The method according to claim 2, characterized in that The adjusting the overall template at the matching position includes: Perform any one or more of the following adjustments on the overall template at the matching position: adjust the position, adjust the angle, and adjust the size.
4. The method according to claim 1, characterized in that: The contour line to be processed includes a plurality of control points; the contour line to be processed is adjusted according to the displacement deviation corresponding to each local template to obtain a cutting line, including: For each local template, adjusting the control point corresponding to the local template according to the displacement deviation corresponding to the local template; The adjusted control points are smoothed to obtain a cutting line composed of the smoothed control points.
5. The method according to claim 1, characterized in that: The step of determining a region to be processed in the template image based on the position to be processed includes: Generating a frame of a preset shape at the position to be processed; determining the inner area of the frame as the area to be processed; Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, and an inner area of the edge line is determined as the area to be processed; Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, the edge line is expanded, and an inner area of the expanded edge line is determined as the area to be processed; Alternatively, the edge line of the pattern to be cut is identified at the position to be processed, the edge line is retracted, and the inner area of the retracted edge line is determined as the area to be processed.
6. The method according to claim 1, characterized in that The local template is generated by the following steps: sequentially determining a plurality of local areas in the area to be processed along the control points in the contour line of the overall template; Modeling is performed based on each determined local area to obtain multiple local templates.
7. A cutting line generating device, characterized in that: include: A first acquisition module is used to acquire an image collected from a flexible material as an image to be processed, wherein the flexible material includes a pattern to be cut; A first matching module, used for matching a preset overall template with the image to be processed, and determining a matching position in the image to be processed according to the matching result, comprising: determining a matching position of the overall template in the image to be processed by controlling a matching similarity; wherein the overall template is a template generated based on the pattern to be cut; An obtaining module, used for obtaining a contour line when the overall template is located at the matching position as a contour line to be processed; The second matching module is used to match the preset local template with the image area at the matching position, and adjust the contour line to be processed based on the matching result to obtain the cutting line, including: for each local template, matching the local template with the image area at its position, and determining the displacement deviation corresponding to the local template according to the matching result; adjusting the contour line to be processed according to the displacement deviation corresponding to each local template to obtain the cutting line; wherein the local template is a template generated based on a partial pattern in the pattern to be cut; and the relative position relationship between the local template and the overall template is fixed; The device also includes: A second acquisition module is used to acquire an image collected for the pattern to be cut as a template image; A first determining module is used to determine the position of the pattern to be cut in the template image as a position to be processed; A second determination module, configured to determine a region to be processed in the template image based on the position to be processed; A first modeling module, used for modeling based on the area to be processed to obtain the overall template; The second matching module is further used for: The local template generation module is configured to determine multiple local areas in the area to be processed in sequence along the control points in the contour line of the overall template; and to perform modeling based on each determined local area to obtain multiple local templates.
8. The device according to claim 7, characterized in that The device also includes: An adjustment module, used for adjusting the overall template at the matching position until the degree of overlap between the overall template and the image area at the matching position meets a preset condition, thereby obtaining an adjusted overall template; The obtaining module is specifically used to obtain the contour line of the adjusted overall template as the contour line to be processed.
9. The device according to claim 8, characterized in that The adjustment module is specifically used to perform any one or more of the following adjustments on the overall template at the matching position: adjusting the position, adjusting the angle, and adjusting the size.
10. The device according to claim 7, characterized in that The second matching module is further used for: For each local template, adjusting the control point corresponding to the local template according to the displacement deviation corresponding to the local template; The adjusted control points are smoothed to obtain a cutting line composed of the smoothed control points.
11. The device according to claim 7, characterized in that The second determining module is specifically used to: Generating a frame of a preset shape at the position to be processed; determining the inner area of the frame as the area to be processed; Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, and an inner area of the edge line is determined as the area to be processed; Alternatively, an edge line of the pattern to be cut is identified at the position to be processed, the edge line is expanded, and an inner area of the expanded edge line is determined as the area to be processed; Alternatively, the edge line of the pattern to be cut is identified at the position to be processed, the edge line is retracted, and the inner area of the retracted edge line is determined as the area to be processed.
12. The device according to claim 7, characterized in that The device also includes: A third determination module is used to sequentially determine a plurality of local areas in the area to be processed along the control points in the contour line of the overall template; The second modeling module is used to perform modeling based on each determined local area to obtain multiple local templates.
Citation Information
Patent Citations
Three-dimensional wall sticker
CN102501714A
Cutting tool bit with visual identification and location and its implementation method
CN107433628A
