WO2023005850A1 - Image processing method and apparatus, and electronic device, storage medium and computer program product - Google Patents
Image processing method and apparatus, and electronic device, storage medium and computer program product Download PDFInfo
- Publication number
- WO2023005850A1 WO2023005850A1 PCT/CN2022/107455 CN2022107455W WO2023005850A1 WO 2023005850 A1 WO2023005850 A1 WO 2023005850A1 CN 2022107455 W CN2022107455 W CN 2022107455W WO 2023005850 A1 WO2023005850 A1 WO 2023005850A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- color
- target
- beautification
- parameter
- lookup table
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 30
- 238000004590 computer program Methods 0.000 title claims abstract description 20
- 238000000034 method Methods 0.000 claims abstract description 59
- 238000012545 processing Methods 0.000 claims description 80
- 230000001795 light effect Effects 0.000 claims description 19
- 239000002184 metal Substances 0.000 claims description 5
- 229910052751 metal Inorganic materials 0.000 claims description 5
- 230000001815 facial effect Effects 0.000 abstract description 4
- 239000003086 colorant Substances 0.000 description 30
- 238000010586 diagram Methods 0.000 description 30
- 230000000694 effects Effects 0.000 description 16
- 230000008569 process Effects 0.000 description 16
- 238000012790 confirmation Methods 0.000 description 9
- 230000006870 function Effects 0.000 description 8
- 230000004044 response Effects 0.000 description 8
- 239000013077 target material Substances 0.000 description 7
- 238000004891 communication Methods 0.000 description 5
- 230000003993 interaction Effects 0.000 description 5
- 239000000463 material Substances 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000005236 sound signal Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000001914 filtration Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000003796 beauty Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000004927 fusion Effects 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 239000010421 standard material Substances 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- KLDZYURQCUYZBL-UHFFFAOYSA-N 2-[3-[(2-hydroxyphenyl)methylideneamino]propyliminomethyl]phenol Chemical compound OC1=CC=CC=C1C=NCCCN=CC1=CC=CC=C1O KLDZYURQCUYZBL-UHFFFAOYSA-N 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 201000001098 delayed sleep phase syndrome Diseases 0.000 description 1
- 208000033921 delayed sleep phase type circadian rhythm sleep disease Diseases 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000004043 dyeing Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 210000004709 eyebrow Anatomy 0.000 description 1
- 210000000720 eyelash Anatomy 0.000 description 1
- 210000000887 face Anatomy 0.000 description 1
- 210000004209 hair Anatomy 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000002932 luster Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003020 moisturizing effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0012—Biomedical image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
- G06T2207/30201—Face
Definitions
- the present disclosure relates to the field of computer vision, and in particular to an image processing method and device, electronic equipment, storage media and computer program products.
- Lip makeup refers to the beauty makeup of the lips.
- the lips after lip makeup modification are generally pure and shiny.
- processing images containing lips to obtain images processed by lip makeup has become more and more widely used in people's daily life.
- users are not satisfied with only obtaining the processed image of lip makeup based on several colors provided.
- Embodiments of the present disclosure provide an image processing method and device, electronic equipment, a storage medium, and a computer program product.
- an image processing method including: receiving a beautification operation on a target part of a human face image; based on the beautification color parameters of the target part input in the beautification operation, generating and A target color lookup table for matching the beautification color parameters; generating a beautified face image according to the original color of pixels in the target part of the face image and the target color lookup table.
- an image processing device including: a receiving module configured to receive a beautification operation on a target part of a human face image; a generating module configured to based on the beautification operation input The beautification color parameter of the target part generates a target color lookup table matching the beautification color parameter; the beautification module is configured to look up the target color according to the original color of the pixel in the target part of the face image, Generate beautified face images.
- an electronic device including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to: execute the above image processing method.
- a computer-readable storage medium on which computer program instructions are stored, and the above-mentioned image processing method is implemented when the computer program instructions are executed by a processor.
- a computer program product including a computer-readable storage medium storing program codes, and when instructions included in the program codes are executed by a processor of a computer device, the above-mentioned image processing method is implemented. .
- a color lookup table corresponding to the beautification color parameter matching is generated, so that according to the target part of the face image
- the original color of the pixel and the target color lookup table to generate a beautified face image.
- the corresponding target color lookup table can be generated according to any input beautification color parameters in the beautification operation, so as to realize the beautification of the color of the target part.
- the color of the beautification operation can be enriched by any input beautification color parameters.
- the beautified face image can have a more natural beautification effect through the target color lookup table.
- FIG. 1 shows a flowchart of an image processing method according to an embodiment of the present disclosure
- FIG. 2A shows a schematic diagram of an input interface of a beautification operation according to an embodiment of the present disclosure
- FIG. 2B shows a flowchart of an image processing method according to an embodiment of the present disclosure
- FIG. 3 shows a flowchart of an image processing method according to an embodiment of the present disclosure
- Fig. 4 shows a schematic diagram of a preset color lookup table according to an embodiment of the present disclosure
- FIG. 5A shows a flowchart of an image processing method according to an embodiment of the present disclosure
- FIG. 5B shows a flowchart of an image processing method according to an embodiment of the present disclosure
- FIG. 6 shows a flowchart of an image processing method according to an embodiment of the present disclosure
- Fig. 7 shows a schematic diagram of raw materials according to an embodiment of the present disclosure
- Fig. 8 shows a schematic diagram of a face image according to an embodiment of the present disclosure
- Fig. 9 shows a schematic diagram of a beautified human face image according to an embodiment of the present disclosure.
- Fig. 10 shows a block diagram of an image processing device according to an embodiment of the present disclosure
- Fig. 11 shows a flowchart of an image processing method according to an application example of the present disclosure
- Fig. 12 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
- FIG. 1 shows a flow chart of an image processing method according to an embodiment of the present disclosure.
- the method can be applied to an image processing device or an image processing system, and the image processing device can be a terminal device, a server, or other processing devices.
- the terminal device may be user equipment (User Equipment, UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA), handheld device, computing device, vehicle-mounted device, Wearable equipment etc.
- the image processing method can also be applied to a cloud server or a local server.
- the cloud server can be a public cloud server or a private cloud server, which can be flexibly selected according to actual conditions.
- the image processing method may be implemented by a processor invoking computer-readable instructions stored in a memory.
- the image processing method is executed by an electronic device
- the electronic device may be the above-mentioned image processing device or a cloud server, or a local server, and the method may include:
- Step S11 receiving a beautification operation on the target part of the face image.
- the face image can be any image containing a face, and the face image can contain one face, or multiple faces, and its implementation form can be flexibly determined according to the actual situation, and is not limited in the embodiments of the present disclosure. .
- the beautification operation can be any operation that performs beautification processing on the target part of the face image, such as lip makeup operation, eye makeup operation, facial repair operation, or hairdressing operation.
- the operation content included in the beautification operation can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments.
- the beautification operation may include an operation indicating to perform beautification processing on the face image; in some possible implementation manners, the beautification operation may also include inputting at least one parameter, such as processing type, Beautify color parameters or adjust parameters, etc.
- the processing type may be the type performed in the beautification operation.
- the processing type included in the beautification operation may also be flexibly changed, and the beautification operation may include at least one processing type.
- the treatment type may include at least one of natural treatment, metallic light effect, matte light effect, moist light effect, and shimmering light effect.
- the natural treatment can include the natural modification of the lip color, retaining the original glossy effect of the lips; the treatment types such as metallic light effect, matte light effect, moist light effect and shimmering light effect can realize the modification of lip color and the glossy effect. Effects can be changed to obtain lip makeup effects with metallic luster, matte lip makeup effects with low gloss, moisturizing lip makeup effects with high gloss and natural brightness transition, and high brightness, high gloss and brightness. Interval flashing lip makeup effects, etc.
- the beautification color parameter can be any parameter input in the beautification operation to beautify the color of the target part of the face image.
- the form of the beautification color parameter can be flexibly determined according to the actual situation.
- the beautification The color parameter can be an input RGB color parameter.
- the adjustment parameters can be input during the beautification operation, and are related parameters for beautifying and adjusting the target part of the face image.
- the adjustment parameters can include various parameter types.
- the adjustment parameters can include at least one of the following : Beautification strength, brightness strength, etc. of the color of the target part of the face image. Based on the adjustment parameters, the way of beautifying and adjusting the target part of the face image can be referred to the following disclosed embodiments in detail, and will not be expanded here.
- Fig. 2A shows a schematic diagram of an input interface of a beautification operation according to an embodiment of the present disclosure. As shown in Fig. 2A, in an example, you can select lip makeup operation, blush operation, eye shadow operation, eyeliner operation, and eyelash operation on the input interface.
- beautification operations such as brush operation, eyebrow operation, foundation operation or hair dyeing operation, and select the processing type of beautification operation in the input interface, as shown in Figure 2A, select the matte light effect processing type in the beautification operation, and Beautification color parameters can be input in the input interface, such as the color values of the three RGB color channels shown in Figure 2A, and other adjustment parameters can also be input, such as the highlights (L, HighLight) and middle Tune (M, Midtones), etc.
- the input interface can also display a face image (in order to protect the objects in the figure, mosaic processing is performed on some parts of the face), and the face image can be obtained through the camera.
- the currently collected image obtained by collecting may also be a selected photo.
- the face image and the beautified face image may be displayed in split screens on the input interface.
- the target part can be any part of the face image that needs to be beautified. Which parts are included in the target part, the implementation form can also be flexibly determined according to the actual situation of the beautification operation.
- the beauty operation includes lip
- the target site may include a lip site.
- Step S12 based on the beautification color parameters of the target part input in the beautification operation, a target color lookup table matching the beautification color parameters is generated.
- the beautification color parameters include RGB color parameters
- three beautification colors in red (R, Red), green (G, Green) and blue (B, Blue) can be input respectively.
- the value of the color parameter on the color channel so as to obtain the input beautification color parameter.
- the target color lookup table may include target output color parameters, and the correspondence between target output color parameters and input colors, where the input color may be a color that is searched from the target color lookup table, and the target output color parameters may contain multiple target
- the output color, the target output color may be the output color corresponding to the input color found in the target color lookup table. For example, if the input color A is searched in the target color lookup table, the target output color B corresponding to A can be found in the target color lookup table.
- the corresponding relationship between colors in the target color lookup table can be flexibly set according to the actual situation, which is not limited in this embodiment of the present disclosure.
- the multiple target output colors in the target color lookup table may be arranged in a gradient manner, and the arrangement manner is not limited in the embodiments of the present disclosure, and is not limited to the following disclosed embodiments.
- a target color lookup table matching the beautification color parameters can be generated according to the beautification color parameters input in the beautification operation.
- the target output color parameters in the target color lookup table belong to Within the range of the beautification color parameters, so that the target output color parameters found according to the target color lookup table all match the beautification color parameters, thereby achieving the purpose of beautifying the target part of the face image according to the beautification color parameters.
- the color in the original preset color lookup table can be corrected according to the beautification color parameters to obtain the target color lookup table; Or directly select the target color lookup table bound to the beautification color parameters according to the beautification color parameters; or generate the target color lookup table according to certain color mapping rules according to the beautification color parameters.
- step S12 reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
- Step S13 generating a beautified face image according to the original color of the pixels in the target part of the face image and the target color lookup table.
- the original color may be the unprocessed color of the target part in the face image.
- the original color of each pixel in the target part may be determined according to the position of the target part in the face image .
- the face image after beautification can be the face image obtained by beautifying the original color according to the target color lookup table.
- the method of generating the face image after beautification can be flexibly determined according to the actual situation.
- the original color of the pixel is searched for the corresponding target output color parameter in the target color lookup table as the color of each pixel in the beautified face image; or the corresponding target can be found in the target color lookup table according to the original color
- the target output color parameters are fused with the original color to serve as the color of each pixel in the beautified face image.
- a color lookup table corresponding to the beautification color parameter matching is generated, so that according to the target part of the face image
- the original color of the pixel and the target color lookup table to generate a beautified face image.
- the corresponding target color lookup table can be generated according to any input beautification color parameters in the beautification operation, so as to realize the beautification of the color of the target part.
- the color of the beautification operation can be enriched by any input beautification color parameters.
- the beautified face image can have a more natural beautification effect through the target color lookup table.
- step S11 may include:
- Step S111 acquiring a face image in response to a face image confirmation operation.
- Step S112 in response to the beautification operation, receiving at least one of the processing type, beautification color parameters and adjustment parameters input in the beautification operation.
- the face image confirmation operation may be used to confirm the face image to be beautified.
- the form of the face image confirmation operation can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments.
- the face image confirmation operation may include: transmitting the face image, or selecting a face image from a preset image library.
- the face image transmission may be that the user actively uploads the face image, and in response to the face image confirmation operation of the face image transmission, the face image uploaded by the user may be obtained by receiving.
- the preset image library can include a plurality of preset face images, and the user can select one or more preset face images from the preset image library as the face image to be beautified. Therefore, in a In a possible implementation manner, in response to the face image confirmation operation of selecting a face image in the preset image library, the selected face image may be read from the preset image library by means of reading.
- the beautification operation can refer to the above-mentioned disclosed embodiments.
- the beautification operation can include outputting at least one parameter, so correspondingly, in response to the beautification operation, the processing type input in the beautification operation can be received , at least one of a beautification color parameter and an adjustment parameter.
- the execution order of the face image confirmation operation and the beautification operation can be flexibly selected according to the actual situation. Class parameters, and then perform face image confirmation operation, or perform face image confirmation operation and beautification operation at the same time, so correspondingly, the input processing type, beautification color parameters and adjustment parameters in the acquisition of face image and reception beautification operation
- the execution sequence of at least one of the processes can be flexibly selected according to the actual situation, which is not limited in this embodiment of the present disclosure.
- the face image to be beautified can be flexibly obtained by receiving or reading, and various parameters of the beautification operation can be flexibly obtained according to the parameters input by the user, which greatly improves the overall
- the flexibility and interactivity of the image processing method improve the user's operation experience for beautification.
- FIG. 3 shows a flow chart of an image processing method according to an embodiment of the present disclosure.
- step S12 may include:
- Step S121 obtaining a preset color lookup table and preset color parameters corresponding to the preset color lookup table
- Step S122 determining the color deviation between the beautification color parameters and the preset color parameters
- Step S123 based on the color deviation, adjust the first output color parameter of the preset color lookup table to obtain a target color lookup table.
- the preset color lookup table may be any preset color lookup table. Similar to the target color lookup table, the preset color lookup table may include a first output color parameter, and a correspondence between the first output color parameter and an input color, wherein the first output color parameter may include multiple first output colors, The first output color may be the output color found in the preset color lookup table according to the input color.
- the multiple first output colors in the preset color lookup table can also be arranged in a gradient form, and the implementation form can refer to the target color lookup table.
- Fig. 4 shows a schematic diagram of a preset color lookup table according to an embodiment of the present disclosure.
- the preset color lookup table includes a plurality of gradient colors with natural transitions as the first output color (Due to the limitations of the grayscale image display, the colors with different shades in the image are actually gradient colors with color differences). Based on the input color, a first output color corresponding to the input color can be found from a preset color lookup table.
- the preset color parameter may be a color parameter matched with the preset color lookup table, and the color of the preset color parameter may be determined according to the actual situation of the preset color lookup table, which is not limited in this embodiment of the present disclosure.
- the form of the preset color parameter can refer to the beautification color parameter, for example, it can also be a color parameter in the form of RGB. Since the preset color parameters match the preset color lookup table, in some possible implementations, the preset color lookup table can be directly used as the target when the beautification color parameters input in the beautification operation are the same as the preset color parameters Color lookup table.
- the beautification color parameters input in the beautification operation may be different from the preset color parameters.
- the preset color can be adjusted according to the color deviation between the beautification color parameters and the preset color parameters.
- the multiple first output colors in the lookup table are adjusted, so as to obtain a target color lookup table matching the beautification color parameters.
- the color deviation between the beautification color parameter and the preset color parameter can be the color difference between the beautification color parameter and the preset color parameter.
- the color deviation The form of is also different.
- the beautification color parameters and the preset color parameters are RGB parameters
- the color deviation can also be in the form of RGB; in some possible implementations, the beautification color parameters are the same as
- the form of preset color parameters may be different.
- the beautification color parameter may be an RGB parameter
- the preset color parameter may be a parameter in the form of HSV (hue H, saturation S, and lightness V).
- the beautification color parameter may be The color parameters and preset color parameters are unified into the same color space, and then the color deviation is calculated.
- the color space to be unified can be flexibly determined according to the actual situation, and is not limited in the embodiments of the present disclosure.
- the method of adjusting the first output color parameter in the preset color lookup table based on the color deviation is not limited in this embodiment of the disclosure.
- the first output color parameter can be directly The multiple first output colors of are added to the color deviation to obtain the target output color parameter.
- After adding the multiple first output colors to the color deviation respectively, according to the preset color parameter The range adjusts the result of the addition to obtain the target output color parameters, etc.
- step S123 reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
- the color deviation between the input beautification color parameters and the preset color parameters can be used to adjust the preset color lookup table to obtain the corresponding target color lookup table, reducing the cost of generating the target color lookup table
- the amount of data that needs to be processed in the process reduces the difficulty of generating the target color lookup table, and improves the convenience, feasibility and efficiency of image processing. While improving the convenience of image processing, it reduces the pressure on hardware storage, so as to achieve the purpose of saving costs.
- FIG. 5A shows a flowchart of an image processing method according to an embodiment of the present disclosure.
- step S123 may include:
- Step S1231 converting the first output color parameter in the preset color lookup table to the preset color space to obtain the second output color parameter;
- Step S1232 in the preset color space, adjust the second output color parameter according to at least one of color deviation and beautification color parameters, to obtain a third output color parameter;
- Step S1233 generating a target color lookup table according to the third output color parameter.
- the preset color space can be any color space form such as RGB color space, HSV color space or HSL (hue H, saturation S and lightness L), which color space to choose can be flexibly set according to the actual situation.
- HSV color space may be used as the preset color space.
- the second output color parameter may be a color parameter obtained by converting the first output color parameter into a preset color space.
- the first output color parameter may include a plurality of first output colors, correspondingly , the second output color parameter may include a plurality of second output colors, and each second output color may be obtained by respectively converting the first output color into a preset color space.
- step S1231 can be flexibly determined according to the form of the first output color parameter and the form of the preset color space.
- the first output color parameter can include multiple first output colors in the form of RGB
- the preset color The space may be an HSV color space.
- the first output colors in the form of a plurality of RGB in the first output color parameter may be respectively converted into a range of [0.0 , 1.0] of the second output color in HSV form to obtain the second output color parameter.
- the color deviation may include the color deviation between the beautification color parameters and the preset color parameters in the preset color space.
- the preset color space may include the HSV color space.
- the beautification can be respectively The color parameters and the preset color parameters are converted into the HSV space to obtain the color deviation in the HSV space.
- the process of obtaining the color deviation can be expressed by the following formula (1):
- diff is the color deviation in the HSV color space
- target_hsv is the beautification color parameter converted to the HSV color space
- lip_ref_hsv is the preset color parameter converted to the HSV color space.
- the third output color parameter may also include a plurality of third output colors, and each third output color may be a color obtained by adjusting the second output color respectively. Since both the second output color and the color deviation belong to the preset color space, the plurality of second output colors can be respectively adjusted according to the color deviation in the preset color space to obtain a plurality of third output colors.
- the second output color can also be adjusted directly according to the beautification color parameter to obtain the third output color.
- the beautification color parameter used to adjust the second output color is also Can belong to a preset color space.
- step S1233 the method of generating the target color lookup table according to the third output color parameter can also be flexibly determined according to the actual situation, for example, multiple third output colors in the third output color parameter can be directly used as the target color lookup table Output color, or according to the preset range of the target output color parameter, adjust part or all of the colors in the third output color to obtain the target output color parameter, etc., see the following disclosed embodiments for details, and do not mention it here Do unfold.
- the first output color parameter in the preset color space, can be adjusted by using the color deviation to generate the target color lookup table, so that by selecting an appropriate preset color space, it is convenient to adjust the output color in the preset color space
- the first output color parameters are adjusted in batches to improve the generation efficiency and editing degree of the target color lookup table, thereby improving the efficiency and convenience of image processing.
- step S1232 may include at least one of the following operations:
- the hue component of the beautification color parameter is adjusted to obtain the hue component of the third output color parameter.
- the hue component of the second output color parameter is adjusted to obtain the saturation component of the third output color parameter.
- the brightness component of the second output color parameter is adjusted to obtain the brightness component of the third output color parameter.
- the preset color space may include the HSV color space, and correspondingly, the HSV color space may include color parameter components, which are respectively: hue component (H, Hue), saturation component (S, Saturation ) and the brightness component (V, Value).
- hue component H, Hue
- saturation component S, Saturation
- V, Value the brightness component
- the manner of adjusting the second output color parameter can also be changed flexibly.
- the H component of the second output color parameter can be adjusted according to the hue component H of the color deviation in the HSV color space to obtain the H component of the third output color parameter.
- the H component of the color deviation may be added to the H components of multiple second output colors in the second output color parameter to obtain the H components of multiple third output colors in the third output color parameter.
- the H component is an angle measure, and the value range is between 0 degrees (°) and 360°, it can also be directly based on the H component in the HSV color space of the beautification color parameter, to adjust the H component of the second output color parameter to obtain the H component of the third output color parameter.
- the adjustment method please refer to the above-mentioned adjustment method based on color deviation.
- the S component and the V component of the second output color parameter can be adjusted respectively according to the saturation component S and the lightness component V of the color deviation in the HSV color space to obtain the first The S component and V component of the three output color parameters.
- the different color components of the second output color parameters can be adaptively adjusted based on at least one of the color deviation and beautification color parameters, respectively, to obtain the third output color
- Different component values in the preset color space effectively improve the flexibility of obtaining the third output color parameter, thereby improving the flexibility of image processing.
- step S1233 may include:
- Step S1233a if the third output color parameter belongs to the preset range, use the third output color parameter as the target output color parameter in the target color lookup table.
- Step S1233b if the third output color parameter exceeds the preset range, determine the target output color parameter in the target color lookup table based on the critical color parameter in the preset range.
- the range value of the preset range can be flexibly determined according to the actual situation.
- the third output color parameter can be a color parameter transformed in the HSV color space. Since the HSV color space In , the range of the H component is between 0° and 360°, and the ranges of the S and V components are both between [0.0, 1.0]. Therefore, according to the ranges of the H, S and V components, the first The three output color parameters are adjusted to obtain the target output color parameters.
- the H component of the third output color parameter when the H component of the third output color parameter is between 0° and 360°, the H component of the third output color parameter can be directly used as the H component of the target output color parameter , when the H component of the third output color parameter exceeds the range between 0° and 360°, the remainder may be calculated for the H component of the third output color parameter based on the critical color parameter 360° of the preset range of the H component, And the obtained remainder is used as the H component of the target output color parameter.
- the process can be expressed by the following formula (2) or (3):
- table2_hsv.h is the H component of the target output color parameter
- table1_hsv.h is the H component of the second output color parameter
- target_hsv.h is the H component of the beautification color parameter converted to HSV color space
- diff.h is the color deviation
- the H component of , fract( ⁇ ) means to find a decimal.
- the S component of the third output color parameter when the S component of the third output color parameter is between [0.0, 1.0], the S component of the third output color parameter can be directly used as the S component of the target output color parameter , when the S component of the third output color parameter exceeds [0.0, 1.0], the critical color parameter 0.0 or 1.0 in the preset range of the S component can be used as the S component of the target output color parameter to determine the target
- the process of outputting the V component of the color parameter can refer to the determination process of the S component.
- the process of determining the target output color parameters S component and V component can be expressed by the following formulas (4) and (5):
- table2_hsv.s is the S component of the target output color parameter
- table1_hsv.s is the S component of the second output color parameter
- diff.s is the S component of the color deviation
- table2_hsv.v is the V component of the target output color parameter
- table1_hsv .v is the V component of the second output color parameter
- diff.v is the V component of the color deviation
- clamp(a,min,max) is an interval limiting function, which is used to limit a between the range of min and max, When a exceeds the range defined by min and max, the value of min or max will be returned.
- the target output color parameter can also be converted back to the same color space as the first output color parameter according to the form of the first output color parameter in the preset color lookup table, for example, in a
- the first output color parameters in the preset color lookup table may all be in RGB format.
- the obtained target output color parameters in HSV format may be converted back to RGB format to obtain the target color lookup table.
- the third output color can be further adjusted according to the preset range, and the target output color parameters belonging to the preset range can be obtained, and then the target color lookup table can be obtained.
- the target color lookup table can be obtained.
- FIG. 6 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
- step S13 may include:
- Step S131 in the target color lookup table, look up the target output color parameter corresponding to the original color of the pixel in the target part as the initial target color of the pixel in the target part.
- Step S132 Determine the target color of the pixels in the target part according to the initial target color of the pixels in the target part.
- Step S133 based on the original color of the pixels in the target part and the target color, determine the beautified human face image.
- the initial target color may be the target output color parameter found by searching the corresponding color in the target color lookup table by taking the original color of the pixel point in the target part as the input color.
- the original material can be placed at the position of the target part in the standard face image to obtain a standard material image, wherein the original material can be determined according to the target part of the beautification operation, as shown in Figure 7
- a schematic diagram of an original material according to an embodiment of the present disclosure is shown, as shown in FIG. 7 , in an example, when the beautification operation is a lip makeup operation, the original material may be a lip mask (mask).
- the original material may be a lip mask (mask).
- determine the key points of the face through key point recognition use the key points of the face and interpolate the interpolation points through the key points of the face, and construct the triangular mesh of the target area in the face image.
- the position of the target part in the face image can be determined, and based on the position, the standard material image can be sampled to obtain the target material. Based on the obtained target material, when the transparency of the pixel in the target material belongs to the preset transparency range, the area corresponding to the position of the pixel in the face image can be used as the image area where the target part is located, and the pixel can be extracted. The original color of multiple pixels in the image area.
- the range of the preset transparency range can be flexibly determined according to the actual situation.
- the preset transparency range can be set to be lower than 100%, that is, the transparency of pixels in the target material is lower than In the case of 100% (not fully transparent), the area corresponding to the position of the pixel in the face image can be used as the image area where the target part is located, and the original color of the pixel in the image area is extracted; in a possible implementation
- the preset transparency range may also be set to be lower than other transparency values, or within a certain transparency range, etc.
- the embodiment of the present disclosure does not limit the range value of the preset transparency range.
- the value of the preset transparency range can be set, and more Specifically determine the image area where the target part that meets the requirements is located, so as to extract more accurate original colors in the target part from the face image, and then improve the reliability and authenticity of the subsequent fused face image.
- the target color of the pixels in the target part can be determined.
- the initial target color can be directly used as the target color.
- it can also be based on the output of the beautification operation. Processing type, adjust the initial target color accordingly, such as brightness adjustment, etc., to obtain the target color.
- step S132 reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
- the beautified human face image can be obtained through step S133.
- the implementation of step S133 can be flexibly determined according to the actual situation.
- the original color of the pixel in the target part can be fused with the target color, and the fused color can be used as the pixel in the beautified face image.
- the color of the point in some possible implementations, it is also possible to determine the fusion ratio of the original color and the target color according to the adjustment parameters input in the beautification operation, such as the intensity of the adjustment parameters, and then compare the original color and the target color according to the fusion ratio The colors are fused to obtain a beautified face image and the like.
- the initial target color can be determined based on the target color lookup table, and other parameters input in the beautification operation can be used to adjust the initial target color to determine the color of the pixels in the beautified face image, and obtain a more Beautified face images that are natural and meet user needs, and improve the interaction level and user experience of image processing.
- step S132 may include:
- the initial target color of the pixels in the target part is used as the target color of the pixels in the target part.
- the initial target color of the pixel in the target part is adjusted based on the randomly obtained noise value to obtain the target color of the pixel in the target part.
- the noise value can be the noise value or information added to each pixel in the image.
- the method of randomly obtaining the noise value can be to obtain the randomly obtained noise value by generating random data.
- the method of generating random data is implemented in this disclosure. The examples are not limited, see the following disclosed examples for details, and will not be expanded here.
- the initial target color may be directly used as the target color.
- the initial target color of at least one pixel in the target part can be adjusted based on randomly obtained noise values, so as to change the color of different pixels.
- the color makes the target area appear metallic light effect effect.
- the implementation method can be flexibly changed according to actual needs, and is not limited to the following disclosed embodiments.
- the texture coordinates can be used to sample the preset noise texture to obtain the random noise value corresponding to each pixel in the lip image; for each pixel, it is judged whether the corresponding noise value is within the preset Set within the noise range (the preset noise range can be distributed in different parts between 0 and 1, such as 0.98 to 1.0, 0.78 to 0.8, etc.); if it is within the preset noise range, use the following method to determine the pixel point The adjustment coefficient of the pixel, otherwise the following method 2 is used to determine the adjustment coefficient of the pixel:
- Method 1 Calculate the adjustment factor through the noise value and the transparency of the target material:
- the adjustment factor is first equal to the noise value
- Adjustment coefficient adjustment coefficient * pow (transparency of target material, 4.0).
- pow(x, y) indicates the result of calculating the yth power of x, so pow(transparency, 4.0) is the value of calculating the 4th power of the transparency.
- Method 2 Calculate the adjustment coefficient by calculating the first brightness of the pixel (the brightness value corresponding to the color value of the pixel), the second brightness, the third brightness, and the preset brightness radius (determining the radius of the highlight point):
- Adjustment coefficient (third brightness-first brightness)/(1.0-first brightness);
- Adjustment coefficient pow((first brightness-third brightness)/(second brightness-third brightness), shinness), where shinness is a preset brightness radius.
- the initial target color can be adjusted according to the obtained adjustment coefficient and the preset light source value to obtain the target color:
- Target color initial target color + adjustment factor ⁇ light source value.
- the first brightness may be a brightness value determined according to the color value of the original color of the pixel, where the brightness value may be determined by calculating the color value, and in one example, the brightness value may be determined according to three of the color values The values of the color channels (Red R, Green G, and Blue B) are calculated.
- the second brightness may be determined according to the color value of the pixel with the target brightness, wherein the pixel with the target brightness may be located within the preset processing range of the pixel in the target part of the face image and has the highest brightness of pixels.
- the size of the preset processing range can be flexibly set according to actual conditions, and is not limited in this embodiment of the present disclosure.
- the third brightness may be a brightness value determined according to a color value of an intermediate color of a pixel, wherein the intermediate color of a pixel may be a color obtained by filtering the pixel through a preset convolution kernel.
- the form and size of the preset convolution kernel can be flexibly set according to the actual situation.
- the filtering range of the preset convolution kernel is consistent with the preset processing range in the above disclosed embodiments, namely
- the pixel can be filtered through the preset convolution kernel to obtain the intermediate color of the pixel after filtering, and the corresponding brightness value can be calculated according to the color value of the intermediate color as the third brightness;
- the area covered by the preset convolution kernel to filter the pixels can be used as the preset processing range, then in the target part of the face image, the brightness value of the pixel that is within the preset processing range and has the highest brightness , can be used as the second brightness.
- the preset light source value may be determined according to the brightness intensity in the adjustment parameters input during the beautification operation.
- the processing type may also include matte light effects, wet light effects, or flickering light effects, etc.
- the first brightness and second brightness mentioned in the above disclosed embodiments may be used and the third brightness to adaptively adjust the initial target color to obtain the target color matching the processing type, etc.
- the processing manner can be flexibly determined according to the actual situation, and is not limited in this embodiment of the present disclosure.
- the processing types corresponding to the beautification operation are different, different methods can be selected to adjust the initial target color to determine the target color, which improves the flexibility of the beautification operation; and through the randomly obtained noise value, To adjust the initial target color of at least one pixel in the target part, the color can be adjusted based on random data to obtain a more natural metallic light effect.
- a beautified human face image obtained by performing a beautification operation on the human face image Fig. 8 shows a schematic diagram of a human face image. After the beautification operation is performed on the human face image in Fig. 8, a schematic diagram of the beautified human face image in Fig. 9 is obtained (in order to protect the objects in the image, each figure Mosaic processing has been carried out on some parts of the human face), as can be seen by comparison, according to the image processing methods proposed in the above-mentioned various disclosed embodiments, a more real and natural human face image after beautification with a better beautifying effect on the lips can be obtained .
- the methods proposed in the embodiments of the present disclosure may further include:
- the beautified face image is displayed.
- the preview operation may be selected by the user, and needs to perform a real-time preview operation on the beautified face image.
- the beautified face image may be displayed on the human-computer interaction interface for the user to view.
- the generated beautified face image may also be actively displayed in real time.
- the beautified human face image can be displayed in real time in response to the preview operation, so as to improve the degree of interaction with the user and enhance the user experience.
- FIG. 10 shows a block diagram of an image processing device according to an embodiment of the present disclosure.
- the image processing device 20 may include:
- the receiving module 21 is configured to receive the beautification operation on the target part of the face image.
- the generation module 22 is configured to generate a target color lookup table matching the beautification color parameters based on the beautification color parameters of the target part input in the beautification operation.
- the beautification module 23 is configured to generate a beautified human face image according to the original color of the pixels in the target part of the human face image and the target color lookup table.
- the generating module is configured to: acquire a preset color lookup table and preset color parameters corresponding to the preset color lookup table; determine the color deviation between the beautification color parameters and the preset color parameters; Based on the color deviation, the first output color parameter of the preset color lookup table is adjusted to obtain a target color lookup table.
- the color deviation includes the color deviation between the beautification color parameter and the preset color parameter in the preset color space;
- the generation module is configured to: convert the first output color parameter in the preset color lookup table to Preset the color space to obtain the second output color parameter; in the preset color space, adjust the second output color parameter according to the color deviation, the beautification color parameter, or the color deviation and the beautification color parameter, to obtain the third output color parameter ; Generate a target color lookup table according to the third output color parameter.
- the color parameter components in the preset color space include: a hue component, a saturation component, and a lightness component; the generation module is configured to at least one of the following operations: according to the hue component of the beautification color parameter, Adjust the hue component of the second output color parameter to obtain the hue component of the third output color parameter; adjust the hue component of the second output color parameter according to the saturation component of the color deviation to obtain the saturation of the third output color parameter brightness component; according to the brightness component of the color deviation, the brightness component of the second output color parameter is adjusted to obtain the brightness component of the third output color parameter.
- the generating module is configured to: when the third output color parameter belongs to a preset range, use the third output color parameter as the target output color parameter in the target color lookup table; When the color parameter exceeds the preset range, the target output color parameter in the target color lookup table is determined based on the critical color parameter in the preset range.
- the beautification module is configured to: in the target color lookup table, look up the target output color parameter corresponding to the original color of the pixel in the target part as the initial target color of the pixel in the target part; The initial target color of the pixels in the target part is determined to determine the target color of the pixels in the target part; based on the original color and the target color of the pixels in the target part, a beautified face image is obtained.
- the beautification module is configured to: when the processing type in the beautification operation includes natural processing, use the initial target color of the pixels in the target part as the target color of the pixels in the target part; or , when the processing type in the beautification operation includes metal light effect processing, the initial target color of the pixel in the target part is adjusted based on the randomly obtained noise value, and the target color of the pixel in the target part is obtained.
- the beautification operation includes a lip makeup operation
- the target part includes a lip part
- the present disclosure proposes an image processing method based on the example of FIG. 11 , including the following process:
- Step S111 receiving the beautification color parameter 10 (target_color) in RGB format input by the user on the input interface, the processing type selected on the input interface (such as water, highlight or matte 11 in Figure 11) and the input adjustment parameters (Intensity 12 and Brightness Intensity 13 in Figure 11, etc.).
- the processing type selected on the input interface such as water, highlight or matte 11 in Figure 11
- the input adjustment parameters Intensity 12 and Brightness Intensity 13 in Figure 11, etc.
- Step S112 acquiring the face image 15 determined by the user by uploading photos and videos 14 or selecting a model.
- Step S113 according to the beautification color parameter 10, adjust the preset color lookup table matched with the preset color parameter (lip_ref_color), so as to generate a target color lookup table.
- the preset color parameter can be the primary color of the lips without any lip makeup treatment, and the process of generating the target color lookup table is as follows:
- the H component, the S component and the V component of the target output color parameter are obtained, thereby obtaining the target output color parameter.
- Step S114 using the lip mask image to obtain the image of the part where lip makeup needs to be done, based on the image of the part where lip makeup is to be done, extract the original color of the pixel of the lip makeup part in the face image, and based on the original color, search in the target color Look up in the table to get the target color 16 of the lip makeup part.
- step S115 the searched target color and the original color are fused according to the intensity in the adjustment parameter input by the user to generate a beautified face image.
- the beautified face image is displayed in the input interface.
- the user by receiving the beautification color parameters in the beautification operation, the user can be supported to choose the color value of the lip makeup arbitrarily, and a target color lookup table is generated based on the color value to realize the lip makeup operation, thereby greatly improving the user's choice of lip makeup. Effect degrees of freedom.
- the image processing method proposed in the application example of this disclosure in addition to being applied to the beautification operation of the lips in the face image, can also be extended to other parts of the beautification operation, such as blush or eye shadow, etc., with the beautification Depending on the type of operation, the image processing method proposed in the application examples of the present disclosure can be flexibly expanded and modified accordingly.
- Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer program instructions are stored, and the above-mentioned method is implemented when the computer program instructions are executed by a processor.
- the computer readable storage medium may be a volatile computer readable storage medium or a nonvolatile computer readable storage medium.
- An embodiment of the present disclosure also proposes an electronic device, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured as the above method.
- the memory above can be a volatile memory (Volatile Memory), such as a random access memory (Random Access Memory, RAM); or a non-volatile memory (Non-Volatile Memory), such as a read-only memory (Read-Only Memory).
- Volatile Memory such as a random access memory (Random Access Memory, RAM); or a non-volatile memory (Non-Volatile Memory), such as a read-only memory (Read-Only Memory).
- Only Memory, ROM read-only memory
- flash memory Flash Memory
- HDD Hard Disk Drive
- SSD solid-state drive
- the above-mentioned processor can be an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processing, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (programmable logic At least one of device, PLD), field programmable gate array (Field Programmable Gate Array, FPGA), central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor.
- ASIC Application Specific Integrated Circuit
- DSP Digital Signal Processing
- DSPD Digital Signal Processing Device
- programmable logic device programmable logic At least one of device, PLD
- field programmable gate array Field Programmable Gate Array, FPGA
- CPU Central Processing Unit
- controller microcontroller, microprocessor
- Electronic devices may be provided as terminals, servers, or other forms of devices.
- the embodiments of the present disclosure further provide a computer program, which implements the above method when the computer program is executed by a processor.
- FIG. 12 is a block diagram of an electronic device 800 according to an embodiment of the present disclosure.
- the electronic device 800 may be a terminal such as a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
- the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (Input/Output, I/O) interface 812 , sensor component 814 , and communication component 816 .
- the processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations.
- the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
- the memory 804 is configured to store various types of data to support operations at the electronic device 800 .
- Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like.
- the power supply component 806 provides power to various components of the electronic device 800 .
- Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 .
- the multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the user.
- the multimedia component 808 includes at least one of the following: a front camera and a rear camera.
- a front camera and a rear camera When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera, the rear camera, or the front camera and the rear camera can receive external multimedia data.
- Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
- the audio component 810 is configured to output, input, or both output and input audio signals.
- the audio component 810 includes a microphone (Microphone, MIC), and when the electronic device 800 is in an operation mode, such as a calling mode, a recording mode and a voice recognition mode, the microphone is configured to receive an external audio signal. Received audio signals may be stored in memory 804 or sent via communication component 816 .
- the audio component 810 also includes a speaker for outputting audio signals.
- the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
- Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 .
- sensor assembly 814 may detect an open/closed state of electronic device 800, relative positioning of components, and the like.
- the communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices.
- electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
- ASICs application specific integrated circuits
- DSPs digital signal processors
- DSPDs digital signal processing devices
- PLDs programmable logic devices
- FPGA field programmable A programmable gate array
- controller microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
- a non-volatile computer-readable storage medium such as the memory 804 including computer program instructions, which can be executed by the processor 820 of the electronic device 800 to implement the above method.
- the present disclosure may be at least one of the following: a system, a method, and a computer program product.
- a computer program product may include a computer readable storage medium having computer readable program instructions thereon for causing a processor to implement various aspects of the present disclosure.
- a computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device.
- a computer readable storage medium may be, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
- the computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device via at least one of a network such as the Internet, a local area network, a wide area network, or a wireless network .
- a network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
- Computer program instructions for performing the operations of the present disclosure may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or programmed in at least one source or object code written in any combination of languages.
- Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
- These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing an apparatus for realizing the functions/actions specified in one or more blocks in the flowchart, block diagram, or both the flowchart and the block diagram.
- These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause at least one of the following, including: a computer, a programmable data processing device, and other equipment to work in a specific way, so that the computer that stores the instructions
- the readable medium then includes an article of manufacture including instructions for implementing various aspects of the functions/acts specified in the flowchart, block diagram, or one or more blocks in the flowchart and the block diagram.
- each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block in the block diagrams, flowcharts, or both, and combinations of blocks in the block diagrams, flowcharts, or block diagrams and flowcharts may be represented by special purpose components that perform the specified function or action.
- the implementation can be implemented by a hardware-based system, or it can be implemented by a combination of special purpose hardware and computer instructions.
- the image processing method includes: receiving a beautification operation on a target part of a human face image; generating a target that matches the beautification color parameter based on the beautification color parameters of the target part input in the beautification operation
- a color lookup table generate a beautified face image according to the original color of the pixels in the target part of the face image and the target color lookup table.
- a color lookup table corresponding to the beautification color parameter matching is generated, so that according to the target part of the face image
- the original color of the pixel and the target color lookup table to generate a beautified face image.
- the corresponding target color lookup table can be generated according to any input beautification color parameters in the beautification operation, so as to realize the beautification of the color of the target part.
- the color of the beautification operation can be enriched by any input beautification color parameters.
- the beautified face image can have a more natural beautification effect through the target color lookup table.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Nuclear Medicine, Radiotherapy & Molecular Imaging (AREA)
- Radiology & Medical Imaging (AREA)
- Quality & Reliability (AREA)
- Image Processing (AREA)
Abstract
The embodiments of the present disclosure relate to an image processing method and apparatus, and an electronic device, a storage medium and a computer program product. The method comprises: receiving a beautification operation for a target portion of a facial image; on the basis of a beautification color parameter of the target portion that is input in the beautification operation, generating a target color lookup table, which matches the beautification color parameter; and, according to an original color of a pixel point in the target portion of the facial image and the target color lookup table, generating a beautified facial image.
Description
相关申请的交叉引用Cross References to Related Applications
本公开基于申请号为202110872286.2、申请日为2021年7月30日、申请名称为“图像处理方法及装置、电子设备和存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。This disclosure is based on the Chinese patent application with the application number 202110872286.2, the application date is July 30, 2021, and the application name is "Image processing method and device, electronic equipment and storage medium", and claims the priority of the Chinese patent application, The entire content of this Chinese patent application is hereby incorporated by reference into this disclosure.
本公开涉及计算机视觉领域,尤其涉及一种图像处理方法及装置、电子设备、存储介质及计算机程序产品。The present disclosure relates to the field of computer vision, and in particular to an image processing method and device, electronic equipment, storage media and computer program products.
唇妆是指唇部的美容化妆,唇妆修饰后的嘴唇一般纯正且富有光泽。随着计算机视觉技术的发展,对包含嘴唇的图像进行处理,得到经过唇妆处理的图像,已愈加广泛地应用于人们的日常生活之中。然而,随着唇妆的发展,用户已不满足于仅根据提供的几种颜色来得到唇妆处理后的图像。Lip makeup refers to the beauty makeup of the lips. The lips after lip makeup modification are generally pure and shiny. With the development of computer vision technology, processing images containing lips to obtain images processed by lip makeup has become more and more widely used in people's daily life. However, along with the development of lip makeup, users are not satisfied with only obtaining the processed image of lip makeup based on several colors provided.
发明内容Contents of the invention
本公开实施例提出了一种图像处理方法及装置、电子设备、存储介质及计算机程序产品。Embodiments of the present disclosure provide an image processing method and device, electronic equipment, a storage medium, and a computer program product.
根据本公开实施例的一方面,提供了一种图像处理方法,包括:接收对人脸图像的目标部位的美化操作;基于所述美化操作中输入的所述目标部位的美化颜色参数,生成与所述美化颜色参数匹配的目标颜色查找表;根据所述人脸图像的目标部位中像素点的原始颜色以及所述目标颜色查找表,生成美化后的人脸图像。According to an aspect of the embodiments of the present disclosure, there is provided an image processing method, including: receiving a beautification operation on a target part of a human face image; based on the beautification color parameters of the target part input in the beautification operation, generating and A target color lookup table for matching the beautification color parameters; generating a beautified face image according to the original color of pixels in the target part of the face image and the target color lookup table.
根据本公开实施例的一方面,提供了一种图像处理装置,包括:接收模块,配置为接收对人脸图像的目标部位的美化操作;生成模块,配置为基于所述美化操作中输入的所述目标部位的美化颜色参数,生成与所述美化颜色参数匹配的目标颜色查找表;美化模块,配置为根据所述人脸图像的目标部位中像素点的原始颜色以及所述目标颜色查找表,生成美化后的人脸图像。According to an aspect of an embodiment of the present disclosure, an image processing device is provided, including: a receiving module configured to receive a beautification operation on a target part of a human face image; a generating module configured to based on the beautification operation input The beautification color parameter of the target part generates a target color lookup table matching the beautification color parameter; the beautification module is configured to look up the target color according to the original color of the pixel in the target part of the face image, Generate beautified face images.
根据本公开实施例的一方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:执行上述图像处理方法。According to an aspect of an embodiment of the present disclosure, there is provided an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to: execute the above image processing method.
根据本公开实施例的一方面,提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述图像处理方法。According to an aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, on which computer program instructions are stored, and the above-mentioned image processing method is implemented when the computer program instructions are executed by a processor.
根据本公开实施例的一方面,提供了一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令被计算机设备的处理器运行时,实现上述图像处理方法。According to an aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer-readable storage medium storing program codes, and when instructions included in the program codes are executed by a processor of a computer device, the above-mentioned image processing method is implemented. .
在本公开实施例中,通过接收对人脸图像目标部位的美化操作,并基于美化操作中输入的美化颜色参数,生成与美化颜色参数匹配对应的颜色查找表,从而根据人脸图像目标部位中像素点的原始颜色以及目标颜色查找表,来生成美化后的人脸图像。通过上述过程,可以根据美化操作中任意输入的美化颜色参数,来生成对应的目标颜色查找表,从而实现对目标部位颜色的美化,一方面可以通过任意输入的美化颜色参数丰富美化操作的颜色,提升美化 操作的自由度;另一方面还可以通过目标颜色查找表使得美化后的人脸图像具有较为自然的美化效果。In the embodiment of the present disclosure, by receiving the beautification operation on the target part of the face image, and based on the beautification color parameters input in the beautification operation, a color lookup table corresponding to the beautification color parameter matching is generated, so that according to the target part of the face image The original color of the pixel and the target color lookup table to generate a beautified face image. Through the above process, the corresponding target color lookup table can be generated according to any input beautification color parameters in the beautification operation, so as to realize the beautification of the color of the target part. On the one hand, the color of the beautification operation can be enriched by any input beautification color parameters. Improve the freedom of beautification operation; on the other hand, the beautified face image can have a more natural beautification effect through the target color lookup table.
应当理解的是,以上的一般描述和后文的细节描述是示例性和解释性的,而非限制本公开,根据下面参考附图对示例性实施例的详细说明,本公开实施例的其它特征及方面将变得清楚。It should be understood that the above general description and the following detailed description are exemplary and explanatory, rather than limiting the present disclosure. According to the following detailed description of the exemplary embodiments with reference to the accompanying drawings, other features of the embodiments of the present disclosure and aspects will become clear.
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings here are incorporated into the description and constitute a part of the present description. These drawings show embodiments consistent with the present disclosure, and are used together with the description to explain the technical solution of the present disclosure.
图1示出根据本公开一实施例的图像处理方法的流程图;FIG. 1 shows a flowchart of an image processing method according to an embodiment of the present disclosure;
图2A示出根据本公开一实施例的美化操作的输入界面示意图;FIG. 2A shows a schematic diagram of an input interface of a beautification operation according to an embodiment of the present disclosure;
图2B示出根据本公开一实施例的图像处理方法的流程图;FIG. 2B shows a flowchart of an image processing method according to an embodiment of the present disclosure;
图3示出根据本公开一实施例的图像处理方法的流程图;FIG. 3 shows a flowchart of an image processing method according to an embodiment of the present disclosure;
图4示出根据本公开一实施例的预设颜色查找表的示意图;Fig. 4 shows a schematic diagram of a preset color lookup table according to an embodiment of the present disclosure;
图5A示出根据本公开一实施例的图像处理方法的流程图;FIG. 5A shows a flowchart of an image processing method according to an embodiment of the present disclosure;
图5B示出根据本公开一实施例的图像处理方法的流程图;FIG. 5B shows a flowchart of an image processing method according to an embodiment of the present disclosure;
图6示出根据本公开一实施例的图像处理方法的流程图;FIG. 6 shows a flowchart of an image processing method according to an embodiment of the present disclosure;
图7示出根据本公开一实施例的原始素材的示意图;Fig. 7 shows a schematic diagram of raw materials according to an embodiment of the present disclosure;
图8示出根据本公开一实施例的人脸图像的示意图;Fig. 8 shows a schematic diagram of a face image according to an embodiment of the present disclosure;
图9示出根据本公开一实施例的美化后的人脸图像的示意图;Fig. 9 shows a schematic diagram of a beautified human face image according to an embodiment of the present disclosure;
图10示出根据本公开一实施例的图像处理装置的框图;Fig. 10 shows a block diagram of an image processing device according to an embodiment of the present disclosure;
图11示出根据本公开一应用示例的图像处理方法的流程图;Fig. 11 shows a flowchart of an image processing method according to an application example of the present disclosure;
图12示出根据本公开实施例的一种电子设备的框图。Fig. 12 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures indicate functionally identical or similar elements. While various aspects of the embodiments are shown in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as superior or better than other embodiments.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and there exists alone B these three situations. In addition, the term "at least one" herein means any one of a variety or any combination of at least two of the more, for example, including at least one of A, B, and C, which may mean including from A, Any one or more elements selected from the set formed by B and C.
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的细节。本领域技术人员应当理解,没有某些细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous details are given in the following specific embodiments. It will be understood by those skilled in the art that the present disclosure may be practiced without certain of the details. In some instances, methods, means, components and circuits that are well known to those skilled in the art have not been described in detail so as to obscure the gist of the present disclosure.
图1示出根据本公开一实施例的图像处理方法的流程图,该方法可以应用于图像处理设备或图像处理系统等,图像处理设备可以为终端设备、服务器或者其他处理设备等。其中,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等。在一个示例中,该图像处理方法也可以应用于云端服务器或本地服务器,云端服务器可以为公有云服务器,也可以为私有云服务器,根据实际情况灵活选择即可。FIG. 1 shows a flow chart of an image processing method according to an embodiment of the present disclosure. The method can be applied to an image processing device or an image processing system, and the image processing device can be a terminal device, a server, or other processing devices. Wherein, the terminal device may be user equipment (User Equipment, UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA), handheld device, computing device, vehicle-mounted device, Wearable equipment etc. In an example, the image processing method can also be applied to a cloud server or a local server. The cloud server can be a public cloud server or a private cloud server, which can be flexibly selected according to actual conditions.
在一些可能的实现方式中,该图像处理方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。In some possible implementation manners, the image processing method may be implemented by a processor invoking computer-readable instructions stored in a memory.
如图1所示,在一种可能的实现方式中,所述图像处理方法由电子设备执行,电子设备可以为上述图像处理设备或云端服务器、本地服务器,所述方法可以包括:As shown in Figure 1, in a possible implementation, the image processing method is executed by an electronic device, the electronic device may be the above-mentioned image processing device or a cloud server, or a local server, and the method may include:
步骤S11,接收对人脸图像的目标部位的美化操作。Step S11, receiving a beautification operation on the target part of the face image.
其中,人脸图像可以是包含人脸的任意图像,人脸图像中可以包含一个人脸,也可以包含多个人脸,其实现形式可以根据实际情况灵活决定,在本公开实施例中不做限制。Wherein, the face image can be any image containing a face, and the face image can contain one face, or multiple faces, and its implementation form can be flexibly determined according to the actual situation, and is not limited in the embodiments of the present disclosure. .
美化操作,可以是对人脸图像的目标部位进行美化处理的任意操作,比如唇妆操作、眼妆操作、修容操作或是美发操作等各类操作。美化操作包含的操作内容可以根据实际情况灵活决定,不局限于下述各公开实施例。在一种可能的实现方式中,该美化操作可以包括指示对人脸图像进行美化处理的操作;在一些可能的实现方式中,该美化操作还可以包括输入至少一种参数等,比如处理类型、美化颜色参数或是调整参数等。The beautification operation can be any operation that performs beautification processing on the target part of the face image, such as lip makeup operation, eye makeup operation, facial repair operation, or hairdressing operation. The operation content included in the beautification operation can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments. In a possible implementation manner, the beautification operation may include an operation indicating to perform beautification processing on the face image; in some possible implementation manners, the beautification operation may also include inputting at least one parameter, such as processing type, Beautify color parameters or adjust parameters, etc.
处理类型可以是美化操作中所执行的类型,随着美化操作形式的不同,美化操作中包含的处理类型也可以灵活发生变化,美化操作可以包含至少一种处理类型。在一种可能的实现方式中,在美化操作包括唇妆操作的情况下,处理类型可以包括自然处理、金属光效、雾面光效、水润光效以及闪烁光效中的至少一种。其中,自然处理可以包括对嘴唇颜色的自然修饰,保留唇部原始的光亮效果;金属光效、雾面光效、水润光效以及闪烁光效等处理类型可以实现对嘴唇颜色的修饰以及光效的改变,分别得到具有金属光泽的唇妆效果、具有低光泽度的雾面唇妆效果、具有高光泽度且亮度过渡自然的水润唇妆效果以及具有高亮度、高光泽度且亮度具有间隔的闪烁唇妆效果等。The processing type may be the type performed in the beautification operation. With the different forms of the beautification operation, the processing type included in the beautification operation may also be flexibly changed, and the beautification operation may include at least one processing type. In a possible implementation manner, when the beautification operation includes a lip makeup operation, the treatment type may include at least one of natural treatment, metallic light effect, matte light effect, moist light effect, and shimmering light effect. Among them, the natural treatment can include the natural modification of the lip color, retaining the original glossy effect of the lips; the treatment types such as metallic light effect, matte light effect, moist light effect and shimmering light effect can realize the modification of lip color and the glossy effect. Effects can be changed to obtain lip makeup effects with metallic luster, matte lip makeup effects with low gloss, moisturizing lip makeup effects with high gloss and natural brightness transition, and high brightness, high gloss and brightness. Interval flashing lip makeup effects, etc.
美化颜色参数可以是在美化操作中输入的,对人脸图像的目标部位的颜色进行美化的任意参数,美化颜色参数的形式可以根据实际情况灵活决定,在一种可能的实现方式中,该美化颜色参数可以是输入的RGB颜色参数。The beautification color parameter can be any parameter input in the beautification operation to beautify the color of the target part of the face image. The form of the beautification color parameter can be flexibly determined according to the actual situation. In a possible implementation, the beautification The color parameter can be an input RGB color parameter.
调整参数可以是在美化操作中输入的,对人脸图像的目标部位进行美化调整的相关参数,调整参数可以包括各种参数类型,在一些可能的实现方式中,调整参数可以包括以下至少之一:对人脸图像的目标部位的颜色进行美化的强度、亮度强度等。基于调整参数,对人脸图像的目标部位进行美化调整的方式可以详见下述各公开实施例,在此先不做展开。The adjustment parameters can be input during the beautification operation, and are related parameters for beautifying and adjusting the target part of the face image. The adjustment parameters can include various parameter types. In some possible implementations, the adjustment parameters can include at least one of the following : Beautification strength, brightness strength, etc. of the color of the target part of the face image. Based on the adjustment parameters, the way of beautifying and adjusting the target part of the face image can be referred to the following disclosed embodiments in detail, and will not be expanded here.
图2A示出根据本公开一实施例的美化操作的输入界面示意图,如2A图所示,在一个示例中,可以在输入界面选择如唇妆操作、腮红操作、眼影操作、眼线操作、睫毛刷操作、眉毛操作、粉底操作或染发操作等各种类型的美化操作,并在输入界面中选定美化操作的处理类型,如图2A所示选择美化操作中的雾面光效处理类型,还可以在输入界面中输入美化颜色参数,比如图2A所示的可以输入RGB三个颜色通道的颜色值,还可以输入其他的调整参数,比如图2A中示出的高光(L,HighLight)以及中间调(M,Midtones)等。Fig. 2A shows a schematic diagram of an input interface of a beautification operation according to an embodiment of the present disclosure. As shown in Fig. 2A, in an example, you can select lip makeup operation, blush operation, eye shadow operation, eyeliner operation, and eyelash operation on the input interface. Various types of beautification operations such as brush operation, eyebrow operation, foundation operation or hair dyeing operation, and select the processing type of beautification operation in the input interface, as shown in Figure 2A, select the matte light effect processing type in the beautification operation, and Beautification color parameters can be input in the input interface, such as the color values of the three RGB color channels shown in Figure 2A, and other adjustment parameters can also be input, such as the highlights (L, HighLight) and middle Tune (M, Midtones), etc.
基于图2A还可以看出,在一个示例中,输入界面还可以显示出人脸图像(为了对图中对象进行保护,对人脸部分部位进行了马赛克处理),该人脸图像可以为通过相机采集所得到的当前采集图像,也可以为选中的照片,在一个示例中,还可以在输入界面将人脸图像和美化后的人脸图像进行分屏显示。Based on FIG. 2A, it can also be seen that in an example, the input interface can also display a face image (in order to protect the objects in the figure, mosaic processing is performed on some parts of the face), and the face image can be obtained through the camera. The currently collected image obtained by collecting may also be a selected photo. In an example, the face image and the beautified face image may be displayed in split screens on the input interface.
目标部位可以是人脸图像中需要进行美化的任意部位,目标部位包含哪些部位,其实现形式同样可以根据美化操作的实际情况灵活决定,在一种可能的实现方式中,在美妆操作包括唇妆操作的情况下,目标部位可以包括嘴唇部位。The target part can be any part of the face image that needs to be beautified. Which parts are included in the target part, the implementation form can also be flexibly determined according to the actual situation of the beautification operation. In one possible implementation, the beauty operation includes lip In the case of a makeup operation, the target site may include a lip site.
步骤S12,基于美化操作中输入的目标部位的美化颜色参数,生成与美化颜色参数匹配的目标颜色查找表。Step S12, based on the beautification color parameters of the target part input in the beautification operation, a target color lookup table matching the beautification color parameters is generated.
其中,美化颜色参数的实现形式可以参考上述公开实施例。在一种可能的实现方式中,在美化颜色参数包括RGB颜色参数的情况下,可以分别输入美化颜色在红色(R,Red)、绿色(G,Green)和蓝色(B,Blue)三个颜色通道上颜色参数值,从而得到输入的美化颜色参数。For the implementation form of the beautification color parameters, reference may be made to the above disclosed embodiments. In a possible implementation, when the beautification color parameters include RGB color parameters, three beautification colors in red (R, Red), green (G, Green) and blue (B, Blue) can be input respectively. The value of the color parameter on the color channel, so as to obtain the input beautification color parameter.
目标颜色查找表可以包含目标输出颜色参数,以及目标输出颜色参数与输入颜色之间的对应关系,其中,输入颜色可以为向目标颜色查找表进行查找的颜色,目标输出颜色参数可以包含多个目标输出颜色,目标输出颜色可以为在目标颜色查找表中查找到的与输入颜色 对应的输出颜色。举例来说,比如根据输入颜色A在目标颜色查找表中查找,可以在目标颜色查找表中找到与A对应的目标输出颜色B。目标颜色查找表中颜色之间的对应关系可以根据实际情况灵活设定,在本公开实施例中不做限制。在一种可能的实现方式中,目标颜色查找表中的多个目标输出颜色可以通过渐变形式进行排列,排列方式在本公开实施例中不做限制,不局限于下述各公开实施例。The target color lookup table may include target output color parameters, and the correspondence between target output color parameters and input colors, where the input color may be a color that is searched from the target color lookup table, and the target output color parameters may contain multiple target The output color, the target output color may be the output color corresponding to the input color found in the target color lookup table. For example, if the input color A is searched in the target color lookup table, the target output color B corresponding to A can be found in the target color lookup table. The corresponding relationship between colors in the target color lookup table can be flexibly set according to the actual situation, which is not limited in this embodiment of the present disclosure. In a possible implementation manner, the multiple target output colors in the target color lookup table may be arranged in a gradient manner, and the arrangement manner is not limited in the embodiments of the present disclosure, and is not limited to the following disclosed embodiments.
在一种可能的实现方式中,可以根据美化操作中输入的美化颜色参数,来生成与美化颜色参数匹配的目标颜色查找表,在这种情况下,目标颜色查找表中的目标输出颜色参数属于美化颜色参数的范围以内,从而使得根据目标颜色查找表查找到的目标输出颜色参数,均与美化颜色参数相匹配,从而达到根据美化颜色参数对人脸图像的目标部位进行美化的目的。In a possible implementation, a target color lookup table matching the beautification color parameters can be generated according to the beautification color parameters input in the beautification operation. In this case, the target output color parameters in the target color lookup table belong to Within the range of the beautification color parameters, so that the target output color parameters found according to the target color lookup table all match the beautification color parameters, thereby achieving the purpose of beautifying the target part of the face image according to the beautification color parameters.
如何基于美化颜色参数来生成目标颜色查找表,其实现方式可以根据实际情况灵活决定,比如可以根据美化颜色参数,对原始的预设颜色查找表中的颜色进行修正,从而得到目标颜色查找表;或是根据美化颜色参数,直接选择与美化颜色参数所绑定的目标颜色查找表;也可以根据美化颜色参数,按照一定的颜色映射规则来生成目标颜色查找表等。步骤S12的一些可能的实现方式可以详见下述各公开实施例,在此先不做展开。How to generate the target color lookup table based on the beautification color parameters can be flexibly determined according to the actual situation. For example, the color in the original preset color lookup table can be corrected according to the beautification color parameters to obtain the target color lookup table; Or directly select the target color lookup table bound to the beautification color parameters according to the beautification color parameters; or generate the target color lookup table according to certain color mapping rules according to the beautification color parameters. For some possible implementation manners of step S12, reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
步骤S13,根据人脸图像的目标部位中像素点的原始颜色以及目标颜色查找表,生成美化后的人脸图像。Step S13, generating a beautified face image according to the original color of the pixels in the target part of the face image and the target color lookup table.
其中,原始颜色可以是目标部位在人脸图像中未经处理过的颜色,在一些可能的实现方式中,可以根据目标部位在人脸图像中的位置,确定目标部位中各像素点的原始颜色。Wherein, the original color may be the unprocessed color of the target part in the face image. In some possible implementations, the original color of each pixel in the target part may be determined according to the position of the target part in the face image .
美化后的人脸图像,可以是根据目标颜色查找表,对原始颜色进行美化所得到的人脸图像,生成美化后的人脸图像的方式可以根据实际情况灵活决定,比如可以基于目标部位中各像素点的原始颜色在目标颜色查找表中查找对应的目标输出颜色参数,来作为美化后的人脸图像中各像素点的颜色;或者也可以根据原始颜色在目标颜色查找表中查找对应的目标输出颜色参数后,将目标输出颜色参数与原始颜色融合后的颜色,来作为美化后的人脸图像中各像素点的颜色等。步骤S13的一些可能的实现方式可以详见下述各公开实施例,在此先不做展开。The face image after beautification can be the face image obtained by beautifying the original color according to the target color lookup table. The method of generating the face image after beautification can be flexibly determined according to the actual situation. The original color of the pixel is searched for the corresponding target output color parameter in the target color lookup table as the color of each pixel in the beautified face image; or the corresponding target can be found in the target color lookup table according to the original color After the color parameters are output, the target output color parameters are fused with the original color to serve as the color of each pixel in the beautified face image. For some possible implementation manners of step S13, reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
在本公开实施例中,通过接收对人脸图像目标部位的美化操作,并基于美化操作中输入的美化颜色参数,生成与美化颜色参数匹配对应的颜色查找表,从而根据人脸图像目标部位中像素点的原始颜色以及目标颜色查找表,来生成美化后的人脸图像。通过上述过程,可以根据美化操作中任意输入的美化颜色参数,来生成对应的目标颜色查找表,以实现对目标部位颜色的美化,一方面可以通过任意输入的美化颜色参数丰富美化操作的颜色,提升美化操作的自由度;另一方面还可以通过目标颜色查找表使得美化后的人脸图像具有较为自然的美化效果。In the embodiment of the present disclosure, by receiving the beautification operation on the target part of the face image, and based on the beautification color parameters input in the beautification operation, a color lookup table corresponding to the beautification color parameter matching is generated, so that according to the target part of the face image The original color of the pixel and the target color lookup table to generate a beautified face image. Through the above process, the corresponding target color lookup table can be generated according to any input beautification color parameters in the beautification operation, so as to realize the beautification of the color of the target part. On the one hand, the color of the beautification operation can be enriched by any input beautification color parameters. Improve the freedom of beautification operation; on the other hand, the beautified face image can have a more natural beautification effect through the target color lookup table.
在一种可能的实现方式中,如图2B所示,步骤S11可以包括:In a possible implementation, as shown in FIG. 2B, step S11 may include:
步骤S111,响应于人脸图像确认操作,获取人脸图像。Step S111 , acquiring a face image in response to a face image confirmation operation.
步骤S112,响应于美化操作,接收美化操作中输入的处理类型、美化颜色参数以及调整参数中的至少一种。Step S112, in response to the beautification operation, receiving at least one of the processing type, beautification color parameters and adjustment parameters input in the beautification operation.
其中,人脸图像确认操作可以用于确认待进行美化操作的人脸图像。该人脸图像确认操作的形式可以根据实际情况灵活决定,不局限于下述各公开实施例。在一种可能的实现方式中,人脸图像确认操作可以包括:传输人脸图像,或者,在预设图像库中选择人脸图像。Wherein, the face image confirmation operation may be used to confirm the face image to be beautified. The form of the face image confirmation operation can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments. In a possible implementation manner, the face image confirmation operation may include: transmitting the face image, or selecting a face image from a preset image library.
其中,传输人脸图像可以是用户主动上传人脸图像,响应于该传输人脸图像的人脸图像确认操作,可以通过接收的方式,获取用户上传的人脸图像。Wherein, the face image transmission may be that the user actively uploads the face image, and in response to the face image confirmation operation of the face image transmission, the face image uploaded by the user may be obtained by receiving.
预设图像库可以包括多个预设的人脸图像,用户可以从预设图像库中选择一个或多个预设的人脸图像,作为待进行美化操作的人脸图像,因此,在一种可能的实现方式中,响应于该在预设图像库中选择人脸图像的人脸图像确认操作,可以通过读取的方式,从预设图像库中读取被选中的人脸图像。The preset image library can include a plurality of preset face images, and the user can select one or more preset face images from the preset image library as the face image to be beautified. Therefore, in a In a possible implementation manner, in response to the face image confirmation operation of selecting a face image in the preset image library, the selected face image may be read from the preset image library by means of reading.
美化操作的实现方式可以参考上述各公开实施例,如上述各公开实施例所述,美化操 作可以包括输出至少一种参数,因此相应地,响应于美化操作,可以接收美化操作中输入的处理类型、美化颜色参数以及调整参数中的至少一种。The implementation of the beautification operation can refer to the above-mentioned disclosed embodiments. As described in the above-mentioned various disclosed embodiments, the beautification operation can include outputting at least one parameter, so correspondingly, in response to the beautification operation, the processing type input in the beautification operation can be received , at least one of a beautification color parameter and an adjustment parameter.
在本公开实施例中,人脸图像确认操作和美化操作的执行顺序可以根据实际情况灵活选择,比如用户可以先进行人脸图像确认操作,再进行美化操作,也可以先输入美化操作中的各类参数,再进行人脸图像确认操作,或是同时执行人脸图像确认操作与美化操作等,因此相应地,获取人脸图像和接收美化操作中输入的处理类型、美化颜色参数以及调整参数中的至少一种等过程的执行顺序可以根据实际情况灵活选择,在本公开实施例中不做限制。In the embodiments of the present disclosure, the execution order of the face image confirmation operation and the beautification operation can be flexibly selected according to the actual situation. Class parameters, and then perform face image confirmation operation, or perform face image confirmation operation and beautification operation at the same time, so correspondingly, the input processing type, beautification color parameters and adjustment parameters in the acquisition of face image and reception beautification operation The execution sequence of at least one of the processes can be flexibly selected according to the actual situation, which is not limited in this embodiment of the present disclosure.
通过本公开实施例,可以根据实际情况,通过接收或读取的方式灵活获取待进行美化操作的人脸图像,并根据用户输入的参数情况,灵活获取美化操作的各类参数,大大提升了整个图像处理方法的灵活程度和交互性,提升用户进行美化的操作体验。Through the embodiments of the present disclosure, according to the actual situation, the face image to be beautified can be flexibly obtained by receiving or reading, and various parameters of the beautification operation can be flexibly obtained according to the parameters input by the user, which greatly improves the overall The flexibility and interactivity of the image processing method improve the user's operation experience for beautification.
图3示出根据本公开一实施例的图像处理方法的流程图,如图3所示,在一种可能的实现方式中,步骤S12可以包括:FIG. 3 shows a flow chart of an image processing method according to an embodiment of the present disclosure. As shown in FIG. 3 , in a possible implementation manner, step S12 may include:
步骤S121,获取预设颜色查找表,以及与预设颜色查找表对应的预设颜色参数;Step S121, obtaining a preset color lookup table and preset color parameters corresponding to the preset color lookup table;
步骤S122,确定美化颜色参数与预设颜色参数之间的颜色偏差;Step S122, determining the color deviation between the beautification color parameters and the preset color parameters;
步骤S123,基于颜色偏差,对预设颜色查找表的第一输出颜色参数进行调整,得到目标颜色查找表。Step S123, based on the color deviation, adjust the first output color parameter of the preset color lookup table to obtain a target color lookup table.
其中,预设颜色查找表可以是预先设定的任意颜色查找表。与目标颜色查找表类似,预设颜色查找表可以包含第一输出颜色参数,以及第一输出颜色参数与输入颜色之间的对应关系,其中第一输出颜色参数可以包含多个第一输出颜色,第一输出颜色可以为预设颜色查找表中根据输入颜色查找到的输出颜色。预设颜色查找表中的多个第一输出颜色同样可以以渐变形式进行排列,其实现形式可以参考目标颜色查找表。Wherein, the preset color lookup table may be any preset color lookup table. Similar to the target color lookup table, the preset color lookup table may include a first output color parameter, and a correspondence between the first output color parameter and an input color, wherein the first output color parameter may include multiple first output colors, The first output color may be the output color found in the preset color lookup table according to the input color. The multiple first output colors in the preset color lookup table can also be arranged in a gradient form, and the implementation form can refer to the target color lookup table.
图4示出根据本公开一实施例的预设颜色查找表的示意图,从图中可以看出,在一个示例中,预设颜色查找表中包括多个自然过渡的渐变色作为第一输出颜色(由于灰度图显示的限制,图中深浅不同的颜色实际上为具有颜色区别的渐变色)。基于输入颜色,可以从预设颜色查找表中查找到与输入颜色对应的第一输出颜色。Fig. 4 shows a schematic diagram of a preset color lookup table according to an embodiment of the present disclosure. It can be seen from the figure that in one example, the preset color lookup table includes a plurality of gradient colors with natural transitions as the first output color (Due to the limitations of the grayscale image display, the colors with different shades in the image are actually gradient colors with color differences). Based on the input color, a first output color corresponding to the input color can be found from a preset color lookup table.
预设颜色参数可以为与预设颜色查找表匹配的颜色参数,该预设颜色参数的颜色可以根据预设颜色查找表的实际情况所确定,在本公开实施例中不做限制。预设颜色参数的形式可以参考美化颜色参数,比如也可以为RGB形式的颜色参数。由于预设颜色参数与预设颜色查找表匹配,在一些可能的实现方式中,在美化操作中输入的美化颜色参数与预设颜色参数相同的情况下,可以直接将预设颜色查找表作为目标颜色查找表。The preset color parameter may be a color parameter matched with the preset color lookup table, and the color of the preset color parameter may be determined according to the actual situation of the preset color lookup table, which is not limited in this embodiment of the present disclosure. The form of the preset color parameter can refer to the beautification color parameter, for example, it can also be a color parameter in the form of RGB. Since the preset color parameters match the preset color lookup table, in some possible implementations, the preset color lookup table can be directly used as the target when the beautification color parameters input in the beautification operation are the same as the preset color parameters Color lookup table.
在一些可能的实现方式中,美化操作中输入的美化颜色参数可能与预设颜色参数不同,在这种情况下,可以根据美化颜色参数与预设颜色参数之间的颜色偏差,对预设颜色查找表中的多个第一输出颜色进行调整,从而得到与美化颜色参数匹配的目标颜色查找表。In some possible implementations, the beautification color parameters input in the beautification operation may be different from the preset color parameters. In this case, the preset color can be adjusted according to the color deviation between the beautification color parameters and the preset color parameters. The multiple first output colors in the lookup table are adjusted, so as to obtain a target color lookup table matching the beautification color parameters.
其中,美化颜色参数与预设颜色参数之间的颜色偏差,可以为美化颜色参数与预设颜色参数之间的颜色差值,随着美化颜色参数和预设颜色参数的形式的不同,颜色偏差的形式也不同,在一些可能的实现方式中,在美化颜色参数与预设颜色参数均为RGB参数的情况下,颜色偏差也可以为RGB形式;在一些可能的实现方式中,美化颜色参数与预设颜色参数的形式可能不同,比如美化颜色参数可以为RGB参数,而预设颜色参数可能为HSV(色调H,饱和度S和明度V)形式的参数,在这种情况下,可以将美化颜色参数与预设颜色参数统一到同一颜色空间下,再进行颜色偏差的计算,统一为何种颜色空间可以根据实际情况灵活决定,在本公开实施例中不做限制。Wherein, the color deviation between the beautification color parameter and the preset color parameter can be the color difference between the beautification color parameter and the preset color parameter. With the difference between the beautification color parameter and the preset color parameter, the color deviation The form of is also different. In some possible implementations, when both the beautification color parameters and the preset color parameters are RGB parameters, the color deviation can also be in the form of RGB; in some possible implementations, the beautification color parameters are the same as The form of preset color parameters may be different. For example, the beautification color parameter may be an RGB parameter, while the preset color parameter may be a parameter in the form of HSV (hue H, saturation S, and lightness V). In this case, the beautification color parameter may be The color parameters and preset color parameters are unified into the same color space, and then the color deviation is calculated. The color space to be unified can be flexibly determined according to the actual situation, and is not limited in the embodiments of the present disclosure.
基于颜色偏差,对预设颜色查找表中的第一输出颜色参数进行调整的方式,在本公开实施例中也不做限制,在一些可能的实现方式中,可以直接将第一输出颜色参数中的多个第一输出颜色分别与颜色偏差相加得到目标输出颜色参数,在一些可能的实现方式中,也可以将多个第一输出颜色分别与颜色偏差相加后,根据颜色参数的预设范围对相加得到的结果进行调整,得到目标输出颜色参数等。步骤S123的一些可能的实现方式可以详见下述各公开实施例,在此先不做展开。The method of adjusting the first output color parameter in the preset color lookup table based on the color deviation is not limited in this embodiment of the disclosure. In some possible implementations, the first output color parameter can be directly The multiple first output colors of are added to the color deviation to obtain the target output color parameter. In some possible implementations, after adding the multiple first output colors to the color deviation respectively, according to the preset color parameter The range adjusts the result of the addition to obtain the target output color parameters, etc. For some possible implementations of step S123, reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
通过本公开实施例,可以利用输入的美化颜色参数与预设颜色参数之间的颜色偏差,在预设颜色查找表的基础上进行调整得到相应的目标颜色查找表,减少生成目标颜色查找表的过程中所需要处理的数据量,降低生成目标颜色查找表的难度,提升图像处理的便捷程度、可行性和效率,同时仅需预先存储预设颜色查找表,降低预先存储的数据存储量,进一步提升图像处理便捷性的同时,降低硬件存储的压力,从而达到节约成本的目的。Through the embodiments of the present disclosure, the color deviation between the input beautification color parameters and the preset color parameters can be used to adjust the preset color lookup table to obtain the corresponding target color lookup table, reducing the cost of generating the target color lookup table The amount of data that needs to be processed in the process reduces the difficulty of generating the target color lookup table, and improves the convenience, feasibility and efficiency of image processing. While improving the convenience of image processing, it reduces the pressure on hardware storage, so as to achieve the purpose of saving costs.
图5A示出根据本公开一实施例的图像处理方法的流程图,如图5A所示,在一种可能的实现方式中,步骤S123可以包括:FIG. 5A shows a flowchart of an image processing method according to an embodiment of the present disclosure. As shown in FIG. 5A, in a possible implementation, step S123 may include:
步骤S1231,将预设颜色查找表中的第一输出颜色参数转换至预设颜色空间,得到第二输出颜色参数;Step S1231, converting the first output color parameter in the preset color lookup table to the preset color space to obtain the second output color parameter;
步骤S1232,在预设颜色空间中,根据颜色偏差和美化颜色参数中的至少一种,对第二输出颜色参数进行调整,得到第三输出颜色参数;Step S1232, in the preset color space, adjust the second output color parameter according to at least one of color deviation and beautification color parameters, to obtain a third output color parameter;
步骤S1233,根据第三输出颜色参数,生成目标颜色查找表。Step S1233, generating a target color lookup table according to the third output color parameter.
其中,预设颜色空间可以是RGB颜色空间、HSV颜色空间或是HSL(色调H,饱和度S和亮度L)等任意的颜色空间形式,选择哪种颜色空间可以根据实际情况灵活设定。在一种可能的实现方式中,为了便于对预设颜色查找表中的多个第一输出颜色统一地实现调整,可以将HSV颜色空间作为预设颜色空间。Wherein, the preset color space can be any color space form such as RGB color space, HSV color space or HSL (hue H, saturation S and lightness L), which color space to choose can be flexibly set according to the actual situation. In a possible implementation manner, in order to uniformly implement adjustments to the multiple first output colors in the preset color lookup table, the HSV color space may be used as the preset color space.
第二输出颜色参数可以是将第一输出颜色参数转换至预设颜色空间中所得到的颜色参数,如上述公开实施例所述,第一输出颜色参数可以包括多个第一输出颜色,相应的,第二输出颜色参数可以包括多个第二输出颜色,各第二输出颜色可以通过将第一输出颜色分别转换至预设颜色空间所得到。The second output color parameter may be a color parameter obtained by converting the first output color parameter into a preset color space. As described in the above disclosed embodiments, the first output color parameter may include a plurality of first output colors, correspondingly , the second output color parameter may include a plurality of second output colors, and each second output color may be obtained by respectively converting the first output color into a preset color space.
步骤S1231的实现方式可以根据第一输出颜色参数的形式与预设颜色空间的形式所灵活决定,在一个示例中,第一输出颜色参数可以包含多个RGB形式的第一输出颜色,预设颜色空间可以为HSV颜色空间,在这种情况下,可以按照RGB与HSV之间的颜色映射关系,将第一输出颜色参数中的多个RGB形式的第一输出颜色,分别转换为范围在[0.0,1.0]的HSV形式的第二输出颜色,得到第二输出颜色参数。The implementation of step S1231 can be flexibly determined according to the form of the first output color parameter and the form of the preset color space. In one example, the first output color parameter can include multiple first output colors in the form of RGB, and the preset color The space may be an HSV color space. In this case, according to the color mapping relationship between RGB and HSV, the first output colors in the form of a plurality of RGB in the first output color parameter may be respectively converted into a range of [0.0 , 1.0] of the second output color in HSV form to obtain the second output color parameter.
颜色偏差可以包括美化颜色参数与预设颜色参数在预设颜色空间中的颜色偏差,如上述公开实施例所述,预设颜色空间可以包括HSV颜色空间,在这种情况下,可以分别将美化颜色参数和预设颜色参数转换到HSV空间中,得到HSV空间中的颜色偏差,在一个示例中,得到颜色偏差的过程可以通过下述公式(1)进行表示:The color deviation may include the color deviation between the beautification color parameters and the preset color parameters in the preset color space. As described in the above disclosed embodiments, the preset color space may include the HSV color space. In this case, the beautification can be respectively The color parameters and the preset color parameters are converted into the HSV space to obtain the color deviation in the HSV space. In one example, the process of obtaining the color deviation can be expressed by the following formula (1):
diff=target_hsv-lip_ref_hsv (1)diff=target_hsv-lip_ref_hsv (1)
其中,diff为HSV颜色空间中的颜色偏差,target_hsv为转换到HSV颜色空间的美化颜色参数,lip_ref_hsv为转换到HSV颜色空间的预设颜色参数。Among them, diff is the color deviation in the HSV color space, target_hsv is the beautification color parameter converted to the HSV color space, and lip_ref_hsv is the preset color parameter converted to the HSV color space.
步骤S1232中,第三输出颜色参数同样可以包含多个第三输出颜色,各第三输出颜色可以为对第二输出颜色分别进行调整所得到的颜色。由于第二输出颜色与颜色偏差均属于预设颜色空间,因此可以在预设颜色空间中,根据颜色偏差对多个第二输出颜色分别进行调整,可以得到多个第三输出颜色。In step S1232, the third output color parameter may also include a plurality of third output colors, and each third output color may be a color obtained by adjusting the second output color respectively. Since both the second output color and the color deviation belong to the preset color space, the plurality of second output colors can be respectively adjusted according to the color deviation in the preset color space to obtain a plurality of third output colors.
在一些可能的实现方式中,还可以直接根据美化颜色参数对第二输出颜色进行调整,得到第三输出颜色,在这种情况下,用于对第二输出颜色进行调整的美化颜色参数,同样可以属于预设颜色空间。步骤S1232的一些可能的实现方式可以详见下述各公开实施例,在此先不做展开。In some possible implementations, the second output color can also be adjusted directly according to the beautification color parameter to obtain the third output color. In this case, the beautification color parameter used to adjust the second output color is also Can belong to a preset color space. For some possible implementations of step S1232, reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
步骤S1233中,根据第三输出颜色参数生成目标颜色查找表的方式,同样可以根据实际情况灵活决定,比如可以直接将第三输出颜色参数中的多个第三输出颜色作为目标颜色查找表的目标输出颜色,或是根据目标输出颜色参数的预设范围,将第三输出颜色中的部分或全部颜色进行调整,得到目标输出颜色参数等,详见下述各公开实施例,在此同样先不做展开。In step S1233, the method of generating the target color lookup table according to the third output color parameter can also be flexibly determined according to the actual situation, for example, multiple third output colors in the third output color parameter can be directly used as the target color lookup table Output color, or according to the preset range of the target output color parameter, adjust part or all of the colors in the third output color to obtain the target output color parameter, etc., see the following disclosed embodiments for details, and do not mention it here Do unfold.
通过本公开实施例,可以在预设颜色空间中,利用颜色偏差对第一输出颜色参数进行调整以生成目标颜色查找表,从而通过选择合适的预设颜色空间,便于对预设颜色空间中的 第一输出颜色参数进行批量调整,以提高目标颜色查找表的生成效率和编辑程度,从而提高图像处理的效率和便捷程度。Through the embodiments of the present disclosure, in the preset color space, the first output color parameter can be adjusted by using the color deviation to generate the target color lookup table, so that by selecting an appropriate preset color space, it is convenient to adjust the output color in the preset color space The first output color parameters are adjusted in batches to improve the generation efficiency and editing degree of the target color lookup table, thereby improving the efficiency and convenience of image processing.
在一种可能的实现方式中,步骤S1232可以包括以下操作的至少一种:In a possible implementation manner, step S1232 may include at least one of the following operations:
根据美化颜色参数的色调分量,对第二输出颜色参数的色调分量进行调整,得到第三输出颜色参数的色调分量。According to the hue component of the beautification color parameter, the hue component of the second output color parameter is adjusted to obtain the hue component of the third output color parameter.
根据颜色偏差的饱和度分量,对第二输出颜色参数的色调分量进行调整,得到第三输出颜色参数的饱和度分量。According to the saturation component of the color deviation, the hue component of the second output color parameter is adjusted to obtain the saturation component of the third output color parameter.
根据颜色偏差的明度分量,对第二输出颜色参数的明度分量进行调整,得到第三输出颜色参数的明度分量。According to the brightness component of the color deviation, the brightness component of the second output color parameter is adjusted to obtain the brightness component of the third output color parameter.
如上述公开实施例所述,预设颜色空间可以包括HSV颜色空间,则相应地,该HSV颜色空间可以包括颜色参数分量,分别为:色调分量(H,Hue)、饱和度分量(S,Saturation)以及明度分量(V,Value)。As described in the above disclosed embodiments, the preset color space may include the HSV color space, and correspondingly, the HSV color space may include color parameter components, which are respectively: hue component (H, Hue), saturation component (S, Saturation ) and the brightness component (V, Value).
基于HSV颜色空间中的不同颜色参数分量,对第二输出颜色参数进行调整的方式也可以灵活变化。Based on different color parameter components in the HSV color space, the manner of adjusting the second output color parameter can also be changed flexibly.
在一种可能的实现方式中,可以根据颜色偏差在HSV颜色空间中的色调分量H,对第二输出颜色参数的H分量进行调整,得到第三输出颜色参数的H分量,举例来说,在一个示例中,可以将颜色偏差的H分量与第二输出颜色参数中多个第二输出颜色的H分量分别相加,得到第三输出颜色参数中多个第三输出颜色的H分量。In a possible implementation, the H component of the second output color parameter can be adjusted according to the hue component H of the color deviation in the HSV color space to obtain the H component of the third output color parameter. For example, in In an example, the H component of the color deviation may be added to the H components of multiple second output colors in the second output color parameter to obtain the H components of multiple third output colors in the third output color parameter.
在一种可能的实现方式中,考虑到H分量是一个角度度量,取值范围在0度(°)~360°之间,因此也可以直接根据美化颜色参数在HSV颜色空间中的H分量,来对第二输出颜色参数的H分量进行调整,得到第三输出颜色参数的H分量。调整方式可以参考上述基于颜色偏差的调整方式。In a possible implementation, considering that the H component is an angle measure, and the value range is between 0 degrees (°) and 360°, it can also be directly based on the H component in the HSV color space of the beautification color parameter, to adjust the H component of the second output color parameter to obtain the H component of the third output color parameter. For the adjustment method, please refer to the above-mentioned adjustment method based on color deviation.
同理,在一种可能的实现方式中,还可以根据颜色偏差在HSV颜色空间中的饱和度分量S和明度分量V,分别对第二输出颜色参数的S分量和V分量进行调整,得到第三输出颜色参数的S分量和V分量。Similarly, in a possible implementation, the S component and the V component of the second output color parameter can be adjusted respectively according to the saturation component S and the lightness component V of the color deviation in the HSV color space to obtain the first The S component and V component of the three output color parameters.
通过本公开实施例,可以在预设颜色空间中,分别对第二输出颜色参数的不同颜色分量,适应性地基于颜色偏差和美化颜色参数中的至少一种来进行调整,得到第三输出颜色在预设颜色空间中的不同分量值,有效提升了得到第三输出颜色参数的灵活程度,从而提升图像处理的灵活性。Through the embodiments of the present disclosure, in the preset color space, the different color components of the second output color parameters can be adaptively adjusted based on at least one of the color deviation and beautification color parameters, respectively, to obtain the third output color Different component values in the preset color space effectively improve the flexibility of obtaining the third output color parameter, thereby improving the flexibility of image processing.
在一种可能的实现方式中,如图5B所示,步骤S1233可以包括:In a possible implementation manner, as shown in FIG. 5B, step S1233 may include:
步骤S1233a,在第三输出颜色参数属于预设范围的情况下,将第三输出颜色参数作为目标颜色查找表中的目标输出颜色参数。Step S1233a, if the third output color parameter belongs to the preset range, use the third output color parameter as the target output color parameter in the target color lookup table.
步骤S1233b,在第三输出颜色参数超过预设范围的情况下,基于预设范围的临界颜色参数,确定目标颜色查找表中的目标输出颜色参数。Step S1233b, if the third output color parameter exceeds the preset range, determine the target output color parameter in the target color lookup table based on the critical color parameter in the preset range.
其中,预设范围的范围数值可以根据实际情况灵活决定,举例来说,在一种可能的实现方式中,第三输出颜色参数可以为在HSV颜色空间下变换后的颜色参数,由于HSV颜色空间中,H分量的范围在0°~360°之间,S分量和V分量的范围均在[0.0,1.0]之间,因此,可以根据H分量、S分量和V分量的范围,分别对第三输出颜色参数进行调整,得到目标输出颜色参数。Wherein, the range value of the preset range can be flexibly determined according to the actual situation. For example, in a possible implementation manner, the third output color parameter can be a color parameter transformed in the HSV color space. Since the HSV color space In , the range of the H component is between 0° and 360°, and the ranges of the S and V components are both between [0.0, 1.0]. Therefore, according to the ranges of the H, S and V components, the first The three output color parameters are adjusted to obtain the target output color parameters.
在一种可能的实现方式中,在第三输出颜色参数的H分量属于0°~360°之间的情况下,可以直接将该第三输出颜色参数的H分量作为目标输出颜色参数的H分量,在第三输出颜色参数的H分量超出0°~360°之间的情况下,可以基于H分量的预设范围的临界颜色参数360°,对第三输出颜色参数的H分量求取余数,并将该求取到的余数作为目标输出颜色参数的H分量,在一个示例中,该过程可以通过下述公式(2)或(3)进行表示:In a possible implementation, when the H component of the third output color parameter is between 0° and 360°, the H component of the third output color parameter can be directly used as the H component of the target output color parameter , when the H component of the third output color parameter exceeds the range between 0° and 360°, the remainder may be calculated for the H component of the third output color parameter based on the critical color parameter 360° of the preset range of the H component, And the obtained remainder is used as the H component of the target output color parameter. In an example, the process can be expressed by the following formula (2) or (3):
table2_hsv.h=fract(table1_hsv.h+target_hsv.h) (2)table2_hsv.h=fract(table1_hsv.h+target_hsv.h) (2)
table2_hsv.h=fract(table1_hsv.h+diff.h) (3)table2_hsv.h=fract(table1_hsv.h+diff.h) (3)
其中,table2_hsv.h为目标输出颜色参数的H分量,table1_hsv.h为第二输出颜色参数的H分量,target_hsv.h为转换到HSV颜色空间的美化颜色参数的H分量,diff.h为颜色偏差的H分量,fract(·)表示求取小数。Among them, table2_hsv.h is the H component of the target output color parameter, table1_hsv.h is the H component of the second output color parameter, target_hsv.h is the H component of the beautification color parameter converted to HSV color space, and diff.h is the color deviation The H component of , fract(·) means to find a decimal.
在一种可能的实现方式中,在第三输出颜色参数的S分量属于[0.0,1.0]之间的情况下,可以直接将该第三输出颜色参数的S分量作为目标输出颜色参数的S分量,在第三输出颜色参数的S分量超出[0.0,1.0]之间的情况下,可以将S分量的预设范围的临界颜色参数0.0或1.0,来作为目标输出颜色参数的S分量,确定目标输出颜色参数的V分量的过程可以参考S分量的确定过程。在一个示例中,确定目标输出颜色参数S分量和V分量的过程可以通过下述公式(4)和(5)进行表示:In a possible implementation, when the S component of the third output color parameter is between [0.0, 1.0], the S component of the third output color parameter can be directly used as the S component of the target output color parameter , when the S component of the third output color parameter exceeds [0.0, 1.0], the critical color parameter 0.0 or 1.0 in the preset range of the S component can be used as the S component of the target output color parameter to determine the target The process of outputting the V component of the color parameter can refer to the determination process of the S component. In an example, the process of determining the target output color parameters S component and V component can be expressed by the following formulas (4) and (5):
table2_hsv.s=clamp(table1_hsv.s+diff_hsv.s,0.0,1.0) (4)table2_hsv.s=clamp(table1_hsv.s+diff_hsv.s,0.0,1.0) (4)
table2_hsv.v=clamp(table1_hsv.v+diff_hsv.v,0.0,1.0) (5)table2_hsv.v=clamp(table1_hsv.v+diff_hsv.v,0.0,1.0) (5)
其中,table2_hsv.s为目标输出颜色参数的S分量,table1_hsv.s为第二输出颜色参数的S分量,diff.s为颜色偏差的S分量,table2_hsv.v为目标输出颜色参数的V分量,table1_hsv.v为第二输出颜色参数的V分量,diff.v为颜色偏差的V分量,clamp(a,min,max)为区间限定函数,用于将a限定在min和max这一范围之间,当a超出min和max所限定的范围的情况下,将会返回min或max的值。Among them, table2_hsv.s is the S component of the target output color parameter, table1_hsv.s is the S component of the second output color parameter, diff.s is the S component of the color deviation, table2_hsv.v is the V component of the target output color parameter, table1_hsv .v is the V component of the second output color parameter, diff.v is the V component of the color deviation, clamp(a,min,max) is an interval limiting function, which is used to limit a between the range of min and max, When a exceeds the range defined by min and max, the value of min or max will be returned.
在一些可能的实现方式中,还可以根据预设颜色查找表中第一输出颜色参数的形式,将目标输出颜色参数转换回与第一输出颜色参数相同的颜色空间中,举例来说,在一个示例中,预设颜色查找表中的第一输出颜色参数可以均为RGB形式,在这种情况下,可以将得到的HSV形式的目标输出颜色参数转换回RGB形式,得到目标颜色查找表。In some possible implementations, the target output color parameter can also be converted back to the same color space as the first output color parameter according to the form of the first output color parameter in the preset color lookup table, for example, in a In an example, the first output color parameters in the preset color lookup table may all be in RGB format. In this case, the obtained target output color parameters in HSV format may be converted back to RGB format to obtain the target color lookup table.
通过本公开实施例,可以根据预设范围对第三输出颜色进一步调整,得到属于预设范围的目标输出颜色参数,继而得到目标颜色查找表,通过上述过程,可以得到更为准确的目标颜色查找表,确保可以实现美化后的人脸图像的生成,减少美化后的人脸图像中存在超出范围的颜色像素的情况的发生,提升图像处理的精度和效果。Through the embodiments of the present disclosure, the third output color can be further adjusted according to the preset range, and the target output color parameters belonging to the preset range can be obtained, and then the target color lookup table can be obtained. Through the above process, a more accurate target color lookup can be obtained The table ensures that the beautified face image can be generated, reduces the occurrence of color pixels out of range in the beautified face image, and improves the accuracy and effect of image processing.
图6示出根据本公开一实施例的图像处理方法的流程图,如图6所示,在一种可能的实现方式中,步骤S13可以包括:FIG. 6 shows a flowchart of an image processing method according to an embodiment of the present disclosure. As shown in FIG. 6, in a possible implementation manner, step S13 may include:
步骤S131,在目标颜色查找表中,查找与目标部位中像素点的原始颜色对应的目标输出颜色参数,作为目标部位中像素点的初始目标颜色。Step S131, in the target color lookup table, look up the target output color parameter corresponding to the original color of the pixel in the target part as the initial target color of the pixel in the target part.
步骤S132,根据目标部位中像素点的初始目标颜色,确定目标部位中像素点的目标颜色。Step S132: Determine the target color of the pixels in the target part according to the initial target color of the pixels in the target part.
步骤S133,基于目标部位中像素点的原始颜色和所述目标颜色,确定美化后的人脸图像。Step S133, based on the original color of the pixels in the target part and the target color, determine the beautified human face image.
其中,初始目标颜色可以是将目标部位中像素点的原始颜色作为输入颜色,在目标颜色查找表中进行对应颜色查找所查找到的目标输出颜色参数。Wherein, the initial target color may be the target output color parameter found by searching the corresponding color in the target color lookup table by taking the original color of the pixel point in the target part as the input color.
目标部位中像素点的原始颜色的实现形式可以参考上述各公开实施例。获取人脸图像的目标部位中像素点的原始颜色的方式可以根据实际情况灵活决定,不局限于下述各公开实施例。For the implementation form of the original color of the pixels in the target part, reference may be made to the above disclosed embodiments. The manner of obtaining the original color of the pixel in the target part of the face image can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments.
在一种可能的实现方式中,可以将原始素材放置到标准人脸图像中目标部位所在的位置,得到标准素材图像,其中,原始素材可以根据美化操作所面向的目标部位所确定,图7示出根据本公开一实施例的原始素材的示意图,如图7所示,在一个示例中,在美化操作为唇妆操作的情况下,原始素材可以为唇部掩模(mask)。并在人脸图像中,通过关键点识别确定人脸关键点,使用人脸关键点与通过人脸关键点插值出插值点,在人脸图像中构建目标区域的三角网格。根据构建的三角网格,可以确定人脸图像中目标部位的位置,基于该位置可以采样标准素材图像以获取目标素材。基于获取到的目标素材,可以在目标素材中的像素点的透明度属于预设透明度范围的情况下,将人脸图像中与像素点的位置对应的区域,作为 目标部位所在图像区域,并提取该图像区域中多个像素点的原始颜色。In a possible implementation, the original material can be placed at the position of the target part in the standard face image to obtain a standard material image, wherein the original material can be determined according to the target part of the beautification operation, as shown in Figure 7 A schematic diagram of an original material according to an embodiment of the present disclosure is shown, as shown in FIG. 7 , in an example, when the beautification operation is a lip makeup operation, the original material may be a lip mask (mask). And in the face image, determine the key points of the face through key point recognition, use the key points of the face and interpolate the interpolation points through the key points of the face, and construct the triangular mesh of the target area in the face image. According to the constructed triangular mesh, the position of the target part in the face image can be determined, and based on the position, the standard material image can be sampled to obtain the target material. Based on the obtained target material, when the transparency of the pixel in the target material belongs to the preset transparency range, the area corresponding to the position of the pixel in the face image can be used as the image area where the target part is located, and the pixel can be extracted. The original color of multiple pixels in the image area.
其中,预设透明度范围的范围情况可以根据实际情况灵活决定,在一种可能的实现方式中,可以将预设透明度范围设定为低于100%,即在目标素材中像素点的透明度低于100%(并非全透明)的情况下,可以将人脸图像中与像素点的位置对应的区域,作为目标部位所在图像区域,并提取图像区域内像素点的原始颜色;在一种可能的实现方式中,也可以将预设透明度范围设定为低于其他透明度值,或是处于某一透明度范围以内等,本公开实施例对预设透明度范围的范围值不做限定。Wherein, the range of the preset transparency range can be flexibly determined according to the actual situation. In a possible implementation, the preset transparency range can be set to be lower than 100%, that is, the transparency of pixels in the target material is lower than In the case of 100% (not fully transparent), the area corresponding to the position of the pixel in the face image can be used as the image area where the target part is located, and the original color of the pixel in the image area is extracted; in a possible implementation In the manner, the preset transparency range may also be set to be lower than other transparency values, or within a certain transparency range, etc. The embodiment of the present disclosure does not limit the range value of the preset transparency range.
通过在目标素材中的像素点的透明度属于预设透明度范围的情况下,对人脸图像对应的像素点的原始颜色进行提取,通过上述过程,可以通过设定预设透明度范围的值,更有针对性地确定符合需求的目标部位所在图像区域,从而从人脸图像中提取到更加准确的目标部位中的原始颜色,继而提升后续得到的融合人脸图像的可靠性和真实性。By extracting the original color of the pixel point corresponding to the face image when the transparency of the pixel point in the target material belongs to the preset transparency range, through the above process, the value of the preset transparency range can be set, and more Specifically determine the image area where the target part that meets the requirements is located, so as to extract more accurate original colors in the target part from the face image, and then improve the reliability and authenticity of the subsequent fused face image.
根据初始目标颜色,可以确定目标部位中像素点的目标颜色,在一些可能的实现方式中,可以直接将初始目标颜色作为目标颜色,在一些可能的实现方式中,还可以根据美化操作中输出的处理类型,对初始目标颜色进行相应地调整,比如亮度调整等,得到目标颜色。步骤S132的一些可能的实现方式可以详见下述各公开实施例,在此先不做展开。According to the initial target color, the target color of the pixels in the target part can be determined. In some possible implementations, the initial target color can be directly used as the target color. In some possible implementations, it can also be based on the output of the beautification operation. Processing type, adjust the initial target color accordingly, such as brightness adjustment, etc., to obtain the target color. For some possible implementation manners of step S132, reference may be made to the following disclosed embodiments in detail, which will not be expanded here.
基于目标部位中像素点的原始颜色和目标颜色,可以通过步骤S133得到美化后的人脸图像。步骤S133的实现方式可以根据实际情况灵活决定,在一些可能的实现方式中,可以将目标部位中像素点的原始颜色和目标颜色进行融合,将融合后的颜色作为美化后的人脸图像中像素点的颜色;在一些可能的实现方式中,还可以根据美化操作中输入的调整参数,比如调整参数中的强度等,确定原始颜色和目标颜色的融合比例,继而按照融合比例对原始颜色和目标颜色进行融合得到美化后的人脸图像等。Based on the original color and the target color of the pixels in the target part, the beautified human face image can be obtained through step S133. The implementation of step S133 can be flexibly determined according to the actual situation. In some possible implementations, the original color of the pixel in the target part can be fused with the target color, and the fused color can be used as the pixel in the beautified face image. The color of the point; in some possible implementations, it is also possible to determine the fusion ratio of the original color and the target color according to the adjustment parameters input in the beautification operation, such as the intensity of the adjustment parameters, and then compare the original color and the target color according to the fusion ratio The colors are fused to obtain a beautified face image and the like.
通过本公开实施例,可以基于目标颜色查找表确定初始目标颜色,并利用美化操作中输入的其他参数,对初始目标颜色进行调整以确定美化后的人脸图像中像素点的颜色,得到更为自然和符合用户需求的美化后的人脸图像,提高图像处理的交互程度和用户体验。Through the embodiments of the present disclosure, the initial target color can be determined based on the target color lookup table, and other parameters input in the beautification operation can be used to adjust the initial target color to determine the color of the pixels in the beautified face image, and obtain a more Beautified face images that are natural and meet user needs, and improve the interaction level and user experience of image processing.
在一种可能的实现方式中,步骤S132可以包括:In a possible implementation manner, step S132 may include:
在美化操作中的处理类型包括自然处理的情况下,将目标部位中像素点的初始目标颜色,作为目标部位中像素点的目标颜色。或者,When the processing type in the beautification operation includes natural processing, the initial target color of the pixels in the target part is used as the target color of the pixels in the target part. or,
在美化操作中的处理类型包括金属光效处理的情况下,基于随机获取的噪声值,对目标部位中像素点的初始目标颜色进行调整,得到目标部位中像素点的目标颜色。When the processing type in the beautification operation includes metal light effect processing, the initial target color of the pixel in the target part is adjusted based on the randomly obtained noise value to obtain the target color of the pixel in the target part.
其中,自然处理和金属光效处理的处理效果可以参考上述各公开实施例。噪声值可以为向图像中各像素点添加的噪声数值或信息,随机获取噪声值的方式可以为,通过生成随机数据的方式,来得到随机获取的噪声值,随机数据的生成方式在本公开实施例中不做限制,详见下述各公开实施例,在此先不做展开。Wherein, the treatment effects of the natural treatment and the metal light effect treatment can refer to the above disclosed embodiments. The noise value can be the noise value or information added to each pixel in the image. The method of randomly obtaining the noise value can be to obtain the randomly obtained noise value by generating random data. The method of generating random data is implemented in this disclosure. The examples are not limited, see the following disclosed examples for details, and will not be expanded here.
在一种可能的实现方式中,可以在处理类型为自然处理的情况下,直接将初始目标颜色作为目标颜色。In a possible implementation manner, when the processing type is natural processing, the initial target color may be directly used as the target color.
在一种可能的实现方式中,可以在处理类型为金属光效处理的情况下,基于随机获取的噪声值来对目标部位中至少一个像素点的初始目标颜色进行调整,来改变不同像素点的颜色使得目标部位出现金属光效的效果。其中,对哪些像素点的颜色进行调整,以及如何基于随机获取到的噪声值,来对初始目标颜色进行调整,其实现方式可以根据实际需求灵活发生变化,不局限于下述各公开实施例。In a possible implementation, when the processing type is metal light effect processing, the initial target color of at least one pixel in the target part can be adjusted based on randomly obtained noise values, so as to change the color of different pixels. The color makes the target area appear metallic light effect effect. Among them, the color of which pixels are adjusted, and how to adjust the initial target color based on the randomly obtained noise value, the implementation method can be flexibly changed according to actual needs, and is not limited to the following disclosed embodiments.
在一个示例中,可以通过纹理坐标在预设的噪声纹理上进行采样,得到唇部部位的图像中各像素点对应的随机噪声值;对于各像素点,分别判断其对应的噪声值是否在预设噪声范围之内(预设噪声范围可以分布在0~1之间的不同部分,如0.98~1.0,0.78~0.8等);若在预设噪声范围内,采用下述方法一确定该像素点的调整系数,否则采用下述方法二确定该像素点的调整系数:In one example, the texture coordinates can be used to sample the preset noise texture to obtain the random noise value corresponding to each pixel in the lip image; for each pixel, it is judged whether the corresponding noise value is within the preset Set within the noise range (the preset noise range can be distributed in different parts between 0 and 1, such as 0.98 to 1.0, 0.78 to 0.8, etc.); if it is within the preset noise range, use the following method to determine the pixel point The adjustment coefficient of the pixel, otherwise the following method 2 is used to determine the adjustment coefficient of the pixel:
方法一、通过噪声值以及目标素材的透明度来计算调整系数:Method 1. Calculate the adjustment factor through the noise value and the transparency of the target material:
调整系数首先等于噪声值;The adjustment factor is first equal to the noise value;
调整系数=调整系数*pow(目标素材的透明度,4.0)。Adjustment coefficient = adjustment coefficient * pow (transparency of target material, 4.0).
其中,pow(x,y)表明计算x的y次方的结果,因而pow(透明度,4.0)为计算透明度的4次方的值。Among them, pow(x, y) indicates the result of calculating the yth power of x, so pow(transparency, 4.0) is the value of calculating the 4th power of the transparency.
方法二、通过像素点的第一亮度(与像素点的颜色值对应的亮度值)、第二亮度、第三亮度以及预设的亮度半径(决定高光点的半径)进行计算得到调整系数:Method 2. Calculate the adjustment coefficient by calculating the first brightness of the pixel (the brightness value corresponding to the color value of the pixel), the second brightness, the third brightness, and the preset brightness radius (determining the radius of the highlight point):
如果第一亮度小于第三亮度,则:If the first brightness is less than the third brightness, then:
调整系数=(第三亮度-第一亮度)/(1.0-第一亮度);Adjustment coefficient=(third brightness-first brightness)/(1.0-first brightness);
如果第一亮度大于第三亮度,则:If the first brightness is greater than the third brightness, then:
调整系数=pow((第一亮度-第三亮度)/(第二亮度-第三亮度),shinness),其中shiness为预设的亮度半径。Adjustment coefficient=pow((first brightness-third brightness)/(second brightness-third brightness), shinness), where shinness is a preset brightness radius.
在通过方法一或方法二确定调整系数以后,可以根据得到的调整系数,以及预设的光源值来对初始目标颜色进行调整,得到目标颜色:After the adjustment coefficient is determined by method 1 or method 2, the initial target color can be adjusted according to the obtained adjustment coefficient and the preset light source value to obtain the target color:
目标颜色=初始目标颜色+调整系数×光源值。Target color = initial target color + adjustment factor × light source value.
其中,第一亮度可以为根据像素点的原始颜色的颜色值所确定的亮度值,其中,亮度值可以通过对颜色值进行计算所确定,在一个示例中,亮度值可以根据颜色值中三个颜色通道(红色R、绿色G以及蓝色B)的值进行计算所得到。Wherein, the first brightness may be a brightness value determined according to the color value of the original color of the pixel, where the brightness value may be determined by calculating the color value, and in one example, the brightness value may be determined according to three of the color values The values of the color channels (Red R, Green G, and Blue B) are calculated.
第二亮度可以根据具有目标亮度的像素点的颜色值所确定,其中,具有目标亮度的像素点,可以是在人脸图像的目标部位中,位于像素点的预设处理范围以内且具有最高亮度的像素点。其中,预设处理范围的范围大小可以根据实际情况灵活设定,在本公开实施例中不做限制。The second brightness may be determined according to the color value of the pixel with the target brightness, wherein the pixel with the target brightness may be located within the preset processing range of the pixel in the target part of the face image and has the highest brightness of pixels. Wherein, the size of the preset processing range can be flexibly set according to actual conditions, and is not limited in this embodiment of the present disclosure.
第三亮度可以是根据对像素点的中间颜色的颜色值所确定的亮度值,其中,像素点的中间颜色,可以是通过预设卷积核对像素点进行滤波后所得到的颜色。其中,预设卷积核的形式与大小可以根据实际情况灵活设定,在一种可能的实现方式中,预设卷积核的滤波范围与上述公开实施例中的预设处理范围一致,即在一个示例中,一方面可以通过预设卷积核对像素点进行滤波处理,得到该像素点在滤波后的中间颜色,并根据中间颜色的颜色值计算对应的亮度值,作为第三亮度,另一方面可以将预设卷积核对像素点进行滤波所覆盖的区域范围作为预设处理范围,则人脸图像的目标部位中,位于该预设处理范围以内且具有最高亮度的像素点的亮度值,可以作为第二亮度。The third brightness may be a brightness value determined according to a color value of an intermediate color of a pixel, wherein the intermediate color of a pixel may be a color obtained by filtering the pixel through a preset convolution kernel. Wherein, the form and size of the preset convolution kernel can be flexibly set according to the actual situation. In a possible implementation, the filtering range of the preset convolution kernel is consistent with the preset processing range in the above disclosed embodiments, namely In an example, on the one hand, the pixel can be filtered through the preset convolution kernel to obtain the intermediate color of the pixel after filtering, and the corresponding brightness value can be calculated according to the color value of the intermediate color as the third brightness; On the one hand, the area covered by the preset convolution kernel to filter the pixels can be used as the preset processing range, then in the target part of the face image, the brightness value of the pixel that is within the preset processing range and has the highest brightness , can be used as the second brightness.
预设的光源值可以根据美化操作中输入的调整参数中的亮度强度所确定。The preset light source value may be determined according to the brightness intensity in the adjustment parameters input during the beautification operation.
在一些可能的实现方式中,处理类型还可以包括雾面光效、水润光效或闪烁光效等,在这些情况下,可以利用上述公开实施例中提到的第一亮度、第二亮度和第三亮度来对初始目标颜色进行适应性地调整,得到与处理类型匹配的目标颜色等。处理方式可以根据实际情况灵活决定,在本公开实施例中不做限定。In some possible implementations, the processing type may also include matte light effects, wet light effects, or flickering light effects, etc. In these cases, the first brightness and second brightness mentioned in the above disclosed embodiments may be used and the third brightness to adaptively adjust the initial target color to obtain the target color matching the processing type, etc. The processing manner can be flexibly determined according to the actual situation, and is not limited in this embodiment of the present disclosure.
通过本公开实施例,可以在美化操作对应的处理类型不同的情况下,选择不同的方式对初始目标颜色进行调整以确定目标颜色,提高了美化操作的灵活性;而且通过随机获取的噪声值,来对目标部位中至少一个像素点的初始目标颜色进行调整,可以基于随机数据调整颜色,得到更加自然的金属光效果。Through the embodiments of the present disclosure, when the processing types corresponding to the beautification operation are different, different methods can be selected to adjust the initial target color to determine the target color, which improves the flexibility of the beautification operation; and through the randomly obtained noise value, To adjust the initial target color of at least one pixel in the target part, the color can be adjusted based on random data to obtain a more natural metallic light effect.
基于上述各公开实施例,可以得到对人脸图像进行美化操作后得到的美化后的人脸图像。图8示出了人脸图像的示意图,对图8中的人脸图像进行美化操作后,得到了图9中美化后的人脸图像的示意图(为了对图像中的对象进行保护,各图中人脸的部分部位进行了马赛克处理),通过对比可以看出,根据上述各公开实施例提出的图像处理方法,可以得到较为真实自然,对唇部具有较好美化效果的美化后的人脸图像。Based on the above disclosed embodiments, it is possible to obtain a beautified human face image obtained by performing a beautification operation on the human face image. Fig. 8 shows a schematic diagram of a human face image. After the beautification operation is performed on the human face image in Fig. 8, a schematic diagram of the beautified human face image in Fig. 9 is obtained (in order to protect the objects in the image, each figure Mosaic processing has been carried out on some parts of the human face), as can be seen by comparison, according to the image processing methods proposed in the above-mentioned various disclosed embodiments, a more real and natural human face image after beautification with a better beautifying effect on the lips can be obtained .
在一些可能的实现方式中,本公开实施例中提出的方法还可以包括:In some possible implementation manners, the methods proposed in the embodiments of the present disclosure may further include:
响应于预览操作,显示美化后的人脸图像。In response to the preview operation, the beautified face image is displayed.
其中,预览操作可以为用户选择的,需要对美化后的人脸图像进行实时预览的操作。响应于该预览操作,可以在人机交互界面中显示美化后的人脸图像,以供用户查看。Wherein, the preview operation may be selected by the user, and needs to perform a real-time preview operation on the beautified face image. In response to the preview operation, the beautified face image may be displayed on the human-computer interaction interface for the user to view.
在一些可能的实现方式中,也可以将生成的美化后的人脸图像主动进行实时显示。In some possible implementation manners, the generated beautified face image may also be actively displayed in real time.
通过本公开实施例,可以响应于预览操作,实时显示美化后的人脸图像,提升与用户之间的交互程度,提升用户的使用感受。Through the embodiments of the present disclosure, the beautified human face image can be displayed in real time in response to the preview operation, so as to improve the degree of interaction with the user and enhance the user experience.
图10示出根据本公开一实施例的图像处理装置的框图。如图10所示,所述图像处理装置20可以包括:FIG. 10 shows a block diagram of an image processing device according to an embodiment of the present disclosure. As shown in Figure 10, the image processing device 20 may include:
接收模块21,配置为接收对人脸图像的目标部位的美化操作。The receiving module 21 is configured to receive the beautification operation on the target part of the face image.
生成模块22,配置为基于美化操作中输入的目标部位的美化颜色参数,生成与美化颜色参数匹配的目标颜色查找表。The generation module 22 is configured to generate a target color lookup table matching the beautification color parameters based on the beautification color parameters of the target part input in the beautification operation.
美化模块23,配置为根据人脸图像的目标部位中像素点的原始颜色以及目标颜色查找表,生成美化后的人脸图像。The beautification module 23 is configured to generate a beautified human face image according to the original color of the pixels in the target part of the human face image and the target color lookup table.
在一种可能的实现方式中,生成模块配置为:获取预设颜色查找表,以及与预设颜色查找表对应的预设颜色参数;确定美化颜色参数与预设颜色参数之间的颜色偏差;基于颜色偏差,对预设颜色查找表的第一输出颜色参数进行调整,得到目标颜色查找表。In a possible implementation manner, the generating module is configured to: acquire a preset color lookup table and preset color parameters corresponding to the preset color lookup table; determine the color deviation between the beautification color parameters and the preset color parameters; Based on the color deviation, the first output color parameter of the preset color lookup table is adjusted to obtain a target color lookup table.
在一种可能的实现方式中,颜色偏差包括美化颜色参数与预设颜色参数在预设颜色空间中的颜色偏差;生成模块配置为:将预设颜色查找表中的第一输出颜色参数转换至预设颜色空间,得到第二输出颜色参数;在预设颜色空间中,根据颜色偏差、美化颜色参数、或颜色偏差和美化颜色参数,对第二输出颜色参数进行调整,得到第三输出颜色参数;根据第三输出颜色参数,生成目标颜色查找表。In a possible implementation manner, the color deviation includes the color deviation between the beautification color parameter and the preset color parameter in the preset color space; the generation module is configured to: convert the first output color parameter in the preset color lookup table to Preset the color space to obtain the second output color parameter; in the preset color space, adjust the second output color parameter according to the color deviation, the beautification color parameter, or the color deviation and the beautification color parameter, to obtain the third output color parameter ; Generate a target color lookup table according to the third output color parameter.
在一种可能的实现方式中,预设颜色空间中的颜色参数分量包括:色调分量、饱和度分量以及明度分量;生成模块配置为以下操作中的至少一种:根据美化颜色参数的色调分量,对第二输出颜色参数的色调分量进行调整,得到第三输出颜色参数的色调分量;根据颜色偏差的饱和度分量,对第二输出颜色参数的色调分量进行调整,得到第三输出颜色参数的饱和度分量;根据颜色偏差的明度分量,对第二输出颜色参数的明度分量进行调整,得到第三输出颜色参数的明度分量。In a possible implementation manner, the color parameter components in the preset color space include: a hue component, a saturation component, and a lightness component; the generation module is configured to at least one of the following operations: according to the hue component of the beautification color parameter, Adjust the hue component of the second output color parameter to obtain the hue component of the third output color parameter; adjust the hue component of the second output color parameter according to the saturation component of the color deviation to obtain the saturation of the third output color parameter brightness component; according to the brightness component of the color deviation, the brightness component of the second output color parameter is adjusted to obtain the brightness component of the third output color parameter.
在一种可能的实现方式中,生成模块配置为:在第三输出颜色参数属于预设范围的情况下,将第三输出颜色参数作为目标颜色查找表中的目标输出颜色参数;在第三输出颜色参数超过预设范围的情况下,基于预设范围的临界颜色参数,确定目标颜色查找表中的目标输出颜色参数。In a possible implementation manner, the generating module is configured to: when the third output color parameter belongs to a preset range, use the third output color parameter as the target output color parameter in the target color lookup table; When the color parameter exceeds the preset range, the target output color parameter in the target color lookup table is determined based on the critical color parameter in the preset range.
在一种可能的实现方式中,美化模块配置为:在目标颜色查找表中,查找与目标部位中像素点的原始颜色对应的目标输出颜色参数,作为目标部位中像素点的初始目标颜色;根据目标部位中像素点的初始目标颜色,确定目标部位中像素点的目标颜色;基于目标部位中像素点的原始颜色和目标颜色,得到美化后的人脸图像。In a possible implementation, the beautification module is configured to: in the target color lookup table, look up the target output color parameter corresponding to the original color of the pixel in the target part as the initial target color of the pixel in the target part; The initial target color of the pixels in the target part is determined to determine the target color of the pixels in the target part; based on the original color and the target color of the pixels in the target part, a beautified face image is obtained.
在一种可能的实现方式中,美化模块配置为:在美化操作中的处理类型包括自然处理的情况下,将目标部位中像素点的初始目标颜色,作为目标部位中像素点的目标颜色;或者,在美化操作中的处理类型包括金属光效处理的情况下,基于随机获取的噪声值,对目标部位中像素点的初始目标颜色进行调整,得到目标部位中像素点的目标颜色。In a possible implementation manner, the beautification module is configured to: when the processing type in the beautification operation includes natural processing, use the initial target color of the pixels in the target part as the target color of the pixels in the target part; or , when the processing type in the beautification operation includes metal light effect processing, the initial target color of the pixel in the target part is adjusted based on the randomly obtained noise value, and the target color of the pixel in the target part is obtained.
在一种可能的实现方式中,美化操作包括唇妆操作,目标部位包括嘴唇部位。In a possible implementation manner, the beautification operation includes a lip makeup operation, and the target part includes a lip part.
应用场景示例Application Scenario Example
在计算机视觉领域,如何得到更加真实自然的唇妆处理后的图像成为目前一个亟待解决的问题。In the field of computer vision, how to obtain more realistic and natural lip makeup processed images has become an urgent problem to be solved.
本公开基于图11的示例提出了一种图像处理方法,包括如下过程:The present disclosure proposes an image processing method based on the example of FIG. 11 , including the following process:
步骤S111,接收用户在输入界面输入的RGB形式的美化颜色参数10(target_color)、在输入界面选择的处理类型(如图11中的水润、高亮或雾面11等)以及输入的调整参数(如图11中的强度12和亮度强度13等)。Step S111, receiving the beautification color parameter 10 (target_color) in RGB format input by the user on the input interface, the processing type selected on the input interface (such as water, highlight or matte 11 in Figure 11) and the input adjustment parameters (Intensity 12 and Brightness Intensity 13 in Figure 11, etc.).
步骤S112,获取用户通过上传照片视频14或选择模特所确定的人脸图像15。Step S112, acquiring the face image 15 determined by the user by uploading photos and videos 14 or selecting a model.
步骤S113,根据美化颜色参数10,对于预设颜色参数(lip_ref_color)匹配的预设颜色查找表进行调整,以生成目标颜色查找表。其中,预设颜色参数可以是未经任何唇妆处理过的嘴唇原色,生成目标颜色查找表的过程如下:Step S113, according to the beautification color parameter 10, adjust the preset color lookup table matched with the preset color parameter (lip_ref_color), so as to generate a target color lookup table. Wherein, the preset color parameter can be the primary color of the lips without any lip makeup treatment, and the process of generating the target color lookup table is as follows:
遍历预设颜色查找表的多个第一输出颜色,将多个第一输出颜色转换到HSV颜色空间(H为色相,S为饱和度,V为亮度,均转换到[0.0,1.0]的范围),得到多个第二输出颜色所构成的第二输出颜色参数(table_hsv);Traverse the multiple first output colors of the preset color lookup table, convert the multiple first output colors to the HSV color space (H is hue, S is saturation, V is brightness, all converted to the range of [0.0, 1.0] ), to obtain the second output color parameter (table_hsv) composed of a plurality of second output colors;
将美化颜色参数以及预设颜色参数均转换到HSV颜色空间,得到HSV颜色空间中的美化颜色参数(target_hsv)和HSV颜色空间中的预设颜色参数(lip_ref_hsv);All the beautification color parameters and the preset color parameters are converted to the HSV color space, and the beautification color parameters (target_hsv) in the HSV color space and the preset color parameters (lip_ref_hsv) in the HSV color space are obtained;
通过上述公开实施例中的公式(1),计算预设颜色空间中美化颜色参数与预设颜色参数之间的颜色偏差(diff);Calculate the color deviation (diff) between the beautification color parameter and the preset color parameter in the preset color space through the formula (1) in the above-mentioned disclosed embodiment;
通过上述公开实施例中的公式(2)、(4)和(5),得到目标输出颜色参数的H分量、S分量和V分量,从而得到目标输出颜色参数。Through the formulas (2), (4) and (5) in the disclosed embodiments above, the H component, the S component and the V component of the target output color parameter are obtained, thereby obtaining the target output color parameter.
步骤S114,通过唇部掩模图像来获取需要做唇妆的部位图像,基于该做唇妆的部位图像,提取人脸图像中唇妆部位的像素的原始颜色,基于该原始颜色在目标颜色查找表中查找,得到唇妆部位的目标颜色16。Step S114, using the lip mask image to obtain the image of the part where lip makeup needs to be done, based on the image of the part where lip makeup is to be done, extract the original color of the pixel of the lip makeup part in the face image, and based on the original color, search in the target color Look up in the table to get the target color 16 of the lip makeup part.
步骤S115,将查找到的目标颜色与原始颜色,按照用户输入的调整参数中的强度进行融合,生成美化后的人脸图像。In step S115 , the searched target color and the original color are fused according to the intensity in the adjustment parameter input by the user to generate a beautified face image.
在用户点击输入界面中的“预览AR实时妆效17”的情况下,在输入界面中显示美化后的人脸图像。When the user clicks "Preview AR real-time makeup effect 17" in the input interface, the beautified face image is displayed in the input interface.
通过本公开应用示例,可以通过接收美化操作中的美化颜色参数,支持用户任意选择唇妆的颜色值,并基于该颜色值生成目标颜色查找表以实现唇妆操作,从而大大提升用户选择唇妆效果的自由度。Through the application example of this disclosure, by receiving the beautification color parameters in the beautification operation, the user can be supported to choose the color value of the lip makeup arbitrarily, and a target color lookup table is generated based on the color value to realize the lip makeup operation, thereby greatly improving the user's choice of lip makeup. Effect degrees of freedom.
本公开应用示例中提出的图像处理方法,除了可以应用于对人脸图像中的唇部进行美化操作以外,还可以扩展应用于其他部位的美化操作,比如腮红或是眼影等,随着美化操作类型的不同,本公开应用示例提出的图像处理方法可以相应的进行灵活扩展与改动。The image processing method proposed in the application example of this disclosure, in addition to being applied to the beautification operation of the lips in the face image, can also be extended to other parts of the beautification operation, such as blush or eye shadow, etc., with the beautification Depending on the type of operation, the image processing method proposed in the application examples of the present disclosure can be flexibly expanded and modified accordingly.
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例。It can be understood that the above-mentioned method embodiments mentioned in this disclosure can all be combined with each other to form a combined embodiment without violating the principle and logic.
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art can understand that in the above-mentioned method of specific implementation, the writing order of each step does not imply a strict execution order and constitutes any limitation on the implementation process, and the execution order of each step should be based on its function and possible internal Logically OK.
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是易失性计算机可读存储介质或非易失性计算机可读存储介质。Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer program instructions are stored, and the above-mentioned method is implemented when the computer program instructions are executed by a processor. The computer readable storage medium may be a volatile computer readable storage medium or a nonvolatile computer readable storage medium.
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为上述方法。An embodiment of the present disclosure also proposes an electronic device, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured as the above method.
在实际应用中,上述存储器可以是易失性存储器(Volatile Memory),例如随机存取存储器(Random Access Memory,RAM);或者非易失性存储器(Non-Volatile Memory),例如只读存储器(Read Only Memory,ROM),快闪存储器(Flash Memory),硬盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD);或者上述种类的存储器的组合,并向处理器提供指令和数据。In practical applications, the memory above can be a volatile memory (Volatile Memory), such as a random access memory (Random Access Memory, RAM); or a non-volatile memory (Non-Volatile Memory), such as a read-only memory (Read-Only Memory). Only Memory, ROM), flash memory (Flash Memory), hard disk (Hard Disk Drive, HDD) or solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memory, and provide instructions and data to the processor .
上述处理器可以为应用专用集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(Digital Signal Processing Device,DSPD)、可编程逻辑器件(programmable logic device,PLD)、现场可编程门阵列(Field Programmable Gate Array,FPGA)、中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本公开实施例不作限定。The above-mentioned processor can be an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processing, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (programmable logic At least one of device, PLD), field programmable gate array (Field Programmable Gate Array, FPGA), central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor. It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not limited in this embodiment of the present disclosure.
电子设备可以被提供为终端、服务器或其它形态的设备。Electronic devices may be provided as terminals, servers, or other forms of devices.
基于前述实施例相同的技术构思,本公开实施例还提供了一种计算机程序,该计算机程序被处理器执行时实现上述方法。Based on the same technical idea as the foregoing embodiments, the embodiments of the present disclosure further provide a computer program, which implements the above method when the computer program is executed by a processor.
图12是根据本公开实施例的一种电子设备800的框图。例如,电子设备800可以是移 动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。FIG. 12 is a block diagram of an electronic device 800 according to an embodiment of the present disclosure. For example, the electronic device 800 may be a terminal such as a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
如图12所示,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(Input/Output,I/O)的接口812,传感器组件814,以及通信组件816。As shown in FIG. 12 , the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (Input/Output, I/O) interface 812 , sensor component 814 , and communication component 816 .
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。The memory 804 is configured to store various types of data to support operations at the electronic device 800 . Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like.
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。The power supply component 806 provides power to various components of the electronic device 800 . Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 .
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,多媒体组件808包括以下至少之一:一个前置摄像头、后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头、后置摄像头或前置摄像头和后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the user. In some embodiments, the multimedia component 808 includes at least one of the following: a front camera and a rear camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera, the rear camera, or the front camera and the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件810被配置为输出、输入或输出和输入音频信号。例如,音频组件810包括一个麦克风(Microphone,MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。The audio component 810 is configured to output, input, or both output and input audio signals. For example, the audio component 810 includes a microphone (Microphone, MIC), and when the electronic device 800 is in an operation mode, such as a calling mode, a recording mode and a voice recognition mode, the microphone is configured to receive an external audio signal. Received audio signals may be stored in memory 804 or sent via communication component 816 . In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位等。 Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 . For example, sensor assembly 814 may detect an open/closed state of electronic device 800, relative positioning of components, and the like.
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices.
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。In an exemplary embodiment, there is also provided a non-volatile computer-readable storage medium, such as the memory 804 including computer program instructions, which can be executed by the processor 820 of the electronic device 800 to implement the above method.
本公开可以是以下至少之一:系统、方法、计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。The present disclosure may be at least one of the following: a system, a method, and a computer program product. A computer program product may include a computer readable storage medium having computer readable program instructions thereon for causing a processor to implement various aspects of the present disclosure.
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是,但不限于电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。A computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer readable storage medium may be, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过以下至少之一:网络、例如因特网、局域网、广域网、无线网下载到外部计算机或外部存储设备。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存 储介质中。The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device via at least one of a network such as the Internet, a local area network, a wide area network, or a wireless network . A network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(Instruction Set Architecture,ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以至少一种编程语言的任意组合编写的源代码或目标代码。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。Computer program instructions for performing the operations of the present disclosure may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or programmed in at least one source or object code written in any combination of languages. Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图、框图或流程图和框图描述了本公开的各个方面。应当理解,流程图、框图或流程图和框图的每个方框以及流程图、框图或流程图和框图中各方框的组合,都可以由计算机可读程序指令实现。Aspects of the present disclosure are described herein with reference to flowchart illustrations, block diagrams, or flowchart illustrations and block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It should be understood that each block of the flowcharts, block diagrams, or both, and combinations of blocks in the flowcharts, block diagrams, or flowcharts and block diagrams, can be implemented by computer-readable program instructions.
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图、框图或流程图和框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得以下至少之一,包括:计算机、可编程数据处理装置、其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图、框图或流程图和框图中的一个或多个方框中规定的功能/动作的各个方面的指令。These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing an apparatus for realizing the functions/actions specified in one or more blocks in the flowchart, block diagram, or both the flowchart and the block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause at least one of the following, including: a computer, a programmable data processing device, and other equipment to work in a specific way, so that the computer that stores the instructions The readable medium then includes an article of manufacture including instructions for implementing various aspects of the functions/acts specified in the flowchart, block diagram, or one or more blocks in the flowchart and the block diagram.
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图、框图或流程图和框图中的一个或多个方框中规定的功能/动作。It is also possible to load computer-readable program instructions into a computer, other programmable data processing device, or other equipment, so that a series of operational steps are performed on the computer, other programmable data processing device, or other equipment to produce a computer-implemented process , so that instructions executed on computers, other programmable data processing devices, or other devices implement the functions/actions specified in the flowcharts, block diagrams, or one or more blocks in the flowcharts and block diagrams.
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图、流程图或框图和流程图中的每个方框、以及框图、流程图或框图和流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions. In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also to be noted that each block in the block diagrams, flowcharts, or both, and combinations of blocks in the block diagrams, flowcharts, or block diagrams and flowcharts, may be represented by special purpose components that perform the specified function or action. The implementation can be implemented by a hardware-based system, or it can be implemented by a combination of special purpose hardware and computer instructions.
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。Having described various embodiments of the present disclosure above, the foregoing description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and alterations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principle of each embodiment, practical application or technical improvement in the market, or to enable other ordinary skilled in the art to understand each embodiment disclosed herein.
本公开实施例中,图像处理方法包括:接收对人脸图像的目标部位的美化操作;基于所述美化操作中输入的所述目标部位的美化颜色参数,生成与所述美化颜色参数匹配的目标颜色查找表;根据所述人脸图像的目标部位中像素点的原始颜色以及所述目标颜色查找表,生成美化后的人脸图像。在本公开实施例中,通过接收对人脸图像目标部位的美化操作,并基于美化操作中输入的美化颜色参数,生成与美化颜色参数匹配对应的颜色查找表,从而根据人脸图像目标部位中像素点的原始颜色以及目标颜色查找表,来生成美化后的人脸图像。通过上述过程,可以根据美化操作中任意输入的美化颜色参数,来生成对应的目标颜色查找表,以实现对目标部位颜色的美化,一方面可以通过任意输入的美化颜色参数丰富美化操作的颜色,提升美化操作的自由度;另一方面还可以通过目标颜色查找表使得美化后的人脸图像具有较为自然的美化效果。In an embodiment of the present disclosure, the image processing method includes: receiving a beautification operation on a target part of a human face image; generating a target that matches the beautification color parameter based on the beautification color parameters of the target part input in the beautification operation A color lookup table: generate a beautified face image according to the original color of the pixels in the target part of the face image and the target color lookup table. In the embodiment of the present disclosure, by receiving the beautification operation on the target part of the face image, and based on the beautification color parameters input in the beautification operation, a color lookup table corresponding to the beautification color parameter matching is generated, so that according to the target part of the face image The original color of the pixel and the target color lookup table to generate a beautified face image. Through the above process, the corresponding target color lookup table can be generated according to any input beautification color parameters in the beautification operation, so as to realize the beautification of the color of the target part. On the one hand, the color of the beautification operation can be enriched by any input beautification color parameters. Improve the freedom of beautification operation; on the other hand, the beautified face image can have a more natural beautification effect through the target color lookup table.
Claims (12)
- 一种图像处理方法,包括:An image processing method, comprising:接收对人脸图像的目标部位的美化操作;Receive a beautification operation on the target part of the face image;基于所述美化操作中输入的所述目标部位的美化颜色参数,生成与所述美化颜色参数匹配的目标颜色查找表;generating a target color lookup table matching the beautification color parameters based on the beautification color parameters of the target part input in the beautification operation;根据所述人脸图像的目标部位中像素点的原始颜色以及所述目标颜色查找表,生成美化后的人脸图像。A beautified human face image is generated according to the original color of the pixels in the target part of the human face image and the target color lookup table.
- 根据权利要求1所述的方法,其中,所述基于所述美化操作中输入的所述目标部位的美化颜色参数,生成目标颜色查找表,包括:The method according to claim 1, wherein the generating a target color lookup table based on the beautification color parameters of the target part input in the beautification operation includes:获取预设颜色查找表,以及与所述预设颜色查找表对应的预设颜色参数;Acquiring a preset color lookup table, and preset color parameters corresponding to the preset color lookup table;确定所述美化颜色参数与所述预设颜色参数之间的颜色偏差;determining a color deviation between the beautification color parameters and the preset color parameters;基于所述颜色偏差,对所述预设颜色查找表的第一输出颜色参数进行调整,得到所述目标颜色查找表。Based on the color deviation, the first output color parameter of the preset color lookup table is adjusted to obtain the target color lookup table.
- 根据权利要求2所述的方法,其中,所述颜色偏差包括所述美化颜色参数与所述预设颜色参数在预设颜色空间中的颜色偏差;The method according to claim 2, wherein the color deviation comprises a color deviation between the beautification color parameter and the preset color parameter in a preset color space;所述基于所述颜色偏差,对所述预设颜色查找表的第一输出颜色参数进行调整,得到所述目标颜色查找表,包括:The adjusting the first output color parameter of the preset color lookup table based on the color deviation to obtain the target color lookup table includes:将所述预设颜色查找表中的第一输出颜色参数转换至所述预设颜色空间,得到第二输出颜色参数;converting the first output color parameter in the preset color lookup table to the preset color space to obtain a second output color parameter;在所述预设颜色空间中,根据所述颜色偏差、所述美化颜色参数、或所述颜色偏差和所述美化颜色参数,对所述第二输出颜色参数进行调整,得到第三输出颜色参数;In the preset color space, adjusting the second output color parameter according to the color deviation, the beautification color parameter, or the color deviation and the beautification color parameter, to obtain a third output color parameter ;根据所述第三输出颜色参数,生成所述目标颜色查找表。Generate the target color lookup table according to the third output color parameter.
- 根据权利要求3所述的方法,其中,所述预设颜色空间中的颜色参数分量包括:色调分量、饱和度分量以及明度分量;The method according to claim 3, wherein the color parameter components in the preset color space include: a hue component, a saturation component, and a lightness component;所述在所述预设颜色空间中,根据所述颜色偏差、所述美化颜色参数、或所述颜色偏差和所述美化颜色参数,对所述第二输出颜色参数进行调整,得到第三输出颜色参数,包括以下操作中的至少一种:In the preset color space, adjusting the second output color parameter according to the color deviation, the beautification color parameter, or the color deviation and the beautification color parameter, to obtain a third output Color parameters, including at least one of the following operations:根据所述美化颜色参数的色调分量,对所述第二输出颜色参数的色调分量进行调整,得到所述第三输出颜色参数的色调分量;adjusting the hue component of the second output color parameter according to the hue component of the beautification color parameter to obtain the hue component of the third output color parameter;根据所述颜色偏差的饱和度分量,对所述第二输出颜色参数的色调分量进行调整,得到所述第三输出颜色参数的饱和度分量;adjusting the hue component of the second output color parameter according to the saturation component of the color deviation to obtain the saturation component of the third output color parameter;根据所述颜色偏差的明度分量,对所述第二输出颜色参数的明度分量进行调整,得到所述第三输出颜色参数的明度分量。According to the brightness component of the color deviation, the brightness component of the second output color parameter is adjusted to obtain the brightness component of the third output color parameter.
- 根据权利要求3或4所述的方法,其中,所述根据所述第三输出颜色参数,生成所述目标颜色查找表,包括:The method according to claim 3 or 4, wherein said generating said target color lookup table according to said third output color parameter comprises:在所述第三输出颜色参数属于预设范围的情况下,将所述第三输出颜色参数作为所述目标颜色查找表中的目标输出颜色参数;When the third output color parameter belongs to a preset range, using the third output color parameter as a target output color parameter in the target color lookup table;在所述第三输出颜色参数超过预设范围的情况下,基于所述预设范围的临界颜色参数,确定所述目标颜色查找表中的目标输出颜色参数。If the third output color parameter exceeds a preset range, the target output color parameter in the target color lookup table is determined based on a critical color parameter in the preset range.
- 根据权利要求1至5中任意一项所述的方法,其中,所述根据所述人脸图像的目标部位中像素点的原始颜色以及所述目标颜色查找表,生成美化后的人脸图像,包括:The method according to any one of claims 1 to 5, wherein the beautified human face image is generated according to the original color of the pixels in the target part of the human face image and the target color lookup table, include:在所述目标颜色查找表中,查找与所述目标部位中像素点的原始颜色对应的目标输出颜色参数,作为所述目标部位中像素点的初始目标颜色;In the target color lookup table, look up the target output color parameter corresponding to the original color of the pixel in the target part as the initial target color of the pixel in the target part;根据所述目标部位中像素点的初始目标颜色,确定所述目标部位中像素点的目标颜色;determining the target color of the pixels in the target part according to the initial target color of the pixels in the target part;基于所述目标部位中像素点的原始颜色和所述目标颜色,确定美化后的人脸图像。Based on the original color of the pixels in the target part and the target color, a beautified human face image is determined.
- 根据权利要求6所述的方法,其中,所述根据所述目标部位中像素点的初始目标颜色,确定所述目标部位中像素点的目标颜色,包括:The method according to claim 6, wherein said determining the target color of the pixels in the target part according to the initial target color of the pixels in the target part comprises:在所述美化操作中的处理类型包括自然处理的情况下,将所述目标部位中像素点的初始目标颜色,作为所述目标部位中像素点的目标颜色;或者,When the processing type in the beautification operation includes natural processing, the initial target color of the pixels in the target part is used as the target color of the pixels in the target part; or,在所述美化操作中的处理类型包括金属光效处理的情况下,基于随机获取的噪声值,对所述目标部位中像素点的初始目标颜色进行调整,得到所述目标部位中像素点的目标颜色。In the case that the processing type in the beautification operation includes metal light effect processing, based on the randomly obtained noise value, the initial target color of the pixel in the target part is adjusted to obtain the target of the pixel in the target part color.
- 根据权利要求1至7中任意一项所述的方法,其中,所述美化操作包括唇妆操作,所述目标部位包括嘴唇部位。The method according to any one of claims 1 to 7, wherein the beautification operation includes a lip makeup operation, and the target site includes a lip site.
- 一种图像处理装置,包括:An image processing device, comprising:接收模块,配置为接收对人脸图像的目标部位的美化操作;The receiving module is configured to receive the beautification operation on the target part of the face image;生成模块,配置为基于所述美化操作中输入的所述目标部位的美化颜色参数,生成与所述美化颜色参数匹配的目标颜色查找表;A generation module configured to generate a target color lookup table matching the beautification color parameters based on the beautification color parameters of the target part input in the beautification operation;美化模块,配置为根据所述人脸图像的目标部位中像素点的原始颜色以及所述目标颜色查找表,生成美化后的人脸图像。The beautification module is configured to generate a beautified face image according to the original color of the pixels in the target part of the face image and the target color lookup table.
- 一种电子设备,包括:An electronic device comprising:处理器;processor;用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至8中任意一项所述的方法。Wherein, the processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1-8.
- 一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现权利要求1至8中任意一项所述的方法。A computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is realized.
- 一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令被计算机设备的处理器运行时,实现权利要求1至8中任意一项所述的方法。A computer program product, comprising a computer-readable storage medium storing program codes, the instructions included in the program codes are executed by a processor of a computer device to implement the method according to any one of claims 1 to 8.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110872286.2A CN113570581A (en) | 2021-07-30 | 2021-07-30 | Image processing method and device, electronic equipment and storage medium |
CN202110872286.2 | 2021-07-30 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023005850A1 true WO2023005850A1 (en) | 2023-02-02 |
Family
ID=78169582
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/107455 WO2023005850A1 (en) | 2021-07-30 | 2022-07-22 | Image processing method and apparatus, and electronic device, storage medium and computer program product |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113570581A (en) |
WO (1) | WO2023005850A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117808902A (en) * | 2024-03-01 | 2024-04-02 | 武汉昊一源科技有限公司 | Three-dimensional lookup table construction method, image processing method, device and storage medium |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113570581A (en) * | 2021-07-30 | 2021-10-29 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
CN114723600A (en) * | 2022-03-11 | 2022-07-08 | 北京字跳网络技术有限公司 | Method, device, equipment, storage medium and program product for generating cosmetic special effect |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180137604A1 (en) * | 2016-11-11 | 2018-05-17 | International Business Machines Corporation | Contextual personalized focus for variable depth of field photographs on social networks |
CN109361867A (en) * | 2018-11-23 | 2019-02-19 | 维沃移动通信有限公司 | A kind of filter processing method and mobile terminal |
CN110443747A (en) * | 2019-07-30 | 2019-11-12 | Oppo广东移动通信有限公司 | Image processing method, device, terminal and computer readable storage medium |
CN112767285A (en) * | 2021-02-23 | 2021-05-07 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
CN112801916A (en) * | 2021-02-23 | 2021-05-14 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
CN113570581A (en) * | 2021-07-30 | 2021-10-29 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109859299B (en) * | 2019-03-27 | 2020-12-22 | 腾讯科技(深圳)有限公司 | Portrait picture processing method and device, computer readable storage medium and computer equipment |
CN111062891A (en) * | 2019-12-16 | 2020-04-24 | Oppo广东移动通信有限公司 | Image processing method, device, terminal and computer readable storage medium |
-
2021
- 2021-07-30 CN CN202110872286.2A patent/CN113570581A/en active Pending
-
2022
- 2022-07-22 WO PCT/CN2022/107455 patent/WO2023005850A1/en unknown
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180137604A1 (en) * | 2016-11-11 | 2018-05-17 | International Business Machines Corporation | Contextual personalized focus for variable depth of field photographs on social networks |
CN109361867A (en) * | 2018-11-23 | 2019-02-19 | 维沃移动通信有限公司 | A kind of filter processing method and mobile terminal |
CN110443747A (en) * | 2019-07-30 | 2019-11-12 | Oppo广东移动通信有限公司 | Image processing method, device, terminal and computer readable storage medium |
CN112767285A (en) * | 2021-02-23 | 2021-05-07 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
CN112801916A (en) * | 2021-02-23 | 2021-05-14 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
CN113160094A (en) * | 2021-02-23 | 2021-07-23 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
CN113570581A (en) * | 2021-07-30 | 2021-10-29 | 北京市商汤科技开发有限公司 | Image processing method and device, electronic equipment and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117808902A (en) * | 2024-03-01 | 2024-04-02 | 武汉昊一源科技有限公司 | Three-dimensional lookup table construction method, image processing method, device and storage medium |
CN117808902B (en) * | 2024-03-01 | 2024-06-04 | 武汉昊一源科技有限公司 | Three-dimensional lookup table construction method, image processing method, device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113570581A (en) | 2021-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023005850A1 (en) | Image processing method and apparatus, and electronic device, storage medium and computer program product | |
WO2022179026A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
CN105409211B (en) | For the automatic white balance positive with skin-color adjustment of image procossing | |
CN113810602B (en) | Shooting method and electronic equipment | |
WO2022179025A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
CN113160094A (en) | Image processing method and device, electronic equipment and storage medium | |
WO2016127671A1 (en) | Image filter generating method and device | |
CN116569213A (en) | Semantical refinement of image regions | |
CN113965694B (en) | Video recording method, electronic device and computer readable storage medium | |
WO2023016035A1 (en) | Video processing method and apparatus, electronic device, and storage medium | |
CN108734754A (en) | Image processing method and device | |
CN113240760B (en) | Image processing method, device, computer equipment and storage medium | |
US20160240166A1 (en) | Image processing apparatus, image processing method, and computer-readable recording medium | |
WO2021136035A1 (en) | Photographing method and apparatus, storage medium, and electronic device | |
CN105574834B (en) | Image processing method and device | |
CN106210446A (en) | saturation enhancement method and device | |
WO2023005853A1 (en) | Image processing method and apparatus, electronic device, storage medium, and computer program product | |
CN107122103A (en) | A kind of image processing method and terminal | |
WO2023045946A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
WO2023045950A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
EP4287604A1 (en) | Video processing method and apparatus, electronic device, and storage medium | |
WO2022042160A1 (en) | Image processing method and apparatus | |
WO2021169810A1 (en) | Video processing method, and server | |
CN105447829B (en) | Image processing method and device | |
TWI234997B (en) | Method for using the image data to change the object and the type of the object |
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: 22848455 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |