CN101859335A - Computer-aided crewel embroidery production method - Google Patents

Computer-aided crewel embroidery production method Download PDF

Info

Publication number
CN101859335A
CN101859335A CN201010175217.8A CN201010175217A CN101859335A CN 101859335 A CN101859335 A CN 101859335A CN 201010175217 A CN201010175217 A CN 201010175217A CN 101859335 A CN101859335 A CN 101859335A
Authority
CN
China
Prior art keywords
color
needle tracking
embroidery
needle
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201010175217.8A
Other languages
Chinese (zh)
Other versions
CN101859335B (en
Inventor
孙正兴
陈圣国
项建华
张岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University
Original Assignee
Nanjing University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University filed Critical Nanjing University
Priority to CN2010101752178A priority Critical patent/CN101859335B/en
Publication of CN101859335A publication Critical patent/CN101859335A/en
Application granted granted Critical
Publication of CN101859335B publication Critical patent/CN101859335B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Sewing Machines And Sewing (AREA)

Abstract

The invention discloses a computer-aided crewel embroidery production method, which comprises the following steps: 1, selection of an embroidery yarn color subset: selecting a certain quantity of embroidery yarn colors as the embroidery yarn color subset; 2, color laying: dividing a pattern to be embroidered into a plurality of color block regions, selecting an embroidery yarn with the color closest to the color of the color block region in a centralized way from the embroidery yarn color subset for each color block region, and filling to produce the pattern of an embroidery stitch scheme; 3, fine embroidery: carrying out transversal for the pattern to be embroidered with a square sliding window, and finding out a cross stitch each time in the position with the window according to the color distribution in the pattern to be embroidered; 4, sequential stitch optimization: adjusting the stitch sequence, so that independent stitches in Step 2 and Step 3 can be continuously made during embroidery, thereby obtaining a stitch sequence for the crewel embroidery; 5, stitch coordinate transformation; and 6, input into the computer-based embroidery machine, thereby obtaining the corresponding crewel embroidery.

Description

A kind of computer-aided crewel embroidery production method
Technical field
The invention belongs to computer software, Computer Image Processing and computer graphics techniques field, relate to a kind of computer-aided crewel embroidery and make software approach, specifically, be that a kind of direct input digital color image output is used for the method that computer embroidering machine is made random stitch embroidery embroidery needle tracking sequence, realize the computerize of random stitch embroidery technological process.
Background technology
Random stitch embroidery is to teach a kind of embroidery art of founding in nineteen thirties by Changzhou artist Yang Shouyu, it has broken away from restraining of China's tradition embroidery " its pin of parallelism; connect airtight its line " in several thousand embroidery method, form unique " length is irregular; oblique line intersects; look is supported by the arm in layering " random pin skill, be beneficial to artist's emotion that freely expresses thoughts, realized the combination of " drawing reason " and " embroidering reason "; Manuscripts such as embroidered oil painting, photography and sketch are longer than in random stitch embroidery, characteristics such as embroidery has that the skill of handling needles is active, the lines flow smoothly, rich color, stereovision are strong, unique style, not only totally different is in other kind embroidery of China, it worldwide also is extremely precious artistic work, repeatedly give to foreign government or leader's collection, embodied its exquisite artistic value and deep cultureal value as state's gift.First batch of non-material cultural heritage has been listed it in Jiangsu Province at present, and Chinese Government has also listed it in world's non-material cultural heritage plan of application.Yet, compare with tradition embroidery, random stitch embroidery technology is intricate, from imitation, shop fixtures, to colouring, toning, adopt " sketch original text " and " color original text " that presentation technique, operation steps and creation effect are ruminated over and ferment, main processes still depends on manual operations so far, and the creation of works cycle is long, the cost costliness, only making a present as government is used for international present contacts, and is difficult to find its track on market, can't be had and approves by the ordinary people; Simultaneously; random stitch embroidery is very high to embroidery person's skill competency profiling; not only GPRS " is drawn reason " and skilled pictorial skill; and can grasp " embroidering reason " and skilled embroidery skill; embroidery person's the road of becoming a useful person is hard and very long; cause the random stitch embroidery talent deficient day by day, the protection and the succession of this stunt handed down from ancient times constituted very big threat.Adopt the making of the auxiliary random stitch embroidery of computer technology can shorten the fabrication cycle of random stitch embroidery embroidery, reduce cost of manufacture, the person's that reduces the embroidery labour intensity attracts more young men to learn and pass on this unique technology.
Yet,, do not see the research report of the auxiliary random stitch embroidery of relevant calculation machine both at home and abroad as yet because random stitch embroidery technology is very complicated.The plane embroidery method that adopts with traditional anglicanum is different, and random stitch embroidery piles up the volume sense of represented object, the spatial relationship and the color change of front and back object with the needle tracking juxtaposition of different directions, length, thickness and color.Existing such as document 1 Tian Xuan, Li Bingshe, Xu Yibing: computer Preprocessing System For Embroidery Image. Xibei Textile Engineering College's journal, 1998,12 (2): 196-198, document 2 Meng Bo, Xie Qi, Chen Shifu: the design of computerized embroidery CAD system and realization. computer utility and software, 2001,18 (10): the 12-14. and document 3 Wus one people, Li Jia, Li Haitao: the design of computerized embroidery CAD system and realization. microcomputer is used, 2007,28 (12): described area of computer aided embroidering method such as 1335-1338. all only supports the plane to embroider method, all is to adopt rim detection or color cluster that input digital image is divided into Uncrossed some enclosed region mutually earlier, adopts such as flat bag pin again, basket, the plane skill of handling needles such as flat pin or at random the skill of handling needles each zone is filled respectively and generates needle tracking.This method require the needle tracking head and the tail in the same area to link to each other in turn and needle tracking between avoid producing as far as possible and intersect, the interregional shortage color transition of the embroidery that generates, gradation is single, is difficult to satisfy the needs of random stitch embroidery technology.
Summary of the invention
Goal of the invention: technical matters to be solved by this invention is at the deficiencies in the prior art, and a kind of computer-aided crewel embroidery production method is provided.
In order to solve the problems of the technologies described above, the invention discloses a kind of computer-aided crewel embroidery production method, may further comprise the steps:
Step 1 is embroidered the line color subclass and selected: the embroidery line color that constitutes selection specified quantity from available embroidery line color according to the color for the treatment of embroidered image is to guarantee only to use the specified quantity color to embroider the chromaticity that line generates embroidery.Embroider line color quantity and specify according to the computer embroidering machine hardware condition, specifying embroidery line color number as the computer embroidering machine of 6 pins is 6 kinds.
Step 2 shop look: will treat that embroidered image segmentation is some big color block areas, the color block areas size depends on the COLOR COMPOSITION THROUGH DISTRIBUTION situation of image itself, the area of color block areas should not be less than 100 pixels, but be not strict with All Ranges all above this size, then each color block areas is selected embroidery line with its color distance minimum to adopt to intersect needle tracking filling embroidery needle tracking conceptual scheme picture from the selected color subclass of step 1, treat that in the embroidered image each puts square area in the corresponding embroidery needle tracking conceptual scheme picture.For example embroidery needle tracking conceptual scheme can be taken as former 5 times for the treatment of embroidered image as length and width, a square area of 5 pixel *, 5 pixels on the corresponding needle tracking conceptual scheme of the some picture on the promptly former figure.Here an intersection needle tracking refers to a needle tracking set that is made of two cross one another needle trackings.Wherein the calculating of color distance determines according to selected color space, if select for use rgb color space to represent, color distance can adopt Euclidean distance or weighted euclidean distance.
Step 3 is smart embroiders: adopt a foursquare moving window at first to cover and treat the embroidered image upper left corner, then from left to right, this window traversal of sliding is from top to bottom again treated embroidered image, the stitch length that window size generates is as required set, and treats that in this window position basis color distribution is sought the intersection needle tracking in the embroidered image at every turn;
Step 4 needle tracking sequential optimization: step 2,3 have generated the sequence of a needle tracking, this step is arranged the needle tracking of color of the same race under the prerequisite of the covering relation that does not change the different colours needle tracking as far as possible continuously, then the needle tracking order of continuously arranged color of the same race is adjusted according to the position of needle tracking, the needle tracking of close together is adjusted to together, if adjacent two distance between needle point tracers in adjustment order back from (distance between the starting point of the terminal point of first needle tracking and second needle tracking) less than certain threshold value, the starting point of then inserting terminal point that a needle tracking connects last needle tracking and back one needle tracking takes the needle the embroidery function continuously, and original adjacent independently needle tracking can be taken the needle when embroidered continuously.
Step 5 needle tracking coordinate conversion: needle tracking starting point and terminal point that preceding step generates are unit with the pixel, this step is according to employed embroidery line width, with pixel coordinate be converted to that computer embroidering machine uses with the coordinate format of millimeter as unit, thereby generate the random stitch embroidery needle tracking sequence of computer embroidering machine form;
Step 6 with described random stitch embroidery needle tracking sequence input computer embroidering machine, thereby obtains corresponding embroidery image.
Because the restriction of computer embroidering machine hardware condition; can not use the embroidery line of a lot of colors simultaneously; for example 6 pin embroidery machines can use the embroidery line of 6 kinds of colors simultaneously; if use the embroidery line that surpasses 6 kinds of colors in the needle tracking sequence; thread-changing need be shut down continually when embroidered, the embroidery make efficiency will be had a strong impact on.
Step 1 of the present invention provides a kind of and has selected genetic algorithm (Elite Genetic Algorithm) to be applied to embroider the method that line color is selected the elite, and the embroidery line color that constitutes selection specified quantity from available embroidery line color according to the color for the treatment of embroidered image is to guarantee only to use the specified quantity color to embroider the chromaticity that line generates embroidery.
The embroidery line color collection T={t of assumption of complete 1, t 2...., t mIn total m kind embroider line, therefrom choose the subclass S={s of a k element 1..., s k, s wherein i∈ T, i=1 ..., k, k is the number of colours of appointment, treats all pixels in the embroidered image and replaces with the most similar color in this subclass that can to rebuild a width of cloth similar to original image but the image of certain aberration is arranged, and uses formula
Figure GSA00000123803800031
Aberration between expression reconstructed image and the original image, wherein p, q are respectively width and the height for the treatment of embroidered image, i, j are that pixel x in the image, y direction are that (adopt image processing field a kind of coordinate system commonly used here: the image upper left corner is true origin for the coordinate figure of unit with the pixel, turn right and be x axle forward, down be y axle forward), c IjEmbroidered image pixel (i, color value j), D (c are treated in expression Ij, s l) expression color value c IjWith the element s in the subclass of k element lDistance, the calculating of color distance can be adopted the computing method of color distance in RGB, YUV or other color space.This step adopts the elite to select genetic algorithm to try to achieve a color subclass S, makes to have less aberration between reconstructed image and the original image.
Step 2 of the present invention shop look may further comprise the steps:
Step 21 smoothed image: remove the minutia for the treatment of embroidered image by the image denoising algorithm, the contour feature that keeps big color lump, the purpose of this step is to produce the zone of a large amount of areas less than certain pixel count when avoiding step 22 by the color split image, and described big color block areas refers to the zone of area greater than 80~100 pixels.Denoise algorithm can be selected anyly can keep the algorithm of image border well in denoising.For example Rudin, Osher and Fatemi in 1992 at document Nonlinear total variation based noise removal algorithms.Physica D, 1992,60 (1-4): what propose among the 259-268. is a kind of based on full variation (Total Variation, TV) denoising method of model.
Image after step 22 is cut apart smoothly: to color replacement the most similar in the embroidery line color subclass that all pixels use steps 1 are selected in the image after level and smooth, image is divided into several regions automatically, and the corresponding color in each zone will be filled the used embroidery line color in this zone as shop color range section.
Step 23 is calculated the direction parameter of each zone intersection needle tracking: according to the color characteristic in zone, and zoning needle tracking direction (angle with needle tracking and x axle is represented).Each zone that step 22 is obtained is adopted and is calculated this zone needle tracking direction in the following method:
Step 23a, at first try to achieve the luminance picture I that treats embroidered image (i, j) and calculate the gradient of luminance picture in view of the above
Figure GSA00000123803800032
G wherein x, G yBe respectively luminance picture is used the x that the Sobel operator obtains and the difference value of y direction.
Step 23b calculates the θ value according to brightness step by following formula.
Figure GSA00000123803800041
Wherein
Figure GSA00000123803800042
Figure GSA00000123803800043
W is the set of regional interior pixel, and (u v) is regional interior pixel point coordinate.
Step 23c obtains the value of β by following formula according to brightness step:
Figure GSA00000123803800044
W is the set of regional interior pixel, and (u v) is regional interior pixel point coordinate.
Step 23d, with θ+β and θ-β as intersecting the direction (with the axial angle of x) of two needle trackings in the needle tracking.
Step 24 adopts selected color to use the intersection needle tracking that each zone is filled according to certain stitch density to each zone.Key step comprises:
Step 24a asks this zone boundary rectangle, and the limit of boundary rectangle is parallel to x, y coordinate axis;
Step 24b, according to the length of the single needle tracking of needle tracking direction calculating, the width setup of needle tracking is 1 pixel, calculates the area that single needle tracking covers described zone;
Step 24c is according to the quantity of the required intersection needle tracking of filling in the area ratio calculating circumscribed rectangular region of the covering of setting;
Step 24d is evenly distributed needle tracking according to intersecting the quantity of needle tracking in boundary rectangle;
Step 24e removes in the needle tracking that previous step tries to achieve suddenly the not pixel in the zone, with the starting point of the straight-line segment of remaining pixel formation and terminal point starting point and the terminal point as needle tracking.
Step 3 of the present invention needs iteration to carry out repeatedly, at first adopts the moving window traversing graph picture of large-size to generate long needle tracking, and the size that progressively reduces moving window then generates short needle tracking.Number of iterations and window size are determined the quality requirements of embroidery according to the user.Each moving window is determined to intersect needle tracking according to the following steps:
Step 31 adopts trial method to seek intersection needle tracking position, use different slopes to seek straight-line segment, all pixel color similarities on the described straight-line segment path promptly with the color distance of straight-line segment starting point less than threshold value, then according to the starting point of this straight-line segment and the starting point and the terminal point coordinate of terminal point coordinate generation needle tracking, key step is as follows:
Step 31a, the upper left corner in square moving window (the x direction left-half in the square moving window, y direction the first half) and in the lower left corner (the x direction left-half in the square moving window, y direction the latter half) select two o'clock starting points at random as two straight-line segments;
Step 31b determines the max-thresholds of color distance in this square moving window scope, if two color of pixel distance is less than this threshold value in the moving window, then thinks similarly, otherwise thinks dissimilar.Max-thresholds constitutes according to the color in the moving window and determines that dynamically suppose that the moving window length of side is n, then threshold maximum value is
Figure GSA00000123803800045
Wherein
Figure GSA00000123803800051
Cij be moving window internal coordinate (with respect to the moving window upper left corner) for (i, pixel color value j),
Figure GSA00000123803800052
Be the mean value of this zone interior pixel color, D (C Ij, C Av) be two-tone distance.Can directly use the square value of color distance to judge that max-thresholds is got 18S for reducing calculated amount 2
Step 31c uses different slopes to sound out and seeks qualified straight-line segment, requires all the pixel color similarities on the straight-line segment path, has less aberration.To a certain given slope, at first calculate the next pixel color on this straight-line segment and the distance of starting point color, if less than specified threshold value, then thinking, this distance value continues color similarity to a bit handling under this straight line; If this distance value, judges whether the length of the straight-line segment that has found meets the requirements greater than specified threshold value then termination,, select another slope value to sound out if length is too short then abandon this line segment.When exceeding this threshold value, the length of straigh line that finds directly returns, to prevent the long needle tracking of generation in the mild zone of some change color.This step at first adopts less color distance threshold value to sound out, if do not find qualified straight-line segment, then increase the color distance threshold value and repeat this step, when max-thresholds that the color distance threshold value calculates in greater than step step 31b, then withdraw from, from step 31a other positions that this window traversal treats embroidered image of restarting to continue to slide from this step 31c.
Step 31d is after finding qualified straight-line segment, to starting point and the terminal point of straight-line segment starting point and the terminal point pixel that one of picked at random is not covered by needle tracking in the square of embroidery needle tracking conceptual scheme picture correspondence respectively as needle tracking on the original image.
Step 32 is determined the color of needle tracking, after the starting point and terminal point of selected needle tracking, according to the straight-line segment starting point in embroidery needle tracking conceptual scheme picture the coverage condition of corresponding square area determine the color of needle tracking.If the pixel ratio that this square area has covered is less than 20%, directly in embroidering the line color subclass, select an embroidery line color with its color distance minimum according to the color for the treatment of corresponding pixel points in the embroidered image; If the pixel ratio that this square area has covered greater than 20%, is then calculated the color of needle tracking by following step, wherein n represents the length of side of square area:
Step 32a, obtain the color of being had a few in this square area in the needle tracking conceptual scheme picture and, with substituting with the embroidery line color for the treatment of corresponding pixel points color distance minimum in the embroidered image in the line color subclass, remember that this value is C during the partial summation that is not capped Sum
Step 32b calculates the color and the C that treat embroidered image corresponding point SumPoor C Diff, C Diff=n*n*C Org-C Sum, C wherein OrgFor treating the color of corresponding pixel points in the embroidered image.
Step 32c calculates and repairs look C Rep=α * C Diff+ (1-α) * C Org, with embroidering in the line color subclass and C RepThe most similar embroidery line color is as the needle tracking color, wherein parameter alpha ∈ (0,1] be the color adaptation factor, be used for regulating needle tracking embroidery line color that uses and the similarity degree for the treatment of embroidered image respective pixel color.Target image was seen far color is more approaching and is treated embroidered image when α got higher value; The less then selected color of α with treat that the respective pixel color is more approaching in the embroidered image, but the situation that visual effect is got higher value not as good as α when far seeing.
Step 4 needle tracking sequential optimization of the present invention may further comprise the steps:
Step 41 division minute hand mark: the needle tracking that surpasses the certain-length threshold value in the needle tracking sequence that obtains for step 2,3 is handled, it is split into the needle tracking of some length less than length threshold according to the length threshold of setting, length threshold generally can be made as 15~25 pixels, also can suitably strengthen this value according to the characteristic of embroidery machine.
Step 42 rearranges needle tracking according to color: the needle tracking sequence that generates in the traversal preceding step, if the color of previous needle tracking is identical with the color of another needle tracking of front in the needle tracking sequence, and all needle trackings between two needle trackings all do not have cross reference, after then the position of previous needle tracking being advanceed to described another needle tracking, thereby the needle tracking that color is identical is arranged continuously;
Step 43 connects the adjacent homochromy and certain threshold pixels of distance with interior needle tracking, and described certain threshold value is generally 2~5 pixels; This step is adjusted in proper order to the needle tracking of continuously arranged same color, makes the start point distance of terminal point and back one needle tracking of last needle tracking in adjacent two needle trackings from dwindling; Can produce big influence to the whole visual effect of embroidery if this distance less than described threshold value, connects, the starting point of then inserting terminal point that a needle tracking connects last needle tracking and back one needle tracking makes computer embroidering machine to take the needle continuously.
Preceding 4 steps of the present invention have generated a needle tracking sequence, and the starting point of needle tracking and terminal point coordinate are unit with the pixel, and the needle tracking conceptual scheme looks like to be of a size of former figure width and highly amplifies identical multiple.The coordinate that uses when computer embroidering machine takes the needle generally is unit with millimeter, step 5 will be that to be converted to millimeter be the coordinate of unit for the needle tracking starting point of unit and terminal point coordinate with the pixel, its method is comparatively simple, and it is just passable only to need to be that the data of unit multiply by the width data of embroidering line with the pixel.
Beneficial effect: the invention provides a kind of input digital color image, automatically generate the computer-aided crewel embroidery production method of random stitch embroidery needle tracking sequence, the needle tracking sequence of utilizing this method to generate can generate the random stitch embroidery embroidery by computer embroidering machine batch, high-level efficiency, reduces the production cost of random stitch embroidery embroidery.
Description of drawings
Below in conjunction with the drawings and specific embodiments the present invention is done further to specify, above-mentioned and/or otherwise advantage of the present invention will become apparent.
Fig. 1 is the disclosed method overall procedure of a present invention synoptic diagram.
Fig. 2 is the synoptic diagram of middle berth color range section intersection needle tracking direction parameter of the present invention.
Fig. 3 is an embroidered process design sketch for the treatment of embroidered image lotus in the embodiment of the invention.
Embodiment:
The invention discloses a kind of computer-aided crewel embroidery production method, may further comprise the steps:
Step 1, embroider the line color subclass and select: the embroidery line color that constitutes selection specified quantity from available embroidery line color according to the color for the treatment of embroidered image is to guarantee only to use the specified quantity color to embroider the chromaticity that line generates embroidery.
Step 2, shop look: will treat that embroidered image segmentation is some big color block areas, then each color block areas is selected the color the most similar to it to adopt to intersect needle tracking filling embroidery needle tracking conceptual scheme picture from the selected color subclass of step 1, treat square area in each pixel correspondence embroidery needle tracking conceptual scheme picture in the embroidered image.
Step 3, the smart embroidery: adopt a foursquare moving window traversal to treat embroidered image, in moving window, seek the intersection needle tracking, progressively strengthen the density of needle tracking according to the similarity of color.
Step 4, needle tracking sequential optimization: step 2,3 have generated the sequence of a needle tracking, this step is arranged the needle tracking of color of the same race under the prerequisite of the covering relation that does not change the different colours needle tracking as far as possible continuously, then the needle tracking order of continuously arranged color of the same race is adjusted according to the position of needle tracking, the needle tracking of close together is adjusted to together, if adjacent two distance between needle point tracers in adjustment order back from (distance between the starting point of the terminal point of first needle tracking and second needle tracking) less than certain threshold value, for example distance is in 3 pixels, then insert a pin, original adjacent independently needle tracking can be taken the needle when embroidered continuously.
Step 5, the needle tracking coordinate conversion: needle tracking starting point and terminal point that preceding step generates are unit with the pixel, this step is according to employed embroidery line width, with pixel coordinate be converted to that computer embroidering machine uses with the coordinate format of millimeter as unit.
Step 6 with described random stitch embroidery needle tracking sequence input computer embroidering machine, thereby obtains corresponding embroidery.
The gordian technique of enforcement of the present invention relates generally to embroiders the selection of line color subclass, shop look, the smart embroidery and the needle tracking sequential optimization, introduces the main flow process of enforcement below:
1. embroidering the line color subclass selects
Can use the embroidery line of a large amount of different colours during artificial embroidered random stitch embroidery works, but use computer embroidering machine can not use the embroidery line of too many different colours.This mainly is because the restriction of the hardware condition of computer embroidering machine, and the pin number of computer embroidering machine has determined the embroidery line color number that can use simultaneously, and for example the computer embroidering machine to 6 pins can use 6 kinds simultaneously.If the embroidery line color quantity of using is too much, must shut down thread-changing continually when embroidered, embroidery machine can't run up, and has a strong impact on embroidered efficient.
This step concentrates the color according to image to constitute the needle tracking color of the color subclass of selection specified quantity as each stage of back from available embroidery line color.This step is imported available embroidery line color set and coloured image, exports selecteed color subclass.The parameter that embroidering each color in the line color set need provide comprises:
1) embroider the line numbering: line was embroidered in identification when this numbering was mainly used in to the computer embroidering machine thread-changing;
2) embroider the line color value: according to employed color space difference, the data layout difference, the most frequently used RGB color space in can using a computer provides the value of 3 components respectively.
The embroidery line color collection T={t of assumption of complete 1, t 2...., t mIn total m kind embroider line, need therefrom choose the subclass S={s of a k element 1..., s k, s wherein i∈ T, i=1 ..., k, k are the number of colours that embroidery machine allow to use, and can be set to 6 to the embroidery machine k of 6 pins, if when allowing embroidery repeatedly thread-changing can strengthen the value of k.Treat all pixels in the embroidered image and replace with the most similar color in this subclass that can to rebuild a width of cloth similar to original image but the image of certain aberration is arranged, use formula
Figure GSA00000123803800071
Aberration between expression reconstructed image and the original image, wherein p, q are respectively width and the height for the treatment of embroidered image, c IjEmbroidered image pixel (i, color value j), D (c are treated in expression Ij, s l) expression color value c IjWith the element s in the subclass of k element lDistance, the computing method of color distance can adopt corresponding calculation method according to the color space of selecting.
If adopt tri-vector to represent color value in the rgb color space, C=(r, g, b) ', two different colours value C 1, C 2Between distance can adopt Euclidean distance to represent usually, consider that human eye is more responsive to luminance signal, and the RGB three-component is to the contribution difference of luminance signal, give different weights to RGB three-component difference, color distance calculation formula to color is adjusted, can make the distance difference that calculates more meet the visual characteristic of human eye, computing formula is
Figure GSA00000123803800081
This step adopts improved elite to select genetic algorithm to try to achieve a color subclass S, makes to have less aberration between reconstructed image and the original image.Genetic algorithm is the randomization searching algorithm that a class is used for reference organic sphere natural selection and natural genetic mechanism, directly with fitness as search information, need not other supplementarys such as derivative.Use genetic algorithm at first to need problem space is encoded, problem space is mapped to the search volume, carry out selection operation, interlace operation, mutation operation with certain probability then, the high pattern of average fitness was remained in each generation, through successive iteration, find the individuality of maximum adaptation degree, reach the purpose of optimization.Improved elite of the present invention selects genetic algorithm to comprise following feature:
1) coding form of gene
Embroider gene position of line definition for every kind that available embroidery line is concentrated, value is that the embroidery line of 1 this color of expression is selected, if value is that 0 this embroidery line of expression is not selected, then length available is that the binary string of m is represented body one by one, remembers G=(g 1, g 2..., g m), g wherein iValue is 0 or 1, and satisfies the formula condition
Figure GSA00000123803800082
2) crossover operator
The crossover operator of genetic algorithm standard can not guarantee to intersect the new individuality that the generates condition above satisfying, and can't directly apply to the present invention.The present invention transforms the single-point crossover operator of standard.Note p 1, p 2Be two father and mother's individualities, c 1, c 2For intersecting the son individuality that generates, the intersection process is as follows:
1. the sub individual c that intersect to generate of initialization 1, c 2, all gene position are 0;
2. to all gene position, if father and mother are individual p 1With the individual p of father and mother 2Genic value on the middle correspondence position is 1, then with the individual p of father and mother 1With the individual p of father and mother 2In the correspondence position genic value value that is 1 position all be changed to 0, with the individual c of son 1, individual c 2With the individual p of father and mother 1With the individual p of father and mother 2The value of middle correspondence position is changed to 1, and the gene position number of writing this condition of foot all over is s, makes parameter d=k-s.
3. generate the random integers cp between the interval [1, d-1].With the individual p of father and mother 1In before cp value be that 1 gene position copies to sub individual c 1Corresponding gene location, a remaining d-cp value are that 1 gene position copies to sub individual c 2Corresponding gene location.With the individual p of father and mother 2In before cp value be that 1 gene position copies to sub individual c 2Corresponding gene location, a remaining d-cp value are that 1 gene position copies to sub individual c 1Corresponding gene location.
3) mutation operator
Similar with crossover operator, also there is same problem in the mutation operator of standard, elected in certain value be 1 gene position, its value is become 0, then can make individual intermediate value is that 1 gene position quantity reduces, and is that 1 gene position quantity increases otherwise then can make individual intermediate value.The present invention transforms the mutation operator of standard, and method is: when certain value is 1 selected the morphing of gene position, select one to morph simultaneously for the gene position of value 0 at random; And when certain value be 0 gene position when morphing, selecting a value at random is that 1 gene position makes a variation simultaneously.
4) definition of fitness function
Genetic algorithm before selection operation, must be calculated each individual fitness in the current colony at every turn, and the individual selecteed probability that fitness value is big more is big more.Formula
Figure GSA00000123803800091
Image and former figure aberration that the color subclass reconstruction of using appointment is described are more little, illustrate that this individual performance is good more, and more near optimum solution, this individual fitness value should be big more, therefore gets
Figure GSA00000123803800092
As this individual fitness.
Select the embroidery line collection of common DMC on the market among the embodiment of Fig. 3, have 454 kinds of colors, the population size is 100, generate initial population at random, maximum genetic algebra 500 adopts the elite to select genetic algorithm, each heredity keeps the optimum solution of previous generation, if continuous 50 generations heredity optimum solution remains unchanged, then stop algorithm, otherwise stop when maximum generation is counted when genetic algebra surpasses.Carry out the probability P of crossover operator cBe 0.8, the probability P of variation mBe 0.15.
2. shop look
Shop color range section adopts regular relatively intersection needle tracking to fill big color lump, and key step is:
Step 2.1. smoothly embroiders original text: remove the minutia for the treatment of embroidered image by the image denoising algorithm, keep the contour feature of big color lump.
If directly according to treating that the color distribution of embroidered image carries out Region Segmentation, tend to occur the very little zone of a large amount of areas, step 2.1 is treated embroidered image and is carried out smoothly removing some minutias before cutting apart, can avoid this situation.Denoise algorithm is selected to select anyly can keep the algorithm of image border well in denoising.For example Rudin, Osher and Fatemi in 1992 at document Nonlinear total variation based noise removalalgorithms.Physica D, 1992,60 (1-4): what propose among the 259-268. is a kind of based on full variation (Total Variation, TV) denoising method of model.For the embroidered image for the treatment of shown in the accompanying drawing 3a, level and smooth image is afterwards seen accompanying drawing 3b.
Step 2.2 is cut apart the image after level and smooth: use the color of color distance minimum in the embroidery line color subclass that steps 1 select to replace to all pixels in the image after level and smooth, image is divided into several regions automatically, the embroidered image segmentation for the treatment of among the embodiment shown in the accompanying drawing 3a is 28 zones, and the corresponding color in each zone will be filled the used embroidery line color in this zone as shop color range section.
Step 2.3 is calculated the direction parameter of each zone intersection needle tracking: according to the color characteristic in zone, and the angle of zoning needle tracking and x axle.Computing method are as follows:
1) trying to achieve the luminance picture I that treats embroidered image, is 0.212671*R+0.715160*G+0.072169*B to each pixel brightness value, and R, G, B are this pixel color three-component value in rgb color space; This conversion is a kind of standard method of RGB image transitions when being gray level image.
2) brightness step of computed image
Figure GSA00000123803800101
Gx, Gy are respectively luminance picture are used the x that the Sobel operator obtains and the difference value of y direction;
3) calculate each regional θ value, the general direction of this value representation intersection needle tracking, as shown in Figure 2, wherein AB, CD are needle tracking, EF is two angular bisectors that intersect needle trackings, and the direction of two needle trackings determined by parameter θ and β, and the angle of itself and x axle is respectively θ+β and θ-β.
θ = 1 2 arctan ( V x V y ) , Wherein:
V x = Σ ( u , v ) ∈ W 2 G x ( u , v ) G y ( u , v ) ,
V y = Σ ( u , v ) ∈ W ( G x ( u , v ) 2 - G y ( u , v ) 2 ) ,
W is the set of regional interior pixel; (u v) is the coordinate of pixel among the W;
Calculate the value of each region beta, this value is for intersecting needle tracking angle in the needle tracking As shown in Figure 2,
Figure GSA00000123803800106
W is the set of regional interior pixel; (u v) is the coordinate of pixel among the W;
4) with θ+β and θ-β as intersecting the direction (with the axial angle of x) of two needle trackings in the needle tracking.
Step 2.4 adopts selected color to use the intersection needle tracking that each zone is filled according to the stitch density of user's appointment to each zone, and described stitch density generally is set at 10%~30%, and key step comprises:
1) asks this zone boundary rectangle, the limit of boundary rectangle is parallel to x, y coordinate axis, all points in the traversal zone, try to achieve x, the minimum value left of y coordinate, top, maximal value right, bottom, then the upper left corner coordinate of boundary rectangle is (left, top), lower right corner coordinate be (right, bottom).
2) according to the length of the single needle tracking of needle tracking direction calculating.Step is as follows:
1. adjust needle tracking orientation angle parameter to scope
Figure GSA00000123803800107
2. estimate the length of needle tracking, establish needle tracking and x axle clamp angle is alpha, if the absolute value of alpha less than
Figure GSA00000123803800108
Length l ength=(right-left+1)/cos (alpha) then, if the absolute value of alpha greater than
Figure GSA00000123803800111
Length=fabs ((bottom-top+1)/sin (alpha)) then;
3) area ratio that covers according to expectation calculates the quantity of filling required intersection needle tracking in the circumscribed rectangular region, if the length that both direction needle tracking previous step is tried to achieve is length1, length2, the needle tracking width setup is that therefore 1 pixel directly uses the area of stitch length as needle tracking covering rectangular area, and then needle tracking quantity is:
lineCount=((bottom-top+1)*(right-left+1)*iScale*percentage)/(length1+length2);
Wherein iScale is that needle tracking scheme picture size is treated embroidered size of images ratio with the source, and this value of embodiment is 5, treats promptly in the embroidered image that the length of side is the square area of 5 pixels in the corresponding needle tracking conceptual scheme of the some picture; Percentage is taken as 20% for the number percent of the shop color range section needle tracking area coverage of user's setting among the embodiment.
4) in boundary rectangle, be evenly distributed needle tracking according to needle tracking quantity.If needle tracking and x axle clamp angle less than
Figure GSA00000123803800112
Then equidistant distribution lineCount point on the boundary rectangle coboundary has been to press the needle tracking direction to draw out needle tracking with these points; If needle tracking and x axle clamp angle greater than
Figure GSA00000123803800113
Then equidistant distribution lineCount point on the boundary rectangle left margin has been to press the needle tracking direction to draw out needle tracking with these points.
5) remove in the needle tracking that previous step tries to achieve suddenly the not pixel in the zone, with the starting point of the straight-line segment of remaining pixel formation and terminal point starting point and terminal point as needle tracking.
Treat shown in Fig. 3 a among the embodiment that embroidered image process is level and smooth, cut apart the back image, the result of shop look is shown in Fig. 3 c.
3 smart embroidery stages
Local color feature according to image on the basis of shop look is sought suitable needle tracking, treats embroidered image by a foursquare moving window traversal, seeks the intersection needle tracking in moving window, progressively strengthens the density of needle tracking.This step needs iteration to carry out repeatedly.At first adopt the moving window traversing graph picture of large-size to generate long needle tracking, the size that progressively reduces moving window then generates short needle tracking.Number of iterations and window size determine that to the quality requirements of embroidery number of iterations is many more according to the user, and the quality of embroidery is high more, and idiographic flow is described below:
1) sets initial sliding window size and the step-length of slip and the minimum threshold of window size, generally the moving window length of side is set at 5~20 pixels when initial, the step-length of sliding is 1/4~3/4 of a window size, and the minimum threshold of window size is set at 2~4 pixels.
2) the hour hand mark length of setting that the current window size allows and minute hand mark length, hour hand mark length is the moving window length of side, minute hand mark length is 1.1~2 times the moving window length of side.
3) seek to intersect needle tracking,, each window carried out following steps original image moving window from top to bottom from left to right:
(a) calculate the ratio that the part of corresponding current window in the embroidered image has been capped;
(b) if the ratio that is capped greater than 90%, skips steps (c) (d) is handled next window;
(c) select a bit as starting point at the window upper left quarter, seek length straight-line segment hour hand mark length and minute hand mark length between to the lower right to souning out with different slopes, and pixel color is close on the straight-line segment, if find starting point and final position according to this straight-line segment to generate a needle tracking; Select a bit as starting point at the window lower left quarter, with different slopes to the upper right side to sound out seeking the straight-line segment of length between hour hand mark length and minute hand mark length, and pixel color is close on the straight-line segment, if find starting point and final position according to this straight-line segment to generate a needle tracking.
4) reduce the step-length that window size and window slide.The home window size dimension is 8 pixels among the embodiment, and the window sliding step is 1/2 of a window size, and the window size dimension is 1/2 of a last window size dimension during each iteration.
5), change step 2 if window size is not less than pre-set threshold; Otherwise algorithm stops.This threshold value is 2 among the embodiment, and iteration is 3 times altogether, and the window length of side is respectively 8,4,2 pixels, and minute hand mark length is 1.5 times of window size, and hour hand mark length is window size.
Sound out seeking the process prescription of qualified straight-line segment with Different Slope in the top step 3), following (wherein n represents the length of side of moving window, flag1 be true respresentation to find the upper left corner be the qualified straight-line segment of starting point, flag2 is that true respresentation is the qualified straight-line segment of starting point to the upper left corner):
1) initialization flag1, flag2 are false;
2) max-thresholds of two color of pixel distances in the calculating moving window, this max-thresholds is chosen to be 18S 2, wherein
Figure GSA00000123803800121
Figure GSA00000123803800122
N is the length of side of moving window, D (C Ij, C Av) be color distance, Cij is that moving window internal coordinate (with respect to the moving window upper left corner) is (i, the color of pixel j), Cav is the mean value of moving window interior pixel color, S is used for weighing the situation of color distribution in the moving window, this moving window interior pixel colour consistency of the more little explanation of this value is high more, and the change color Shaoxing opera in big more this moving window of explanation of this value is strong.
3) in the present embodiment, the color distance threshold setting is 1000, generally can be set at 500~2000 as required, if do not find distance less than 1000 straight-line segment, then strengthen the color distance threshold value and repeat to seek straight-line segment, between each color distance threshold range 800-1200 that increases, increase by 1000 in the present embodiment, when max-thresholds that the color distance threshold value calculates in greater than step 31b, then withdraw from step 31.
4) in 1/4 zone in the upper left corner of square area selected at random a bit (startx, starty);
5) the k initial value is 1 for subtract 1 less than the random integers of n at every turn up to its value, repeats following step:
(5.1) judge that starting point is (startx, starty) slope be the most close embroidery line color of pixel color on the direction of k/n whether identical with starting point or with the color distance of starting point whether less than color distance and value, if with it as the line segment terminal point, continue next pixel of cycle criterion, when line segment length greater than 1.5*n or run into certain pixel and the starting point color distance returns the line segment terminal point of having tried to achieve during greater than the color distance value;
(5.2) if the line segment length that finds more than or equal to n, adds the needle tracking table with this line segment, put flag1=true, on needle tracking conceptual scheme picture, draw this line segment, withdraw from current circulation, change step 7);
6) the k initial value is 1 for subtract 1 less than the random integers of n at every turn up to its value, repeats following step:
(6.1) function is identical with step (5.1), and the straight-line segment slope changes into and is n/k;
(6.2) same step (5.2);
7) in 1/4 zone in the lower left corner of square area selected at random a bit (startx, starty);
8) the k initial value is 1 for subtract 1 less than the random integers of n at every turn up to its value, repeats following step:
(8.1) the same step of function (5.1), the straight-line segment slope is-k/n;
(8.2) if the line segment length that finds more than or equal to n, adds the needle tracking table with this line segment, put flag2=true, on needle tracking conceptual scheme picture, draw this line segment, withdraw from current circulation, change step 10);
9) the k initial value is 1 for subtract 1 less than the random integers of n at every turn up to its value, repeats following step:
(9.1) the same step of function (8.1), the straight-line segment slope is-n/k;
(9.2) the same step of function (8.2);
10), flag1, flag2 increase color distance threshold value (former threshold value increases by 100 as new threshold value) if being vacation; Otherwise algorithm stops;
11) if the color distance threshold value greater than 18S2, algorithm stops;
12) change step 4).
After in window, finding qualified straight-line segment, the beginning or end of this straight-line segment in target image in the corresponding zone one of picked at random embroidered point that line covers as the needle tracking beginning or end.
Determined also to need to determine behind the starting point of needle tracking and the terminal point color of needle tracking, because machine is embroidered can only to use a small amount of color, treat that there are aberration in the color in most of zone in the embroidered image and the color in the selected color subclass, if it is embroidered to use embroidery line with a kind of color to carry out in a zone repeatedly, then the visual effect of works and former figure have very big-difference.Mix producing new color when the neighbor point of different colours is far seen, the present invention mixes by a small amount of color in the color subclass of selecting previously in the neighbor point use, produces and the more approaching color of original image when far seeing.
This method is treated a pixel corresponding square area in needle tracking conceptual scheme picture in the embroidered image, and the RGB mean value that adopts each pixel in this square area is as mixing the new color that produces.After the starting point and terminal point of selected needle tracking, according to the straight-line segment starting point in needle tracking conceptual scheme picture the coverage condition of corresponding square area determine the color of needle tracking.Method is as follows:
1) if the pixel ratio that this square area has covered less than 20%, is directly selected one and the immediate embroidery line color of this color according to the color for the treatment of corresponding pixel points in the embroidered image in embroidering the line color subclass;
2) if the pixel ratio that this square area has covered greater than 20%, is then calculated the color of needle tracking by following step, wherein n represents the length of side of square area:
1. obtain the color of being had a few in this square area and, with treating that the embroidery line color that the corresponding pixel points color is the most close in the embroidered image substitutes, remember that this value is C during the partial summation that is not capped Sum
2. calculate the color C that treats embroidered image corresponding pixel points OrgWith C SumPoor C Diff: C Diff=n*n*C Org-C Sum
3. calculate and repair look C Rep=α * C Diff+ (1-α) * C Org, use C RepIn embroidering the line color subclass, seek the most similar color as the needle tracking color, wherein parameter alpha ∈ (0,1] be the color adaptation factor, be used for regulating embroidery line color that needle tracking uses and the similarity degree for the treatment of embroidered image respective pixel color.Target image was seen far color is more approaching and is treated embroidered image when α got higher value; The less then selected color of α with treat that the respective pixel color is more approaching in the embroidered image, but the situation that visual effect is got higher value not as good as α when far seeing.α gets 0.5 among the embodiment.
Comprise original image, image, shop chromatic effect, smart embroidery process effect after level and smooth among Fig. 3 and intersect the partial result figure of needle tracking.Treat embroidered image among the embodiment shown in Fig. 3 a, Fig. 3 b is the image after level and smooth, Fig. 3 c is the image behind the auxilliary look, and Fig. 3 d, Fig. 3 e, Fig. 3 f are the embroidery needle tracking conceptual scheme picture that 3 traversals of smart embroidery stage are treated to obtain behind the embroidered image, and Fig. 3 g is depicted as the embroidery needle tracking conceptual scheme of generation as the partial enlarged drawing picture.
4. needle tracking sequential optimization
Preceding step has generated a discontinuous needle tracking sequence, can not need adjust the needle tracking order directly for embroidery machine uses, and the needle tracking of same color is concentrated as far as possible, and close needle tracking is connected, and generates continuous needle tracking sequence.This step is divided into following steps:
Step 41, division minute hand mark: the needle tracking that surpasses certain-length in the needle tracking sequence that obtains for step 2,3 is handled, and it is split into the needle tracking of some length less than length threshold according to length threshold of setting.
Step 42, rearrange needle tracking according to color: the needle tracking sequence that generates in the traversal preceding step, if the color of needle tracking 1 is identical with the color of front needle tracking 2 in the needle tracking sequence, and needle tracking 1 and needle tracking 2 all do not have cross reference to all needle trackings between this needle tracking, then the position of needle tracking 1 is advanceed to needle tracking 2 after.
Step 43, connect the adjacent homochromy and very near needle tracking of distance: the needle tracking that step 4.2 is identical with some colors is arranged continuously, this step is adjusted in proper order to the needle tracking of continuously arranged same color, makes the start point distance of terminal point and back one needle tracking of last needle tracking in adjacent two needle trackings from short as far as possible.Can not produce big influence to the whole visual effect of embroidery if two distance between needle point tracers from very near, connect, the needle tracking that then inserts a weak point makes computer embroidering machine to take the needle continuously.
Specifically describe the needle tracking optimizing process below:
1) division minute hand mark
This step is checked each needle tracking in the needle tracking sequence, span (distance of Origin And Destination coordinate x direction and y direction) according to its x direction and y direction judges whether it to be split into a plurality of hour hand marks, if surpass preset threshold (following threshold value is represented with MAXSL) then division, otherwise do not handle.Threshold value is 20 among the embodiment, and promptly x direction or y direction span surpass 20, and it is split into a plurality of needle trackings.
If x direction span is xd, y direction span is yd, then:
If xd, yd do not handle all smaller or equal to MAXSL, otherwise handle by following method;
If xd>yd is equally divided into the splits section with former needle tracking, splits=(xd+MAXSL-1)/MAXSL;
If xd<=yd is equally divided into the splits section with former needle tracking, splits=(yd+MAXSL-1)/MAXSL;
2) rearrange needle tracking according to color
This step is imported unsorted needle tracking tabulation stitches, the needle tracking tabulation newstitches that output rearranges by color, and arthmetic statement is as follows:
When needle tracking tabulation stitches is not empty, repeat following steps;
From needle tracking tabulation stitches, take out first needle tracking stitch;
Preserve the color curColor of needle tracking stitch;
Needle tracking stitch is joined among the new needle tracking tabulation newstitches;
All needle trackings among the traversal needle tracking stitches, to each needle tracking:
If this needle tracking and stitches gauge outfit are all non-intersect to all needle trackings between this needle tracking, then this needle tracking is put into newstitches, this needle tracking of deletion from stitches.
3) connect adjacent homochromy and needle tracking that distance is very near;
Previous step is divided into plurality of sections with the needle tracking sequence by color suddenly, and each section color is identical but still discontinuous, and this step is handled respectively each section, adjusts the needle tracking order in section.This step is imported unsorted needle tracking tabulation stitches, the needle tracking tabulation newstitches that the output opsition dependent rearranges, and arthmetic statement is as follows:
From stitches, take out first needle tracking stitch;
Stitch is joined among the newstitches;
The final position of preserving stitch is curPos;
Step below when needle tracking tabulation stitches is not empty, repeating;
All needle trackings among the traversal stitches are to the distance of each needle tracking calculating needle tracking starting point and terminal point and curPos;
Take out beginning or end and curPos needle tracking stitch, if this needle tracking terminal point and curPos are apart from minimum, then with this needle tracking starting point and terminal point exchange apart from minimum;
If top minor increment less than 3, generates a new needle tracking, starting point is curPos, and terminal point is the stitch starting point, and the needle tracking that this is new adds newstitches;
Stitch is added newstitches;
Put the terminal point that curPos is sticth.
The invention provides a kind of thinking and method of computer-aided crewel embroidery production method; the method and the approach of this technical scheme of specific implementation are a lot; the above only is a preferred implementation of the present invention; should be understood that; for those skilled in the art; under the prerequisite that does not break away from the principle of the invention, can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.The all available prior art of each ingredient not clear and definite in the present embodiment is realized.

Claims (10)

1. a computer-aided crewel embroidery production method is characterized in that, may further comprise the steps:
Step 1, embroider the line color subclass and select: the embroidery line color that constitutes selection some from current embroidery line color according to the color for the treatment of embroidered image is as embroidering the line color subclass;
Step 2, shop look: will treat that embroidered image segmentation is some color block areas, then each color block areas is selected to embroider line with the color of color block areas color distance minimum from described embroidery line color subclass, adopt the intersection needle tracking to fill and generate embroidery needle tracking conceptual scheme picture, treat that in the embroidered image each puts square area in the corresponding embroidery needle tracking conceptual scheme picture, the needle tracking set of described intersection needle tracking for being made of two cross one another needle trackings;
Step 3, the smart embroidery: cover the upper left corner for the treatment of embroidered image with a foursquare moving window, this window traversal of sliding is then treated embroidered image, at every turn in this window position according to treating that the color distribution in the embroidered image seeks the intersection needle tracking;
Step 4, needle tracking sequential optimization: adjust the needle tracking order, make that adjacent independently needle tracking takes the needle continuously in step 2 and the step 3 when embroidered, thereby obtain random stitch embroidery embroidery needle tracking sequence;
Step 5, needle tracking coordinate conversion: according to employed embroidery line width, to be with the pixel needle tracking starting point of unit and terminal point coordinate be converted to that computer embroidering machine uses with the coordinate format of millimeter as unit, thereby generate the random stitch embroidery needle tracking sequence of computer embroidering machine form;
Step 6 with the random stitch embroidery needle tracking sequence input computer embroidering machine of described computer embroidering machine form, thereby obtains corresponding random stitch embroidery embroidery.
2. a kind of computer-aided crewel embroidery production method according to claim 1, it is characterized in that, in the step 1, use improved elite to select embroidery line color that genetic algorithm selects some as embroidering the line color subclass, described embroidery line color quantity is identical with the embroidery machine needle number.
3. a kind of computer-aided crewel embroidery production method according to claim 1 is characterized in that, described step 2 may further comprise the steps:
Step 21, smoothed image: remove the minutia for the treatment of in the embroidered image, keep the contour feature of color block areas;
Step 22, split image: use the color of color distance minimum in the embroidery line color that steps 1 select to replace to all pixels in the image after level and smooth, image segmentation is become several regions, the corresponding color in each zone is for filling the used embroidery line color in this zone;
Step 23, calculate each zone and intersect the direction parameter of needle tracking: according to the color characteristic in zone, the direction of zoning needle tracking;
Step 24 is filled each zone, adopts selected embroidery line color to use the intersection needle tracking to fill according to certain stitch density to each zone.
4. a kind of computer-aided crewel embroidery production method according to claim 1, it is characterized in that, in the step 3, the moving window traversing graph picture with certain size generates corresponding needle tracking earlier, and the size iteration traversing graph picture that reduces moving window again generates corresponding needle tracking; The traversing graph in back as the time moving window area be a preceding traversing graph as the time moving window area 3/4~1/4; Iterations is more than twice.
5. a kind of computer-aided crewel embroidery production method according to claim 4 is characterized in that, seeks the intersection needle tracking in the described step 3 and may further comprise the steps in moving window:
Step 31 uses different slope to seek straight-line segment, all the pixel color similarities on the described straight-line segment path promptly with the color distance of straight-line segment starting point less than threshold value, starting point and the terminal point coordinate that generates needle tracking according to the starting point and the terminal point coordinate of this straight-line segment then;
Step 32, according to the straight-line segment starting point in embroidery needle tracking conceptual scheme picture the ratio of the area that covered in the corresponding square area and square area area determine the color of needle tracking.
6. a kind of computer-aided crewel embroidery production method according to claim 1 is characterized in that, described step 4 may further comprise the steps:
Step 41, division minute hand mark: the needle tracking that surpasses length threshold in the needle tracking sequence is handled, this needle tracking is split into the needle tracking of some length less than length threshold according to length threshold;
Step 42, rearrange needle tracking according to color: traversal needle tracking sequence, if the color of current needle tracking is identical with the color of another needle tracking of front in the needle tracking sequence, and all other needle trackings between described current needle tracking and another needle tracking of described front all do not have cross reference, after then the position of current needle tracking being advanceed to another needle tracking of described front, thereby the needle tracking that color is identical is arranged continuously;
Step 43, connect the needle tracking of adjacent homochromy and distance less than certain threshold value: the needle tracking to continuously arranged same color is adjusted in proper order, each needle tracking is selected with its final position apart from the needle tracking of minimum as its next needle tracking, if two distance between needle point tracers, then insert the starting point of terminal point that a needle tracking connects last needle tracking and back one needle tracking from less than described threshold value the embroidery function is taken the needle continuously.
7. a kind of computer-aided crewel embroidery production method according to claim 5 is characterized in that, described step 31 may further comprise the steps:
Step 31a selects the starting point of two pixels as two straight-line segments at random in the upper left corner in square moving window and the lower left corner;
Step 31b determines the max-thresholds of color distance in described square moving window scope, if two color of pixel distances are less than this threshold value in the moving window, then is judged to be similarly, otherwise be dissmilarity; Max-thresholds is determined according to treating that the color in the moving window constitutes in the embroidered image;
Step 31c uses different slope to seek straight-line segment, all the pixel color similarities on the described straight-line segment path promptly with the color distance of straight-line segment starting point less than certain threshold value; Adopt certain color distance threshold value to seek straight-line segment earlier, if do not find, then strengthen the color distance threshold value and repeat to seek straight-line segment, when max-thresholds that the color distance threshold value calculates in greater than step 31b, then withdraw from step 31, this window traversal that continues to slide is treated embroidered image;
Step 31d, after treating to find qualified straight-line segment on the embroidered image, to starting point and the terminal point of the starting point of straight-line segment and the terminal point pixel that one of picked at random is not covered by needle tracking in the square area of described embroidery needle tracking conceptual scheme picture correspondence respectively as needle tracking.
8. a kind of computer-aided crewel embroidery production method according to claim 5 is characterized in that, described step 32 may further comprise the steps:
Step 32a, calculate the straight-line segment starting point found in embroidery needle tracking conceptual scheme picture the area that covered in the corresponding square area and the ratio of square area area;
Step 32b is if described ratio less than certain threshold value, is directly selected an embroidery line color with its color distance minimum according to the color for the treatment of corresponding pixel points in the embroidered image in embroidering the line color subclass; If the pixel ratio that this square area has covered, is then carried out the color that following steps are calculated needle tracking greater than certain threshold value;
Step 32c, obtain the color of being had a few in this square area and, substitute with the embroidery line color for the treatment of corresponding pixel points color distance minimum in the embroidered image with embroidering in the line color subclass during partial summation that is not capped, remember that this value is C Sum
Step 32d calculates the color and value C for the treatment of embroidered image corresponding point SumDifference C Diff, C Diff=n*n*C Org-C Sum, C wherein OrgFor treating the color of corresponding pixel points in the embroidered image, n is the length of side of this square area;
Step 32e calculates and repairs look C Rep=α * C Diff+ (1-α) * C Org, in embroidering the line color subclass, select and C RepThe embroidery line color of color distance minimum is as the needle tracking color, wherein parameter alpha ∈ (0,1] be the color adaptation factor.
9. a kind of computer-aided crewel embroidery production method according to claim 3 is characterized in that, described step 23 may further comprise the steps:
Step 23a, (i j), and calculates the gradient of described luminance picture to calculate the luminance picture I treat embroidered image
Figure FSA00000123803700031
G wherein x, G yBe respectively luminance picture is used the x that the Sobel operator obtains and the figure of y direction
The aberration branch; The convolution operation kernel that calculates the image difference employing of x, y direction is respectively:
- 1 0 1 - 2 0 2 - 1 0 1 , - 1 - 2 - 1 0 0 0 1 2 1
Step 23b, according to the gradient calculation θ value of luminance picture, algorithm is as follows:
θ = 1 2 arctan ( V x V y ) , Wherein V x = Σ ( u , v ) ∈ W 2 G x ( u , v ) G y ( u , v ) ,
V y = Σ ( u , v ) ∈ W ( G x ( u , v ) 2 - G y ( u , v ) 2 ) , W is the set of regional interior pixel, and (u v) is the coordinate of pixel among the W;
Step 23c, according to the gradient calculation β value of luminance picture, algorithm is as follows:
β = arctan ( Σ ( u , v ) ∈ W G x 2 ( u , v ) Σ ( u , v ) ∈ W G y 2 ( u , v ) ) , W is the set of regional interior pixel, and (u v) is the coordinate of pixel among the W;
Step 23d, with θ+β and θ-β as intersecting the direction of two needle trackings in the needle tracking, promptly with the axial angle of x.
10. a kind of computer-aided crewel embroidery production method according to claim 3 is characterized in that, described step 24 may further comprise the steps:
Step 24a calculates the boundary rectangle in described zone, and the limit of described boundary rectangle is parallel to x, y coordinate axis respectively;
Step 24b calculates the area that the single needle mark covers described zone according to the length of the single needle tracking of needle tracking direction calculating and width;
Step 24c is according to the quantity of filling required intersection needle tracking in the described circumscribed rectangular region of percentage calculation of the area coverage of setting;
Step 24d is evenly distributed needle tracking according to intersecting the quantity of needle tracking in boundary rectangle;
Step 24e removes in the needle tracking the not pixel in described zone, and the starting point of the straight-line segment that constitutes with remaining pixel and terminal point are as the starting point and the terminal point of needle tracking.
CN2010101752178A 2010-05-18 2010-05-18 Computer-aided crewel embroidery production method Expired - Fee Related CN101859335B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010101752178A CN101859335B (en) 2010-05-18 2010-05-18 Computer-aided crewel embroidery production method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010101752178A CN101859335B (en) 2010-05-18 2010-05-18 Computer-aided crewel embroidery production method

Publications (2)

Publication Number Publication Date
CN101859335A true CN101859335A (en) 2010-10-13
CN101859335B CN101859335B (en) 2011-09-07

Family

ID=42945244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010101752178A Expired - Fee Related CN101859335B (en) 2010-05-18 2010-05-18 Computer-aided crewel embroidery production method

Country Status (1)

Country Link
CN (1) CN101859335B (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102995324A (en) * 2011-09-08 2013-03-27 詹逢志 Image embroidery process capable of showing stereoscopic, vivid and realistic effects
CN103065023A (en) * 2013-01-29 2013-04-24 四川大学 Design for fur / leather weaving products based on computer aided design and production method thereof
CN103180880A (en) * 2010-10-25 2013-06-26 威仕达品特技术有限公司 Embroidery image rendering using parametric texture mapping
CN103294864A (en) * 2013-05-29 2013-09-11 南京大学 Computer-aided disordered needlework manufacture method using genetic algorithms
CN103473433A (en) * 2013-09-29 2013-12-25 南京大学 Computer-assisted disordered needlework manufacture method based on reaction diffusion process
CN103793549A (en) * 2013-11-04 2014-05-14 南京大学 Computer-aided random stitch embroidery producing method adopting fuzzy clustering and random walk
CN104060417A (en) * 2014-07-02 2014-09-24 苏州市叶绣工艺厂 Wireless embroidery system
CN104278451A (en) * 2014-10-31 2015-01-14 诸暨银河机电有限公司 Picture embroidering machine system
CN105701836A (en) * 2016-03-02 2016-06-22 丹阳正则绣艺术有限公司 Method for aided design of random stitch embroidery through adoption of image process software
CN110512372A (en) * 2019-08-22 2019-11-29 厦门盈趣科技股份有限公司 Embroidery machine embroidery control method, system, embroidery machine and storage medium
CN113379856A (en) * 2021-06-30 2021-09-10 珠海必要工业科技股份有限公司 Embroidery effect graph generation method and device and storage medium
CN113373607A (en) * 2021-06-30 2021-09-10 珠海必要工业科技股份有限公司 Embroidery needle path generation method and device and storage medium
CN113393542A (en) * 2021-06-30 2021-09-14 珠海必要工业科技股份有限公司 Embroidery effect graph generation method and device, electronic equipment and storage medium
CN114782581A (en) * 2022-06-24 2022-07-22 杭州小影创新科技股份有限公司 Image embroidery special effect conversion method and device
CN116579934A (en) * 2023-04-06 2023-08-11 湖南师范大学 Embroidery plate making processing method and system based on edge detection

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1401844A (en) * 2002-04-09 2003-03-12 深圳市盈宁科技有限公司 Method for making embroidery product by computer design
EP1676945A1 (en) * 2003-10-15 2006-07-05 Shima Seiki Manufacturing, Ltd. Embroidery data creation device, embroidery data creation method, and embroidery data creation program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1401844A (en) * 2002-04-09 2003-03-12 深圳市盈宁科技有限公司 Method for making embroidery product by computer design
EP1676945A1 (en) * 2003-10-15 2006-07-05 Shima Seiki Manufacturing, Ltd. Embroidery data creation device, embroidery data creation method, and embroidery data creation program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《计算机学报》 20110331 陈圣国等 计算机辅助乱针绣制作技术研究 526-538 1-10 第34卷, 第3期 2 *

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103180880A (en) * 2010-10-25 2013-06-26 威仕达品特技术有限公司 Embroidery image rendering using parametric texture mapping
CN102995324A (en) * 2011-09-08 2013-03-27 詹逢志 Image embroidery process capable of showing stereoscopic, vivid and realistic effects
CN103065023B (en) * 2013-01-29 2015-07-15 四川大学 Design for fur / leather weaving products based on computer aided design and production method thereof
CN103065023A (en) * 2013-01-29 2013-04-24 四川大学 Design for fur / leather weaving products based on computer aided design and production method thereof
CN103294864A (en) * 2013-05-29 2013-09-11 南京大学 Computer-aided disordered needlework manufacture method using genetic algorithms
CN103294864B (en) * 2013-05-29 2016-01-20 南京大学 A kind of computer-aided crewel embroidery production method adopting genetic algorithm
CN103473433A (en) * 2013-09-29 2013-12-25 南京大学 Computer-assisted disordered needlework manufacture method based on reaction diffusion process
CN103473433B (en) * 2013-09-29 2016-01-20 南京大学 A kind of computer-aided crewel embroidery production method based on reaction and diffusion process
CN103793549A (en) * 2013-11-04 2014-05-14 南京大学 Computer-aided random stitch embroidery producing method adopting fuzzy clustering and random walk
CN103793549B (en) * 2013-11-04 2016-06-22 南京大学 Adopt the computer-aided crewel embroidery production method of fuzzy clustering and random walk
CN104060417A (en) * 2014-07-02 2014-09-24 苏州市叶绣工艺厂 Wireless embroidery system
CN104278451A (en) * 2014-10-31 2015-01-14 诸暨银河机电有限公司 Picture embroidering machine system
CN105701836A (en) * 2016-03-02 2016-06-22 丹阳正则绣艺术有限公司 Method for aided design of random stitch embroidery through adoption of image process software
CN110512372A (en) * 2019-08-22 2019-11-29 厦门盈趣科技股份有限公司 Embroidery machine embroidery control method, system, embroidery machine and storage medium
CN113373607A (en) * 2021-06-30 2021-09-10 珠海必要工业科技股份有限公司 Embroidery needle path generation method and device and storage medium
CN113379856A (en) * 2021-06-30 2021-09-10 珠海必要工业科技股份有限公司 Embroidery effect graph generation method and device and storage medium
CN113393542A (en) * 2021-06-30 2021-09-14 珠海必要工业科技股份有限公司 Embroidery effect graph generation method and device, electronic equipment and storage medium
CN113379856B (en) * 2021-06-30 2022-11-22 珠海必要工业科技股份有限公司 Embroidery effect graph generation method and device and storage medium
CN114782581A (en) * 2022-06-24 2022-07-22 杭州小影创新科技股份有限公司 Image embroidery special effect conversion method and device
CN114782581B (en) * 2022-06-24 2022-10-04 杭州小影创新科技股份有限公司 Image embroidery special effect conversion method and device
CN116579934A (en) * 2023-04-06 2023-08-11 湖南师范大学 Embroidery plate making processing method and system based on edge detection
CN116579934B (en) * 2023-04-06 2024-04-16 湖南师范大学 Embroidery plate making processing method and system based on edge detection

Also Published As

Publication number Publication date
CN101859335B (en) 2011-09-07

Similar Documents

Publication Publication Date Title
CN101859335B (en) Computer-aided crewel embroidery production method
CN104063562A (en) Method used for generating bottom embroidery draft of disordered needlework and based on color clustering
CN103294864B (en) A kind of computer-aided crewel embroidery production method adopting genetic algorithm
CN107045551B (en) Hunan embroidery image gene construction and Hunan embroidery image digital processing method
CN103088515B (en) Method suitable for weaving colored jacquard fabric with large texture thread number
WO2022179097A1 (en) Method and system for automatically constructing editable model of isogeometric topology optimization result
CN114386295B (en) Textile computer simulation method based on color separation and color change of colored spun yarns
CN102663806A (en) Artistic-vision-based cartoon stylized rendering method of image
CN101414168B (en) Automatic drip model method of microcomputer combining with digital control drip model machine
CN106875459B (en) Self-adaptive equalization method for color jacquard weave structure based on image segmentation
CN103793549B (en) Adopt the computer-aided crewel embroidery production method of fuzzy clustering and random walk
CN104331883B (en) A kind of image boundary extraction method based on asymmetric inversed placement model
CN110757806A (en) 3D printing-oriented double-type-shape close-laying method and system
CN101781833B (en) Generation method of numerical control quilting processing procedure
Zhenyuan et al. Directionality‐Aware Design of Embroidery Patterns
CN102508948B (en) Processing method of jacquard fabric based on Peano curve fractal graph
CN102117485B (en) Method for automatically segmenting images based on target shape
CN106997471A (en) A kind of determination method and system of Tangka's image type
CN106296804A (en) A kind of construction method of parametrization Three-dimension Tree sign mould
CN108280861B (en) Method for intelligently searching and circularly processing pictures
Sun et al. Design of Three‐Dimensional Pleated Clothing Pattern Based on Computer Animation Technology
CN1981077A (en) Yarn image forming apparatus for melange yarn, method of forming yarn image therewith, and program therefor
CN113584665B (en) Textile pattern design method based on quasi-regular pattern drawing and textile thereof
CN109753758A (en) A kind of production method of bamboo weaving calligraphy, writing
DU et al. Terrain edge stitching based on least squares generative adversarial networks

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110907

Termination date: 20150518

EXPY Termination of patent right or utility model