CN102521867B - Mobile phone anime character and background creation method - Google Patents

Mobile phone anime character and background creation method Download PDF

Info

Publication number
CN102521867B
CN102521867B CN201110424554.0A CN201110424554A CN102521867B CN 102521867 B CN102521867 B CN 102521867B CN 201110424554 A CN201110424554 A CN 201110424554A CN 102521867 B CN102521867 B CN 102521867B
Authority
CN
China
Prior art keywords
image
pixeldes
pixel
value
color
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
CN201110424554.0A
Other languages
Chinese (zh)
Other versions
CN102521867A (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.)
Talkweb Information System Co Ltd
Original Assignee
Talkweb Information System 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 Talkweb Information System Co Ltd filed Critical Talkweb Information System Co Ltd
Priority to CN201110424554.0A priority Critical patent/CN102521867B/en
Publication of CN102521867A publication Critical patent/CN102521867A/en
Application granted granted Critical
Publication of CN102521867B publication Critical patent/CN102521867B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Abstract

本发明公开了一种手机动漫人物及背景创作方法,采用如下五种方法中的任一种方法对原图像进行处理或者采用前4中方法中的任一种方法与方法5对源图像混合处理:方法1:非对角线元素消隐方法:方法2:随机模糊化方法;方法3:珠帘效果模拟方法;方法4:图像移色方法;方法5:单色化和钝化方法。该方法构思新颖,不但趣味性强,实现简单,而且数据量小,易于实施,适于在手机上运行。

The invention discloses a mobile phone animation character and background creation method, which uses any one of the following five methods to process the original image or uses any one of the first 4 methods and method 5 to mix and process the source image : Method 1: Off-diagonal element blanking method; Method 2: Random blurring method; Method 3: Bead curtain effect simulation method; Method 4: Image color shifting method; Method 5: Monochrome and passivation method. The method is novel in conception, not only interesting, but also simple in implementation, small in data volume, easy to implement, and suitable for running on mobile phones.

Description

一种手机动漫人物及背景创作方法A mobile phone animation character and background creation method

技术领域 technical field

本发明涉及一种手机动漫人物及背景创作方法。The invention relates to a mobile phone animation character and background creation method.

背景技术 Background technique

作为动漫产业的一个分支,我国手机动漫产品也获得了长足的发展,目前主要包括动漫彩信、四格手机漫画、动画短片和回合制手机游戏等。它们兼有文化产品和信息产品的双重特性:作为文化产品无疑需要遵循社会主义文化产品的普遍原则,但又不宜直白说教,而要寓教于乐;而作为信息产品则希望尽可能地引入先进的计算机技术,以期在提高产品质量的同时提高其生产效率。As a branch of the animation industry, my country's mobile animation products have also achieved considerable development. Currently, they mainly include animation MMS, four-frame mobile comics, animation short films and turn-based mobile games. They have the dual characteristics of both cultural products and information products: as cultural products, it is undoubtedly necessary to follow the general principles of socialist cultural products, but it is not suitable for blunt preaching, but to entertain and teach; as information products, we hope to introduce as much as possible Advanced computer technology, in order to improve product quality and improve its production efficiency.

艺术上的朦胧是一种美学境界。较之清晰、分明的真彩数码作品,它像是一种有特殊美感的、只可意会却难于言表的艺术形式。如果将真彩色数码照片类比为国画中的工笔花鸟、是浓妆艳抹的贵妇人,那么各种朦胧作品就像是国画中的泼墨山水,是不施粉黛的村姑,真乃:“水光潋滟晴方好,山色空濛雨亦奇”。较之色彩艳丽、鲜明的彩色数码照片,本发明所追求的若隐若现、山色空濛,将留给观众无穷的想象空间。Obscurity in art is an aesthetic realm. Compared with clear and distinct true-color digital works, it seems to be an art form with special aesthetic feeling that can only be understood but hard to describe. If the true-color digital photos are compared to the fine brushwork flowers and birds in traditional Chinese paintings, and the ladies with heavy makeup, then all kinds of hazy works are like the splashed ink landscapes in Chinese paintings, and they are village girls who do not wear makeup. Shino: "The water is shining It’s good to have a sunny day, but it’s strange to see the mountains empty and rainy.” Compared with colorful and vivid color digital photos, the faintly visible and empty mountain scenery pursued by the present invention will leave infinite imagination space for the audience.

目前尚未发现有与本发明相似的此类具有套色或黑白朦胧画作品效果的动漫作品的报道。Have not yet found the report of this kind of animation works similar to the present invention with the effects of color-gathering or black-and-white hazy paintings.

发明内容 Contents of the invention

本发明所要解决的技术问题是提供一种手机动漫人物及背景创作方法,本发明的手机动漫人物及背景创作方法数据处理量小,易于实施,适于在手机上运行。The technical problem to be solved by the present invention is to provide a mobile phone cartoon character and background creation method. The mobile phone cartoon character and background creation method of the present invention has a small amount of data processing, is easy to implement, and is suitable for running on a mobile phone.

发明的技术解决方案如下:The technical solution of the invention is as follows:

一种手机动漫人物及背景创作方法,采用如下五种方法中的任一种方法对原图像进行处理或者采用前4中方法中的任一种方法与方法5对源图像混合处理:A mobile phone animation character and background creation method, using any one of the following five methods to process the original image or using any one of the first 4 methods and method 5 to mix and process the source image:

方法1:非对角线元素消隐方法:Method 1: Off-diagonal element blanking method:

方法2:随机模糊化方法;Method 2: random fuzzy method;

方法3:珠帘效果模拟方法;Method 3: Simulation method of bead curtain effect;

方法4:图像移色方法;Method 4: image color shifting method;

方法5:单色化和钝化方法。Method 5: monochromatization and passivation method.

所述的非对角线元素消隐方法的步骤为:The steps of the described non-diagonal element blanking method are:

将原图像网格化,每一个网格的对角线处的像素保留色彩,其他位置的像素清零为白色,即用白色像素替换;The original image is gridded, and the pixels at the diagonal of each grid retain the color, and the pixels at other positions are cleared to white, that is, replaced with white pixels;

网格化对应的网格密度gridSize为小于5像素;所述的网格密度即正方形网格的边长。The grid density corresponding to gridSize is less than 5 pixels; the grid density is the side length of the square grid.

方法2中的随机模糊化方法步骤为:The steps of the random fuzzing method in Method 2 are:

步骤(1).将预留存放输出图像即目标图像的数据空间清零为白色;Step (1). The data space reserved for storing the output image, that is, the target image, is cleared to white;

步骤(2).从原图像的左上角开始,参数i为行计数器,参数j为列计数器,参数i和参数j均以gridSize作为递增步长,参数k为辅助计数器,k从0递增到gridSize,达到gridSize后再清零;按步骤(3)~(4)遍历全图,即完成随机模糊化的过程;Step (2). Starting from the upper left corner of the original image, parameter i is a row counter, parameter j is a column counter, both parameter i and parameter j use gridSize as the incremental step, parameter k is an auxiliary counter, and k is incremented from 0 to gridSize , and then reset to zero after reaching the gridSize; traverse the whole graph according to steps (3)~(4), that is, complete the random fuzzing process;

步骤(3).在每一个以gridSize为边长的网格中,按以下方法确定源、终两类像素点即pixelSou和pixelDes位置:Step (3). In each grid with gridSize as the side length, determine the source and final two types of pixel points, namely pixelSou and pixelDes positions, as follows:

pixelSou=souBase+(i+k+yrand)*lineByte+(j+k+xrand)*pixelByte;pixelSou=souBase+(i+k+yrand)*lineByte+(j+k+xrand)*pixelByte;

pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;

其中souBase和desBasewe分别为源、终两类像素点的基地址,lineByte为图像每行字节数,pixelByte为图像每像素字节数,i和j为相应行与列的序数,yrand和xrand都是随机数,随机数在0-gridsize之间随机取值;Among them, souBase and desBasewe are the base addresses of the source and final pixel points respectively, lineByte is the number of bytes per line of the image, pixelByte is the number of bytes per pixel of the image, i and j are the serial numbers of the corresponding rows and columns, yrand and xrand are both It is a random number, and the random number takes a random value between 0-gridsize;

步骤(4).取出源像素点蓝、绿、红数据赋予对应输出像素点Step (4). Take out the blue, green, and red data of the source pixel and assign it to the corresponding output pixel

*(pixelDes)=*(pixelSou);*(pixelDes) = *(pixelSou);

*(pixelDes+1)=*(pixelSou+1);*(pixelDes+1)=*(pixelSou+1);

*(pixelDes+2)=*(pixelSou+2)。*(pixelDes+2)=*(pixelSou+2).

珠帘效果模拟方法为:The bead curtain effect simulation method is:

步骤1:制作珠帘模板:设定珠帘参数制作珠链模板,所述的珠帘参数包括珠链列距、珠体行距、珠体直径、珠体连接线直径【在实例中,连线直径为2】Step 1: Make the bead curtain template: set the bead curtain parameters to make the bead chain template. The bead curtain parameters include the row spacing of the bead chain, the row spacing of the bead body, the diameter of the bead body, and the diameter of the connecting line of the bead body [In the example, the connection line Diameter is 2]

步骤2:将所述的珠帘模板作为蒙板叠加在方法1或方法2形成的图像上得到最终的具有珠帘效果的新图像。Step 2: Superimpose the bead curtain template as a mask on the image formed by method 1 or method 2 to obtain a final new image with bead curtain effect.

图像移色方法的步骤为:The steps of the image color shifting method are:

步骤(1).选取2个色彩样板点,根据2个色彩样板点的位置,从图像中分别查找出它们的像素对应的蓝、绿、红数值,分别记作b1,g1,r1,和b2,g2,r2;Step (1). Select 2 color sample points, and according to the positions of the 2 color sample points, find out the blue, green, and red values corresponding to their pixels from the image, respectively denoted as b1, g1, r1, and b2 , g2, r2;

步骤(2).处理点X,Y初始座标设为图像左上角,即X,Y均设为0;Step (2). The initial coordinates of the processing point X and Y are set to the upper left corner of the image, that is, both X and Y are set to 0;

步骤(3).通过以下步骤(4)~(9)逐列、逐行地按像素即处理点推进:Step (3). Through the following steps (4) to (9), proceed column by column and row by pixel, that is, process points:

步骤(4).取得当前处理点的蓝、绿、红数值,分别记作sb,sg,sr;Step (4). Obtain the blue, green and red values of the current processing point, denoted as sb, sg, sr respectively;

步骤(5).如abs(sb-b1)<areaExtanDegree且abs(sg-g1)<areaExtanDegree且abs(sr-r1)<areaExtanDegree则记b1为b,记g1为g,记r1为r,转步骤(7)进行图像移色操作;其中,areaExtanDegree为区域扩展度;反之,如判别条件不满足则转步骤(8)保留原色;【移色操作会带来山雨欲来的效果:因为山雨欲来中,样板点是取在天空(或山体)中,这一判断是测定天空(或山体)的范围。因为在RGB颜色标准中,RGB取值越小,颜色就越深。例如RGB三色都是0时就是黑色。步骤7的移色操作的实质是减小RGB的取值,从而使天色(或山体的颜色)变暗,达到山雨欲来的效果】Step (5). If abs(sb-b1)<areaExtanDegree and abs(sg-g1)<areaExtanDegree and abs(sr-r1)<areaExtanDegree, record b1 as b, record g1 as g, record r1 as r, and go to step (7) Carry out image color shifting operation; among them, areaExtanDegree is the degree of area expansion; otherwise, if the judgment condition is not satisfied, go to step (8) to retain the original color; [color shifting operation will bring the effect of mountain rain: because of mountain rain In the future, the sample point is taken in the sky (or mountain), and this judgment is to measure the range of the sky (or mountain). Because in the RGB color standard, the smaller the RGB value, the darker the color. For example, when the RGB three colors are all 0, it is black. The essence of the color shifting operation in step 7 is to reduce the value of RGB, so as to darken the sky (or the color of the mountain) and achieve the effect of rain coming]

步骤(6).如abs(sb-b2)<areaExtanDegree且abs(sg-g2)<areaExtanDegree且abs(sr-r2)<areaExtanDegree则记b2为b,记g2为g,记r2为r,转步骤(7)进行图像移色操作;反之,如判别条件不满足则转步骤(8)保留原色;Step (6). If abs(sb-b2)<areaExtanDegree and abs(sg-g2)<areaExtanDegree and abs(sr-r2)<areaExtanDegree, record b2 as b, record g2 as g, record r2 as r, and go to step (7) Carry out image color shifting operation; On the contrary, if discriminating condition does not satisfy then go to step (8) retain primary color;

步骤(7).按以下公式将色彩的RGB制式变换成YCrCb制式Step (7). Transform the RGB system of the color into the YCrCb system according to the following formula

Y=(257*r+504*g+98*b)/1000+16;Y=(257*r+504*g+98*b)/1000+16;

Cr=(439*r-368*g-71*b)/1000+128;Cr=(439*r-368*g-71*b)/1000+128;

Cb=(-148*r-291*g+439*b)/1000+128;Cb=(-148*r-291*g+439*b)/1000+128;

根据雾气浓度参数修正Y值:Correct the Y value according to the fog concentration parameter:

Y=Y*fog;Y=Y*fog;

按下列公式将YCrCb制式反变换为RGB制式:Convert the YCrCb system to the RGB system inversely according to the following formula:

fogB=(1.164*(Y-16)+2.017*(Cb-128));fogB=(1.164*(Y-16)+2.017*(Cb-128));

fogG=(1.164*(Y-16)-0.813*(Cr-128)-0.392*(Cb-128));fogG=(1.164*(Y-16)-0.813*(Cr-128)-0.392*(Cb-128));

fogR=(1.164*(Y-16)+1.596*(Cr-128));fogR=(1.164*(Y-16)+1.596*(Cr-128));

对当前像素值予以黯黄化移色并输出Dim and yellow the current pixel value and output

*(pixelDes)=sb-(fogB*fog/10);*(pixelDes)=sb-(fogB*fog/10);

*(pixelDes+1)=sg-(fogG*fog/10);*(pixelDes+1)=sg-(fogG*fog/10);

*(pixelDes+2)=sr-(fogR*fog/10);*(pixelDes+2)=sr-(fogR*fog/10);

转步骤(9);Go to step (9);

步骤(8).将处理点的图像数据保持原数据输出:Step (8). Keep the image data of the processing point as the original data output:

*(pixelDes)=sb;*(pixelDes) = sb;

*(pixelDes+1)=sg;*(pixelDes+1)=sg;

*(pixelDes+2)=sr;*(pixelDes+2)=sr;

步骤(9).处理点X座标+1,如未到图像右边界则转步骤(4);否则转步骤(10);Step (9). The X coordinate of the processing point is +1, if the right boundary of the image is not reached, then go to step (4); otherwise go to step (10);

步骤(10).处理点X座标设为0,处理点Y座标+1,如处理点未到图像右下边界则转步骤(4);否则程序结束。Step (10). The X coordinate of the processing point is set to 0, and the Y coordinate of the processing point is +1. If the processing point does not reach the lower right boundary of the image, go to step (4); otherwise, the program ends.

所述的单色化和钝化方法为:Described monochromaticization and passivation method are:

先对原图像进行单色化操作,即对图像的每一个像素进行以下的灰度化操作:The monochrome operation is first performed on the original image, that is, the following grayscale operation is performed on each pixel of the image:

处理后各像点的灰度值I=0.3B+0.59G+0.11R,其中B、G、R为该像素点原先的蓝、绿、红分量值;得到单色化后的图像;Gray value I=0.3B+0.59G+0.11R of each pixel after processing, wherein B, G, R are the original blue, green and red component values of the pixel; obtain the monochromatic image;

再对单色化后的图像进行钝化操作;钝化操作的如下,对于一个N*N的滤波窗口,对该滤波窗口的每一列元素求最大值、中值和最小值;再求出所有最大值中的最小值MaxMin、所有中间值中的中间值MedMed以及所有最小值中的最大值MinMax,最终得到的中间值为MED=med[MaxMin,MedMed,MinMax]。Then perform a passivation operation on the monochromatic image; the passivation operation is as follows, for an N*N filter window, calculate the maximum value, median value and minimum value for each column element of the filter window; then find all The minimum value MaxMin among the maximum values, the median value MedMed among all intermediate values, and the maximum value MinMax among all minimum values, the finally obtained median value is MED=med[MaxMin, MedMed, MinMax].

因为尚无人想到可以在手机上以本人(或朋友)的照片为素材、进行DIY操作来创作手机动漫人物或动漫背景;特别是考虑到手机相对于台式计算机远为薄弱(仅相当于本世纪初期的台式机)的计算能力,也往往使人却步。Because no one has thought of using photos of oneself (or friends) as materials on mobile phones to carry out DIY operations to create mobile animation characters or animation backgrounds; especially considering that mobile phones are far weaker than desktop computers (only equivalent to this century) The computing power of early desktop computers) is also often prohibitive.

为了针对手机这一特殊的平台实现DIY图像操作,在设计上采用了以下一系列措施,特别是减少应用程序的内存需求:In order to realize DIY image operation for the special platform of mobile phone, the following series of measures are adopted in the design, especially to reduce the memory requirement of the application program:

A.应用程序越简单越好。我们尽可能将每个组件制作成Midlet,将所用到的多个Midlet封装在一个Midlet包中,这使手机的程序管理器可以更节约地管理Midlet和Midlet所使用的资源。A. The simpler the application, the better. We try our best to make each component into a Midlet, and encapsulate multiple Midlets used in a Midlet package, which enables the program manager of the mobile phone to manage Midlets and the resources used by Midlets more economically.

B.应用程序越小越好。删除应用程序中暂时用不上的组件,尽量减少不必要的信息,以减少整个程序的体积。当在无线网上下载应用程序时,较小的应用程序将大大缩短下载时间,并能与设备上其他应用程序兼容(而不是排他)地运行。B. The smaller the application, the better. Delete the temporarily unused components in the application and minimize unnecessary information to reduce the size of the entire program. When downloading apps over a wireless network, a smaller app will greatly reduce download time and will run in compatibility (rather than exclusive) with other apps on the device.

C.尽量减少应用程序总内存需求。主要措施有:①少使用对象类型,换用标量类型(scalar type)。因为标量类型比对象类型占用更少的内存;②尽量少声明对象。因为当声明一个对象时,系统要在运行堆上分配空间,所以应该在应用程序即将使用该对象时再分配它,而不是程序启动时全部进行分配。而且,一旦程序不再需要该对象,就将对该对象的引用均赋值为null。③按精度需要使用数据类型。只要有可能就应该用boolean,byte,short等数据类型代替int。这种细节对台式机程序影响甚微,但对手机将会带产生积少成多的影响。④尽量重用。让多个引用在程序生存周期中的不同时间使用同一个对象。例如重用某些大型数组、重用可利用已分配的运行时存储器,使用“惰性”实例化。虽然这不符合软件工程原则,但却适合手机这种能力很弱的计算设备的现实情况。⑤避免在循环内创建对象。⑥经常检查存储器使用情况。相关的方法有:freeMemory和totalMemory。自行处理OutMemoryError错误。应当保证应用程序在内存溢出时,有一个预定的退出例程对此进行管理,而不留给操作系统。⑦及时释放资源。对文件、网络连接等等资源,当不再需要使用时,切莫占着不放。应当自己执行必要的清除操作,而不要依靠垃圾收集器或宿主环境。⑧多使用局部变量。在台式机应用中,开发人员习惯设定较多的类数据成员,而较少使用局部变量。但类数据成员实际上是类内的“全局变量”,是需要频繁的数据调度、堆栈操作支持,实际上是消耗CPU计算来支持的。通过局部变量赋值,消除访问类的数据成员的额外步骤,可以减少应用程序的CPU处理量。这样虽然失去了将数据封装在类中所带来的好处,但是,对于在手机这种微小型计算设备上运行、需要大量数据的应用程序来说,其处理速度是需要首先考虑的。C. Minimize the total memory requirements of the application. The main measures are: ①Use less object types and use scalar types instead. Because the scalar type occupies less memory than the object type; ② declare as few objects as possible. Because the system allocates space on the running heap when declaring an object, it should be allocated when the application is about to use the object, rather than all allocated when the program starts. Moreover, once the program no longer needs the object, all references to the object are assigned the value null. ③According to the accuracy needs to use the data type. Whenever possible, data types such as boolean, byte, and short should be used instead of int. This kind of detail has little impact on desktop programs, but it will have a cumulative impact on mobile phones. ④Reuse as much as possible. Let multiple references use the same object at different times in the program's lifetime. For example reusing some large arrays, reusing can take advantage of allocated runtime memory, using "lazy" instantiation. While this doesn't conform to software engineering principles, it fits the realities of a computing device as thin as a cell phone. ⑤ Avoid creating objects within the loop. ⑥ Always check the memory usage. Related methods are: freeMemory and totalMemory. Handle OutMemoryError errors yourself. It should be ensured that when the application runs out of memory, there is a predetermined exit routine to manage this, rather than leaving it to the operating system. ⑦Release resources in time. For resources such as files, network connections, etc., when you no longer need to use them, don't hold them. You should perform the necessary cleanup yourself, rather than relying on the garbage collector or the host environment. ⑧ Use local variables more. In desktop applications, developers are accustomed to setting more class data members and using less local variables. However, class data members are actually "global variables" in the class, which require frequent data scheduling and stack operation support, and actually consume CPU calculations to support them. You can reduce your application's CPU processing by eliminating the extra step of accessing data members of a class through local variable assignment. In this way, although the benefits of encapsulating data in classes are lost, the processing speed needs to be considered first for applications that run on tiny computing devices such as mobile phones and require a large amount of data.

有益效果:Beneficial effect:

本发明的手机动漫人物及背景创作方法,采用图像处理算法,以数码照片为素材,改造成不同的套色或黑白朦胧画作品,在动漫服务器或手机用户个人的手机上进行DIY操作,创造出效果特异的动漫人物或动漫背景。The method for creating mobile cartoon characters and backgrounds of the present invention adopts image processing algorithms, uses digital photos as materials, transforms them into different color registers or black and white hazy paintings, and performs DIY operations on animation servers or personal mobile phones of mobile phone users to create effects Unique anime characters or anime backgrounds.

本发明使用简单实用的数字图像处理算法,注意减少数据量和提高CPU运行效率,使受制约于手机屏幕尺寸和手机计算能力的手机动漫作品能够以低廉的创作成本和快速的运行效果,为不同年龄、不同层次、处于不同时间段的手机用户,提供亦庄亦谐的、不同风格的电子资讯,给手机用户的生活带来更多姿色和欢乐。特别要指出:本发明目的之一是在手机这种软硬件资源远远弱于计算机的平台上实现DIY图像操作,所以在设计上采取上述一系列针对性措施是完全必要的。The present invention uses a simple and practical digital image processing algorithm, pays attention to reducing the amount of data and improving the operating efficiency of the CPU, so that mobile animation works that are restricted by the size of the mobile phone screen and the computing power of the mobile phone can be produced for different users with low creation costs and fast running effects. Mobile phone users of different ages, different levels, and in different time periods can provide electronic information in different styles that are both solemn and harmonious, and bring more beauty and joy to the lives of mobile phone users. In particular, it should be pointed out that one of the purposes of the present invention is to realize DIY image operation on a platform such as a mobile phone whose hardware and software resources are far weaker than that of a computer, so it is absolutely necessary to take the above-mentioned series of targeted measures in the design.

附图说明 Description of drawings

图1为非对角线元素消隐方法的示意图;(图1中的步长step即gridSize),)Fig. 1 is a schematic diagram of the off-diagonal element blanking method; (the step size step in Fig. 1 is gridSize),)

图2数码照片原图及采用5种方法得到的效果图(其中,(a)~(d)为原图,(e),(f)为采用非对角线元素消隐方法的效果图(也可以形象地称为“轻纱漫曼”效果图),(g),(h)为采用随机模糊化方法的效果图(也可以形象地称为随机朦胧效果图),(i),(j)为采用珠帘效果模拟方法处理的效果图(也可以形象地称为“珠帘摇曳”效果图、(k),(l)为采用图像移色方法的效果图,(也可以形象地称为“山雨欲来”效果图,(m),(n)为采用单色化和钝化方法的效果图,(也可以形象地称为“泼墨写意”效果图)。Fig. 2 The original image of the digital photo and the effect images obtained by using five methods (where (a) to (d) are the original images, (e) and (f) are the effect images using the off-diagonal element blanking method ( It can also be vividly called "Grassy Manman" rendering), (g), (h) are renderings using random fuzzing method (also can be vividly called random hazy rendering), (i), ( j) is the effect diagram processed by the bead curtain effect simulation method (it can also be referred to as the "bead curtain swaying" effect diagram, (k), (l) is the effect diagram using the image color shifting method, (it can also be visualized It is called the "mountain and rain is coming" rendering, (m), (n) are renderings using monochromatic and passivation methods, (it can also be vividly called "splashing ink freehand brushwork" rendering).

具体实施方式 Detailed ways

以下将结合附图和具体实施例对本发明做进一步详细说明:The present invention will be described in further detail below in conjunction with accompanying drawing and specific embodiment:

本发明提供“轻纱漫曼”、“随机朦胧”、“珠帘摇曳”、“山雨欲来”和“泼墨写意”等五种艺术创作手法。其中“轻纱漫曼”创作手法用独创的“非对角线元素消隐”算法实现;“随机朦胧”创作手法则在消隐的基础上叠加随机像素输出;“珠帘摇曳”创作手法则在消隐的基础上叠加珠帘效果模拟;而“泼墨写意”的基础是单色化和钝化。但是“山雨欲来”创作手法则并未消隐,而应用了独创的图像移色算法,并以下述定义2表述之。The present invention provides five artistic creation methods such as "light gauze", "random haze", "bead curtain swaying", "mountain rain is coming" and "splashing ink freehand". Among them, the creative method of "light gauze" is realized by the original "non-diagonal element blanking" algorithm; the creative method of "random hazy" superimposes random pixel output on the basis of blanking; the creative method of "bead curtain swaying" The bead curtain effect simulation is superimposed on the basis of blanking; while the basis of "splash ink freehand brushwork" is monochromatic and passivation. However, the creative method of "Mountains and Rain is Coming" has not been eliminated, but an original image color shifting algorithm has been applied, and it is expressed by the following definition 2.

定义1.如将某图像分划为若干网格,进而,按某种规则将各网格中某些像素隐去,则称为图像消隐。图像消隐可以达到轻纱薄雾、若隐若现的效果。特别地,当仅保留对角线上的图像元素,则称为深度消隐或非对角线元素消隐Definition 1. If an image is divided into several grids, and some pixels in each grid are hidden according to a certain rule, it is called image blanking. Image blanking can achieve the effect of gauze mist and looming. In particular, when only the image elements on the diagonal are kept, it is called depth blanking or off-diagonal element blanking

(参见图1);反之,如保留非对角线上的图像元素,则称为浅度消隐或对角线元素消隐。(See Figure 1); On the contrary, if the image elements on off-diagonal lines are kept, it is called shallow blanking or diagonal element blanking.

通过图像消隐技术(特别是深度消隐)可以实现若隐若现的视觉效果。例如,当网格长宽均为gridSize时,如采用深度消隐则仅保留对角线上的gridSize个像素;如采用浅度消隐则将保留非对角线上的gridSize*(gridSize-1)个像素;The looming visual effect can be realized by image blanking technology (especially depth blanking). For example, when the length and width of the grid are both gridSize, if deep blanking is used, only gridSize pixels on the diagonal line will be reserved; if shallow blanking is used, gridSize*(gridSize-1 pixels on the off-diagonal line will be kept ) pixels;

定义2.如将某像素点的颜色修正为其原有值减去它与一个非负(或非正)系数的乘积,则称为对该像素实施图像移色。特别地,当选用非负系数时称为黯黄化移色;当选用非正系数时则称为白皙化移色。具体地:Definition 2. If the color of a pixel is corrected to its original value minus the product of it and a non-negative (or non-positive) coefficient, it is called image color shifting for the pixel. In particular, when a non-negative coefficient is selected, it is called a yellowish color shift; when a non-positive coefficient is selected, it is called a whitening color shift. specifically:

A.像素点原有亮度Y由下式给出:A. The original brightness Y of the pixel is given by the following formula:

Y=0.257*rin+0.504*gin+0.98*bin           (1)Y=0.257*r in +0.504*g in +0.98*b in (1)

其中rin,gin,bin为该像素点原有颜色取值。Among them , r in , g in , and bin are the original color values of the pixel.

B.移色系数M为一个实效的、与亮度Y负相关的阶跃式非负(或非正)系数。B. The color shifting coefficient M is an effective step-type non-negative (or non-positive) coefficient that is negatively correlated with the brightness Y.

C.移色输出rout,gout,bout由下式给出;C. color shifting output r out , g out , b out are given by the following formula;

rout=abs(rin-(M1*rin))         (2)r out =abs(r in -(M 1 *r in )) (2)

gout=abs(gin-(M2*gin))         (3)g out =abs(g in -(M 2 *g in )) (3)

bout=abs(bin-(M3*bin))         (4)b out =abs(b in -(M 3 *b in )) (4)

式中abs函数为取绝对值操作。In the formula, the abs function is an absolute value operation.

实施例1:Example 1:

要实施本发明的手机动漫人物及背景创作方法,首先要设定项参数如下:To implement the mobile cartoon character and background creation method of the present invention, at first the item parameters will be set as follows:

1.纱帘密度即网格密度(gridSize):纱帘密度应<5。1. The density of the gauze curtain is the grid density (gridSize): the density of the gauze curtain should be <5.

2.雾气浓度(fog):雾气浓度应在1.0~2.0之间。2. Fog concentration (fog): The fog concentration should be between 1.0 and 2.0.

3色彩样板点(colorSamples):用户通过现场所见即所得地选择2个色彩样板点,程序就雾化了由区域扩展度确定的雾化区域,出现雾气朦胧的视觉效果。而且,根据2个色彩样板点的颜色制作珠帘的颜色,所以珠帘的颜色灵活多变。3 Color Samples (colorSamples): The user selects 2 color sample points through WYSIWYG on-site, and the program atomizes the atomized area determined by the area expansion degree, resulting in a hazy visual effect. Moreover, the color of the bead curtain is made according to the colors of the two color sample points, so the color of the bead curtain is flexible and changeable.

4.区域扩展度(areaExtanDegree):所选择的数值越大,经由颜色朦胧样板点扩展的移色区域越大。可选范围为1~100。4. AreaExtanDegree (areaExtanDegree): The larger the selected value, the larger the color shifting area extended through the color hazy template point. The optional range is 1 to 100.

不同背景与人物的朦胧画作品,参见图2。For hazy paintings with different backgrounds and characters, see Figure 2.

方法1:“非对角线元素消隐”方法,即先对预留存放输出图像的数据空间清零为白色,然后,将非对角线上的图像元素隐去,也即,仅将对角线上的图像元素留下。具体地,令行计数器和列计数器以gridSize【前面在设定参数时已经设定:纱帘密度(gridSize):纱帘密度应<5。】为步长“跳跃”地遍历全图,而当行计数器或列计数器跃进一步时,因为开始了另一格栅,辅助计数器则由0变到gridSize,从而仅将源图像对角线上的图像拷贝到目标图像上去。通过这种留下少数,隐去大部的算法达到轻纱薄雾、若隐若现的效果。图1为“非对角线元素消隐”算法的图解。Method 1: "Blank off-diagonal elements" method, that is, first clear the data space reserved for storing the output image to white, and then hide the image elements on the off-diagonal line, that is, only the Image elements on the corners are left. Specifically, order the row counter and the column counter to use gridSize [it has been set before when setting parameters: the screen density (gridSize): the screen density should be <5. 】Traversing the whole image by "jumping" for the step length, and when the row counter or column counter jumps one step, because another grid is started, the auxiliary counter changes from 0 to gridSize, so that only the image on the diagonal of the source image Copy it to the target image. Through this algorithm of leaving a few and hiding the majority, the effect of light gauze and mist is achieved. Figure 1 is a diagram of the "off-diagonal element blanking" algorithm.

步骤(1).对预留存放输出图像的数据空间清零为白色;Step (1). The data space reserved for storing the output image is cleared to white;

步骤(2).从图像的左上角开始,参数i为行计数器,参数j为列计数器,gridSize作为步长,参数k为辅助计数器,按步骤(3)~(4)遍历全图;Step (2). Starting from the upper left corner of the image, parameter i is a row counter, parameter j is a column counter, gridSize is a step size, and parameter k is an auxiliary counter, and traverse the entire image according to steps (3) to (4);

步骤(3).确定源(source)、目标(destination)两类像素点的位置(pixelSou和pixelDes):Step (3). Determine the position of the source (source), target (destination) two types of pixel points (pixelSou and pixelDes):

pixelSou=souBase+(i+k)*lineByte+(j+k)*pixelByte;pixelSou=souBase+(i+k)*lineByte+(j+k)*pixelByte;

pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;

其中souBase和desBasewe为源、终两类像素点的基地址,lineByte为图像每行字节数,pixelByte为图像每像素字节数,i和j为相应行与列,k变化范围为0~gridSize;Among them, souBase and desBasewe are the base addresses of the source and final pixel points, lineByte is the number of bytes per row of the image, pixelByte is the number of bytes per pixel of the image, i and j are the corresponding rows and columns, and k varies from 0 to gridSize ;

对预留存放输出图像的数据空间清零为白色;所以如果没有数据输出到这个像素点,它就是白的,因此就产生了消隐的效果。The data space reserved for storing the output image is cleared to white; so if no data is output to this pixel, it is white, thus producing a blanking effect.

可以这样理解,将整幅图网格化,将网格对角线处的像素保留,其他点的像素都设为白色。It can be understood that the entire image is gridded, the pixels at the diagonal of the grid are reserved, and the pixels at other points are set to white.

方法2:实现随机模糊。随机模糊化方法的基础也是“非对角线元素消隐”算法。其特点是行计数器和列计数器还是以gridSize为步长“跳跃”地遍历全图,但在影响源地址的辅助计数器中加入随机数。其中,Method 2: Implement random blurring. The basis of the stochastic fuzzing method is also the "off-diagonal element blanking" algorithm. Its characteristic is that the row counter and column counter still "jump" through the whole graph with the gridSize as the step size, but add random numbers to the auxiliary counters that affect the source address. in,

(1)构成源指针的行计数器和列计数器逐步跃进,辅助计数器有2个变量,一个是k(由0变到gridSize),另一个是随机数yrand或xrand【随机数的范围在0-gridsize之间随机】从而将指定位置的源图像拷贝到目标图像上去;(1) The row counter and column counter that constitute the source pointer step by step, the auxiliary counter has 2 variables, one is k (change from 0 to gridSize), and the other is random number yrand or xrand [the range of random number is 0-gridsize Random between] to copy the source image at the specified location to the target image;

(2)构成目标指针的行计数器和列计数器逐步跃进,辅助计数器只有1个变量k(由0变到gridSize)。(2) The row counter and column counter that constitute the target pointer leap forward step by step, and the auxiliary counter has only one variable k (changed from 0 to gridSize).

步骤(1).对预留存放输出图像的数据空间清零为白色;Step (1). The data space reserved for storing the output image is cleared to white;

步骤(2).从图像的左上角开始,参数i为行计数器,参数j为列计数器,参数k为辅助计数器,gridSize作为步长,按步骤(3)~(4)遍历全图;Step (2). Starting from the upper left corner of the image, parameter i is a row counter, parameter j is a column counter, parameter k is an auxiliary counter, gridSize is used as a step size, and traverse the entire image according to steps (3) to (4);

步骤(3).确定源(source)、终(destination)两类像素点(pixelSou和pixelDes)位置:Step (3). Determine the source (source) and final (destination) two types of pixel points (pixelSou and pixelDes) positions:

pixelSou=souBase+(i+k+yrand)*lineByte+(j+k+xrand)*pixelByte;pixelSou=souBase+(i+k+yrand)*lineByte+(j+k+xrand)*pixelByte;

pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;

其中souBase和desBasewe为源、终两类像素点的基地址,lineByte为图像每行字节数,pixelByte为图像每像素字节数,i和j为相应行与列,k变化范围为0~gridSize,yrand和xrand都是随机数;Among them, souBase and desBasewe are the base addresses of the source and final pixel points, lineByte is the number of bytes per row of the image, pixelByte is the number of bytes per pixel of the image, i and j are the corresponding rows and columns, and k varies from 0 to gridSize , both yrand and xrand are random numbers;

步骤(4).取出源像素点蓝、绿、红数据赋予对应输出像素点Step (4). Take out the blue, green, and red data of the source pixel and assign it to the corresponding output pixel

*(pixelDes)=*(pixelSou);*(pixelDes) = *(pixelSou);

*(pixelDes+1)=*(pixelSou+1);*(pixelDes+1)=*(pixelSou+1);

*(pixelDes+2)=*(pixelSou+2)。*(pixelDes+2)=*(pixelSou+2).

方法3:实现珠帘效果。珠帘效果模拟方法的基础也是“非对角线元素消隐”算法。行计数器和列计数器以gridSize为步长“跳跃”地遍历全图。其中,行计数器和列计数器跃进一步时,辅助计数器则由0变到gridSize,从而将源图像中的非对角线元素消隐。(参见图1)而且,因为是根据2个色彩样板点的颜色制作珠帘的颜色,所以具有很强的灵活性。Method 3: Realize the bead curtain effect. The basis of the bead curtain effect simulation method is also the "off-diagonal element blanking" algorithm. The row counter and column counter "jump" through the whole graph with gridSize as the step size. Wherein, when the row counter and the column counter take a step, the auxiliary counter changes from 0 to gridSize, thereby blanking off-diagonal elements in the source image. (see Fig. 1) and, because be to make the color of bead curtain according to the color of 2 color sample points, so have very strong flexibility.

步骤(1).对预留存放输出图像的数据空间清零为白色;Step (1). The data space reserved for storing the output image is cleared to white;

步骤(2).从图像的左上角开始,参数i为行计数器,参数j为列计数器,参数k为辅助计数器,gridSize作为步长,按步骤(2)~(4)遍历全图;Step (2). Starting from the upper left corner of the image, the parameter i is a row counter, the parameter j is a column counter, the parameter k is an auxiliary counter, gridSize is used as a step size, and traverse the whole image according to steps (2) to (4);

步骤(3).确定源(source)、目标(destination)两类像素点(pixelSou和pixelDes)位置:Step (3). Determine the source (source), target (destination) two types of pixel points (pixelSou and pixelDes) position:

pixelSou=souBase+(i+k)*lineByte+(j+k)*pixelByte;pixelSou=souBase+(i+k)*lineByte+(j+k)*pixelByte;

pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;

其中souBase和desBasewe为源、终两类像素点的基地址,lineByte为图像每行字节数,pixelByte为图像每像素字节数,i和j为相应行与列,k变化范围为0~gridSize;Among them, souBase and desBasewe are the base addresses of the source and final pixel points, lineByte is the number of bytes per row of the image, pixelByte is the number of bytes per pixel of the image, i and j are the corresponding rows and columns, and k varies from 0 to gridSize ;

步骤(4).取出源像素点蓝、绿、红数据赋予对应输出像素点Step (4). Take out the blue, green, and red data of the source pixel and assign it to the corresponding output pixel

*(pixelDes)=abs(*(pixelSou));*(pixelDes)=abs(*(pixelSou));

*(pixelDes+1)=abs(*(pixelSou+1));*(pixelDes+1)=abs(*(pixelSou+1));

*(pixelDes+2)=abs(*(pixelSou+2));*(pixelDes+2)=abs(*(pixelSou+2));

步骤(5).根据2个色彩样板点的位置,从图像中分别查找出它们的像素数据color1,color2;Step (5). According to the positions of the two color template points, their pixel data color1 and color2 are respectively found from the image;

步骤(6).以color1或color2两种颜色以适当的行距、列距【例如在图2i和2j中的行距两色交替地各为20,列距为40。】调用MakeColorPearl模板形成彩色的珍珠。该模板的参数为:列号j,行号i,图像每行字节数lineByte,图像每像素字节数pixelByte,珍珠直径r,珍珠颜色color(分别用color1或color2);【MakeColorPearl模板,即形成彩色珠帘模板,为现有成熟技术,】Step (6). Use two colors of color1 or color2 with appropriate row spacing and column spacing [for example, the row spacing in Figures 2i and 2j is 20 for each of the two colors alternately, and the column spacing is 40. 】Call the MakeColorPearl template to form colored pearls. The parameters of the template are: column number j, line number i, lineByte of each line of the image, pixelByte of each pixel of the image, pearl diameter r, pearl color (color1 or color2 respectively); [MakeColorPearl template, namely Forming a color bead curtain template is an existing mature technology,]

方法4:图像移色方法,包括以下步骤:Method 4: Image color shifting method, comprising the following steps:

步骤(1).根据2个色彩样板点的位置,从图像中分别查找出它们的像素数据(蓝、绿、红数值),分别记作b1,g1,r1,和b2,g2,r2,用在步骤(5)和步骤(6)中。Step (1). According to the positions of the two color sample points, find out their pixel data (blue, green, red values) respectively from the image, which are respectively recorded as b1, g1, r1, and b2, g2, r2, and use In step (5) and step (6).

步骤(2).处理点X,Y初始座标设为图像左上角,即X,Y均设为0;Step (2). The initial coordinates of the processing point X and Y are set to the upper left corner of the image, that is, both X and Y are set to 0;

步骤(3).通过以下步骤(4)~(9)逐列、逐行地推进:Step (3). Advance column by column and row by row through the following steps (4) to (9):

步骤(4).取得某一处理点的蓝、绿、红数值,分别记作sb,sg,sr;Step (4). Obtain the blue, green and red values of a certain processing point, denoted as sb, sg, sr respectively;

步骤(5).如abs(sb-b 1)<areaExtanDegree且abs(sg-g1)<areaExtanDegree且abs(sr-r1)<areaExtanDegree则记b1为b,记g1为g,记r1为r,转步骤(7)进行图像移色操作。反之,如判别条件不满足则转步骤(8)保留原色;Step (5). If abs(sb-b 1)<areaExtanDegree and abs(sg-g1)<areaExtanDegree and abs(sr-r1)<areaExtanDegree, record b1 as b, record g1 as g, record r1 as r, and turn to Step (7) performs image color shifting operation. On the contrary, if the discrimination condition is not satisfied, then go to step (8) to retain the original color;

步骤(6).如abs(sb-b2)<areaExtanDegree且abs(sg-g2)<areaExtanDegree且abs(sr-r2)<areaExtanDegree则记b2为b,记g2为g,记r2为r,转步骤(7)进行图像移色操作。反之,如判别条件不满足则转步骤(8)保留原色;Step (6). If abs(sb-b2)<areaExtanDegree and abs(sg-g2)<areaExtanDegree and abs(sr-r2)<areaExtanDegree, record b2 as b, record g2 as g, record r2 as r, and go to step (7) Carry out image color shifting operation. On the contrary, if the discrimination condition is not satisfied, then go to step (8) to retain the original color;

步骤(7).按公式(1),(2),(3)将色彩的RGB制式变换成YCrCb制式Step (7). According to formula (1), (2), (3) the RGB system of color is transformed into YCrCb system

Y=(257*r+504*g+98*b)/1000+16    (5)Y=(257*r+504*g+98*b)/1000+16 (5)

Cr=(439*r-368*g-71*b)/1000+128  (6)Cr=(439*r-368*g-71*b)/1000+128 (6)

Cb=(-148*r-291*g+439*b)/1000+128(7)Cb=(-148*r-291*g+439*b)/1000+128(7)

根据雾气浓度参数修正Y值:Correct the Y value according to the fog concentration parameter:

Y=Y*fog                         (8)Y=Y*fog (8)

按公式(5),(6),(7)将YCrCb制式反变换为RGB制式According to the formula (5), (6), (7) inversely convert the YCrCb system to the RGB system

fogB=(1.164*(Y-16)+2.017*(Cb-128))                 (9)fogB=(1.164*(Y-16)+2.017*(Cb-128)) (9)

fogG=(1.164*(Y-16)-0.813*(Cr-128)-0.392*(Cb-128))  (10)fogG=(1.164*(Y-16)-0.813*(Cr-128)-0.392*(Cb-128)) (10)

fogR=(1.164*(Y-16)+1.596*(Cr-128))                 (11)fogR=(1.164*(Y-16)+1.596*(Cr-128)) (11)

对当前像素值予以黯黄化移色并输出Dim and yellow the current pixel value and output

*(pixelDes)=sb-(fogB*fog/10);*(pixelDes)=sb-(fogB*fog/10);

*(pixelDes+1)=sg-(fogG*fog/10);*(pixelDes+1)=sg-(fogG*fog/10);

*(pixelDes+2)=sr-(fogR*fog/10);*(pixelDes+2)=sr-(fogR*fog/10);

转步骤(9);Go to step (9);

步骤(8).将处理点的图像数据“原封不动”地输出:Step (8). Output the image data of the processing point "as it is":

*(pixelDes)=sb;*(pixelDes) = sb;

*(pixelDes+1)=sg;*(pixelDes+1)=sg;

*(pixelDes+2)=s r;*(pixelDes+2)=s r;

步骤(9).处理点X座标+1,如未到图像右边界则转步骤(4);否则转步骤(10);Step (9). The X coordinate of the processing point is +1, if the right boundary of the image is not reached, then go to step (4); otherwise go to step (10);

步骤(10).处理点X座标设为0,处理点Y座标+1,如处理点未到图像右下边界则转步骤(4);否则程序结束;Step (10). The X coordinate of the processing point is set to 0, and the Y coordinate of the processing point is +1. If the processing point does not reach the lower right boundary of the image, then go to step (4); otherwise, the program ends;

算法5.单色化和钝化方法:相继调用灰度化操作和图像钝化操作。灰度化操作,处理后各像点的灰度值I=0.3B+0.59G+0.11R,其中B、G、R为该像素点原先的蓝、绿、红分量值。Algorithm 5. Monochrome and passivation method: call grayscale operation and image passivation operation successively. Grayscale operation, the grayscale value of each pixel after processing is I=0.3B+0.59G+0.11R, where B, G, and R are the original blue, green, and red component values of the pixel.

钝化方法说明如下:Passivation methods are described below:

标准一维中值滤波的定义为:The standard one-dimensional median filter is defined as:

yk=med{xk-n,xk-n+1,...,xk,...,xk+n-1,xk+n}y k =med{x kn ,x k-n+1 ,...,x k ,...,x k+n-1 ,x k+n }

式中,med表示取中值操作。由此可见,中值滤波是将滑动窗口的各像素的灰度(即上式中的xk-n,xk-n+1,...,xk,...,xk+n-1,xk+n)从上而下排序,选中间取值作为该像素的代表。当滑动窗口较大而使滑动窗口内像素很多(设为m)时,要进行排序操作很消耗计算能力(需要做m(m-2)/2次比较操作。为此采用了快速排序算法实现钝化操作,减小计算量约0.47倍。简述其思路如下:为便于描述,称3×3窗口内各行像素为:第0行p.0,p1,p2,第1行p.3,p.4,p5,第2行p6,p.7,p.8。首先对窗口内每一列像素计算得到最大值组、中值组、最小值组:In the formula, med means to take the median value operation. It can be seen that the median filter is to convert the grayscale of each pixel of the sliding window (that is, x kn , x k-n+1 , ..., x k , ..., x k+n-1 in the above formula , x k+n ) are sorted from top to bottom, and the middle value is selected as the representative of the pixel. When the sliding window is large and there are many pixels in the sliding window (set to m), it is very computationally expensive to perform a sorting operation (need to do m(m-2)/2 comparison operations. A quick sorting algorithm is used for this purpose. The passivation operation reduces the calculation amount by about 0.47 times. The idea is briefly described as follows: for the convenience of description, the pixels in each row in the 3×3 window are called: row 0 p .0 , p 1 , p 2 , row 1 p . 3 , p .4 , p 5 , the second line p 6 , p .7 , p .8 . First, calculate the maximum value group, median value group, and minimum value group for each column of pixels in the window:

最大值组:Max0=max[p0,p.3,p6],Max1=max[p1,p4,p7],Max2=max[p2,p5,p8];相仿地有中值组Med0,Med1,Med2,和最小值组Min0,Min1,Min2。进一步求出:MaxMin=min[Max0,Max1,Max2],相仿地求出MedMed,MinMax;进一步求出:MED=med[MaxMin,MedMed,MinMax]即为真正的中值。Maximum group: Max 0 = max[p 0 , p .3 , p 6 ], Max 1 = max[p 1 , p 4 , p 7 ], Max 2 = max[p 2 , p 5 , p 8 ]; Similarly there are median groups Med 0 , Med 1 , Med 2 , and minimum groups Min 0 , Min 1 , Min 2 . Further obtain: MaxMin=min[Max 0 , Max 1 , Max 2 ], similarly obtain MedMed, MinMax; further obtain: MED=med[MaxMin, MedMed, MinMax] is the real median value.

Claims (1)

1. cartoon character on mobile phone and a background creative method, is characterized in that, adopts any method in front 4 kinds of methods and method 5 to source images hybrid processing:
Method 1: off diagonal element blanking method:
Method 2: Random-fuzzy method;
Method 3: pearl-decorated curtain effect simulation method;
Method 4: image moves color method;
Method 5: monochromatization and passivating method;
The step of described off diagonal element blanking method is:
By original image gridding, the pixel at the diagonal line place of each grid retains color, and the pixel zero clearing of other positions is white, replaces by white pixel;
Mesh-density gridSize corresponding to gridding is for being less than 5 pixels; Described mesh-density is the length of side of square net;
Random-fuzzy method step in method 2 is:
Step (1). be that the data space zero clearing of target image is white by the reserved output image of depositing;
Step (2). from the upper left corner of original image, parameter i is linage-counter, and parameter j is column counter, parameter i and parameter j are all using gridSize as incremental steps, parameter k is auxiliary counter, and k is incremented to gridSize from 0, reaches zero clearing again after gridSize; By step (3)~(4) traversal full figure, complete the process of Random-fuzzy;
Step (3). in the grid at each taking gridSize as the length of side, determine that by the following method source, whole two class pixels are pixelSou and pixelDes position:
pixelSou=souBase+(i+k+yrand)*lineByte+(j+k+xrand)*pixelByte;
pixelDes=desBase+(i+k)*lineByte+(j+k)*pixelByte;
Wherein souBase and desBase are respectively the base address of source, whole two class pixels, lineByte is the every row byte number of image, pixelByte is the every pixel words joint number of image, i and j are the ordinal number of corresponding line and row, yrand and xrand are random numbers, and random number is random value between 0-gridsize;
Step (4). taking-up source pixel is filled enamel, green, red data are given corresponding output pixel point
*(pixelDes)=*(pixelSou);
*(pixelDes+1)=*(pixelSou+1);
*(pixelDes+2)=*(pixelSou+2);
Pearl-decorated curtain effect simulation method is:
Step 1: make pearl-decorated curtain template: set pearl-decorated curtain parameter and make pelletron template, described pearl-decorated curtain parameter comprises pelletron row distance, pearl body line-spacing, pearl body diameter, pearl body connecting line diameter;
Step 2: described pearl-decorated curtain template is superimposed upon on the image that method 1 or method 2 form and obtains the final new images with pearl-decorated curtain effect as covering plate;
The step that image moves color method is:
Step (1). choose 2 color typical applications, according to the position of 2 color typical applications, from image, find out respectively their corresponding indigo plant, green, the red numerical value of pixel, be denoted as respectively b1, g1, r1, and b2, g2, r2;
Step (2). process points x, y initial coordinate is made as the image upper left corner, i.e. x, y is all made as 0;
Step (3). be according to pixels that process points advances by column, line by line by following steps (4)~(9):
Step (4). obtain the indigo plant of current process points, green, red numerical value, be denoted as respectively sb, sg, sr;
Step (5). as abs (sb-b1) <areaExtanDegree and abs (sg-g1) <areaExtanDegree and abs (sr-r1) <areaExtanDegree remember that b1 is b, note g1 is g, note r1 is r, goes to step (7) and carries out image and move look operation; Wherein, areaExtanDegree is area extension degree; Otherwise, go to step (8) reservation primary colors as criterion does not meet; In formula, abs function is the operation that takes absolute value;
Step (6). as abs (sb-b2) <areaExtanDegree and abs (sg-g2) <areaExtanDegree and abs (sr-r2) <areaExtanDegree remember that b2 is b, note g2 is g, note r2 is r, goes to step (7) and carries out image and move look operation; Otherwise, go to step (8) reservation primary colors as criterion does not meet;
Step (7). as follows the RGB standard transformation of color is become to YCrCb standard
Y=(257*r+504*g+98*b)/1000+16;
Cr=(439*r-368*g-71*b)/1000+128;
Cb=(-148*r-291*g+439*b)/1000+128;
According to fog concentration parameter correction Y value:
Y=Y*fog; Wherein, fog is fog concentration, and value is between 1.0~2.0;
By following formula, the contravariant of YCrCb standard is changed to RGB standard:
fogB=(1.164*(Y-16)+2.017*(Cb-128));
fogG=(1.164*(Y-16)-0.813*(Cr-128)-0.392*(Cb-128));
fogR=(1.164*(Y-16)+1.596*(Cr-128));
Current pixel value is given to dim yellow and move look output
*(pixelDes)=sb–(fogB*fog/10);
*(pixelDes+1)=sg–(fogG*fog/10);
*(pixelDes+2)=sr–(fogR*fog/10);
Go to step (9);
Step (8). the view data of process points is kept to former data output:
*(pixelDes)=sb;
*(pixelDes+1)=sg;
*(pixelDes+2)=sr;
Step (9). process points x coordinate+1, as do not gone to step (4) to image right margin; Otherwise go to step (10);
Step (10). process points x coordinate is made as 0, and process points y coordinate+1, as process points does not go to step (4) to border, image bottom right; Otherwise EOP (end of program);
Described monochromatization and passivating method are:
First original image is carried out to monochromatization operation, each pixel of image is carried out to following 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; Obtain the image after monochromatization;
Again the image after monochromatization is carried out to passivation operation; Passivation operation as follows, for the filter window of a N*N, to each column element maximizing, intermediate value and the minimum value of this filter window; Obtain intermediate value MedMed in minimum M axMin, all intermediate values in all maximal values and the maximal value MinMax in all minimum value, the intermediate value finally obtaining is MED=med[MaxMin, MedMed, MinMax again].
CN201110424554.0A 2011-12-16 2011-12-16 Mobile phone anime character and background creation method Expired - Fee Related CN102521867B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110424554.0A CN102521867B (en) 2011-12-16 2011-12-16 Mobile phone anime character and background creation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110424554.0A CN102521867B (en) 2011-12-16 2011-12-16 Mobile phone anime character and background creation method

Publications (2)

Publication Number Publication Date
CN102521867A CN102521867A (en) 2012-06-27
CN102521867B true CN102521867B (en) 2014-09-17

Family

ID=46292769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110424554.0A Expired - Fee Related CN102521867B (en) 2011-12-16 2011-12-16 Mobile phone anime character and background creation method

Country Status (1)

Country Link
CN (1) CN102521867B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819857B (en) * 2012-07-26 2014-09-24 拓维信息系统股份有限公司 Method for creating cartoon character face in mobile phone based on whitening and skin tendering
HUE046808T2 (en) 2013-02-23 2020-03-30 Qualcomm Inc Systems and methods for interactive image caricaturing by an electronic device
CN103593834B (en) * 2013-12-03 2017-06-13 厦门美图网科技有限公司 A kind of image enchancing method of the intelligence addition depth of field
CN108010108A (en) * 2017-12-02 2018-05-08 天津大行道动漫文化发展有限公司 A kind of cartoon figure's background moves inspection and processing method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1511306A (en) * 2001-05-21 2004-07-07 ���ιɷ����޹�˾ Image processing device and game device
CN1705371A (en) * 2004-06-02 2005-12-07 罗伯特·博世有限公司 On-screen display and privacy masking apparatus and method
CN101536078A (en) * 2006-09-25 2009-09-16 奥多比公司 Improving image masks
CN102034256A (en) * 2010-11-15 2011-04-27 拓维信息系统股份有限公司 Mobile phone cartoon character creating method based on boundary tracking and pseudo-coloring

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080158224A1 (en) * 2006-12-28 2008-07-03 National Tsing Hua University Method for generating an animatable three-dimensional character with a skin surface and an internal skeleton

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1511306A (en) * 2001-05-21 2004-07-07 ���ιɷ����޹�˾ Image processing device and game device
CN1705371A (en) * 2004-06-02 2005-12-07 罗伯特·博世有限公司 On-screen display and privacy masking apparatus and method
CN101536078A (en) * 2006-09-25 2009-09-16 奥多比公司 Improving image masks
CN102034256A (en) * 2010-11-15 2011-04-27 拓维信息系统股份有限公司 Mobile phone cartoon character creating method based on boundary tracking and pseudo-coloring

Also Published As

Publication number Publication date
CN102521867A (en) 2012-06-27

Similar Documents

Publication Publication Date Title
CN105719327B (en) A kind of artistic style image processing method
CN108352083B (en) 2D image processing for stretching into 3D objects
US20130127890A1 (en) Polygon Processing Techniques in Procedural Painting Algorithms
CN105138317B (en) Window display processing method and device for terminal device
CN102496180B (en) Method for automatically generating wash landscape painting image
CN103218846B (en) The ink and wash analogy method of Three-dimension Tree model
US8676552B2 (en) Methods and apparatus for simulation of fluid motion using procedural shape growth
US10685472B1 (en) Animation brushes
CN102521867B (en) Mobile phone anime character and background creation method
Chan et al. Two methods for creating Chinese painting
CN110115841B (en) Rendering method and device for vegetation object in game scene
Yang et al. Realization of Seurat’s pointillism via non-photorealistic rendering
CN112995534B (en) Video generation method, device, equipment and readable storage medium
Ryffel et al. AR Museum: A mobile augmented reality application for interactive painting recoloring
AU2018226403B2 (en) Brush stroke generation with deep neural networks
CN102034256B (en) Mobile phone cartoon character creating method based on boundary tracking and pseudo-coloring
CN113838155A (en) Method and device for generating material map and electronic equipment
Ye [Retracted] Application of Photoshop Graphics and Image Processing in the Field of Animation
Barile et al. Animated drawings rendered by genetic programming
Xia Research on Rendering Technology of Ink Painting based on NPR
Peng Bilateral Filtering Based Image Cartoon Stylization Design
CN108162673A (en) A kind of ink and wash industrial production system and its method
CN109816755A (en) A kind of production method of ink image, calculates equipment and storage medium at device
Shapoval et al. Computer graphics and photography in terms of design
Strickland Chinese Painting in 3D: An Artistic Study of the Use of the Traditional Chinese Painting Aesthetic in Three-Dimensional Computer Graphics

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

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