CN104268832B - Gradient mesh recoloring method - Google Patents

Gradient mesh recoloring method Download PDF

Info

Publication number
CN104268832B
CN104268832B CN201410470187.1A CN201410470187A CN104268832B CN 104268832 B CN104268832 B CN 104268832B CN 201410470187 A CN201410470187 A CN 201410470187A CN 104268832 B CN104268832 B CN 104268832B
Authority
CN
China
Prior art keywords
mesh
point
color
gradient
gradient mesh
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.)
Expired - Fee Related
Application number
CN201410470187.1A
Other languages
Chinese (zh)
Other versions
CN104268832A (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.)
Tianjin University
Original Assignee
Tianjin 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 Tianjin University filed Critical Tianjin University
Priority to CN201410470187.1A priority Critical patent/CN104268832B/en
Publication of CN104268832A publication Critical patent/CN104268832A/en
Application granted granted Critical
Publication of CN104268832B publication Critical patent/CN104268832B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The invention discloses a gradient mesh recoloring method and relates to the field of computer image processing. The method comprises the steps of establishing a control mesh, wherein the control mesh is the expansion of a gradient mesh and is a 4*4 mesh with 16 control points; determining mesh points used for color marking according to the mesh point marking condition; conducting blended coloring on the control mesh through the mesh points used for color marking to obtain a recolored gradient mesh. According to the method, extra reference images do not need to be provided by a user, proper colors are directly selected to be applied to the gradient mesh, the operation that the control points are edited and colored one by one is not needed, operation is convenient, the calculating process is simple and efficient, and a result image can be rendered in a short time.

Description

