CN108616700B - Image processing method and device, electronic equipment and computer readable storage medium - Google Patents

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

Info

Publication number
CN108616700B
CN108616700B CN201810487407.XA CN201810487407A CN108616700B CN 108616700 B CN108616700 B CN 108616700B CN 201810487407 A CN201810487407 A CN 201810487407A CN 108616700 B CN108616700 B CN 108616700B
Authority
CN
China
Prior art keywords
light effect
image
pixel
processed
light
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.)
Expired - Fee Related
Application number
CN201810487407.XA
Other languages
Chinese (zh)
Other versions
CN108616700A (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 CN201810487407.XA priority Critical patent/CN108616700B/en
Publication of CN108616700A publication Critical patent/CN108616700A/en
Application granted granted Critical
Publication of CN108616700B publication Critical patent/CN108616700B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/76Circuitry for compensating brightness variation in the scene by influencing the image signals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation

Landscapes

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

Abstract

The application relates to an image processing method and device, an electronic device and a computer readable storage medium. The method comprises the following steps: the method comprises the steps of obtaining at least two brightening central points in an image to be processed, establishing a light effect model according to the brightening central points, wherein the light effect model is a model simulating light intensity change, and performing light ray adding effect processing on the image to be processed according to the light effect model. Because a plurality of brightening central points of the image to be processed can be obtained to establish the light effect model, the light ray adding effect is carried out on the image to be processed according to the light effect model, and the light ray processing effect can be improved.

Description

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

技术领域technical field

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

背景技术Background technique

随着计算机技术的发展,图像处理方式越来越丰富,人们可以在拍摄过程中,通过移动对焦点和测光点调整被拍摄物体的光线亮度,也可以在拍摄的图像中选取提亮点进行光线效果的添加,从而凸显被拍摄物体的轮廓,达到较好的拍摄效果。With the development of computer technology, image processing methods have become more and more abundant. During the shooting process, people can adjust the light brightness of the object to be shot by moving the focus point and the metering point, and can also select the highlight point in the shot image for lighting. The effect is added, so as to highlight the outline of the object to be photographed and achieve a better shooting effect.

然而,传统的图像处理方法存在添加光线效果较差的问题。However, the traditional image processing method has the problem of poor effect of adding light.

发明内容SUMMARY OF THE INVENTION

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

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

获取待处理图像中至少两个提亮中心点;Obtain at least two brightening center points in the image to be processed;

根据所述提亮中心点建立光效模型,所述光效模型是模拟光线强弱变化的模型;A light effect model is established according to the brightening center point, and the light effect model is a model for simulating changes in light intensity;

根据所述光效模型对所述待处理图像进行添加光线效果的处理。The processing of adding a light effect is performed on the to-be-processed image according to the light effect model.

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

获取模块,用于获取待处理图像中至少两个提亮中心点;an acquisition module, used to acquire at least two highlight center points in the image to be processed;

模型建立模块,用于根据所述提亮中心点建立光效模型,所述光效模型是模拟光线强弱变化的模型;a model establishment module for establishing a light effect model according to the brightening center point, where the light effect model is a model for simulating changes in light intensity;

处理模块,用于根据所述光效模型对所述待处理图像进行添加光线效果的处理。A processing module, configured to perform processing of adding light effects to the to-be-processed image according to the light effect model.

一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如下步骤:An electronic device includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the following steps:

获取待处理图像中至少两个提亮中心点;Obtain at least two brightening center points in the image to be processed;

根据所述提亮中心点建立光效模型,所述光效模型是模拟光线强弱变化的模型;A light effect model is established according to the brightening center point, and the light effect model is a model for simulating changes in light intensity;

根据所述光效模型对所述待处理图像进行添加光线效果的处理。The processing of adding a light effect is performed on the to-be-processed image according to the light effect model.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤: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:

获取待处理图像中至少两个提亮中心点;Obtain at least two brightening center points in the image to be processed;

根据所述提亮中心点建立光效模型,所述光效模型是模拟光线强弱变化的模型;A light effect model is established according to the brightening center point, and the light effect model is a model for simulating changes in light intensity;

根据所述光效模型对所述待处理图像进行添加光线效果的处理。The processing of adding a light effect is performed on the to-be-processed image according to the light effect model.

上述图像处理方法和装置、电子设备、计算机可读存储介质,可以获取待处理图像中至少两个提亮中心点,根据提亮中心点建立光效模型,根据光效模型对待处理图像进行添加光线效果的处理,光效模型是模拟光线强度变化的模型。由于可以获取待处理图像的多个提亮中心点建立光效模型,根据光效模型对待处理图像进行添加光线效果的处理,可以提高光线处理效果。The above-mentioned image processing method and device, electronic equipment, and computer-readable storage medium can obtain at least two brightening center points in the image to be processed, establish a light effect model according to the brightening center points, and add light to the image to be processed according to the light effect model. The processing of effects, the light effect model is a model that simulates changes in light intensity. Since a plurality of brightening center points of the image to be processed can be acquired to establish a light effect model, and the processing of adding light effects to the image to be processed is performed according to the light effect model, the light processing effect can be improved.

附图说明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为一个实施例中电子设备的内部结构示意图;1 is a schematic diagram of the internal structure of an electronic device 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 flowchart of an image processing method in yet another embodiment;

图5为一个实施例中建立光效模型的流程图;5 is a flow chart of establishing a light effect model in one embodiment;

图6为一个实施例中光效模型的示意图;6 is a schematic diagram of a light effect model in one embodiment;

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

图8为一个实施例中图像处理装置的结构框图;8 is a structural block diagram of an image processing apparatus 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 client may be referred to as a second client, and similarly, a second client may be referred to as a first client, without departing from the scope of this application. Both the first client and the second client are clients, but they are not the same client.

图1为一个实施例中电子设备的内部结构示意图。如图1所示,该电子设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该处理器用于提供计算和控制能力,支撑整个电子设备的运行。存储器用于存储数据、程序等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于电子设备的无线网络通信方法。存储器可包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统和计算机程序。该计算机程序可被处理器所执行,以用于实现以下各个实施例所提供的一种图像处理方法。内存储器为非易失性存储介质中的操作系统计算机程序提供高速缓存的运行环境。网络接口可以是以太网卡或无线网卡等,用于与外部的电子设备进行通信。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。FIG. 1 is a schematic diagram of the internal structure of an electronic device in one embodiment. As shown in FIG. 1, the electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory is used to store data, programs, etc., and at least one computer program is stored in the memory, and the computer program can be executed by the processor to implement the wireless network communication method applicable to the electronic device provided in the embodiments of the present application. The memory may include non-volatile storage media and internal memory. The nonvolatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement an image processing method provided by the following embodiments. Internal memory provides a cached execution environment for operating system computer programs in non-volatile storage media. The network interface can be an Ethernet card or a wireless network card, etc., and is used to communicate with external electronic devices. The electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device, and the like.

图2为一个实施例中图像处理方法的流程图。本实施例中图像处理方法,以运行于图1中电子设备为例进行描述。如图2所示,图像处理方法包括步骤202至步骤206。FIG. 2 is a flowchart of an image processing method in one embodiment. The image processing method in this embodiment is described by taking the electronic device running in FIG. 1 as an example. As shown in FIG. 2 , the image processing method includes steps 202 to 206 .

步骤202,获取待处理图像中至少两个提亮中心点。Step 202: Acquire at least two highlight center points in the image to be processed.

待处理图像是由多个像素点组成的需要进行添加光线效果处理的图像。待处理图像可以是电子设备通过摄像头实时采集的图像,也可以是存储在电子设备本地的图像,或者是电子设备从网络下载的图像。光线效果可以是自然光、舞台光、胶片光、轮廓光等效果。光源发出光之后,光线会以光源为中心向四周进行扩散,并且光线的强度会随着与光源距离的增大而减弱。提亮中心点即为光源中心对应的像素点。提亮中心点的个数可以为2个、3个、4个、5个等不限于此。The image to be processed is an image composed of multiple pixels and needs to be processed by adding light effects. The image to be processed may be an image collected by the electronic device in real time through a camera, or may be an image stored locally on the electronic device, or an image downloaded by the electronic device from a network. Lighting effects can be natural light, stage light, film light, contour light, etc. After the light source emits light, the light will spread around the light source, and the intensity of the light will decrease as the distance from the light source increases. The highlight center point is the pixel point corresponding to the center of the light source. The number of highlighting center points may be 2, 3, 4, 5, etc., but is not limited to this.

电子设备可以获取待处理图像,并将待处理图像进行显示。电子设备可以对待处理图像进行识别,根据待处理图像的被拍摄物体确定至少两个提亮中心点,也可以获取由用户根据显示的待处理图像选择的至少两个提亮中心点。The electronic device can acquire the to-be-processed image and display the to-be-processed image. The electronic device may identify the image to be processed, determine at least two highlight center points according to the object in the image to be processed, or obtain at least two highlight center points selected by the user according to the displayed image to be processed.

步骤204,根据提亮中心点建立光效模型,光效模型是模拟光线强弱变化的模型。Step 204 , establishing a light effect model according to the brightening center point, where the light effect model is a model for simulating changes in light intensity.

光效模型是指对待处理图像进行添加光线效果处理的模型,光效模型可以模拟光源发出的光线强弱变化的曲线。根据提亮中心点建立光效模型,即将提亮中心点作为光源从而模拟各个像素点所在位置的光线强弱变化的模型。电子设备根据光效模型对待处理图像进行添加光线效果的处理,可包括对待处理图像进行增亮处理、改变待处理图像的颜色等。电子设备中可以预先存储光效参考模型,该光效参考模型可以是以图像中任意一个参考像素点为光源的模型。在获取到提亮中心点后,可以获取提亮中心点相对参考像素点的位移,并将光效参考模型进行位移之后得到该提亮中心点对应的光效模型。The light effect model refers to the model that adds light effects to the image to be processed. The light effect model can simulate the curve of the intensity change of the light emitted by the light source. A light effect model is established based on the brightening center point, that is, a model in which the brightening center point is used as a light source to simulate the change of light intensity at the location of each pixel point. The electronic device performs processing of adding light effects to the image to be processed according to the light effect model, which may include performing brightening processing on the image to be processed, changing the color of the image to be processed, and the like. The light effect reference model may be pre-stored in the electronic device, and the light effect reference model may be a model in which any reference pixel in the image is the light source. After the highlighting center point is obtained, the displacement of the highlighting center point relative to the reference pixel point can be obtained, and the light effect model corresponding to the highlighting center point can be obtained after displacing the light effect reference model.

例如,电子设备中可以预先存储一个光效参考模型为P(x,y),该光效参考模型以坐标为(0,0)的参考像素点为光源的模型。假设选取的提亮中心点为(x0,y0)的话,那么该提亮中心点相对于参考像素点的位移就为(-x0,-y0),则根据该位移得到的该提亮中心点对应的光效模型就为P(x-x0,y-y0)。得到的光效模型P(x-x0,y-y0)中,就是以提亮中心点(x0,y0)为光源的光效模型。For example, a light effect reference model may be pre-stored in the electronic device as P(x, y), and the light effect reference model takes the reference pixel point whose coordinates are (0, 0) as the model of the light source. Assuming that the selected highlighting center point is (x 0 , y 0 ), then the displacement of the highlighting center point relative to the reference pixel point is (-x 0 , -y 0 ), then the improvement obtained according to the displacement The light effect model corresponding to the bright center point is P(xx 0 , yy 0 ). In the obtained light effect model P(xx 0 , yy 0 ), it is the light effect model with the brightening center point (x 0 , y 0 ) as the light source.

电子设备可以获取待处理图像的环境参数,根据环境参数确定光效模型中的光线效果参数。可选地,光线效果参数可包括色彩调节参数及亮度增强系数等。色彩调节参数可用于调节添加的光线效果的颜色,色彩调节参数可包括色彩转换矩阵、色彩饱和度等,其中,色彩转换矩阵可用于调整像素点的色彩值,饱和度则指的是色彩的鲜艳程度。色彩饱和度可用于调整像素点的色彩饱和度,亮度增强系数可用于调节添加的光线效果的强度。The electronic device can acquire the environmental parameters of the image to be processed, and determine the light effect parameters in the light effect model according to the environmental parameters. Optionally, the light effect parameters may include color adjustment parameters, brightness enhancement coefficients, and the like. The color adjustment parameters can be used to adjust the color of the added light effect. The color adjustment parameters can include color conversion matrix, color saturation, etc., where the color conversion matrix can be used to adjust the color value of the pixel, and the saturation refers to the vividness of the color. degree. The color saturation can be used to adjust the color saturation of the pixels, and the brightness enhancement factor can be used to adjust the intensity of the added light effect.

在一个实施例中,电子设备可根据采集的色温确定光效模型中的色彩调节参数。可选地,电子设备可预先设置不同的色温对应的色彩调节参数,采集待处理图像的色温后,可直接获取与采集的色温对应的色彩调节参数。色彩调节参数可改变在待处理图像中添加的光线效果的色调及色彩饱和度。电子设备可根据色温选取添加的光线效果类型,光线效果类型可包括夕阳光效果、阴天效果、舞台光效果等,但不限于此。不同光线效果类型中可设置有不同的色彩调节参数,比如,夕阳光效果可设置暖色调的色彩调节参数,增加待处理图像中像素点在R、G通道的值,使待处理图像添加的光线效果偏黄、偏红,阴天效果可设置冷色调的色彩调节参数,增加待处理图像中像素点在B通道的值,使待处理图像添加的光线效果偏蓝、偏灰等,但不限于此。In one embodiment, the electronic device may determine color adjustment parameters in the light effect model according to the collected color temperature. Optionally, the electronic device may preset color adjustment parameters corresponding to different color temperatures, and after collecting the color temperature of the image to be processed, may directly obtain the color adjustment parameters corresponding to the collected color temperature. Color adjustment parameters change the hue and color saturation of the light effect added to the image being processed. The electronic device may select the added light effect type according to the color temperature, and the light effect type may include a sunset light effect, a cloudy sky effect, a stage light effect, etc., but is not limited thereto. Different color adjustment parameters can be set in different light effect types. For example, the sunset light effect can set the color adjustment parameters of warm tones, and increase the value of the pixels in the R and G channels in the image to be processed, so that the light added to the image to be processed can be adjusted. The effect is yellowish, reddish, and cloudy. You can set the color adjustment parameters of the cool tone, increase the value of the pixel in the B channel of the image to be processed, and make the light effect added to the image to be processed bluish, gray, etc., but not limited to this.

电子设备可以根据获取的至少两个提亮中心点构建对应的光效模型,光效模型的数量与提亮中心点的数量一一对应。The electronic device may construct a corresponding light effect model according to the acquired at least two brightening center points, and the number of the light effect models corresponds to the number of the brightening center points one-to-one.

步骤206,根据光效模型对待处理图像进行添加光线效果的处理。Step 206 , adding light effects to the image to be processed according to the light effect model.

电子设备根据光效模型对待处理图像进行添加光线效果的处理,可以调整待处理图像中像素点的色彩值,也可以对待处理图像进行增亮处理等。具体地,电子设备可以根据光效模型获取待处理图像中各个像素点对应的像素增强系数,根据像素增强系数对像素点进行添加光线效果的处理。像素点的像素增强系数可以是与像素点最接近的提亮中心点建立的光效模型中像素点对应的像素增强系数,也可以是图像中至少两个光效模型中像素点对应的至少两个像素增强系数的加权叠加。电子设备可以通过像素增强系数对待处理图像进行叠加或乘积的方式进行对待处理图像添加光线效果的处理。The electronic device performs processing of adding light effects to the image to be processed according to the light effect model, and can adjust the color values of the pixels in the image to be processed, and can also perform brightening processing on the image to be processed. Specifically, the electronic device may acquire pixel enhancement coefficients corresponding to each pixel in the image to be processed according to the light effect model, and perform processing of adding light effects to the pixel points according to the pixel enhancement coefficient. The pixel enhancement coefficient of a pixel point may be the pixel enhancement coefficient corresponding to the pixel point in the light effect model established by the brightening center point closest to the pixel point, or it may be at least two corresponding to the pixel point in at least two light effect models in the image. Weighted superposition of pixel enhancement coefficients. The electronic device may perform the processing of adding light effects to the image to be processed by superimposing or multiplying the pixel enhancement coefficients on the image to be processed.

例如,假设待处理图像为H0(x,y),光效模型为P(x,y),则通过叠加方式进行添加光线效果的处理之后的待处理图像H(x,y)就可以表示为H(x,y)=(1+P(x,y))H0(x,y),通过乘积的方式进行添加光线效果处理后的待处理图像就可以表示为H(x,y)=P(x,y)H0(x,y)。可以理解的是,添加光线效果的处理还可以是以其他方式实现的,在此不做限定。For example, assuming that the image to be processed is H 0 (x, y) and the light effect model is P(x, y), the image to be processed H(x, y) after the processing of adding light effects by superposition can be expressed as It is H(x,y)=(1+P(x,y))H 0 (x,y), and the image to be processed after adding light effect processing by product can be expressed as H(x,y) =P(x,y)H 0 (x,y). It can be understood that the processing of adding light effects can also be implemented in other ways, which are not limited here.

本申请实施例提供的图像处理方法,可以获取待处理图像中至少两个提亮中心点,根据提亮中心点建立模拟光线强度变化的光效模型,根据所述光效模型对所述待处理图像进行添加光线效果的处理。可以获取待处理图像的至少两个提亮中心点建立对应的至少两个光效模型,根据建立至少两个光效模型对待处理图像进行添加光线效果的处理,可以提高添加光线的效果。The image processing method provided by the embodiment of the present application can obtain at least two brightening center points in the image to be processed, establish a light effect model simulating light intensity changes according to the brightening center points, The image is processed to add light effects. At least two brightening center points of the to-be-processed image can be acquired to establish at least two corresponding light effect models, and the light-added effect can be improved by performing the processing of adding light effects to the to-be-processed image according to the establishment of the at least two light effect models.

如图3所示,在一个实施例中,提供的一种图像处理方法还包括步骤302至步骤306。其中:As shown in FIG. 3 , in one embodiment, the provided image processing method further includes steps 302 to 306 . in:

步骤302,获取待处理图像的目标区域,目标区域为被拍摄物体的区域。Step 302: Obtain a target area of the image to be processed, where the target area is the area of the object to be photographed.

电子设备可以识别待处理图像中被拍摄物体区域。具体地,电子设备可以获取待处理图像的对焦点位置确定被拍摄物体的区域,还可以采用图像特征提取方法确定被拍摄物体的区域。具体地,待处理图像的图像特征包括颜色特征、纹理特征、形状特征、空间关系特征等,图像特征提取方法可以是直方图法、几何参数法、边界特征法等不限于此。目标区域中的提亮中心点可以是1个、2个、3个等不限于此。电子设备确定待处理图像中被拍摄物体的区域即目标区域后,获取目标区域中的至少一个提亮中心点。在一个实施例中,目标区域也可以是其他需要进行添加主光线效果的区域。The electronic device can identify the area of the photographed object in the image to be processed. Specifically, the electronic device may obtain the focus point position of the image to be processed to determine the area of the object to be photographed, and may also use an image feature extraction method to determine the area of the object to be photographed. Specifically, the image features of the image to be processed include color features, texture features, shape features, spatial relationship features, etc. The image feature extraction method may be a histogram method, a geometric parameter method, a boundary feature method, etc., but is not limited thereto. The number of highlight center points in the target area may be 1, 2, 3, etc., but not limited thereto. After the electronic device determines the area of the object to be photographed in the image to be processed, that is, the target area, it acquires at least one highlight center point in the target area. In one embodiment, the target area may also be another area where the main light effect needs to be added.

步骤304,对目标区域中的提亮中心点进行第一光线效果的处理。Step 304, processing the first light effect on the highlight center point in the target area.

步骤306,对目标区域外的提亮中心点进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。Step 306 , processing a second light effect on the brightening center point outside the target area, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect.

目标区域外的提亮中心点是指电子设备可以在确定目标区域后,从待处理图像中的目标区域外的其他区域获取的至少一个提亮中心点。亮度增强系数可与光效模型中的分布幅度关联,亮度增强系数越大,分布幅度可越大,添加的光线效果的强度越大;亮度增强系数越小,分布幅度可越小,添加的光线效果强度越小。The highlight center point outside the target area refers to at least one highlight center point obtained by the electronic device from other areas outside the target area in the image to be processed after determining the target area. The brightness enhancement coefficient can be related to the distribution amplitude in the light effect model. The larger the brightness enhancement coefficient is, the larger the distribution amplitude can be, and the greater the intensity of the added light effect; The less powerful the effect.

电子设备对目标区域中的提亮中心点进行第一光线效果的处理是指电子设备根据目标区域中的提亮中心点和第一光线效果的亮度增强系数确定目标区域中提亮中心点对应的光效模型,从而获取光效模型中像素点对应的像素增强系数,根据像素增强系数对目标区域中的像素点进行添加第一光线效果的处理。电子设备对目标区域外的提亮中心点进行第二光线效果的处理与对目标区域进行第一光线效果的处理方法相似,在此不再赘述。The processing by the electronic device to perform the first light effect on the highlight center point in the target area means that the electronic device determines the corresponding highlight center point in the target area according to the highlight center point in the target area and the brightness enhancement coefficient of the first light effect. The light effect model is obtained, thereby obtaining the pixel enhancement coefficient corresponding to the pixel point in the light effect model, and performing the processing of adding the first light effect to the pixel point in the target area according to the pixel enhancement coefficient. The processing method of the electronic device performing the second light effect on the brightening center point outside the target area is similar to the processing method of performing the first light effect on the target area, and details are not described herein again.

由于第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数,在电子设备完成对待处理图像的第一光线效果和第二光线效果的处理后,可以突出待处理图像中的目标区域,使被拍摄物体的轮廓更好地凸显,提高了添加光线的效果。Since the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect, after the electronic device completes the processing of the first light effect and the second light effect of the image to be processed, the target area in the image to be processed can be highlighted , so that the outline of the object to be photographed is better highlighted and the effect of adding light is improved.

如图4所示,在一个实施例中提供的一种图像处理方法还包括步骤402至步骤408。其中:As shown in FIG. 4 , an image processing method provided in an embodiment further includes steps 402 to 408 . in:

步骤402,确定所述待处理图像的人脸区域。Step 402: Determine the face region of the image to be processed.

电子设备可对待处理图像进行人脸检测,判断待处理图像中是否包含人脸,若包含,则可确定待处理图像的人脸区域。电子设备可提取待处理图像的图像特征,并通过预设的人脸检测模型对图像特征进行分析,判断待处理图像中是否包含人脸。在一个实施例中,人脸检测模型可以是预先通过机器学习构建的决策模型,构建人脸检测模型时,可获取大量的样本图像,样本图像中包含有人脸图像及无人图像,可根据每个样本图像是否包含人脸对样本图像进行标记,并将标记的样本图像作为人脸检测模型的输入,通过机器学习进行训练,得到人脸检测模型。The electronic device can perform face detection on the image to be processed, and determine whether the image to be processed contains a human face, and if so, can determine the face area of the image to be processed. The electronic device can extract image features of the image to be processed, and analyze the image features through a preset face detection model to determine whether the image to be processed contains a human face. In one embodiment, the face detection model may be a decision-making model constructed in advance through machine learning. When constructing the face detection model, a large number of sample images may be obtained. The sample images include face images and unmanned images. Whether each sample image contains a face, mark the sample image, use the marked sample image as the input of the face detection model, and train through machine learning to obtain the face detection model.

步骤404,对人脸区域中的提亮中心点进行第一光线效果的处理。Step 404, processing the first light effect on the highlight center point in the face area.

电子设备对人脸区域中的提亮中心点进行第一光线效果的处理是指电子设备获取人脸区域的提亮中心点,根据人脸区域的提亮中心点和第一光线效果的参数建立光效模型,根据光效模型获取人脸区域中像素点对应的像素增强系数,对人脸区域进行添加第一光线效果的处理。光线效果的参数包括亮度增强系数、色彩调节参数等。电子设备可以获取人脸区域的至少一个提亮中心点。具体地,提亮中心点的数量可以与人脸区域在待处理图像中的占比相关联,占比越大,人脸区域的提亮中心点的数量越多,占比越小,人脸区域的提亮中心点的数量越少。The processing of the first light effect by the electronic device on the brightening center point in the face area means that the electronic device obtains the brightening center point in the face area, and establishes the first light effect according to the brightening center point in the face area and the parameters of the first light effect. For the light effect model, the pixel enhancement coefficients corresponding to the pixels in the face area are obtained according to the light effect model, and the processing of adding the first light effect is performed on the face area. The parameters of the light effect include brightness enhancement coefficients, color adjustment parameters, and the like. The electronic device may acquire at least one highlight center point of the face area. Specifically, the number of highlighted center points can be related to the proportion of the face area in the image to be processed. The smaller the number of highlighted center points for the area.

步骤406,获取待处理图像中与人脸区域对应的人像区域。Step 406: Obtain a portrait region corresponding to the human face region in the image to be processed.

电子设备检测待处理图像中的人脸区域后,可以根据人脸区域和深度信息,获取待处理图像中的人像区域。人像与人脸通常在同一垂直平面上,人像到图像采集装置的深度信息与人脸到图像采集装置的深度信息的取值在同一范围内。因此,在获取人脸区域后,可以从电子设备获取的深度图中获取人脸区域对应的深度信息,然后根据人脸区域对应的深度信息可以获取人像区域对应的深度信息,然后根据人像区域对应的深度信息即可获取到待处理图像中的人像区域。可以理解的是,还可以通过其他方法来获取人像区域,在本实施例中不进行限定。例如还可以通过人工智能、区域生长法等方法来获取人像区域。After the electronic device detects the face area in the image to be processed, it can acquire the portrait area in the image to be processed according to the face area and depth information. The portrait and the human face are usually on the same vertical plane, and the values of 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 area, the depth information corresponding to the face area can be obtained from the depth map obtained by the electronic device, and then the depth information corresponding to the portrait area can be obtained according to the depth information corresponding to the face area, and then The depth information can be obtained to obtain the portrait area in the image to be processed. It can be understood that, other methods may also be used to obtain the portrait area, which is not limited in this embodiment. For example, the portrait region can also be obtained by methods such as artificial intelligence and region growing method.

步骤408,对人像区域进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。Step 408 , processing the portrait area with a second light effect, where the luminance enhancement coefficient of the second light effect is lower than the luminance enhancement coefficient of the first light effect.

电子设备根据待处理图像中人脸区域确定人像区域后,可以获取人像区域的至少一个提亮中心点,根据人像区域的提亮中心点和第二光线效果的参数建立光效模型,根据人像区域的光效模型获取人像区域中像素点对应的像素增强系数,对人像区域进行添加第二光线效果的处理。可选地,电子设备可以获取待处理图像中多个人脸区域和多个人像区域,对多个人脸区域进行第一光线效果的处理,对多个人像区域进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。After the electronic device determines the portrait area according to the face area in the image to be processed, it can obtain at least one brightening center point of the portrait area, and establish a light effect model according to the brightening center point of the portrait area and the parameters of the second light effect. The light effect model obtains the pixel enhancement coefficients corresponding to the pixels in the portrait area, and performs processing of adding a second light effect to the portrait area. Optionally, the electronic device may acquire multiple face areas and multiple portrait areas in the image to be processed, perform the first lighting effect processing on the multiple face areas, perform the second lighting effect processing on the multiple portrait areas, and perform the second lighting effect processing on the multiple portrait areas. The brightness enhancement coefficient of the light effect is lower than the brightness enhancement coefficient of the first light effect.

电子设备分别对人脸区域和人像区域进行第一光线效果和第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数,可以突出待处理图像中人像,使待处理图像中的人脸添加光线效果更强,从而更好突出待处理图像的人物轮廓,使添加的光线效果更好。The electronic device performs the processing of the first light effect and the second light effect on the face area and the portrait area respectively, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect, which can highlight the portrait in the image to be processed, The effect of adding light to the face in the image to be processed is stronger, so that the outline of the person in the image to be processed is better highlighted, and the added light effect is better.

在一个实施例中,提供的一种图像处理方法中根据提亮中心点建立光效模型,如图5所示包括步骤502至步骤506。其中:In one embodiment, an image processing method is provided in which a light effect model is established according to the highlight center point, as shown in FIG. 5 , including steps 502 to 506 . in:

步骤502,获取二维高斯分布函数。Step 502, obtaining a two-dimensional Gaussian distribution function.

具体地,光效模型可以根据二维高斯分布函数进行构建。首先获取二维高斯分布函数如下:Specifically, the light effect model can be constructed according to a two-dimensional Gaussian distribution function. First obtain the two-dimensional Gaussian distribution function as follows:

Figure BDA0001667111380000081
Figure BDA0001667111380000081

上述函数是以(0,0)为极大值点的二维高斯分布函数,其中,(x,y)表示待处理图像中的像素点;P(x,y)表示像素点进行增亮处理时的像素增强系数;d为标准差,亮度增强系数可影响d的大小,亮度增强系数越大时,d可越小,亮度增强系数越小时,d可越大。在光效模型中,处于待处理图像不同位置的像素点,对应的像素增强系数不同,距离极大值点越近的像素点,像素增强系数越强,距离极大值点越远的像素点,像素增强系数越小。The above function is a two-dimensional Gaussian distribution function with (0, 0) as the maximum point, where (x, y) represents the pixel point in the image to be processed; P(x, y) represents the pixel point for brightening processing The pixel enhancement coefficient at time; d is the standard deviation, the brightness enhancement coefficient can affect the size of d, the larger the brightness enhancement coefficient, the smaller the d can be, and the smaller the brightness enhancement coefficient, the larger the d can be. In the light effect model, the pixels at different positions of the image to be processed have different pixel enhancement coefficients. The pixel points that are closer to the maximum point have stronger pixel enhancement coefficients, and the pixels that are farther from the maximum point are , the smaller the pixel enhancement coefficient is.

步骤504,根据亮度增强系数确定分布幅度。Step 504: Determine the distribution amplitude according to the luminance enhancement coefficient.

步骤506,将提亮中心点作为二维高斯分布函数的极大值点,根据极大值点及分布幅度构建光效模型。Step 506 , taking the highlight center point as the maximum point of the two-dimensional Gaussian distribution function, and constructing a light effect model according to the maximum point and the distribution amplitude.

在本实施例中,光效模型为二维高斯分布函数,电子设备可根据提亮中心点的位置确定光效模型的极大值点,并根据亮度增强系数确定分布幅度。光效模型的极大值点可用于决定光效模型的位置,电子设备可将提亮中心点作为光效模型的极大值点。光效模型的分布幅度可用于描述二维高斯分布函数的形状。当亮度增强系数越大时,光效模型的形状可越“瘦高”,当亮度增强系数越小时,光效模型的形状可越“瘦小”。In this embodiment, the light effect model is a two-dimensional Gaussian distribution function, and the electronic device can determine the maximum value point of the light effect model according to the position of the brightening center point, and determine the distribution amplitude according to the brightness enhancement coefficient. The maximum value point of the light effect model can be used to determine the position of the light effect model, and the electronic device can use the highlight center point as the maximum value point of the light effect model. The distribution amplitude of the light effect model can be used to describe the shape of the two-dimensional Gaussian distribution function. When the brightness enhancement coefficient is larger, the shape of the light effect model can be more "skinny and taller", and when the brightness enhancement coefficient is smaller, the shape of the light effect model can be more "thin".

电子设备根据提亮中心点建立光效模型即将上述二维高斯分布函数进行位移,将上述二维高斯分布函数的极大值点移动到提亮中心点的位置即可得到光效模型。假设提亮中心点的位置为(x0,y0),则得到的光效模型就可以表示为:The electronic device establishes a light effect model according to the brightening center point, that is, displaces the two-dimensional Gaussian distribution function, and moves the maximum point of the two-dimensional Gaussian distribution function to the position of the brightening center point to obtain the light effect model. Assuming that the position of the highlight center point is (x 0 , y 0 ), the resulting light effect model can be expressed as:

Figure BDA0001667111380000091
Figure BDA0001667111380000091

得到的光效模型中,提亮中心点(x0,y0)就为极大值点,即在提亮中心点(x0,y0)得到的像素增强系数Po(x,y)最大。In the obtained light effect model, the highlight center point (x 0 , y 0 ) is the maximum value point, that is, the pixel enhancement coefficient P o (x, y) obtained at the highlight center point (x 0 , y 0 ) maximum.

图6为一个实施例中光效模型的示意图。如图6所示,该光效模型中待处理图像的分辨率为50*50,提亮中心点602的坐标值为(25,25)。可以看出,该提亮中心点602对应的像素增强系数最大,待处理图像中其他像素点对应的像素增强系数随着与提亮中心点602的距离的增加而降低,离提亮中心点602的距离越远的像素点,对应的像素增强系数越小。FIG. 6 is a schematic diagram of a light effect model in one embodiment. As shown in FIG. 6 , the resolution of the image to be processed in the light effect model is 50*50, and the coordinate value of the highlight center point 602 is (25, 25). It can be seen that the pixel enhancement coefficient corresponding to the highlight center point 602 is the largest, and the pixel enhancement coefficients corresponding to other pixel points in the image to be processed decrease as the distance from the highlight center point 602 increases. The farther the distance is, the smaller the corresponding pixel enhancement coefficient is.

在一个实施例中,提供的一种图像处理方法还包括:根据待处理图像的亮度信息确定光学模型中的亮度增强系数,亮度增强系数用于调节光效模型中光线强弱变化的强度。In one embodiment, an image processing method is provided, further comprising: determining a brightness enhancement coefficient in the optical model according to brightness information of the image to be processed, where the brightness enhancement coefficient is used to adjust the intensity of light intensity changes in the light effect model.

电子设备可以设定标准亮度阈值,该标准亮度阈值用于表示被拍摄物体的亮度值与待处理图像的亮度值的理想比值。当被拍摄物体的亮度值与待处理图像的亮度值达到理想比值时,可认定拥有一个较为理想的效果。当电子设备采集待处理图像的亮度信息后,可判定被拍摄物体的亮度值与待处理图像的亮度值的比值是否小于标准亮度阈值。当比值大于标准亮度阈值时,则可不对待处理图像进行添加光线效果的处理。当比值小于标准亮度阈值时,则可根据该比值的大小确定光学模型中的亮度增强系数。光学模型中的亮度增强系数与该比值呈负相关,当被拍摄物体的亮度值与待处理图像的亮度值的比值较小时,亮度增强系数增大,当被拍摄物体的亮度值与待处理图像的亮度值的比值较大时,亮度增强系数减小。亮度增强系数还可以根据待处理图像的亮度值进行调整等,在此不做限定。The electronic device may set a standard brightness threshold, where the standard brightness threshold is used to represent an ideal ratio of the brightness value of the object to be photographed to the brightness value of the image to be processed. When the brightness value of the photographed object and the brightness value of the image to be processed reach an ideal ratio, it can be determined that there is a relatively ideal effect. After the electronic device collects the brightness information of the image to be processed, it can determine whether the ratio of the brightness value of the object to be photographed to the brightness value of the image to be processed is smaller than the standard brightness threshold. When the ratio is greater than the standard brightness threshold, the processing of adding light effects to the image to be processed may not be performed. When the ratio is smaller than the standard brightness threshold, the brightness enhancement coefficient in the optical model can be determined according to the ratio. The brightness enhancement coefficient in the optical model is negatively correlated with this ratio. When the ratio of the brightness value of the object to be photographed to the brightness value of the image to be processed is small, the brightness enhancement coefficient increases. When the ratio of the brightness value to is larger, the brightness enhancement coefficient decreases. The brightness enhancement coefficient can also be adjusted according to the brightness value of the image to be processed, etc., which is not limited here.

如图7所示,在一个实施例中,提供的一种图像处理方法还包括步骤702至步骤704。其中:As shown in FIG. 7 , in one embodiment, the provided image processing method further includes steps 702 to 704 . in:

步骤702,根据光效模型获取待处理图像中各个像素点对应的像素增强系数。Step 702: Obtain pixel enhancement coefficients corresponding to each pixel in the image to be processed according to the light effect model.

可以理解的是,待处理图像为一个二维像素点矩阵,可以以待处理图像的最左下角像素点为原点建立坐标系,待处理图像中的像素点就可以通过一个二维坐标进行表示。根据上述光效模型可以获取待处理图像中各个像素点的像素增强系数,可以直接将各个像素点对应的坐标带入到上述光效模型中,得到像素点的像素增强系数。电子设备可以获取与像素点距离最近的提亮中心点建立的光学模型中像素点的像素增强系数作为像素点对应的像素增强系数,也可以获取待处理图像中至少两个光效模型中像素点的至少两个像素增强系数,将至少两个像素增强系数进行加权得到像素点对应的像素增强系数。It can be understood that the image to be processed is a two-dimensional pixel matrix, and a coordinate system can be established with the pixel at the bottom left corner of the image to be processed as the origin, and the pixels in the image to be processed can be represented by a two-dimensional coordinate. According to the above light effect model, the pixel enhancement coefficient of each pixel in the image to be processed can be obtained, and the coordinates corresponding to each pixel can be directly brought into the above light effect model to obtain the pixel enhancement coefficient of the pixel. The electronic device can obtain the pixel enhancement coefficient of the pixel point in the optical model established by the brightening center point closest to the pixel point as the pixel enhancement coefficient corresponding to the pixel point, or obtain the pixel point in at least two light effect models in the image to be processed. The at least two pixel enhancement coefficients are weighted to obtain the pixel enhancement coefficients corresponding to the pixel points.

步骤704,根据像素点对应的像素增强系数对像素点进行添加光线效果的处理。Step 704: Perform processing of adding light effects to the pixel points according to the pixel enhancement coefficients corresponding to the pixel points.

电子设备根据像素点对应的像素增强系数对像素点进行添加光线效果的处理,可以对待处理图像中的所有像素点进行添加光线效果的处理,也可以对目标区域进行添加光线效果的处理,还可以对人脸区域和人像区域进行添加光线效果的处理。待处理图像中除人像区域或目标区域外的区域可以不做处理,也可以进行弱化处理。The electronic device adds light effects to the pixels according to the pixel enhancement coefficients corresponding to the pixels. It can add light effects to all pixels in the image to be processed, and can also add light effects to the target area. Add light effects to the face area and the portrait area. Areas other than the portrait area or the target area in the image to be processed may not be processed, or may be weakened.

在一个实施例中,提供的一种图像处理方法还包括:当像素点存在多个像素增强系数时,将像素点的多个像素增强系数进行加权得到像素点对应的像素增强系数,根据像素点对应的像素增强系数对像素点进行处理。In one embodiment, an image processing method is provided, further comprising: when there are multiple pixel enhancement coefficients at a pixel point, weighting the multiple pixel enhancement coefficients of the pixel point to obtain the pixel enhancement coefficient corresponding to the pixel point, and according to the pixel point The corresponding pixel enhancement coefficients process the pixel points.

具体地,电子设备将像素点的多个像素增强系数进行加权可以是将像素点的所有像素增强系数的平均值作为像素点对应的像素增强系数,也可以是将待处理图像中像素点所在区域的提亮中心点建立的光效模型中像素点的多个像素增强系数的平均值作为像素点对应的像素增强系数,还可以将像素点的多个像素增强系数中最大的像素增强系数作为像素点对应的像素增强系数,像素增强系数的加权方式可以有多种,在此不做限定。像素点所在区域可以是目标区域、目标区域外的区域、人脸区域、人像区域等。Specifically, the electronic device may use the average value of all pixel enhancement coefficients of the pixel as the pixel enhancement coefficient corresponding to the pixel, or it may be the area where the pixel is located in the image to be processed. The average value of the multiple pixel enhancement coefficients of the pixel points in the light effect model established by the brightening center point is taken as the pixel enhancement coefficient corresponding to the pixel point, and the largest pixel enhancement coefficient among the multiple pixel enhancement coefficients of the pixel point can also be taken as the pixel point. The pixel enhancement coefficient corresponding to the point, and the weighting manner of the pixel enhancement coefficient may be various, which is not limited here. The area where the pixel points are located may be a target area, an area outside the target area, a face area, a portrait area, and the like.

电子设备可以根据加权得到像素点对应的像素增强系数对像素点进行添加光线效果处理。从而使待处理图像中被拍摄物体更加突出,提高光线处理的效果。The electronic device may add light effect processing to the pixel points according to the pixel enhancement coefficients corresponding to the pixel points obtained by weighting. Therefore, the photographed object in the to-be-processed image is more prominent, and the effect of light processing is improved.

在一个实施例中,提供了一种图像处理方法,实现该方法的具体步骤如下所述:In one embodiment, an image processing method is provided, and the specific steps for realizing the method are as follows:

首先,电子设备可以获取待处理图像中至少两个提亮中心点。待处理图像是由多个像素点组成的需要进行添加光线效果处理的图像。待处理图像可以是电子设备通过摄像头实时采集的图像,也可以是存储在电子设备本地的图像。光线效果可以是自然光、舞台光、胶片光、轮廓光等效果。提亮中心点即为光源中心对应的像素点。电子设备可以获取待处理图像,并将待处理图像进行显示。电子设备可以对待处理图像进行识别,根据待处理图像的被拍摄物体确定至少两个提亮中心点,也可以获取由用户根据显示的待处理图像选择的至少两个提亮中心点。First, the electronic device may acquire at least two highlight center points in the image to be processed. The image to be processed is an image composed of multiple pixels and needs to be processed by adding light effects. The image to be processed may be an image captured by the electronic device in real time through a camera, or may be an image stored locally on the electronic device. Lighting effects can be natural light, stage light, film light, contour light, etc. The highlight center point is the pixel point corresponding to the center of the light source. The electronic device can acquire the to-be-processed image and display the to-be-processed image. The electronic device may identify the image to be processed, determine at least two highlight center points according to the object in the image to be processed, or obtain at least two highlight center points selected by the user according to the displayed image to be processed.

接着,电子设备根据提亮中心点建立光效模型,光效模型是模拟光线强弱变化的模型。光效模型是指对待处理图像进行添加光线效果处理的模型,光效模型可以模拟光源发出的光线强弱变化的曲线。根据提亮中心点建立光效模型,即将提亮中心点作为光源从而模拟各个像素点所在位置的光线强弱变化的模型。电子设备根据光效模型对待处理图像进行添加光线效果的处理,可包括对待处理图像进行增亮处理、改变待处理图像的颜色等。电子设备中可以预先存储光效参考模型,该光效参考模型可以是以图像中任意一个参考像素点为光源的模型。在获取到提亮中心点后,可以获取提亮中心点相对参考像素点的位移,并将光效参考模型进行位移之后得到该提亮中心点对应的光效模型。Next, the electronic device establishes a light effect model according to the brightening center point, and the light effect model is a model that simulates changes in light intensity. The light effect model refers to the model that adds light effects to the image to be processed. The light effect model can simulate the curve of the intensity change of the light emitted by the light source. A light effect model is established based on the brightening center point, that is, a model in which the brightening center point is used as a light source to simulate the change of light intensity at the location of each pixel point. The electronic device performs processing of adding light effects to the image to be processed according to the light effect model, which may include performing brightening processing on the image to be processed, changing the color of the image to be processed, and the like. The light effect reference model may be pre-stored in the electronic device, and the light effect reference model may be a model in which any reference pixel in the image is the light source. After the highlighting center point is obtained, the displacement of the highlighting center point relative to the reference pixel point can be obtained, and the light effect model corresponding to the highlighting center point can be obtained after displacing the light effect reference model.

可选地,电子设备获取二维高斯分布函数,根据亮度增强系数确定分布幅度,将提亮中心点作为二维高斯分布函数的极大值点,根据极大值点及分布幅度构建光效模型。光效模型为二维高斯分布函数,电子设备可根据提亮中心点的位置确定光效模型的极大值点,并根据亮度增强系数确定分布幅度。光效模型的极大值点可用于决定光效模型的位置,电子设备可将提亮中心点作为光效模型的极大值点。光效模型的分布幅度可用于描述二维高斯分布函数的形状。电子设备根据提亮中心点建立光效模型即将上述二维高斯分布函数进行位移,将二维高斯分布函数的极大值点移动到提亮中心点的位置即可得到光效模型。Optionally, the electronic device obtains a two-dimensional Gaussian distribution function, determines the distribution amplitude according to the brightness enhancement coefficient, takes the brightening center point as the maximum value point of the two-dimensional Gaussian distribution function, and constructs a light effect model according to the maximum value point and the distribution amplitude. . The light effect model is a two-dimensional Gaussian distribution function, and the electronic device can determine the maximum value point of the light effect model according to the position of the brightening center point, and determine the distribution amplitude according to the brightness enhancement coefficient. The maximum value point of the light effect model can be used to determine the position of the light effect model, and the electronic device can use the highlight center point as the maximum value point of the light effect model. The distribution amplitude of the light effect model can be used to describe the shape of the two-dimensional Gaussian distribution function. The electronic device establishes a light effect model according to the brightening center point, that is, displaces the above-mentioned two-dimensional Gaussian distribution function, and moves the maximum point of the two-dimensional Gaussian distribution function to the position of the brightening center point to obtain the light effect model.

可选地,根据待处理图像的亮度信息确定光效模型中的亮度增强系数,亮度增强系数用于调节光效模型中光线强弱变化的强度。电子设备可以设定标准亮度阈值,该标准亮度阈值用于表示被拍摄物体的亮度值与待处理图像的亮度值的理想比值。当被拍摄物体的亮度值与待处理图像的亮度值的比值小于标准亮度阈值时,则可根据该比值的大小确定光学模型中的亮度增强系数。光学模型中的亮度增强系数与该比值呈负相关,当被拍摄物体的亮度值与待处理图像的亮度值的比值较小时,亮度增强系数增大,当被拍摄物体的亮度值与待处理图像的亮度值的比值较大时,亮度增强系数减小。亮度增强系数还可以根据待处理图像的亮度值进行调整等,在此不做限定。Optionally, a brightness enhancement coefficient in the light effect model is determined according to the brightness information of the image to be processed, and the brightness enhancement coefficient is used to adjust the intensity of light intensity changes in the light effect model. The electronic device may set a standard brightness threshold, where the standard brightness threshold is used to represent an ideal ratio of the brightness value of the object to be photographed to the brightness value of the image to be processed. When the ratio of the brightness value of the photographed object to the brightness value of the image to be processed is smaller than the standard brightness threshold, the brightness enhancement coefficient in the optical model can be determined according to the ratio. The brightness enhancement coefficient in the optical model is negatively correlated with this ratio. When the ratio of the brightness value of the object to be photographed to the brightness value of the image to be processed is small, the brightness enhancement coefficient increases. When the ratio of the brightness value to is larger, the brightness enhancement coefficient decreases. The brightness enhancement coefficient can also be adjusted according to the brightness value of the image to be processed, etc., which is not limited here.

接着,电子设备根据光效模型对待处理图像进行添加光线效果的处理。电子设备根据光效模型对待处理图像进行添加光线效果的处理,可以调整待处理图像中像素点的色彩值,也可以对待处理图像进行增亮处理等。具体地,电子设备可以根据光效模型获取待处理图像中各个像素点对应的像素增强系数,根据像素增强系数对像素点进行添加光线效果的处理。电子设备可以通过像素增强系数对待处理图像进行叠加或乘积的方式进行对待处理图像添加光线效果的处理。Next, the electronic device performs processing of adding light effects to the image to be processed according to the light effect model. The electronic device performs processing of adding light effects to the image to be processed according to the light effect model, and can adjust the color values of the pixels in the image to be processed, and can also perform brightening processing on the image to be processed. Specifically, the electronic device may acquire pixel enhancement coefficients corresponding to each pixel in the image to be processed according to the light effect model, and perform processing of adding light effects to the pixel points according to the pixel enhancement coefficient. The electronic device may perform the processing of adding light effects to the image to be processed by superimposing or multiplying the pixel enhancement coefficients on the image to be processed.

可选地,电子设备获取待处理图像的目标区域,目标区域为被拍摄物体的区域,对目标区域中的提亮中心点进行第一光线效果的处理,对目标区域外的提亮中心点进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。电子设备可以识别待处理图像中被拍摄物体区域。电子设备确定待处理图像中被拍摄物体的区域即目标区域后,获取目标区域中的至少一个提亮中心点。电子设备对目标区域中的提亮中心点进行第一光线效果的处理是指电子设备根据目标区域中的提亮中心点和第一光线效果的亮度增强系数确定目标区域中提亮中心点对应的光效模型,从而获取光效模型中像素点对应的像素增强系数,根据像素增强系数对目标区域中的像素点进行添加第一光线效果的处理。电子设备对目标区域外的提亮中心点进行第二光线效果的处理与对目标区域进行第一光线效果的处理方法相似。由于第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数,在电子设备完成对待处理图像的第一光线效果和第二光线效果的处理后,可以突出待处理图像中的目标区域,使被拍摄物体的轮廓更好地凸显,提高了添加光线的效果。Optionally, the electronic device obtains the target area of the image to be processed, where the target area is the area of the object to be photographed, and performs the first light effect processing on the brightening center point in the target area, and performs the first light effect processing on the brightening center point outside the target area. In the processing of the second light effect, the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect. The electronic device can identify the area of the photographed object in the image to be processed. After the electronic device determines the area of the object to be photographed in the image to be processed, that is, the target area, it acquires at least one highlight center point in the target area. The processing by the electronic device to perform the first light effect on the highlight center point in the target area means that the electronic device determines the corresponding highlight center point in the target area according to the highlight center point in the target area and the brightness enhancement coefficient of the first light effect. The light effect model is obtained, thereby obtaining the pixel enhancement coefficient corresponding to the pixel point in the light effect model, and performing the processing of adding the first light effect to the pixel point in the target area according to the pixel enhancement coefficient. The processing method of the electronic device performing the second light effect on the brightening center point outside the target area is similar to the processing method of performing the first light effect on the target area. Since the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect, after the electronic device completes the processing of the first light effect and the second light effect of the image to be processed, the target area in the image to be processed can be highlighted , so that the outline of the object to be photographed is better highlighted and the effect of adding light is improved.

可选地,电子设备确定待处理图像的人脸区域,对人脸区域中的提亮中心点进行第一光线效果的处理,获取待处理图像中与人脸区域对应的人像区域,对人像区域中提亮中心点进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。电子设备可对待处理图像进行人脸检测,判断待处理图像中是否包含人脸,若包含,则可确定待处理图像的人脸区域。电子设备检测待处理图像中的人脸区域后,可以根据人脸区域和深度信息,获取待处理图像中的人像区域。电子设备分别对人脸区域和人像区域进行第一光线效果和第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数,可以突出待处理图像中人像,使待处理图像中的人脸添加光线效果更强,从而更好突出待处理图像的人物轮廓,使添加的光线效果更好。Optionally, the electronic device determines the face area of the image to be processed, performs the processing of the first light effect on the brightening center point in the face area, obtains the portrait area corresponding to the face area in the image to be processed, and performs the processing on the portrait area. The middle brightening center point is processed for the second light effect, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect. The electronic device can perform face detection on the image to be processed, and determine whether the image to be processed contains a human face, and if so, can determine the face area of the image to be processed. After the electronic device detects the face area in the image to be processed, it can acquire the portrait area in the image to be processed according to the face area and depth information. The electronic device performs the processing of the first light effect and the second light effect on the face area and the portrait area respectively, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect, which can highlight the portrait in the image to be processed, The effect of adding light to the face in the image to be processed is stronger, so that the outline of the person in the image to be processed is better highlighted, and the added light effect is better.

可选地,电子设备根据光效模型获取待处理图像中各个像素点对应的像素增强系数,根据像素点对应的像素增强系数对像素点进行添加光线效果的处理。待处理图像为一个二维像素点矩阵,可以以待处理图像的最左下角像素点为原点建立坐标系,待处理图像中的像素点就可以通过一个二维坐标进行表示。根据上述光效模型可以获取待处理图像中各个像素点的像素增强系数,可以直接将各个像素点对应的坐标带入到上述光效模型中,得到像素点的像素增强系数。电子设备根据像素点对应的像素增强系数对像素点进行添加光线效果的处理,可以对待处理图像中的所有像素点进行添加光线效果的处理,也可以对目标区域进行添加光线效果的处理,还可以对人脸区域和人像区域进行添加光线效果的处理。Optionally, the electronic device obtains pixel enhancement coefficients corresponding to each pixel in the to-be-processed image according to the light effect model, and performs processing of adding light effects to the pixel according to the pixel enhancement coefficient corresponding to the pixel. The image to be processed is a two-dimensional pixel matrix, and a coordinate system can be established with the pixel at the bottom left corner of the image to be processed as the origin, and the pixels in the image to be processed can be represented by a two-dimensional coordinate. According to the above light effect model, the pixel enhancement coefficient of each pixel in the image to be processed can be obtained, and the coordinates corresponding to each pixel can be directly brought into the above light effect model to obtain the pixel enhancement coefficient of the pixel. The electronic device adds light effects to the pixels according to the pixel enhancement coefficients corresponding to the pixels. It can add light effects to all pixels in the image to be processed, and can also add light effects to the target area. Add light effects to the face area and the portrait area.

可选地,当所述像素点存在多个像素增强系数时,电子设备将所述像素点的多个像素增强系数进行加权得到所述像素点对应的像素增强系数,根据所述像素点对应的像素增强系数对所述像素点进行处理。电子设备将像素点的多个像素增强系数进行加权可以是将像素点的所有像素增强系数的平均值作为像素点对应的像素增强系数,也可以是将待处理图像中像素点所在区域的提亮中心点建立的光效模型中像素点的多个像素增强系数的平均值作为像素点对应的像素增强系数,还可以将像素点的多个像素增强系数中最大的像素增强系数作为像素点对应的像素增强系数,像素增强系数的加权方式可以有多种,在此不做限定。Optionally, when the pixel point has multiple pixel enhancement coefficients, the electronic device weights the multiple pixel enhancement coefficients of the pixel point to obtain the pixel enhancement coefficient corresponding to the pixel point. The pixel points are processed by pixel enhancement coefficients. The electronic device weights multiple pixel enhancement coefficients of a pixel point, which may be the average value of all pixel enhancement coefficients of the pixel point as the pixel enhancement coefficient corresponding to the pixel point, or it may be to brighten the area where the pixel point is located in the image to be processed. The average value of the multiple pixel enhancement coefficients of the pixel points in the light effect model established by the center point is used as the pixel enhancement coefficient corresponding to the pixel point, and the largest pixel enhancement coefficient among the multiple pixel enhancement coefficients of the pixel point can also be used as the corresponding pixel point. The pixel enhancement coefficient, the weighting manner of the pixel enhancement coefficient can be in various ways, which is not limited here.

应该理解的是,虽然图2-5、7的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-5、7中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowcharts of FIGS. 2-5 and 7 are shown in sequence according to the arrows, these steps are not necessarily executed in the sequence shown by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIGS. 2-5 and 7 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. These sub-steps are not necessarily completed at the same time. Alternatively, the order of execution of the stages is not necessarily sequential, but may be performed alternately or alternately with other steps or sub-steps of other steps or at least a portion of a stage.

图8为一个实施例的图像处理装置的结构框图。如图8所示,该装置包括获取模块820、模型建立模块840和处理模块860,其中:FIG. 8 is a structural block diagram of an image processing apparatus according to an embodiment. As shown in FIG. 8 , the apparatus includes an acquisition module 820, a model establishment module 840 and a processing module 860, wherein:

获取模块820,用于获取待处理图像中至少两个提亮中心点。The acquiring module 820 is configured to acquire at least two highlight center points in the image to be processed.

模型建立模型840,用于根据提亮中心点建立光效模型,光效模型是模拟光线强弱变化的模型。The model establishment model 840 is used to establish a light effect model according to the brightening center point, and the light effect model is a model for simulating changes in light intensity.

处理模块860,用于根据光效模型对待处理图像进行添加光线效果的处理。The processing module 860 is configured to perform processing of adding light effects to the image to be processed according to the light effect model.

在一个实施例中,处理模块860还可以用于获取待处理图像的目标区域,目标区域为被拍摄物体的区域;对目标区域的提亮中心点进行第一光线效果的处理,对目标区域外的提亮中心点进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。In one embodiment, the processing module 860 may also be used to obtain a target area of the image to be processed, where the target area is the area of the object to be photographed; perform the first light effect processing on the highlight center point of the target area, The second light effect is processed at the brightening center point, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect.

在一个实施例中,处理模块860还可以用于确定所述待处理图像的人脸区域,对人脸区域中的提亮中心点进行第一光线效果的处理,获取待处理图像中与人脸区域对应的人像区域,对人像区域中的提亮中心点进行第二光线效果的处理,第二光线效果的亮度增强系数低于第一光线效果的亮度增强系数。In one embodiment, the processing module 860 may also be used to determine the face area of the image to be processed, perform the first light effect processing on the highlighted center point in the face area, and obtain the image to be processed that matches the face of the human face. In the portrait area corresponding to the area, a second light effect is processed on the brightening center point in the portrait area, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect.

在一个实施例中,模型建立模块840还可以用于根据待处理图像的亮度信息确定光效模型中的亮度增强系数,亮度增强系数用于调节光效模型中光线强弱变化的强度。In one embodiment, the model building module 840 may be further configured to determine a brightness enhancement coefficient in the light effect model according to the brightness information of the image to be processed, where the brightness enhancement coefficient is used to adjust the intensity of light intensity changes in the light effect model.

在一个实施例中,模型建立模块840还可以用于获取二维高斯分布函数,根据亮度增强系数确定分布幅度,将提亮中心点作为二维高斯分布函数的极大值点,根据极大值点及分布幅度构建光效模型。In one embodiment, the model building module 840 can also be used to obtain a two-dimensional Gaussian distribution function, determine the distribution amplitude according to the brightness enhancement coefficient, and use the highlight center point as the maximum value point of the two-dimensional Gaussian distribution function, according to the maximum value Point and distribution amplitude to build a light effect model.

在一个实施例中,处理模块860还可以用于根据光效模型获取待处理图像中各个像素点对应的像素增强系数,根据像素点对应的像素增强系数对像素点进行添加光线效果的处理。In one embodiment, the processing module 860 may be further configured to obtain pixel enhancement coefficients corresponding to each pixel in the image to be processed according to the light effect model, and perform processing of adding light effects to the pixels according to the pixel enhancement coefficients corresponding to the pixels.

在一个实施例中,处理模块860还可以用于当所述像素点存在多个像素增强系数时,将像素点的多个像素增强系数进行加权得到像素点对应的像素增强系数,根据像素点对应的像素增强系数对像素点进行处理。In one embodiment, the processing module 860 may also be configured to, when there are multiple pixel enhancement coefficients at the pixel point, weight the multiple pixel enhancement coefficients of the pixel point to obtain the pixel enhancement coefficient corresponding to the pixel point. The pixel enhancement coefficient of the pixel is processed.

上述图像处理装置中各个模块的划分仅用于举例说明,在其他实施例中,可将图像处理装置按照需要划分为不同的模块,以完成上述图像处理装置的全部或部分功能。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.

关于图像处理装置的具体限定可以参见上文中对于图像处理方法的限定,在此不再赘述。上述图像处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the image processing apparatus, reference may be made to the limitation of the image processing method above, which will not be repeated here. Each module in the above-mentioned image processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

本申请实施例中提供的图像处理装置中的各个模块的实现可为计算机程序的形式。该计算机程序可在终端或服务器上运行。该计算机程序构成的程序模块可存储在终端或服务器的存储器上。该计算机程序被处理器执行时,实现本申请实施例中所描述方法的步骤。The implementation of each module in the image processing apparatus provided in the embodiments of the present application may be in the form of a computer program. The computer program can be run on a terminal or server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, the steps of the methods described in the embodiments of the present application are implemented.

本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行图像处理方法的步骤。Embodiments of the present application also provide a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, when executed by one or more processors, cause the processors to perform the steps of an image processing method.

一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行图像处理方法。A computer program product containing instructions, when run on a computer, causes the computer to perform an image processing method.

本申请实施例还提供一种电子设备。上述电子设备中包括图像处理电路,图像处理电路可以利用硬件和/或软件组件实现,可包括定义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中。In addition, image sensor 914 may also send raw image data to sensor 920, which may provide raw image data to ISP processor 940 based on the sensor 920 interface type, or sensor 920 may store the 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 in 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颜色空间中的图像数据处理。ISP处理器940处理后的图像数据可输出给显示器970,以供用户观看和/或由图形引擎或GPU(Graphics Processing Unit,图形处理器)进一步处理。此外,ISP处理器940的输出还可发送给图像存储器930,且显示器970可从图像存储器930读取图像数据。在一个实施例中,图像存储器930可被配置为实现一个或多个帧缓冲器。此外,ISP处理器940的输出可发送给编码器/解码器960,以便编码/解码图像数据。编码的图像数据可被保存,并在显示于显示器970设备上之前解压缩。编码器/解码器960可由CPU或GPU或协处理器实现。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 receives processed data from the image memory 930 and performs image data processing in the original domain and in the RGB and YCbCr color spaces on the processed data. The image data processed by the ISP processor 940 may be output to the display 970 for viewing by the 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 970 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. In addition, the output of ISP processor 940 may be sent to encoder/decoder 960 for encoding/decoding image data. The encoded image data can be saved and decompressed prior to display on the display 970 device. The encoder/decoder 960 may be implemented by a CPU or GPU or a co-processor.

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 and ISP processing of imaging device 910 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, stabilization parameters, etc.), camera flash control parameters, lens 912 control parameters (eg, focal length for focusing or zooming), or these combination of 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中图像处理技术可实现上述图像处理方法。In this embodiment, the above-mentioned image processing method can be implemented by using the image processing technology shown in FIG. 9 .

本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(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 (12)

1.一种图像处理方法,其特征在于,包括:1. an image processing method, is characterized in that, comprises: 获取待处理图像中至少两个提亮中心点;所述提亮中心点为光源中心对应的像素点;Obtain at least two brightening center points in the image to be processed; the brightening center points are the pixel points corresponding to the center of the light source; 根据所述提亮中心点建立光效模型,所述光效模型是将提亮中心点作为光源从而模拟各个像素点所在位置的光线强弱变化的模型;A light effect model is established according to the brightening center point, and the light effect model is a model in which the brightening center point is used as a light source to simulate the change of light intensity at the position of each pixel point; 根据所述光效模型对所述待处理图像进行添加光线效果的处理;Perform processing of adding light effects to the to-be-processed image according to the light effect model; 所述方法还包括:获取待处理图像的目标区域,所述目标区域为被拍摄物体的区域;所述至少两个提亮中心点包括目标区域中的提亮中心点以及目标区域外的提亮中心点;The method further includes: acquiring a target area of the image to be processed, where the target area is the area of the object to be photographed; the at least two highlight center points include a highlight center point in the target area and a highlight outside the target area center point; 对所述目标区域中的提亮中心点进行第一光线效果的处理;processing the first light effect on the brightening center point in the target area; 对所述目标区域外的提亮中心点进行第二光线效果的处理,所述第二光线效果的亮度增强系数低于所述第一光线效果的亮度增强系数;processing the second light effect on the brightening center point outside the target area, the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect; 所述方法还包括:The method also includes: 根据所述待处理图像的亮度信息确定光效模型中的亮度增强系数,所述亮度增强系数用于调节所述光效模型中光线强弱变化的强度。The brightness enhancement coefficient in the light effect model is determined according to the brightness information of the to-be-processed image, and the brightness enhancement coefficient is used to adjust the intensity of the light intensity change in the light effect model. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, wherein the method further comprises: 确定所述待处理图像的人脸区域;determining the face area of the image to be processed; 对所述人脸区域中的提亮中心点进行第一光线效果的处理;processing the first light effect on the brightening center point in the face area; 获取所述待处理图像中与所述人脸区域对应的人像区域;acquiring the portrait area corresponding to the face area in the to-be-processed image; 对所述人像区域中提亮中心点进行第二光线效果的处理,所述第二光线效果的亮度增强系数低于所述第一光线效果的亮度增强系数。The second light effect processing is performed on the brightened central point in the portrait area, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect. 3.根据权利要求1所述的方法,其特征在于,所述根据所述提亮中心点建立光效模型,包括:3. The method according to claim 1, wherein the establishing a light effect model according to the highlighting center point comprises: 获取二维高斯分布函数;Get the two-dimensional Gaussian distribution function; 根据所述亮度增强系数确定分布幅度;determining the distribution amplitude according to the luminance enhancement coefficient; 将所述提亮中心点作为二维高斯分布函数的极大值点,根据所述极大值点及分布幅度构建光效模型。The highlight center point is taken as the maximum value point of the two-dimensional Gaussian distribution function, and a light effect model is constructed according to the maximum value point and the distribution amplitude. 4.根据权利要求1至3中任一项所述的方法,其特征在于,所述方法还包括:4. The method according to any one of claims 1 to 3, wherein the method further comprises: 根据所述光效模型获取待处理图像中各个像素点对应的像素增强系数;Obtain pixel enhancement coefficients corresponding to each pixel in the image to be processed according to the light effect model; 根据所述像素点对应的像素增强系数对所述像素点进行添加光线效果的处理。The processing of adding light effects is performed on the pixel points according to the pixel enhancement coefficients corresponding to the pixel points. 5.根据权利要求4所述的方法,其特征在于,所述方法还包括:5. The method according to claim 4, wherein the method further comprises: 当所述像素点存在多个像素增强系数时,将所述像素点的多个像素增强系数进行加权得到所述像素点对应的像素增强系数,根据所述像素点对应的像素增强系数对所述像素点进行处理。When the pixel point has multiple pixel enhancement coefficients, weighting the multiple pixel enhancement coefficients of the pixel point to obtain the pixel enhancement coefficient corresponding to the pixel point, according to the pixel enhancement coefficient corresponding to the pixel point. Pixels are processed. 6.一种图像处理装置,其特征在于,包括:6. An image processing device, comprising: 获取模块,用于获取待处理图像中至少两个提亮中心点;所述提亮中心点为光源中心对应的像素点;an acquisition module, configured to acquire at least two brightening center points in the to-be-processed image; the brightening center points are the pixel points corresponding to the center of the light source; 模型建立模块,用于根据所述提亮中心点建立光效模型,所述光效模型是将提亮中心点作为光源从而模拟各个像素点所在位置的光线强弱变化的模型;a model establishment module, used for establishing a light effect model according to the brightening center point, and the light effect model is a model in which the brightening center point is used as a light source to simulate the change of light intensity at the position of each pixel point; 处理模块,用于根据所述光效模型对所述待处理图像进行添加光线效果的处理;a processing module, configured to perform processing of adding light effects to the to-be-processed image according to the light effect model; 所述处理模块,还用于获取待处理图像的目标区域,所述目标区域为被拍摄物体的区域;所述至少两个提亮中心点包括目标区域中的提亮中心点以及目标区域外的提亮中心点;The processing module is also used to obtain the target area of the image to be processed, and the target area is the area of the object to be photographed; the at least two highlight center points include the highlight center point in the target area and the area outside the target area. brighten the center point; 对所述目标区域中的提亮中心点进行第一光线效果的处理;对所述目标区域外的提亮中心点进行第二光线效果的处理,所述第二光线效果的亮度增强系数低于所述第一光线效果的亮度增强系数;The first light effect processing is performed on the brightening center point in the target area; the second light effect processing is performed on the brightening center point outside the target area, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect; 所述模型建立模块,还用于根据所述待处理图像的亮度信息确定光效模型中的亮度增强系数,所述亮度增强系数用于调节所述光效模型中光线强弱变化的强度。The model building module is further configured to determine a brightness enhancement coefficient in the light effect model according to the brightness information of the image to be processed, where the brightness enhancement coefficient is used to adjust the intensity of light intensity changes in the light effect model. 7.根据权利要求6所述的装置,其特征在于,7. The device of claim 6, wherein 所述处理模块,还用于确定所述待处理图像的人脸区域;对所述人脸区域中的提亮中心点进行第一光线效果的处理;获取所述待处理图像中与所述人脸区域对应的人像区域;对所述人像区域中提亮中心点进行第二光线效果的处理,所述第二光线效果的亮度增强系数低于所述第一光线效果的亮度增强系数。The processing module is further configured to determine the face area of the to-be-processed image; perform the first light effect processing on the brightening center point in the face area; The portrait area corresponding to the face area; the highlighting center point in the portrait area is processed with a second light effect, and the brightness enhancement coefficient of the second light effect is lower than the brightness enhancement coefficient of the first light effect. 8.根据权利要求6所述的装置,其特征在于,8. The device of claim 6, wherein 所述模型建立模块,还用于获取二维高斯分布函数;根据所述亮度增强系数确定分布幅度;将所述提亮中心点作为二维高斯分布函数的极大值点,根据所述极大值点及分布幅度构建光效模型。The model building module is also used to obtain a two-dimensional Gaussian distribution function; determine the distribution amplitude according to the brightness enhancement coefficient; take the highlight center point as the maximum value point of the two-dimensional Gaussian distribution function, The value points and distribution amplitudes are used to construct a light effect model. 9.根据权利要求6至8中任一项所述的装置,其特征在于,9. The device according to any one of claims 6 to 8, characterized in that, 所述处理模块,还用于根据所述光效模型获取待处理图像中各个像素点对应的像素增强系数;根据所述像素点对应的像素增强系数对所述像素点进行添加光线效果的处理。The processing module is further configured to acquire pixel enhancement coefficients corresponding to each pixel in the image to be processed according to the light effect model; and perform processing of adding light effects to the pixel points according to the pixel enhancement coefficient corresponding to the pixel. 10.根据权利要求9所述的装置,其特征在于,10. The device of claim 9, wherein: 所述处理模块,还用于当所述像素点存在多个像素增强系数时,将所述像素点的多个像素增强系数进行加权得到所述像素点对应的像素增强系数,根据所述像素点对应的像素增强系数对所述像素点进行处理。The processing module is further configured to, when there are multiple pixel enhancement coefficients at the pixel point, weight the multiple pixel enhancement coefficients of the pixel point to obtain the pixel enhancement coefficient corresponding to the pixel point, according to the pixel point The corresponding pixel enhancement coefficients process the pixel points. 11.一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如权利要求1至5中任一项所述的图像处理方法的步骤。11. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is made to execute any one of claims 1 to 5 The steps of the image processing method. 12.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至5中任一项所述的方法的步骤。12. 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 steps of the method according to any one of claims 1 to 5 are implemented.
CN201810487407.XA 2018-05-21 2018-05-21 Image processing method and device, electronic equipment and computer readable storage medium Expired - Fee Related CN108616700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810487407.XA CN108616700B (en) 2018-05-21 2018-05-21 Image processing method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810487407.XA CN108616700B (en) 2018-05-21 2018-05-21 Image processing method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108616700A CN108616700A (en) 2018-10-02
CN108616700B true CN108616700B (en) 2020-11-17

Family

ID=63663788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810487407.XA Expired - Fee Related CN108616700B (en) 2018-05-21 2018-05-21 Image processing method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN108616700B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109461186A (en) * 2018-10-15 2019-03-12 Oppo广东移动通信有限公司 Image processing method, device, computer readable storage medium and electronic equipment
CN109167935A (en) * 2018-10-15 2019-01-08 Oppo广东移动通信有限公司 Video processing method and device, electronic equipment and computer readable storage medium
CN109447927B (en) * 2018-10-15 2021-01-22 Oppo广东移动通信有限公司 Image processing method and apparatus, electronic device, computer-readable storage medium
CN112417930B (en) * 2019-08-23 2023-10-13 深圳市优必选科技股份有限公司 Image processing method and robot
CN112153303B (en) * 2020-09-28 2021-09-21 广州虎牙科技有限公司 Visual data processing method and device, image processing equipment and storage medium
CN112969088A (en) * 2021-02-01 2021-06-15 维沃移动通信有限公司 Screen projection control method and device, electronic equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308572A (en) * 2008-06-24 2008-11-19 北京中星微电子有限公司 Luminous effect processing method and apparatus
CN104794462A (en) * 2015-05-11 2015-07-22 北京锤子数码科技有限公司 Figure image processing method and device
CN106023104A (en) * 2016-05-16 2016-10-12 厦门美图之家科技有限公司 Human face eye area image enhancement method and system and shooting terminal
CN106257540A (en) * 2015-06-15 2016-12-28 联发科技股份有限公司 Method for providing virtual light and processing system thereof
CN107800965A (en) * 2017-10-31 2018-03-13 广东欧珀移动通信有限公司 Image processing method, device, computer readable storage medium and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6381404B2 (en) * 2014-10-23 2018-08-29 キヤノン株式会社 Image processing apparatus and method, and imaging apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308572A (en) * 2008-06-24 2008-11-19 北京中星微电子有限公司 Luminous effect processing method and apparatus
CN104794462A (en) * 2015-05-11 2015-07-22 北京锤子数码科技有限公司 Figure image processing method and device
CN106257540A (en) * 2015-06-15 2016-12-28 联发科技股份有限公司 Method for providing virtual light and processing system thereof
CN106023104A (en) * 2016-05-16 2016-10-12 厦门美图之家科技有限公司 Human face eye area image enhancement method and system and shooting terminal
CN107800965A (en) * 2017-10-31 2018-03-13 广东欧珀移动通信有限公司 Image processing method, device, computer readable storage medium and computer equipment

Also Published As

Publication number Publication date
CN108616700A (en) 2018-10-02

Similar Documents

Publication Publication Date Title
CN108616700B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN109767467B (en) Image processing method, apparatus, electronic device, and computer-readable storage medium
US11233933B2 (en) Method and device for processing image, and mobile terminal
CN108734676B (en) Image processing method and apparatus, electronic device, computer-readable storage medium
US11431915B2 (en) Image acquisition method, electronic device, and non-transitory computer readable storage medium
CN108805103B (en) Image processing method and apparatus, electronic device, computer-readable storage medium
US20210192698A1 (en) Image Processing Method, Electronic Device, and Non-Transitory Computer-Readable Storage Medium
CN109191403A (en) Image processing method and apparatus, electronic device, computer-readable storage medium
CN111028137B (en) Image processing method, apparatus, electronic device, and computer-readable storage medium
CN108322651B (en) Photographing method and device, electronic equipment and computer readable storage medium
CN108846807A (en) Light efficiency processing method, device, terminal and computer readable storage medium
CN109360254B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN113313661A (en) Image fusion method and device, electronic equipment and computer readable storage medium
CN108540716A (en) Image processing method, device, electronic device, and computer-readable storage medium
CN108376404A (en) Image processing method and device, electronic equipment and storage medium
CN108717530A (en) Image processing method, device, computer readable storage medium and electronic equipment
CN109712177A (en) Image processing method, apparatus, electronic device, and computer-readable storage medium
CN109325905B (en) Image processing method, image processing device, computer readable storage medium and electronic apparatus
EP3871406B1 (en) Systems and methods for exposure control
CN110689007B (en) Subject recognition method and device, electronic equipment and computer-readable storage medium
CN108600631B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN109040598B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN108769510A (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN108629329B (en) Image processing method and apparatus, electronic device, computer-readable storage medium
CN109410308A (en) Image processing method and device, electronic equipment, computer readable storage medium

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
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20201117

CF01 Termination of patent right due to non-payment of annual fee