CN102306389B - Method for realizing embossment effect of animation character and background of mobile phone - Google Patents

Method for realizing embossment effect of animation character and background of mobile phone Download PDF

Info

Publication number
CN102306389B
CN102306389B CN 201110219903 CN201110219903A CN102306389B CN 102306389 B CN102306389 B CN 102306389B CN 201110219903 CN201110219903 CN 201110219903 CN 201110219903 A CN201110219903 A CN 201110219903A CN 102306389 B CN102306389 B CN 102306389B
Authority
CN
China
Prior art keywords
distortion
projectdirection
template
embossment
coordinate
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
CN 201110219903
Other languages
Chinese (zh)
Other versions
CN102306389A (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.)
HUNAN INTERACTIVE MEDIA CO Ltd
Original Assignee
HUNAN INTERACTIVE MEDIA CO Ltd
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 HUNAN INTERACTIVE MEDIA CO Ltd filed Critical HUNAN INTERACTIVE MEDIA CO Ltd
Priority to CN 201110219903 priority Critical patent/CN102306389B/en
Publication of CN102306389A publication Critical patent/CN102306389A/en
Application granted granted Critical
Publication of CN102306389B publication Critical patent/CN102306389B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a method for realizing an embossment effect of an animation character and a background of a mobile phone. The method comprises the following steps of: 1, creating an optional route-distortion-based animation face; 2, creating chromatic embossments on an image; and 3, performing optional graying operation. In the method for realizing the embossment effect, a simple and practical digital image processing algorithm is used, great attention is paid to reducing the data volume and improving the central processing unit (CPU) operating efficiency to ensure that a user can use a mobile phone with comparatively poor computing power to DIY (do-it-yourself) a mobile phone animated cartoon work with a unique artistic style on the mobile phone, and effects of low creation cost and a quick operation can be achieved. The method for realizing the embossment effect of the animation character and the background of the mobile phone is low in data processing amount, is easy to implement and is suitable for running on the mobile phone.

Description

The anaglyph implementation method of a kind of cartoon character on mobile phone and background
Technical field
The invention belongs to the digital image processing techniques fields, relate to the anaglyph implementation method of a kind of cartoon character on mobile phone and background.
Background technology
" cultural industry development planning " that State Council puts into effect is first cultural industry ad hoc planning of China, and " planning " lists animation industry in that state key develops Cultural industryOne of class indicates Cultural industryRisen to the strategic industry of country, for the development of animation industry provides rare opportunity.
As a branch of animation industry, China's mobile phone cartoon product has also obtained significant progress, mainly comprises at present animation multimedia message, four lattice mobile phone cartoons, flash and turn-based mobile phone games etc.They have the dual nature of cultural product and information products concurrently: need undoubtedly to follow the principle of generality of socialist culture product as cultural product, but unsuitable blunt preach, and will teach through lively activities; Wish to introduce as much as possible advanced computer technology as information products, to improve its production efficiency when improving the quality of products.
Embossment is sculpture and the product of drawing combination, is a kind of sculpture of the concavo-convex image that rises and falls of carve in the plane.Embossment generally is attached on a plane, therefore is widely used on building decoration and apparatus implements.It processes object with the way of space compression, shows three dimensions single viewing and admiring on face by the means of having an X-rayed.
Compare with PC, the software and hardware configuration of mobile phone is obviously lower, thereby data-handling capacity is far away from general PC, and it is well-known, common image is processed because needs are processed a large amount of data, and is high to performance requirements such as processor and storeies, thus, if realize such as the embossment texts, need to overcome great difficulty on mobile phone.
We still find no the report of realizing having the cartoon of chromatography anaglyph based on cell phone platform.
Summary of the invention
Technical matters to be solved by this invention is the anaglyph implementation method that proposes a kind of cartoon character on mobile phone and background, the anaglyph implementation method of cartoon character on mobile phone of the present invention and background, and data volume is little, and is easy to implement, is suitable for moving on mobile phone.
Technical solution of the present invention is as follows:
The anaglyph implementation method of a kind of cartoon character on mobile phone and background is carried out the operation of chromatography embossment to digital picture, comprises the following steps:
Step 1. is set and is kept look, projecting direction, relief depth, two color blend typical applications, color blend degree, monochromatic embossment or chromatography embossments;
A) keep look, be designated as reservedColor: keep look by selection and make be coated with last layer pseudo-colours effect on the picture of embossment, None, Red, Green and Blue totally 4 kinds of options are arranged, wherein,
ReservedColor is that None represents look without reserve;
ReservedColor is that Red represents to keep red;
ReservedColor is that Green represents to keep green;
ReservedColor is that Blue represents to keep blue;
B) projecting direction is designated as projectDirection: so that embossment obtains corresponding drop shadow effect, RightTop, Right, RightBottom, Bottom, LeftBottom are arranged by selecting different projecting directions, Left, LeftTop and Top be totally 8 kinds of options, wherein
ProjectDirection is that RightTop represents the projection to left down from the upper right;
ProjectDirection is that Right represents projection from right to left;
ProjectDirection is that RightBottom represents to go up from the bottom right projection left;
ProjectDirection is that Bottom represents projection from bottom to top;
ProjectDirection is that LeftBottom represents to go up from the lower-left projection to the right;
ProjectDirection is that Left represents projection from left to right;
ProjectDirection is that LeftTop represents from the upper left to the bottom right projection;
ProjectDirection is that Top represents projection from the top down;
C) relief depth is designated as reliefDepth: span is 1~15;
D) color blend typical application is designated as colorMixPoint: the user is choosing 2 pixels on the digital picture of pre-treatment, be used for obtaining the pixel data of selected pixel;
E) color blend degree is designated as colorMixDegree: selected numerical value is larger, and larger via the true qualities zone of color blend typical application expansion, span is 1~100;
F) select monochromatic embossment or chromatography embossment, [as selecting traditional embossment of picture for only representing with 256 grades of gray scales of monochromatic embossment; As select " chromatography embossment " picture be the fusion of greyish white traditional embossment and colored regional area, or select Red by reservedColor, the pseudo color image that Green or Blue obtain; ]
The operation of step 2. chromatography embossment:
Below the current picture point of just processing is designated as process points, the coordinate of process points is denoted as x0, y0; From a certain projecting direction to the process points projection [from source point to the process points projection], the projection source point that obtains pixel value difference is designated as source point, and the source point coordinate is x0+xShift, y0+yShift, and xShift and yShift are respectively the side-play amount of x and y direction;
Step 1). the value that calculates xShift and yShift according to the intension of 8 kinds of values of projecting direction projectDirection is respectively:
When projectDirection=RightTop, xShift=-reliefDepth; YShift=-reliefDepth;
When projectDirection=Right, xShift=-reliefDepth; YShift=0;
When projectDirection=RightBottom, xShift=-reliefDepth; YShift=reliefDepth;
When projectDirection=Bottom, xShift=0; YShift=reliefDepth;
When projectDirection=LeftBottom, xShift=reliefDepth; YShift=reliefDepth;
When projectDirection=Left, xShift=reliefDepth; YShift=0;
When projectDirection=LeftTop, xShift=reliefDepth; YShift=-reliefDepth;
When projectDirection=Top, xShift=0; YShift=-reliefDepth;
Step 2). according to the position of 2 color blend typical applications, the pixel data that finds out respectively them from image is blue, green, red numerical value, is denoted as respectively b1, g1, r1, and b2, g2, r2 is used for step 6) and step 7) process;
Step 3). process points X, the initial coordinate of Y are made as the image upper left corner, i.e. X, Y all is made as 0;
Step 4). by following steps 5)~step 10) advance by column, line by line process points and process points is operated:
Step 5). obtain the indigo plant of current process points, green, red numerical value, be denoted as respectively b, g, r;
Step 6) if. abs (b-b1)<colorMixDegree and abs (g-g1)<colorMixDegree and abs (r-r1)<colorMixDegree with b1, g1, r1 turns step 10 as the color output valve of process points), wherein abs is the function that takes absolute value;
Step 7) if. abs (b-b2)<colorMixDegree and abs (g-g2)<colorMixDegree and abs (r-r2)<colorMixDegree with b2, g2, r2 turns step 10 as the color output valve of process points, and wherein abs is the function that takes absolute value;
Step (8). according to coordinate x0+xShift, the pixel data that y0+xShift takes out source point is blue, green, red numerical value, is denoted as respectively b3, g3, r3, then with the b of process points, g, the b3 of r data and source point, g3, the r3 data calculate b4 by following formula, g4, the r4 data:
b4=abs(b-b3+128);
g4=abs(g-g3+128);
r4=abs(r-r3+128);
If reservedColor is None, with this b4, g4, the r4 data turn step (10) as the color output valve of process points;
Step 9).
If reservedColor is Blue, with b, g4, the r4 data turn step 10 as the color output valve of " process points ");
If reservedColor is Green, with b4, g, the r4 data turn step 10 as the color output valve of " process points ");
If reservedColor is Red, with b4, g4, the r data turn step 10 as the color output valve of " process points ");
Step 10). with process points Building X mark+1, turn step 4 as X less than picture traverse width); Otherwise turn step 11);
Step 11). process points Building X mark is made as 0, and process points Building Y mark+1 turns step 4 as Y less than picture altitude height); Otherwise turn step 12);
Step 12). the embossment process finishes, and turns step 13);
Step 13). according to whether selecting monochromatic embossment to operate in abovementioned steps 1, as selecting all processes end of chromatography embossment; Thereby as select monochromatic embossment according to gray count formula I=0.3B+0.59G+0.11R, full figure to be carried out gray processing operation to obtain monochromatic anaglyph, wherein B, G, R are the indigo plant of pixel, green, red component value.
Before digital picture is carried out the operation of chromatography embossment, original digital image is carried out distortion process, and with the present image of the image after distortion as the operation of chromatography embossment, step is as follows:
Step 1: based on the distortionless template of the size design of digital portrait to be operated and distortion template;
Step 2: set the distortion band of being established by twisting center line and distortion bandwidth, according to distortion parameter bit distortion template assignment;
Step 3: the digital portrait for the treatment of operation based on described distortion template carries out the distortion operation, forms the figure facial makeup of distortion;
The step of described step 1 is:
Step a: for width is width, highly is the digital portrait to be operated of height, setting up the length of side with the capable and columns of lines row, square grid is the distortionless square trellis template of scale-distortionless template, records X, the Y coordinate of each grid left upper end point in this distortionless template; For ease of operation fast in the mobile phone of low arithmetic capability, adopt the list structure that comprises line pointer and column pointer, a two-dimensional array is converted into one-dimensional representation;
Step b: set up one for above-mentioned same digital portrait and have the grid that lines is capable and columns is listed as, each grid length of side be scale be used for depositing twist angle (dx, dy) Grid Template-distortion template records X, the Y coordinate of each grid left upper end point in this distortion template; For ease of operation fast in the mobile phone of low arithmetic capability, adopt the list structure that comprises line pointer and column pointer, a two-dimensional array is converted into one-dimensional representation.
The concrete steps of described step 2 are:
1) set up with twisting center line and the formed distortion band of distortion bandwidth, and make in distortionless template and treat the distortion mark, its process is:
Obtain the mouse motion track, as the twisting center line of distortion band; The distortion bandwidth is set by the user; Take the grid upper left corner of twisting center line process as the center of circle, all grids in take radius as the area of a circle that radius was covered are labeled as the distortion band, and radius is 1/2 of distortion bandwidth;
2) calculate to obtain in the distortion template each grid in the torsion resistance (dx, dy) of X, Y-direction, deposit X, Y coordinate scale+dx and the scale+dy of each grid left upper end point in the distortion template, finally complete the assignment of distortion template;
Dx, dy is value by the following method:
Judge whether current grid makes a mark in distortionless template, as unmarked, dx, dy gets 0, otherwise,
dx=TwistIntensity*Coefficent*cos(alpha);
dy=TwistIntensity*Coefficent*sin(alpha);
TwistIntensit is the transverse strength that the user sets, Coefficent under the normal distribution condition when certain puts coefficient of torsion when being distance apart from the distance of twisting center line:
Coefficent = 1 σ 2 π e - d 2 2 σ 2 ,
σ is the sigma value that can manually set, the distribution gradient of sign transverse strength, d be current grid apart from the distance of distortion band center line, alpha is this distortion band center line at the tangent line at current grid place and the angle of x axle.
The concrete steps of described step 3 are: the square block-by-block that is scale to the length of side carries out the distortion operation, thereby realizes the distortion operation to full figure;
The distortion operating process of each square is as follows:
Step 1, play up piece location line number according to this quilt and determine current piece upper left corner X coordinate: the x that played up ij=j * scale
Step 2, play up piece location line number according to this quilt and determine current piece upper left corner Y coordinate: the y that played up ij=i * scale
The upper left corner X coordinate of corresponding this piece: Lx in step 3, taking-up distortion template ij=TwistTemplet[i * columns+j] .x, TwistTemplet refers to the distortion template;
The upper left corner Y coordinate of corresponding this piece: Ly in step 4, taking-up distortion template ij=TwistTemplet[i * columns+j] .y;
The lower right corner X coordinate of corresponding this piece: Rx in step 5, taking-up distortion template ij=TwistTemplet[i * columns+ (j+1)] .x;
The lower right corner Y coordinate of corresponding this piece: Ry in step 6, taking-up distortion template ij=TwistTemplet[i * columns+ (j+1)] .y;
Step 7, obtain the X mean deviation of every bit in projecting block: dx ij=(Rx ij-Lx ij)/scale;
Step 8, obtain the X mean deviation of every bit in projecting block: dy ij=(Ry ij-Ly ij)/scale;
Step 9, cumulative every bky of delegation in projecting block is obtained its Y coordinate iy:iy=Ly ij+ (bkL * dy ij);
Step 10, cumulative each row bkx in projecting block is obtained its X coordinate ix:ix=Lx ij+ (bkC * dx ij);
Step 11, will gradually project to the capable bkx of bky with the RGB image of the capable ix of iy row sign and list, namely gradually complete as the hypograph assign operation: here, after distortion, the image output pointer is:
Im gOpt+bky×lineByte+bkx×pixelByte+shift;
Before distortion, the input pointer of image is:
Im gIpt+iy×LineByte+ix×pixelByte+shift;
Wherein, ImgOpt is the base address of image output pointer after distortion;
ImgIpt is the base address of image input pointer before distortion;
LineByte is the byte number of each image line;
PixelByte is the byte number of each image column;
Shift is the RGB image side-play amount of projection operation gradually, is respectively 0,1,2.
After digital picture being carried out the operation of chromatography embossment, resulting chromatography camegraph is carried out the gray processing operation, the gray-scale value I=0.3B+0.59G+0.11R of each picture point after processing, wherein B, G, R are the original indigo plant of this pixel, green, red component value.
Beneficial effect:
The present invention is by the image processing algorithm of designed, designed, take digital photograph as material, be transformed into and the different chromatography embossment of the monochromatic embossment of traditional colour, carry out the DIY operation on animation server or cellphone subscriber individual's mobile phone, create the special cartoon character of effect and or animation background.
The present invention uses simple and practical Digital Image Processing algorithm, note reducing data volume and improve the CPU operational efficiency, make the restricted mobile phone cartoon works on mobile phone screen size and mobile phone computing power can be with cheap creation cost and operational effect fast, for all ages and classes, different levels, be in the cellphone subscriber of different time sections, electronics information serious and comical at the same time, different-style is provided, brings more colourful look and joy for cellphone subscriber's life.Will point out especially: realizing DIY image manipulation if one of the object of the invention is weaker than at this software and hardware resources of mobile phone on the platform of computing machine far away, is fully necessary so take in design above-mentioned a series of specific aim measure.Our main center of effort is:
A. application program is more simple better.We become Midlet with each establishment of component as far as possible, and a plurality of Midlet used are encapsulated in Midlet bag, and this makes the Program Manager of mobile phone can manage more frugally the resource that Midlet and Midlet use.
B. application program is the smaller the better.The assembly of temporarily not using in the deletion application program reduces unnecessary information, to reduce the volume of whole program as far as possible.When downloading application program on wireless network, less application program will shorten download time greatly, and can move with other application programs on equipment are compatible (rather than exclusive).
C. reduce the total memory requirements of application program as far as possible.Major measure has: 1. use less object type, use scalar type (scalar type) instead.Because scalar type takies still less internal memory than object type; 2. lack statement object as far as possible.Because when statement during an object, system will be on the operation heap allocation space, so should reallocate it when application program is about to use this object, rather than all distribute during program start.And, in case program no longer needs this object, will be just null to the equal assignment of quoting of this object.3. need the usage data type by precision.Just should use boolean whenever possible, byte, the data types such as short replace int.This details is very little on the impact of desktop computer program, but will be with producing the impact that takes care of the pence on mobile phone.4. reuse as far as possible.Allow and a plurality ofly quote in program the different time in life cycle and use same objects.For example reuse some Large-scale array, reuse and to utilize the runtime storage that has distributed, use the 'inertia' instantiation.Although this does not meet the soft project principle, be fit to the reality of the very weak computing equipment of this ability of mobile phone.5. avoid creating object in circulation.6. running check storer operating position.Relevant method has: freeMemory and totalMemory.OutMemoryError mistake by oneself.Should guarantee application program when internal memory overflows, have a predetermined routine that withdraws from that this is managed, and do not leave operating system for.7. timely releasing resource.To file, network connection etc. resource, when no longer needing to use, don't not account for and putting.Should oneself carry out necessary clear operation, and not rely on garbage collector or host environment.8. use local variables more.In desktop computer was used, the developer was accustomed to setting more class data member, and less use local variable.But the class data member is actually " global variable " in class, is data dispatch, stack manipulation support frequently, is actually to consume that CPU calculates to support.By the local variable assignment, eliminate the additional step of the data member of access classes, can reduce the CPU treatment capacity of application program.Encapsulate data although lost like this benefit of bringing in class,, for the application program of moving, need mass data on this microminiature computing equipment of mobile phone, at first its processing speed need to be considered.
Description of drawings
(Fig. 1 a) and " maiden " embossment (Fig. 1 b) and the former figure (Fig. 1 c) thereof that are formed by this patent for embossment " Marseillaise " on Fig. 1 Paris, FRA Arc De Triomphe;
Fig. 2 does not add the embossment of distortion, and (Fig. 2 a) He after adding distortion forms embossment (Fig. 2 b) and the former figure (Fig. 2 c) thereof with " desolate sense ";
The embossments that Fig. 3 is various does not add distortion are (Fig. 3 a-k presents multiple anaglyph) for example;
Fig. 4 process flow diagram of the present invention.
Embodiment
Below with reference to specific implementation process and accompanying drawing, the present invention is described in further details.
Embodiment 1
One, step 1. be optional animation types of facial makeup in Beijing operas creation based on the path distortion, comprise following concrete steps:
Step 1, set up 2 kinds of templates.Clear for explaining, it can be decomposed into the following step:
Step (1). for width is width, highly is the image of height, setting up one, the capable and columns row of lines, the length of side are arranged is grid-like distortionless template-SquareTemplet of scale.Record the equally spaced X of each grid left upper end point, Y coordinate in this distortionless square trellis template; For ease of operation fast in the mobile phone of low arithmetic capability, adopt the list structure that comprises line pointer and column pointer, a two-dimensional array is converted into one-dimensional representation;
Step (2). set up one for above-mentioned same digital portrait and have the grid that lines is capable and columns is listed as, each grid length of side is the latticed distortion template-TwistTemplet that is used for depositing twist angle (dx, dy) of scale.Record X, the Y coordinate of each grid left upper end point unequal interval in this distortion template; For ease of operation fast in the mobile phone of low arithmetic capability, adopt the list structure that comprises line pointer and column pointer, a two-dimensional array is converted into one-dimensional representation.
Step 2. is set up with twisting center line and the formed distortion band of distortion bandwidth, and makes in distortionless template and treat the distortion mark, and its process is:
Step (1). obtain the mouse motion track, as the twisting center line of distortion band; The distortion bandwidth is set by the user; Take the grid upper left corner of twisting center line process as the center of circle, all grids in take radius as the area of a circle that radius was covered are labeled as the distortion band, and radius is 1/2 of distortion bandwidth;
Step (2). calculate to obtain in the distortion template each grid in the torsion resistance (dx, dy) of X, Y-direction, deposit X, Y coordinate scale+dx and the scale+dy of each grid left upper end point in the distortion template, finally complete the assignment of distortion template;
Dx, dy is value by the following method:
Judge whether current grid makes a mark in distortionless template, as unmarked, dx, dy gets 0, otherwise,
dx=TwistIntensity*Coefficent*cos(alpha);
dy=TwistIntensity*Coefficent*sin(alpha);
TwistIntensit is the transverse strength that the user sets, Coefficent under the normal distribution condition when certain puts coefficient of torsion when being distance apart from the distance of twisting center line:
Coefficent = 1 σ 2 π e - d 2 2 σ 2 ,
σ is the sigma value that can manually set, the distribution gradient of sign transverse strength, d be current grid apart from the distance of distortion band center line, alpha is this distortion band center line at the tangent line at current grid place and the angle of x axle.
Step 3. pair image carries out the figure facial makeup that the distortion operation forms distortion:
As described in step 1, we are width, highly are the image of height for width, set up one have the capable and columns of lines row, the length of side is the square of scale, therefore this operation is to realize towards the square block-by-block that the length of side is scale, namely capable by bkTwist function traversal lines of columns row are realized the full figure operation.And, for two kinds of appellations of this Operation Definition are described:
● played up piece: refer to the target image piece that this operation is pointed;
● projecting block: the image interpolation of the former figure in this projecting block ground is hinted obliquely at played up piece and get on.
Operating process: with variable i from top to bottom line by line, with variable j from left to right and under by column, call to traversal self-editing " bkTwist " (meaning Block Twist) function each is played up piece enforcement distortion operation, thereby realize the distortion operation to full figure.Wherein the function of bkTwist function is the former figure image interpolation in each projecting block ground to be hinted obliquely to being played up on piece go.The below is unfolded as follows the operating process of bkTwist function:
Step (1). play up piece location line number according to this quilt and determine current piece upper left corner X coordinate: the x that played up ij=j * scale
Step (2). play up piece location line number according to this quilt and determine current piece upper left corner Y coordinate: the y that played up ij=i * scale
Step (3). take out the upper left corner X coordinate of corresponding this piece in the distortion template: Lx ij=TwistTemplet[i * columns+j] .x
Step (4). take out the upper left corner Y coordinate of corresponding this piece in the distortion template: Ly ij=TwistTemplet[i * columns+j] .y
Step (5). take out the lower right corner X coordinate of corresponding this piece in the distortion template: Rx ij=TwistTemplet[i * columns+ (j+1)] .x
Step (6). take out the lower right corner Y coordinate of corresponding this piece in the distortion template: Ry ij=TwistTemplet[i * columns+ (j+1)] .y
Step (7). obtain the X mean deviation of every bit in projecting block: dx ij=(Rx ij-Lx ij)/scale
Step (8). obtain the X mean deviation of every bit in projecting block: dy ij=(Ry ij-Ly ij)/scale
Step (9). every bky of delegation in projecting block is obtained its Y coordinate iy:iy=Ly cumulatively ij+ (bkL * dy ij)
Step (10). each row bkx in projecting block is obtained its X coordinate ix:ix=Lx cumulatively ij+ (bkC * dx ij)
Step (11). will gradually project to the capable bkx of bky with the RGB image of the capable ix row of iy sign and list, namely gradually complete as the hypograph assign operation: wherein the image output pointer is:
Im gOpt+bky×lineByte+bkx×pixelByte+shift (3)
Image input pointer is:
Im gIpt+iy×LineByte+ix×pixelByte+shift
(4)
And wherein, ImgOpt is the output pointer of image after distortion;
ImgIpt is the input pointer of image before distortion;
LineByte is the byte number of each image line;
PixelByte is the byte number of each image column;
Shift is the RGB image side-play amount of projection operation gradually, is respectively 0,1,2
Two, step 2. for image being carried out the creation of chromatography embossment, comprise following concrete steps:
Step 1. is set and is kept look, projecting direction, relief depth, (two) color blend typical application, color blend degree parameter, and the selection of monochromatic embossment or chromatography embossment.
1. keep look (reservedColor): keep look by selection and make the pseudo-colours effect of coating thin layer on the picture of embossment.None is arranged, Red, Green, 4 kinds of options of Blue.Wherein,
ReservedColor is that None represents look without reserve;
ReservedColor is that Red represents to keep red;
ReservedColor is that Green represents to keep green;
ReservedColor is that Blue represents to keep blue.
2. projecting direction (projectDirection): can make embossment obtain corresponding drop shadow effect by selecting different projecting directions.RightTop, Right, RightBottom, Bottom, LeftBottom are arranged, Left, LeftTop, 8 kinds of options of Top.Wherein,
ProjectDirection is that RightTop represents the projection to left down from the upper right, referring to Fig. 3 (b);
ProjectDirection is that Right represents projection from right to left;
ProjectDirection is that RightBottom represents to go up from the bottom right projection left;
ProjectDirection is that Bottom represents projection from bottom to top;
ProjectDirection is that LeftBottom represents to go up from the lower-left projection to the right,, referring to Fig. 3 (c);
ProjectDirection is that Left represents projection from left to right;
ProjectDirection is that LeftTop represents from the upper left to the bottom right projection;
ProjectDirection is that Top represents projection from the top down.
Contrast accompanying drawing 3 (b) can obviously discover from 3 (c) because the moulding difference of the different formation of projecting direction.
3. relief depth (reliefDepth): selected numerical value is larger, and the visual three-dimensional discrepancy in elevation is also larger.Optional scope is 1~15.
Referring to Fig. 3 (d), 3 (e), wherein the reliefDepth of 3 (d) is that the reliefDepth of 2,3 (e) is 10.
4. color blend typical application (colorMixPoint): color blend is the main points that the present invention obtains to overlap chromatic effect.The user selects 2 color blend typical applications by on-the-spot What You See Is What You Get ground, and program has just kept by the natural color in color blend degree definite color blend zone.Thereby show as the fusion of traditional embossment and chromatography embossment, the former is linen and the latter is natural color.Such two kinds of different colours merge at boundary separately flawlessly, present peculiar visual effect! Different background and personage's chromatography embossment works, referring to Fig. 3 (f), 3 (g), 3 (h), 3 (i), 3 (j), 3 (k).
5. color blend degree (colorMixDegree): selected numerical value is larger, and is larger via the true qualities zone of color blend typical application expansion.Optional scope is 1~100.
6. select monochromatic embossment or chromatography embossment.As selecting " monochromatic embossment " picture traditional embossment for only representing with 256 grades of gray scales; As select " chromatography embossment " picture be the fusion of greyish white traditional embossment and colored regional area, or select Red by reservedColor, the pseudo color image that Green or Blue obtain.
Step 2. realizes the chromatography embossment of original creation according to the algorithm of designed, designed.Below with the current picture point of just processing, referred to as " process points ", its coordinate is denoted as x0, y0; Relatively, from a certain projecting direction " process points " projection, obtain the projection source point of pixel value difference (thereby producing anaglyph) referred to as " source point ", its coordinate is x0+xShift, y0+yShift.
Step (1). the value that calculates xShift and yShift according to the intension of 8 kinds of values of projecting direction projectDirection is respectively:
When projectDirection=RightTop, xShift=-reliefDepth; YShift=-reliefDepth;
When projectDirection=Right, xShift=-reliefDepth; YShift=0;
When projectDirection=RightBottom, xShift=-reliefDepth; YShift=reliefDepth;
When projectDirection=Bottom, xShift=0; YShift=reliefDepth;
When projectDirection=LeftBottom, xShift=reliefDepth; YShift=reliefDepth;
When projectDirection=Left, xShift=reliefDepth; YShift=0;
When projectDirection=LeftTop, xShift=reliefDepth; YShift=-reliefDepth;
When projectDirection=Top, xShift=0; YShift=-reliefDepth.
Step (2). according to the position of 2 color blend typical applications, find out respectively their pixel data (blue, green, red numerical value) from image, be denoted as respectively b1, g1, r1, and b2, g2, r2 is used for step (6) and step (7) and processes.
Step (3). process points X, the initial coordinate of Y are made as the image upper left corner, i.e. X, Y all is made as 0;
Step (4). advance by column, line by line " process points " by following steps (5)~step (10):
Step (5). obtain the indigo plant of a certain process points, green, red numerical value, be denoted as respectively b, g, r;
Step (6). as abs (b-b1)<colorMixDegree and abs (g-g1)<colorMixDegree and abs (r-r1)<colorMixDegree with b1, g1, r1 turns step (10) as the color output valve of " process points ".Wherein abs is the function that takes absolute value.
Step (7). as abs (b-b2)<colorMixDegree and abs (g-g2)<colorMixDegree and abs (r-r2)<colorMixDegree with b2, g2, r2 turns step (10) as the color output valve of " process points ".Wherein abs is the function that takes absolute value.
Step (8). according to coordinate x0+xShift, y0+yShift takes out the pixel data (blue, green, red numerical value) of " source point ", is denoted as respectively b3, g3, r3.Then with the b of process points, g, the b3 of r data and source point, g3, the r3 data calculate b4 by following formula, g4, the r4 data:
b4=abs(b-b3+128) (5)
g4=abs(g-g3+128) (6)
r4=abs(r-r3+128) (7)
Be None as reservedColor, with this b4, g4, the r4 data turn step (10) as the color output valve of " process points ".
Step (9).
Be Blue as reservedColor, with b, g4, the r4 data turn step (10) as the color output valve of " process points ";
Be Green as reservedColor, with b4, g, the r4 data turn step (10) as the color output valve of " process points ";
Be Red as reservedColor, with b4, g4, the r data turn step (10) as the color output valve of " process points ".
Step (10). with process points Building X mark+1, turn step (4) as X less than picture traverse width; Otherwise turn step (11);
Step (11). process points Building X mark is made as 0, and process points Building Y mark+1 turns step (4) as Y less than picture altitude height; Otherwise turn step (12);
Step 12). the embossment process finishes, and turns step 13);
Step 13). according to whether selecting the monochromatic embossment process of carrying out to shift in abovementioned steps 1.As select the chromatography embossment all processes finish; As select monochromatic embossment according to the gray count formula of later step three, full figure to be carried out the gray processing operation, wherein B, G, R are the indigo plant of this pixel, green, red component value.
Three, step 3. optional gray processing operation, the gray-scale value I=0.3B+0.59G+0.11R of each picture point after processing, wherein B, G, R are the original indigo plant of this pixel, green, red component value.Accompanying drawing 2 (a), 2 (b) are for adding the camegraph after gray processing operates.

Claims (4)

1. the anaglyph implementation method of a cartoon character on mobile phone and background, is characterized in that, digital picture is carried out the operation of chromatography embossment, comprises the following steps:
Step 1. is set and is kept look, projecting direction, relief depth, two color blend typical applications, color blend degree, monochromatic embossment or chromatography embossments;
A) keep look, be designated as reservedColor: keep look by selection and make be coated with last layer pseudo-colours effect on the picture of embossment, None, Red, Green and Blue totally 4 kinds of options are arranged, wherein,
ReservedColor is that None represents look without reserve;
ReservedColor is that Red represents to keep red;
ReservedColor is that Green represents to keep green;
ReservedColor is that Blue represents to keep blue;
B) projecting direction is designated as projectDirection: so that embossment obtains corresponding drop shadow effect, RightTop, Right, RightBottom, Bottom, LeftBottom are arranged by selecting different projecting directions, Left, LeftTop and Top be totally 8 kinds of options, wherein
ProjectDirection is that RightTop represents the projection to left down from the upper right;
ProjectDirection is that Right represents projection from right to left;
ProjectDirection is that RightBottom represents to go up from the bottom right projection left;
ProjectDirection is that Bottom represents projection from bottom to top;
ProjectDirection is that LeftBottom represents to go up from the lower-left projection to the right;
ProjectDirection is that Left represents projection from left to right;
ProjectDirection is that LeftTop represents from the upper left to the bottom right projection;
ProjectDirection is that Top represents projection from the top down;
C) relief depth is designated as reliefDepth: span is 1~15;
D) color blend typical application is designated as colorMixPoint: the user is choosing 2 pixels on the digital picture of pre-treatment, be used for obtaining the pixel data of selected pixel;
E) color blend degree is designated as colorMixDegree: selected numerical value is larger, and larger via the true qualities zone of color blend typical application expansion, span is 1~100;
F) select monochromatic embossment or chromatography embossment;
The operation of step 2. chromatography embossment:
Below the current picture point of just processing is designated as process points, the coordinate of process points is denoted as x0, y0; From a certain projecting direction to the process points projection, the projection source point that is used for the acquisition pixel value difference is designated as source point, and the source point coordinate is x0+xShift, y0+yShift, and xShift and yShift are respectively the side-play amount of x and y direction;
Step 1). the value that calculates xShift and yShift according to the intension of 8 kinds of values of projecting direction projectDirection is respectively:
When projectDirection=RightTop, xShift=-reliefDepth; YShift=-reliefDepth;
When projectDirection=Right, xShift=-reliefDepth; YShift=0;
When projectDirection=RightBottom, xShift=-reliefDepth; YShift=reliefDepth;
When projectDirection=Bottom, xShift=0; YShift=reliefDepth;
When projectDirection=LeftBottom, xShift=reliefDepth; YShift=reliefDepth;
When projectDirection=Left, xShift=reliefDepth; YShift=0;
When projectDirection=LeftTop, xShift=reliefDepth; YShift=-reliefDepth;
When projectDirection=Top, xShift=0; YShift=-reliefDepth;
Step 2). according to the position of 2 color blend typical applications, the pixel data that finds out respectively them from image is blue, green, red numerical value, is denoted as respectively b1, g1, r1, and b2, g2, r2 is used for step 6) and step 7) process;
Step 3). process points X, the initial coordinate of Y are made as the image upper left corner, i.e. X, Y all is made as 0;
Step 4). by following steps 5)~step 10) advance by column, line by line process points and process points is operated:
Step 5). obtain the indigo plant of current process points, green, red numerical value, be denoted as respectively b, g, r;
Step 6) if. abs (b-b 1)<colorMixDegree and abs (g-g1)<colorMixDegree and abs (r-r1)<colorMixDegree with b1, g1, r1 turns step 10 as the color output valve of process points), wherein abs is the function that takes absolute value;
Step 7) if. abs (b-b2)<colorMixDegree and abs (g-g2)<colorMixDegree and abs (r-r2)<colorMixDegree with b2, g2, r2 turns step 10 as the color output valve of process points, and wherein abs is the function that takes absolute value;
Step (8). according to coordinate x0+xShift, the pixel data that y0+xShift takes out source point is blue, green, red numerical value, is denoted as respectively b3, g3, r3, then with the b of process points, g, the b3 of r data and source point, g3, the r3 data calculate b4 by following formula, g4, the r4 data:
b4=abs(b-b3+128);
g4=abs(g-g3+128);
r4=abs(r-r3+128);
If reservedColor is None, with this b4, g4, the r4 data turn step (10) as the color output valve of process points;
Step 9).
If reservedColor is Blue, with b, g4, the r4 data turn step 10 as the color output valve of " process points ");
If reservedColor is Green, with b4, g, the r4 data turn step 10 as the color output valve of " process points ");
If reservedColor is Red, with b4, g4, the r data turn step 10 as the color output valve of " process points ");
Step 10). with process points Building X mark+1, turn step 4 as X less than picture traverse width); Otherwise turn step 11);
Step 11). process points Building X mark is made as 0, and process points Building Y mark+1 turns step 4 as Y less than picture altitude height); Otherwise turn step 12);
Step 12). the embossment process finishes, and turns step 13);
Step 13). according to whether selecting monochromatic embossment to operate in abovementioned steps 1, as selecting all processes end of chromatography embossment; Thereby as select monochromatic embossment according to gray count formula I=0.3B+0.59G+0.11R, full figure to be carried out gray processing operation to obtain monochromatic anaglyph, wherein B, G, R are the indigo plant of pixel, green, red component value.
2. the anaglyph implementation method of cartoon character on mobile phone according to claim 1 and background, it is characterized in that, before digital picture is carried out the operation of chromatography embossment, original digital image is carried out distortion process, and with the present image of the image after distortion as the operation of chromatography embossment, step is as follows:
Step 1: based on the distortionless template of the size design of digital portrait to be operated and distortion template;
Step 2: set the distortion band of being established by twisting center line and distortion bandwidth, according to distortion parameter bit distortion template assignment;
Step 3: the digital portrait for the treatment of operation based on described distortion template carries out the distortion operation, forms the figure facial makeup of distortion;
The step of described step 1 is:
Step a: for width is width, highly is the digital portrait to be operated of height, setting up the length of side with the capable and columns of lines row, square grid is the distortionless square trellis template of scale-distortionless template, records X, the Y coordinate of each grid left upper end point in this distortionless template; For ease of operation fast in the mobile phone of low arithmetic capability, adopt the list structure that comprises line pointer and column pointer, a two-dimensional array is converted into one-dimensional representation;
Step b: set up one for above-mentioned digital portrait and have the grid that lines is capable and columns is listed as, each grid length of side be scale be used for depositing twist angle (dx, dy) Grid Template-distortion template records X, the Y coordinate of each grid left upper end point in this distortion template; For ease of operation fast in the mobile phone of low arithmetic capability, adopt the list structure that comprises line pointer and column pointer, a two-dimensional array is converted into one-dimensional representation;
The concrete steps of described step 2 are:
1) set up with twisting center line and the formed distortion band of distortion bandwidth, and make in distortionless template and treat the distortion mark, its process is:
Obtain the mouse motion track, as the twisting center line of distortion band; The distortion bandwidth is set by the user; Take the grid upper left corner of twisting center line process as the center of circle, all grids in take radius as the area of a circle that radius was covered are labeled as the distortion band, and radius is 1/2 of distortion bandwidth;
2) calculate to obtain in the distortion template each grid in the torsion resistance (dx, dy) of X, Y-direction, deposit X, Y coordinate scale+dx and the scale+dy of each grid left upper end point in the distortion template, finally complete the assignment of distortion template;
Dx, dy is value by the following method:
Judge whether current grid makes a mark in distortionless template, as unmarked, dx, dy gets 0, otherwise,
dx=TwistIntensity*Coefficent*cos(alpha);
dy=TwistIntensity*Coefficent*sin(alpha);
TwistIntensit is the transverse strength that the user sets, Coefficent under the normal distribution condition when certain puts coefficient of torsion when being distance apart from the distance of twisting center line:
Coefficent = 1 σ 2 π e - d 2 2 σ 2 ,
σ is the sigma value that can manually set, the distribution gradient of sign transverse strength, d be current grid apart from the distance of distortion band center line, alpha is this distortion band center line at the tangent line at current grid place and the angle of x axle.
3. the anaglyph implementation method of cartoon character on mobile phone according to claim 2 and background, is characterized in that, the concrete steps of described step 3 are: the square block-by-block that is scale to the length of side carries out the distortion operation, thereby realizes the distortion operation to full figure;
The distortion operating process of each square is as follows:
Step 1, play up piece location line number according to this quilt and determine current piece upper left corner X coordinate: the x that played up ij=j * scale
Step 2, play up piece location line number according to this quilt and determine current piece upper left corner Y coordinate: the y that played up ij=i * scale
The upper left corner X coordinate of corresponding this piece: Lx in step 3, taking-up distortion template ij=TwistTemplet[i * columns+j] .x, TwistTemplet refers to the distortion template;
The upper left corner Y coordinate of corresponding this piece: Ly in step 4, taking-up distortion template ij=TwistTemplet[i * columns+j] .y;
The lower right corner X coordinate of corresponding this piece: Rx in step 5, taking-up distortion template ij=TwistTemplet[i * columns+ (j+1)] .x;
The lower right corner Y coordinate of corresponding this piece: Ry in step 6, taking-up distortion template ij=TwistTemplet[i * columns+ (j+1)] .y;
Step 7, obtain the X mean deviation of every bit in projecting block: dx ij=(Rx ij-Lx ij)/scale;
Step 8, obtain the X mean deviation of every bit in projecting block: dy ij=(Ry ij-Ly ij)/scale;
Step 9, cumulative every bky of delegation in projecting block is obtained its Y coordinate iy:iy=Ly ij+ (bkL * dy ij);
Step 10, cumulative each row bkx in projecting block is obtained its X coordinate ix:ix=Lx ij+ (bkC * dx ij);
Step 11, will gradually project to the capable bkx of bky with the RGB image of the capable ix of iy row sign and list, namely gradually complete as the hypograph assign operation: here, after distortion, the image output pointer is:
ImgOpt+bky×lineByte+bkx×pixelByte+shift;
Before distortion, the input pointer of image is:
ImgIpt+iy×LineByte+ix×pixelByte+shift;
Wherein, ImgOpt is the base address of image output pointer after distortion;
ImgIpt is the base address of image input pointer before distortion;
LineByte is the byte number of each image line;
PixelByte is the byte number of each image column;
Shift is the RGB image side-play amount of projection operation gradually, is respectively 0,1,2.
4. the anaglyph implementation method of according to claim 1-3 described cartoon character on mobile phone of any one and background, it is characterized in that, after digital picture being carried out the operation of chromatography embossment, resulting chromatography camegraph is carried out the gray processing operation, the gray-scale value I=0.3B+0.59G+0.11R of each picture point after processing, wherein B, G, R are the original indigo plant of this pixel, green, red component value.
CN 201110219903 2011-08-03 2011-08-03 Method for realizing embossment effect of animation character and background of mobile phone Expired - Fee Related CN102306389B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110219903 CN102306389B (en) 2011-08-03 2011-08-03 Method for realizing embossment effect of animation character and background of mobile phone

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110219903 CN102306389B (en) 2011-08-03 2011-08-03 Method for realizing embossment effect of animation character and background of mobile phone

Publications (2)

Publication Number Publication Date
CN102306389A CN102306389A (en) 2012-01-04
CN102306389B true CN102306389B (en) 2013-05-08

Family

ID=45380247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110219903 Expired - Fee Related CN102306389B (en) 2011-08-03 2011-08-03 Method for realizing embossment effect of animation character and background of mobile phone

Country Status (1)

Country Link
CN (1) CN102306389B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663798B (en) * 2012-04-25 2014-01-01 拓维信息系统股份有限公司 Mobile phone cartoon character and background creation method based on simulation frescoes
KR20150121069A (en) * 2013-02-23 2015-10-28 퀄컴 인코포레이티드 Systems and methods for interactive image caricaturing by an electronic device
CN105205797B (en) * 2015-09-30 2017-11-03 中南大学 A kind of acquiring method of image variant art distortion figure
CN105825531B (en) * 2016-03-17 2018-08-21 广州多益网络股份有限公司 A kind of colouring method and device of game object
CN112767522A (en) * 2020-11-27 2021-05-07 成都完美时空网络技术有限公司 Virtual object wind animation rendering method and device, storage medium and electronic device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020158972A1 (en) * 2001-04-25 2002-10-31 Stephany Thomas M. Method of image processing an animated figure
JP4081754B2 (en) * 2001-05-21 2008-04-30 株式会社セガ Image processing apparatus and game apparatus
US7619628B2 (en) * 2005-06-24 2009-11-17 Microsoft Corporation Caching digital image data
CN1997191A (en) * 2006-09-30 2007-07-11 武汉市迅彩科技有限责任公司 A method for animation display in the mobile communication terminal
CN102034256B (en) * 2010-11-15 2012-08-22 拓维信息系统股份有限公司 Mobile phone cartoon character creating method based on boundary tracking and pseudo-coloring

Also Published As

Publication number Publication date
CN102306389A (en) 2012-01-04

Similar Documents

Publication Publication Date Title
CN102306389B (en) Method for realizing embossment effect of animation character and background of mobile phone
Cohen et al. Wang tiles for image and texture generation
CN108074274A (en) BIM model real-time rendering method and devices based on browser
CN107567642A (en) System, method and apparatus for the three-dimensional modeling based on voxel
CN109102560A (en) Threedimensional model rendering method and device
CN104506921B (en) A kind of method and device of dynamic displaying pictures
CN110333924A (en) A kind of image morphing method of adjustment, device, equipment and storage medium
US11961174B2 (en) Programmatically configuring materials
Lagae Wang tiles in computer graphics
CN102819855A (en) Method and device for generating two-dimensional images
CN103021025B (en) Utilize the method for generating pattern of computer program
CN102243767B (en) Creation method of mobile phone cartoon figure based on local image distortion
CN102521867B (en) Mobile phone anime character and background creation method
CN102074035B (en) Panoramic image distortion-based mobile phone cartoon character creating method
CN101511034A (en) Truly three-dimensional stereo display method facing Skyline
Guérin et al. Efficient modeling of entangled details for natural scenes
Hu et al. Research on 3d interactive model selection and customization of ceramic products based on big data cloud service platform
CN114255312A (en) Processing method and device of vegetation image and electronic equipment
CN105513121A (en) Digital three-dimensional ink-wash landscape paint drawing method
CN101488230B (en) VirtualEarth oriented ture three-dimensional stereo display method
CN101488232B (en) Implanted true three-dimension volumetric display method oriented to C Tech software
Parzer Irrational image generator
CN113192211B (en) Three-color Tang virtual coloring system and method based on 3D model
CN108553902A (en) A kind of transform method of the multi-dimension material based on UE engines
CN101482977B (en) Microstation oriented implantation type true three-dimensional stereo display method

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: 20130508

Termination date: 20180803

CF01 Termination of patent right due to non-payment of annual fee