[go: up one dir, main page]

CN107862658B - Image processing method, apparatus, computer-readable storage medium and electronic device - Google Patents

Image processing method, apparatus, computer-readable storage medium and electronic device Download PDF

Info

Publication number
CN107862658B
CN107862658B CN201711054076.2A CN201711054076A CN107862658B CN 107862658 B CN107862658 B CN 107862658B CN 201711054076 A CN201711054076 A CN 201711054076A CN 107862658 B CN107862658 B CN 107862658B
Authority
CN
China
Prior art keywords
image
beauty
channel
processed
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711054076.2A
Other languages
Chinese (zh)
Other versions
CN107862658A (en
Inventor
杜成鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201711054076.2A priority Critical patent/CN107862658B/en
Publication of CN107862658A publication Critical patent/CN107862658A/en
Application granted granted Critical
Publication of CN107862658B publication Critical patent/CN107862658B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/169Holistic features and representations, i.e. based on the facial image taken as a whole
    • 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/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)

Abstract

本申请涉及一种图像处理方法、装置、计算机可读存储介质和电子设备。所述方法包括:获取待处理图像;获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数;根据所述美颜参数对所述各个通道图像分别进行美颜处理;将所述美颜处理后的各个通道图像进行融合,得到美颜图像。上述图像处理方法、装置、计算机可读存储介质和电子设备,提高了图像处理的准确率。

Figure 201711054076

The present application relates to an image processing method, device, computer-readable storage medium and electronic device. The method comprises: obtaining an image to be processed; obtaining the brightness value corresponding to each channel image in the image to be processed, and obtaining the beauty parameters corresponding to each channel image according to the brightness value; performing beauty processing on each channel image according to the beauty parameters; and fusing the channel images after the beauty processing to obtain a beauty image. The above-mentioned image processing method, device, computer-readable storage medium and electronic device improve the accuracy of image processing.

Figure 201711054076

Description

图像处理方法、装置、计算机可读存储介质和电子设备Image processing method, apparatus, computer-readable storage medium and electronic device

技术领域technical field

本申请涉及图像处理技术领域,特别是涉及图像处理方法、装置、计算机可读存储介质和电子设备。The present application relates to the technical field of image processing, and in particular, to an image processing method, apparatus, computer-readable storage medium, and electronic device.

背景技术Background technique

无论是在工作还是生活中,拍照都是一项必不可少的技能。为了拍出一张让人满意的照片,不仅需要在拍摄过程中对拍摄参数进行改善,还需要在拍摄完成之后对照片本身进行改善。美颜处理就是指对照片进行美化的一种方法,经过美颜处理之后,会让照片中的人物看起来更加符合人类的审美。Whether it is at work or in life, taking pictures is an essential skill. In order to take a satisfactory photo, it is not only necessary to improve the shooting parameters during the shooting process, but also to improve the photo itself after the shooting is completed. Beauty processing refers to a method of beautifying photos. After beauty processing, the characters in the photos will look more in line with human aesthetics.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种图像处理方法、装置、计算机可读存储介质和电子设备,可以提高图像处理的准确率。Embodiments of the present application provide an image processing method, apparatus, computer-readable storage medium, and electronic device, which can improve the accuracy of image processing.

一种图像处理方法,所述方法包括:An image processing method, the method comprising:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数;Acquire the brightness value corresponding to each channel image in the to-be-processed image, and acquire the beauty parameter corresponding to each channel image according to the brightness value;

根据所述美颜参数对所述各个通道图像分别进行美颜处理;Performing beautification processing on the respective channel images according to the beautifying parameters;

将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image of each channel after the beauty treatment is fused to obtain a beauty image.

一种图像处理装置,所述装置包括:An image processing device, the device comprising:

图像获取模块,用于获取待处理图像;Image acquisition module, used to acquire the image to be processed;

参数获取模块,用于获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数;A parameter acquisition module, configured to acquire the brightness value corresponding to each channel image in the to-be-processed image, and acquire the beauty parameter corresponding to each channel image according to the brightness value;

美颜处理模块,用于根据所述美颜参数对所述各个通道图像分别进行美颜处理;A beauty processing module, configured to perform beauty processing on the respective channel images according to the beauty parameters;

图像融合模块,用于将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image fusion module is used for fusing each channel image after the beauty treatment to obtain a beauty image.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数;Acquire the brightness value corresponding to each channel image in the to-be-processed image, and acquire the beauty parameter corresponding to each channel image according to the brightness value;

根据所述美颜参数对所述各个通道图像分别进行美颜处理;Performing beautification processing on the respective channel images according to the beautifying parameters;

将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image of each channel after the beauty treatment is fused to obtain a beauty image.

一种电子设备,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时,使得所述处理器执行如下步骤:An electronic device, comprising a memory and a processor, wherein computer-readable instructions are stored in the memory, and when the instructions are executed by the processor, the processor is caused to perform the following steps:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数;Acquire the brightness value corresponding to each channel image in the to-be-processed image, and acquire the beauty parameter corresponding to each channel image according to the brightness value;

根据所述美颜参数对所述各个通道图像分别进行美颜处理;Performing beautification processing on the respective channel images according to the beautifying parameters;

将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image of each channel after the beauty treatment is fused to obtain a beauty image.

上述图像处理方法、装置、计算机可读存储介质和电子设备,首先获取待处理图像中各个通道图像的亮度值,并根据亮度值获取各个通道图像的美颜参数,然后根据获取的美颜参数对各个通道图像进行美颜处理。这样可以针对各个通道图像进行不同的美颜处理,优化了美颜处理,使图像处理更加准确。The above-mentioned image processing method, device, computer-readable storage medium and electronic equipment, first obtain the brightness value of each channel image in the image to be processed, and obtain the beauty parameters of each channel image according to the brightness value, and then according to the obtained beauty parameters. Each channel image is beautified. In this way, different beautification processing can be performed for each channel image, which optimizes the beauty processing and makes the image processing more accurate.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1为一个实施例中图像处理方法的应用环境图;Fig. 1 is the application environment diagram of the image processing method in one embodiment;

图2为一个实施例中图像处理方法的流程图;2 is a flowchart of an image processing method in one embodiment;

图3为另一个实施例中图像处理方法的流程图;3 is a flowchart of an image processing method in another embodiment;

图4为一个实施例中获取深度信息的原理图;4 is a schematic diagram of acquiring depth information in one embodiment;

图5为又一个实施例中图像处理方法的流程图;5 is a flowchart of an image processing method in yet another embodiment;

图6为又一个实施例中图像处理方法的流程图;6 is a flowchart of an image processing method in yet another embodiment;

图7为一个实施例中图像处理装置的结构示意图;7 is a schematic structural diagram of an image processing apparatus in an embodiment;

图8为一个实施例中图像处理系统的结构示意图;8 is a schematic structural diagram of an image processing system in one embodiment;

图9为一个实施例中图像处理电路的示意图。FIG. 9 is a schematic diagram of an image processing circuit in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一获取模块称为第二获取模块,且类似地,可将第二获取模块称为第一获取模块。第一获取模块和第二获取模块两者都是获取模块,但其不是同一获取模块。It will be understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, a first acquisition module may be referred to as a second acquisition module, and similarly, a second acquisition module may be referred to as a first acquisition module, without departing from the scope of this application. Both the first acquisition module and the second acquisition module are acquisition modules, but they are not the same acquisition module.

图1为一个实施例中图像处理方法的应用环境图。如图1所示,该应用环境中包括用户终端102和服务器104。用户终端102中可以用于采集待处理图像,生成待处理图像,然后将待处理图像发送到服务器104中。服务器104接收到待处理图像之后,获取待处理图像中各个通道图像对应的亮度值,并根据亮度值获取各个通道图像对应的美颜参数;根据美颜参数对各个通道图像分别进行美颜处理;将美颜处理后的各个通道图像进行融合,得到美颜图像。最后服务器104将美颜图像返回给用户终端102。可以理解的是,用户终端102可以向服务器104发送一个图像集合,该图像集合中包含多张图像。服务器104接收到图像集合之后,对图像集合中的图像进行美颜处理。其中,用户终端102是处于计算机网络最外围,主要用于输入用户信息以及输出处理结果的电子设备,例如可以是个人电脑、移动终端、个人数字助理、可穿戴电子设备等。服务器 104是用于响应服务请求,同时提供计算服务的设备,例如可以是一台或者多台计算机。可以理解的是,在本申请提供的其他实施例中,该图像处理方法的应用环境中可以只包括用户终端102,即用户终端102用于采集待处理图像,并将待处理图像进行美颜处理。FIG. 1 is an application environment diagram of an image processing method in one embodiment. As shown in FIG. 1 , the application environment includes a user terminal 102 and a server 104 . The user terminal 102 can be used to collect the to-be-processed image, generate the to-be-processed image, and then send the to-be-processed image to the server 104 . After receiving the to-be-processed image, the server 104 acquires the brightness value corresponding to each channel image in the to-be-processed image, and acquires the beauty parameter corresponding to each channel image according to the brightness value; and performs beauty processing on each channel image according to the beauty parameter; The image of each channel after beautification processing is fused to obtain a beauty image. Finally, the server 104 returns the beauty image to the user terminal 102 . It can be understood that the user terminal 102 can send an image set to the server 104, and the image set includes multiple images. After receiving the image set, the server 104 performs beautification processing on the images in the image set. The user terminal 102 is an electronic device located at the outermost periphery of the computer network and is mainly used for inputting user information and outputting processing results, such as a personal computer, mobile terminal, personal digital assistant, wearable electronic device and the like. The server 104 is a device used to respond to service requests while providing computing services, and may be, for example, one or more computers. It can be understood that, in other embodiments provided in this application, the application environment of the image processing method may only include the user terminal 102, that is, the user terminal 102 is used to collect the image to be processed and perform beauty processing on the image to be processed. .

图2为一个实施例中图像处理方法的流程图。如图2所示,该图像处理方法包括步骤202至步骤206。其中:FIG. 2 is a flowchart of an image processing method in one embodiment. As shown in FIG. 2 , the image processing method includes steps 202 to 206 . in:

步骤202,获取待处理图像。Step 202, acquiring an image to be processed.

在一个实施例中,待处理图像是指需要进行美颜处理的图像。待处理图像可以是由移动终端进行采集的。移动终端上安装有可以用于拍摄的摄像头,用户可以通过移动终端发起拍照指令,移动终端在检测到拍照指令之后,通过摄像头采集拍摄图像。移动终端会将采集的图像进行存储,形成一个图像集合。可以理解的是,待处理图像还可以是通过其他途径获取的,在此不做限定。例如,待处理图像还可以是从网页中下载的,或者是从外接存储设备中导入的等等。获取待处理图像具体可以包括:接收用户输入的美颜指令,并根据美颜指令获取待处理图像,其中美颜指令中包含图像标识。图像标识是指区分不同待处理图像的唯一标识,根据图像标识获取待处理图像。例如,图像标识可以是图像名称、图像编码、图像存储地址等中的一种或多种。具体地,移动终端在获取到待处理图像之后,可以在移动终端本地进行美颜处理,也可以将待处理图像发送至服务器进行美颜处理。In one embodiment, the image to be processed refers to an image that needs to be processed for beauty. The image to be processed may be collected by a mobile terminal. A camera that can be used for shooting is installed on the mobile terminal, the user can initiate a photographing instruction through the mobile terminal, and after detecting the photographing instruction, the mobile terminal collects and photographed images through the camera. The mobile terminal will store the collected images to form an image set. It can be understood that, the image to be processed may also be obtained through other means, which is not limited here. For example, the image to be processed may also be downloaded from a web page, or imported from an external storage device, and so on. Acquiring the image to be processed may specifically include: receiving a beauty instruction input by the user, and acquiring the image to be processed according to the beauty instruction, wherein the beauty instruction includes an image identifier. The image identifier refers to a unique identifier that distinguishes different images to be processed, and the image to be processed is obtained according to the image identifier. For example, the image identification may be one or more of image name, image code, image storage address, and the like. Specifically, after acquiring the to-be-processed image, the mobile terminal may perform beauty processing locally on the mobile terminal, or may send the to-be-processed image to the server for beauty processing.

步骤204,获取待处理图像中各个通道图像对应的亮度值,并根据亮度值获取各个通道图像对应的美颜参数。Step 204: Obtain the brightness value corresponding to each channel image in the image to be processed, and obtain the beauty parameter corresponding to each channel image according to the brightness value.

具体地,待处理图像是由若干个像素点构成的,每个像素点可以由多个颜色通道构成,每个颜色通道表示一个颜色分量。例如,图像可以由RGB(Red Green Blue,红,绿,蓝)三通道构成,也可以是由CMY(Cyan Magenta Yellow,洋红,青,黄)三通道构成。在图像处理的过程中,可以通过函数提取图像的各个颜色分量,并分别对各个颜色分量进行处理。例如,在Matlab中通过imread() 函数读取名称为“rainbow.jpg”图像,令im=imread(’rainbow.jpg’),则RGB颜色分量可以通过函数r=im(:,:,1)、g=im(:,:,2)、b=im(:,:,3)进行提取。通道图像即待处理图像中各个颜色通道的像素所构成的图像,在对图像进行美颜处理的时候,可以分别对图像的各个颜色通道进行美颜处理,每个颜色通道的处理可以不相同。Specifically, the image to be processed is composed of several pixel points, each pixel point may be composed of multiple color channels, and each color channel represents a color component. For example, an image may be composed of three channels of RGB (Red Green Blue, red, green, and blue), or may be composed of three channels of CMY (Cyan Magenta Yellow, magenta, cyan, and yellow). In the process of image processing, each color component of the image can be extracted by a function, and each color component can be processed separately. For example, in Matlab, the image named "rainbow.jpg" is read through the imread() function, and im=imread('rainbow.jpg'), then the RGB color components can be passed through the function r=im(:,:,1) , g=im(:,:,2), b=im(:,:,3) to extract. The channel image is the image formed by the pixels of each color channel in the image to be processed. When the image is beautified, each color channel of the image can be beautified separately, and the processing of each color channel can be different.

亮度是指图像的明亮程度,亮度值可以体现图像出现的偏差程度。根据亮度值获取美颜程度参数的方法具体可以包括:获取各个通道图像对应的亮度参考值,根据获取的亮度值与亮度参考值的差值获取各个通道图像的美颜参数。例如,可以首先建立肤色的标准RGB通道值,假设标准的肤色对应的RGB通道值分别为233、206和188。则对皮肤区域进行美白处理的时候,可以分别获取RGB三通道的亮度值,并将该亮度值与标准的通道值进行比较,相差越大的通道,对应的美白程度越深,即对应的美颜参数越大。具体地,可以分别获取各个通道图像中的亮度值,根据获取的亮度值获取各个通道图像对应的美颜参数。美颜参数是指对图像进行美颜处理的参数,美颜参数可以体现对图像进行美颜处理的程度。例如,对图像进行磨皮处理时,对应的美颜参数可以为美颜级别,美颜级别可以分为1级、2级、3级,从1级到3级进行磨皮处理的程度逐渐递增。Brightness refers to the brightness of the image, and the brightness value can reflect the degree of deviation of the image. The method for obtaining the beauty degree parameter according to the brightness value may specifically include: obtaining the brightness reference value corresponding to each channel image, and obtaining the beauty parameter of each channel image according to the difference between the obtained brightness value and the brightness reference value. For example, a standard RGB channel value of the skin color may be established first, assuming that the RGB channel values corresponding to the standard skin color are 233, 206, and 188, respectively. When whitening the skin area, the brightness values of the three RGB channels can be obtained separately, and the brightness values can be compared with the standard channel values. The larger the color parameter. Specifically, the brightness values in each channel image may be acquired respectively, and the beauty parameters corresponding to each channel image may be acquired according to the acquired brightness values. Beauty parameters refer to parameters for beautifying an image, which can reflect the degree of beautifying an image. For example, when microdermabrasion is performed on an image, the corresponding beauty parameter can be the beauty level, which can be divided into level 1, level 2, and level 3, and the degree of microdermabrasion is gradually increased from level 1 to level 3 .

步骤206,根据美颜参数对各个通道图像分别进行美颜处理。Step 206: Perform beautification processing on each channel image according to the beauty parameters.

美颜处理就是指对图像进行美化的一种方法,具体是指对图像中的人像进行美化的一种方法。一般情况下,美颜处理可以针对整个图像进行处理,也可以只针对图像中的一个区域进行处理。例如,美颜处理可以包括美白、磨皮、瘦脸、瘦身等处理,美白、磨皮处理可以提高图像的亮度和平滑度,那么美白、磨皮等处理就可以是针对整个图像进行的处理,瘦脸、瘦身等处理则只能是针对人像所在的区域进行处理。待处理图像的亮度值和美颜参数具有对应关系,根据亮度值获取各个通道图像的美颜参数,并根据美颜参数对各个通道图像分别进行美颜处理。可以理解的是,亮度值和美颜参数的对应关系可以是线性的函数关系,也可以是非线性的函数关系。例如,在RGB图像中,图像可以包括 R通道图像、G通道图像、B通道图像,这三个通道图像对应的亮度值分别为 50、210、130,对应的美颜程度分别为1级、3级、2级,则需要对R通道图像、 G通道图像、B通道图像分别进行1级、3级、2级美颜处理。Beauty processing refers to a method of beautifying an image, specifically a method of beautifying a portrait in an image. In general, beauty processing can be performed on the entire image, or only on a region in the image. For example, the beauty treatment can include whitening, skin resurfacing, face-lifting, and weight-loss processing. Whitening and skin resurfacing can improve the brightness and smoothness of the image. Then whitening and skin resurfacing can be performed on the entire image. , slimming and other processing can only be processed for the area where the portrait is located. The brightness value of the image to be processed has a corresponding relationship with the beauty parameter, the beauty parameter of each channel image is obtained according to the brightness value, and the beauty treatment is performed on each channel image according to the beauty parameter. It can be understood that the corresponding relationship between the brightness value and the beauty parameter may be a linear functional relationship or a nonlinear functional relationship. For example, in an RGB image, the image may include an R channel image, a G channel image, and a B channel image. The brightness values corresponding to these three channel images are 50, 210, and 130, respectively, and the corresponding beauty levels are 1 and 3, respectively. Level 1, Level 2, you need to perform Level 1, Level 3, Level 2 beautification processing on the R channel image, G channel image, and B channel image, respectively.

步骤208,将美颜处理后的各个通道图像进行融合,得到美颜图像。Step 208 , fuse each channel image after beautification processing to obtain a beautification image.

在一个实施例中,图像融合是指将多个图像进行合成,生成一张目标图像的过程。在将待处理图像的各个通道图像进行美颜处理之后,美颜处理之后的各个通道图像进行融合,得到最终的美颜图像。根据各个通道图像中的亮度值进行美颜处理,亮度值越低的通道图像,说明亮度偏差越严重。根据亮度偏差获取对应的美颜参数,并分别对各个通道图像进行美颜处理。例如,在进行磨皮处理的时候,G通道图像的亮度值最高,为了保留G通道图像的亮度区域的细节信息,可以对G通道图像进行较浅程度的磨皮处理。In one embodiment, image fusion refers to a process of synthesizing multiple images to generate a target image. After each channel image of the to-be-processed image is subjected to beautification processing, each channel image after the beautification processing is fused to obtain a final beautified image. The beautification process is performed according to the brightness value in each channel image. The channel image with the lower brightness value indicates that the brightness deviation is more serious. Obtain the corresponding beauty parameters according to the brightness deviation, and perform beauty processing on each channel image respectively. For example, during the skin resurfacing process, the brightness value of the G channel image is the highest. In order to retain the detail information of the brightness area of the G channel image, the G channel image can be subjected to a shallow resurfacing process.

上述实施例提供的图像处理方法、装置、计算机可读存储介质和电子设备,首先获取待处理图像中各个通道图像的亮度值,并根据亮度值获取各个通道图像的美颜参数,然后根据获取的美颜参数对各个通道图像进行美颜处理。这样可以针对各个通道图像进行不同的美颜处理,优化了美颜处理,使图像处理更加准确。The image processing method, device, computer-readable storage medium and electronic device provided by the above-mentioned embodiments first obtain the brightness value of each channel image in the image to be processed, and obtain the beauty parameters of each channel image according to the brightness value, and then according to the obtained value. The beautification parameters perform beautification processing on each channel image. In this way, different beautification processing can be performed for each channel image, which optimizes the beauty processing and makes the image processing more accurate.

图3为另一个实施例中图像处理方法的流程图。如图3所示,该图像处理方法包括步骤302至步骤310。其中:FIG. 3 is a flowchart of an image processing method in another embodiment. As shown in FIG. 3 , the image processing method includes steps 302 to 310 . in:

步骤302,获取待处理图像。Step 302, acquiring the image to be processed.

