Disclosure of Invention
The pattern correction method, the pattern correction device, the electronic equipment and the storage medium provided by the application aim at solving the problems of uneven needle point data and the like in patterns generated by the existing plate making software or other software, the patterns are corrected, and the corrected patterns are suitable for sewing technologies or sewing methods with special requirements on the patterns. 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 a target needle point section in the pattern and a front sequence section and a rear sequence section of each target needle point section according to the target needle point, and combining the front sequence section, the target needle point section and the rear sequence section into a section to be corrected; and determining the corrected coordinates of the needle points in the segment to be corrected according to the probability distribution of the coordinate difference value of the needle points in the segment to be corrected before correction and the corrected coordinates.
Further, the predetermined indicator includes a discrete second derivative, and the definition of the discrete second derivative includes
h is the distance between two adjacent needle points.
Furthermore, the starting point and the end point of the target needle point segment are the target needle points, and the distance between any two adjacent target needle points in the target needle point segment does not exceed a set distance.
Further, the determining a 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 the needle points with the numbers larger than the reference needle point and the distances between the reference needle point and the target needle point not exceeding a set threshold value by taking the target needle point with the minimum number as the reference needle point, and if the other target needle points exist, continuously searching by taking the target needle point with the maximum number as a new reference needle point until the other target needle points cannot be found;
and taking the target needle point with the minimum number in all the found target needle points as the starting point of the target needle point segment, and taking the target needle point with the maximum number as the end point of the target needle point segment.
Furthermore, the needle point with the largest number in the front sequence section is adjacent to the starting point of the target needle point section, and the needle point with the smallest number in the rear sequence section is adjacent to the end point of the target needle point section.
Further, the merging the pre-sequence segment, the target needle point segment and the post-sequence segment into a segment to be corrected includes:
if the number of the needle points with the numbers smaller than the starting number of the target needle point segment is smaller than the preset number of the needle points of the preceding segment, all the needle points with the numbers smaller than the starting number of the target needle point segment are brought into the preceding segment; and/or the presence of a gas in the gas,
if the number of the needle points with the numbers larger than the end point number of the target needle point segment is smaller than the preset number of the needle points of the subsequent segment, bringing all the needle points with the numbers larger than the end point number of the target needle point segment into the subsequent segment; and/or the presence of a gas in the gas,
if the two sections to be corrected are overlapped or adjacent, the two sections to be corrected are merged into one section to be corrected.
Further, the coordinate difference between the coordinates before and after the correction of the needle points obeys N (0, sigma)2)。
In a second aspect, the present application provides a pattern correction apparatus comprising: a point screening device, a segment confirming device and a point correcting device; the point screening device is used for screening target needle points in the patterns according to preset indexes; the segment confirming device is used for determining a target needle point segment in the pattern and a front sequence segment and a rear sequence segment of each target needle point segment according to the target needle point and combining the front sequence segment, the target needle point segment and the rear sequence segment into a segment to be corrected; the point correction device is used for determining the corrected coordinates of the needle points in the segment to be corrected according to the probability distribution of the coordinate difference value of the needle points in the segment to be corrected before correction and the needle points after correction.
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 execute the pattern correction method according to any one of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program which, when executed, implements a pattern correction method as defined in any one of the above first aspects.
The pattern correction method, device, electronic equipment and storage medium provided by the application can correct the problems of uneven needle point data and the like in the 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 the patterns, such as a rotary machine head technology and the like. The pattern correction method is high in accuracy, meanwhile, the method can be automatically operated by compiling special software and the like, the pattern correction efficiency is high, and the requirements of actual sewing production can be met.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, the technical solutions of the present application will be described in detail and completely with reference to the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the scope of protection granted by the present application.
The terms "first," "second," "third," and the like in the claims, the description, and the drawings of the specification, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, but rather the terms "first," "second," "third," and the like may be used interchangeably without affecting the semantic accuracy. Moreover, the terms "comprises," "comprising," "includes," "including," "has," "having," and any variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment technical scheme corrects the patterns based on the patterns generated by the existing plate making software or other software. For convenience of description, the dots in the pattern are indicated by the numbers of the dots. The technical scheme of the embodiment mainly corrects the problem that dot data in patterns generated by the existing plate making software or other software are not smooth. The unsmooth means that the difference of some indexes of a plurality of adjacent or close needle points 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 unsmooth representation shows that the graph has obvious and relatively sharp bulges or depressions, and correspondingly, the smooth representation shows that the graph has no relatively sharp bulges or depressions.
The first embodiment is as follows:
fig. 1 is a flowchart of 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 includes coordinate values for locating the needle point on the fabric, the coordinate values are X, Y coordinate values in a set two-dimensional coordinate system, the fabric is regarded as a plane by neglecting tiny fluctuation on the fabric in sewing production, and the X, Y coordinate values can determine the position of the needle point on the fabric. The Y value may be considered a function of the X value, which may then be used to describe certain properties of the pin points.
As an initial step, the needle points in the pattern are first selected, and the selected needle points are usually referred to as target needle points based on a predetermined index. If the Y value of the pin point is regarded as a function of the X value, the setting index may be a function expression. The problem that the needle point data are not smooth is corrected, and the set index can be selected as a discrete second derivative. The discrete second-order derivative is defined on the basis of the common continuous function second-order derivative, the needle points in the patterns are discrete rather than discontinuous data, the problem that the second-order derivative of the continuous function is directly used and cannot be calculated exists, and the like, so that the discrete second-order derivative is required to be adopted. The discrete second derivative can have a variety of different definitions, one of which is given below, where y ═ f (x) is given
While
H in the above formula represents the distance between two adjacent needle points, and the specific value of h can be obtained by calculation according to the coordinate values of two adjacent needle points. The patterns produced by the existing plate making software or other software have the same distance between two adjacent needle points. If the distance between two adjacent needle points is different, the formula can be modified adaptively according to the derivation process. Other definitions of discrete second derivatives, e.g. first derivatives in the above formula
Is replaced by
Based on different definitions of the discrete second derivative, the discrete second derivative of a certain needle point can be calculated according to the coordinate values of the needle point and 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 pin point is too large, the pin point is relatively not smooth enough. The discrete second derivative of each needle point can be calculated according to the number of the needle points in the traversal pattern, and if the absolute value of the discrete second derivative of a certain needle point is larger than a preset threshold value, the certain needle point is marked as a target needle point.
S102, determining a target needle point section in the pattern and a front sequence section and a rear sequence section of each target needle point section according to the target needle point, and combining the front sequence section, the target needle point section and the rear sequence section into a section to be corrected.
In step S101, the target needle point in the pattern has been screened out, and it is obvious that the target needle point should be corrected, but the correction generally cannot only correct the target needle point itself, and other needle points adjacent to or closer to the target needle point also need to be corrected together, so the concept of the section to be corrected is introduced. The segment to be corrected includes the target needle point in step S101, and also includes 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 front segment, a target needle point segment and a rear segment, the set regards the needle point with the minimum number as a starting point and regards the needle point with the maximum number as an end point, wherein the target needle point segment is defined as the starting point and the end point of the target needle point segment are the 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 dots may be represented by the difference between the two dot numbers, for example, the 7 and 9 dot spacing is 2. The adjacent target needle points mean that all the needle points between the two target needle points are not the target needle points. Multiple target needle point segments may be present in the same pattern, and for some complex patterns, the set pitch required for target needle point segments located at different positions of 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 point 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 only include one needle point, i.e. the start point and the end point of the target needle point segment are the same needle point.
A method for determining target needle point segments in patterns according to target needle points is a relatively common method, and 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 the needle points with the numbers larger than the reference needle point and the distances between the reference needle point and the target needle point not exceeding a set threshold value by taking the target needle point with the minimum number as the reference needle point, and if the other target needle points exist, continuously searching by taking the target needle point with the maximum number as a new reference needle point until the other target needle points cannot be found; and taking the target needle point with the minimum number in all the found target needle points as the starting point of the target needle point segment, and taking the target needle point with the maximum number as the end point of the target needle point segment.
Obviously, by traversing all the pins in the pattern by the method, all the target pin segments in the pattern can be found. For example, in the pattern shown in fig. 2, if the preset threshold value of the absolute value of the discrete second derivative is set to 45, the needle points 6, 8, 9, 18, and 19 in the pattern are the target needle points, and if the distance threshold value of all the target needle point segments of the pattern is set to 2, the above method is used to traverse from the needle point 1, and first find the needle point 6, then find the needle point 8 in the range of the needle points 7-8, find the needle point 9 in the range of the needle points 9-10, and find no target needle point in the range of the needle points 10-11, then the starting point of the target needle point segment 1 is the needle point 6, and the ending point is the needle point 9. Then, starting from the needle point 12, first finding the needle point 18, then finding the needle point 19 in the range of the needle points 19-20, and finding no target needle point in the range of the needle points 20-21, the starting point of the target needle point segment 2 is the needle point 18, and the end point is the needle point 19. And finally, traversing from the needle point 22, finding no target needle point, finishing the searching of the whole pattern, and finding 2 target needle point segments.
The preceding and following segments are sets of needle points that are closer in distance to the target needle point segment. The needle point with the maximum number in the front sequence section is adjacent to the starting point of the target needle point section, and the needle point with the minimum number in the rear sequence section is adjacent to the end point of the target needle point section. If the numbers of the needle points are increased by 1, the numbers of the adjacent needle points are different by 1. In order to ensure the accuracy of pattern correction, it is usually necessary to combine the preceding segment and the subsequent segment into the segment to be corrected, and then perform correction together. It is apparent that the preceding and following sections correspond to specific target needle point sections. The number of the needle points included in the front and rear sections may be the same or different, and should be determined according to the actual condition of the pattern or the target needle point section. For some simpler patterns, the number of the needle points of the front sequence section and the rear sequence section can be set to be the same as or slightly less than that of the corresponding target needle point section. For example, in the pattern shown in fig. 2, the front section and the rear section of the target needle point section 1 have 4 needle points respectively, and the number of the needle points is the same as that of the target needle point section 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-sequence section, the target needle point section and the post-sequence section are combined into the section to be corrected, 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 and merging of the pre-sequence segment and the post-sequence segment into the segment to be corrected need to comply with corresponding special rules. The main purpose of the special rule is to make the segment to be corrected contain as many needle points as possible, thereby ensuring the subsequent correction effect.
If the number of the starting point of the target needle point segment is smaller, the situation that the number of the needle points of which the numbers are smaller than the number of the starting point of the target needle point segment in the pattern is smaller than the preset number of the needle points of the preceding segment can occur, and at the moment, all the needle points of which the numbers are smaller than the number of the starting point of the target needle point segment in the pattern are brought into the preceding segment. For example, the starting point of a certain target needle point segment is needle point 3, the target needle point segment includes 4 needle points, and the preset front sequence segment and the preset rear sequence segment each include 4 needle points, but only three needle points, namely needle point 0, needle point 1 and needle point 2, which are numbered less than needle point 3, all needle points 0, needle point 1 and needle point 2 are included in the front sequence segment.
If the number of the end point of the target needle point segment is larger, the situation that the number of the needle points with the numbers larger than the number of the end point of the target needle point segment in the pattern is smaller than the preset number of the needle points of the subsequent segment can occur, and at the moment, all the needle points with the numbers larger than the number of the end point of the target needle point segment in the pattern are brought into the subsequent segment. For example, if the end point of a target needle point segment is a needle point 20, the target needle point segment includes 4 needle points, and the pre-subsequent segment and the post-subsequent segment each include 4 needle points, but the pattern includes only 23 needle points, and the last needle point is numbered 22, then both the needle points 21 and 22 are included in the post-subsequent segment.
And if the two sections to be corrected are overlapped or adjacent, combining the two sections to be corrected into one section to be corrected. And the superposition means that at least one needle point belongs to both the first section to be corrected and the second section to be corrected. The adjacent means that the starting point of the first segment to be corrected is adjacent to the end point of the second segment to be corrected, or the end point of the first segment to be corrected is adjacent to the starting point of the second segment to be corrected.
S103, determining the corrected coordinates of the needle points in the segment to be corrected according to the probability distribution of the coordinate difference value of the needle points in the segment to be corrected before correction and the needle points after correction.
The pattern is corrected by substantially correcting all the needle points in the segment to be corrected obtained in step S102. The correction of the needle point generally means that the coordinate value of the needle point is modified. The coordinate values before and after the correction of the pinpoint are not completely irrelevant, and a reasonable assumption is that the coordinate difference between the coordinate values before and after the correction of the pinpoint obeys a certain probability distribution, such as a relatively common normal distribution. Note P
x、P
yFor the abscissa and ordinate, G, before correction of a certain needle point
x、G
yFor the corrected abscissa and ordinate values of the needle point, order
Then t
xAnd t
yThe coordinate difference between the coordinates before and after the correction of the needle points can be considered. t is t
xAnd t
yH in the definition, i.e., h described in step S101, represents a distance between two adjacent needle points before correction, and h may beElimination of t
xAnd t
yDimension of (2), conveniently for t
xAnd t
yThe statistical processing of (3). In general, t can be seen
xAnd t
yObey N (0, sigma)
2) I.e. by
In the above formula, f represents a probability density function, i ═ x, y. The specific value of the standard deviation sigma is determined according to the situation of the pattern or 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 distribution obeys N (0, sigma) by using the methods
2) Due to P of each pin point
x、P
yAs is known, each needle point G can be calculated
x、G
yThe numerical value of (c). Multiple groups of random numbers are used for calculating to obtain multiple groups of G
x、G
yThen, the discrete second derivative corresponding to the coordinates of each corrected needle point in the segment to be corrected can be calculated according to the description in step S101, and then a group of the smoothest G is selected
x、G
y. Since the distances between adjacent needle points are not necessarily the same after the correction, the calculation formula of the discrete second derivative in step S101 needs to be modified adaptively, for example
In the formula h
1Indicates the distance between the needle point and the next adjacent needle point after the needle point, h
2Indicating 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 then correction results which have good smoothing effect and meet the requirements of new sewing technology or new method can be selected.
And (4) correcting the needle points in the segment to be corrected, if the data corresponding to the needle points in the segment to be corrected is corrected, correcting the data corresponding to the needle points in the segment to be corrected into corrected numerical values (the data without correction is kept unchanged), and keeping the data of other needle points in the pattern unchanged, so that the corrected pattern can be obtained. The corrected pattern can be directly used for sewing production, and the sewing machine produces a sewing product according to the corrected pattern.
In the pattern correction method provided by the embodiment, the time complexity and the space complexity are not high, an operator of the sewing machine can obtain a correction result in a very short time by inputting a small amount of set data into software after writing special software, and the correction efficiency is basically incomparable with the manual pattern correction. The method has good actual operation effect and can meet the requirement of actual sewing production. For example, the pattern corrected by the method is sewn by utilizing a rotary machine head technology, so that the rotation angle of the machine head can be effectively controlled, the phenomenon that the rotation angle is too large when the machine head sews some needle points is avoided, and meanwhile, the mechanical vibration in the sewing process is fully reduced.
Example two:
fig. 3 is a schematic configuration diagram of the pattern correction apparatus according to the embodiment. The pattern correcting device 30 includes a dot selecting device 31, a segment checking device 32, and a dot correcting device 33. The point screening device 31 is used for screening target needle points in patterns according to preset indexes. The segment confirming device 32 is used for determining a target needle point segment in the pattern and a front sequence segment and a rear sequence segment of each target needle point segment according to the target needle point, and combining the front sequence segment, the target needle point segment and the rear sequence segment into a segment to be corrected. The point correcting device 33 is configured to determine the corrected coordinates of the needle points in the segment to be corrected according to the probability distribution of the coordinate difference between the coordinates before and after correction of the needle points in the segment to be corrected.
For a specific implementation manner of the apparatus in this embodiment, reference may be made to the content in the first embodiment, which has similar implementation principle and technical effect, and details of this embodiment are not described herein again.
The apparatus described in this embodiment is understood as a functional module framework mainly implemented by a computer program or the like. The division of the device described in this embodiment corresponds to the method steps described in the first embodiment, and is only a logical function division, and there may be another division manner in actual implementation, for example, a plurality of devices may be combined or integrated into another device, or some devices may be omitted or not executed.
The embodiments of the physical unit of the device-bearing entity in this embodiment have diversity, 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 carrying device can be electrically connected through cables, wireless networks and the like, and do not necessarily have direct physical contact or mechanical connection relation.
Example three:
fig. 4 is a schematic diagram of a hardware structure of the electronic device according to the 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 via the bus 43.
During operation of the electronic device, the memory 42 stores computer instructions, and the at least one processor 41 executes the computer instructions stored by the memory 42 to cause the electronic device 40 to perform the method according to the first embodiment.
For a specific implementation process of the electronic device 40, reference may be made to the content described in the first embodiment, which implements similar principles and technical effects, and details of this embodiment are not described herein again.
In this embodiment, it should be understood that the Processor may be a Central Processing Unit (CPU), other general-purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. The general purpose processor may be a microprocessor or other conventional processor. The computer instructions stored by the execution memory 42 may be executed directly by a hardware processor, or may be executed by a combination of hardware and software modules within a 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 (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
Example four:
the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the method as described in the first embodiment.
The 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. Readable storage media can be any available media 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. Of course, the media described above may also be part of the processor. The processor and the readable storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the readable storage medium may also reside as discrete components in an electronic device.
The technical scheme of the application can be stored in a computer readable storage medium if the technical scheme is realized in a software form and is sold or used as a product. Based on this understanding, all or part of the technical solutions of the present application may be embodied in the form of a software product stored in a storage medium, including a computer program or several instructions. The computer software product enables a computer device (which may be a personal computer, a server, a network device, or a similar electronic device) to perform all or part of the steps of the method according to one embodiment of the present application. The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and may store program codes.
Those skilled in the art will appreciate that all or a portion of the steps described in relation to implementing the first embodiment may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium, and when executed, performs all or part of the steps described in the first embodiment. The storage medium includes various media that can store program codes, such as ROM, RAM, magnetic or optical disk.
Finally, it should be noted that the embodiments of the present application are only used for illustrating the technical solutions of the present application, and not for limiting the same. Although the present application has been described in detail with reference to the embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.