CN108038819A - A kind of stroke generation method based on interactive mode - Google Patents
A kind of stroke generation method based on interactive mode Download PDFInfo
- Publication number
- CN108038819A CN108038819A CN201711338215.4A CN201711338215A CN108038819A CN 108038819 A CN108038819 A CN 108038819A CN 201711338215 A CN201711338215 A CN 201711338215A CN 108038819 A CN108038819 A CN 108038819A
- Authority
- CN
- China
- Prior art keywords
- stroke
- sample
- mrow
- msup
- path
- 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
Links
- 230000002452 interceptive effect Effects 0.000 title claims abstract description 23
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000004422 calculation algorithm Methods 0.000 claims description 13
- 238000006073 displacement reaction Methods 0.000 claims description 12
- 238000011049 filling Methods 0.000 claims description 11
- 238000013507 mapping Methods 0.000 claims description 9
- 239000004576 sand Substances 0.000 claims description 7
- 210000000988 bone and bone Anatomy 0.000 claims description 4
- 239000000523 sample Substances 0.000 claims 39
- 230000003466 anti-cipated effect Effects 0.000 claims 1
- 239000013074 reference sample Substances 0.000 claims 1
- 230000017105 transposition Effects 0.000 claims 1
- 239000000976 ink Substances 0.000 description 18
- 230000015654 memory Effects 0.000 description 14
- 238000004590 computer program Methods 0.000 description 10
- 238000010422 painting Methods 0.000 description 10
- 230000006872 improvement Effects 0.000 description 9
- 238000009877 rendering Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000003860 storage Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 244000025254 Cannabis sativa Species 0.000 description 2
- 241000196324 Embryophyta Species 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 239000013256 coordination polymer Substances 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000009792 diffusion process Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000003973 paint Substances 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 101100346764 Mus musculus Mtln gene Proteins 0.000 description 1
- XCWPUUGSGHNIDZ-UHFFFAOYSA-N Oxypertine Chemical compound C1=2C=C(OC)C(OC)=CC=2NC(C)=C1CCN(CC1)CCN1C1=CC=CC=C1 XCWPUUGSGHNIDZ-UHFFFAOYSA-N 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000013508 migration Methods 0.000 description 1
- 230000005012 migration Effects 0.000 description 1
- 238000002156 mixing Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 241000894007 species Species 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
The present invention discloses a kind of stroke generation method based on interactive mode, comprises the following steps, and obtains an image comprising pattern as image object;A delineation operation is obtained on the drawing sample to prestore, the delineation operation includes at least one stroke sample;The elementary contour that user delineates on described image object is obtained, the elementary contour forms the preliminary elementary path of stroke to be generated;By being corrected to the outline strokes in the stroke sample, accurate stroke sample is obtained as candidate's stroke sample;Using candidate's stroke sample as reference, stroke form sample group is generated by way of mirror image and anti-path;Selection and the most matched form sample of the preliminary elementary path in the stroke form sample group, as final stroke sample;The final stroke sample is mapped on the preliminary elementary path, stroke of the generation with the drawing sample style.
Description
Technical field
The present invention relates to the Style Transfer technology of computer graphics non-photorealistic rendering, more particularly to one kind is based on interaction
The stroke generation method of formula.
Background technology
Chinese freehand brushwork ink and wash is different from other drawing species (such as western canvas, watercolor), describes to have with very few strokes
The scenery object or scene of body, express the creation intention and artistic individuality of artist.Enjoyable ink and wash is inhaled with its unique artistry
Draw more and more people and learn creation ink and wash, include the drawing fan on no drawing techniques basis.Moreover, at present mostly
Several graphics class business softwares (such as Adobe Illustrator, Adobe Photoshop, CorelDRAW etc.) supports China
The Core Generator of artistic style.However, the paint of generation high quality usually requires the knowledge and skills of specialty, and it is existing
Draw tool is required complicated and accurately entered in terms of drawing skill, meanwhile, generate the instrument of drawing (such as using Style Transfer
Fig. 1 (b)) only by certain drawing style bulk migration to given object, seldom consider local stroke form and color.
Flowers ink and wash is one of primary categories in Chinese ink painting, and the important artistic that it represents oriental painting is special
Sign.In other words, the artistic charm and value of ink and wash uniqueness are typically formd in flower-and-plant painting with pen, with black gimmick:It
Stroke is curved or straight, bold or soft, wide or narrow, pale or simple and honest;Its mass colour passes through the mixing between water and ink
Diffusion reaches the deep or light a variety of changes of dry and wet.Therefore, the diversity and complexity of stroke and mass colour, and the specialized skills of drawing
Make the work that generation is painted rich in challenge.
In general, non-photorealistic rendering refers to by building different brush models, pen of the output with artistic style
Draw, describe specific object as Freehandhand-drawing.In recent years, having some must learn with the relevant outstanding working value of non-photorealistic rendering
Practise and use for reference.Mainly there is the work of following two aspects:
On the one hand it is the model based on physics:Lead to provide the user with naturally impression, the equipment as pen directly perceived
Cross and the physical attribute of pen or other media is modeled, simulate the physical process of drawing.Wherein, Chu and Tai is in document [Chu
N.S.H.,Tai C.-L.,“MoXi:Real-Time Ink Di spersion inAbsorbent Paper”,ACM
Transactions on Graphics, vol.24 (3), pp.504-511,2005] in design one real-time painting system carry out mould
Intend in the effect for having absorptive paper inking diffusion.Meanwhile Xu etc. document [Xu S., Tang M., LAU F., et al.,
“Virtual Hairy Brush for Painterly Rendering”,Graphical Models,vol.66(5),
Pp.263-302,2004] propose a kind of novel for Chinese calligraphy and " the electronics brush " of drawing in, only determined with four attribute
The justice essential characteristic of true brush.Lu etc. is in document [Lu J., Barnes C., DiVerdi S., et al., " Rea
lBrush:Painting with Examples of Physical Media”,ACM Transactions on
Graphics, vol.32 (4), pp.117,2013] painting system of an interactive data-driven is proposed in, it can profit
New stroke is synthesized with the scan image of real media, avoids the calculating of the physical analogy of complexity.It is soft for digitlization drawing
Part, such as Adobe brush packages, ArtRage, and Corel Painter, user is just as using real brush one
Sample, operates mouse or digital pen is painted.However, for the user of no related drawing experience, if not to them
Carry out the training on operation of such virtual unit, then easily and to operate this kind equipment exactly be complicated and difficult.On the other hand
It is the model based on image:Compared with physical model, this class model avoids large-scale calculation amount and complicated manipulation.In mould
In terms of intending west drawing, Herzmann etc. document [Hertzmann A., Jacobs C.E., Oliver N., et al.,
“Image analogies”,In:Proceedings of the 28th Annual Conference on Computer
Graphics and Interactive Techniques, New York, USA, pp.327-340,2001] in use " image
Analogy " technical finesse photograph image, image of the generation with artistic effect, but in their experimental result, painted for China
For picture, due to drawing different image-regions using different styles, algorithm cannot be distinguished by these regions, so being paid no attention to
The stylized result thought.In terms of oriental painting is simulated, Xie etc. is in document [Xie N., Laga H., Saito S., " IR2s:
interactive real photo to Sumi-e”,In:Proceedings of the 8th International
Symposium on Non-Photorealistic Animation and Rendering,Annecy,France,pp.63-
71,2010] interactive system painted based on grass is devised in, the ink that real photo is converted to Japan draws drawing.
Dong etc. is in document [Dong L., Lu S.and Jin X., " Real-time Image-based Chinese Ink
Painting Rendering”,Multimedia Tools&Applications,vol.69(3),pp.605-620,2014]
In the image with Chinese ink style converted the image into by texture mapping and Future Opportunities of Texture Synthesis.However, existing mould
The model for intending oriental painting style mainly handles whole image, rather than forms the stroke of image, is so difficult to show China
Paint rich and changeful art feature.
The content of the invention
For above-mentioned technical problem, the shortcomings of the prior art is overcome, the present invention provides a kind of based on interactive
Stroke generation method;Be capable of providing series of algorithms instructs lines to be converted into certain by what the user on photo drew roughly
The stroke of Chinese ink painting's style, realizes migrating to the effect of photograph image for Chinese ink style.
The present invention provides a kind of based on interactive stroke generation method, comprise the following steps, obtain one and include figure
The image of case is as image object;
A delineation operation is obtained on the drawing sample to prestore, the delineation operation includes at least one stroke sample;
The elementary contour that user delineates on described image object is obtained, the elementary contour forms the first of stroke to be generated
Walk elementary path;
By being corrected to the outline strokes in the stroke sample, accurate stroke sample is obtained as candidate's stroke
Sample;Using candidate's stroke sample as reference, stroke form sample group is generated by way of mirror image and anti-path;
Selection and the most matched form sample of the preliminary elementary path in the stroke form sample group, as final
Stroke sample;
The final stroke sample is mapped on the preliminary elementary path, generation is with the drawing sample style
Stroke.
As a further improvement, the profile of the stroke sample by drawing a circle to approve out wraps the step of correction
Include:
Determine to obtain candidate's pen most close to the profile of stroke edge in the stroke sample using opposite searching algorithm
Draw sample;
Using candidate's stroke sample as reference, form sample group is generated by way of mirror image and anti-path;Wherein,
Each form sample group includes at least four form samples, and four form samples include the candidate as reference
Stroke sample, the mirror image stroke sample of candidate's stroke sample, the anti-path stroke of candidate's stroke sample and the time
Select the anti-path stroke of stroke sample mirror image stroke.
As a further improvement, the selection in the form sample group and the most matched shape of the preliminary elementary path
Aspect this as final stroke sample, including,
The elementary path is divided into some path sections, by energy theorem, is chosen in the form sample group
With final stroke sample of the most matched form sample of the path sections as the path sections.
As a further improvement, it is described by energy theorem, chosen and the path sections in the form sample group
The step of final stroke sample of the most matched form sample as the path sections, includes,
The energy theorem is in l2One energy term of definition space, for describing the outline strokes in the final stroke sample
Displacement item and corresponding preliminary elementary path (path sections) displacement item total difference, and make the totality poor
Different minimum, so as to automatically select the final stroke sample;
Wherein, the displacement item is used to describe the outline strokes in the final stroke sample and the preliminary elementary path
Displacement between the relative position vector and stroke direction vector at upper any point.
As a further improvement, the style and features by the final stroke sample are mapped to the preliminary elementary path
On step include,
Adjust the Aspect Ratio of the final stroke sample so that the final stroke sample and the corresponding path portion
The Aspect Ratio divided is consistent.
As a further improvement, the style and features by the final stroke sample are mapped to the preliminary elementary path
On step further include,
By the texture-mapping algorithm based on pixel, rasterisation filling region is realized and with from the final pen with scan line
The pixel filling selected in picture is into path sections corresponding with the finally stroke.
As a further improvement, including:
With pixel described in following constraint:
a、pSAdjacent pixel there is distance pFThe nearest color value of neighborhood;
b、pSWith pFPosition with respect to its respective bone path is nearest;
c、pSWith pPThe average color of the pixel of surrounding is closest;
Wherein, pSIt is the best pixel selected in ink stroke region;pFFor any pixel in filling region;pPFor
Pixel in input picture;And weigh constraints above condition, E by 3 energy termsb(pS) constraints a is corresponded to, p is describedSWith pF
Between neighborhood territory pixel color data error summation;
Ep(pS) constraints b is corresponded to, p is describedSWith pFDegree of closeness between corresponding skeleton path respectively;
Ea(pS) constraints c is corresponded to, p is describedSWith pPAverage color using some R as pixel in the circle of radius respectively
Difference;
Specifically meet the following formula:
Wherein, λ (p) represents the color value of p,It is pSNeighborhood territory pixel, and pi FIt is pFNeighborhood territory pixel,Skeleton
Distance p on pathFNearest point is identicalUnder value,It is the correspondence on the skeleton path in the final stroke sample
A bit, rSAnd rPIt is the half of the final stroke specimen width respectively, N represents that all pixels are total in the circle of specified radius R
Number,Represent circle inherence pSNeighbouring pixel, andRepresent in photograph image, specifying p in circlePNeighbouring pixel.
As a further improvement, the texture-mapping algorithm based on pixel, using in l1Definition is by 3 energy in space
Three a energy terms simultaneously are minimized to obtain best pixel by the energy equation that is formed of item, this step meets the following formula:
Wherein, α1, α2And α3Represent balance weight parameter.
Brief description of the drawings
In order to illustrate more clearly of technical scheme, attached drawing needed in embodiment will be made below
Simply introduce, it should be apparent that, drawings in the following description are only some embodiments of the present invention, general for this area
For logical technical staff, without creative efforts, other attached drawings can also be obtained according to these attached drawings.
Fig. 1 is the ink image and the ink image comparison figure of existing draw tool generation that the present invention generates, wherein (b)
For the ink image of existing draw tool generation, (C) is the ink image that the present invention generates.
Fig. 2 is the overall flow figure of the method for the present invention.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work
Embodiment, belongs to the scope of protection of the invention.
Referring to Fig. 2, Fig. 2 is the first embodiment of the present invention, there is provided a kind of stroke generation method based on interactive mode,
Comprise the following steps:
S10, obtains an image comprising pattern as image object;
A delineation operation is obtained on the drawing sample to prestore, the delineation operation bag at least includes a stroke sample;
The picture material that image object is included, its pattern can be animal, plant etc., and the specific can be ox, horse, flower
Grass, vegetation;The subject matter of the sample to prestore can also be animal, plant etc., and the subject matter of sample simultaneously needs and the figure in image object
Case is consistent, for example, subject matter be flowers, the subject matter of pattern also needs to be consistent;In other words, image object is selected is
User wants the template of the elementary path sketched the contours, and the stroke style feature for the elementary path that stroke sample, which is user, to be wanted.
S20, obtains the elementary contour that user delineates on described image object, and the elementary contour forms stroke to be generated
Preliminary elementary path;
Here mentioned delineate can be not up to the effect completely the same with pattern elementary contour, can be a kind of rough
Sketch the contours, while the intention of user can also be included wherein, such as add in pattern template the lines that are not present to preliminary base
This path.
S30, by being corrected to the outline strokes in the stroke sample, obtains accurate stroke sample as candidate
Stroke sample;Using candidate's stroke sample as reference, stroke form sample group is generated by way of mirror image and anti-path;
During stroke sample is drawn a circle to approve, because being only the region for having drawn a circle to approve desired stroke in stroke sample, this
Non- stroke region (non-stroke region referred herein is the part for not including stroke lines) wherein occurs, such influence is
The information that stroke sample areas includes not is that accurate outline strokes information also includes disturbing factor, is unfavorable for stroke sample
The extraction of specific outline strokes in this, while to ensure efficiency and experience of the user when choosing stroke sample, this interference
Factor is unavoidable, therefore the extraction of stroke sample profile is unavoidable in stroke sample.
In the present embodiment, determined using opposite searching algorithm in the stroke sample most close to the profile of stroke edge,
Obtain candidate's stroke sample;
In opposite searching algorithm, the outline strokes in stroke sample are by a three curvilinear structures (CS,LS,RS) represent, its
Middle CS(t)∈ISBy CS(t)=(LS(t)+RS(t))/2 obtain, and its domain FSIn LSAnd RSBetween by as candidate's stroke sample
General profile, LSAnd RSIt is the two sides of the general profile;Then by side LSAnd RSIt is fitted to curve LS(t) and RS(t),
And split the curve segment that it is identical quantity;It is assumed that the endpoint in each curve segment is as LS(t) and RS(t) feature on
Point, will be from LS(t) it is directed toward RS(t) line orientations are defined as the positive direction ω (t) of search, respectively along ω (t) and-ω (t) sides
To calculating the directional derivative D of each grey scale pixel value+ωAnd D-ω, each pair characteristic point is finally reset to the direction derivative overall situation most
On the position of small value;Adjust side LSAnd side RSInto most close to the profile of the stroke in stroke sample.
And using candidate's stroke sample as reference, form sample group, mould are generated by way of mirror image and anti-path
Intend the different posture of candidate's stroke sample;Wherein, each form sample group includes at least four form samples, described in four
Form sample includes the candidate's stroke sample, the mirror image stroke sample of candidate's stroke sample, the candidate as reference
The anti-path stroke of the anti-path stroke of stroke sample and candidate's stroke sample mirror image stroke.
According to three curvilinear structures, meet formula (1), defined formula (1) is:
Wherein, if n is dry brush number of samples, a time for including 4n element is formed by 4 kinds of situations of each stroke
Selected works close:Then 4 kinds of situations of stroke are followed successively by
S40, selection and the most matched form sample of the preliminary elementary path in the stroke form sample group, as
Final stroke sample;
The preliminary elementary path is divided into some path sections, by energy theorem, in the form sample group
Choose and final stroke sample of the most matched form sample of the path sections as the path sections.Candidate's stroke sample
Form is relatively simple, causes to be difficult to be matched with preliminary elementary path, a variety of candidate's stroke forms of form sample group generation
Add the matching probability of path sections and candidate's stroke.
Illustrated with reference to energy theorem, energy theorem is in l2Definition spaceDescriptionWith CPBetween displacement item δ
Total difference, wherein, the displacement item be used to describe outline strokes in the final stroke sample with it is described preliminary basic
Displacement on path between the relative position vector at any point and stroke direction vector.Then make the total difference minimum
Change, so as to automatically select optimal stroke masterplate.Meet formula (2), defined formula (2) is:
Wherein, displacement item δ is calculated by formula (3), and defined formula (3) is:
Wherein,For any elementary path,ForArriveLine orientations,ForIt is upper any one
PointRelative position vectorExtremelyMapping,For the displacement of closest point.
S50, the final stroke sample is mapped on the preliminary elementary path, and generation has the drawing sample wind
The stroke of lattice.
The corresponding form sample of each path sections has been obtained by energy theorem in above-mentioned part, then will be per all the way
The corresponding form sample substitution original route part of path portion, generation meet the profile of the selected stroke sample characteristics of user;With
The Aspect Ratio of the final stroke sample is adjusted afterwards so that the length of the final stroke sample and the corresponding path sections
Wide ratio is consistent;And by the texture-mapping algorithm based on pixel, rasterisation filling region is realized and with from institute with scan line
The pixel filling selected in final stroke is stated into path sections corresponding with the finally stroke.
Adjusting the Aspect Ratio of the final stroke sample so that the final stroke sample and the corresponding path
In partial Aspect Ratio process consistent, final stroke width wP(t) with the photo object on preliminary elementary path CP
Length it is related to curvature.The wP(t) it is calculated by formula (4), defined formula (4) is:
Wherein, kw(t) be the final stroke specimen width of bi-directional scaling coefficient, LPAnd κP(t) represent preliminary basic respectively
The length and curvature in path.Coefficient entry kw(t) it is calculated by formula (5), defined formula (5) is:
Wherein, κS(t) the preliminary elementary path C of tableS(t) curvature, LSRepresent CS(t) length.
By realizing rasterisation filling region and with from described final with scan line based on the texture-mapping algorithm of pixel
During the pixel filling selected in stroke to path sections corresponding with the finally stroke, with described in following constraint
Pixel:
a、pSAdjacent pixel there is distance pFThe nearest color value of neighborhood;
b、pSWith pFPosition with respect to its respective bone path is nearest;
c、pSWith pPThe average color of the pixel of surrounding is closest;
Wherein, pSIt is the best pixel selected in ink stroke region;pFFor any pixel in filling region;pPFor
Pixel in input picture;And weigh constraints above condition by 3 energy terms:
Eb(pS) constraints a is corresponded to, p is describedSWith pFBetween neighborhood territory pixel color data error summation;
Ep(pS) constraints b is corresponded to, p is describedSWith pFDegree of closeness between corresponding skeleton path respectively;
Ea(pS) constraints c is corresponded to, p is describedSWith pPAverage color using some R as pixel in the circle of radius respectively
Difference;
It meets the following formula:
Wherein, λ (p) represents the color value of p,It is pSNeighborhood territory pixel, andIt is pFNeighborhood territory pixel,Bone
Distance p on frame pathFNearest point is identicalUnder value,
Be correspondence on the skeleton path in the final stroke sample a bit, rSAnd rPIt is described final respectively
The half of stroke specimen width, N represent all pixels sum in the circle of specified radius R,Represent circle inherence pSNeighbouring picture
Element, andRepresent in photograph image, specifying p in circlePNeighbouring pixel.
The texture-mapping algorithm based on pixel, using in l1The energy being made of 3 energy terms is defined in space
Three energy terms simultaneously are minimized to obtain best pixel by equation, this step meets the following formula:
Wherein, α1, α2And α3Represent balance weight parameter.
Second embodiment of the invention provide the equipment based on interactive stroke generation include processor, memory and
The computer program performed by the processor is stored in the memory and is configured as, the processor performs the meter
Calculation machine program, for example, it is described based on interactive stroke generation program.
Exemplary, the computer program can be divided into one or more modules, one or more described mould
Block is stored in the memory, and is performed by the processor, to complete the present embodiment.One or more modules can
To be the series of computation machine programmed instruction section that can complete specific function, which is used to describing the computer program existing
Based on the implementation procedure in interactive stroke generation terminal device.
The stroke generation equipment based on interactive mode can be desktop PC, notebook, palm PC and high in the clouds
The computing devices such as server.
It is described to may include based on interactive stroke generation equipment, but it is not limited only to processor, memory, display.This
Field technology personnel are appreciated that the schematic diagram is only based on the example of the stroke generation equipment of interactive mode, do not form
To the restriction based on interactive stroke generation equipment, components more more or fewer than diagram can be included, or combine some
Component, or different components, such as based on interactive stroke generation equipment can also include input-output equipment, network connects
Enter equipment, bus etc..
Alleged processor can be central processing unit (Central Processing Unit, CPU), can also be it
His general processor, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
It is the control centre based on interactive stroke generation equipment Deng, the processor, utilizes various interfaces and connection
The whole various pieces based on interactive stroke generation equipment.
The memory can be used for storing the computer program and/or module, and the processor is by running or performing
The computer program and/or module being stored in the memory, and the data being stored in memory are called, described in realization
Various functions based on interactive stroke generation equipment.The memory can mainly include storing program area and storage data
Area, wherein, storing program area can storage program area, needed at least one function application program (such as sound-playing function,
Text conversion function etc.) etc.;Storage data field can be stored uses created data (such as voice data, text according to mobile phone
Word message data etc.) etc..In addition, memory can include high-speed random access memory, non-volatile memories can also be included
Device, such as hard disk, memory, plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure
Digital, SD) card, flash card (Flash Card), at least one disk memory, flush memory device or other volatibility are consolidated
State memory device.
Wherein, if the module based on interactive stroke generation integration of equipments is real in the form of SFU software functional unit
Now and as independent production marketing or in use, it can be stored in a computer read/write memory medium.Based on so
Understanding, the present invention realizes all or part of flow in above-described embodiment method, can also be instructed by computer program
Relevant hardware is completed, and the computer program can be stored in a computer-readable recording medium, the computer journey
Sequence is when being executed by processor, it can be achieved that the step of above-mentioned each embodiment of the method.Wherein, the computer program includes calculating
Machine program code, the computer program code can be source code form, object identification code form, executable file or it is some in
Between form etc..The computer-readable medium can include:Any entity or dress of the computer program code can be carried
Put, recording medium, USB flash disk, mobile hard disk, magnetic disc, CD, computer storage, read-only storage (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software
Distribution medium etc..It should be noted that the content that includes of the computer-readable medium can be according to making laws in jurisdiction
Appropriate increase and decrease is carried out with the requirement of patent practice, such as in some jurisdictions, according to legislation and patent practice, computer
Computer-readable recording medium does not include electric carrier signal and telecommunication signal.
It should be noted that device embodiment described above is only schematical, wherein described be used as separating component
The unit of explanation may or may not be physically separate, can be as the component that unit is shown or can also
It is not physical location, you can with positioned at a place, or can also be distributed in multiple network unit.Can be according to reality
Need to select some or all of module therein to realize the purpose of this embodiment scheme.In addition, device provided by the invention
In embodiment attached drawing, the connection relation between module represents there is communication connection between them, specifically can be implemented as one or
A plurality of communication bus or signal wire.Those of ordinary skill in the art are without creative efforts, you can to understand
And implement.
The above is the preferred embodiment of the present invention, it is noted that for those skilled in the art
For, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also considered as
Protection scope of the present invention.
Claims (8)
- It is 1. a kind of based on interactive stroke generation method, it is characterised in that comprise the following steps,An image comprising pattern is obtained as image object;A delineation operation is obtained on the drawing sample to prestore, the delineation operation includes at least one stroke sample;The elementary contour that user delineates on described image object is obtained, the elementary contour forms the preliminary base of stroke to be generated This path;By being corrected to the outline strokes in the stroke sample, accurate stroke sample is obtained as candidate's stroke sample This;Using candidate's stroke sample as reference, stroke form sample group is generated by way of mirror image and anti-path;Selection and the most matched form sample of the preliminary elementary path in the stroke form sample group, as final stroke Sample;The final stroke sample is mapped on the preliminary elementary path, pen of the generation with the drawing sample style Draw.
- 2. the according to the method described in claim 1, it is characterized in that, profile of the stroke sample by drawing a circle to approve out The step of being corrected includes:Determine to obtain candidate's stroke sample most close to the profile of stroke edge in the stroke sample using opposite searching algorithm This;Using candidate's stroke sample as reference, form sample group is generated by way of mirror image and anti-path;Wherein, it is each The form sample group includes at least four form samples, and four form samples include candidate's stroke as reference Sample, the mirror image stroke sample of candidate's stroke sample, the anti-path stroke of candidate's stroke sample and candidate pen Draw the anti-path stroke of sample mirror image stroke.
- 3. according to the method described in claim 1, it is characterized in that, the selection in the form sample group with it is described preliminary The most matched form sample of elementary path as final stroke sample, including,The elementary path is divided into some path sections, by energy theorem, selection and institute in the form sample group State final stroke sample of the most matched form sample of path sections as the path sections.
- 4. according to the method described in claim 3, it is characterized in that, described by energy theorem, in the form sample group Choose includes with the step of final stroke sample of the most matched form sample of the path sections as the path sections,The energy theorem is in l2One energy term of definition space, for describing the position of the outline strokes in the final stroke sample The total difference of the displacement item of transposition and corresponding preliminary elementary path (path sections), and make the total difference most Smallization, so as to automatically select the final stroke sample;Wherein, the outline strokes that the displacement item is used to describe in the final stroke sample are taken up an official post with the preliminary elementary path The displacement anticipated between the relative position vector and stroke direction vector of a bit.
- 5. according to the method described in claim 3, it is characterized in that, the style and features by the final stroke sample map Step on to the preliminary elementary path includes,Adjust the Aspect Ratio of the final stroke sample so that the final stroke sample and the corresponding path sections Aspect Ratio is consistent.
- 6. according to the method described in claim 1, it is characterized in that, the style and features by the final stroke sample map Step on to the preliminary elementary path further includes,By the texture-mapping algorithm based on pixel, rasterisation filling region is realized and with out of described final stroke with scan line The pixel filling selected is into path sections corresponding with the finally stroke.
- 7. according to the method described in claim 1, it is characterised in that it includes:With pixel described in following constraint:a、pSAdjacent pixel there is distance pFThe nearest color value of neighborhood;b、pSWith pFPosition with respect to its respective bone path is nearest;c、pSWith pPThe average color of the pixel of surrounding is closest;Wherein, pSIt is the best pixel selected in ink stroke region;pFFor any pixel in filling region;pPFor input Pixel in image;And weigh constraints above condition, E by 3 energy termsb(pS) constraints a is corresponded to, p is describedSWith pFBetween The summation of the color data error of neighborhood territory pixel;Ep(pS) constraints b is corresponded to, p is describedSWith pFDegree of closeness between corresponding skeleton path respectively;Ea(pS) constraints c is corresponded to, p is describedSWith pPDifference using some R as the average color of pixel in the circle of radius respectively It is different;Specifically meet the following formula:<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>E</mi> <mi>b</mi> </msub> <mo>(</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>)</mo> <mo>=</mo> <msubsup> <mi>&Sigma;</mi> <mrow> <mi>i</mi> <mo>,</mo> <mi>D</mi> <mo>&Element;</mo> <mo>{</mo> <mi>S</mi> <mo>,</mo> <mi>F</mi> <mo>}</mo> </mrow> <mrow> <mo>|</mo> <mo>|</mo> <msubsup> <mi>p</mi> <mi>i</mi> <mi>D</mi> </msubsup> <mo>-</mo> <msup> <mi>p</mi> <mi>D</mi> </msup> <mo>|</mo> <mo>|</mo> <mo>&le;</mo> <mn>1</mn> </mrow> </msubsup> <mi>&lambda;</mi> <mo>(</mo> <msubsup> <mi>p</mi> <mi>i</mi> <mi>S</mi> </msubsup> <mo>)</mo> <mo>-</mo> <mi>&lambda;</mi> <mo>(</mo> <msubsup> <mi>p</mi> <mi>i</mi> <mi>F</mi> </msubsup> <mo>)</mo> <mo>|</mo> <mo>|</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>E</mi> <mi>p</mi> </msub> <mo>(</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>)</mo> <mo>=</mo> <mo>|</mo> <mo>|</mo> <mfrac> <mrow> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>-</mo> <msup> <mi>C</mi> <mi>S</mi> </msup> <mrow> <mo>(</mo> <mover> <mi>t</mi> <mo>~</mo> </mover> <mo>)</mo> </mrow> </mrow> <mrow> <msup> <mi>r</mi> <mi>S</mi> </msup> <mrow> <mo>(</mo> <mover> <mi>t</mi> <mo>~</mo> </mover> <mo>)</mo> </mrow> </mrow> </mfrac> <mo>-</mo> <mfrac> <mrow> <msup> <mi>p</mi> <mi>F</mi> </msup> <mo>-</mo> <msup> <mi>C</mi> <mi>P</mi> </msup> <mrow> <mo>(</mo> <mover> <mi>t</mi> <mo>~</mo> </mover> <mo>)</mo> </mrow> </mrow> <mrow> <msup> <mi>r</mi> <mi>P</mi> </msup> <mrow> <mo>(</mo> <mover> <mi>t</mi> <mo>~</mo> </mover> <mo>)</mo> </mrow> </mrow> </mfrac> <mo>|</mo> <mo>|</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>E</mi> <mi>a</mi> </msub> <mo>(</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>)</mo> <mo>=</mo> <mfrac> <mn>1</mn> <mi>N</mi> </mfrac> <mo>|</mo> <mo>|</mo> <msubsup> <mi>&Sigma;</mi> <mi>j</mi> <mrow> <mo>|</mo> <mo>|</mo> <msubsup> <mi>p</mi> <mi>j</mi> <mi>S</mi> </msubsup> <mo>-</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>|</mo> <mo>|</mo> <mo>&le;</mo> <mi>R</mi> </mrow> </msubsup> <mi>&lambda;</mi> <mo>(</mo> <msubsup> <mi>p</mi> <mi>i</mi> <mi>S</mi> </msubsup> <mo>)</mo> <mo>-</mo> <msubsup> <mi>&Sigma;</mi> <mi>j</mi> <mrow> <mo>|</mo> <mo>|</mo> <msubsup> <mi>p</mi> <mi>j</mi> <mi>S</mi> </msubsup> <mo>-</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>|</mo> <mo>|</mo> <mo>&le;</mo> <mi>R</mi> </mrow> </msubsup> <mi>&lambda;</mi> <mo>(</mo> <msubsup> <mi>p</mi> <mi>j</mi> <mi>P</mi> </msubsup> <mo>)</mo> <mo>|</mo> <mo>|</mo> </mtd> </mtr> </mtable> </mfenced>Wherein, λ (p) represents the color value of p,It is pSNeighborhood territory pixel, andIt is pFNeighborhood territory pixel,Skeleton path On distance pFNearest point is identicalUnder value,It is the correspondence one on the skeleton path in the final stroke sample Point, rSAnd rPIt is the half of the final stroke specimen width respectively, N represents all pixels sum in the circle of specified radius R,Represent circle inherence pSNeighbouring pixel, andRepresent in photograph image, specifying p in circlePNeighbouring pixel.
- 8. according to the method described in claim 6, it is characterized in that,The texture-mapping algorithm based on pixel, using in l1The energy equation that definition is made of 3 energy terms in space is simultaneously Three energy terms are minimized to obtain best pixel, this step meets the following formula:<mrow> <munder> <mrow> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow> <mrow> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>&Element;</mo> <msup> <mi>F</mi> <mi>S</mi> </msup> </mrow> </munder> <mo>&lsqb;</mo> <msub> <mi>&alpha;</mi> <mn>1</mn> </msub> <msub> <mi>E</mi> <mi>b</mi> </msub> <mrow> <mo>(</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>)</mo> </mrow> <mo>+</mo> <msub> <mi>&alpha;</mi> <mn>2</mn> </msub> <msub> <mi>E</mi> <mi>p</mi> </msub> <mrow> <mo>(</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>)</mo> </mrow> <mo>+</mo> <msub> <mi>&alpha;</mi> <mn>3</mn> </msub> <msub> <mi>E</mi> <mi>a</mi> </msub> <mrow> <mo>(</mo> <msup> <mi>p</mi> <mi>S</mi> </msup> <mo>)</mo> </mrow> <mo>&rsqb;</mo> </mrow>Wherein, α1, α2And α3Represent balance weight parameter.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711338215.4A CN108038819B (en) | 2017-12-14 | 2017-12-14 | Interactive stroke generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711338215.4A CN108038819B (en) | 2017-12-14 | 2017-12-14 | Interactive stroke generation method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108038819A true CN108038819A (en) | 2018-05-15 |
CN108038819B CN108038819B (en) | 2021-11-26 |
Family
ID=62103231
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711338215.4A Active CN108038819B (en) | 2017-12-14 | 2017-12-14 | Interactive stroke generation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108038819B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103218846A (en) * | 2013-04-16 | 2013-07-24 | 西安理工大学 | Ink painting simulation method of three-dimensional tree model |
CN103458261A (en) * | 2013-09-08 | 2013-12-18 | 华东电网有限公司 | Video scene variation detection method based on stereoscopic vision |
CN104239855A (en) * | 2014-09-03 | 2014-12-24 | 南京大学 | Image style transfer synthesis method based on stroke synthesis |
CN105374007A (en) * | 2015-12-02 | 2016-03-02 | 华侨大学 | Generation method and generation device of pencil drawing fusing skeleton strokes and textural features |
-
2017
- 2017-12-14 CN CN201711338215.4A patent/CN108038819B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103218846A (en) * | 2013-04-16 | 2013-07-24 | 西安理工大学 | Ink painting simulation method of three-dimensional tree model |
CN103458261A (en) * | 2013-09-08 | 2013-12-18 | 华东电网有限公司 | Video scene variation detection method based on stereoscopic vision |
CN104239855A (en) * | 2014-09-03 | 2014-12-24 | 南京大学 | Image style transfer synthesis method based on stroke synthesis |
CN105374007A (en) * | 2015-12-02 | 2016-03-02 | 华侨大学 | Generation method and generation device of pencil drawing fusing skeleton strokes and textural features |
Non-Patent Citations (3)
Title |
---|
LIJIE YANG 等: "Sketch-based stroke generation in Chinese flower painting", 《SCIENCE CHINA-INFORMATION SCIENCES》 * |
杨丽洁 等: "中国水墨画的交互式三维建模方法", 《小型微型计算机系统》 * |
杨丽洁 等: "动态模拟中国水墨画中的笔画绘制", 《计算机辅助设计与图形学学报》 * |
Also Published As
Publication number | Publication date |
---|---|
CN108038819B (en) | 2021-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Pirk et al. | Plastic trees: interactive self-adapting botanical tree models | |
US11288499B2 (en) | Interactive method for generating strokes with Chinese ink painting style and device thereof | |
CN101887366B (en) | Digital simulation and synthesis technology with artistic style of Yunnan heavy-color painting | |
CN102339479B (en) | Stretch-driven mesh parameterization method using spectral analysis | |
CN110222722A (en) | Interactive image stylization processing method, calculates equipment and storage medium at system | |
CN108171650A (en) | One kind has the function of that stroke optimizes Chinese flower ink and wash style stroke generation method | |
CN114139495A (en) | Chinese font style migration method based on adaptive generation countermeasure network | |
US20220044451A1 (en) | Method and device for image generation and colorization | |
CN106251391A (en) | Divided method | |
Igno-Rosario et al. | Interactive system for painting artworks by regions using a robot | |
CN106611172A (en) | Style learning-based Chinese character synthesis method | |
CN106023276A (en) | Pencil drawing making method and pencil drawing making device based on image processing | |
Yang et al. | Easy drawing: Generation of artistic Chinese flower painting by stroke-based stylization | |
CN104978708B (en) | Interactive colored woodcut digital synthesis method out of print | |
CN106530383B (en) | The facial rendering intent of face based on Hermite interpolation neural net regression models | |
Lin et al. | Drawing road networks with mental maps | |
CN103294875A (en) | Group formation simulation method based on group intelligence and self-adaption evaluation | |
Du | Application of CAD aided intelligent technology in landscape design | |
CN108171766A (en) | A kind of image generating method that there are outline strokes and correct | |
Isenberg | Visual abstraction and stylisation of maps | |
CN108399288A (en) | A kind of device adding decorative element automatically in planar design | |
CN108038819A (en) | A kind of stroke generation method based on interactive mode | |
Yang et al. | Brushwork master: Chinese ink painting synthesis for animating brushwork process | |
Jenny et al. | Challenges in adapting example-based texture synthesis for panoramic map creation: a case study | |
Visvalingam et al. | Algorithms for sketching surfaces |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |