WO2018201662A1 - Lip color rendering method, apparatus, and electronic device - Google Patents

Lip color rendering method, apparatus, and electronic device Download PDF

Info

Publication number
WO2018201662A1
WO2018201662A1 PCT/CN2017/104367 CN2017104367W WO2018201662A1 WO 2018201662 A1 WO2018201662 A1 WO 2018201662A1 CN 2017104367 W CN2017104367 W CN 2017104367W WO 2018201662 A1 WO2018201662 A1 WO 2018201662A1
Authority
WO
WIPO (PCT)
Prior art keywords
lip
layer
rendering
color
image
Prior art date
Application number
PCT/CN2017/104367
Other languages
French (fr)
Chinese (zh)
Inventor
张硕
Original Assignee
广州视源电子科技股份有限公司
广州睿鑫电子科技有限公司
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 广州视源电子科技股份有限公司, 广州睿鑫电子科技有限公司 filed Critical 广州视源电子科技股份有限公司
Publication of WO2018201662A1 publication Critical patent/WO2018201662A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • G06V40/165Detection; Localisation; Normalisation using facial parts and geometric relationships
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0641Shopping interfaces
    • G06Q30/0643Graphical representation of items or shoppers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Definitions

  • the present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, and an electronic device for rendering colors of a lip.
  • the color number of the lipstick is an important part of the purchase of lipstick.
  • the color is selected by color test.
  • the commonly used color test method is to apply lipstick on the hand or the lips.
  • the method of coloring on the hand is simple, but it cannot accurately determine the effect of lipstick on the lips; the way of applying it on the lips is related to hygiene, etc., which is usually used by the shopping guide to paint the customer.
  • the whole process is cumbersome and requires one-on-one service. Either way, you need lipstick to test, so you usually need to go to the physical counter for color test, and you need to remove the lipstick after the test. It can be seen that the traditional color test method is inconvenient.
  • the color replacement of the lips of the image makes the lip look like a flat color, which does not show the state when the person actually applies the lipstick, and the color test effect is not good.
  • the present application provides a method, device, and electronic device for rendering colors of a lip.
  • a method of rendering a color of a lip comprising the following steps:
  • the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  • the step of superimposing the brightened mixed layer and the colored lip layer according to a preset algorithm to obtain an effect map after the lip renders the color includes:
  • the step of coloring the lip rendering area according to the color number information to generate a colored lip layer comprises:
  • the pixel value of each pixel of the lip rendering area is multiplied by the pixel value in the color number information to obtain a colored lip layer.
  • the step of identifying the image to determine the lip rendering area comprises:
  • the lip contour area is white, and the lip outline area is black, and the lip contour area is blurred to generate a lip rendering area.
  • the step of triangulating the lip feature points to obtain the lip contour region comprises:
  • the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour area.
  • the application also discloses a device for rendering a color of a lip, comprising:
  • a region module for identifying an image to determine a lip rendering area
  • a rendering module configured to generate a colored lip layer by coloring the lip rendering area according to the color number information
  • Extract the initial lip layer corresponding to the lip rendering area from the image adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend.
  • the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  • the rendering module includes:
  • a color picking unit configured to obtain shallow pixel position information that the pixel value of the colored lip layer is less than a preset threshold, and to change a pixel value corresponding to the shallow pixel position in the mixed layer as the first pixel;
  • a color mixing unit configured to superimpose a pixel value greater than or equal to a preset threshold in the coloring layer and a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
  • a rendering unit configured to render the first pixel and the second pixel onto the image to obtain an effect diagram.
  • the rendering module is further configured to multiply a pixel value of each pixel of the lip rendering area by a pixel value in the color number information to obtain a colored lip layer.
  • the area module includes:
  • a point taking unit for performing face detection on the image to recognize the face image, and extracting the lip feature point from the face image
  • the blur unit is configured to white the lip contour area and black outside the lip contour area, and blur the lip contour area to generate a lip rendering area;
  • the area unit is further configured to determine whether the lips are in an open state according to a distribution state of the inner circle points in the feature points of the lips;
  • the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour area.
  • the application also discloses an electronic device, including:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • To the high-gloss lip layer brighten the highlight lip layer and the layer where the image is located to obtain a brightened mixed layer;
  • the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  • the invention performs color rendering on the lip region in the image according to the color number signal, adjusts the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brightens and blends the highlight layer with the layer where the image is located to obtain a change.
  • the brightened mixed layer and the colored lip layer are superimposed and mixed to obtain the effect diagram of the lip rendered color, and the generated effect diagram is not only It can reveal the texture in the lips, and it can also simulate the luster that people have after applying lipstick in real scenes. You can experience the true color test without applying lipstick.
  • FIG. 1 is a flow chart showing a method for rendering a color of a lip according to an exemplary embodiment of the present application
  • FIG. 2 is a detailed flowchart of identifying an image of a lip rendering area according to an exemplary embodiment of the present application
  • FIG. 3 is a schematic diagram of extracting feature points from a face image
  • Figure 4a is a schematic view of the triangulation of feature points when the lips are in an open state
  • Figure 4b is a schematic view of the triangulation of feature points when the lips are in a closed state
  • Figure 4c is an effect diagram of the lip rendering area of the present application.
  • Figure 4d is an effect diagram of the colored lip layer generated by the present application.
  • FIG. 5 is a detailed flowchart showing superimposing and mixing a brightened mixed layer and a colored lip layer according to an exemplary embodiment of the present application
  • FIG. 6 is a flow chart showing a refinement of a lip contour region by triangulating a lip feature point according to an exemplary embodiment of the present application
  • FIG. 7 is a logic block diagram of an apparatus for rendering a color of a lip according to an exemplary embodiment of the present application.
  • FIG. 8 is a detailed logic block diagram of a rendering module according to an exemplary embodiment of the present application.
  • FIG. 9 is a detailed logic block diagram of a region module shown in an exemplary embodiment of the present application.
  • FIG. 10 is a diagram showing an effect of an electronic device according to an exemplary embodiment of the present application.
  • first, second, third, etc. may be used to describe various information in this application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information without departing from the scope of the present application.
  • second information may also be referred to as the first information.
  • word "if” as used herein may be interpreted as "when” or “when” or “in response to a determination.”
  • FIG. 1 is a flow chart of a method for rendering a color of a lip according to an exemplary embodiment of the present application; as shown in FIG. 1, the method may include steps S110 to S140:
  • Step S110 Identifying an image to determine a lip rendering area
  • the image When the image is received, the image may be subjected to face detection to determine whether there is a face in the image and the face position is located, and then the lip is recognized from the face, and the area where the lips are located is used as the lip rendering area;
  • the neural network, the color recognition, the region segmentation, the key point detection and the like are used to identify the face and lips from the image.
  • the manner of determining the lip rendering area provided by an embodiment of the present application is as shown in FIG. 2, and the image is identified.
  • the steps to determine the lip rendering area include:
  • Step S211 performing face detection on the image to identify the face image, and extracting the lip feature point from the face image;
  • Step S212 Triangulating the lip feature points to obtain a lip contour area
  • step S213 the lip contour area is white and the lip contour area is black, and the lip contour area is blurred to generate a lip rendering area.
  • the feature points corresponding to the human face are as shown in FIG. 3. Since the present application only performs rendering processing on the lip portion, only the feature points in the frame 302 corresponding to the human face lip 301 can be extracted, and the number of the feature points can be any number of , the application of the feature The number of points is not limited. For convenience of description, 20 feature points are taken as an example. As shown in FIG. 4a, there are 12 outer ring points and eight inner circle points, and outer ring points can be sequentially connected to form a large polygon.
  • the inner circle points are sequentially connected to form a small polygon, and the two polygons are nested, and the polygon circle between the large polygon and the small polygon is the lip contour region; for the convenience of program description, the feature points of the outer circle point and/or the inner circle point of the embodiment are composed.
  • the triangle represents the lip contour area.
  • the edge of the lip contour area drawn by the feature point line is sharp, there is no real lip shape smoothness, and the color of the lip (lipstick) and the skin is a gradual transition at the junction, in order to be able to More closely related to the shape and color effect of the real lips, an embodiment of the present application smoothes and/or blurs the edge of the lip contour region, and the lip contour region is white and the lip contour region is black, and the lip contour region is performed. Blurring processing generates a lip rendering area as shown in Figure 4c.
  • the fuzzy processing for example, a Gaussian operator, a Laplacian Gaussian operator, etc., taking a Gaussian operator as an example in the embodiment of the present application, and a total of 9 pixels of the A pixel and each of the left and right pixels.
  • the Gaussian operator weighting operation horizontal operation
  • the Gaussian operator weighting operation vertical operation
  • the Gaussian operator weighting operation is performed on the RGB values of the nine pixels, and the RGB values of the A pixels are obtained.
  • the pixels at the edge of the lip contour area are used as A pixels.
  • the GPU Graphics Processing Unit
  • the GPU performs the above operations at the same time, and the processing speed is fast.
  • the above operation can be repeated (one horizontal operation + one time)
  • the vertical operation is one operation).
  • the lip rendering area transitions from the middle to the edge with a gradient color.
  • the lip rendering area is colored, the effect of the real lipstick can be more naturally applied, so that the initial lip layer extracted from the image of the lip rendering area can be closer to the real one. Lips.
  • Step S120 Coloring the lip rendering area according to the color number information to generate a colored lip layer
  • the color number information includes the name of the color, the corresponding RGB value, etc.
  • the color number information may be generated according to the user's instruction, or may be automatically generated by the system according to historical data, user skin color, etc., of course, different manufacturers have the same name color.
  • the RGB values used for lipsticks may also be different.
  • the name of the color may include information such as brand and color number to facilitate user use.
  • the name of the center color corresponds to the RGB value to color the lip rendering area according to the RGB value to generate a colored lip layer, as shown in Figure 4d.
  • There are a plurality of ways of coloring the lip rendering area which may be processed one by one pixel or may be processed by the area. In order to improve the speed of coloring, the lip rendering area is colored according to the color number information according to an embodiment of the present application.
  • the steps to color the lip layer include:
  • the pixel value of each pixel of the lip rendering area is multiplied by the pixel value in the color number information to obtain a colored lip layer.
  • the coral color to color the lip rendering area that is, mix the RGB value of the coral color with the RGB value of the lip rendering area.
  • the black RGB values are 0, 0, 0, respectively, and the white RGB values are 255, 255, respectively.
  • the RGB values of the coral color are 255, 127, and 80 respectively.
  • black RGB values are 0, 0, 0, white RGB values are 1, 1, 1, and coral RGB values are 1, 0.498, 0.314, respectively.
  • the RGB values after the coral color on the white are 1, 0.498, and 0.314, respectively, and the RGB value after the coral color on the black is 0. 0, 0, the overall rendering of the area can greatly improve the coloring speed.
  • Step S130 extract an initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation to obtain a highlight lip layer after graying the initial lip layer, and brighten and mix the highlight lip layer with the image layer. Brighten the mixed layer;
  • the human lips have a reflection (reflection) on the light.
  • a lipstick, lip oil, etc. is applied to the lips to form a glaze, the reflection (highlight) is more obvious.
  • Only the color of the lip rendering area in the image cannot reach the highlight.
  • the present application proposes a scheme for adding highlights to the lips.
  • an automatic matching highlight or the like may be adopted.
  • an embodiment of the present application generates highlights by enhancing the original reflective effect of the lips; The initial lip layer corresponding to the lip rendering area is extracted, and the initial lip layer is grayed out and the color gradation is adjusted to obtain a highlight lip layer.
  • the gradation can be performed according to the R value, the G value, or the B value, or the RGB whole can be grayed out according to a certain ratio. This application does not limit this, and the gradation (including gamma correction) is adjusted after the gradation. Enhance the contrast between light and dark, for example, map the RGB values of the grayscale pixels to the interval of 50-150, and then restore to 0-255, so that the pixels with the original RGB values in the range of 0-50 eventually become 0, the original RGB Value is at 150- The pixels in the range of 255 eventually become 255, and the pixels with RGB values of 50-150 also enhance the contrast between light and dark, making dark pixels darker and brighter pixels brighter, thus forming a highlight effect.
  • Step S140 superimposing and blending the brightened mixed layer and the colored lip layer according to a preset algorithm to obtain an effect diagram after the lip renders the color.
  • a represents the RGB value of the pixel in the colored lip layer and b represents the RGB value of the pixel in the brightened mixed layer.
  • the other regions are black, and the black RGB values are 0, 0, and 0, respectively, and the white RGB values are 255, 255, and 255, respectively (using the formula ( 1)
  • the calculation is performed by converting the RGB value into a number between 0-1, and the R value, the G value, and the B value are calculated independently.
  • superimposing and mixing using the formula (1) will make the pixels in the image outside the lip area.
  • the value is also changed.
  • the step of superimposing the brightened mixed layer and the colored lip layer according to a preset algorithm according to a preset algorithm to obtain a rendering result after the lip is rendered include:
  • Step S541 acquiring shallow pixel position information whose pixel value of the colored lip layer is smaller than a preset threshold, and changing a pixel value corresponding to the shallow pixel position in the mixed layer as the first pixel;
  • Step S542 superimposing the pixel values in the coloring layer that are greater than or equal to the preset threshold and the corresponding pixel values in the highlight lip layer according to a preset algorithm to obtain a second pixel;
  • Step S543 Rendering the first pixel and the second pixel onto the image to obtain an effect map.
  • steps S541 and S542 can be understood as a preset algorithm as shown in the formula (2).
  • a represents the RGB value of the pixel in the colored lip layer and b represents the RGB value of the pixel in the brightened mixed layer.
  • the default value in the formula (2) is a preset threshold value that is compared with the pixel value of the colored lip layer.
  • the preset threshold value can be arbitrarily set, for example, 0.5 or 0.8, which is not limited in this application.
  • Other types of mixing formulas can also be used in equation (2). Since the black RGB values are 0, 0, and 0, respectively, it is obvious that the black area except the lip portion in Fig. 4d will display the area in the brightened mixed layer. Of course, other areas other than the lip portion may be used in other ways.
  • the lip part is calculated according to formula (2), in which part of the pixel value is the pixel value of the corresponding position in the brightened mixed layer, and part of the pixel value is the pixel in the colored lip layer and the brightened mixed layer.
  • the step of triangulating the lip feature points to obtain the lip contour region includes :
  • Step S611 determining whether the lips are in an open state according to the distribution state of the inner circle points in the feature points of the lips;
  • Step S612 when the lips are not in the open state, triangulating the outer circle points in the lip feature points to obtain a lip contour region;
  • Step S613 When the lips are in the open state, triangulation is performed in a combination of the outer circle points and the inner circle points to obtain a lip contour region.
  • each feature point of the circle determines whether the lip is in an open state, and when the lip is in an open state or a closed state, the variation of the feature point spacing of the inner ring is more obvious, as shown in FIG. 4a and FIG. 4b, according to the feature point 414.
  • the distribution states of 415, 416, 418, 419, and 420 determine whether the lips are in an open state, for example, calculating a first average of the ordinates of the feature points 414, 415, and 416, and the ordinates of the feature points 418, 419, and 420 a second average value, comparing whether the difference between the first average value and the second average value is less than a preset threshold (for example, 2 pixels, 5 pixels, etc.); of course, feature points 414 and 420, 415 and 419 may also be calculated separately, Whether the difference between the 416 and the 418 ordinate is less than a preset threshold, and greater than the preset threshold can determine that the lips are in an open state (as shown in FIG.
  • the lips can be judged to be in a closed state (as shown in FIG. 4b). Shown). Further, different triangulation treatments may be adopted for the lips to be in an open state or a closed state. As shown in FIG. 4a, when the lips are in an open state, the outer circle points and the inner circle points are combined to obtain a lip contour.
  • the region for example, consists of a triangle with feature points 401, 402, 413, and then the next triangle with 402, 413, 414, which in turn loops to all feature points, the triangles form a closed region and do not overlap, resulting in a lip contour region.
  • the triangles in which the partial regions overlap may occur due to the interlaced position of the inner circle points, and the overlapping of the lip contour regions by the triangle region will result in overlapping portions. Repeat the coloring and darken the color.
  • the outer circle points in the lip feature points are triangulated to obtain the lip contour regions, for example, the feature points 401, 402, 412 form a triangle, and then The next triangle is composed of 402, 412, and 403, and sequentially loops to all the outer circle points, and the triangles form a closed area and do not overlap to obtain a lip contour area. Therefore, by the above-described discrimination processing of the closed state of the lips, not only the efficiency of acquiring the lip contour region but also the coloring effect can be ensured.
  • the present application also provides an embodiment of a device for rendering a color of a lip.
  • FIG. 7 is a logic block diagram of an apparatus 700 for rendering colors of a lip according to an exemplary embodiment of the present application.
  • the device 700 for rendering colors of a lip may include a region module 710 and a rendering module. 720:
  • the area module 710 is configured to identify an image to determine a lip rendering area
  • a rendering module 720 configured to generate a colored lip layer by coloring the lip rendering area according to the color number information
  • Extract the initial lip layer corresponding to the lip rendering area from the image adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend.
  • the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  • the rendering module 720 includes:
  • the color picking unit 721 is configured to obtain shallow pixel position information that the pixel value of the colored lip layer is smaller than a preset threshold, and the pixel value corresponding to the shallow pixel position in the brightened mixed layer is used as the first pixel;
  • a color mixing unit 722 configured to superimpose a pixel value greater than or equal to a preset threshold in the colored layer with a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
  • the rendering unit 723 is configured to render the first pixel and the second pixel onto the image to obtain an effect map.
  • the rendering module 720 is further configured to multiply pixel values of each pixel of the lip rendering area by pixel values in the color number information to obtain a colored lip layer.
  • the area module 710 includes:
  • the pointing unit 711 is configured to perform face detection on the image to identify the face image, and extract the lip feature point from the face image;
  • a region unit 712 configured to triangulate the lip feature points to obtain a lip contour region
  • the blurring unit 713 is configured to black out the lip contour area and black out the lip contour area to blur the lip contour area to generate a lip rendering area;
  • the area unit 712 is further configured to determine whether the lips are in an open state according to a distribution state of the inner circle points in the lip feature points;
  • the present application further provides an electronic device, including:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  • the electronic device of the present application may be an electronic device 100 installed with a lip rendering color function application software, and the color of the lips in the image may be rendered by installing the application software in the electronic device 100, and the image may be acquired by the camera 101. It may also be an image stored in the electronic device 100 or acquired by other means.
  • the device embodiment since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the present application. Those of ordinary skill in the art can understand and implement without any creative effort.

Abstract

Provided is a lip color rendering method, apparatus, and electronic device. The method comprises: performing recognition on an image to determine a lip rendering area (S110); coloring the lip rendering area according to color number information to generate a colored lip image layer (S120); extracting from the image an initial lip image layer corresponding to the lip rendering area, adjusting color gradation after the initial lip image layer is converted to grayscale to obtain a highlighted lip image layer, and brightening and mixing the highlighted lip image layer and an image layer in which the image is located to obtain a brightened mixed image layer (S130); and superimposing and mixing the brightened mixed image layer and the colored lip image layer according to a preset algorithm to obtain a lip color-rendered image (S140). The generated image can not only express textures in the lip, but also simulate gloss when lipstick is applied in a real scenario, providing the experience of a real color test without having to apply lipstick.

Description

嘴唇渲染颜色的方法、装置及电子设备Method, device and electronic device for rendering color of lips 技术领域Technical field
本申请涉及图像处理技术领域,尤其涉及嘴唇渲染颜色的方法、装置及电子设备。The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, and an electronic device for rendering colors of a lip.
背景技术Background technique
选择口红的色号是选购口红时很重要的一个环节,一般是通过试色挑选颜色,目前常用的试色方式是将口红涂在手上或嘴唇上。涂在手上试色的方式虽然简单,但是无法准确判断口红涂在嘴唇上的效果;而涂在嘴唇上的方式,介于卫生等问题,通常是由导购人员使用工具为客户涂抹上色,整个过程十分繁琐,且需要一对一的服务。而不管是哪种方式,都需要有口红可以用来试,所以通常需要客户到实体柜台进行试色,试完后还需要卸掉口红。可见传统的试色方式都不方便。Choosing the color number of the lipstick is an important part of the purchase of lipstick. Generally, the color is selected by color test. The commonly used color test method is to apply lipstick on the hand or the lips. The method of coloring on the hand is simple, but it cannot accurately determine the effect of lipstick on the lips; the way of applying it on the lips is related to hygiene, etc., which is usually used by the shopping guide to paint the customer. The whole process is cumbersome and requires one-on-one service. Either way, you need lipstick to test, so you usually need to go to the physical counter for color test, and you need to remove the lipstick after the test. It can be seen that the traditional color test method is inconvenient.
而对图像的嘴唇部位进行颜色替换的方式,使得唇部看起来是一个平整的颜色,不能显示人真实涂抹口红时的状态,试色效果不佳。The color replacement of the lips of the image makes the lip look like a flat color, which does not show the state when the person actually applies the lipstick, and the color test effect is not good.
发明内容Summary of the invention
有鉴于此,本申请提供一种嘴唇渲染颜色的方法、装置及电子设备。In view of this, the present application provides a method, device, and electronic device for rendering colors of a lip.
具体地,本申请是通过如下技术方案实现的:Specifically, the present application is implemented by the following technical solutions:
一种嘴唇渲染颜色的方法,包括以下步骤:A method of rendering a color of a lip, comprising the following steps:
对图像进行识别确定嘴唇渲染区域;Identifying the image to determine the lip rendering area;
根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;Coloring the lip rendering area according to the color number information to generate a colored lip layer;
从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer
根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。 According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
一个实施例中,所述根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图的步骤包括:In one embodiment, the step of superimposing the brightened mixed layer and the colored lip layer according to a preset algorithm to obtain an effect map after the lip renders the color includes:
获取着色嘴唇图层的像素值小于预设阈值的浅像素位置信息,将变亮混合图层中与浅像素位置对应的像素值作为第一像素;Obtaining shallow pixel position information that the pixel value of the colored lip layer is smaller than a preset threshold, and the pixel value corresponding to the shallow pixel position in the mixed layer is brightened as the first pixel;
将着色图层中大于或等于预设阈值的像素值与高光嘴唇图层中对应的像素值根据预设算法进行叠加混合得到第二像素;Pixeling a pixel value greater than or equal to a preset threshold in the colored layer with a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
将第一像素与第二像素渲染到图像上得到效果图。Rendering the first pixel and the second pixel onto the image to obtain an effect map.
一个实施例中,所述根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层的步骤包括:In one embodiment, the step of coloring the lip rendering area according to the color number information to generate a colored lip layer comprises:
将嘴唇渲染区域各像素的像素值与色号信息中的像素值相乘得到着色嘴唇图层。The pixel value of each pixel of the lip rendering area is multiplied by the pixel value in the color number information to obtain a colored lip layer.
一个实施例中,所述对图像进行识别确定嘴唇渲染区域的步骤包括:In one embodiment, the step of identifying the image to determine the lip rendering area comprises:
对图像进行人脸检测以识别人脸图像,从人脸图像中提取嘴唇特征点;Performing face detection on the image to recognize the face image, and extracting the lip feature points from the face image;
对嘴唇特征点进行三角化处理得到嘴唇轮廓区域;Triangulating the lip feature points to obtain the lip contour area;
以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域。The lip contour area is white, and the lip outline area is black, and the lip contour area is blurred to generate a lip rendering area.
一个实施例中,所述对嘴唇特征点进行三角化处理得到嘴唇轮廓区域的步骤包括:In one embodiment, the step of triangulating the lip feature points to obtain the lip contour region comprises:
根据嘴唇特征点中内圈点的分布状态判断嘴唇是否处于张开状态;Whether the lips are in an open state according to the distribution state of the inner circle points in the feature points of the lips;
当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域;When the lips are not in the open state, the outer circle points in the lip feature points are triangulated to obtain the lip contour area;
当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓区域。When the lips are in the open state, the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour area.
本申请还公开了一种嘴唇渲染颜色的装置,包括:The application also discloses a device for rendering a color of a lip, comprising:
区域模块,用于对图像进行识别确定嘴唇渲染区域;a region module for identifying an image to determine a lip rendering area;
渲染模块,用于根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;及a rendering module, configured to generate a colored lip layer by coloring the lip rendering area according to the color number information; and
从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;及Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer; and
根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。 According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
一个实施例中,所述渲染模块包括:In one embodiment, the rendering module includes:
取色单元,用于获取着色嘴唇图层的像素值小于预设阈值的浅像素位置信息,将变亮混合图层中与浅像素位置对应的像素值作为第一像素;a color picking unit, configured to obtain shallow pixel position information that the pixel value of the colored lip layer is less than a preset threshold, and to change a pixel value corresponding to the shallow pixel position in the mixed layer as the first pixel;
混色单元,用于将着色图层中大于或等于预设阈值的像素值与高光嘴唇图层中对应的像素值根据预设算法进行叠加混合得到第二像素;a color mixing unit, configured to superimpose a pixel value greater than or equal to a preset threshold in the coloring layer and a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
渲染单元,用于将第一像素与第二像素渲染到图像上得到效果图。a rendering unit, configured to render the first pixel and the second pixel onto the image to obtain an effect diagram.
一个实施例中,所述渲染模块,还用于将嘴唇渲染区域各像素的像素值与色号信息中的像素值相乘得到着色嘴唇图层。In one embodiment, the rendering module is further configured to multiply a pixel value of each pixel of the lip rendering area by a pixel value in the color number information to obtain a colored lip layer.
一个实施例中,所述区域模块包括:In one embodiment, the area module includes:
取点单元,用于对图像进行人脸检测以识别人脸图像,从人脸图像中提取嘴唇特征点;a point taking unit for performing face detection on the image to recognize the face image, and extracting the lip feature point from the face image;
区域单元,用于对嘴唇特征点进行三角化处理得到嘴唇轮廓区域;a region unit for triangulating the lip feature points to obtain a lip contour region;
模糊单元,用于以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域;The blur unit is configured to white the lip contour area and black outside the lip contour area, and blur the lip contour area to generate a lip rendering area;
所述区域单元,还用于根据嘴唇特征点中内圈点的分布状态判断嘴唇是否处于张开状态;及The area unit is further configured to determine whether the lips are in an open state according to a distribution state of the inner circle points in the feature points of the lips; and
当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域;及When the lips are not in the open state, the outer circle points in the lip feature points are triangulated to obtain the lip contour area;
当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓区域。When the lips are in the open state, the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour area.
本申请还公开了一种电子设备,包括:The application also discloses an electronic device, including:
处理器;processor;
用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
其中,所述处理器被配置为:Wherein the processor is configured to:
对图像进行识别确定嘴唇渲染区域;Identifying the image to determine the lip rendering area;
根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;Coloring the lip rendering area according to the color number information to generate a colored lip layer;
从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得 到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;Extract the initial lip layer corresponding to the lip rendering area from the image, and adjust the color gradation after the initial lip layer is grayed out. To the high-gloss lip layer, brighten the highlight lip layer and the layer where the image is located to obtain a brightened mixed layer;
根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
本发明根据色号信号对图像中的嘴唇区域进行颜色渲染,并对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光图层与图像所在图层进行变亮混合得到变亮混合图层,以模拟涂抹口红后局部有反光的高光效果,根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图,生成的效果图不仅能够显现嘴唇中的纹理,还能够模拟出人在真实场景下涂上口红后具有的光泽,无需涂抹口红即可体验真实的试色效果。The invention performs color rendering on the lip region in the image according to the color number signal, adjusts the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brightens and blends the highlight layer with the layer where the image is located to obtain a change. Brightly blend the layer to simulate the partial highlighting effect after applying the lipstick. According to the preset algorithm, the brightened mixed layer and the colored lip layer are superimposed and mixed to obtain the effect diagram of the lip rendered color, and the generated effect diagram is not only It can reveal the texture in the lips, and it can also simulate the luster that people have after applying lipstick in real scenes. You can experience the true color test without applying lipstick.
附图说明DRAWINGS
图1是本申请一示例性实施例示出的一种嘴唇渲染颜色的方法的流程图;1 is a flow chart showing a method for rendering a color of a lip according to an exemplary embodiment of the present application;
图2是本申请一示例性实施例示出的对图像进行识别确定嘴唇渲染区域的细化流程图;2 is a detailed flowchart of identifying an image of a lip rendering area according to an exemplary embodiment of the present application;
图3是从人脸图像中提取特征点的示意图;3 is a schematic diagram of extracting feature points from a face image;
图4a是对嘴唇处于张开状态时的特征点进行三角化处理的示意图;Figure 4a is a schematic view of the triangulation of feature points when the lips are in an open state;
图4b是对嘴唇处于闭合状态时的特征点进行三角化处理的示意图;Figure 4b is a schematic view of the triangulation of feature points when the lips are in a closed state;
图4c是本申请嘴唇渲染区域的效果图;Figure 4c is an effect diagram of the lip rendering area of the present application;
图4d是本申请生成的着色嘴唇图层的效果图;Figure 4d is an effect diagram of the colored lip layer generated by the present application;
图5是本申请一示例性实施例示出的将变亮混合图层与着色嘴唇图层进行叠加混合的细化流程图;FIG. 5 is a detailed flowchart showing superimposing and mixing a brightened mixed layer and a colored lip layer according to an exemplary embodiment of the present application; FIG.
图6是本申请一示例性实施例示出的对嘴唇特征点进行三角化处理得到嘴唇轮廓区域的细化流程图;6 is a flow chart showing a refinement of a lip contour region by triangulating a lip feature point according to an exemplary embodiment of the present application;
图7是本申请一示例性实施例示出的一种嘴唇渲染颜色的装置的逻辑框图;FIG. 7 is a logic block diagram of an apparatus for rendering a color of a lip according to an exemplary embodiment of the present application; FIG.
图8是本申请一示例性实施例示出的渲染模块的细化逻辑框图;FIG. 8 is a detailed logic block diagram of a rendering module according to an exemplary embodiment of the present application; FIG.
图9是本申请一示例性实施例示出的区域模块的细化逻辑框图;9 is a detailed logic block diagram of a region module shown in an exemplary embodiment of the present application;
图10是本申请一示例性实施例示出电子装置效果图。 FIG. 10 is a diagram showing an effect of an electronic device according to an exemplary embodiment of the present application.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. The following description refers to the same or similar elements in the different figures unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with aspects of the present application as detailed in the appended claims.
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in the present application is for the purpose of describing particular embodiments, and is not intended to be limiting. The singular forms "a", "the" and "the" It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本申请可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in this application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, the first information may also be referred to as the second information without departing from the scope of the present application. Similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to a determination."
图1是本申请一示例性实施例示出的一种嘴唇渲染颜色的方法的流程图;如图1所示,该方法可以包括步骤S110至S140:1 is a flow chart of a method for rendering a color of a lip according to an exemplary embodiment of the present application; as shown in FIG. 1, the method may include steps S110 to S140:
步骤S110:对图像进行识别确定嘴唇渲染区域;Step S110: Identifying an image to determine a lip rendering area;
在接收到图像时,可以对图像进行人脸检测,以确定图像中是否存在人脸并定位人脸位置,再从人脸中识别出嘴唇,以嘴唇所在区域作为嘴唇渲染区域;其中,可以通过神经网络、色彩识别、区域分割、关键点检测等多种方式从图像中识别出人脸嘴唇,本申请一实施例提供的确定嘴唇渲染区域的方式如图2所示,所述对图像进行识别确定嘴唇渲染区域的步骤包括:When the image is received, the image may be subjected to face detection to determine whether there is a face in the image and the face position is located, and then the lip is recognized from the face, and the area where the lips are located is used as the lip rendering area; The neural network, the color recognition, the region segmentation, the key point detection and the like are used to identify the face and lips from the image. The manner of determining the lip rendering area provided by an embodiment of the present application is as shown in FIG. 2, and the image is identified. The steps to determine the lip rendering area include:
步骤S211:对图像进行人脸检测以识别人脸图像,从人脸图像中提取嘴唇特征点;Step S211: performing face detection on the image to identify the face image, and extracting the lip feature point from the face image;
步骤S212:对嘴唇特征点进行三角化处理得到嘴唇轮廓区域;Step S212: Triangulating the lip feature points to obtain a lip contour area;
步骤S213:以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域。In step S213, the lip contour area is white and the lip contour area is black, and the lip contour area is blurred to generate a lip rendering area.
人脸对应的特征点如图3所示,由于本申请仅对嘴唇部分进行渲染处理,因此,可以仅提取人脸嘴唇301对应的框302中的特征点,特征点的数量可以有任意多个,本申请对特征 点的数量不做限定,为了便于描述,接下来以20个特征点为例进行说明,如图4a所示,外圈点12个、内圈点8个,可以采用外圈点顺次相连组成大多边形、内圈点顺次相连组成小多边形,2个多边形嵌套,以大多边形与小多边形间的多边形圈为嘴唇轮廓区域;为了便于程序描述,本实施例以外圈点和/或内圈点的特征点组成的三角形表示嘴唇轮廓区域。从图4a、图4b中可以看出,由特征点连线描绘出的嘴唇轮廓区域边缘锐利,没有真实唇形平滑,且嘴唇(口红)与皮肤的颜色在交界处是渐变过渡的,为了能够更贴近真实嘴唇的形状及上色效果,本申请一实施例通过对嘴唇轮廓区域边缘进行平滑和/或模糊处理,以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域,如图4c所示。模糊处理的方法有多种,例如,高斯算子、拉普拉斯高斯算子等,以本申请一实施例采用高斯算子为例,以A像素及其左右各4个像素共9个像素为一组,以这9个像素的RGB值进行高斯算子加权运算(横向运算),得到该A像素的RGB值,再以该A像素及其上下各4个像素共9个像素为一组,以这9个像素的RGB值进行高斯算子加权运算(竖向运算),得到该A像素的RGB值。嘴唇轮廓区域边缘的像素均作为A像素,采用GPU(Graphics Processing Unit,图形处理器)同时进行上述运算,处理速度快,当然,为了增强效果,也可以再重复进行上述运算(一次横向运算+一次竖向运算为一次运算)。从而嘴唇渲染区域从中间向边缘以渐变色过渡,对嘴唇渲染区域上色时,能更加自然的贴近真实涂抹口红的效果,从而嘴唇渲染区域从图像中抠取的初始嘴唇图层能更加贴近真实嘴唇。The feature points corresponding to the human face are as shown in FIG. 3. Since the present application only performs rendering processing on the lip portion, only the feature points in the frame 302 corresponding to the human face lip 301 can be extracted, and the number of the feature points can be any number of , the application of the feature The number of points is not limited. For convenience of description, 20 feature points are taken as an example. As shown in FIG. 4a, there are 12 outer ring points and eight inner circle points, and outer ring points can be sequentially connected to form a large polygon. The inner circle points are sequentially connected to form a small polygon, and the two polygons are nested, and the polygon circle between the large polygon and the small polygon is the lip contour region; for the convenience of program description, the feature points of the outer circle point and/or the inner circle point of the embodiment are composed. The triangle represents the lip contour area. As can be seen from Fig. 4a and Fig. 4b, the edge of the lip contour area drawn by the feature point line is sharp, there is no real lip shape smoothness, and the color of the lip (lipstick) and the skin is a gradual transition at the junction, in order to be able to More closely related to the shape and color effect of the real lips, an embodiment of the present application smoothes and/or blurs the edge of the lip contour region, and the lip contour region is white and the lip contour region is black, and the lip contour region is performed. Blurring processing generates a lip rendering area as shown in Figure 4c. There are various methods for the fuzzy processing, for example, a Gaussian operator, a Laplacian Gaussian operator, etc., taking a Gaussian operator as an example in the embodiment of the present application, and a total of 9 pixels of the A pixel and each of the left and right pixels. For a group, the Gaussian operator weighting operation (horizontal operation) is performed on the RGB values of the 9 pixels, and the RGB value of the A pixel is obtained, and then the A pixel and the upper and lower 4 pixels are 9 pixels in total. The Gaussian operator weighting operation (vertical operation) is performed on the RGB values of the nine pixels, and the RGB values of the A pixels are obtained. The pixels at the edge of the lip contour area are used as A pixels. The GPU (Graphics Processing Unit) performs the above operations at the same time, and the processing speed is fast. Of course, in order to enhance the effect, the above operation can be repeated (one horizontal operation + one time) The vertical operation is one operation). Thus, the lip rendering area transitions from the middle to the edge with a gradient color. When the lip rendering area is colored, the effect of the real lipstick can be more naturally applied, so that the initial lip layer extracted from the image of the lip rendering area can be closer to the real one. Lips.
步骤S120:根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;Step S120: Coloring the lip rendering area according to the color number information to generate a colored lip layer;
色号信息包括颜色的名称、对应的RGB值等,色号信息可以是根据用户的指令生成的,也可以是系统根据历史数据、用户肤色等信息自动生成的,当然,不同厂商对同一名称颜色的口红使用的RGB值也可能不同,例如,不同品牌的珊瑚色口红的颜色对应的RGB值就可能不同,所以,颜色的名称可以包含品牌、色号等信息,以方便用户使用,可以在系统中将颜色的名称与RGB值对应,以根据RGB值对嘴唇渲染区域上色生成着色嘴唇图层,如图4d所示。对嘴唇渲染区域上色的方式有多种,可以逐一像素进行处理,也可以按区域进行处理,为了提高上色的速度,本申请一实施例所述根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层的步骤包括:The color number information includes the name of the color, the corresponding RGB value, etc. The color number information may be generated according to the user's instruction, or may be automatically generated by the system according to historical data, user skin color, etc., of course, different manufacturers have the same name color. The RGB values used for lipsticks may also be different. For example, the color of the coral color of different brands may have different RGB values. Therefore, the name of the color may include information such as brand and color number to facilitate user use. The name of the center color corresponds to the RGB value to color the lip rendering area according to the RGB value to generate a colored lip layer, as shown in Figure 4d. There are a plurality of ways of coloring the lip rendering area, which may be processed one by one pixel or may be processed by the area. In order to improve the speed of coloring, the lip rendering area is colored according to the color number information according to an embodiment of the present application. The steps to color the lip layer include:
将嘴唇渲染区域各像素的像素值与色号信息中的像素值相乘得到着色嘴唇图层。The pixel value of each pixel of the lip rendering area is multiplied by the pixel value in the color number information to obtain a colored lip layer.
例如,选择珊瑚色对嘴唇渲染区域上色,即将珊瑚色的RGB值与嘴唇渲染区域的RGB值混合,例如,黑色的RGB值分别为0、0、0,白色的RGB值分别为255、255、255,珊瑚色的RGB值分别为255、127、80,由于R、G、B各值的取值范围是0-255,为了便于计算, 将RGB值转化成0-1间的数,例如,黑色的RGB值为0、0、0,白色的RGB值分别为1、1、1,珊瑚色的RGB值分别为1、0.498、0.314,进行混合时将像素的RGB值与珊瑚色的RGB值相乘即可,例如,为白色上珊瑚色后的RGB值分别为1、0.498、0.314,为黑色上珊瑚色后的RGB值为0、0、0,区域整体渲染的处理方式可以大大提高上色速度。For example, select the coral color to color the lip rendering area, that is, mix the RGB value of the coral color with the RGB value of the lip rendering area. For example, the black RGB values are 0, 0, 0, respectively, and the white RGB values are 255, 255, respectively. 255, the RGB values of the coral color are 255, 127, and 80 respectively. Since the values of R, G, and B are in the range of 0-255, for the convenience of calculation, Convert RGB values into numbers between 0-1. For example, black RGB values are 0, 0, 0, white RGB values are 1, 1, 1, and coral RGB values are 1, 0.498, 0.314, respectively. When mixing, multiply the RGB value of the pixel by the RGB value of the coral color. For example, the RGB values after the coral color on the white are 1, 0.498, and 0.314, respectively, and the RGB value after the coral color on the black is 0. 0, 0, the overall rendering of the area can greatly improve the coloring speed.
步骤S130:从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;Step S130: extract an initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation to obtain a highlight lip layer after graying the initial lip layer, and brighten and mix the highlight lip layer with the image layer. Brighten the mixed layer;
人的嘴唇会对光有反射(反光),当涂了口红、唇油等在嘴唇上形成釉层后反光(高光)会更明显,仅在图像中对嘴唇渲染区域上色不能达到形成高光的效果,对此,本申请提出为嘴唇增加高光的方案,当然,可以采用自动匹配高光等方式,为了增强高光真实感,本申请一实施例采用将嘴唇原本反光效果增强的方式生成高光;从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,本实施例采用的灰度化是指使像素的R值=G值=B值,可以根据R值、G值或者B值进行灰度化,也可以根据某一比例对RGB整体进行灰度化,本申请对此不作限制,灰度化后调整色阶(包括gamma矫正)以增强明暗对比,例如,将灰度化后像素的RGB值映射到50-150的区间内,再还原到0-255,使原本RGB值在0-50范围内的像素最终变成0,原本RGB值在150-255范围内的像素最终变成255,RGB值在50-150的像素也增强了明暗对比,使暗的像素更暗、亮的像素更亮,从而形成高光的效果。以对初始嘴唇图层中4个像素进行灰度化后调整色阶为例,若RGB值为(40,40,70)、(70,40,70)、(140,70,140)、(200,140,200),根据将RGB值按照(0.3,0.59,0.11)进行灰度化后为(43,43,43)、(52,52,52)、(99,99,99)、(165,165,165),将上述RGB值映射到50-150的区间并结合gamma矫正:(43-50)÷(150-50)=-0.07(小于0时取0),(52-50)÷(150-50)=0.02,(99-50)÷(150-50)=0.49,(165-50)÷(150-50)=1.15(大于1时取1),计算结果为(0,0,0)、(0.02,0.02,0.02)、(0.49,0.49,0.49)、(1,1,1);还原到0-255:0→0,0.02→5,0.49→125,1→255,即调整色阶后的RGB值为(0,0,0)、(5,5,5)、(125,125,125)、(255,255,255)。将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层,为原嘴唇图层增添高光效果。The human lips have a reflection (reflection) on the light. When a lipstick, lip oil, etc. is applied to the lips to form a glaze, the reflection (highlight) is more obvious. Only the color of the lip rendering area in the image cannot reach the highlight. In this regard, the present application proposes a scheme for adding highlights to the lips. Of course, an automatic matching highlight or the like may be adopted. In order to enhance the realism of highlights, an embodiment of the present application generates highlights by enhancing the original reflective effect of the lips; The initial lip layer corresponding to the lip rendering area is extracted, and the initial lip layer is grayed out and the color gradation is adjusted to obtain a highlight lip layer. The gray level used in this embodiment refers to making the pixel R value=G value=B value. The gradation can be performed according to the R value, the G value, or the B value, or the RGB whole can be grayed out according to a certain ratio. This application does not limit this, and the gradation (including gamma correction) is adjusted after the gradation. Enhance the contrast between light and dark, for example, map the RGB values of the grayscale pixels to the interval of 50-150, and then restore to 0-255, so that the pixels with the original RGB values in the range of 0-50 eventually become 0, the original RGB Value is at 150- The pixels in the range of 255 eventually become 255, and the pixels with RGB values of 50-150 also enhance the contrast between light and dark, making dark pixels darker and brighter pixels brighter, thus forming a highlight effect. For example, if the gradation is adjusted by grading the four pixels in the initial lip layer, if the RGB values are (40, 40, 70), (70, 40, 70), (140, 70, 140), ( 200, 140, 200), according to (0.3, 0.59, 0.11), the RGB values are (43, 43, 43), (52, 52, 52), (99, 99, 99), ( 165, 165, 165), mapping the above RGB values to the interval of 50-150 and combining gamma correction: (43-50) ÷ (150-50) = -0.07 (takes 0 when less than 0), (52-50) ÷(150-50)=0.02,(99-50)÷(150-50)=0.49,(165-50)÷(150-50)=1.15 (take 1 when greater than 1), the calculation result is (0, 0,0), (0.02,0.02,0.02), (0.49,0.49,0.49), (1,1,1); restored to 0-255:0→0, 0.02→5, 0.49→125,1→255 , that is, the RGB values after adjusting the color gradation are (0, 0, 0), (5, 5, 5), (125, 125, 125), (255, 255, 255). Brighten the highlight lip layer and the layer where the image is located to create a brightened blend layer that adds highlight to the original lip layer.
步骤S140:根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。Step S140: superimposing and blending the brightened mixed layer and the colored lip layer according to a preset algorithm to obtain an effect diagram after the lip renders the color.
实际涂抹口红后,还是能看到嘴唇上的纹理,口红效果也与唇色有一定关系,为此,本 申请采用预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,使得效果图中能看到真实涂沫口红后应有的光泽及纹理。After actually applying lipstick, you can still see the texture on the lips. The lipstick effect also has a certain relationship with the lip color. To this end, Ben Applying a preset algorithm to superimpose and blend the brightened mixed layer with the colored lip layer, so that the gloss and texture that should be seen after the actual application of the lipstick can be seen in the effect picture.
根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合的方式有多种,例如,如公式(1)所示的预设算法,There are various ways to superimpose and blend the brightened mixed layer and the colored lip layer according to a preset algorithm, for example, a preset algorithm as shown in the formula (1).
Figure PCTCN2017104367-appb-000001
Figure PCTCN2017104367-appb-000001
其中,a表示着色嘴唇图层中像素的RGB值,b表示着变亮混合图层中像素的RGB值。然而,由图4d可知,着色嘴唇图层中除嘴唇部分外,其它区域为黑色,而黑色的RGB值分别为0、0、0,白色的RGB值分别为255、255、255(使用公式(1)时是将RGB值转化成0-1间的数进行计算的,R值、G值、B值独立计算),显然,采用公式(1)进行叠加混合将使图像中嘴唇以外区域的像素值也发生改变,对此,如图5所示,本申请一实施例提出的根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图的步骤包括:Where a represents the RGB value of the pixel in the colored lip layer and b represents the RGB value of the pixel in the brightened mixed layer. However, as can be seen from Fig. 4d, in the colored lip layer, except for the lip portion, the other regions are black, and the black RGB values are 0, 0, and 0, respectively, and the white RGB values are 255, 255, and 255, respectively (using the formula ( 1) The calculation is performed by converting the RGB value into a number between 0-1, and the R value, the G value, and the B value are calculated independently. Obviously, superimposing and mixing using the formula (1) will make the pixels in the image outside the lip area. The value is also changed. In this regard, as shown in FIG. 5, the step of superimposing the brightened mixed layer and the colored lip layer according to a preset algorithm according to a preset algorithm to obtain a rendering result after the lip is rendered. include:
步骤S541:获取着色嘴唇图层的像素值小于预设阈值的浅像素位置信息,将变亮混合图层中与浅像素位置对应的像素值作为第一像素;Step S541: acquiring shallow pixel position information whose pixel value of the colored lip layer is smaller than a preset threshold, and changing a pixel value corresponding to the shallow pixel position in the mixed layer as the first pixel;
步骤S542:将着色图层中大于或等于预设阈值的像素值与高光嘴唇图层中对应的像素值根据预设算法进行叠加混合得到第二像素;Step S542: superimposing the pixel values in the coloring layer that are greater than or equal to the preset threshold and the corresponding pixel values in the highlight lip layer according to a preset algorithm to obtain a second pixel;
步骤S543:将第一像素与第二像素渲染到图像上得到效果图。Step S543: Rendering the first pixel and the second pixel onto the image to obtain an effect map.
上述步骤S541及步骤S542可以理解为如公式(2)所示的预设算法,The above steps S541 and S542 can be understood as a preset algorithm as shown in the formula (2).
Figure PCTCN2017104367-appb-000002
Figure PCTCN2017104367-appb-000002
其中,a表示着色嘴唇图层中像素的RGB值,b表示着变亮混合图层中像素的RGB值。公式(2)中的0.5即为与着色嘴唇图层的像素值进行对比的预设阈值,预设阈值可以任意设定,例如为0.5或0.8等,本申请对此不作限定,可以理解的,公式(2)中也可以采用其它类型的混合公式。由于黑色的RGB值分别为0、0、0,显然,图4d中除嘴唇部分外的黑色区域将显示变亮混合图层中的区域,当然,也可以对嘴唇部分以外的区域采用其它方式进行美肤或增加化妆效果;嘴唇部分根据公式(2)进行计算,其中部分像素值为变亮混合图层中对应位置的像素值,部分像素值为着色嘴唇图层与变亮混合图层中像素的混合结果,从而,最终的效果图中能够显示口红效果、真实涂沫口红后应有的光泽及纹理。 Where a represents the RGB value of the pixel in the colored lip layer and b represents the RGB value of the pixel in the brightened mixed layer. The default value in the formula (2) is a preset threshold value that is compared with the pixel value of the colored lip layer. The preset threshold value can be arbitrarily set, for example, 0.5 or 0.8, which is not limited in this application. Other types of mixing formulas can also be used in equation (2). Since the black RGB values are 0, 0, and 0, respectively, it is obvious that the black area except the lip portion in Fig. 4d will display the area in the brightened mixed layer. Of course, other areas other than the lip portion may be used in other ways. Skin or add makeup effect; the lip part is calculated according to formula (2), in which part of the pixel value is the pixel value of the corresponding position in the brightened mixed layer, and part of the pixel value is the pixel in the colored lip layer and the brightened mixed layer The result of the mixing, and thus, the final effect diagram can show the lipstick effect, the gloss and texture that should be present after the actual application of lipstick.
进一步地,由于人的嘴唇有张开和闭合等状态,针对不同状态本申请提出了不同的处理方式,如图6所示,所述对嘴唇特征点进行三角化处理得到嘴唇轮廓区域的步骤包括:Further, since the human lips have open and closed states, the present application proposes different processing manners for different states. As shown in FIG. 6, the step of triangulating the lip feature points to obtain the lip contour region includes :
步骤S611:根据嘴唇特征点中内圈点的分布状态判断嘴唇是否处于张开状态;Step S611: determining whether the lips are in an open state according to the distribution state of the inner circle points in the feature points of the lips;
步骤S612:当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域;Step S612: when the lips are not in the open state, triangulating the outer circle points in the lip feature points to obtain a lip contour region;
步骤S613:当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓区域。Step S613: When the lips are in the open state, triangulation is performed in a combination of the outer circle points and the inner circle points to obtain a lip contour region.
判断嘴唇是否处于张开状态的方式有多种,例如,通过比较像素RGB值区分嘴唇、牙齿等以判断嘴唇是否处于张开状态,然而目前的判断方式计算方法都较复杂,本申请提出根据内圈各特征点的位置关系判断嘴唇是否处于张开状态,嘴唇处于张开状态或闭合状态时,内圈各特征点间距的变化较明显,如图4a、图4b所示,可以根据特征点414、415、416、418、419、420的分布状态判断嘴唇是否处于张开状态,例如,计算特征点414、415、416纵坐标的第一平均值,特征点418、419、420纵坐标的第二平均值,比较第一平均值与第二平均值的差值是否小于预设阈值(例如,为2像素、5像素等);当然,也可以分别计算特征点414与420、415与419、416与418纵坐标的差值是否小于预设阈值,大于预设阈值可以判断嘴唇处于张开状态(如图4a所示),否则可以判断嘴唇处于闭合状态(如图4b所示)。进一步地,针对嘴唇处于张开状态或闭合状态可以采用不同的三角化处理方式,如图4a所示,当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓区域,例如,以特征点401、402、413组成一个三角形,再以402、413、414组成下一个三角形,依次循环到所有的特征点,三角形组成闭合区域且不重叠,得到嘴唇轮廓区域。若在嘴唇闭合状态仍以外圈点和内圈点组合的方式进行三角化处理,因内圈点位置交错可能出现部分区域重叠的三角形,而以三角形为区域对嘴唇轮廓区域上色时,将导致重叠的部分重复上色、颜色变深。为此,如图4b所示,当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域,例如,以特征点401、402、412组成一个三角形,再以402、412、403组成下一个三角形,依次循环到所有的外圈点,三角形组成闭合区域且不重叠,得到嘴唇轮廓区域。从而,通过上述对嘴唇闭合状态的区分处理,不仅可以提高获取嘴唇轮廓区域的效率,还可以保证上色效果。There are various ways to determine whether the lips are in an open state. For example, by comparing the pixel RGB values to distinguish lips, teeth, etc. to determine whether the lips are in an open state, the current calculation method of the judgment method is complicated, and the present application proposes The positional relationship of each feature point of the circle determines whether the lip is in an open state, and when the lip is in an open state or a closed state, the variation of the feature point spacing of the inner ring is more obvious, as shown in FIG. 4a and FIG. 4b, according to the feature point 414. The distribution states of 415, 416, 418, 419, and 420 determine whether the lips are in an open state, for example, calculating a first average of the ordinates of the feature points 414, 415, and 416, and the ordinates of the feature points 418, 419, and 420 a second average value, comparing whether the difference between the first average value and the second average value is less than a preset threshold (for example, 2 pixels, 5 pixels, etc.); of course, feature points 414 and 420, 415 and 419 may also be calculated separately, Whether the difference between the 416 and the 418 ordinate is less than a preset threshold, and greater than the preset threshold can determine that the lips are in an open state (as shown in FIG. 4a), otherwise the lips can be judged to be in a closed state (as shown in FIG. 4b). Shown). Further, different triangulation treatments may be adopted for the lips to be in an open state or a closed state. As shown in FIG. 4a, when the lips are in an open state, the outer circle points and the inner circle points are combined to obtain a lip contour. The region, for example, consists of a triangle with feature points 401, 402, 413, and then the next triangle with 402, 413, 414, which in turn loops to all feature points, the triangles form a closed region and do not overlap, resulting in a lip contour region. If the combination of the circle point and the inner circle point is triangulated in the closed state of the lips, the triangles in which the partial regions overlap may occur due to the interlaced position of the inner circle points, and the overlapping of the lip contour regions by the triangle region will result in overlapping portions. Repeat the coloring and darken the color. To this end, as shown in FIG. 4b, when the lips are not in the open state, the outer circle points in the lip feature points are triangulated to obtain the lip contour regions, for example, the feature points 401, 402, 412 form a triangle, and then The next triangle is composed of 402, 412, and 403, and sequentially loops to all the outer circle points, and the triangles form a closed area and do not overlap to obtain a lip contour area. Therefore, by the above-described discrimination processing of the closed state of the lips, not only the efficiency of acquiring the lip contour region but also the coloring effect can be ensured.
与前述嘴唇渲染颜色的方法的实施例相对应,本申请还提供了嘴唇渲染颜色的装置的实施例。 Corresponding to an embodiment of the aforementioned method of rendering a color of a lip, the present application also provides an embodiment of a device for rendering a color of a lip.
请参考图7,图7是本申请一示例性实施例示出的一种嘴唇渲染颜色的装置700的逻辑框图;如图7所示,该嘴唇渲染颜色的装置700可以包括区域模块710及渲染模块720:Please refer to FIG. 7. FIG. 7 is a logic block diagram of an apparatus 700 for rendering colors of a lip according to an exemplary embodiment of the present application. As shown in FIG. 7, the device 700 for rendering colors of a lip may include a region module 710 and a rendering module. 720:
区域模块710,用于对图像进行识别确定嘴唇渲染区域;The area module 710 is configured to identify an image to determine a lip rendering area;
渲染模块720,用于根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;及a rendering module 720, configured to generate a colored lip layer by coloring the lip rendering area according to the color number information; and
从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;及Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer; and
根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
如图8所示,所述渲染模块720包括:As shown in FIG. 8, the rendering module 720 includes:
取色单元721,用于获取着色嘴唇图层的像素值小于预设阈值的浅像素位置信息,将变亮混合图层中与浅像素位置对应的像素值作为第一像素;The color picking unit 721 is configured to obtain shallow pixel position information that the pixel value of the colored lip layer is smaller than a preset threshold, and the pixel value corresponding to the shallow pixel position in the brightened mixed layer is used as the first pixel;
混色单元722,用于将着色图层中大于或等于预设阈值的像素值与高光嘴唇图层中对应的像素值根据预设算法进行叠加混合得到第二像素;a color mixing unit 722, configured to superimpose a pixel value greater than or equal to a preset threshold in the colored layer with a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
渲染单元723,用于将第一像素与第二像素渲染到图像上得到效果图。The rendering unit 723 is configured to render the first pixel and the second pixel onto the image to obtain an effect map.
进一步的,所述渲染模块720,还用于将嘴唇渲染区域各像素的像素值与色号信息中的像素值相乘得到着色嘴唇图层。Further, the rendering module 720 is further configured to multiply pixel values of each pixel of the lip rendering area by pixel values in the color number information to obtain a colored lip layer.
如图9所示,所述区域模块710包括:As shown in FIG. 9, the area module 710 includes:
取点单元711,用于对图像进行人脸检测以识别人脸图像,从人脸图像中提取嘴唇特征点;The pointing unit 711 is configured to perform face detection on the image to identify the face image, and extract the lip feature point from the face image;
区域单元712,用于对嘴唇特征点进行三角化处理得到嘴唇轮廓区域;a region unit 712, configured to triangulate the lip feature points to obtain a lip contour region;
模糊单元713,用于以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域;The blurring unit 713 is configured to black out the lip contour area and black out the lip contour area to blur the lip contour area to generate a lip rendering area;
所述区域单元712,还用于根据嘴唇特征点中内圈点的分布状态判断嘴唇是否处于张开状态;及The area unit 712 is further configured to determine whether the lips are in an open state according to a distribution state of the inner circle points in the lip feature points; and
当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域;及When the lips are not in the open state, the outer circle points in the lip feature points are triangulated to obtain the lip contour area;
当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓 区域。When the lips are in the open state, the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour. region.
与前述嘴唇渲染颜色的方法的实施例相对应,本申请还提供了一种电子设备,包括:Corresponding to the foregoing embodiment of the method for rendering a color of a lip, the present application further provides an electronic device, including:
处理器;processor;
用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
其中,所述处理器被配置为:Wherein the processor is configured to:
对图像进行识别确定嘴唇渲染区域;Identifying the image to determine the lip rendering area;
根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;Coloring the lip rendering area according to the color number information to generate a colored lip layer;
从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer
根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
本申请的电子设备可以是安装有嘴唇渲染颜色功能应用软件的电子设备100,通过在电子设备100中安装该应用软件即可对图像中的嘴唇渲染颜色,该图像可以是通过摄像头101获取的,也可以是电子设备100中存储的,或者通过其它途径获取的图像。The electronic device of the present application may be an electronic device 100 installed with a lip rendering color function application software, and the color of the lips in the image may be rendered by installing the application software in the electronic device 100, and the image may be acquired by the camera 101. It may also be an image stored in the electronic device 100 or acquired by other means.
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。The implementation process of the function and the function of each unit in the foregoing device is specifically described in the implementation process of the corresponding steps in the foregoing method, and details are not described herein again.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the device embodiment, since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment. The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the present application. Those of ordinary skill in the art can understand and implement without any creative effort.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。 The above is only the preferred embodiment of the present application, and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., which are made within the spirit and principles of the present application, should be included in the present application. Within the scope of protection.

Claims (10)

  1. 一种嘴唇渲染颜色的方法,其特征在于,包括以下步骤:A method for rendering a color of a lip, comprising the steps of:
    对图像进行识别确定嘴唇渲染区域;Identifying the image to determine the lip rendering area;
    根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;Coloring the lip rendering area according to the color number information to generate a colored lip layer;
    从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer
    根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  2. 如权利要求1所述的嘴唇渲染颜色的方法,其特征在于,所述根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图的步骤包括:The method for rendering a color of a lip according to claim 1, wherein the step of superimposing the brightened mixed layer and the colored lip layer according to a preset algorithm to obtain an effect map after the lip is rendered by the lip comprises:
    获取着色嘴唇图层的像素值小于预设阈值的浅像素位置信息,将变亮混合图层中与浅像素位置对应的像素值作为第一像素;Obtaining shallow pixel position information that the pixel value of the colored lip layer is smaller than a preset threshold, and the pixel value corresponding to the shallow pixel position in the mixed layer is brightened as the first pixel;
    将着色图层中大于或等于预设阈值的像素值与高光嘴唇图层中对应的像素值根据预设算法进行叠加混合得到第二像素;Pixeling a pixel value greater than or equal to a preset threshold in the colored layer with a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
    将第一像素与第二像素渲染到图像上得到效果图。Rendering the first pixel and the second pixel onto the image to obtain an effect map.
  3. 如权利要求1所述的嘴唇渲染颜色的方法,其特征在于,所述根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层的步骤包括:The method for rendering a color of a lip according to claim 1, wherein the step of coloring the lip rendering region according to the color number information to generate a colored lip layer comprises:
    将嘴唇渲染区域各像素的像素值与色号信息中的像素值相乘得到着色嘴唇图层。The pixel value of each pixel of the lip rendering area is multiplied by the pixel value in the color number information to obtain a colored lip layer.
  4. 如权利要求1至3中任一项所述的嘴唇渲染颜色的方法,其特征在于,所述对图像进行识别确定嘴唇渲染区域的步骤包括:The method for rendering a color of a lip according to any one of claims 1 to 3, wherein the step of identifying the image to determine a lip rendering area comprises:
    对图像进行人脸检测以识别人脸图像,从人脸图像中提取嘴唇特征点;Performing face detection on the image to recognize the face image, and extracting the lip feature points from the face image;
    对嘴唇特征点进行三角化处理得到嘴唇轮廓区域;Triangulating the lip feature points to obtain the lip contour area;
    以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域。The lip contour area is white, and the lip outline area is black, and the lip contour area is blurred to generate a lip rendering area.
  5. 如权利要求4所述的嘴唇渲染颜色的方法,其特征在于,所述对嘴唇特征点进行三角化处理得到嘴唇轮廓区域的步骤包括:The method for rendering a color of a lip according to claim 4, wherein the step of triangulating the lip feature point to obtain a lip contour region comprises:
    根据嘴唇特征点中内圈点的分布状态判断嘴唇是否处于张开状态;Whether the lips are in an open state according to the distribution state of the inner circle points in the feature points of the lips;
    当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域;When the lips are not in the open state, the outer circle points in the lip feature points are triangulated to obtain the lip contour area;
    当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓区域。When the lips are in the open state, the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour area.
  6. 一种嘴唇渲染颜色的装置,其特征在于,包括: A device for rendering a color of a lip, comprising:
    区域模块,用于对图像进行识别确定嘴唇渲染区域;a region module for identifying an image to determine a lip rendering area;
    渲染模块,用于根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;及a rendering module, configured to generate a colored lip layer by coloring the lip rendering area according to the color number information; and
    从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;及Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer; and
    根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
  7. 如权利要求6所述的嘴唇渲染颜色的装置,其特征在于,所述渲染模块包括:The apparatus for rendering a color of a lip according to claim 6, wherein the rendering module comprises:
    取色单元,用于获取着色嘴唇图层的像素值小于预设阈值的浅像素位置信息,将变亮混合图层中与浅像素位置对应的像素值作为第一像素;a color picking unit, configured to obtain shallow pixel position information that the pixel value of the colored lip layer is less than a preset threshold, and to change a pixel value corresponding to the shallow pixel position in the mixed layer as the first pixel;
    混色单元,用于将着色图层中大于或等于预设阈值的像素值与高光嘴唇图层中对应的像素值根据预设算法进行叠加混合得到第二像素;a color mixing unit, configured to superimpose a pixel value greater than or equal to a preset threshold in the coloring layer and a corresponding pixel value in the highlight lip layer according to a preset algorithm to obtain a second pixel;
    渲染单元,用于将第一像素与第二像素渲染到图像上得到效果图。a rendering unit, configured to render the first pixel and the second pixel onto the image to obtain an effect diagram.
  8. 如权利要求6所述的嘴唇渲染颜色的装置,其特征在于,所述渲染模块,还用于将嘴唇渲染区域各像素的像素值与色号信息中的像素值相乘得到着色嘴唇图层。The apparatus for rendering a color of a lip according to claim 6, wherein the rendering module is further configured to multiply a pixel value of each pixel of the lip rendering area by a pixel value in the color number information to obtain a colored lip layer.
  9. 如权利要求6至8中任一项所述的嘴唇渲染颜色的装置,其特征在于,所述区域模块包括:The apparatus for rendering a color of a lip according to any one of claims 6 to 8, wherein the area module comprises:
    取点单元,用于对图像进行人脸检测以识别人脸图像,从人脸图像中提取嘴唇特征点;a point taking unit for performing face detection on the image to recognize the face image, and extracting the lip feature point from the face image;
    区域单元,用于对嘴唇特征点进行三角化处理得到嘴唇轮廓区域;a region unit for triangulating the lip feature points to obtain a lip contour region;
    模糊单元,用于以嘴唇轮廓区域内为白色、嘴唇轮廓区域外为黑色,对嘴唇轮廓区域进行模糊处理,生成嘴唇渲染区域;The blur unit is configured to white the lip contour area and black outside the lip contour area, and blur the lip contour area to generate a lip rendering area;
    所述区域单元,还用于根据嘴唇特征点中内圈点的分布状态判断嘴唇是否处于张开状态;及The area unit is further configured to determine whether the lips are in an open state according to a distribution state of the inner circle points in the feature points of the lips; and
    当嘴唇不处于张开状态时,对嘴唇特征点中的外圈点进行三角化处理得到嘴唇轮廓区域;及When the lips are not in the open state, the outer circle points in the lip feature points are triangulated to obtain the lip contour area;
    当嘴唇处于张开状态时,以外圈点和内圈点组合的方式进行三角化处理得到嘴唇轮廓区域。When the lips are in the open state, the outer circle points and the inner circle points are combined to triangulate to obtain the lip contour area.
  10. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
    其中,所述处理器被配置为:Wherein the processor is configured to:
    对图像进行识别确定嘴唇渲染区域; Identifying the image to determine the lip rendering area;
    根据色号信息对嘴唇渲染区域上色生成着色嘴唇图层;Coloring the lip rendering area according to the color number information to generate a colored lip layer;
    从图像中提取嘴唇渲染区域对应的初始嘴唇图层,对初始嘴唇图层灰度化后调整色阶得到高光嘴唇图层,将高光嘴唇图层与图像所在图层进行变亮混合得到变亮混合图层;Extract the initial lip layer corresponding to the lip rendering area from the image, adjust the color gradation after the initial lip layer is grayed out to obtain a highlight lip layer, and brighten and blend the highlight lip layer with the image layer to obtain a brightening blend. Layer
    根据预设算法将变亮混合图层与着色嘴唇图层进行叠加混合,得到嘴唇渲染颜色后的效果图。 According to the preset algorithm, the brightened mixed layer is superimposed and blended with the colored lip layer to obtain an effect diagram after the lip renders the color.
PCT/CN2017/104367 2017-05-05 2017-09-29 Lip color rendering method, apparatus, and electronic device WO2018201662A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710312352.4 2017-05-05
CN201710312352.4A CN107229905B (en) 2017-05-05 2017-05-05 Method and device for rendering color of lips and electronic equipment

Publications (1)

Publication Number Publication Date
WO2018201662A1 true WO2018201662A1 (en) 2018-11-08

Family

ID=59934218

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/104367 WO2018201662A1 (en) 2017-05-05 2017-09-29 Lip color rendering method, apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN107229905B (en)
WO (1) WO2018201662A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111738914A (en) * 2020-07-29 2020-10-02 腾讯科技(深圳)有限公司 Image processing method, image processing device, computer equipment and storage medium
CN112308944A (en) * 2019-07-29 2021-02-02 丽宝大数据股份有限公司 Augmented reality display method of simulated lip makeup
CN112767285A (en) * 2021-02-23 2021-05-07 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN112954206A (en) * 2021-02-05 2021-06-11 上海富彭展览展示服务有限公司 Virtual makeup display method, system, device and storage medium thereof
CN113476844A (en) * 2021-07-05 2021-10-08 网易(杭州)网络有限公司 Special effect processing method and device in game, electronic equipment and storage medium
CN113763109A (en) * 2021-02-03 2021-12-07 北京沃东天骏信息技术有限公司 Article recommendation method, device, equipment and storage medium
CN113781464A (en) * 2021-09-17 2021-12-10 平安科技(深圳)有限公司 Lip dryness detecting method and device, computer equipment and storage medium
CN112037123B (en) * 2019-11-27 2023-08-08 腾讯科技(深圳)有限公司 Lip makeup special effect display method, device, equipment and storage medium

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108073930A (en) * 2017-11-17 2018-05-25 维库(厦门)信息技术有限公司 A kind of target detection and tracking based on multiple irregular ROI
CN108062510B (en) * 2017-11-17 2022-02-11 维库(厦门)信息技术有限公司 Multi-target tracking result real-time dynamic display method and computer equipment
CN107945188A (en) * 2017-11-20 2018-04-20 北京奇虎科技有限公司 Personage based on scene cut dresss up method and device, computing device
CN108846320A (en) * 2018-05-25 2018-11-20 广州久邦世纪科技有限公司 A kind of image processing method that lip color colours automatically and its system
CN108875594B (en) * 2018-05-28 2023-07-18 腾讯科技(深圳)有限公司 Face image processing method, device and storage medium
CN108874145B (en) * 2018-07-04 2022-03-18 深圳美图创新科技有限公司 Image processing method, computing device and storage medium
CN110728618B (en) * 2018-07-17 2023-06-27 淘宝(中国)软件有限公司 Virtual makeup testing method, device, equipment and image processing method
CN111507143B (en) * 2019-01-31 2023-06-02 北京字节跳动网络技术有限公司 Expression image effect generation method and device and electronic equipment
CN109887062B (en) * 2019-03-14 2023-05-16 网易(杭州)网络有限公司 Rendering method, device, equipment and storage medium
CN110738626B (en) * 2019-10-24 2022-06-28 广东三维家信息科技有限公司 Rendering graph optimization method and device and electronic equipment
CN113450367A (en) * 2020-03-24 2021-09-28 北京字节跳动网络技术有限公司 Image processing method and device
CN111881850A (en) * 2020-07-30 2020-11-03 云知声智能科技股份有限公司 Lipstick color testing method, device and equipment
CN111986131B (en) * 2020-07-31 2024-03-12 北京达佳互联信息技术有限公司 Image synthesis method and device and electronic equipment
CN112837405A (en) * 2020-12-04 2021-05-25 佛山欧神诺云商科技有限公司 Dynamic modeling implementation method, electronic device and storage medium
CN113920207B (en) * 2021-09-28 2023-07-11 海南电网有限责任公司澄迈供电局 Power failure plan analysis system
CN114119848A (en) * 2021-12-05 2022-03-01 北京字跳网络技术有限公司 Model rendering method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1475969A (en) * 2002-05-31 2004-02-18 ��˹���´﹫˾ Method and system for intensify human image pattern
CN102332170A (en) * 2011-07-26 2012-01-25 深圳市万兴软件有限公司 Method and system for generating computer sketch images
CN103077368A (en) * 2011-10-25 2013-05-01 上海银晨智能识别科技有限公司 Method and device for positioning mouth part of human face image as well as method and system for recognizing mouth shape
CN103914699A (en) * 2014-04-17 2014-07-09 厦门美图网科技有限公司 Automatic lip gloss image enhancement method based on color space
CN106251191A (en) * 2016-07-15 2016-12-21 深圳市金立通信设备有限公司 The display control method of a kind of terminal screen and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8214766B1 (en) * 2008-07-09 2012-07-03 Adobe Systems Incorporated Method and system for preview control for image adjustment
US9230312B2 (en) * 2010-01-27 2016-01-05 Adobe Systems Incorporated Methods and apparatus for performing tone mapping on high dynamic range images

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1475969A (en) * 2002-05-31 2004-02-18 ��˹���´﹫˾ Method and system for intensify human image pattern
CN102332170A (en) * 2011-07-26 2012-01-25 深圳市万兴软件有限公司 Method and system for generating computer sketch images
CN103077368A (en) * 2011-10-25 2013-05-01 上海银晨智能识别科技有限公司 Method and device for positioning mouth part of human face image as well as method and system for recognizing mouth shape
CN103914699A (en) * 2014-04-17 2014-07-09 厦门美图网科技有限公司 Automatic lip gloss image enhancement method based on color space
CN106251191A (en) * 2016-07-15 2016-12-21 深圳市金立通信设备有限公司 The display control method of a kind of terminal screen and terminal

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112308944A (en) * 2019-07-29 2021-02-02 丽宝大数据股份有限公司 Augmented reality display method of simulated lip makeup
EP3772038A1 (en) * 2019-07-29 2021-02-03 Cal-Comp Big Data Inc Augmented reality display method of simulated lip makeup
CN112037123B (en) * 2019-11-27 2023-08-08 腾讯科技(深圳)有限公司 Lip makeup special effect display method, device, equipment and storage medium
CN111738914A (en) * 2020-07-29 2020-10-02 腾讯科技(深圳)有限公司 Image processing method, image processing device, computer equipment and storage medium
CN111738914B (en) * 2020-07-29 2023-09-12 腾讯科技(深圳)有限公司 Image processing method, device, computer equipment and storage medium
CN113763109A (en) * 2021-02-03 2021-12-07 北京沃东天骏信息技术有限公司 Article recommendation method, device, equipment and storage medium
CN112954206A (en) * 2021-02-05 2021-06-11 上海富彭展览展示服务有限公司 Virtual makeup display method, system, device and storage medium thereof
CN112767285A (en) * 2021-02-23 2021-05-07 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN112767285B (en) * 2021-02-23 2023-03-10 北京市商汤科技开发有限公司 Image processing method and device, electronic device and storage medium
CN113476844A (en) * 2021-07-05 2021-10-08 网易(杭州)网络有限公司 Special effect processing method and device in game, electronic equipment and storage medium
CN113781464A (en) * 2021-09-17 2021-12-10 平安科技(深圳)有限公司 Lip dryness detecting method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN107229905A (en) 2017-10-03
CN107229905B (en) 2020-08-11

Similar Documents

Publication Publication Date Title
WO2018201662A1 (en) Lip color rendering method, apparatus, and electronic device
EP3144899B1 (en) Apparatus and method for adjusting brightness of image
CN107771336B (en) Feature detection and masking in images based on color distribution
US9142054B2 (en) System and method for changing hair color in digital images
KR101554403B1 (en) Image processing device, image processing method, and recording medium for control program
Du et al. Saliency-guided color-to-gray conversion using region-based optimization
US20110311134A1 (en) Image masks generated from local color models
Li et al. A multi-scale fusion scheme based on haze-relevant features for single image dehazing
TW200402231A (en) Method and system for enhancing portrait images
JP2016514305A (en) Multispectral imaging system for shadow detection and attenuation
EP3358523B1 (en) A system and method for illumination correction of colored overlays on an image
WO2023005743A1 (en) Image processing method and apparatus, computer device, storage medium, and computer program product
Meylan Tone mapping for high dynamic range images
CN116563570B (en) Color recognition method and device, electronic equipment and storage medium
Finlayson et al. Lookup-table-based gradient field reconstruction
JP6711020B2 (en) Image processing apparatus, image processing method, image processing system and program
US20060257023A1 (en) Method and system for image border color selection
Murali et al. A survey on shadow removal techniques for single image
US8086060B1 (en) Systems and methods for three-dimensional enhancement of two-dimensional images
EP3195251B1 (en) Method to enhance contrast with reduced visual artifacts
CN109859258B (en) Interface processing method and device and electronic equipment
Kiyokawa et al. Luminance edge is a cue for glossiness perception based on low-luminance specular components
CN114596213A (en) Image processing method and device
Salvador Shadow segmentation and tracking in real-world conditions
Chamaret et al. Harmony-guided image editing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17908130

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS (EPO FORM 1205A DATED 26.03.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17908130

Country of ref document: EP

Kind code of ref document: A1