A kind of gradient mesh weight color method
Technical field
The present invention relates to Computer Image Processing field, more particularly to a kind of gradient mesh weight color method.
Background technology
(1) gradient mesh (Gradient mesh) (see document [1] [2]):Vector graphics is used in computer graphicss Point, straight line or polygon etc. represent the mode of image based on math equation, and it will be appreciated that preservation information is few, can nothing Limit and put, parameter can be changed.Gradient mesh is a kind of vector graphics method for expressing conventional at present.Gradient mesh is expressed as one The 2D grids of individual rule, define and store the position of each grid vertex, color, and position and color in parameter space Gradient information.According to these information, the image of rasterizing can be produced by bicubic non-linear interpolation.Create a width gradual change net The vectogram of lattice is wasted time and energy very much.Pin is in this regard, document [1] is proposed and a kind of generates gradient mesh based on user mutual Method, document [2] then directly generates the gradient mesh of a width rasterized images, and is expanded to pertusate image.This A little methods can generate a gradient mesh, but when user needs to enter the grid that these are generated edlin, change color, At present business software does not still provide instrument easily to realize the purpose.
(2) gradient mesh is coloured (see document [3]) again:The method is proposed by Y.Xiao etc., needs user to provide a width Reference picture, algorithm calculates both distribution of color relations according to the distribution of color of gradient mesh image and reference picture, leads to The method for crossing principal component analysiss is transferred to color on gradient mesh from reference picture.On this basis, by reference picture Color gamut analysis, the color of gradient mesh is adjusted to into suitable yardstick, be allowed to reference picture try one's best it is consistent.The method The mode for also providing user mutual is coloured again, i.e., user is labeled on associated picture and gradient mesh, according to two Realize colour switching in the corresponding region of person.This method user needs to be additionally provided a width reference picture, and needs in two width It is labeled on figure, color is chosen has certain limitation.
List of references
[1].J.Sun,L.Liang,F.Wen,and H.-Y.Shum,”Image vectorization using optimized gradient meshes,”ACM Transactions on Graphics,vol.26,no.3,p.11, 2007.
[2].Y.-K.Lai,S.-M.Hu,and R.R.Martin,“Automatic and topology- preserving gradient mesh generation for image vectorization,”ACM Transactions on Graphics,vol.28,no.3,pp.1–8,2009.
[3].Y.Xiao,L.Wan,C.-S.Leung,Y.-K.Lai,and T.-T.Wong,“Example-based color transfer for gradient meshes,”IEEE Transactions on Multimedia,vol.15, no.3,pp.549–560,2013.
The content of the invention
The invention provides a kind of gradient mesh weight color method, the present invention is using user's stroke as interactive mode, right Gradient mesh this widely used vector graph model is coloured again, substantially reduces user for editing the time of grid, It is described below:
A kind of gradient mesh weight color method, the method comprising the steps of:
Build control grid;The control grid is the extension of gradient mesh, and the control grid is one and has 16 The grid of the 4*4 at control point;
Mesh point for color mark is determined by mesh point flag condition;
Mixing coloring is carried out to controlling grid by the mesh point for color mark, the gradual change net colour again after is obtained Lattice.
The mesh point flag condition is specially:
A () mesh point is just in user's stroke;
B () net boundary curve passes through user's stroke;
Threshold value of the user's stroke point distance inside (c) mesh point to the face less than a certain user setting;
Meet one of above three condition.
The mesh point by for color mark carries out mixing coloring to controlling grid, obtains the gradual change colour again after The step of grid, is specially:
For any point t to be colored, its color value is drawn by the stroke color mixing of different weights
ω represents the weight of certain color, defines ω (r)=r-∈, ∈ is colour mixture coefficient.Apart from dcT () is represented from b to any The minimum range of point, the color of its midpoint t is c.
For pertusate gradient mesh, methods described also includes:The circulation of the distance controlling color after constraint,
Distance definition after constraint is as follows,
A and b is made to be 2 points on plane region, P is the border of hole, and d (a, b) is the distance of a and b point-to-point transmissions.
The beneficial effect of technical scheme that the present invention is provided is:Special skill of the present invention as Computer Image Processing field Art, can make up existing gradient mesh editor and depend on manual deficiency in a large number, simplify the process of its color editor, and effect is as follows:
(1) it is convenient and swift.Do not need user to provide extra reference picture, directly choose suitable color in gradient mesh On drawn, be also not required to enter edlin one by one to control point and take color, it is easy to operate.Calculating process is simply efficient, can be with Result images are rendered in a short period of time.
(2) gradient mesh effect is reasonable colour again after.The present invention is directly enterprising in control grid by building control grid Row color change, then gradient mesh is reconstructed, therefore color transition nature, with good visual effect.Simultaneously because not changing Artwork color overall brightness distributed effect, it is to avoid irrational color change occur.
(3) suitable for polytype gradient mesh figure.By the splicing to gradient mesh, this method is applied to simultaneously to be had The gradient mesh of hole, had both maintained the seriality in UNICOM region, also maintained the color independence of hole segregated portion.
Description of the drawings
Fig. 1 is a kind of flow chart of gradient mesh weight color method;
Fig. 2 is the schematic diagram of gradient mesh;
Fig. 3 is the gradient mesh comprising hole;
Fig. 4 is the schematic diagram for controlling grid;
Fig. 5 attaches most importance to the design sketch of coloring.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below further is made to embodiment of the present invention Ground is described in detail.
There is gradient mesh color transition to smooth naturally, electrodeless can scale, and space usage data amount is little to wait good characteristic, more Select to carry out realistic vectogram making using gradient mesh come more artisies.Gradient mesh is compiled at present The method collected is mostly manual operations, and process is loaded down with trivial details.By taking the editor for color as an example, if it is desired to changing some region of face Color, need to one by one change conversion by the whole control point in the region, both waste time and energy, and be very easy to color transition occur unnatural Situation.In order to lift Consumer's Experience, the method that associated picture is coloured again to gradient mesh has been based at present, but should Method needs user to choose relevant range on another width reference picture, and material there are certain requirements.For current present situation, this It is bright to weigh dye technology there is provided a kind of gradient mesh based on user input color stroke.User can directly select suitable face Color, is simply drawn on a width gradient mesh with stroke, and the method will automatically calculate the result for colouring again, greatly shorten User is used to edit the time of grid.This method is adopted the following technical scheme that:Build control grid, determine on gradient mesh Stroke point and the heavy colouring algorithm based on colour mixture, it is described below referring to Fig. 1:
101:Build control grid;
Control grid be the extension to gradient mesh, will a grid (Ferguson patch) expand to a 4*4 Grid.Therefore the gradient mesh of a M*N can be configured such that the grid of (3M-2) * (3N-2), used as control grid.Jing realities Checking, the effect coloured again on control grid is better than the effect for directly calculating on the mesh point of gradient mesh.It is right In pertusate gradient mesh, because itself is disassembled for some imperforate gradient mesh, need first to per imperforate Gradient mesh builds control grid, then pieces together complete control grid.After colour again, control grid need to be split into original If this stem portion, and then reconstruct corresponding gradient mesh.
Wherein, gradient mesh is a plane grid being made up of Ferguson faces, and each face includes 4 control point (such as Shown in Fig. 2).Wherein, m0, m1, m2, m3Four control point of a grid in grid are represented as, u, v are along (m0, m1) and (m0, m2) direction vector, thenWithIt is along u, the partial derivative in v directions.For each control point, its position is represented with { x, y }, { r, g, b } represents its color value, then gradient is expressed asWherein, m represents the position at control point Or color, α, β are scale parameter.Arbitrfary point inside each Ferguson face can be calculated by equation below and be obtained:
M (u, v)=UCQCTVT,
U=[1 u u2 u3], V=[1 v v2 v3], and 0≤u, v≤1.
Gradient mesh can expand to the grid comprising hole, as shown in Figure 3.Gradient mesh being divided into two by level, Any point v on each line of cutsIt is divided intoWithFor the end points v of line of cutL, its upper and lower both sides Ferguson faces are in end points vLOn have the different partial derivatives on u direction, therefore useWithRepresent point vL(meaning is same With).Now meetBy repeating such shearing step, one has N number of hole The grid in hole can be split as the N+1 grid without hole.
Control grid is an approximate and extension of gradient mesh.Control grid (as shown in Figure 4) is one and has 16 The grid of the 4*4 at control point, using p0iRepresent the first row, p1iRepresent the second row, p2iRepresent the third line, p3iFourth line is represented, its In (0≤i≤3).Then arbitrfary point p is determined by following three step.
A the corner point of () 4 grids is original Ferguson faces control point (p00, p03, p30, p33).For example, p00=m0
B () 8 borderline non-corner points go out partial derivative using the Difference Calculation of corner point
(p01, p10, p02, p13, p31, p20, p32, p23).For example,Due to p00=m0, obtain
C the point of () 4 inside draws (p by mixed partial derivative11, p12, p21, p22).For example, for p11, m0Mixing local derviation NumberPass throughDraw.Now, it is noted that in Ferguson facesCause This,
Specifically, 16 control point are defined as follows:
102:Mesh point for color mark is determined by mesh point flag condition;
After user is identified on the rasterized images that gradient mesh is generated, user's stroke point needs the quilt from original image Navigate on gradient mesh.But because gradient mesh is more sparse compared with rasterized images, stroke be able to not may just fall gradually On the mesh point of Moving grids, if only taking the stroke point on mesh point, some necessary stroke points will be ignored.According to gradual change , to the distance of stroke point, and the position that stroke is located is determining the mesh point for color mark for the mesh point of grid.
That is, after user's stroke is obtained, whether the mesh point of each gradient mesh block comprising user's stroke need to be determined It is labeled as stroke point.The labeled condition of a certain mesh point is following (following three conditions meet arbitrary):
A () mesh point is just in user's stroke;
B () net boundary curve passes through user's stroke;
Threshold value L of the user's stroke point distance inside (c) mesh point to the face less than a certain user settingτ
L hereτLength and the longest edge circle positive correlation in the face, i.e.,
Now { Lt| t=0,1,2,3 }, LtExpression ought be above four edges circle, ρ is the correlation coefficient that can be set by the user.
103:Mixing coloring is carried out to controlling grid by the mesh point for color mark, the gradual change colour again after is obtained Grid.
On the basis of control grid, using a kind of algorithm quickly based on colour mixture, it is capable of achieving to the fast of gradient mesh Speed is coloured again.After control grid builds, weight tinting steps only need to be carried out on control grid.In view of visual effect and speed Degree effect, the method that the present invention is coloured again using mixing.Its main thought is, the close pixel Ying Chong of color in artwork Color still keep close color, each pixel to colour after coloring again after is the mixing of stroke color, and the power for mixing The heavy distance dependent with the pixel to a certain color stroke point, i.e. distance are bigger, and this color proportion is less.It is worth here Obtain it is noted that for pertusate gradient mesh, when the control grid to piecing together is coloured again, needing to keep hole The color of both sides does not interfere with each other, i.e., the color of side can not be delivered to opposite side by the boundary point on hole.
General, a and b is made for 2 points on plane region, the curve of connection a and b, parameter s table on Γ (s) expression R Show arc length, and s ∈ [0, l (Γ)], l (Γ) represent length of a curve.Then the distance for defining a and b point-to-point transmissions is expressed as follows:
Wherein, Cb, Cr represent the Cb in YCbCr color spaces, Cr Color Channels.Calculate this apart from when, by Cb, Cr passages On color gradient it is cumulative along curve Γ (s).Then, distance between two points d is madecB () is represented from b to the minimum range of arbitrfary point a, The color of its midpoint a is c, i.e.,
For any point t to be colored, its color value is drawn by the stroke color mixing of different weights
Herein, ω represents the weight of certain color, defines ω (r)=r-∈, ∈ be colour mixture coefficient, usual ∈ >=1.Afterwards, make ω weighted values can be easily calculated with simple Dijkastra algorithms, and further calculates the Cb, Cr of any point Color value.In order to keep weight colouring results visually to meet with artwork as far as possible, the Y space values of result figure keep constant.
And for pertusate gradient mesh, need on this basis add a constraint to control the circulation of color.Specifically For, for a pair of the mesh points (except hole two-end-point) on the border P of hole, the color of point-to-point transmission can not be mutually perpendicular to across More.Distance definition after addition constraint is as follows,
After the control grid for being coloured again, in addition it is also necessary to convert thereof into gradient mesh.Make mi,jFor on gradient mesh Arbitrfary point, p3i, 3j(this is because each gradient mesh comprising 2*2 point is expanded to represent the corresponding point controlled on grid For the control grid of 4*4 point).Then mI, jColor meet
mI, j=p3i,3j.
Assume along mI, jPartial derivative along u direction isI.e.
Wherein p3i+1,3jIt is to control mesh point, p along the next of u positive directions3i-1,3jIt is the next one control along u negative directions Mesh point, αI, jFor scale parameter.By centered difference, can obtainI.e.
In sum, the present invention proposes the method coloured again to gradient mesh based on user's stroke, enormously simplify volume User operation during gradient mesh color is collected, and weight coloring effect is naturally rationally, with good visual effect.The present invention fills Point using gradient mesh characteristic, memory space is less and ensure that the speed of algorithm.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, the embodiments of the present invention Sequence number is for illustration only, does not represent the quality of embodiment.
The foregoing is only presently preferred embodiments of the present invention, not to limit the present invention, all spirit in the present invention and Within principle, any modification, equivalent substitution and improvements made etc. should be included within the scope of the present invention.

Claims (2)

1. a kind of gradient mesh weighs color method, it is characterised in that the method comprising the steps of:
Virtual control grid is built based on gradient mesh, a gradient mesh piece unit is the grid of the 2*2 with 4 summits, One control grid with the 4*4 at 16 control point is converted to by conversion;
Mesh point for color mark is determined by mesh point flag condition;
Mixing coloring is carried out to controlling grid by the mesh point for color mark, the gradient mesh colour again after is obtained;
The control grid virtual based on gradient mesh structure is specially:
A the corner point of () 4 grids is original Ferguson faces control point (p00, p03, p30, p33);p00=m0
B () 8 borderline non-corner points go out partial derivative using the Difference Calculation of corner point
(p01, p10, p02, p13, p31, p20, p32, p23);Due to p00=m0, obtain
C the point of () 4 inside draws (p by mixed partial derivative11, p12, p21, p22);For p11, m0Mixed partial derivativePass throughDraw;Because in Ferguson facesSo
The mesh point by for color mark carries out mixing coloring to controlling grid, obtains the gradient mesh colour again after The step of be specially:
For any point t to be colored, its color value is drawn by the stroke color mixing of different weights
c h r o m ( t ) = Σ c ω ( d c ( t ) ) c Σ c ω ( d c ( t ) )
ω represents the weight of certain color, defines ω (r)=r-∈, ∈ is colour mixture coefficient, apart from dcT () is represented from b to arbitrfary point t's Minimum range, the color of its midpoint t is c;For pertusate gradient mesh, using the stream of the distance controlling color after constraint Logical, it is desirable to for a pair of mesh points on the border P of hole, the color of point-to-point transmission can not be mutually perpendicular to cross over, and be defined as follows,
A and b is made to be 2 points on plane region, P is the border of hole, and d (a, b) is the distance of a and b point-to-point transmissions;
After the control grid for being coloured again, gradient mesh is converted thereof into by inverse transformation;Make mi,jFor on gradient mesh Arbitrfary point, p3i,3jRepresent the point on corresponding control grid;mi,jColor be
mi,j=p3i,3j.
Set up an office mi,jPartial derivative along u direction isBy centered difference, can obtain
∂ u m i , j = p 3 i + 1 , 3 j - p 3 i - 1 , 3 j 1 + α i , j .
2. a kind of gradient mesh according to claim 1 weighs color method, it is characterised in that the mesh point flag condition Specially:
A () mesh point is just in user's stroke;
B () net boundary curve passes through user's stroke;
C the user's stroke point distance inside () mesh point to the face is less than threshold value Lτ
LτLength and the longest edge circle positive correlation in the face, i.e.,
L τ = ρ m a x t L t
Meet one of above three condition;LtExpression ought be above four edges circle, ρ is the correlation coefficient that can be set by the user.
CN201410470187.1A 2014-09-15 2014-09-15 Gradient mesh recoloring method Expired - Fee Related CN104268832B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410470187.1A CN104268832B (en) 2014-09-15 2014-09-15 Gradient mesh recoloring method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410470187.1A CN104268832B (en) 2014-09-15 2014-09-15 Gradient mesh recoloring method

Publications (2)

Publication Number Publication Date
CN104268832A CN104268832A (en) 2015-01-07
CN104268832B true CN104268832B (en) 2017-05-17

Family

ID=52160352

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410470187.1A Expired - Fee Related CN104268832B (en) 2014-09-15 2014-09-15 Gradient mesh recoloring method

Country Status (1)

Country Link
CN (1) CN104268832B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112802155B (en) * 2021-04-09 2021-06-25 腾讯科技(深圳)有限公司 Map data rendering method, related device, equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103782289A (en) * 2011-09-08 2014-05-07 兰德马克绘图国际公司 Systems and methods for rendering 2D grid data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8274517B2 (en) * 2003-11-14 2012-09-25 Microsoft Corporation Systems and methods for downloading algorithmic elements to a coprocessor and corresponding techniques

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103782289A (en) * 2011-09-08 2014-05-07 兰德马克绘图国际公司 Systems and methods for rendering 2D grid data

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Automatic and Topology-Preserving Gradient Mesh Generation for Image Vectorization;Yu-Kun Lai;《ACM Transactions on Graphics》;20090831;第28卷(第3期);第851-858页 *
Example-Based Color Transfer for Gradient Meshes;Yi Xiao et al;《IEEE TRANSACTIONS ON MULTIMEDIA》;20130430;第15卷(第3期);第549-559页 *
Image Vectorization using Optimized Gradient Meshes;Jian Sun et al;《ACM Transactions on Graphics》;20070731;第26卷(第3期);摘要第2段,第1部分倒数第2段,第3.1部分倒数第1段,第4.1部分第3段,图4 *
Liron Yatziv and Guillermo Sapiro.Fast Image and Video Colorization Using Chrominance Blending.《IEEE TRANSACTIONS ON IMAGE PROCESSING》.2006,第15卷(第5期), *

Also Published As

Publication number Publication date
CN104268832A (en) 2015-01-07

Similar Documents

Publication Publication Date Title
CN108830912B (en) Interactive gray image coloring method for depth feature-based antagonistic learning
CN100573590C (en) Editing equipment and edit methods
Cantrell et al. Digital drawing for landscape architecture: contemporary techniques and tools for digital representation in site design
CN105374007B (en) Merge the pencil drawing generation method and device of skeleton stroke and textural characteristics
CN1764231B (en) Device and method for color correction of an input image
CN109544669B (en) Diffusion coloring using weighted color points
CN102750405B (en) Computer simulation method of spun-dyed fancy fabrics
CN108986132A (en) A method of certificate photo Trimap figure is generated using full convolutional neural networks
CN109920012A (en) Image colorant system and method based on convolutional neural networks
US11043012B2 (en) Flow-based color transfer from source graphic to target graphic
CN109544662A (en) A kind of animation style line original text painting methods and system based on SRUnet
Zhang Application of computer graphics and image software in marine graphic design
CN110322530A (en) It is a kind of based on depth residual error network can interaction figure picture coloring
CN103413331B (en) A kind of support edits the high resolution video image content sparse expression method propagated
CN107291918A (en) A kind of visual mining methods of point of interest POI with bit pattern
CN104268832B (en) Gradient mesh recoloring method
CN110120059A (en) A kind of icon generation method and device
EP2828842A1 (en) Method and apparatus for dimensional printing
US11155041B2 (en) Methods of generating energy transmission properties in voxel data structures using texture maps
Barendrecht et al. Locally refinable gradient meshes supporting branching and sharp colour transitions: Towards a more versatile vector graphics primitive
CN103745496A (en) Direct volume rendering method based on transfer function with two-dimensional image being interactive interface
CN101799931B (en) Painting rendering method based on colour feature study
CN106021228A (en) Method and system for performing text analysis by utilizing knowledge topographic map
Dodgson et al. Contrast Brushes: Interactive Image Enhancement by Direct Manipulation.
Panchaud et al. Smart cartographic background symbolization for map mashups in geoportals: A proof of concept by example of landuse representation

Legal Events

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

Granted publication date: 20170517

Termination date: 20210915