Disclosure of Invention
The pattern correction method, the pattern correction device, the electronic equipment and the storage medium provided by the application are used for correcting the pattern aiming at the problems of uneven needle point data and the like in the pattern generated by the existing plate making software or other software, and the corrected pattern is suitable for a sewing technology or a sewing method with special requirements on the pattern. The accuracy and the efficiency of pattern correction are high, and the requirements of actual sewing production can be met.
In a first aspect, a pattern correction method includes: screening target needle points in the patterns according to preset indexes; determining target needle point sections in the pattern and a leading section and a trailing section of each target needle point section according to the target needle points, and combining the leading section, the target needle point sections and the trailing section into a section to be corrected; and determining the corrected coordinates of the needle points in the section to be corrected according to the probability distribution of the coordinate difference between the coordinates of the needle points in the section to be corrected and the coordinates after correction.
Further, the preset index includes a discrete second derivative, and the definition of the discrete second derivative includesh is the distance between two adjacent needle points.
Further, the starting point and the ending point of the target needle point section are the target needle points, and the distance between any two adjacent target needle points in the target needle point section does not exceed the set distance.
Further, the determining the target needle point segment in the pattern according to the target needle point includes:
traversing the needle points in the pattern according to the numbers, and finding out the target needle point with the minimum number;
searching whether other target needle points exist in all needle points with the number being smaller than that of the reference needle point and the distance between the target needle point and the reference needle point not exceeding a set threshold value by taking the target needle point with the smallest number as the reference needle point, and continuously searching by taking the target needle point with the largest number as a new reference needle point if the other target needle points exist until the other target needle points cannot be found;
and taking the target needle point with the smallest number in all the found target needle points as the starting point of the target needle point section, and taking the target needle point with the largest number as the ending point of the target needle point section.
Further, the needle point with the largest number in the preceding segment is adjacent to the start point of the target needle point segment, and the needle point with the smallest number in the following segment is adjacent to the end point of the target needle point segment.
Further, the merging the preamble section, the target needle point section and the subsequent section into the section to be corrected includes:
if the number of the needle points with the number smaller than the starting point number of the target needle point section is smaller than the number of the needle points of the preset preamble section, all the needle points with the number smaller than the starting point of the target needle point section are incorporated into the preamble section; and/or the number of the groups of groups,
if the number of the needle points with the number larger than the end point number of the target needle point section is smaller than the number of the needle points of the preset subsequent section, all the needle points with the number larger than the end point number of the target needle point section are brought into the subsequent section; and/or the number of the groups of groups,
and if the two sections to be corrected are overlapped or adjacent, merging the two sections to be corrected into one section to be corrected.
Further, the coordinate difference between the coordinates before correction and the coordinates after correction of the needle point is subjected to N (0, sigma) 2 )。
In a second aspect, the present application provides an apparatus for correcting a pattern, comprising: a point screening device, a segment confirmation device and a point correction device; the point screening device is used for screening target needle points in the patterns according to preset indexes; the segment confirmation device is used for determining target needle point segments in the pattern and a leading segment and a trailing segment of each target needle point segment according to the target needle points, and combining the leading segment, the target needle point segments and the trailing segment into a segment to be corrected; the point correction device is used for determining corrected coordinates of the needle points in the section to be corrected according to probability distribution of coordinate difference values of the coordinates before correction and the coordinates after correction of the needle points in the section to be corrected.
In a third aspect, the present application provides an electronic device comprising a processor and a memory; the memory is used for storing computer instructions; the processor is configured to execute computer instructions stored in the memory to cause the electronic device to perform the pattern correction method according to any one of the above first aspects.
In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program which, when executed, implements the pattern correction method according to any one of the first aspects.
The pattern correction method, the pattern correction device, the electronic equipment and the storage medium provided by the application can correct the problems of uneven needle point data and the like in patterns generated by the existing plate making software or other software, and the corrected patterns are suitable for sewing technologies or sewing methods with special requirements on patterns, such as a rotating machine head technology and the like. The pattern correction method has higher accuracy, can automatically operate by writing special software and the like, has high pattern correction efficiency, and can meet the requirements of actual sewing production.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings. It will be apparent that the described embodiments are some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, shall fall within the scope of the application as claimed.
The terms "first," "second," "third," and the like in the claims, in the description and in the drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order, and may be interchanged without affecting the accuracy of the semantics. Furthermore, the terms "comprises," "comprising," "includes," "including," "having," and any similar variation thereof, are intended to be non-exclusive, and thus, include a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to those steps or elements but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The technical scheme of the embodiment is to correct patterns based on patterns generated by the existing plate making software or other software. For convenience of description, the needle points in the pattern are denoted by the numbers of the needle points. The technical scheme of the embodiment is mainly used for correcting the problem that needle points in patterns generated by the existing plate making software or other software are not smooth. Uneven means that the difference between some index of several points adjacent or closer to each other is too large. If a coordinate system is established by taking the needle point number as the abscissa and the index of each needle point as the ordinate, and corresponding points of each needle point in the coordinate system are connected to form a graph, the non-smooth appearance is that the graph has obvious and relatively sharp protrusions or depressions, and correspondingly, the smooth appearance is that the graph does not have relatively sharp protrusions or depressions.
Embodiment one:
FIG. 1 is a flowchart showing a pattern correction method according to the present embodiment, which includes the following steps.
S101, screening target needle points in the patterns according to preset indexes.
The needle point data comprises a coordinate value for locating the needle point on the fabric, wherein the coordinate value is generally X, Y coordinate values in a set two-dimensional coordinate system, tiny undulation on the fabric is ignored in sewing production, the fabric is regarded as a plane, and X, Y coordinate values can determine the position of the needle point on the fabric. The Y value may be considered as a function of the X value, which may then be used to describe certain properties of the needle point.
As an initial step, first, the needle points in the pattern are selected, and the selected needle points are generally referred to as target needle points based on a predetermined index. If the Y value for the point is considered as a function of the X value, the setting index may be some functional expression. The problem of uneven point data is corrected, and the set index can be selected as a discrete second derivative. The discrete second derivative is defined on the basis of the common continuous function second derivative, the needle points in the pattern are discrete rather than continuous data, and the direct use of the continuous function second derivative can have the problems of incapacity of calculation and the like, so that the discrete second derivative needs to be adopted. The discrete second derivative can have a number of different definitions, one of which is given below, given y=f (x)WhileH in the above formula represents the distance between two adjacent needle points, and the specific value of h can be obtained by calculating according to the coordinate values of the two adjacent needle points. The distance between two adjacent dots is generally the same in the pattern produced by the prior art plate making software or other software. If the distances between two adjacent points are different, the formula may be adaptively modified according to the above-described derivation process. Other definitions of the discrete second derivative, e.g. the first derivative +.>Replaced by->Different decisions based on discrete second derivativesBy definition, the discrete second derivative of a needle point can be calculated according to the coordinate values of the needle point and the two needle points before or after the needle point.
The absolute value of the second derivative at a point on the graph is related to the curvature of that point, and if the absolute value of the discrete second derivative at a point is too large, then the point is relatively unsmooth. The needle points in the pattern can be traversed according to the numbers, the discrete second derivative of each needle point is calculated, and if the absolute value of the discrete second derivative of a certain needle point is larger than a preset threshold value, the needle point is marked as a target needle point.
S102, determining target needle point sections in the pattern and the leading section and the trailing section of each target needle point section according to the target needle points, and combining the leading section, the target needle point sections and the trailing section into a section to be corrected.
In step S101, the target needle points in the pattern have been selected, and it is obvious that the target needle points should be corrected, but the correction cannot generally be performed only on the target needle points themselves, and other needle points adjacent to or close to the target needle points need to be corrected together, so that the concept of the segment to be corrected is introduced. The segment to be corrected includes both the target needle point described in step S101 and a needle point adjacent to or closer to the target needle point. The segment to be corrected can be regarded as a needle point set consisting of a preamble segment, a target needle point segment and a following segment, the set takes the needle point with the smallest number as a starting point and takes the needle point with the largest number as an ending point, wherein the target needle point segment is defined as the starting point and the ending point of the target needle point segment are both target needle points described in the step S101, and the distance between any two adjacent target needle points in the target needle point segment does not exceed the set distance. The spacing between the spots may be represented by the difference in the two spot numbers, e.g. the spots numbered 7 and 9 have a spacing of 2. Adjacent target points refer to all points between two target points that are not target points. There may be multiple target needle segments in the same pattern, and for some complex patterns, the desired set spacing of target needle segments at different locations in the pattern may also be different. In practice, for convenience of operation, a reference pitch may be set for a pattern, and the set pitch of each target needle segment is a positive integer multiple of the reference pitch. Based on the definition of the target needle point segment, the target needle point segment may include only one needle point, i.e., the start point and the end point of the target needle point segment are the same needle point.
According to the target needle point, a target needle point section in the pattern is determined, and a relatively common method is adopted, wherein the principle steps are as follows: traversing the needle points in the pattern according to the numbers, and finding out the target needle point with the minimum number; searching whether other target needle points exist in all needle points with the number being smaller than that of the reference needle point and the distance between the target needle point and the reference needle point not exceeding a set threshold value by taking the target needle point with the smallest number as the reference needle point, and continuously searching by taking the target needle point with the largest number as a new reference needle point if the other target needle points exist until the other target needle points cannot be found; and taking the target needle point with the smallest number in all the found target needle points as the starting point of the target needle point section, and taking the target needle point with the largest number as the ending point of the target needle point section.
Obviously, all the target needle points in the pattern can be searched by traversing all the needle points in the pattern by the method. For example, in the pattern shown in fig. 2, if the preset threshold of the absolute value of the discrete second derivative is set to 45, then the points 6, 8, 9, 18, 19 in the pattern are target points, and if the pitch threshold of all the target point segments in the pattern is set to 2, then the method is utilized to traverse from the point 1, first the point 6 is found, then the point 8 is found in the range of the points 7-8, the point 9 is found in the range of the points 9-10, the target point is not found in the range of the points 10-11, and then the start point of the target point segment 1 is the point 6 and the end point is the point 9. Then, from the needle point 12, the needle point 18 is found first, then the needle point 19 is found in the range of the needle points 19-20, and the target needle point is not found in the range of the needle points 20-21, then the starting point of the target needle point segment 2 is the needle point 18, and the end point is the needle point 19. Finally, the traversal starts from the needle point 22, the target needle point is not found any more, the whole pattern searching is finished, and 2 target needle point segments are found.
The leading segment and the trailing segment are the collection of needle points that are closely spaced from the target needle point segment. The needle point with the largest number in the front section is adjacent to the starting point of the target needle point section, and the needle point with the smallest number in the rear section is adjacent to the ending point of the target needle point section. If the numbers of the needle points are successively increased by 1, the numbers of adjacent needle points differ by 1. In order to ensure the accuracy of pattern correction, it is generally necessary to combine the preceding segment and the following segment into the segment to be corrected, and then to perform correction together. Obviously, the leading segment and the trailing segment correspond to a particular target needle point segment. The number of spots included in the preceding and following sections, which may or may not be the same, is usually determined according to the actual situation of the pattern or target spot section. For some simpler designs, the number of stitches of the preceding and following segments may be set to be the same as or slightly less than the number of stitches of their corresponding target stitch segments. For example, in the pattern shown in fig. 2, the preceding and following segments of the target needle point segment 1 each have 4 needle points, which are the same number as the needle points of the target needle point segment 1; the front section and the rear section of the target needle point section 2 are respectively provided with 2 needle points, and the number of the needle points is the same as that of the target needle point section 2.
The pre-segment, the target needle point segment and the post-segment are combined into a segment to be corrected, and three needle point sets are combined into one needle point set, and the number of the needle points and other corresponding data of the needle points are kept unchanged. In some special cases, the setting of the leading segment and the trailing segment and merging into the segment to be corrected need to follow corresponding special rules. The main purpose of the special rules is to make the segment to be corrected contain as many needle points as possible, so as to ensure the subsequent correction effect.
If the number of the starting point of the target needle point section is smaller, the situation that the number of the needle points, which are smaller than the number of the starting point of the target needle point section, in the pattern is smaller than the number of the needle points of the preset preamble section may occur, and at the moment, all the needle points, which are smaller than the number of the starting point of the target needle point section, in the pattern are included in the preamble section. For example, the starting point of a target needle point segment is needle point 3, the target needle point segment comprises 4 needle points, the preset fore segment and the following segment respectively comprise 4 needle points, but the number is smaller than that of the needle point 3, namely, only three needle points of needle point 0, needle point 1 and needle point 2, and the needle point 0, the needle point 1 and the needle point 2 are all incorporated into the fore segment.
If the number of the destination needle point segment end point is larger, the number of the needle points with the number larger than the destination needle point segment end point number in the pattern may be smaller than the preset number of the needle points of the subsequent segment, and at the moment, all the needle points with the number larger than the destination needle point segment end point in the pattern are included in the subsequent segment. For example, the end point of a target needle point segment is a needle point 20, the target needle point segment comprises 4 needle points, the preset front segment and the subsequent segment respectively comprise 4 needle points, but the pattern comprises only 23 needle points, the number of the last needle point is 22, and the needle point 21 and the needle point 22 are both incorporated into the subsequent segment.
And if the two sections to be modified are overlapped or adjacent, combining the two sections to be modified into one section to be modified. Coincidence means that at least one needle point exists which belongs to both the first section to be corrected and the second section to be corrected. Adjacent means that the start point of the first segment to be corrected is adjacent to the end point of the second segment to be corrected, or that the end point of the first segment to be corrected is adjacent to the start point of the second segment to be corrected.
S103, determining corrected coordinates of the needle points in the section to be corrected according to probability distribution of coordinate difference values of the coordinates before correction and the coordinates after correction of the needle points in the section to be corrected.
The pattern is corrected by correcting substantially all the needle points in the segment to be corrected obtained in step S102. The modification of the needle point generally refers to modifying the coordinate values of the needle point. The coordinate values before correction and after correction of the needle point are not completely uncorrelated, and a reasonable assumption is made that the coordinate differences between the coordinates before correction and the coordinates after correction follow a probability distribution, such as a relatively common normal distribution. Record P x 、P y G is the abscissa and ordinate before correction of a needle point x 、G y For the abscissa and ordinate values after the needle point correction, letThen t x And t y The coordinate difference between the coordinates before correction and the coordinates after correction can be regarded as the needle point. t is t x And t y H in the definition, namely h in the step S101, represents the distance between two adjacent needle points before correction, and h can eliminate t x And t y Is convenient for t x And t y Is a statistical treatment of (1). In general, it is possible toView t x And t y Obeys N (0, sigma) 2 ) I.e. +.>F in the above formula represents a probability density function, i=x, y. The specific value of the standard deviation sigma is determined according to the pattern or the condition of the segment to be corrected, and certain trial calculation can be carried out if necessary.
At present, there are mature probability value generation methods, and the methods can be used for generating a distribution obeying N (0, sigma) 2 ) Due to P of each point x 、P y It is known that each needle point G can be calculated x 、G y Is a numerical value of (2). Multiple groups of G are obtained by calculating multiple groups of random numbers x 、G y Then, the discrete second derivative corresponding to the corrected coordinates of each needle point in the section to be corrected can be calculated according to the description in the step S101, and a group of the most smooth G is selected x 、G y . Since the distances between adjacent points after correction are not necessarily the same, the calculation formula of the discrete second derivative in step S101 needs to be adaptively modified, for exampleH in 1 Indicating the distance between the needle point and the next adjacent needle point after the needle point, h 2 Indicating the distance between the next adjacent needle point after the needle point and the next adjacent needle point after the needle point. In actual operation, most sections to be corrected generate 3-5 groups of random numbers, and correction results which have good smoothing effect and meet the requirements of a new sewing technology or a new sewing method can be selected.
And correcting the needle points in the section to be corrected, if the data corresponding to the needle points in the section to be corrected are corrected, the data are corrected to be a corrected numerical value (the data without correction are kept unchanged), and the data of other needle points in the pattern are kept unchanged, so that the corrected pattern can be obtained. The corrected pattern can be directly used for sewing production, and a sewing machine can produce a sewing product according to the corrected pattern.
According to the pattern correction method provided by the embodiment, the time complexity and the space complexity of the method are low, an operator of a sewing machine after writing special software can obtain a correction result in a very short time by inputting a small amount of setting data into the software, and the correction efficiency is not comparable to that of the manual pattern correction. The actual operation effect of the method is good, and the requirement of the inter-stitch production can be met. For example, the corrected pattern is sewn by using a rotating machine head technology, so that the rotating angle of the machine head can be effectively controlled, the overlarge rotating angle of the machine head when sewing a plurality of needle points is avoided, and meanwhile, the mechanical vibration in the sewing process is sufficiently reduced.
Embodiment two:
FIG. 3 is a schematic diagram showing the configuration of a pattern correction apparatus according to the present embodiment. The pattern correction device 30 includes a dot screening device 31, a segment confirmation device 32, and a dot correction device 33. The dot screening device 31 is used for screening target needle dots in the pattern according to a preset index. The segment confirming device 32 is used for determining target needle point segments in the pattern and the preceding segment and the following segment of each target needle point segment according to the target needle points, and combining the preceding segment, the target needle point segment and the following segment into a segment to be corrected. The point correction device 33 is configured to determine corrected coordinates of the needle point in the section to be corrected according to a probability distribution of a coordinate difference between the coordinates of the needle point in the section to be corrected and the coordinates of the needle point.
The specific implementation manner of the device in this embodiment may be referred to in the first embodiment, and the implementation principle and technical effects are similar, which is not described herein.
The apparatus described in this embodiment should be understood as a functional module architecture implemented mainly by means of computer programs or the like. The division of the apparatus according to the embodiment corresponds to the method steps described in the first embodiment, and is merely a logic function division, and there may be another division manner in actual implementation, for example, multiple apparatuses may be combined or integrated into another apparatus, or some apparatuses may be omitted or not executed.
The embodiments of the physical units as the device-carrying entities in this embodiment have a variety of embodiments, and all devices may be distributed in one physical unit, or one or several devices may be distributed in different physical units. The physical units of the bearing device can be electrically connected in a cable, wireless network or other modes, and do not necessarily have direct physical contact or mechanical connection relation.
Embodiment III:
fig. 4 is a schematic hardware structure of the electronic device according to the present embodiment. As shown in fig. 4, the electronic device 40 includes: at least one processor 41 and a memory 42. Optionally, the electronic device 40 further comprises a bus 43, and the processor 41 and the memory 42 are connected by the bus 43.
During operation of the electronic device, the memory 42 stores computer instructions that the at least one processor 41 executes to cause the electronic device 40 to perform the method as described in embodiment one.
The specific implementation process of the electronic device 40 may be described in the first embodiment, and the implementation principle and technical effects are similar, which is not described herein.
In this embodiment, it should be understood that the processor may be a central processing unit (in english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (in english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (in english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. The general purpose processor may be a microprocessor or other conventional processor. The computer instructions stored in the execution memory 42 may be performed directly by a hardware processor or by a combination of hardware and software modules in the processor.
The memory may include high speed RAM memory and may also include non-volatile storage NVM, such as at least one disk memory.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
Embodiment four:
the present application also provides a computer-readable storage medium having a computer program stored therein, which when executed, implements the method as described in embodiment one.
The above-described computer-readable storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks, and so forth. A readable storage medium can be any available medium that can be accessed by a general purpose or special purpose computer or similar electronic device.
A computer readable storage medium may be coupled to the processor such that the processor can read information from, and write information to, the medium. In the alternative, the medium may be integral to the processor. The processor and the readable storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). The processor and the readable storage medium may reside as discrete components in an electronic device.
The technical solution of the present application may be stored in a computer readable storage medium if implemented in the form of software and sold or used as a product. With such understanding, all or part of the technical solution of the present application may be embodied in the form of a software product stored in a storage medium comprising a computer program or several instructions. The computer software product causes a computer device (which may be a personal computer, a server, a network device, or similar electronic device) to perform all or part of the steps of a method according to an embodiment of the application. The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps described in implementing the embodiment one may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer-readable storage medium, which when executed performs all or part of the steps described in the first embodiment. The aforementioned storage medium includes various media that can store program codes such as ROM, RAM, magnetic disk, or optical disk.
Finally, it should be noted that the embodiments of the present application are only used to illustrate the technical solution of the present application, and not to limit it. Although the embodiments have been described in detail, those skilled in the art should understand that they can modify the technical solutions described in the embodiments of the present application or make equivalent substitutions for some or all of the technical features thereof, and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.