A facial whitening image processing method, device, medium and equipment
By performing light and dark replacement, weighted fusion and color adjustment on portrait images, and combining lookup table technology, facial skin and teeth areas are whitened separately, solving the problems of unnatural whitening effects and strong filtering in the existing technology, achieving high-quality facial whitening effects.
Patent Information
- Application Number
- CN202111470958.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-12-03
- Filing Date
- 2021-12-03
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-12-03
AI Technical Summary
When the prior art whitens portraits, it is difficult to adjust the skin area, which affects the color of the image background. The whitening effect has a strong filtering feeling, making it difficult to achieve the ideal photo editing effect.
By extracting the target image, the facial skin image is replaced with a one-dimensional lookup table, then the original color value and the replaced color value are weighted and fused, and whitening is performed according to the preset fine-tuning weight. At the same time, the whitening image is adjusted using a two-dimensional lookup table, and the mouth area is extracted from the face image, and the teeth are whitened through the third lookup table.
It realizes that only whitening of the facial skin area does not affect the background color of the image, nor changes the color of other areas. The whitening effect is natural and has no filter feeling. At the same time, local whitening is optimized for the tooth area, improving the overall whitening effect.
Smart Images

Figure CN114596214B_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the China Patent Office on December 3, 2020, with application number 202011396247.1 and invention name “A facial whitening image processing method, device, medium and equipment”, the entire contents of which are incorporated by reference in this application. Technical Field
[0002] The present disclosure relates to the field of image processing technology, and more specifically, to a facial whitening image processing method, device, medium and equipment. Background Art
[0003] Whitening a portrait is a common photo editing operation for beauty lovers. Manual photo editing requires first cutting out the skin area of the portrait, then adjusting the skin color, and finally smoothing the edge area to make the transition between the skin area and other areas harmonious and natural. Such photo editing operations often require certain photo editing skills, and editing a photo takes a lot of time, which is not friendly to most beauty lovers.
[0004] At present, filters are generally used to whiten portraits, that is, by adjusting the color of the entire image. However, this method is often difficult to adjust the skin area, affects the color of the image background, and has a strong filter feeling, making it difficult to achieve the ideal photo editing effect. Summary of the invention
[0005] In order to solve the technical problem that the existing technology whitens the entire image, the whitening effect has a strong filter feeling and the whitening effect is poor. The present disclosure provides a facial whitening image processing method, comprising:
[0006] Extract the target image;
[0007] According to the color value of the pixel in the target image, searching for the corresponding color value in the lookup table, and replacing the color value of the pixel in the target image with the searched color value;
[0008] Performing at least one fusion process on the original color value and the replaced color value of the pixel in the target image;
[0009] According to the target image after fusion processing and the preset fine-tuning weight, the target image is whitened.
[0010] Further, the target image data is a facial skin image, and searching for a corresponding color value in a lookup table according to a color value of a pixel in the target image, and replacing the color value of the pixel in the target image with the searched color value, comprises:
[0011] The facial skin image is light-dark replaced by a first lookup table to obtain replaced image data, wherein the first lookup table is a one-dimensional image lookup table with a gradual gradient from black to white.
[0012] Further, performing light and dark replacement on the facial skin image by using a first lookup table to obtain replaced image data includes:
[0013] Acquire color values of pixels from the facial skin image;
[0014] Determine the color value as the one-dimensional coordinate to be searched;
[0015] Query the color value at the one-dimensional coordinate in the first lookup table;
[0016] The color value of the pixel in the facial skin image is replaced by the color value at the one-dimensional coordinate.
[0017] Furthermore, the performing at least one fusion process on the original color value of the pixel point in the target image and the replaced color value includes:
[0018] The original color value of the pixel in the facial skin image and the replaced color value are weightedly fused.
[0019] Furthermore, the whitening process is performed on the target image according to the fused target image and the preset fine-tuning weight, including:
[0020] According to the preset fine-tuning weights, weighted fusion is performed on the color values of the pixels in the fused facial skin image and the color values of the pixels in the original facial skin image.
[0021] Furthermore, after whitening the target image according to the fused target image and the preset fine-tuning weight, the method further includes:
[0022] The second lookup table is used to adjust the color of the facial skin image after whitening. The second lookup table is a two-dimensional color lookup table composed of multiple color pictures. The color pictures in the second lookup table are arranged in a gradient order from dark to light from left to right and from top to bottom.
[0023] Further, the color adjustment of the facial skin image after the whitening process is performed using the second lookup table, comprising:
[0024] Obtaining RGB three-channel color values of pixel points from the facial skin image after whitening processing;
[0025] According to the color values of the RGB three channels of the pixel point, query the corresponding three-channel color values in the second lookup table;
[0026] The three-channel color values of the pixels in the facial skin image after the whitening process are replaced with the queried three-channel color values.
[0027] Furthermore, the method further comprises:
[0028] Acquire a face image to be processed, and identify and locate key point data in the face image;
[0029] Determining a mouth area from the face image according to the key point data;
[0030] Acquire a template material, and fit the template material to a blank texture by indexing according to the pixel coordinates of the mouth area;
[0031] Based on the texture data of the template material, teeth whitening processing is performed on the mouth area in the face image corresponding to the template material.
[0032] Further, the teeth whitening process is performed on the mouth area in the face image corresponding to the template material based on the texture data of the template material, including:
[0033] Based on the texture data of the template material, querying the color value corresponding to each pixel in the mouth area in a third lookup table;
[0034] The current color value of each pixel in the mouth area of the face image is replaced by the color value corresponding to each pixel obtained by querying.
[0035] Furthermore, the step of searching the third lookup table for the color value corresponding to each pixel in the mouth area based on the texture data of the template material includes:
[0036] Acquire a channel value of a preset color channel of a first pixel from a blank texture to which the template material is attached, wherein the first pixel is any pixel in the template material;
[0037] Calculating a first coordinate and a second coordinate corresponding to the first pixel point according to the acquired channel value;
[0038] Determine a first color value of the RGB three channels corresponding to the first coordinate and a second color value of the RGB three channels corresponding to the second coordinate;
[0039] respectively searching in a third lookup table a third color value corresponding to the first color value and a fourth color value corresponding to the second color value;
[0040] An average color value of the third color value and the fourth color value found out is determined as the color value after whitening processing corresponding to the first pixel.
[0041] In order to achieve the above technical objectives, the present disclosure also provides a facial whitening image processing device, comprising:
[0042] A data extraction module, used for extracting a target image;
[0043] A data adjustment module, configured to search a lookup table for a corresponding color value according to a color value of a pixel in the target image, and replace the color value of the pixel in the target image with the searched color value;
[0044] A fusion adjustment module, used for performing at least one fusion process on the original color value of the pixel point in the target image and the replaced color value;
[0045] The fine-tuning processing module is used to perform whitening processing on the target image according to the target image after fusion processing and preset fine-tuning weights.
[0046] In order to achieve the above technical objectives, the present disclosure also provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to implement the steps of the above facial whitening image processing method.
[0047] To achieve the above technical objectives, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above facial whitening image processing method when executing the computer program.
[0048] The beneficial effects of the present disclosure are:
[0049] The present disclosure provides a facial whitening image processing method, device, medium and equipment, which brightens the facial skin image through a first lookup table, and adjusts the color of the facial skin image through a second lookup table, so that only the facial skin area is whitened, which will not affect the color of the entire image background, nor will it change the color of the eyes, hair, eyebrows, lips and other parts. And the mouth area is extracted from the face image, and the teeth whitening process is performed only on the mouth area through a third lookup table, which will not affect other areas of the face. The skin area and the teeth area are whitened separately, so that the whitened image has no filter feeling, the whitening effect is very good, and it is more natural visually.
[0050] Based on the actual needs of users, the LUT lookup table technology is used to adjust the brightness and replace the color of the facial image taken by the user, thereby achieving a more realistic whitening effect. At the same time, the present invention also performs local whitening optimization for the user's teeth to better meet the user's whitening needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram showing a process flow of a facial whitening image processing method provided by an embodiment of the present disclosure;
[0052] Figure 2 Another schematic diagram of a facial whitening image processing method provided by an embodiment of the present disclosure is shown;
[0053] Figure 3 A schematic diagram showing a first lookup table provided in an embodiment of the present disclosure is shown;
[0054] Figure 4 A schematic diagram of a second lookup table provided in an embodiment of the present disclosure is shown;
[0055] Figure 5 A schematic diagram of performing color lookup in a second lookup table provided by an embodiment of the present disclosure is shown;
[0056] Figure 6 A schematic diagram showing a process flow of a teeth whitening treatment provided by an embodiment of the present disclosure is shown;
[0057] Figure 7 A schematic diagram showing facial key point data provided by an embodiment of the present disclosure is shown;
[0058] Figure 8 A schematic diagram showing the method of fitting a template material into a blank texture map by indexing provided by an embodiment of the present disclosure is shown;
[0059] Fig. 9 A schematic diagram showing a third lookup table provided in an embodiment of the present disclosure is shown;
[0060] Fig.10 A structural schematic diagram of a facial whitening image processing device provided by an embodiment of the present disclosure is shown;
[0061] Fig.11 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0062] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0063] Various structural schematic diagrams according to embodiments of the present disclosure are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may further design regions / layers with different shapes, sizes, and relative positions according to actual needs.
[0064] Explanation of terms involved in this disclosure:
[0065] LUT: LUT refers to the Look-Up Table, which is essentially a RAM. After the data is written into the RAM in advance, every time a signal is input, it is equivalent to inputting an address to look up the table, find out the content corresponding to the address, and then output it.
[0066] LUT has a wide range of applications. For example, LUT (Look-Up Table) can be applied to a pixel grayscale mapping table. It transforms the actual sampled pixel grayscale value into another corresponding grayscale value after certain transformations such as threshold, inversion, binarization, contrast adjustment, linear transformation, etc., which can highlight the useful information of the image and enhance the light contrast of the image. Many PC series cards have 8 / 10 / 12 / 16 or even 32-bit LUTs. The specific transformation in the LUT is defined by the software. The most important significance of LUT here is that it is compatible with the high-level display functions of ordinary monitors, so that those wide color gamuts (generally referring to those exceeding sRGB) that cannot be displayed by ordinary monitors can be roughly simulated on ordinary monitors as much as possible. However, the effect simulated by LUT can only be used as a reference and as a general look and feel when retouching. The best and most complete presentation is still the high consistency of various indicators of the monitor, graphics card and the material itself, the so-called "hard decoding".
[0067] The full name of LUT is Look Up Table, which is translated into Chinese as a lookup table. It is equivalent to a discrete function. Given an input value, an output value is obtained through a lookup table. Lookup tables can be used in many places. In the field of color adjustment, they are called color lookup tables. Color lookup tables have three components: R, G, and B. In this article, the input component is called: R in , G in , B in; The output component is called R out , G out , B out The input and output are in a one-to-one correspondence. The system finds the output value for each input value based on the correspondence in the lookup table, thereby completing the color conversion.
[0068] LUT can be divided into 1D LUT and 3D LUT based on the search method. The conversion formula is as follows:
[0069] 1.1 1D LUT:
[0070] R out =F LUT (R in )
[0071] G out =F LUT (G in )
[0072] B out =F LUT (B in )
[0073] From the formula, we can see that the RGB data in 1D LUT are independent of each other and can only affect the brightness of R, G, and B respectively. It can control the Gamma value and balance the RGB color.
[0074] The amount of data contained in a system with a color depth of 10 bits is relatively small.
[0075] 1.2 3D LUT:
[0076]
[0077]
[0078]
[0079] Judging from the formula, the scope of influence of 3D LUT is more profound. Each color component of RGB is related to the three input components. 3D LUT can affect hue, saturation, brightness, etc., and can almost affect every aspect of the picture.
[0080] The data contained in a system with a color depth of 10 bits is huge, so 3D LUT is usually stored by listing nodes. The data between two nodes is calculated by the difference method, so the number of nodes is a sign of the accuracy of 3D LUT. The maximum number of nodes currently supported by the color management system is 257.
[0081] Embodiment 1:
[0082] like Figure 1 As shown, the present disclosure provides a facial whitening image processing method, comprising:
[0083] S101: extracting a target image;
[0084] S102: searching for a corresponding color value in a lookup table according to the color value of a pixel in the target image, and replacing the color value of the pixel in the target image with the searched color value;
[0085] S103: performing at least one fusion process on the original color value and the replaced color value of the pixel in the target image;
[0086] S104: performing whitening processing on the target image according to the fused target image and the preset fine-tuning weight.
[0087] The target image is specifically a facial skin image. In step S101, a facial image to be processed may be first obtained, all facial key points in the facial image may be identified, and a facial skin image may be subtracted from the facial image based on the identified facial key points.
[0088] like Figure 2 As shown, the S102 specifically includes S1021: performing light and dark replacement on the facial skin image through a first lookup table to obtain replaced image data.
[0089] It should be noted that the first lookup table referred to in the present disclosure is a one-dimensional color lookup table with a gradual gradient from black to white. Figure 3 shown.
[0090] Specifically, for each pixel in the facial skin image extracted in S101, a color value of the pixel is obtained from the facial skin image, where the color value of the pixel is a value between 0 and 255. The color value is determined as the one-dimensional coordinate to be searched. The color value at the one-dimensional coordinate is searched in a first lookup table. The color value of the pixel in the facial skin image is replaced with the color value at the one-dimensional coordinate found.
[0091] For example, if the color value of a pixel in the facial skin image is x, then the corresponding one-dimensional coordinate is (x, 1.0). Look up the color value y at the coordinate (x, 1.0) in the first lookup table. Replace the color value of the pixel in the facial skin image from x to y.
[0092] Furthermore, the S103 specifically includes S1031: performing weighted fusion on the original color values of the pixels in the facial skin image and the replaced color values.
[0093] Specifically, the weighted fusion is performed according to the following formula:
[0094] C2=C*a+C1*(1-a), where C2 represents the color value of the pixel after fusion, C1 represents the color value of the pixel after the facial skin image is replaced, that is, the color value corresponding to the pixel found in the first lookup table, and C represents the original color value of the pixel in the facial skin image. a is a weighting coefficient, and the value of a can be 0.5, 0.6, etc.
[0095] By the above method, the color value of each pixel in the facial skin image is replaced with the corresponding color value found in the first lookup table. Then, according to the above weighted fusion formula, the replaced facial skin image is fused with the original facial skin image, so that the color value of each pixel in the fused facial skin image is the weighted sum of the replaced color value and the color value before the replacement. The facial skin image is replaced with light and dark by the first lookup table, the brightness of the facial skin image is improved, and the effect of brightening the facial skin is achieved.
[0096] After the above fusion process, the fused facial skin image is fused with weight coefficients. S104 specifically includes S1041: weighted fusion of the color values of the pixels in the fused facial skin image and the original facial skin image according to the preset fine-tuning weights.
[0097] Specifically, the fusion is performed according to the following formula:
[0098] C3=C*(1.0-D)+C2*D, where D represents the preset fine-tuning weight, C2 represents the color value of the pixel after fusion in S103, and C3 represents the color value of the pixel after fusion in S104.
[0099] After brightening the facial skin image through the first lookup table, the color of the original facial skin image is merged with the brightened color according to the preset fine-tuning weight. In this way, the facial skin image can be whitened to a certain extent through the preset fine-tuning weight. The preset fine-tuning weight is equivalent to the whitening degree. The value range of the preset fine-tuning weight is 0-1, 0 means no whitening, and 1 is the maximum whitening.
[0100] After whitening the facial skin image according to the preset fine-tuning weights, Figure 2As shown, it also includes S105: using a second lookup table to adjust the color of the facial skin image after the whitening process. It should be noted that the second lookup table referred to in the present disclosure is a two-dimensional color lookup table composed of multiple color images, such as a lookup table composed of multiple color images arranged four by four. The upper left vertex of the color image located in the upper left corner of the second lookup table is black, and the lower right vertex of the color image located in the lower right corner is white. In the second lookup table, the color images are arranged in a gradient order from dark to light from left to right and from top to bottom, as shown in FIG. Figure 4 shown.
[0101] For each pixel in the facial skin image after whitening, obtain the RGB three-channel color value of the pixel from the facial skin image after whitening. According to the color value of the RGB three-channel of the pixel, query the corresponding three-channel color value in the second lookup table. That is, according to the value of the R channel of the pixel, query the corresponding R channel value in the second lookup table. According to the value of the G channel of the pixel, query the corresponding G channel value in the second lookup table. And, according to the value of the B channel of the pixel, query the corresponding B channel value in the second lookup table.
[0102] like Figure 5 As shown, RGB output = LUT (R input, G input, B input). If the input RGB three-channel values are (50,50,50), the output three-channel values are (70,70,70). If the input three-channel values are (50,70,50), the output three-channel values are (85,90,70). If the input three-channel values are (50,70,60), the output three-channel values are (90,95,80).
[0103] For each pixel in the facial skin image after whitening processing, the corresponding three-channel value is queried in the second lookup table in the above manner, and then the current three-channel color value of the pixel in the facial skin image after whitening processing is replaced by the queried three-channel color value.
[0104] The color values of the pixels in the facial skin image after whitening are replaced by the second lookup table to further whiten the facial skin image. The multiple color images arranged in the second lookup table can adjust the red and yellow colors in the facial skin image, and the whitening effect is better for facial skin images with reddish and yellowish colors.
[0105] Through the above steps S101-S104 and S105, the color replacement operation is performed through the second lookup table, and the whitening process of the facial skin image is completed. Subsequently, the facial skin image obtained by the final processing is re-integrated with the facial features image previously segmented into a face image, that is, the face image after face whitening is obtained. In this way, only the facial skin is whitened, and the color of the eyes, eyebrows, lips, hair and other areas will not be changed, so that the facial whitening process is more targeted and the whitening effect is more natural.
[0106] Embodiment 2:
[0107] Considering that users have an increasing demand for teeth whitening, and after whitening the facial skin in the manner of the above embodiment, if the color difference between the tooth area and the facial skin is large, it will reduce the overall visual effect of the face image. Based on this, the facial whitening image processing method provided by the present disclosure can also whiten the tooth area. Figure 6 As shown, teeth whitening treatment is carried out through the following steps:
[0108] S201: Acquire a face image to be processed, and identify and locate key point data in the face image.
[0109] like Figure 7 As shown, the key point data in the face image can be the face key points detected by a preset face key point detection model, including key points in areas such as face contour, eyes, nose, mouth, eyebrows, etc.
[0110] S202: Determine the mouth area from the face image according to the recognized key point data.
[0111] According to the facial key points located at the mouth in the recognized key point data, the mouth area is determined from the facial image. The mouth area may include an image of teeth or may not include an image of teeth.
[0112] Therefore, before performing the subsequent teeth whitening process, the embodiment of the present application can also use a preset image classification model to identify whether the mouth area in the face image contains an image of teeth. If so, the subsequent teeth whitening process will continue. If not, the subsequent teeth whitening process will not be performed, thus avoiding teeth whitening process on images that do not contain teeth.
[0113] S203: Acquire a template material, and fit the template material to the blank texture by indexing according to the pixel coordinates of the mouth area.
[0114] The template material is a mouth image with a preset color, which can be pink, red, etc. According to the pixel coordinates of the mouth area in the face image, the template material is attached to the blank texture by indexing, such as Figure 8 As shown, the position of the template material in the blank texture map is made the same as the position of the above-mentioned mouth area in the face image.
[0115] S204: Based on the texture data of the template material, perform teeth whitening processing on the mouth area in the face image corresponding to the template material.
[0116] First, based on the texture data of the template material, the color value corresponding to each pixel in the mouth area is queried in the third lookup table, and then the current color value of each pixel in the mouth area in the face image is replaced with the color value corresponding to each pixel obtained.
[0117] Specifically, a channel value of a preset color channel of a first pixel is obtained from a blank texture to which a template material is attached, and the first pixel is any pixel in the template material. The preset color channel may be any one of the three channels of R, G, and B. According to the obtained channel value, a first coordinate and a second coordinate corresponding to the first pixel are calculated. A first color value of the RGB three channels corresponding to the first coordinate and a second color value of the RGB three channels corresponding to the second coordinate are determined. A third color value corresponding to the first color value and a fourth color value corresponding to the second color value are respectively queried in a third lookup table. The average color value of the third color value and the fourth color value found is determined as the color value after whitening corresponding to the first pixel.
[0118] The above method is used to determine the color value of each pixel of the template material in the blank texture image after whitening. Then, for each pixel in the mouth area of the face image, the current pixel value of the pixel is replaced with the color value of the pixel with the same coordinates in the template material after whitening.
[0119] In order to facilitate understanding of the above process of searching for the color value corresponding to the pixel point through the third lookup table, a specific example is used to illustrate. Assuming that the preset color channel is the B channel, the B channel value of the first pixel point is obtained from the blank texture map with the template material attached, and the first coordinate and the second coordinate corresponding to the first pixel point are calculated based on the B channel value. First, calculate B1=B / 255*15, then calculate Y=floor(B1)*0.2, X=floor(B1)-Y*4, V=(X, Y) as the first coordinate corresponding to the first pixel point. Calculate Y1=ceil(B1)*0.2, X1=ceil(B1)-Y*4, V1=(X1, Y1) as the second coordinate corresponding to the first pixel point. The three-channel color values R, G, and B of the first pixel point are used as the color values of the first coordinate (X, Y). Calculate R1=R*0.234375+0.0078125, G1=G*0.234375+0.0078125, and use R1, G1, and B1 as the color values of the second coordinate (X1, Y1). Let RG(R1, G1), texPos1.XY=V*0.25+RG, and texPos2.X1Y1=V1*0.25+RG. Take texPos1.XY and texPos2.X1Y1 as the coordinates to be queried, query the color value COLOR=RGBA(texPos1.XY) at texPos1.XY in the third lookup table, and query the color value COLOR1=RGBA(texPos2.X1Y1) at texPos2.X1Y1. Calculate (COLOR+COLOR1) / 2, and use the calculated value as the color value after whitening corresponding to the first pixel. Then, the color value of the pixel point in the mouth area of the face image whose coordinates are the same as the coordinates of the first pixel point is modified to (COLOR+COLOR1) / 2.
[0120] By the above method, the mouth area is extracted separately according to the facial features of the human face, and the extracted mouth area is dyed by the template material, so as to perform a cutout process on the extracted mouth image, and the color of the cutout mouth image data is adjusted by the third lookup table. The teeth area is whitened separately, so that the facial whitening process is more targeted, and the teeth whitening process is prevented from affecting the color of other facial areas, thereby improving the effect of facial whitening.
[0121] It should be noted that the third lookup table of the present disclosure is arranged in the same manner as the second lookup table, such as a lookup table consisting of a plurality of four-by-four color images, but the third lookup table for each color image is different from the second lookup table, specifically Fig. 9If the third lookup table is applied to the above-mentioned face whitening technical solution, the entire screen will appear white and the face of the person cannot be recognized. Since the teeth are white in color, the third lookup table, which is a specialized lookup table, needs to be used.
[0122] For the face image to be processed, the facial skin is whitened by the method of embodiment 1, and the teeth are whitened in the mouth area by the method of embodiment 2, thereby improving the facial whitening effect of the face image.
[0123] In this application, the facial skin image is brightened through the first lookup table, and the color of the facial skin image is adjusted through the second lookup table, so that only the facial skin area is whitened, which will not affect the color of the entire image background, nor will it change the color of the eyes, hair, eyebrows, lips and other parts. And the mouth area is extracted from the face image, and the teeth whitening process is performed only on the mouth area through the third lookup table, which will not affect other areas of the face. The skin area and the teeth area are whitened separately, so that the whitened image has no filter feeling, the whitening effect is very good, and it is more natural visually.
[0124] Embodiment three:
[0125] like Fig.10 As shown, the present disclosure also provides a facial whitening image processing device, which is used to execute the facial whitening image processing method described in the above embodiments, and the device includes:
[0126] A data extraction module 301 is used to extract a target image;
[0127] The data adjustment module 302 is used to search for a corresponding color value in a lookup table according to the color value of a pixel in the target image, and replace the color value of the pixel in the target image with the searched color value;
[0128] A fusion adjustment module 303 is used to perform at least one fusion process on the original color value and the replaced color value of the pixel point in the target image;
[0129] The fine-tuning processing module 304 is used to perform whitening processing on the target image according to the target image after fusion processing and the preset fine-tuning weight.
[0130] The data extraction module 301 is connected to the data adjustment module 302 , the fusion adjustment module 303 and the fine-tuning processing module 304 in sequence.
[0131] Further, the target image is a facial skin image, and the data adjustment module 302 specifically includes:
[0132] The light-dark replacement module is used to perform light-dark replacement on the facial skin image through a first lookup table to obtain replaced image data, wherein the first lookup table is a one-dimensional color lookup table that gradually changes from black to white.
[0133] The light and dark replacement module is specifically used to obtain the color value of the pixel point from the facial skin image; determine the color value as the one-dimensional coordinate to be searched; query the color value at the one-dimensional coordinate in the first lookup table; and replace the color value of the pixel point in the facial skin image with the color value at the one-dimensional coordinate.
[0134] The fusion adjustment module 303 is used to perform weighted fusion on the original color values of the pixels in the facial skin image and the replaced color values.
[0135] The fine-tuning processing module 304 is used to perform weighted fusion on the color values of the pixels in the fused facial skin image and the color values of the pixels in the original facial skin image according to preset fine-tuning weights.
[0136] The device also includes: a color adjustment module, which is used to use a second lookup table to adjust the color of the facial skin image after whitening treatment. The second lookup table is a two-dimensional color lookup table composed of multiple color images. The color images in the second lookup table are arranged in a gradient order from dark to light from left to right and from top to bottom.
[0137] The color adjustment module is specifically used to obtain the RGB three-channel color values of pixels from the facial skin image after whitening processing; according to the RGB three-channel color values of the pixels, the corresponding three-channel color values are searched in the second lookup table; and the three-channel color values of the pixels in the facial skin image after whitening processing are replaced with the searched three-channel color values.
[0138] The device also includes: a teeth whitening module, which is used to obtain a face image to be processed, identify and locate key point data in the face image; determine the mouth area from the face image according to the key point data; obtain a template material, and fit the template material to a blank texture by indexing according to the pixel coordinates of the mouth area; and perform teeth whitening processing on the mouth area in the face image corresponding to the template material based on the texture data of the template material.
[0139] The teeth whitening module is used to query the color value corresponding to each pixel in the mouth area in the third lookup table based on the texture data of the template material; and replace the current color value of each pixel in the mouth area in the face image with the color value corresponding to each pixel obtained by the query.
[0140] A teeth whitening module is used to obtain a channel value of a preset color channel of a first pixel point from a blank texture with a template material affixed thereto, wherein the first pixel point is any pixel point in the template material; based on the obtained channel value, a first coordinate and a second coordinate corresponding to the first pixel point are calculated; a first color value of the RGB three-channel corresponding to the first coordinate and a second color value of the RGB three-channel corresponding to the second coordinate are determined; a third color value corresponding to the first color value and a fourth color value corresponding to the second color value are respectively searched in a third lookup table; and an average color value of the third color value and the fourth color value found out is determined as the color value after whitening corresponding to the first pixel point.
[0141] The facial whitening image processing device provided in the embodiment of the present application and the facial whitening image processing method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0142] Embodiment 4:
[0143] The present disclosure can also provide a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to implement the steps of the above-mentioned facial whitening image processing method.
[0144] The computer storage medium of the present disclosure may be implemented using semiconductor memory, magnetic core memory, magnetic drum memory or magnetic disk memory.
[0145] Semiconductor memory, mainly used in computers, has two types of semiconductor storage elements: Mos and bipolar. Mos elements have high integration, simple process but slow speed. Bipolar elements have complex process, high power consumption, low integration but fast speed. After the advent of NMos and CMos, Mos memory began to occupy a dominant position in semiconductor memory. NMos is fast, such as Intel's 1K-bit static random access memory with an access time of 45ns. CMos consumes less power, and the access time of 4K-bit CMos static memory is 300ns. The above-mentioned semiconductor memories are all random access memories (RAM), that is, new content can be read and written randomly during operation. Semiconductor read-only memory (ROM) can be read randomly but cannot be written during operation. It is used to store solidified programs and data. ROM is divided into two types: non-rewritable fuse read-only memory - PROM and rewritable read-only memory EPROM.
[0146] Magnetic core memory has the characteristics of low cost and high reliability, and has more than 20 years of practical experience. Magnetic core memory was widely used as main memory before the mid-1970s. Its storage capacity can reach more than 10 bits, and the fastest access time is 300ns. The capacity of typical magnetic core memory in the world is 4MS~8MB, and the access cycle is 1.0~1.5μs. After the rapid development of semiconductor storage to replace magnetic core memory as the main memory, magnetic core memory can still be used as a large-capacity expansion memory.
[0147] Magnetic drum storage is a magnetic recording external storage. Due to its fast information access speed and stable and reliable operation, although its capacity is small and it is gradually being replaced by disk storage, it is still used as an external storage for real-time process control computers and medium and large computers. In order to meet the needs of small and microcomputers, ultra-small magnetic drums have appeared, which are small in size, light in weight, highly reliable and easy to use.
[0148] Disk storage is a magnetic recording external storage. It has the advantages of both magnetic drum and tape storage, that is, its storage capacity is larger than that of magnetic drum, and its access speed is faster than that of tape storage. It can also be stored offline. Therefore, disks are widely used as large-capacity external storage in various computer systems. Disks are generally divided into two categories: hard disk and floppy disk storage.
[0149] There are many types of hard disk storage. From the structural point of view, it is divided into two types: removable and fixed. The removable disk platter can be replaced, while the fixed disk platter is fixed. Both removable and fixed disks have two types: multi-piece combination and single-piece structure, and can be divided into fixed head type and movable head type. Fixed head type disks have small capacity, low recording density and high access speed, but high cost. Movable head type disks have high recording density (up to 1000-6250 bits / inch), so they have large capacity, but the access speed is lower than that of fixed head disks. The storage capacity of disk products can reach hundreds of megabytes, the bit density is 6,250 bits per inch, and the track density is 475 tracks per inch. Among them, multi-piece removable disk storage has a large off-body capacity because the disk group can be replaced, and it has large capacity and high speed. It can store large amounts of intelligence data and is widely used in online intelligence retrieval systems and database management systems.
[0150] Embodiment five:
[0151] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned facial whitening image processing method when executing the computer program.
[0152] Fig.11 FIG. 1 is a schematic diagram of the internal structure of an electronic device in one embodiment. Fig.11As shown, the electronic device includes a processor, a storage medium, a memory and a network interface connected via a system bus. Among them, the storage medium of the computer device stores an operating system, a database and computer-readable instructions, and the database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor can implement a facial whitening image processing method. The processor of the electronic device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute a thread timeout fault detection method. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art can understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0153] The electronic device includes but is not limited to smart phones, computers, tablet computers, wearable smart devices, artificial intelligence devices, mobile power supplies, etc.
[0154] In some embodiments, the processor may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing programs or modules stored in the memory (for example, executing remote data reading and writing programs, etc.), and calling data stored in the memory.
[0155] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory and at least one processor, etc.
[0156] Fig.11 Only an electronic device with components is shown, and those skilled in the art will understand that Fig.11 The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0157] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0158] Furthermore, the electronic device may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
[0159] Optionally, the electronic device may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0160] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like.
[0161] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0162] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0163] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0164] The present disclosure provides a facial whitening image processing method, device, medium and equipment. Based on the actual needs of users, the LUT lookup table technology is used to adjust the brightness and replace the color of the facial image taken by the user, thereby achieving a more realistic whitening effect. At the same time, the present disclosure also performs partial whitening optimization for the user's teeth, better meeting the user's whitening needs.
[0165] The embodiments of the present disclosure are described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, a person skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A facial whitening image processing method, characterized in that: include: Extract the target image; According to the color value of the pixel in the target image, searching for the corresponding color value in the lookup table, and replacing the color value of the pixel in the target image with the searched color value; Performing at least one fusion process on the original color value of the pixel point in the target image and the replaced color value; According to the target image after fusion processing and the preset fine-tuning weight, whitening the target image; Wherein, the target image is a facial skin image, and searching for corresponding color values in a lookup table according to color values of pixels in the target image, and replacing the color values of the pixels in the target image with the searched color values, comprises: Performing light and dark replacement on the facial skin image using a first lookup table to obtain replaced image data, wherein the first lookup table is a one-dimensional color lookup table that gradually changes from black to white; The step of performing at least one fusion process on the original color value of the pixel in the target image and the replaced color value includes: Performing weighted fusion on the original color value of the pixel in the facial skin image and the replaced color value; Wherein, performing whitening processing on the target image according to the fused target image and the preset fine-tuning weights includes: According to the preset fine-tuning weights, weighted fusion is performed on the color values of the pixels in the fused facial skin image and the color values of the pixels in the original facial skin image.
2. The method according to claim 1, characterized in that The step of performing light and dark replacement on the facial skin image by using a first lookup table to obtain replaced image data includes: Acquire color values of pixels from the facial skin image; Determine the color value as the one-dimensional coordinate to be searched; Query the color value at the one-dimensional coordinate in the first lookup table; The color value of the pixel in the facial skin image is replaced by the color value at the one-dimensional coordinate.
3. The method according to claim 1, characterized in that After whitening the target image according to the fused target image and the preset fine-tuning weight, the method further includes: The second lookup table is used to adjust the color of the facial skin image after whitening. The second lookup table is a two-dimensional color lookup table composed of multiple color pictures. The color pictures in the second lookup table are arranged in a gradient order from dark to light from left to right and from top to bottom.
4. The method according to claim 3, characterized in that The step of using the second lookup table to perform color adjustment on the facial skin image after the whitening process comprises: Obtaining RGB three-channel color values of pixel points from the facial skin image after whitening processing; According to the color values of the RGB three channels of the pixel point, query the corresponding three-channel color values in the second lookup table; The three-channel color values of the pixels in the facial skin image after the whitening process are replaced with the queried three-channel color values.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Acquire a face image to be processed, and identify and locate key point data in the face image; Determining a mouth area from the face image according to the key point data; Acquire a template material, and fit the template material to a blank texture by indexing according to the pixel coordinates of the mouth area; Based on the texture data of the template material, teeth whitening processing is performed on the mouth area in the face image corresponding to the template material.
6. The method according to claim 5, characterized in that The step of performing teeth whitening processing on the mouth area in the face image corresponding to the template material based on the texture data of the template material comprises: Based on the texture data of the template material, querying the color value corresponding to each pixel in the mouth area in a third lookup table; The current color value of each pixel in the mouth area of the face image is replaced by the color value corresponding to each pixel obtained by querying.
7. The method according to claim 6, characterized in that The step of querying the color value corresponding to each pixel point in the mouth area in a third lookup table based on the texture data of the template material includes: Acquire a channel value of a preset color channel of a first pixel from a blank texture to which the template material is attached, wherein the first pixel is any pixel in the template material; Calculating a first coordinate and a second coordinate corresponding to the first pixel point according to the acquired channel value; Determine a first color value of the RGB three channels corresponding to the first coordinate and a second color value of the RGB three channels corresponding to the second coordinate; respectively searching in a third lookup table a third color value corresponding to the first color value and a fourth color value corresponding to the second color value; An average color value of the third color value and the fourth color value found out is determined as the color value after whitening processing corresponding to the first pixel.
8. A facial whitening image processing device, characterized in that: include: A data extraction module, used for extracting a target image; A data adjustment module, configured to search a lookup table for a corresponding color value according to a color value of a pixel in the target image, and replace the color value of the pixel in the target image with the searched color value; A fusion adjustment module, used for performing at least one fusion process on the original color value of the pixel point in the target image and the replaced color value; A fine-tuning processing module, used for whitening the target image according to the target image after fusion processing and a preset fine-tuning weight; Wherein, the target image is a facial skin image, and searching for corresponding color values in a lookup table according to color values of pixels in the target image, and replacing the color values of the pixels in the target image with the searched color values, comprises: Performing light and dark replacement on the facial skin image using a first lookup table to obtain replaced image data, wherein the first lookup table is a one-dimensional color lookup table that gradually changes from black to white; The step of performing at least one fusion process on the original color value of the pixel in the target image and the replaced color value includes: Performing weighted fusion on the original color value of the pixel in the facial skin image and the replaced color value; Wherein, performing whitening processing on the target image according to the fused target image and the preset fine-tuning weights includes: According to the preset fine-tuning weights, weighted fusion is performed on the color values of the pixels in the fused facial skin image and the color values of the pixels in the original facial skin image.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the facial whitening image processing method described in any one of claims 1 to 7 are implemented.
10. A computer storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, they are used to implement the steps corresponding to the facial whitening image processing method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Image processing apparatus, image processing method, and lookup table generation method
CN102065204A
Face key point-based automatic under-eye bag removing method and system
CN105608722A