在一个实施例中,可以通过移动终端获取待处理图像,获取到待处理图像之后,可以在移动终端本地进行美颜处理,也可以发送到服务器进行美颜处理。若在服务器上进行美颜处理,则发送到服务器的可以是一个待处理图像,待处理图像集合是指一张或多张待处理图像构成的集合。各个移动终端可以将待处理图像集合发送到服务器,服务器在接收到该待处理图像集合之后,对待处理图像集合中的待处理图像进行美颜处理。移动终端发送待处理图像集合时,同时发送对应的终端标识,服务器处理完成之后,根据终端标识查找对应的移动终端,把处理完成之后的待处理图像集合发送到移动终端。其中,终端标识是指用户终端的唯一标识。例如,终端标识可以是IP(Internet Protocol,网络之间互连的协议)地址、MAC(Media Access Control,媒体访问控制)地址等中的至少一种。In one embodiment, the image to be processed may be acquired through a mobile terminal, and after the image to be processed is acquired, beautification processing may be performed locally on the mobile terminal, or may be sent to a server for beautification processing. If the beautification process is performed on the server, an image to be processed may be sent to the server, and the set of images to be processed refers to a set composed of one or more images to be processed. Each mobile terminal may send the set of images to be processed to the server, and after receiving the set of images to be processed, the server performs beauty processing on the images to be processed in the set of images to be processed. When the mobile terminal sends the set of images to be processed, it also sends the corresponding terminal identifier. After the server finishes processing, it searches for the corresponding mobile terminal according to the terminal identifier, and sends the set of images to be processed after the processing is completed to the mobile terminal. The terminal identifier refers to the unique identifier of the user terminal. For example, the terminal identifier may be at least one of an IP (Internet Protocol, protocol for interconnection between networks) address, a MAC (Media Access Control, media access control) address, and the like.

步骤304,获取待处理图像中的目标区域。Step 304, acquiring the target area in the image to be processed.

一般情况下,用户关注的并不是图像中的整个区域,而是图像中的某一个区域。例如,用户一般比较关注图像中的人像所在的区域,或者人脸所在的区域。目标区域就是指用户比较关注的区域,在获取美颜参数的时候,可以不用获取整个图像中的亮度值,只获取目标区域的亮度值即可。例如,目标区域可以是指人脸区域、人像区域、皮肤区域、嘴唇区域等,在此不做限定。具体的,目标区域可以是指待处理图像中的人脸区域或人像区域,其中人脸区域是指待处理图像中人像的人脸所在的区域,人像区域是指待处理图像中的整个人像所在的区域。获取待处理图像中的目标区域具体可以包括:检测待处理图像中的人脸区域,将人脸区域作为目标区域;和/或检测待处理图像中的人脸区域,并根据人脸区域获取人像区域,将人像区域作为目标区域。In general, what the user pays attention to is not the whole area in the image, but a certain area in the image. For example, the user generally pays more attention to the area where the portrait is located in the image, or the area where the human face is located. The target area refers to the area that the user pays more attention to. When obtaining the beauty parameters, it is not necessary to obtain the brightness value of the entire image, but only the brightness value of the target area. For example, the target area may refer to a face area, a portrait area, a skin area, a lip area, etc., which is not limited herein. Specifically, the target area may refer to a face area or a portrait area in the image to be processed, wherein the face area refers to the area where the face of the portrait in the image to be processed is located, and the portrait area refers to the location of the entire portrait in the image to be processed. Area. Acquiring the target area in the image to be processed may specifically include: detecting the face area in the image to be processed, and using the face area as the target area; and/or detecting the face area in the image to be processed, and obtaining the portrait according to the face area area, take the portrait area as the target area.

不难理解,待处理图像是由若干个像素点组成,人脸区域是由待处理图像中人脸对应的像素点所构成的区域。具体可以通过人脸检测算法获取待处理图像的人脸区域,人脸检测算法可以包括基于几何特征的检测方法、特征脸检测方法、线性判别分析方法、基于隐马尔柯夫模型检测方法等,在此不做限定。一般地,通过图像采集装置采集图像的时候,可以同时获取图像对应的深度图,深度图中的像素点与图像中的像素点对应。深度图中的像素点表示图像中对应像素的深度信息,深度信息即为像素点对应的物体到图像采集装置的深度信息。例如,深度信息可以通过双摄像头进行获取,得到的像素点对应的深度信息可以为1米、2米或3米等。则获取人像区域具体可以包括:获取待处理图像及对应的深度信息;检测待处理图像中的人脸区域,并根据人脸区域和深度信息,获取待处理图像中的人像区域。一般认为人像与人脸在同一垂直平面上,人像到图像采集装置的深度信息与人脸到图像采集装置的深度信息的取值在同一范围内。因此,在获取人脸区域后,可以从深度图中获取人脸区域对应的深度信息,然后根据人脸区域对应的深度信息可以获取人像区域对应的深度信息,然后根据人像区域对应的深度信息即可获取到待处理图像中的人像区域。It is not difficult to understand that the image to be processed is composed of several pixels, and the face area is an area composed of pixels corresponding to the face in the image to be processed. Specifically, the face region of the image to be processed can be obtained through a face detection algorithm. The face detection algorithm can include a detection method based on geometric features, an eigenface detection method, a linear discriminant analysis method, a detection method based on a hidden Markov model, etc. This is not limited. Generally, when an image is acquired by an image acquisition device, a depth map corresponding to the image can be acquired at the same time, and the pixels in the depth map correspond to the pixels in the image. The pixels in the depth map represent the depth information of the corresponding pixels in the image, and the depth information is the depth information from the object corresponding to the pixel to the image acquisition device. For example, the depth information can be acquired through dual cameras, and the depth information corresponding to the obtained pixels can be 1 meter, 2 meters, or 3 meters, etc. The obtaining of the portrait region may specifically include: obtaining the image to be processed and corresponding depth information; detecting the face region in the image to be processed, and obtaining the portrait region in the image to be processed according to the face region and the depth information. It is generally considered that the portrait and the face are on the same vertical plane, and the depth information from the portrait to the image acquisition device and the depth information from the human face to the image acquisition device are in the same range. Therefore, after obtaining the face region, the depth information corresponding to the face region can be obtained from the depth map, and then the depth information corresponding to the portrait region can be obtained according to the depth information corresponding to the face region, and then according to the depth information corresponding to the portrait region, namely The portrait area in the image to be processed can be obtained.

图4为一个实施例中获取深度信息的原理图。如图4所示,已知第一摄像头 402到第二摄像头404之间的距离Tc,通过第一摄像头402和第二摄像头404分别拍摄物体406对应的图像,根据该图像可以获取第一夹角A1和第二夹角A2,第一摄像头402到第二摄像头404所在水平线与物体402之间的垂直交点为交点408。假设第一摄像头402到交点408的距离为Tx,那么交点408到第二摄像头404的距离就为Tc-Tx,物体406的深度信息即物体406到交点408的垂直距离为Ts。根据第一摄像头402、物体406和交点408组成的三角形,则可以得到以下公式:FIG. 4 is a schematic diagram of acquiring depth information in one embodiment. As shown in FIG. 4 , the distance T c between the first camera 402 and the second camera 404 is known, and images corresponding to the object 406 are captured by the first camera 402 and the second camera 404 respectively, and the first clip can be obtained according to the images. The angle A1 and the second included angle A2, the vertical intersection between the horizontal line where the first camera 402 to the second camera 404 are located and the object 402 is the intersection 408 . Assuming that the distance from the first camera 402 to the intersection 408 is T x , the distance from the intersection 408 to the second camera 404 is T c −T x , and the depth information of the object 406 , that is, the vertical distance from the object 406 to the intersection 408 is T s . According to the triangle formed by the first camera 402, the object 406 and the intersection 408, the following formula can be obtained:

Figure BDA0001451485350000081
Figure BDA0001451485350000081

同理,根据第二摄像头404、物体406和交点408组成的三角形,则可以得到以下公式:Similarly, according to the triangle formed by the second camera 404, the object 406 and the intersection 408, the following formula can be obtained:

Figure BDA0001451485350000082
Figure BDA0001451485350000082

由上述公式可以得到物体406的深度信息为:From the above formula, the depth information of the object 406 can be obtained as:

Figure BDA0001451485350000083
Figure BDA0001451485350000083

步骤306,获取目标区域的各个通道图像对应的亮度值,并根据亮度值获取各个通道图像对应的美颜参数。Step 306: Obtain the brightness value corresponding to each channel image of the target area, and obtain the beauty parameter corresponding to each channel image according to the brightness value.

获取目标区域的各个通道图像对应的亮度值,并根据亮度值获取各个通道图像对应的美颜参数。例如,获取待处理图像中人脸区域对应的CMY通道图像的亮度值,若C通道图像对应的亮度值最大,则待处理图像对应的C通道图像对应的磨皮程度最低。可以理解的是,在进行美颜处理的时候,可以不用对整个待处理图像进行处理,而只针对目标区域进行处理,则可以根据亮度值获取目标区域的各个通道图像对应的美颜参数,并根据该美颜参数对目标区域的各个通道图像分别进行美颜处理。一般来说,待处理图像中可以包含一个或多个目标区域,每一个目标区域都可以是一个独立的连通区域,将这些独立的目标区域从待处理图像中提取出来。在获取目标区域的亮度值的时候,若待处理图像中存在两个或两个以上的目标区域,则可以将这个多个目标区域作为一个整体获取各个通道图像对应的亮度值,并根据获取的亮度值获取各个通道图像的美颜参数,也可以分别获取各个目标区域对应的各个通道图像的亮度值,并根据亮度值分别获取各个目标区域对应的各个通道图像的美颜参数。例如,待处理图像中包括人脸1和人脸2,则在获取美颜参数的时候,可以将人脸1和人脸 2作为一个整体获取RGB三通道图像的亮度值,并通过亮度值获取待处理图像对应的RGB三通道图像的美颜参数。也可以分别获取人脸1和人脸2的亮度值,并根据获取的亮度值分别获取人脸1和人脸2对应的美颜参数。具体地,获取人脸1对应的RGB三通道图像的亮度值,根据获取的亮度值分别获取人脸1对应的RGB三通道图像的美颜参数;获取人脸2对应的RGB三通道图像的亮度值,根据获取的亮度值分别获取人脸2对应的RGB三通道图像的美颜参数。Obtain the brightness value corresponding to each channel image of the target area, and obtain the beauty parameter corresponding to each channel image according to the brightness value. For example, the brightness value of the CMY channel image corresponding to the face region in the image to be processed is obtained. If the brightness value corresponding to the C channel image is the largest, the C channel image corresponding to the to-be-processed image has the lowest degree of skin grinding. It can be understood that, when performing beauty processing, it is not necessary to process the entire image to be processed, but only the target area. The beauty parameters corresponding to each channel image of the target area can be obtained according to the brightness value and According to the beautification parameters, beautification processing is performed on each channel image of the target area respectively. Generally speaking, the image to be processed may contain one or more target areas, each target area may be an independent connected area, and these independent target areas are extracted from the image to be processed. When obtaining the brightness value of the target area, if there are two or more target areas in the image to be processed, the multiple target areas can be taken as a whole to obtain the brightness values corresponding to each channel image, and according to the obtained brightness values The brightness value is used to obtain the beauty parameters of each channel image, and the brightness value of each channel image corresponding to each target area can also be obtained separately, and the beauty parameters of each channel image corresponding to each target area can be obtained according to the brightness value. For example, if the image to be processed includes face 1 and face 2, when acquiring the beauty parameters, the luminance value of the RGB three-channel image can be obtained by taking the face 1 and face 2 as a whole, and obtaining the luminance value Beauty parameters of the RGB three-channel image corresponding to the image to be processed. The brightness values of the face 1 and the face 2 can also be obtained respectively, and the beauty parameters corresponding to the face 1 and the face 2 can be obtained respectively according to the obtained brightness values. Specifically, the brightness value of the RGB three-channel image corresponding to face 1 is obtained, and the beauty parameters of the RGB three-channel image corresponding to face 1 are respectively obtained according to the obtained brightness value; the brightness of the RGB three-channel image corresponding to face 2 is obtained. value, and obtain the beauty parameters of the RGB three-channel image corresponding to face 2 according to the obtained brightness value.

具体的,在对人脸区域进行美颜处理时,图像中的人脸区域的面积可以能不一样,一般需要突出的主人脸的面积比较大,路人的人脸面积都比较小。同时人脸面积比较小的时候,若进行磨皮等处理时,处理之后就会使得人脸的五官变得模糊不清。则在进行美颜处理的时候,可以获取目标区域对应的区域面积,若区域面积小于面积阈值,则不进行美颜处理,只将区域面积大于面积阈值的目标区域进行美颜处理。则在步骤306之前还可以包括:获取目标区域的区域面积,并获取区域面积大于面积阈值的人脸区域。目标区域是由若干个像素点构成,则目标区域的面积则可以表示为目标区域内所包含的像素点的总数量,也可以表示为目标区域与对应的待处理图像的面积比例。Specifically, when the face area is beautified, the area of the face area in the image may be different. Generally, the area of the main face that needs to be prominent is relatively large, and the area of the face of passers-by is relatively small. At the same time, when the face area is relatively small, if processing such as microdermabrasion is performed, the facial features of the face will become blurred after processing. When performing beauty processing, the area corresponding to the target area can be obtained. If the area area is smaller than the area threshold, the beauty processing is not performed, and only the target area whose area is larger than the area threshold is subjected to the beauty processing. Then, before step 306, the method may further include: acquiring the area of the target area, and acquiring the face area whose area is greater than the area threshold. The target area is composed of several pixels, and the area of the target area can be expressed as the total number of pixels contained in the target area, or as the area ratio of the target area to the corresponding image to be processed.

步骤308,根据美颜参数对各个通道图像分别进行美颜处理。Step 308: Perform beautification processing on each channel image according to the beauty parameters.

在一个实施例中,根据目标区域的亮度值获取待处理图像中的各个通道图像的美颜参数,并根据获取的美颜参数对待处理图像中的各个通道图像进行美颜处理。也可以只对目标区域进行处理,即获取目标区域的亮度值,根据亮度值获取目标区域的各个通道图像对应的美颜参数,并根据获取的美颜参数对分别对目标区域的各个通道图像进行美颜处理。例如,可以获取皮肤区域对应的 RGB三通道图像的亮度值,并根据获取的亮度值分别获取皮肤区域的RGB三通道图像美白级别,然后根据获取的美白级别分别对皮肤区域的RGB三通道图像进行对应程度的美白处理。In one embodiment, the beauty parameters of each channel image in the image to be processed are obtained according to the brightness value of the target area, and the beauty treatment is performed on each channel image in the image to be processed according to the obtained beauty parameters. It is also possible to process only the target area, that is, obtain the brightness value of the target area, obtain the beauty parameters corresponding to each channel image of the target area according to the brightness value, and perform the processing on each channel image of the target area according to the obtained beauty parameters. Beauty treatment. For example, the brightness value of the RGB three-channel image corresponding to the skin area can be obtained, and the RGB three-channel image whitening level of the skin area can be obtained according to the obtained brightness value, and then the RGB three-channel image of the skin area can be processed according to the obtained whitening level. Corresponding degree of whitening treatment.

步骤310,将美颜处理后的各个通道图像进行融合,得到美颜图像。Step 310 , fuse each channel image after beautification processing to obtain a beautification image.

在一个实施例中,若只对待处理图像中的目标区域进行美颜处理,而未对待处理图像中除目标区域之外的剩余区域做美颜处理,在处理之后可能会导致目标区域和剩余区域之间有明显的差异。例如,对目标区域进行美白处理之后,目标区域的亮度明显比剩余区域的亮度高,这样使图像看起来很不自然。那么可以在生成的美颜图像中,将目标区域的边界进行过渡处理,使得到的美颜图像看起来更加自然。In one embodiment, if only the target area in the to-be-processed image is subjected to beautification processing, and the remaining areas of the to-be-processed image other than the target area are not subjected to cosmetic beautification processing, the target area and the remaining area may be affected after processing. There are clear differences between them. For example, after whitening the target area, the target area is significantly brighter than the remaining area, which makes the image look unnatural. Then, in the generated beauty image, the boundary of the target area can be transitioned, so that the obtained beauty image looks more natural.

上述实施例提供的图像处理方法,首先获取待处理图像中目标区域的各个通道图像的亮度值,并根据亮度值获取各个通道图像的美颜参数,然后根据获取的美颜参数对各个通道图像进行美颜处理。这样可以针对各个通道图像进行不同的美颜处理,优化了美颜处理,使图像处理更加准确。In the image processing method provided by the above embodiment, the brightness value of each channel image of the target area in the image to be processed is first obtained, and the beauty parameters of each channel image are obtained according to the brightness value, and then each channel image is processed according to the obtained beauty parameters. Beauty treatment. In this way, different beautification processing can be performed for each channel image, which optimizes the beauty processing and makes the image processing more accurate.

图5为又一个实施例中图像处理方法的流程图。如图5所示,该图像处理方法包括步骤502至步骤512。其中:FIG. 5 is a flowchart of an image processing method in yet another embodiment. As shown in FIG. 5 , the image processing method includes steps 502 to 512 . in:

步骤502,获取待处理图像。Step 502, acquiring the image to be processed.

步骤504,获取待处理图像中各个通道图像对应的亮度值。Step 504: Obtain the brightness value corresponding to each channel image in the image to be processed.

可以理解的是,待处理图像是由若干个像素点构成的,这些像素点按照一定的规律进行排列。一般来说,待处理图像是一个二维的像素阵列,每一个像素点都存在对应的通道值,像素点在图像中的位置,可以通过一个位置坐标进行表示。例如,待处理图像可以是640*480的,表示这张待处理图像在每一个长度方向上有640个像素点,在每一个宽度方向上有480个像素点,像素点总量为640*480=307200,即该待处理图像为30万像素。获取待处理图像中各个通道图像对应的亮度值,可以首先获取待处理图像的每个通道图像,然后遍历通道图像中的每个像素,根据获取的每个像素的通道值获取亮度值。例如,获取待处理图像的G通道图像,遍历G通道图像中的每一个像素点,获取G通道值,并将所有像素点的G通道值的平均值作为该G通道图像的亮度值。可以理解的是,若只统计某一个区域的各个通道图像的亮度值,那么只需要遍历该区域的像素点,并获取对应的通道图像的亮度值即可。It can be understood that the image to be processed is composed of several pixel points, and these pixel points are arranged according to a certain rule. Generally speaking, the image to be processed is a two-dimensional pixel array, each pixel has a corresponding channel value, and the position of the pixel in the image can be represented by a position coordinate. For example, the image to be processed can be 640*480, which means that the image to be processed has 640 pixels in each length direction and 480 pixels in each width direction, and the total number of pixels is 640*480 =307200, that is, the image to be processed is 300,000 pixels. To obtain the brightness value corresponding to each channel image in the to-be-processed image, each channel image of the to-be-processed image can be obtained first, then each pixel in the channel image is traversed, and the brightness value is obtained according to the obtained channel value of each pixel. For example, the G channel image of the image to be processed is obtained, each pixel in the G channel image is traversed, the G channel value is obtained, and the average value of the G channel values of all pixels is used as the brightness value of the G channel image. It can be understood that, if only the brightness values of each channel image of a certain area are counted, then only the pixels of the area need to be traversed, and the brightness value of the corresponding channel image can be obtained.

步骤506,根据待处理图像获取对应的人物属性特征。Step 506: Acquire corresponding person attribute features according to the image to be processed.

人物属性特征是指表示图像中人物的人物属性的特征,例如人物属性特征可以是指性别特征、年龄特征、人种特征等中的一种或多种。可以首先获取待处理图像中的人脸区域,然后根据人脸区域来识别对应的人物属性。具体地,获取待处理图像中的人脸区域,通过特征识别模型获取人脸区域对应的人物属性特征。其中,特征识别模型是指识别人物属性特征的模型,特征识别模型是通过人脸样本集合训练得到的。人脸样本集合是指由若干张人脸图像构成的图像集合,根据人脸样本集合训练得到特征识别模型,一般地人脸样本集合中的人脸图像越多,训练得到的特征识别模型越精确。例如,在监督学习中,将人脸样本集合中的每一张人脸图像打上相应的标签,用于标记人脸图像的类型,通过对人脸样本集合的训练可以得到特征识别模型。特征识别模型可以将人脸区域进行分类,得到对应的人物属性特征。例如,将人脸区域可以分为黄种人、黑种人和白种人,那么得到的对应的人物属性特征就是黄种人、黑种人或白种人中的一种。也就是说,通过特征识别模型进行分类是基于同一标准的。可以理解的是,若要得到人脸区域的不同维度的人物属性特征,则可以通过不同的特征识别模型分别进行获取。具体地,人物属性特征可以包括人种特征参数、性别特征参数、年龄特征参数、肤色特征参数、肤质特征参数、脸型特征参数、妆容特征参数,在此不做限定。例如,通过人种识别模型得到人脸区域对应的人种特征参数,根据年龄识别模型得到人脸区域对应的年龄特征参数,根据性别识别模型得到人脸区域对应的性别特征参数。The character attribute feature refers to a feature representing the character attribute of the character in the image, for example, the character attribute feature may refer to one or more of a gender feature, an age feature, an ethnic feature, and the like. The face area in the image to be processed may be acquired first, and then the corresponding character attributes can be identified according to the face area. Specifically, a face region in the image to be processed is acquired, and a character attribute feature corresponding to the face region is acquired through a feature recognition model. Among them, the feature recognition model refers to a model that recognizes the attributes of a person, and the feature recognition model is obtained by training a set of face samples. The face sample set refers to an image set composed of several face images. The feature recognition model is obtained by training according to the face sample set. Generally, the more face images in the face sample set, the more accurate the feature recognition model obtained by training. . For example, in supervised learning, each face image in the face sample set is marked with a corresponding label to mark the type of face image, and a feature recognition model can be obtained by training the face sample set. The feature recognition model can classify the face area and obtain the corresponding character attribute features. For example, the face area can be divided into yellow, black and white, then the corresponding character attribute feature obtained is one of yellow, black or white. That is, classification by feature recognition models is based on the same criteria. It can be understood that, to obtain character attribute features of different dimensions of the face region, they can be obtained separately through different feature recognition models. Specifically, the character attribute features may include race feature parameters, gender feature parameters, age feature parameters, skin color feature parameters, skin texture feature parameters, face shape feature parameters, and makeup feature parameters, which are not limited herein. For example, the ethnic characteristic parameter corresponding to the face region is obtained through the ethnic identification model, the age characteristic parameter corresponding to the face region is obtained according to the age identification model, and the gender characteristic parameter corresponding to the face region is obtained according to the gender identification model.

步骤508,根据人物属性特征和亮度值,获取各个通道图像对应的美颜参数。Step 508: Obtain the beauty parameters corresponding to the images of each channel according to the character attributes and brightness values.

在一个实施例中,美颜参数可以包括美颜类别参数和美颜程度参数。其中,美颜类别参数是表示美颜处理类别的参数,美颜程度参数是表示美颜处理程度的参数。例如,美颜类别参数可以为美白处理、磨皮处理等,美颜程度参数则可以分为1级、2级、3级、4级、5级等五个等级。从1级到5级的美颜处理,美颜处理的程度递增。获取到待处理图像的人物属性特征和亮度值之后,可以根据人物属性特征和亮度值,获取各个通道图像对应的美颜参数。人物属性特征与美颜类别参数是对应的,根据人物属性特征可以获取对应的美颜类别参数。亮度值与美颜程度参数对应,根据亮度值可以获取对应的美颜程度参数。例如,当识别图像中的人脸为男性时,将图像进行磨皮处理,当识别图像中的人脸为女性时,将图像进行美白处理。具体地,根据人物属性特征获取待处理图像对应的美颜类别参数;根据亮度值获取各个通道图像对应的美颜程度参数。可以理解的是,待处理图像中可能会存在多个人脸,当待处理图像中存在多个人脸区域时,可以分别识别各个人脸区域,并分别获取各个人脸区域对应的人物属性特征和亮度值,然后分别对各个人脸区域进行的美颜处理。In one embodiment, the beauty parameter may include a beauty category parameter and a beauty level parameter. Among them, the beauty category parameter is a parameter representing the beauty processing category, and the beauty level parameter is a parameter representing the beauty processing level. For example, the beauty category parameter may be whitening treatment, skin resurfacing treatment, etc., and the beauty level parameter may be divided into five levels, namely, level 1, level 2, level 3, level 4, and level 5. From level 1 to level 5 beautifying treatment, the degree of beautifying treatment increases. After acquiring the human attribute features and brightness values of the image to be processed, the beauty parameters corresponding to each channel image can be acquired according to the human attribute features and brightness values. The character attribute feature corresponds to the beauty category parameter, and the corresponding beauty category parameter can be obtained according to the character attribute feature. The brightness value corresponds to the beauty level parameter, and the corresponding beauty level parameter can be obtained according to the brightness value. For example, when the face in the image is identified as male, the image is subjected to microdermabrasion processing, and when the face in the identified image is identified as female, the image is subjected to whitening processing. Specifically, the beauty category parameter corresponding to the image to be processed is obtained according to the character attribute feature; the beauty level parameter corresponding to each channel image is obtained according to the brightness value. It can be understood that there may be multiple faces in the image to be processed. When there are multiple face regions in the image to be processed, each face region can be identified separately, and the character attributes and brightness corresponding to each face region can be obtained separately. value, and then perform beautification processing for each face area separately.

步骤510,根据美颜参数对各个通道图像分别进行美颜处理。Step 510: Perform beautification processing on each channel image according to the beauty parameters.

美颜参数包括美颜类别参数和美颜程度参数,根据美颜类别参数和美颜程度参数对各个通道图像分别进行美颜处理。一般来说各个通道图像对应的美颜类别参数是相同的,对应的美颜程度参数可以不同。例如,若要对图像进行磨皮处理,那么应该对各个通道图像都进行磨皮处理,而每个通道图像对应的磨皮程度可以不一样。The beauty parameters include a beauty category parameter and a beauty degree parameter, and each channel image is subjected to beautification processing according to the beauty category parameter and the beauty level parameter. Generally speaking, the beauty category parameters corresponding to each channel image are the same, and the corresponding beauty level parameters can be different. For example, if you want to perform microdermabrasion processing on an image, you should perform microdermabrasion processing on each channel image, and the degree of microdermabrasion corresponding to each channel image can be different.

步骤512,将美颜处理后的各个通道图像进行融合,得到美颜图像。Step 512 , fuse each channel image after beautifying processing to obtain a beautifying image.

上述实施例提供的图像处理方法,首先获取待处理图像中各个通道图像的亮度值,并根据亮度值获取各个通道图像的美颜参数,然后根据获取的美颜参数对各个通道图像进行美颜处理。这样可以针对各个通道图像进行不同的美颜处理,优化了美颜处理,使图像处理更加准确。In the image processing method provided by the above embodiment, the brightness value of each channel image in the image to be processed is first obtained, and the beauty parameters of each channel image are obtained according to the brightness value, and then the beauty treatment is performed on each channel image according to the obtained beauty parameters. . In this way, different beautification processing can be performed for each channel image, which optimizes the beauty processing and makes the image processing more accurate.

图6为又一个实施例中图像处理方法的流程图。如图6所示,该图像处理方法包括步骤602至步骤614。其中:FIG. 6 is a flowchart of an image processing method in yet another embodiment. As shown in FIG. 6 , the image processing method includes steps 602 to 614 . in:

步骤602,获取待处理图像。Step 602, acquiring the image to be processed.

步骤604,检测待处理图像中的人脸区域,获取人脸区域的各个通道图像对应的亮度值。Step 604: Detect the face region in the image to be processed, and obtain brightness values corresponding to each channel image of the face region.

步骤606,通过特征识别模型获取人脸区域对应的人物属性特征,其中特征识别模型是通过人脸样本集合训练得到的。Step 606 , obtaining the character attribute features corresponding to the face region through a feature recognition model, wherein the feature recognition model is obtained by training a set of face samples.

步骤608,根据人物属性特征获取待处理图像对应的美颜类别参数,美颜类别参数是表示美颜处理类别的参数。Step 608: Acquire a beauty category parameter corresponding to the image to be processed according to the character attribute feature, where the beauty category parameter is a parameter representing a beauty processing category.

步骤610,根据亮度值获取各个通道图像对应的美颜程度参数,美颜程度参数是表示美颜处理程度的参数。Step 610: Obtain a beauty level parameter corresponding to each channel image according to the brightness value, where the beauty level parameter is a parameter representing the level of beauty processing.

步骤612,根据美颜类别参数和美颜程度参数对各个通道图像分别进行美颜处理。Step 612: Perform beautification processing on each channel image according to the beautification category parameter and the beautification degree parameter.

步骤614,将美颜处理后的各个通道图像进行融合,得到美颜图像。Step 614 , fuse each channel image after beautification processing to obtain a beautification image.

上述实施例提供的图像处理方法,首先获取待处理图像中的人脸区域,并获取人脸区域对应的各个通道图像的亮度值,根据亮度值获取各个通道图像的美颜参数,然后根据获取的美颜参数对各个通道图像进行美颜处理。这样可以针对各个通道图像进行不同的美颜处理,优化了美颜处理,使图像处理更加准确。In the image processing method provided by the above-mentioned embodiments, the face region in the image to be processed is firstly obtained, and the brightness value of each channel image corresponding to the face region is obtained, and the beauty parameters of each channel image are obtained according to the brightness value, and then according to the obtained value. The beautification parameters perform beautification processing on each channel image. In this way, different beautification processing can be performed for each channel image, which optimizes the beauty processing and makes the image processing more accurate.

图7为一个实施例中图像处理装置的结构示意图。如图7所示,该图像处理装置700包括图像获取模块702、参数获取模块704、美颜处理模块706和图像融合模块708。其中:FIG. 7 is a schematic structural diagram of an image processing apparatus in an embodiment. As shown in FIG. 7 , the image processing apparatus 700 includes an image acquisition module 702 , a parameter acquisition module 704 , a beauty processing module 706 and an image fusion module 708 . in:

图像获取模块702,用于获取待处理图像。The image acquisition module 702 is used to acquire the image to be processed.

参数获取模块704,用于获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数。The parameter acquisition module 704 is configured to acquire the brightness value corresponding to each channel image in the to-be-processed image, and acquire the beauty parameter corresponding to each channel image according to the brightness value.

美颜处理模块706,用于根据所述美颜参数对所述各个通道图像分别进行美颜处理。The beauty processing module 706 is configured to perform beauty processing on the respective channel images according to the beauty parameters.

图像融合模块708,用于将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image fusion module 708 is configured to fuse the images of each channel after the beauty treatment to obtain a beauty image.

上述实施例提供的图像处理装置,首先获取待处理图像中各个通道图像的亮度值,并根据亮度值获取各个通道图像的美颜参数,然后根据获取的美颜参数对各个通道图像进行美颜处理。这样可以针对各个通道图像进行不同的美颜处理,优化了美颜处理,使图像处理更加准确。The image processing device provided by the above embodiment first obtains the brightness value of each channel image in the image to be processed, and obtains the beauty parameter of each channel image according to the brightness value, and then performs beauty processing on each channel image according to the obtained beauty parameter. . In this way, different beautification processing can be performed for each channel image, which optimizes the beauty processing and makes the image processing more accurate.

在一个实施例中,参数获取模块704还用于获取所述待处理图像中的目标区域;获取所述目标区域的各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数。In one embodiment, the parameter obtaining module 704 is further configured to obtain the target area in the to-be-processed image; obtain the brightness value corresponding to each channel image of the target area, and obtain the corresponding brightness value of each channel image according to the brightness value Beauty parameters.

在一个实施例中,参数获取模块704还用于检测所述待处理图像中的人脸区域,将所述人脸区域作为目标区域;和/或检测所述待处理图像中的人脸区域,并根据所述人脸区域获取人像区域,将所述人像区域作为目标区域。In one embodiment, the parameter acquisition module 704 is further configured to detect the face area in the image to be processed, and use the face area as the target area; and/or detect the face area in the image to be processed, and obtain a portrait area according to the face area, and use the portrait area as a target area.

在一个实施例中,参数获取模块704还用于根据所述待处理图像获取对应的人物属性特征;根据所述人物属性特征和亮度值,获取所述各个通道图像对应的美颜参数。In one embodiment, the parameter obtaining module 704 is further configured to obtain the corresponding human attribute feature according to the to-be-processed image; and obtain the beauty parameter corresponding to each channel image according to the human attribute feature and the brightness value.

在一个实施例中,参数获取模块704还用于获取所述待处理图像中的人脸区域,通过特征识别模型获取所述人脸区域对应的人物属性特征,其中所述特征识别模型是通过人脸样本集合训练得到的。In one embodiment, the parameter obtaining module 704 is further configured to obtain the face region in the image to be processed, and obtain the character attribute feature corresponding to the face region through a feature recognition model, wherein the feature recognition model The face sample set is obtained by training.

在一个实施例中,参数获取模块704还用于根据所述人物属性特征获取所述待处理图像对应的美颜类别参数,所述美颜类别参数是表示美颜处理类别的参数;根据所述亮度值获取所述各个通道图像对应的美颜程度参数,所述美颜程度参数是表示美颜处理程度的参数。In one embodiment, the parameter obtaining module 704 is further configured to obtain the beauty category parameter corresponding to the image to be processed according to the character attribute feature, where the beauty category parameter is a parameter representing the beauty treatment category; according to the The brightness value obtains a beauty level parameter corresponding to each channel image, and the beauty level parameter is a parameter representing the level of beauty processing.

在一个实施例中,美颜处理模块706还用于根据所述美颜类别参数和美颜程度参数对所述各个通道图像分别进行美颜处理。In one embodiment, the beauty processing module 706 is further configured to perform beauty processing on the respective channel images according to the beauty category parameter and the beauty level parameter.

上述图像处理装置中各个模块的划分仅用于举例说明,在其他实施例中,可将图像处理装置按照需要划分为不同的模块,以完成上述图像处理装置的全部或部分功能。The division of each module in the above image processing apparatus is only for illustration. In other embodiments, the image processing apparatus may be divided into different modules as required to complete all or part of the functions of the above image processing apparatus.

图8为一个实施例中图像处理系统的结构示意图。如图8所示,该图像处理图像包括特征层802、适配层804和处理层806。其中,特征层802用于获取待处理图像,获取待处理图像中的亮度值。然后对待处理图像进行人脸检测,并根据人脸检测得到的人脸区域获取对应的人物属性特征。人物属性特征可以包括人种特征参数、性别特征参数、年龄特征参数、肤色特征参数、肤质特征参数、脸型特征参数、妆容特征参数,在此不做限定。特征层802将获取的亮度值和人物属性特征发送到适配层804,适配层804根据待处理图像对应的亮度值和人物属性特征,获取对应的美颜参数,并将美颜参数发送至处理层806中。处理层806根据接收到的美颜参数对待处理图像进行美颜处理,然后输出美颜处理后的图像。其中,美颜处理可以但不限于包括磨皮、美白、大眼、瘦脸、肤色调整、祛斑、亮眼、去眼袋、牙齿美白、美唇等处理。FIG. 8 is a schematic structural diagram of an image processing system in one embodiment. As shown in FIG. 8 , the image processing image includes a feature layer 802 , an adaptation layer 804 and a processing layer 806 . Among them, the feature layer 802 is used to acquire the image to be processed, and acquire the brightness value in the image to be processed. Then, face detection is performed on the image to be processed, and corresponding character attribute features are obtained according to the face region obtained by the face detection. The character attribute features may include race feature parameters, gender feature parameters, age feature parameters, skin color feature parameters, skin texture feature parameters, face shape feature parameters, and makeup feature parameters, which are not limited herein. The feature layer 802 sends the acquired brightness value and human attribute features to the adaptation layer 804, and the adaptation layer 804 obtains the corresponding beauty parameters according to the brightness values and human attribute features corresponding to the image to be processed, and sends the beauty parameters to in processing layer 806. The processing layer 806 performs beautification processing on the image to be processed according to the received beauty parameters, and then outputs the image after beautification processing. Among them, the beauty treatment may include, but is not limited to, treatments such as skin resurfacing, whitening, big eyes, face reduction, skin tone adjustment, freckle removal, eye brightening, eye bag removal, teeth whitening, and lip beautification.

本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机程序的非易失性计算机可读存储介质,当所述计算机程序被一个或多个处理器执行时,使得所述处理器执行以下步骤:Embodiments of the present application also provide a computer-readable storage medium. One or more non-transitory computer-readable storage media containing a computer program that, when executed by one or more processors, causes the processors to perform the following steps:

获取待处理图像;Get the image to be processed;

获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数;Acquire the brightness value corresponding to each channel image in the to-be-processed image, and acquire the beauty parameter corresponding to each channel image according to the brightness value;

根据所述美颜参数对所述各个通道图像分别进行美颜处理;Performing beautification processing on the respective channel images according to the beautifying parameters;

将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image of each channel after the beauty treatment is fused to obtain a beauty image.

在一个实施例中,所述处理器执行的所述获取所述待处理图像中各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数包括:In one embodiment, the acquiring the brightness value corresponding to each channel image in the to-be-processed image performed by the processor, and acquiring the beauty parameter corresponding to each channel image according to the brightness value includes:

获取所述待处理图像中的目标区域;obtaining the target area in the to-be-processed image;

获取所述目标区域的各个通道图像对应的亮度值,并根据所述亮度值获取各个通道图像对应的美颜参数。The brightness value corresponding to each channel image of the target area is acquired, and the beauty parameter corresponding to each channel image is acquired according to the brightness value.

在一个实施例中,所述处理器执行的所述获取所述待处理图像中的目标区域包括以下方法中至少一种:In one embodiment, the acquiring the target area in the to-be-processed image performed by the processor includes at least one of the following methods:

检测所述待处理图像中的人脸区域,将所述人脸区域作为目标区域;Detecting the face area in the to-be-processed image, and using the face area as a target area;

检测所述待处理图像中的人脸区域,并根据所述人脸区域获取人像区域,将所述人像区域作为目标区域。A face area in the to-be-processed image is detected, a portrait area is acquired according to the face area, and the portrait area is used as a target area.

在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:

根据所述待处理图像获取对应的人物属性特征;Obtaining the corresponding character attribute feature according to the to-be-processed image;

所述根据所述亮度值获取各个通道图像对应的美颜参数包括:The acquiring the beauty parameters corresponding to each channel image according to the brightness value includes:

根据所述人物属性特征和亮度值,获取所述各个通道图像对应的美颜参数。According to the character attribute feature and the brightness value, the beauty parameters corresponding to the respective channel images are acquired.

在一个实施例中,所述处理器执行的所述根据所述待处理图像获取对应的人物属性特征包括:In one embodiment, the acquiring the corresponding person attribute feature according to the to-be-processed image performed by the processor includes:

获取所述待处理图像中的人脸区域,通过特征识别模型获取所述人脸区域对应的人物属性特征,其中所述特征识别模型是通过人脸样本集合训练得到的。The face region in the image to be processed is acquired, and the character attribute feature corresponding to the face region is acquired through a feature recognition model, wherein the feature recognition model is obtained by training a set of face samples.

在一个实施例中,所述处理器执行的所述根据所述人物属性特征和亮度值,获取所述各个通道图像对应的美颜参数包括:In one embodiment, the acquiring, according to the character attribute feature and the brightness value, performed by the processor to obtain the beauty parameters corresponding to the respective channel images includes:

根据所述人物属性特征获取所述待处理图像对应的美颜类别参数,所述美颜类别参数是表示美颜处理类别的参数;Obtaining a beauty category parameter corresponding to the to-be-processed image according to the character attribute feature, where the beauty category parameter is a parameter representing a beauty treatment category;

根据所述亮度值获取所述各个通道图像对应的美颜程度参数,所述美颜程度参数是表示美颜处理程度的参数。The beauty level parameter corresponding to each channel image is acquired according to the brightness value, and the beauty level parameter is a parameter representing the level of beauty processing.

在一个实施例中,所述处理器执行的所述根据所述美颜参数对所述各个通道图像分别进行美颜处理包括:In one embodiment, the performing the beautifying processing on the respective channel images according to the beautifying parameters performed by the processor includes:

根据所述美颜类别参数和美颜程度参数对所述各个通道图像分别进行美颜处理。According to the beauty category parameter and the beauty level parameter, beautification processing is performed on the respective channel images.

本申请实施例还提供一种电子设备。上述电子设备中包括图像处理电路,图像处理电路可以利用硬件和/或软件组件实现,可包括定义ISP(Image Signal Processing,图像信号处理)管线的各种处理单元。图9为一个实施例中图像处理电路的示意图。如图9所示,为便于说明,仅示出与本申请实施例相关的图像处理技术的各个方面。The embodiments of the present application also provide an electronic device. The above electronic device includes an image processing circuit, and the image processing circuit may be implemented by hardware and/or software components, and may include various processing units that define an ISP (Image Signal Processing, image signal processing) pipeline. FIG. 9 is a schematic diagram of an image processing circuit in one embodiment. As shown in FIG. 9 , for the convenience of description, only various aspects of the image processing technology related to the embodiments of the present application are shown.

如图9所示,图像处理电路包括ISP处理器940和控制逻辑器950。成像设备910捕捉的图像数据首先由ISP处理器940处理,ISP处理器940对图像数据进行分析以捕捉可用于确定和/或成像设备910的一个或多个控制参数的图像统计信息。成像设备910可包括具有一个或多个透镜912和图像传感器914的照相机。图像传感器914可包括色彩滤镜阵列(如Bayer滤镜),图像传感器914可获取用图像传感器914的每个成像像素捕捉的光强度和波长信息,并提供可由ISP处理器940处理的一组原始图像数据。传感器920(如陀螺仪)可基于传感器920接口类型把采集的图像处理的参数(如防抖参数)提供给ISP处理器940。传感器920接口可以利用SMIA(Standard Mobile Imaging Architecture,标准移动成像架构)接口、其它串行或并行照相机接口或上述接口的组合。As shown in FIG. 9 , the image processing circuit includes an ISP processor 940 and a control logic 950 . Image data captured by imaging device 910 is first processed by ISP processor 940 , which analyzes the image data to capture image statistics that can be used to determine and/or control one or more parameters of imaging device 910 . Imaging device 910 may include a camera having one or more lenses 912 and an image sensor 914 . Image sensor 914 may include an array of color filters (eg, Bayer filters), image sensor 914 may obtain light intensity and wavelength information captured with each imaging pixel of image sensor 914 and provide a set of raw materials that may be processed by ISP processor 940. image data. The sensor 920 (eg, a gyroscope) may provide the acquired image processing parameters (eg, anti-shake parameters) to the ISP processor 940 based on the sensor 920 interface type. The sensor 920 interface may utilize a SMIA (Standard Mobile Imaging Architecture) interface, other serial or parallel camera interfaces, or a combination of the above interfaces.

此外,图像传感器914也可将原始图像数据发送给传感器920,传感器920 可基于传感器920接口类型把原始图像数据提供给ISP处理器940,或者传感器 920将原始图像数据存储到图像存储器930中。Additionally, image sensor 914 may also send raw image data to sensor 920, which may provide raw image data to ISP processor 940 based on sensor 920 interface type, or sensor 920 may store raw image data in image memory 930.

ISP处理器940按多种格式逐个像素地处理原始图像数据。例如,每个图像像素可具有8、10、12或14比特的位深度,ISP处理器940可对原始图像数据进行一个或多个图像处理操作、收集关于图像数据的统计信息。其中,图像处理操作可按相同或不同的位深度精度进行。The ISP processor 940 processes raw image data pixel by pixel in various formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits, and the ISP processor 940 may perform one or more image processing operations on the raw image data, collecting statistical information about the image data. Among them, the image processing operations can be performed with the same or different bit depth precision.

ISP处理器940还可从图像存储器930接收图像数据。例如,传感器920接口将原始图像数据发送给图像存储器930,图像存储器930中的原始图像数据再提供给ISP处理器940以供处理。图像存储器930可为存储器装置的一部分、存储设备、或电子设备内的独立的专用存储器,并可包括DMA(Direct Memory Access,直接存储器存取)特征。ISP processor 940 may also receive image data from image memory 930 . For example, the sensor 920 interface sends the raw image data to the image memory 930, and the raw image data in the image memory 930 is provided to the ISP processor 940 for processing. The image memory 930 may be a part of a memory device, a storage device, or an independent dedicated memory within an electronic device, and may include a DMA (Direct Memory Access, direct memory access) feature.

当接收到来自图像传感器914接口或来自传感器920接口或来自图像存储器930的原始图像数据时,ISP处理器940可进行一个或多个图像处理操作,如时域滤波。处理后的图像数据可发送给图像存储器930,以便在被显示之前进行另外的处理。ISP处理器940还可从图像存储器930接收处理数据,对所述处理数据进行原始域中以及RGB和YCbCr颜色空间中的图像数据处理。处理后的图像数据可输出给显示器980,以供用户观看和/或由图形引擎或GPU(Graphics Processing Unit,图形处理器)进一步处理。此外,ISP处理器940的输出还可发送给图像存储器930,且显示器980可从图像存储器930读取图像数据。在一个实施例中,图像存储器930可被配置为实现一个或多个帧缓冲器。此外,ISP 处理器940的输出可发送给编码器/解码器970,以便编码/解码图像数据。编码的图像数据可被保存,并在显示于显示器980设备上之前解压缩。When receiving raw image data from the image sensor 914 interface or from the sensor 920 interface or from the image memory 930, the ISP processor 940 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to image memory 930 for additional processing before being displayed. The ISP processor 940 may also receive processed data from the image memory 930 on which to perform image data processing in the original domain and in the RGB and YCbCr color spaces. The processed image data may be output to the display 980 for viewing by a user and/or further processed by a graphics engine or a GPU (Graphics Processing Unit, graphics processor). In addition, the output of the ISP processor 940 may also be sent to the image memory 930 , and the display 980 may read image data from the image memory 930 . In one embodiment, image memory 930 may be configured to implement one or more frame buffers. Additionally, the output of ISP processor 940 may be sent to encoder/decoder 970 for encoding/decoding image data. The encoded image data can be saved and decompressed prior to display on the display 980 device.

ISP处理器940处理图像数据的步骤包括:对图像数据进行VFE(Video Front End,视频前端)处理和CPP(Camera Post Processing,摄像头后处理)处理。对图像数据的VFE处理可包括修正图像数据的对比度或亮度值、修改以数字方式记录的光照状态数据、对图像数据进行补偿处理(如白平衡,自动增益控制,γ校正等)、对图像数据进行滤波处理等。对图像数据的CPP处理可包括对图像进行缩放、向每个路径提供预览帧和记录帧。其中,CPP可使用不同的编解码器来处理预览帧和记录帧。ISP处理器940处理后的图像数据可发送给美颜模块 960,以便在被显示之前对图像进行美颜处理。美颜模块960对图像数据美颜处理可包括:美白、祛斑、磨皮、瘦脸、祛痘、增大眼睛等。其中,美颜模块960 可为移动终端中CPU(Central Processing Unit,中央处理器)、GPU或协处理器等。美颜模块960处理后的数据可发送给编码器/解码器970,以便编码/解码图像数据。编码的图像数据可被保存,并在显示于显示器980设备上之前解压缩。其中,美颜模块960还可位于编码器/解码器970与显示器980之间,即美颜模块对已成像的图像进行美颜处理。上述编码器/解码器970可为移动终端中CPU、 GPU或协处理器等。The step of processing the image data by the ISP processor 940 includes: performing VFE (Video Front End, video front-end) processing and CPP (Camera Post Processing, camera post-processing) processing on the image data. VFE processing of image data may include correction of contrast or brightness values of image data, modification of digitally recorded lighting state data, compensation processing of image data (such as white balance, automatic gain control, gamma correction, etc.), image data filter processing, etc. CPP processing of image data may include scaling the image, providing preview frames and recording frames to each path. Among them, CPP can use different codecs to process preview frames and record frames. The image data processed by the ISP processor 940 may be sent to the beauty module 960 to perform beauty processing on the image before being displayed. The beauty processing of the image data by the beauty module 960 may include: whitening, freckle removal, skin resurfacing, face reduction, acne removal, eye enlargement, and the like. The beauty module 960 may be a CPU (Central Processing Unit, central processing unit), a GPU, a co-processor, or the like in the mobile terminal. The data processed by the beauty module 960 may be sent to the encoder/decoder 970 for encoding/decoding the image data. The encoded image data can be saved and decompressed prior to display on the display 980 device. The beauty module 960 may also be located between the encoder/decoder 970 and the display 980, that is, the beauty module performs beauty processing on the imaged image. The aforementioned encoder/decoder 970 may be a CPU, a GPU, or a co-processor in the mobile terminal, or the like.

ISP处理器940确定的统计数据可发送给控制逻辑器950单元。例如,统计数据可包括自动曝光、自动白平衡、自动聚焦、闪烁检测、黑电平补偿、透镜 912阴影校正等图像传感器914统计信息。控制逻辑器950可包括执行一个或多个例程(如固件)的处理器和/或微控制器,一个或多个例程可根据接收的统计数据,确定成像设备910的控制参数以及ISP处理器940的控制参数。例如,成像设备910的控制参数可包括传感器920控制参数(例如增益、曝光控制的积分时间)、照相机闪光控制参数、透镜912控制参数(例如聚焦或变焦用焦距)、或这些参数的组合。ISP控制参数可包括用于自动白平衡和颜色调整(例如,在RGB 处理期间)的增益水平和色彩校正矩阵,以及透镜912阴影校正参数。Statistics determined by the ISP processor 940 may be sent to the control logic 950 unit. For example, the statistics may include image sensor 914 statistics such as auto exposure, auto white balance, auto focus, flicker detection, black level compensation, lens 912 shading correction, and the like. Control logic 950 may include a processor and/or microcontroller executing one or more routines (eg, firmware) that may determine control parameters of imaging device 910 and ISP processing based on received statistics control parameters of the controller 940. For example, imaging device 910 control parameters may include sensor 920 control parameters (eg, gain, integration time for exposure control), camera flash control parameters, lens 912 control parameters (eg, focal length for focus or zoom), or a combination of these parameters. ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (eg, during RGB processing), and lens 912 shading correction parameters.

运用图9中图像处理技术可实现上述实施例提供的图像处理方法。The image processing method provided by the above embodiment can be implemented by using the image processing technology in FIG. 9 .

一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例提供的图像处理方法。A computer program product containing instructions, when run on a computer, causes the computer to execute the image processing method provided by the above embodiments.

本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM) 或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态 RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database, or other medium as used herein may include non-volatile and/or volatile memory. Suitable nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be noted that, for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (10)

1.一种图像处理方法,其特征在于,所述方法包括:1. an image processing method, is characterized in that, described method comprises: 接收用户输入的美颜指令获取待处理图像;Receive the beauty instruction input by the user to obtain the image to be processed; 获取待处理图像的各个通道图像,遍历所述各个通道图像中的每个像素点,将所述各个通道图像中所有像素点通道值的平均值作为所述各个通道图像对应的亮度值,并根据所述各个通道图像对应亮度值与所述各个通道图像的亮度参考值之间的差值,获取所述各个通道图像对应的美颜参数;其中,不同的差值对应不同的美颜参数;Obtain each channel image of the image to be processed, traverse each pixel point in the each channel image, take the average value of the channel values of all pixel points in the each channel image as the brightness value corresponding to the each channel image, and according to The difference between the brightness value corresponding to each channel image and the brightness reference value of each channel image is obtained, and the beauty parameter corresponding to each channel image is obtained; wherein, different difference values correspond to different beauty parameters; 根据所述美颜参数对所述各个通道图像分别进行美颜处理;Performing beautification processing on the respective channel images according to the beautifying parameters; 将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image of each channel after the beauty treatment is fused to obtain a beauty image. 2.根据所述权利要求1所述的图像处理方法,其特征在于,所述获取待处理图像的各个通道图像,遍历所述各个通道图像中的每个像素点,将所述各个通道图像中所有像素点通道值的平均值作为所述各个通道图像对应的亮度值,并根据各所述亮度值与亮度参考值的差值获取各个通道图像对应的美颜参数包括:2 . The image processing method according to claim 1 , wherein the acquiring each channel image of the to-be-processed image, traverses each pixel in the each channel image, and converts the The average value of the channel values of all pixel points is taken as the brightness value corresponding to each channel image, and the beauty parameters corresponding to each channel image are obtained according to the difference between each of the brightness values and the brightness reference value, including: 获取所述待处理图像中的目标区域;obtaining the target area in the to-be-processed image; 遍历所述目标区域的各个通道图像中的每个像素点,将所述目标区域的各个通道图像中所有像素点通道值的平均值作为所述目标区域的各个通道图像对应的亮度值,并根据各所述亮度值与亮度参考值的差值获取各个通道图像对应的美颜参数。Traverse each pixel point in each channel image of the target area, take the average value of all pixel point channel values in each channel image of the target area as the brightness value corresponding to each channel image of the target area, and according to The difference between each of the luminance values and the luminance reference value obtains the beauty parameters corresponding to each channel image. 3.根据所述权利要求2所述的图像处理方法,其特征在于,所述获取所述待处理图像中的目标区域包括以下方法中至少一种:3. The image processing method according to claim 2, wherein the acquiring the target area in the to-be-processed image comprises at least one of the following methods: 检测所述待处理图像中的人脸区域,将所述人脸区域作为目标区域;Detecting the face area in the to-be-processed image, and using the face area as a target area; 检测所述待处理图像中的人脸区域,并根据所述人脸区域获取人像区域,将所述人像区域作为目标区域。A face area in the to-be-processed image is detected, a portrait area is acquired according to the face area, and the portrait area is used as a target area. 4.根据所述权利要求1至3任一项所述的图像处理方法,其特征在于,所述方法还包括:4. The image processing method according to any one of claims 1 to 3, wherein the method further comprises: 根据所述待处理图像获取对应的人物属性特征;Obtaining the corresponding character attribute feature according to the to-be-processed image; 所述根据各所述亮度值与亮度参考值的差值获取各个通道图像对应的美颜参数包括:The obtaining the beauty parameters corresponding to each channel image according to the difference between each of the luminance values and the luminance reference value includes: 根据所述人物属性特征和各所述亮度值与亮度参考值的差值,获取所述各个通道图像对应的美颜参数。The beauty parameters corresponding to each channel image are acquired according to the character attribute feature and the difference between each of the luminance values and the luminance reference value. 5.根据所述权利要求4所述的图像处理方法,其特征在于,所述根据所述待处理图像获取对应的人物属性特征包括:5 . The image processing method according to claim 4 , wherein the obtaining the corresponding character attributes according to the to-be-processed image comprises: 5 . 获取所述待处理图像中的人脸区域,通过特征识别模型获取所述人脸区域对应的人物属性特征,其中所述特征识别模型是通过人脸样本集合训练得到的。The face region in the image to be processed is acquired, and the character attribute feature corresponding to the face region is acquired through a feature recognition model, wherein the feature recognition model is obtained by training a set of face samples. 6.根据所述权利要求4所述的图像处理方法,其特征在于,所述根据所述人物属性特征和各所述亮度值与亮度参考值的差值,获取所述各个通道图像对应的美颜参数包括:6 . The image processing method according to claim 4 , wherein the image processing method corresponding to each channel image is obtained according to the character attribute feature and the difference between each of the luminance values and the luminance reference value. 7 . Color parameters include: 根据所述人物属性特征获取所述待处理图像对应的美颜类别参数,所述美颜类别参数是表示美颜处理类别的参数;Obtaining a beauty category parameter corresponding to the to-be-processed image according to the character attribute feature, where the beauty category parameter is a parameter representing a beauty treatment category; 根据各所述亮度值与亮度参考值的差值获取所述各个通道图像对应的美颜程度参数,所述美颜程度参数是表示美颜处理程度的参数。The beauty level parameter corresponding to each channel image is acquired according to the difference between each of the brightness values and the brightness reference value, where the beauty level parameter is a parameter representing the level of beauty processing. 7.根据所述权利要求6所述的图像处理方法,其特征在于,所述根据所述美颜参数对所述各个通道图像分别进行美颜处理包括:7. The image processing method according to claim 6, wherein the performing beautifying processing on the respective channel images according to the beautifying parameters comprises: 根据所述美颜类别参数和美颜程度参数对所述各个通道图像分别进行美颜处理。According to the beauty category parameter and the beauty level parameter, beautification processing is performed on the respective channel images. 8.一种图像处理装置,其特征在于,所述装置包括:8. An image processing device, wherein the device comprises: 图像获取模块,用于接收用户输入的美颜指令获取待处理图像;所述美颜指令中包含图像标识;an image acquisition module, configured to receive a beautifying instruction input by a user to acquire an image to be processed; the beautifying instruction includes an image identifier; 参数获取模块,用于获取待处理图像的各个通道图像,遍历所述各个通道图像中的每个像素点,将所述各个通道图像中所有像素点通道值的平均值作为所述各个通道图像对应的亮度值,并根据所述各个通道图像对应亮度值与所述各个通道图像的亮度参考值之间的差值,获取所述各个通道图像对应的美颜参数;其中,不同的差值对应不同的美颜参数;The parameter acquisition module is used to acquire each channel image of the image to be processed, traverse each pixel point in the each channel image, and take the average value of the channel values of all pixel points in the each channel image as the corresponding channel image and according to the difference between the corresponding brightness value of each channel image and the brightness reference value of each channel image, the beauty parameters corresponding to each channel image are obtained; wherein, different difference values correspond to different beauty parameters; 美颜处理模块,用于根据所述美颜参数对所述各个通道图像分别进行美颜处理;A beauty processing module, configured to perform beauty processing on the respective channel images according to the beauty parameters; 图像融合模块,用于将所述美颜处理后的各个通道图像进行融合,得到美颜图像。The image fusion module is used for fusing each channel image after the beauty treatment to obtain a beauty image. 9.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述的图像处理方法。9 . A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the image processing method according to any one of claims 1 to 7 is implemented. 10.一种电子设备,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时,使得所述处理器执行如权利要求1至7中任一项所述的图像处理方法。10. An electronic device comprising a memory and a processor, wherein computer-readable instructions are stored in the memory, and when the instructions are executed by the processor, the processor is made to execute any one of claims 1 to 7 The image processing method described in item.
CN201711054076.2A 2017-10-31 2017-10-31 Image processing method, apparatus, computer-readable storage medium and electronic device Active CN107862658B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711054076.2A CN107862658B (en) 2017-10-31 2017-10-31 Image processing method, apparatus, computer-readable storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711054076.2A CN107862658B (en) 2017-10-31 2017-10-31 Image processing method, apparatus, computer-readable storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN107862658A CN107862658A (en) 2018-03-30
CN107862658B true CN107862658B (en) 2020-09-22

Family

ID=61696508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711054076.2A Active CN107862658B (en) 2017-10-31 2017-10-31 Image processing method, apparatus, computer-readable storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN107862658B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108769520B (en) * 2018-05-31 2021-04-13 康键信息技术(深圳)有限公司 Electronic device, image processing method, and computer-readable storage medium
CN108961157B (en) * 2018-06-19 2021-06-01 Oppo广东移动通信有限公司 Image processing method, image processing device and terminal device
CN108898169B (en) * 2018-06-19 2021-06-01 Oppo广东移动通信有限公司 Picture processing method, picture processing device and terminal equipment
CN109144369B (en) * 2018-09-21 2020-10-20 维沃移动通信有限公司 Image processing method and terminal equipment
CN109345603B (en) * 2018-09-29 2021-08-31 Oppo广东移动通信有限公司 Image processing method and apparatus, electronic device, computer-readable storage medium
CN109360254B (en) * 2018-10-15 2023-04-18 Oppo广东移动通信有限公司 Image processing method and device, electronic equipment and computer readable storage medium
CN112446832A (en) * 2019-08-31 2021-03-05 华为技术有限公司 Image processing method and electronic equipment
CN113763284B (en) * 2021-09-27 2024-07-16 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016102753A (en) * 2014-11-28 2016-06-02 大日本印刷株式会社 Portable terminal equipment, color determination program for skin, and color determination method for skin
CN106530252A (en) * 2016-11-08 2017-03-22 北京小米移动软件有限公司 Image processing method and device
CN106611402A (en) * 2015-10-23 2017-05-03 腾讯科技(深圳)有限公司 Image processing method and device
CN107274354A (en) * 2017-05-22 2017-10-20 奇酷互联网络科技(深圳)有限公司 image processing method, device and mobile terminal

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105654435B (en) * 2015-12-25 2018-09-11 武汉鸿瑞达信息技术有限公司 A kind of face skin softening method for whitening
CN106056552A (en) * 2016-05-31 2016-10-26 努比亚技术有限公司 Image processing method and mobile terminal
CN106447606A (en) * 2016-10-31 2017-02-22 南京维睛视空信息科技有限公司 Rapid real-time video beautifying method
CN107180415B (en) * 2017-03-30 2020-08-14 北京奇艺世纪科技有限公司 Skin beautifying processing method and device in image
CN107301626B (en) * 2017-06-22 2020-11-06 成都品果科技有限公司 Buffing algorithm suitable for shooting images by mobile equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016102753A (en) * 2014-11-28 2016-06-02 大日本印刷株式会社 Portable terminal equipment, color determination program for skin, and color determination method for skin
CN106611402A (en) * 2015-10-23 2017-05-03 腾讯科技(深圳)有限公司 Image processing method and device
CN106530252A (en) * 2016-11-08 2017-03-22 北京小米移动软件有限公司 Image processing method and device
CN107274354A (en) * 2017-05-22 2017-10-20 奇酷互联网络科技(深圳)有限公司 image processing method, device and mobile terminal

Also Published As

Publication number Publication date
CN107862658A (en) 2018-03-30

Similar Documents

Publication Publication Date Title
CN107862658B (en) Image processing method, apparatus, computer-readable storage medium and electronic device
EP3477931B1 (en) Image processing method and device, readable storage medium and electronic device
CN107818305B (en) Image processing method, apparatus, electronic device, and computer-readable storage medium
CN110473185B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN107730444B (en) Image processing method, image processing device, readable storage medium and computer equipment
CN107742274A (en) Image processing method, device, computer-readable storage medium, and electronic device
CN107886484B (en) Beautifying method, beautifying device, computer-readable storage medium and electronic equipment
CN107993209B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN107800965B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN108717530B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN107862663A (en) Image processing method, device, readable storage medium and computer equipment
CN107705248A (en) Image processing method, device, electronic device, and computer-readable storage medium
CN107945107A (en) Image processing method, device, computer-readable storage medium, and electronic device
CN107833197A (en) Method, apparatus, computer-readable recording medium and the electronic equipment of image procossing
CN109712177B (en) Image processing method, apparatus, electronic device, and computer-readable storage medium
CN107862274A (en) Beautifying method, device, electronic device and computer-readable storage medium
CN107911625A (en) Light measuring method, light measuring device, readable storage medium and computer equipment
CN107578372B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN109242794B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN107743200A (en) Method, device, computer-readable storage medium and electronic device for taking pictures
CN108111768B (en) Method, apparatus, electronic device, and computer-readable storage medium for controlling focus
CN107862653A (en) Method for displaying image, device, storage medium and electronic equipment
CN107820017A (en) Image capturing method, device, computer-readable recording medium and electronic equipment
CN107862654A (en) Image processing method, device, computer-readable storage medium, and electronic device
CN107909542A (en) Image processing method, device, computer-readable recording medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant