WO2023010796A1 - 图像处理方法及相关装置 - Google Patents

图像处理方法及相关装置 Download PDF

Info

Publication number
WO2023010796A1
WO2023010796A1 PCT/CN2021/143390 CN2021143390W WO2023010796A1 WO 2023010796 A1 WO2023010796 A1 WO 2023010796A1 CN 2021143390 W CN2021143390 W CN 2021143390W WO 2023010796 A1 WO2023010796 A1 WO 2023010796A1
Authority
WO
WIPO (PCT)
Prior art keywords
brightness
skin color
color
image
initial
Prior art date
Application number
PCT/CN2021/143390
Other languages
English (en)
French (fr)
Inventor
谢富名
肖任意
赵薇
Original Assignee
展讯通信(上海)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 展讯通信(上海)有限公司 filed Critical 展讯通信(上海)有限公司
Publication of WO2023010796A1 publication Critical patent/WO2023010796A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/61Control of cameras or camera modules based on recognised objects
    • H04N23/611Control of cameras or camera modules based on recognised objects where the recognised objects include parts of the human body
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the present application relates to the technical field of image processing, in particular to an image processing method and related devices.
  • the face When taking selfies or photographing people, the face is often processed, such as whitening, thinning the face, etc.
  • the user can set the range and area to be processed by the user.
  • the existing facial processing includes image processing through built-in algorithms, but often It is a general-purpose algorithm, and it cannot be personalized to perform different facial processing for different users, and the effect of image processing is not ideal.
  • the present application proposes an image processing method and a related device, which can automatically beautify the image in combination with brightness-related information and physiological characteristics for the face area, improve the accuracy and effect of image processing, and greatly improve user experience.
  • the embodiment of the present application provides an image processing method, the method comprising:
  • an embodiment of the present application provides an image processing device, the image processing device comprising:
  • an image acquisition unit configured to acquire an initial image
  • the first brightness unit is used to determine the initial brightness of the face area of the face image in the initial image
  • a face recognition unit configured to determine the physiological characteristics of the face image
  • a skin color segmentation unit configured to determine a skin color area in the facial area
  • a second brightness unit configured to determine a target brightness according to the initial brightness and the physiological characteristics
  • An image processing unit configured to adjust the brightness of the skin color area according to the initial brightness and the target brightness, so as to obtain a target image.
  • an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured by the above Executed by a processor, the above program includes instructions for executing the steps in the first aspect of the embodiments of the present application.
  • the embodiment of the present application provides a computer storage medium, wherein the above computer storage medium stores a computer program for electronic data exchange, wherein the above computer program enables the computer to execute the computer program described in the first aspect of the embodiment of the present application Some or all of the steps described.
  • the embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable the computer to execute the program as implemented in the present application. Some or all of the steps described in the first aspect.
  • the computer program product may be a software installation package.
  • FIG. 1 is a system architecture diagram of an image processing method provided in an embodiment of the present application
  • FIG. 2 is a schematic flow chart of an image processing method provided in an embodiment of the present application.
  • FIG. 3 is a schematic diagram of feature points of a facial region provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 5 is a block diagram of functional units of an image processing device provided by an embodiment of the present application.
  • FIG. 6 is a block diagram of functional units of another image processing device provided by an embodiment of the present application.
  • the system architecture 100 includes a shooting module 110, a face detection module 120, a skin color segmentation module 130, and a face processing module 140, wherein the above-mentioned shooting module 110
  • the face detection module 120 is connected, the face detection module 120 is connected to the skin color segmentation module 130, and the face processing module 140 is connected to the camera module 110, the face detection module 120, and the skin color segmentation module 130 respectively.
  • the above-mentioned shooting module 110 may include a plurality of camera arrays, and the initial image may be acquired in video recording mode or shooting mode, and the above-mentioned face detection module 120 may be used to determine the feature point coordinates of the facial area of the face image in the initial image, the facial area
  • the above-mentioned skin color segmentation module 130 can have a built-in trained neural network model for determining the skin color area of the facial area.
  • the skin color area is an area that needs to be adjusted for brightness.
  • the processing module 140 is used to determine the target brightness according to the initial brightness and physiological characteristics from the face detection module 120, and adjust the brightness of the skin color area according to the target brightness and the initial brightness to obtain the target image.
  • the image can be automatically beautified for the face area, combined with brightness-related information and physiological characteristics, improving the accuracy and effect of image processing, and greatly improving the user experience.
  • FIG. 2 is a schematic flow chart of an image processing method provided in the embodiment of the present application, which specifically includes the following steps:
  • Step 201 acquiring an initial image.
  • the above-mentioned initial images may be multiple, and the above-mentioned initial images include human face images.
  • a plurality of continuous initial images can be obtained through the video recording mode.
  • the video recording mode here includes the preview mode when the camera module is turned on, and the picture displayed by the user equipment in the preview mode is also It belongs to the continuous initial images obtained in the video recording mode of the present application.
  • the above video recording mode also includes the recording mode after the camera module is turned on, which will not be repeated here.
  • At least one initial image may be captured through a shooting mode, which will not be repeated here.
  • acquiring the initial image in various ways can improve the flexibility of image acquisition, provide more application scenarios for subsequent image processing, and improve user experience.
  • Step 202 determining the initial brightness of the face area of the face image in the initial image.
  • the above-mentioned initial image can be automatically detected first to determine facial feature point information.
  • the above-mentioned facial feature point information can include a set of feature point coordinates, and then locate the nose region of the above-mentioned facial area according to the above-mentioned feature point coordinate set, and calculate the above-mentioned facial feature points respectively.
  • the average brightness of the three color channels in the nose area, the brightness of the first skin color corresponding to the first color channel, the brightness of the second skin color corresponding to the second color channel, and the third skin color corresponding to the third color channel Brightness, the above-mentioned initial brightness includes first skin color brightness, second skin color brightness and third skin color brightness.
  • the three color channels in the embodiment of the present application are common RGB color channels, namely R (Red) channel, G (Green) channel and B (Blue) channel, it can be understood that the first color channel, the second The color channel and the third color channel are different from each other.
  • the first color channel is the R channel
  • the second color channel is the G channel
  • the third color channel is the B channel. limitations, which will not be repeated here.
  • Figure 3 is a schematic diagram of a facial feature point provided by the embodiment of the present application. It can be seen that a total of 123 points are used to mark the contour of the face, eyes, and nose.
  • the distribution statistics of this area in the RGB color space domain obtain the average brightness of each channel, that is, the brightness of the first skin color, the brightness of the second skin color and the brightness of the third skin color.
  • the alignment process can determine the coordinates of feature points with higher accuracy, and obtain more accurate initial brightness, which can improve the accuracy of subsequent image processing.
  • Step 203 determining the physiological characteristics of the face image.
  • the physiological characteristics can be determined by the facial recognition model, which can be a convolutional neural network model trained to recognize the physiological characteristics reflected by the face in the image, and the above-mentioned physiological characteristics can include gender, age, race and other information will not be repeated here.
  • Step 204 determine the skin color area in the facial area.
  • the above-mentioned skin color region may be a skin region in a face image, for example, a skin region excluding hair, eyes and other occlusions, glasses, accessories and the like.
  • the facial contour point set when the initial image is acquired in the video recording mode, can be determined according to the above-mentioned feature point coordinate set, and the facial contour point set is triangulated and rendered to determine the preview skin color area, and finally perform adaptive mean filtering on the preview skin color area to determine the skin color area.
  • point 1 to point 33 and point 105 to point 123 can be used as the contour point set of the face, and these points can be triangulated and rendered to obtain the preview skin color area mask nTmp , and then pass The following formula performs adaptive filtering to obtain the skin color area mask n :
  • radio MAX(Dist(pt 75 , pt 84 ), Dist(pt 52 , pt 99 ))/10
  • Blur() represents the average value filter with a radius of radio
  • pt represents a point
  • the number after pt represents a specific point in Figure 3, which will not be repeated here.
  • the initial image when the initial image is acquired in the shooting mode, the initial image can be input into the skin color segmentation model, and the preview skin color area and the gray scale of the skin color area can be determined according to the output of the skin color segmentation model Finally, according to the grayscale image of the skin color area, guide filtering is performed on the preview skin color area to obtain the skin color area.
  • the above skin color segmentation model can be a trained convolutional neural network model for skin color area segmentation, and mask nTmp can be obtained through the above skin color segmentation model, and then grayscaled to obtain the above skin color
  • the area grayscale mask gray at this time the skin tone area grayscale mask gray is used as a guide map, and the skin tone area mask n is determined by the following formula:
  • mask n fast Guide Filter(mask nTmp , mask gray , radio, eps, scale)
  • radio MAX(Dist(pt 75 , pt 84 ), Dist(pt 52 , pt 99 ))/20
  • radio is the filter radius
  • eps is the threshold for defining the smooth area and edge area
  • scale is the magnification of image downsampling
  • pt is the point in Figure 3
  • the number after pt indicates the specific point in Figure 3, here No longer.
  • Step 205 determining a target brightness according to the initial brightness and the physiological characteristics.
  • the above-mentioned target brightness may include a first target brightness corresponding to the first color channel, a second target brightness corresponding to the second color channel, and a third target brightness corresponding to the third color channel.
  • the attribute weight parameter may be determined according to the physiological characteristics, and then the first target brightness and the second target brightness may be determined according to the attribute weight parameter, the first skin color brightness, the second skin color brightness and the third skin color brightness.
  • Brightness, a third target brightness the first target brightness corresponds to the first color channel
  • the second target brightness corresponds to the second color channel
  • the third target brightness corresponds to the third color channel.
  • the historical brightness information corresponding to the historical image may be acquired first, and the historical image is used to indicate the image of the previous frame of the initial image, so
  • the historical brightness information includes the first historical skin color brightness corresponding to the first color channel, the second historical skin color brightness corresponding to the second color channel, and the third historical skin color brightness corresponding to the third color channel, and then according to the The first historical skin color brightness, the second historical skin color brightness and the third historical skin color brightness perform brightness smoothing processing on the first skin color brightness, the second skin color brightness and the third skin color brightness to obtain the first A smooth skin color brightness, a second smooth skin color brightness and a third smooth skin color brightness, and then determine the first smooth skin color brightness according to the attribute weight parameter, the first smooth skin color brightness, the second smooth skin color brightness and the third smooth skin color brightness A color channel brightness gain parameter, a second color channel brightness gain parameter and a third color channel brightness gain parameter, finally, according to the first smooth skin color brightness, the second smooth skin color brightness, the third
  • the following formula can be used to perform brightness smoothing processing to obtain the first smooth skin color brightness light rTmp , the second smooth skin color brightness light gTmp and the third smooth skin color brightness light bTmp :
  • light refR represents the first historical skin color brightness
  • light refG represents the second historical skin color brightness
  • light refB represents the third historical skin color brightness
  • the image processing method of the present application processes each frame of image, so when multiple consecutive initial images are acquired in video recording mode, the current initial image can be processed based on the previous frame of historical image Perform brightness smoothing to prevent display problems caused by excessive brightness changes and improve user experience.
  • the target average brightness light oMean for adaptive adjustment according to the current attribute weight parameters corresponding to the first smooth skin color brightness light rTmp , the second smooth skin color brightness light gTmp , the third smooth skin color brightness light bTmp and physiological characteristics:
  • light iMean represents the average brightness of the initial target
  • hThr represents the preset constant value, which will not be repeated here
  • level is the preset whitening intensity level, which can be adjusted by the user
  • the whitening intensity level level is used to achieve the required whitening effect intensity.
  • atri w ⁇ [0,2] represents the attribute weight parameter.
  • the first target brightness light oR , the second target brightness light oG and the third target brightness light oB are calculated by the following formulas:
  • rbDiff MAX(ABS(light rTmp -light bTmp ),1)
  • bgDiff ABS(light gTmp -light bTmp )
  • MAX() means to take the maximum value
  • ABS() means to take the absolute value
  • CLIP() means to limit the data within the range
  • gUp means the brightness gain parameter of the first color channel
  • bUp means the brightness gain parameter of the second color channel
  • gamma Indicates the brightness gain parameter of the third color channel.
  • the function of the above three brightness gain parameters is mainly to control the brightness gain of the R, G, and B channels. If combined with physiological characteristics, fine-tuning the target brightness light oR , light oG , and light oB can also achieve different effects of whitening treatment; for example, when the user is a woman, appropriately increasing light oR can make the female face whitening effect more rosy captivating.
  • light_iMean represents the average brightness of the initial target
  • hThr represents the preset constant value, which will not be repeated here
  • w ⁇ (0,5], level ⁇ [0,100]] level is the preset whitening intensity level
  • atri_w ⁇ [0,2] represents the attribute weight parameter, by controlling this parameter, the whitening intensity can be precisely controlled for different skin colors, races, genders and ages.
  • first target brightness light_oR, the second target brightness light_oG and the third target brightness light_oB are calculated by the following formulas:
  • MAX() means to take the maximum value
  • ABS() means to take the absolute value
  • CLIP() means to limit the data within the range
  • gUp means the brightness gain parameter of the first color channel
  • bUp means the brightness gain parameter of the second color channel
  • gamma Indicates the brightness gain parameter of the third color channel.
  • the function of the above three brightness gain parameters is mainly to control the brightness gain of the R, G, and B channels. If you fine-tune the target brightness light_oR, light_oG, and light_oB in combination with physiological characteristics, you can also achieve different whitening effects; for example, when the user is a woman, appropriately increasing light_oR can make the female face whitening effect more rosy and captivating.
  • the target brightness that is more in line with the actual needs of the user can be determined based on the physiological characteristics, and the quality of image processing and user experience can be improved.
  • Step 206 Adjust the brightness of the skin color area according to the initial brightness and the target brightness to obtain a target image.
  • the Bessel can be determined according to the first skin color brightness, the second skin color brightness, the third skin color brightness, the first target brightness, the second target brightness and the third target brightness.
  • Curve brightness mapping table, the Bezier curve brightness mapping table includes a first color channel mapping table, a second color channel mapping table and a third color channel mapping table, and then convert the skin color according to the first color channel mapping table adjusting the first skin color brightness of the region to the first target brightness to obtain a first color channel image, and then adjusting the second skin color brightness of the skin color region to the second skin color brightness according to the second color channel mapping table to obtain For the second color channel image, finally, the third color channel image is obtained by adjusting the third skin color brightness of the skin color region to the third target brightness according to the third color channel mapping table.
  • the R channel whitening mapping curve Assume that the grayscale range of the image is [0,255], and the point pairs are set to ⁇ 0,0 ⁇ , ⁇ 1,1 ⁇ , ⁇ light iR ,light oR ⁇ , ⁇ 245,245 ⁇ , ⁇ 255,255 ⁇ , the points ⁇ 1,1 ⁇ , ⁇ 245,245 ⁇ are variable, and there is no limit to the number of point pairs here , mainly through the control points ⁇ light iR , light oR ⁇ to achieve smooth nonlinear brightness enhancement, and further, by solving the above-mentioned point pairs with Bezier curves, the Bezier curve whitening mapping table is obtained, that is, the first color channel
  • imgSrc R the above-mentioned imgSrc R , imgSrc G , and imgSrc B respectively represent images of each channel in the RGB color space of the original image, and details are not repeated here.
  • the image processing method at first, acquire an initial image; then, determine the initial brightness of the face region of the face image in the initial image; then, determine the physiological characteristics of the face image through a facial recognition model; then, determine the the skin color area in the facial area; then, determine the target brightness according to the initial brightness and the physiological characteristics; finally, adjust the brightness of the skin color area according to the initial brightness and the target brightness to obtain a target image . It can automatically beautify the image based on the facial area, combining brightness-related information and physiological characteristics, improving the accuracy and effect of image processing, and greatly improving the user experience.
  • FIG. 4 is a schematic structural diagram of an electronic device provided in the embodiment of the present application.
  • the electronic device 400 includes a processor 401, Interface 402 and memory 403, the processor, communication interface and memory are connected to each other, wherein the electronic device 400 may also include a bus 404, the processor 401, communication interface 402 and memory 403 may be connected to each other through the bus 404, the bus 404 It may be a Peripheral Component Interconnect (PCI for short) bus or an Extended Industry Standard Architecture (EISA for short) bus or the like.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus 404 can be divided into address bus, data bus, control bus and so on.
  • the memory 403 is used to store computer programs, the computer programs include program instructions, and the processor is configured to invoke the program instructions to execute all or part of the methods described in FIG. 2 above.
  • the electronic device includes hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software drives hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
  • the embodiment of the present application may divide the electronic device into functional units according to the above method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic, and is only a logical function division, and there may be another division manner in actual implementation.
  • FIG. 5 is the functional unit composition of an image processing device provided in the embodiment of the present application Block diagram, the image processing device 500 includes:
  • An image acquisition unit 510 configured to acquire an initial image
  • the first brightness unit 520 is used to determine the initial brightness of the face area of the face image in the initial image
  • a face recognition unit 530 configured to determine the physiological characteristics of the face image
  • a skin color segmentation unit 540 configured to determine the skin color area in the facial area
  • the second brightness unit 550 is configured to determine a target brightness according to the initial brightness and the physiological characteristics
  • An image processing unit 560 configured to adjust the brightness of the skin color area according to the initial brightness and the target brightness, so as to obtain a target image.
  • the image processing device 600 includes a processing unit 601 and a communication unit 602, wherein the processing The unit 601 is configured to execute any step in the above method embodiments, and when performing data transmission such as sending, the communication unit 602 can be optionally called to complete corresponding operations.
  • the image processing apparatus 600 may further include a storage unit 603 for storing program codes and data.
  • the processing unit 601 may be a processor
  • the communication unit 602 may be a touch screen
  • the storage unit 603 may be a memory.
  • the processing unit 601 is specifically used for:
  • Both the above image processing device 500 and the image processing device 600 can execute all the image processing methods included in the above embodiments.
  • An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables the computer to execute some or all of the steps of any method described in the above method embodiments .
  • An embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable the computer to execute any one of the methods described in the above method embodiments. Some or all steps of the method.
  • the computer program product may be a software installation package, and the above computer includes a cloud server.
  • the disclosed device can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the above units is only a logical function division.
  • there may be other division methods for example, multiple units or components can be combined or integrated. to another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the above-mentioned integrated units are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable memory.
  • the technical solution of the present application is essentially or part of the contribution to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a computer device which may be a personal computer, server or network device, etc.
  • the aforementioned memory includes: various media that can store program codes such as U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

本申请提供了一种图像处理方法及相关装置,首先,获取初始图像;然后,确定所述初始图像中人脸图像的面部区域的初始亮度;接着,确定所述人脸图像的生理特征;接着,确定所述面部区域中的肤色区域;然后,根据所述初始亮度和所述生理特征确定目标亮度;最后,根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。可以针对面部区域,结合亮度相关信息和生理特征自动对图像进行美化处理,提升图像处理的精度和效果,大大提升了用户体验。

Description

图像处理方法及相关装置 技术领域
本申请涉及图像处理技术领域,特别是一种图像处理方法及相关装置。
背景技术
在自拍或者拍摄人物时,往往会对面部进行处理,如美白、瘦脸等,用户可以自行设定需要进行面部处理的幅度和区域,现有的面部处理包括通过内置的算法进行图像处理,但往往是通用算法,无法个性化针对不同对用户进行不同的面部处理,图像处理的效果并不理想。
发明内容
本申请提出了一种图像处理方法及相关装置,可以针对面部区域,结合亮度相关信息和生理特征自动对图像进行美化处理,提升图像处理的精度和效果,大大提升了用户体验。
第一方面,本申请实施例提供了一种图像处理方法,所述方法包括:
获取初始图像;
确定所述初始图像中人脸图像的面部区域的初始亮度;
确定所述人脸图像的生理特征;
确定所述面部区域中的肤色区域;
根据所述初始亮度和所述生理特征确定目标亮度;
根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
第二方面,本申请实施例提供了一种图像处理装置,所述图像处理装置包括:
图像获取单元,用于获取初始图像;
第一亮度单元,用于确定所述初始图像中人脸图像的面部区域的初始亮度;
面部识别单元,用于确定所述人脸图像的生理特征;
肤色分割单元,用于确定所述面部区域中的肤色区域;
第二亮度单元,用于根据所述初始亮度和所述生理特征确定目标亮度;
图像处理单元,用于根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
第三方面,本申请实施例提供了一种电子设备,包括处理器、存储器、通信接口以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面中的步骤的指令。
第四方面,本申请实施例提供了一种计算机存储介质,其中,上述计算机存储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。
第五方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。
附图说明
为了更清楚地说明本发明实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种图像处理方法的系统构架图;
图2为本申请实施例提供的一种图像处理方法的流程示意图;
图3为本申请实施例提供的一种面部区域特征点的示意图;
图4为本申请实施例提供的一种电子设备的结构示意图;
图5为本申请实施例提供的一种图像处理装置的功能单元组成框图;
图6为本申请实施例提供的另一种图像处理装置的功能单元组成框图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
下面结合图1对本申请实施例中的一种图像处理方法的系统架构进行说明,该系统架构100包括拍摄模块110、面部检测模块120、肤色分割模块130以及面部处理模块140,其中上述拍摄模块110连接面部检测模块120,上述面部检测模块120连接上述肤色分割模块130,上述面部处理模块140分别连接拍摄模块110、面部检测模块120、肤色分割模块130。
其中,上述拍摄模块110可以包括多个摄像头阵列,可以以录像模式或拍摄模式获取初始图像,上述面部检测模块120可以用于确定初始图像中人脸图像的面部区域的特征点坐标、面部区域的初始亮度和人脸图像反映的生理特征,上述肤色分割模块130可以内置训练好的神经网络模型,用于确定面部区域的肤色区域,一般来说,肤色区域是需要进行亮度调整的区域,上述面部处理模块140用于根据来自面部检测模块120的初始亮度、生理特征确定目标亮度,并根据该目标亮度和初始亮度对肤色区域的亮度进行调整,得到目标图像。
可见,通过上述系统架构,可以针对面部区域,结合亮度相关信息和生理特征自动对图像进行美化处理,提升图像处理的精度和效果,大大提升了用户体验。
下面结合图2对本申请实施例中的一种图像处理方法进行说明,图2为本申请实施例提供的一种图像处理方法的流程示意图,具体包括以下步骤:
步骤201,获取初始图像。
其中,上述初始图像可以为多张,上述初始图像中包括人脸图像。
在一个可能的实施例中,可以通过录像模式获取连续的多张初始图像,需要说明的是,此处的录像模式,包括摄像模块开启时的预览模式,在预览模式下用户设备显示的画面也属于本申请的录像模式下获取的连续的初始图像,上述录像模式还包括摄像模块开启后进行录像时的模式,在此不再赘述。
在一个可能的实施例中,可以通过拍摄模式拍摄至少一张初始图像,在此不再赘述。
可见,通过多种方式获取初始图像,可以提升图像获取的灵活性,为后续的图像处理提供更多应用场景,提升用户体验。
步骤202,确定所述初始图像中人脸图像的面部区域的初始亮度。
其中,可以先自动检测上述初始图像以确定面部特征点信息,上述面部特征点信息可以包括特征点坐标集合,然后根据上述特征点坐标集合定位到上述面部区域的鼻部区域,并分别计算所述鼻部区域的三个颜色通道的平均亮度,得到第一颜色通道对应的所述第一肤色亮度、第二颜色通道对应的所述第二肤色亮度和第三颜色通道对应的所述第三肤色亮度,上述初始亮度包括第一肤色亮度、第二肤色亮度和第三肤色亮度。
其中,本申请实施例中的三个颜色通道为通用的RGB颜色通道,即R(Red)通道、G(Green)通道和B(Blue)通道,可以理解的是,第一颜色通道、第二颜色通道和第三颜色通道互不相同,本申请中以第一颜色通道为R通道、第二颜色通道为G通道、第三颜色通道为B通道为例进行说明,并不表示对本申请实施例的限定,在此不再赘述。
具体的,可以自动检测所有初始图像,并对面部特征点进行对齐处理,得到所有的特征点坐标,根据上述特征点坐标选择鼻部区域,此处的鼻部区域可以表示面部区域的眼睛和嘴巴之间的一小块区域,此处以图3为例进行说明,图3为本申请实施例提供的一种面部特征点的示意图,可见,一共通过123个点标记了面部的轮廓、眼睛、鼻子、嘴巴、眉毛等,鼻部区域如矩形示意的区域,对该区域在RGB颜色空间域的分布统计得到各通道的平均亮度,即第一肤色亮度、第二肤色亮度和第三肤色亮度。
可见,对齐处理可以确定准确度较高的特征点坐标,并且获取到更加精确的初始亮度,可以提升后续的图像处理精度。
步骤203,确定所述人脸图像的生理特征。
其中,可以通过面部识别模型来确定生理特征,该面部识别模型可以为训练好的用于识别图像中人脸反映的生理特征的卷积神经网络模型,上述生理特征可以包括性别、年龄、人种等信息,在此不再赘述。
可见,通过面部识别模型确定所述人脸图像的生理特征,可以在后续图像处理时进行适应性处理,提升处理效果和用户体验。
步骤204,确定所述面部区域中的肤色区域。
其中,上述肤色区域可以为人脸图像中的皮肤区域,举例来说,即排除头发、眼睛等区域、眼镜、饰品等遮挡物后的皮肤区域。
在一个可能的实施例中,当在录像模式下获取到初始图像时,可以根据上述特征点坐标集合确定面部轮廓点集,并对所述面部轮廓点集进行三角化处理并渲染,确定预览肤色区域,最后对所述预览肤色区域进行自适应均值滤波处理确定所述肤色区域。
具体的,同样以图3为例,可以将点1至点33、点105至点123作为面部的轮廓点集,并对这些点进行三角化处理后进行渲染得到预览肤色区域mask nTmp,然后通过以下公式进行自适应滤波处理得到肤色区域mask n
mask n=Blur(mask nTmp,radio)
radio=MAX(Dist(pt 75,pt 84),Dist(pt 52,pt 99))/10
其中,Blur()表示半径为radio的均值滤波,pt表示点位,pt后的数字表示图3中具体的点位,在此不再赘述。
可见,当在录像模式下获取到初始图像时,由于获取到的初始图像为大量连续的图像,需要更加高效的处理方法来确定肤色区域,调用上述特征点坐标来进行计算可以大大提升处理速度。
在一个可能的实施例中,当在拍摄模式下获取到所述初始图像时,可以将所述初始图像输入肤色分割模型,并根据所述肤色分割模型的输出确定预览肤色区域和肤色区域灰度图,最后根据所述肤色区域灰度图对所述预览肤色区域进行导向滤波处理,以得到所述肤色区域。
具体的,同样以图3为例,上述肤色分割模型可以为训练好的用于进行肤色区域分割的卷积神 经网络模型,可以通过上述肤色分割模型得到mask nTmp,然后进行灰度化得到上述肤色区域灰度图mask gray,此时肤色区域灰度图mask gray作为导向图,通过下列公式确定肤色区域mask n
mask n=fast Guide Filter(mask nTmp,mask gray,radio,eps,scale)
radio=MAX(Dist(pt 75,pt 84),Dist(pt 52,pt 99))/20
其中,radio为滤波半径,eps为界定平滑区域和边缘区域的阈值,scale为图像降采样的倍率,pt为图3中的点位,pt后的数字表示图3中具体的点位,在此不再赘述。
可见,当在拍摄模式下获取到所述初始图像时,由于拍摄到的一般为清晰的一张图像,此时可以用精度更高但速度较慢的方法来得到肤色区域,如此可以划分出的肤色区域准确度更高,提升图像处理的质量,通过自适应快速导向滤波处理可以改善mask nTmp边缘锯齿、边界不平滑等问题。
步骤205,根据所述初始亮度和所述生理特征确定目标亮度。
其中,上述目标亮度可以包括第一颜色通道对应的第一目标亮度、第二颜色通道对应的第二目标亮度和第三颜色通道对应的第三目标亮度。
其中,可以根据所述生理特征确定属性权重参数,接着根据所述属性权重参数、所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度确定第一目标亮度、第二目标亮度、第三目标亮度,所述第一目标亮度对应所述第一颜色通道,所述第二目标亮度对应所述第二颜色通道,所述第三目标亮度对应所述第三颜色通道。
在一个可能的实施例中,当在录像模式下获取到所述初始图像时,可以先获取历史图像对应的历史亮度信息,所述历史图像用于指示所述初始图像上一帧的图像,所述历史亮度信息包括所述第一颜色通道对应的第一历史肤色亮度、所述第二颜色通道对应的第二历史肤色亮度和所述第三颜色通道对应的第三历史肤色亮度,然后根据所述第一历史肤色亮度、所述第二历史肤色亮度和所述第三历史肤色亮度对所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度进行亮度平滑处理,得到第一平滑肤色亮度、第二平滑肤色亮度和第三平滑肤色亮度,接着根据所述属性权重参数、所述第一平滑肤色亮度、所述第二平滑肤色亮度和所述第三平滑肤色亮度确定第一颜色通道亮度增益参数、第二颜色通道亮度增益参数和第三颜色通道亮度增益参数,最后,根据所述第一平滑肤色亮度、所述第二平滑肤色亮度、所述第三平滑肤色亮度、所述第一颜色通道亮度增益参数、所述第二颜色通道亮度增益参数和所述第三颜色通道亮度增益参数确定所述第一目标亮度、所述第二目标亮度和所述第三目标亮度。
具体的,在确定当前是通过录像模式获取初始图像时,可以通过下列公式进行亮度平滑处理得到第一平滑肤色亮度light rTmp、第二平滑肤色亮度light gTmp和第三平滑肤色亮度light bTmp
light rTmp=(light iR+light refR)/2
light gTmp=(light iG+light refG)/2
light bTmp=(light iB+light refB)/2
其中,light refR表示第一历史肤色亮度,light refG表示第二历史肤色亮度,light refB表示第三历史肤色亮度。
可以理解的是,本申请的图像处理方法是对每一帧图像都进行处理,所以在录像模式下获取到连续的多张初始图像时,在处理当前的初始图像时可以基于上一帧历史图像进行亮度平滑处理防止亮度变化过大导致的显示问题,提升用户体验。
然后根据当前的到第一平滑肤色亮度light rTmp、第二平滑肤色亮度light gTmp、第三平滑肤色亮度light bTmp和生理特征对应的属性权重参数确定自适应调整的目标平均亮度light oMean
light iMean=(light rTmp+light gTmp+light bTmp)/3
belta=level*atri w/200
Figure PCTCN2021143390-appb-000001
其中light iMean表示初始目标平均亮度,hThr表示预设的常数值,在此不做赘述,w∈(0,5],level∈[0,100],level为预设的美白强度等级,用户可以自行调节美白强度等级level,实现所需美白效果强度,atri w∈[0,2]表示属性权重参数,通过控制该参数可以对不同肤色人种、性别和年龄进行美白强度精确控制。
最后,通过以下公式计算第一目标亮度light oR、第二目标亮度light oG和第三目标亮度light oB
rbDiff=MAX(ABS(light rTmp-light bTmp),1)
bgDiff=ABS(light gTmp-light bTmp)
gUp=belta*(light iMean-light gTmo)
bw=CLIP(20/(bgDiff+1),0.8,1)
bUp=MAX((belta*(1+2*bgDiff/rbDiff)*(light iMean-light bTmp))*bw,0)
gamma=MAX(light oMean*3/(light iMean*3+bUp+gUp),1)
light oR=CLIP(light rTmp*gamma,0,255)
light oG=CLIP((light gTmp+gUp)*gamma,0,255)
light oB=CLIP((light bTmp+bUp)*gamma,0,255)
其中,MAX()表示取最大值;ABS()表示取绝对值;CLIP()是将数据限定在范围内;gUp表示第一颜色通道亮度增益参数,bUp表示第二颜色通道亮度增益参数,gamma表示第三颜色通道亮度增益参数,上述三个亮度增益参数的作用主要是用来控制R、G、B三通道的亮度增益。如果结合生理特征,对目标亮度light oR,light oG,light oB进行微调,还可以实现不同效果的美白处理;比如当用户为女性时,适当增大light oR,可使女性人脸美白效果更加红润迷人。
在一个可能的实施例中,当在拍摄模式下获取到所述初始图像时,
light rTmp=light iR,light gTmp=light ig,light bTmp=light iB
可见,在拍摄模式下获取到初始图像时一般无需进行亮度平滑处理,以初始亮度计算后续的目标平均亮度,即:
light iMean=(light iR+light iG+light iB)/3
belta=level*atri w/200
Figure PCTCN2021143390-appb-000002
其中light_iMean表示初始目标平均亮度,hThr表示预设的常数值,在此不做赘述,w∈(0,5],level∈[0,100],level为预设的美白强度等级,用户可以自行调节美白强度等级level,实现所需美白效果强度,atri_w∈[0,2]表示属性权重参数,通过控制该参数可以对不同肤色人种、性别和年龄进行美白强度精确控制。
最后,通过以下公式计算第一目标亮度light_oR、第二目标亮度light_oG和第三目标亮度light_oB:
rbDiff=MAX(ABS(light iR-light iB),1)
bgDiff=ABS(light iG-light iB)
gUp=belta*(light iMean-light iG)
bw=CLIP(20/(bgDiff+1),0.8,1)
bUp=MAX((belta*(1+2*bgDiff/rbDiff)*(light iMean-light iB))*bw,0)
gamma=MAX(light oMean*3/(light iMean*3+bUp+gUp),1)
light oR=CLIP(light iR*gamma,0,255)
light oG=CLIP((light iG+gUp)*gamma,0,255)
light oB=CLIP((light iB+bUp)*gamma,0,255)
其中,MAX()表示取最大值;ABS()表示取绝对值;CLIP()是将数据限定在范围内;gUp表示第一颜色通道亮度增益参数,bUp表示第二颜色通道亮度增益参数,gamma表示第三颜色通道亮度增益参数,上述三个亮度增益参数的作用主要是用来控制R、G、B三通道的亮度增益。如果结合生理特征,对目标亮度light_oR,light_oG,light_oB进行微调,还可以实现不同效果的美白处理;比如当用户为女性时,适当增大light_oR,可使女性人脸美白效果更加红润迷人。
可见,根据所述初始亮度和所述生理特征确定目标亮度,可以基于生理特征确定更加符合用户实际需求的目标亮度,提升图像处理的质量和用户体验。
步骤206,根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
其中,可以先根据所述第一肤色亮度、所述第二肤色亮度、所述第三肤色亮度、所述第一目标亮度、所述第二目标亮度和所述第三目标亮度确定贝塞尔曲线亮度映射表,所述贝塞尔曲线亮度映射表包括第一颜色通道映射表、第二颜色通道映射表和第三颜色通道映射表,然后根据所述第一颜色通道映射表将所述肤色区域的第一肤色亮度调整为所述第一目标亮度得到第一颜色通道图像,接着根据所述第二颜色通道映射表将所述肤色区域的第二肤色亮度调整为所述第二肤色亮度得到第二颜色通道图像,最后,根据所述第三颜色通道映射表将所述肤色区域的第三肤色亮度调整为所述第三目标亮度得到第三颜色通道图像。
具体的,可以设定生成第一颜色通道、第二颜色通道和第三颜色通道的控制点对,以生成R通道美白映射曲线为例:假设图像灰度范围为[0,255],点对设置为{0,0},{1,1},{light iR,light oR},{245,245},{255,255},其中点{1,1},{245,245}可变,此处不对点对数量进行限制,主要是通过控制点{light iR,light oR}来实现平滑的非线性亮度提升,进一步,通过对上述点对进行贝赛尔曲线求解,得到贝赛尔曲线美白映射表,即第一颜色通道映射表curve R,第二颜色通道映射表curve G,第三颜色通道映射表curve B,最后结合上述第一颜色通道映射表curve R,第二颜色通道映射表curve G,第三颜色通道映射表curve B,对确定的肤色区域进行处理,得到第一颜色通道图像imgSrc R、第二颜色通道图像imgSrc G和第三颜色通道图像imgSrc B
Figure PCTCN2021143390-appb-000003
Figure PCTCN2021143390-appb-000004
Figure PCTCN2021143390-appb-000005
其中,上述imgSrc R,imgSrc G,imgSrc B分别表示原图像RGB颜色空间各通道图像,在此不再赘述。
可见,通过自适应的贝赛尔曲线映射算法,在不降低人脸对比度的同时获得自然的人脸美白效果,有效解决人脸美白效果假白问题,且该算法对泛场景人脸美白鲁棒性更高;同时,人脸智能美白在RGB颜色空间进行,且直接查找贝塞尔曲线映射查表,可大大降低算法复杂度,既可用于静态人脸用户自适应智能美白处理,也可用于动态视频。
通过上述图像处理方法,首先,获取初始图像;然后,确定所述初始图像中人脸图像的面部区域的初始亮度;接着,通过面部识别模型确定所述人脸图像的生理特征;接着,确定所述面部区域中的肤色区域;然后,根据所述初始亮度和所述生理特征确定目标亮度;最后,根据所述初始亮度 和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。可以针对面部区域,结合亮度相关信息和生理特征自动对图像进行美化处理,提升图像处理的精度和效果,大大提升了用户体验。
下面结合图4对本申请实施例中的一种电子设备进行说明,图4为本申请实施例提供的一种电子设备的结构示意图,如图4所示,该电子设备400包括处理器401、通信接口402和存储器403,所述处理器、通信接口和存储器相互连接,其中,电子设备400还可以包括总线404,处理器401、通信接口402和存储器403之间可以通过总线404相互连接,总线404可以是外设部件互连标准(Peripheral Component Interconnect,简称PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,简称EISA)总线等。总线404可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。所述存储器403用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行上述图2中所描述的全部或部分方法。
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所提供的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,下面结合图5对本申请实施例中的一种图像处理装置进行详细说明,图5为本申请实施例提供的一种图像处理装置的功能单元组成框图,该图像处理装置500包括:
图像获取单元510,用于获取初始图像;
第一亮度单元520,用于确定所述初始图像中人脸图像的面部区域的初始亮度;
面部识别单元530,用于确定所述人脸图像的生理特征;
肤色分割单元540,用于确定所述面部区域中的肤色区域;
第二亮度单元550,用于根据所述初始亮度和所述生理特征确定目标亮度;
图像处理单元560,用于根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
在采用集成的单元的情况下,下面结合图6对本申请实施例中的另一种图像处理装置600进行详细说明,所述图像处理装置600包括处理单元601和通信单元602,其中,所述处理单元601,用于执行如上述方法实施例中的任一步骤,且在执行诸如发送等数据传输时,可选择的调用所述通信单元602来完成相应操作。
其中,所述图像处理装置600还可以包括存储单元603,用于存储程序代码和数据。所述处理单元601可以是处理器,所述通信单元602可以是触控显示屏,存储单元603可以是存储器。
所述处理单元601具体用于:
获取初始图像;
确定所述初始图像中人脸图像的面部区域的初始亮度;
确定所述人脸图像的生理特征;
确定所述面部区域中的肤色区域;
根据所述初始亮度和所述生理特征确定目标亮度;
根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
可以理解的是,由于方法实施例与装置实施例为相同技术构思的不同呈现形式,因此,本申请中方法实施例部分的内容应同步适配于装置实施例部分,此处不再赘述。上述图像处理装置500和图像处理装置600均可执行上述实施例包括的全部的图像处理方法。
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤。
本申请实施例还提供一种计算机程序产品,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包,上述计算机包括云服务器。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (20)

  1. 一种图像处理方法,其特征在于,所述方法包括:
    获取初始图像;
    确定所述初始图像中人脸图像的面部区域的初始亮度;
    确定所述人脸图像的生理特征;
    确定所述面部区域中的肤色区域;
    根据所述初始亮度和所述生理特征确定目标亮度;
    根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
  2. 根据权利要求1所述的方法,其特征在于,所述初始亮度包括第一肤色亮度、第二肤色亮度和第三肤色亮度;所述确定所述初始图像中人脸图像的面部区域的初始亮度,包括:
    检测所述初始图像以确定面部特征点信息,所述面部特征点信息包括特征点坐标集合;
    根据所述特征点坐标集合定位所述面部区域的鼻部区域,并分别计算所述鼻部区域的三个颜色通道的平均亮度,得到第一颜色通道对应的所述第一肤色亮度、第二颜色通道对应的所述第二肤色亮度和第三颜色通道对应的所述第三肤色亮度。
  3. 根据权利要求2所述的方法,其特征在于,所述确定所述面部区域中的肤色区域,包括:
    当在录像模式下获取到所述初始图像时,根据所述特征点坐标集合确定面部轮廓点集;
    对所述面部轮廓点集进行三角化处理并渲染,确定预览肤色区域;
    对所述预览肤色区域进行自适应均值滤波处理确定所述肤色区域。
  4. 根据权利要求2所述的方法,其特征在于,所述确定所述面部区域中的肤色区域,包括:
    当在拍摄模式下获取到所述初始图像时,将所述初始图像输入肤色分割模型,根据所述肤色分割模型的输出确定预览肤色区域和肤色区域灰度图;
    根据所述肤色区域灰度图对所述预览肤色区域进行导向滤波处理,以得到所述肤色区域。
  5. 根据权利要求2所述的方法,其特征在于,根据所述初始亮度和所述生理特征确定目标亮度,包括:
    根据所述生理特征确定属性权重参数;
    根据所述属性权重参数、所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度确定第一目标亮度、第二目标亮度、第三目标亮度,所述第一目标亮度对应所述第一颜色通道,所述第二目标亮度对应所述第二颜色通道,所述第三目标亮度对应所述第三颜色通道。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述属性权重参数、所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度确定第一目标亮度、第二目标亮度、第三目标亮度,包括:
    当在录像模式下获取到所述初始图像时,获取历史图像对应的历史亮度信息,所述历史图像用于指示所述初始图像上一帧的图像,所述历史亮度信息包括所述第一颜色通道对应的第一历史肤色亮度、所述第二颜色通道对应的第二历史肤色亮度和所述第三颜色通道对应的第三历史肤色亮度;
    根据所述第一历史肤色亮度、所述第二历史肤色亮度和所述第三历史肤色亮度对所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度进行亮度平滑处理,得到第一平滑肤色亮度、第二平滑肤色亮度和第三平滑肤色亮度;
    根据所述属性权重参数、所述第一平滑肤色亮度、所述第二平滑肤色亮度和所述第三平滑肤色 亮度确定第一颜色通道亮度增益参数、第二颜色通道亮度增益参数和第三颜色通道亮度增益参数;
    根据所述第一平滑肤色亮度、所述第二平滑肤色亮度、所述第三平滑肤色亮度、所述第一颜色通道亮度增益参数、所述第二颜色通道亮度增益参数和所述第三颜色通道亮度增益参数确定所述第一目标亮度、所述第二目标亮度和所述第三目标亮度。
  7. 根据权利要求6所述的方法,其特征在于,根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像,包括:
    根据所述第一肤色亮度、所述第二肤色亮度、所述第三肤色亮度、所述第一目标亮度、所述第二目标亮度和所述第三目标亮度确定贝塞尔曲线亮度映射表,所述贝塞尔曲线亮度映射表包括第一颜色通道映射表、第二颜色通道映射表和第三颜色通道映射表;
    根据所述第一颜色通道映射表将所述肤色区域的第一肤色亮度调整为所述第一目标亮度得到第一颜色通道图像;
    根据所述第二颜色通道映射表将所述肤色区域的第二肤色亮度调整为所述第二肤色亮度得到第二颜色通道图像;
    根据所述第三颜色通道映射表将所述肤色区域的第三肤色亮度调整为所述第三目标亮度得到第三颜色通道图像。
  8. 根据权利要求1~7任一项所述的方法,其特征在于,所述获取初始图像,包括:
    通过录像模式获取连续的多张初始图像;或,通过拍摄获取至少一张初始图像。
  9. 一种图像处理装置,其特征在于,所述图像处理装置包括:
    图像获取单元,用于获取初始图像;
    第一亮度单元,用于确定所述初始图像中人脸图像的面部区域的初始亮度;
    面部识别单元,用于确定所述人脸图像的生理特征;
    肤色分割单元,用于确定所述面部区域中的肤色区域;
    第二亮度单元,用于根据所述初始亮度和所述生理特征确定目标亮度;
    图像处理单元,用于根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
  10. 根据权利要求9所述的图像处理装置,其特征在于,所述初始亮度包括第一肤色亮度、第二肤色亮度和第三肤色亮度;在所述确定所述初始图像中人脸图像的面部区域的初始亮度方面,所述第一亮度单元具体用于:
    检测所述初始图像以确定面部特征点信息,所述面部特征点信息包括特征点坐标集合;
    根据所述特征点坐标集合定位所述面部区域的鼻部区域,并分别计算所述鼻部区域的三个颜色通道的平均亮度,得到第一颜色通道对应的所述第一肤色亮度、第二颜色通道对应的所述第二肤色亮度和第三颜色通道对应的所述第三肤色亮度。
  11. 根据权利要求10所述的图像处理装置,其特征在于,在所述确定所述面部区域中的肤色区域方面,所述肤色分割单元具体用于:
    当在录像模式下获取到所述初始图像时,根据所述特征点坐标集合确定面部轮廓点集;
    对所述面部轮廓点集进行三角化处理并渲染,确定预览肤色区域;
    对所述预览肤色区域进行自适应均值滤波处理确定所述肤色区域。
  12. 根据权利要求10所述的图像处理装置,其特征在于,在所述确定所述面部区域中的肤色 区域方面,所述肤色分割单元具体用于:
    当在拍摄模式下获取到所述初始图像时,将所述初始图像输入肤色分割模型,根据所述肤色分割模型的输出确定预览肤色区域和肤色区域灰度图;
    根据所述肤色区域灰度图对所述预览肤色区域进行导向滤波处理,以得到所述肤色区域。
  13. 根据权利要求10所述的图像处理装置,其特征在于,在所述根据所述初始亮度和所述生理特征确定目标亮度方面,所述第二亮度单元具体用于:
    根据所述生理特征确定属性权重参数;
    根据所述属性权重参数、所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度确定第一目标亮度、第二目标亮度、第三目标亮度,所述第一目标亮度对应所述第一颜色通道,所述第二目标亮度对应所述第二颜色通道,所述第三目标亮度对应所述第三颜色通道。
  14. 根据权利要求13所述的图像处理装置,其特征在于,在所述根据所述属性权重参数、所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度确定第一目标亮度、第二目标亮度、第三目标亮度方面,所述第二亮度单元具体用于:
    当在录像模式下获取到所述初始图像时,获取历史图像对应的历史亮度信息,所述历史图像用于指示所述初始图像上一帧的图像,所述历史亮度信息包括所述第一颜色通道对应的第一历史肤色亮度、所述第二颜色通道对应的第二历史肤色亮度和所述第三颜色通道对应的第三历史肤色亮度;
    根据所述第一历史肤色亮度、所述第二历史肤色亮度和所述第三历史肤色亮度对所述第一肤色亮度、所述第二肤色亮度和所述第三肤色亮度进行亮度平滑处理,得到第一平滑肤色亮度、第二平滑肤色亮度和第三平滑肤色亮度;
    根据所述属性权重参数、所述第一平滑肤色亮度、所述第二平滑肤色亮度和所述第三平滑肤色亮度确定第一颜色通道亮度增益参数、第二颜色通道亮度增益参数和第三颜色通道亮度增益参数;
    根据所述第一平滑肤色亮度、所述第二平滑肤色亮度、所述第三平滑肤色亮度、所述第一颜色通道亮度增益参数、所述第二颜色通道亮度增益参数和所述第三颜色通道亮度增益参数确定所述第一目标亮度、所述第二目标亮度和所述第三目标亮度。
  15. 根据权利要求14所述的图像处理装置,其特征在于,在根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像方面,所述图像处理单元具体用于:
    根据所述第一肤色亮度、所述第二肤色亮度、所述第三肤色亮度、所述第一目标亮度、所述第二目标亮度和所述第三目标亮度确定贝塞尔曲线亮度映射表,所述贝塞尔曲线亮度映射表包括第一颜色通道映射表、第二颜色通道映射表和第三颜色通道映射表;
    根据所述第一颜色通道映射表将所述肤色区域的第一肤色亮度调整为所述第一目标亮度得到第一颜色通道图像;
    根据所述第二颜色通道映射表将所述肤色区域的第二肤色亮度调整为所述第二肤色亮度得到第二颜色通道图像;
    根据所述第三颜色通道映射表将所述肤色区域的第三肤色亮度调整为所述第三目标亮度得到第三颜色通道图像。
  16. 根据权利要求9~15任一项所述的图像处理装置,其特征在于,在获取初始图像方面,所述图像获取单元具体用于:
    通过录像模式获取连续的多张初始图像;或,通过拍摄获取至少一张初始图像。
  17. 一种电子设备,其特征在于,包括处理器、存储器,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述应用处理器执行,所述程序包括用于执行如权利要求1~7任一项所述的方法中的步骤的指令。
  18. 一种芯片,应用于电子设备,其特征在于,
    所述芯片,用于获取初始图像;确定所述初始图像中人脸图像的面部区域的初始亮度;确定所述人脸图像的生理特征;确定所述面部区域中的肤色区域;根据所述初始亮度和所述生理特征确定目标亮度;根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
  19. 一种芯片模组,应用于电子设备,其特征在于,包括收发组件和芯片,
    所述芯片,用于获取初始图像;确定所述初始图像中人脸图像的面部区域的初始亮度;确定所述人脸图像的生理特征;确定所述面部区域中的肤色区域;根据所述初始亮度和所述生理特征确定目标亮度;根据所述初始亮度和所述目标亮度对所述肤色区域的亮度进行调整,以得到目标图像。
  20. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行如权利要求1~7任一项所述的方法。
PCT/CN2021/143390 2021-08-03 2021-12-30 图像处理方法及相关装置 WO2023010796A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110885563.3 2021-08-03
CN202110885563.3A CN113610723B (zh) 2021-08-03 2021-08-03 图像处理方法及相关装置

Publications (1)

Publication Number Publication Date
WO2023010796A1 true WO2023010796A1 (zh) 2023-02-09

Family

ID=78339199

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/143390 WO2023010796A1 (zh) 2021-08-03 2021-12-30 图像处理方法及相关装置

Country Status (2)

Country Link
CN (1) CN113610723B (zh)
WO (1) WO2023010796A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113610723B (zh) * 2021-08-03 2022-09-13 展讯通信(上海)有限公司 图像处理方法及相关装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019133991A1 (en) * 2017-12-29 2019-07-04 Wu Yecheng System and method for normalizing skin tone brightness in a portrait image
CN111614908A (zh) * 2020-05-29 2020-09-01 Oppo广东移动通信有限公司 图像处理方法、装置、电子设备及存储介质
CN112446832A (zh) * 2019-08-31 2021-03-05 华为技术有限公司 一种图像处理方法及电子设备
CN112784773A (zh) * 2021-01-27 2021-05-11 展讯通信(上海)有限公司 图像处理方法及装置、存储介质、终端
CN112887582A (zh) * 2019-11-29 2021-06-01 深圳市海思半导体有限公司 一种图像色彩处理方法、装置及相关设备
CN113610723A (zh) * 2021-08-03 2021-11-05 展讯通信(上海)有限公司 图像处理方法及相关装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104537612A (zh) * 2014-08-05 2015-04-22 华南理工大学 一种自动的人脸图像皮肤美化方法
CN107862657A (zh) * 2017-10-31 2018-03-30 广东欧珀移动通信有限公司 图像处理方法、装置、计算机设备及计算机可读存储介质
CN109639982B (zh) * 2019-01-04 2020-06-30 Oppo广东移动通信有限公司 一种图像降噪方法、装置、存储介质及终端
CN111062891A (zh) * 2019-12-16 2020-04-24 Oppo广东移动通信有限公司 图像处理方法、装置、终端及计算机可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019133991A1 (en) * 2017-12-29 2019-07-04 Wu Yecheng System and method for normalizing skin tone brightness in a portrait image
CN112446832A (zh) * 2019-08-31 2021-03-05 华为技术有限公司 一种图像处理方法及电子设备
CN112887582A (zh) * 2019-11-29 2021-06-01 深圳市海思半导体有限公司 一种图像色彩处理方法、装置及相关设备
CN111614908A (zh) * 2020-05-29 2020-09-01 Oppo广东移动通信有限公司 图像处理方法、装置、电子设备及存储介质
CN112784773A (zh) * 2021-01-27 2021-05-11 展讯通信(上海)有限公司 图像处理方法及装置、存储介质、终端
CN113610723A (zh) * 2021-08-03 2021-11-05 展讯通信(上海)有限公司 图像处理方法及相关装置

Also Published As

Publication number Publication date
CN113610723A (zh) 2021-11-05
CN113610723B (zh) 2022-09-13

Similar Documents

Publication Publication Date Title
US11153547B1 (en) Correlated illuminant estimations
USRE47960E1 (en) Methods and devices of illuminant estimation referencing facial color features for automatic white balance
EP3338217B1 (en) Feature detection and masking in images based on color distributions
CN107730444B (zh) 图像处理方法、装置、可读存储介质和计算机设备
WO2022161009A1 (zh) 图像处理方法及装置、存储介质、终端
CN104574285B (zh) 一种自动祛除图像黑眼圈的方法
CN109639982A (zh) 一种图像降噪方法、装置、存储介质及终端
US11238569B2 (en) Image processing method and apparatus, image device, and storage medium
CN110838084B (zh) 一种图像的风格转移方法、装置、电子设备及存储介质
US10965924B2 (en) Correlating illuminant estimation by a plurality of cameras
WO2022135574A1 (zh) 肤色检测方法、装置、移动终端和存储介质
CN110866139A (zh) 一种化妆处理方法、装置及设备
WO2021197186A1 (zh) 辅助化妆方法、终端设备、存储介质及程序产品
CN106530309A (zh) 一种基于移动平台的视频抠图方法及系统
WO2022135579A1 (zh) 肤色检测方法、装置、移动终端和存储介质
JP6942825B2 (ja) 顔画像を強化する方法及び装置、電子機器
WO2023010796A1 (zh) 图像处理方法及相关装置
WO2023273247A1 (zh) 人脸图像处理方法及装置、计算机可读存储介质、终端
CN114187166A (zh) 图像处理方法、智能终端及存储介质
CN112597911A (zh) 一种磨皮处理方法、装置、移动终端和存储介质
CN113487670A (zh) 一种化妆镜及状态调整方法
KR101507410B1 (ko) 모바일 단말의 라이브 메이크업 촬영 방법 및 장치
US10354125B2 (en) Photograph processing method and system
CN114998115A (zh) 图像美化处理方法、装置及电子设备
WO2022042502A1 (zh) 美颜功能开启方法、装置及电子设备

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE