HK40081243B - Image processing method and electronic device - Google Patents
Image processing method and electronic device Download PDFInfo
- Publication number
- HK40081243B HK40081243B HK42023069517.3A HK42023069517A HK40081243B HK 40081243 B HK40081243 B HK 40081243B HK 42023069517 A HK42023069517 A HK 42023069517A HK 40081243 B HK40081243 B HK 40081243B
- Authority
- HK
- Hong Kong
- Prior art keywords
- image
- mapping
- electronic device
- lookup table
- dimensional lookup
- Prior art date
Links
Description
技术领域Technical Field
本申请涉及图像处理领域,具体涉及一种图像处理方法与电子设备。This application relates to the field of image processing, specifically to an image processing method and an electronic device.
背景技术Background Technology
三维查找表(Three Dimension Look Up Table,3D LUT)在图像处理领域的应用非常普遍,通常通过在电子设备上加载3D LUT可以对图像进行颜色校正或者图像风格调整,从而实现不同的图像效果。Three-dimensional lookup tables (3D LUTs) are widely used in the field of image processing. Typically, by loading 3D LUTs onto electronic devices, color correction or image style adjustment can be performed on images to achieve different image effects.
在电子设备要实现3D LUT功能,则需要进行颜色查找表的加载与三维插值的计算;颜色查找表是指离散的原始色彩数据和校正后的色彩数据之间的三维映射表;但是,实现3D LUT功能对于电子设备的存储大小和运算能力均有较高的要求;在存储大小限制的情况,或者,有性能功耗约束的情况,电子设备则无法满足使用3D LUT的要求。To implement 3D LUT functionality in electronic devices, it is necessary to load color lookup tables and perform three-dimensional interpolation calculations. A color lookup table is a three-dimensional mapping table between discrete original color data and corrected color data. However, implementing 3D LUT functionality places high demands on the storage size and computing power of electronic devices. When storage size is limited, or when there are performance and power consumption constraints, electronic devices cannot meet the requirements for using 3D LUTs.
因此,在电子设备的性能受限的情况下,如何对图像进行处理实现图像的颜色校正或者图像风格调整成为一个亟需解决的问题。Therefore, given the limitations of electronic devices' performance, how to process images to achieve color correction or style adjustment has become an urgent problem to be solved.
发明内容Summary of the Invention
本申请提供了一种图像处理方法与电子设备,通过二维查找表中的第二映射与伽马处理中的第一映射对待处理图像进行处理,能够有效减少电子设备的运算量。This application provides an image processing method and an electronic device, which processes the image to be processed by using a second mapping in a two-dimensional lookup table and a first mapping in gamma processing, thereby effectively reducing the computational load of the electronic device.
第一方面,提供了一种图像处理方法,包括:Firstly, an image processing method is provided, including:
在第一拍摄模式下,显示第一界面,所述第一界面包括第一控件;检测到对所述第一控件的第一操作;响应于所述第一操作,确定伽马处理中的第一映射和二维查找表中的第二映射,所述第一映射与所述第一控件对应,所述第二映射与所述第一控件对应,所述第一映射和所述第二映射相关联;获取待处理图像;根据所述第一映射和所述第二映射,对所述待处理图像进行处理,得到第一图像。In the first shooting mode, a first interface is displayed, the first interface including a first control; a first operation on the first control is detected; in response to the first operation, a first mapping in gamma processing and a second mapping in a two-dimensional lookup table are determined, the first mapping corresponds to the first control, the second mapping corresponds to the first control, and the first mapping and the second mapping are associated; an image to be processed is acquired; the image to be processed is processed according to the first mapping and the second mapping to obtain a first image.
应理解,二维查找表中的第二映射可以是指一种函数关系,通过第二映射可以将每个像素的色彩信息进行重新定位得到新的色彩信息。通过二维查找表中的第二映射可以确定一种图像模式;该图像模式可以实现相机中不同滤镜的效果。It should be understood that the second mapping in a two-dimensional lookup table can refer to a functional relationship, through which the color information of each pixel can be repositioned to obtain new color information. The second mapping in the two-dimensional lookup table can determine an image mode; this image mode can achieve the effects of different filters in a camera.
在本申请的实施例中,电子设备响应于检测到的第一操作可以确定伽马处理中的第一映射和二维查找表中的第二映射;根据所述第一映射和所述第二映射,对待处理图像进行处理,得到第一图像;由于本申请实施例采用二维查找表中的第二映射与伽马处理中的第一映射对待处理图像进行图像,其中,第一映射与第二映射相关联;因此,与通过三维查找表对待处理图像进行处理相比,本申请的图像处理方法能够有效的降低电子设备的运算量。In embodiments of this application, the electronic device, in response to a detected first operation, can determine a first mapping in gamma processing and a second mapping in a two-dimensional lookup table; based on the first mapping and the second mapping, the image to be processed is processed to obtain a first image; since the embodiments of this application use the second mapping in the two-dimensional lookup table and the first mapping in gamma processing to process the image to be processed, wherein the first mapping is associated with the second mapping; therefore, compared with processing the image to be processed through a three-dimensional lookup table, the image processing method of this application can effectively reduce the computational load of the electronic device.
结合第一方面,在第一方面的某些实现方式中,所述第一拍摄模式是指图像的出帧率大于预设阈值的拍摄模式。In conjunction with the first aspect, in some implementations of the first aspect, the first shooting mode refers to a shooting mode in which the frame rate of the image is greater than a preset threshold.
在一种可能的实现方式中,第一拍摄模式可以是指出帧率较高的拍摄模式;比如,可以是指相机应用程序中的慢动作拍摄模式。In one possible implementation, the first shooting mode could refer to a shooting mode with a higher frame rate; for example, it could refer to a slow-motion shooting mode in a camera application.
结合第一方面,在第一方面的某些实现方式中,所述第一控件是指用于指示所述二维查找表中的第二映射表的控件。In conjunction with the first aspect, in some implementations of the first aspect, the first control refers to a control used to indicate the second mapping table in the two-dimensional lookup table.
在一种可能的实现方式中,第一界面可以是指拍摄的预览界面,在拍摄的预览界面中包括图像模式预览框,图像模式预览框中可以包括多个不同的图像模式,该图像模式可以是指图像的滤镜效果;检测到对第一控件的第一操作可以是指检测到用户选择图像模式预览框中目标风格的操作;一个图像模式可以对应于二维查找表的一种映射,即一个图像模式可以对应一种目标二维查找表。In one possible implementation, the first interface may refer to the shooting preview interface, which includes an image mode preview box. The image mode preview box may include multiple different image modes, which may refer to the filter effect of the image. Detecting the first operation on the first control may refer to detecting the operation of the user selecting the target style in the image mode preview box. An image mode may correspond to a mapping of a two-dimensional lookup table, that is, an image mode may correspond to a target two-dimensional lookup table.
结合第一方面,在第一方面的某些实现方式中,所述第一控件是指用于指示自动识别所述二维查找表中的第二映射。In conjunction with the first aspect, in some implementations of the first aspect, the first control refers to a second mapping used to instruct automatic identification of the two-dimensional lookup table.
在一种可能的实现方式中,第一界面可以是相机应用程序的设置界面,第一操作可以是指在设置界面中用户可以开启自动识别图像模式的操作;在自动识别图像模式功能开启后,相机可以根据拍摄场景自动识别确定目标风格,即可以是根据拍摄场景自动确定二维查找表中的第二映射。In one possible implementation, the first interface can be the settings interface of the camera application, and the first operation can refer to the user enabling the automatic image recognition mode in the settings interface; after the automatic image recognition mode function is enabled, the camera can automatically identify and determine the target style according to the shooting scene, that is, it can automatically determine the second mapping in the two-dimensional lookup table according to the shooting scene.
结合第一方面,在第一方面的某些实现方式中,所述根据所述第一映射和所述第二映射,对所述待处理图像进行处理,得到第一图像,包括:根据所述第一映射对所述待处理图像进行处理,得到第二图像;In conjunction with the first aspect, in some implementations of the first aspect, processing the image to be processed according to the first mapping and the second mapping to obtain a first image includes: processing the image to be processed according to the first mapping to obtain a second image;
根据所述第二图像与所述第二映射确定第一调整量与第二调整量,其中,所述第一调整量用于表示所述二图像中第一颜色分量的调整量,所述第二调整量用于表示所述第二图像中第二颜色分量的调整量;A first adjustment amount and a second adjustment amount are determined based on the second image and the second mapping, wherein the first adjustment amount is used to represent the adjustment amount of the first color component in the two images, and the second adjustment amount is used to represent the adjustment amount of the second color component in the second image;
根据所述第二图像、所述第一调整量与所述第二调整量得到所述第一图像。The first image is obtained based on the second image, the first adjustment amount, and the second adjustment amount.
结合第一方面,在第一方面的某些实现方式中,所述第一映射和所述第二映射相关联用于指示根据所述伽马处理中的第一映射确定所述二维查找表中的第二映射。In conjunction with the first aspect, in some implementations of the first aspect, the first mapping and the second mapping are associated to indicate the determination of the second mapping in the two-dimensional lookup table based on the first mapping in the gamma processing.
在本申请的实施例中,伽马处理中的第一映射与二维查找表中的第二映射是相关联的;即可以根据伽马处理中的第一映射进行二维查找表中的第二映射。In embodiments of this application, the first mapping in the gamma processing is associated with the second mapping in the two-dimensional lookup table; that is, the second mapping in the two-dimensional lookup table can be performed based on the first mapping in the gamma processing.
结合第一方面,在第一方面的某些实现方式中,所述根据所述伽马处理中的第一映射确定所述二维查找表中的第二映射,包括:In conjunction with the first aspect, in certain implementations of the first aspect, determining the second mapping in the two-dimensional lookup table based on the first mapping in the gamma processing includes:
获取所述伽马处理中的第三映射与三维查找表中的第四映射,所述三维查找表中的第四映射与所述二维查找表中的第二映射对应;Obtain the third mapping in the gamma processing and the fourth mapping in the three-dimensional lookup table, wherein the fourth mapping in the three-dimensional lookup table corresponds to the second mapping in the two-dimensional lookup table;
对第一颜色空间进行均匀划分,得到初始第一颜色空间的图像与初始第二颜色空间的图像;The first color space is uniformly divided to obtain an image in the initial first color space and an image in the initial second color space;
根据所述伽马处理的第一映射、所述伽马处理的第三映射、所述三维查找表中的第四映射对所述初始第二颜色空间的图像进行处理,得到第三图像,所述第三图像为所述第二颜色空间的图像;The image in the initial second color space is processed according to the first mapping of the gamma processing, the third mapping of the gamma processing, and the fourth mapping in the three-dimensional lookup table to obtain a third image, which is an image in the second color space.
将所述第三图像转换为所述第一颜色空间的第四图像;Convert the third image into a fourth image in the first color space;
根据所述初始第一颜色空间的图像与所述第一颜色空间的第四图像之间的像素差,确定所述二维查找表中的第二映射。The second mapping in the two-dimensional lookup table is determined based on the pixel difference between the image in the initial first color space and the fourth image in the first color space.
结合第一方面,在第一方面的某些实现方式中,所述根据所述初始第一颜色空间的图像与所述第一颜色空间的第三图像之间的像素差,确定所述二维查找表中的第二映射,包括:In conjunction with the first aspect, in some implementations of the first aspect, determining the second mapping in the two-dimensional lookup table based on the pixel difference between the image in the initial first color space and the third image in the first color space includes:
确定第一亮度值;Determine the first brightness value;
在亮度为所述第一亮度值时,所述根据所述初始第一颜色空间的图像与所述第一颜色空间的第四图像之间的像素差,确定所述二维查找表中的第二映射。When the brightness is the first brightness value, the second mapping in the two-dimensional lookup table is determined based on the pixel difference between the image in the initial first color space and the fourth image in the first color space.
应理解,过亮或者过暗的亮度值在图像中会引入较多的图像噪声,因此在确定第一亮度值时需要避免过亮与过暗的亮度值。It should be understood that excessively bright or dark brightness values will introduce more image noise into the image, so excessively bright or dark brightness values should be avoided when determining the first brightness value.
结合第一方面,在第一方面的某些实现方式中,所述第一颜色空间是指HSL颜色空间,或者HSV颜色空间;所述第二颜色空间是指RGB颜色空间。In conjunction with the first aspect, in some implementations of the first aspect, the first color space refers to the HSL color space or the HSV color space; the second color space refers to the RGB color space.
第二方面,提供了一种电子设备,所述电子设备包括:一个或多个处理器、存储器和显示屏;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:在第一拍摄模式下,显示第一界面,所述第一界面包括第一控件;检测到对所述第一控件的第一操作;响应于第一操作,确定伽马处理中的第一映射和二维查找表中的第二映射,所述第一映射与所述第一控件对应,所述第二映射与所述第一控件对应,所述第一映射和所述第二映射相关联;获取待处理图像;根据所述第一映射和所述第二映射,对所述待处理图像进行处理,得到第一图像。In a second aspect, an electronic device is provided, comprising: one or more processors, a memory, and a display screen; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform: in a first shooting mode, displaying a first interface, the first interface including a first control; detecting a first operation on the first control; in response to the first operation, determining a first mapping in gamma processing and a second mapping in a two-dimensional lookup table, the first mapping corresponding to the first control, the second mapping corresponding to the first control, and the first mapping and the second mapping being associated; acquiring an image to be processed; and processing the image to be processed according to the first mapping and the second mapping to obtain a first image.
结合第二方面,在第二方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors invoke the computer instructions to cause the electronic device to execute:
根据所述第一映射对所述待处理图像进行处理,得到第二图像;The image to be processed is processed according to the first mapping to obtain the second image;
根据所述第二图像与所述第二映射确定第一调整量与第二调整量,其中,所述第一调整量用于表示所述二图像中第一颜色分量的调整量,所述第二调整量用于表示所述第二图像中第二颜色分量的调整量;A first adjustment amount and a second adjustment amount are determined based on the second image and the second mapping, wherein the first adjustment amount is used to represent the adjustment amount of the first color component in the two images, and the second adjustment amount is used to represent the adjustment amount of the second color component in the second image;
根据所述第二图像、所述第一调整量与所述第二调整量得到所述第一图像。The first image is obtained based on the second image, the first adjustment amount, and the second adjustment amount.
结合第二方面,在第二方面的某些实现方式中,所述第一映射和所述第二映射相关联用于指示根据所述伽马处理中的第一映射确定所述二维查找表中的第二映射。In conjunction with the second aspect, in some implementations of the second aspect, the first mapping and the second mapping are associated to indicate the determination of the second mapping in the two-dimensional lookup table based on the first mapping in the gamma processing.
结合第二方面,在第二方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors invoke the computer instructions to cause the electronic device to execute:
获取所述伽马处理中的第三映射与三维查找表中的第四映射,所述三维查找表中的第四映射与所述二维查找表中的第二映射对应;Obtain the third mapping in the gamma processing and the fourth mapping in the three-dimensional lookup table, wherein the fourth mapping in the three-dimensional lookup table corresponds to the second mapping in the two-dimensional lookup table;
对第一颜色空间进行均匀划分,得到初始第一颜色空间的图像与初始第二颜色空间的图像;The first color space is uniformly divided to obtain an image in the initial first color space and an image in the initial second color space;
根据所述伽马处理的第一映射、所述伽马处理的第三映射、所述三维查找表中的第四映射对所述初始第二颜色空间的图像进行处理,得到第三图像,所述第三图像为所述第二颜色空间的图像;The image in the initial second color space is processed according to the first mapping of the gamma processing, the third mapping of the gamma processing, and the fourth mapping in the three-dimensional lookup table to obtain a third image, which is an image in the second color space.
将所述第三图像转换为所述第一颜色空间的第四图像;Convert the third image into a fourth image in the first color space;
根据所述初始第一颜色空间的图像与所述第一颜色空间的第四图像之间的像素差,确定所述二维查找表中的第二映射。The second mapping in the two-dimensional lookup table is determined based on the pixel difference between the image in the initial first color space and the fourth image in the first color space.
结合第二方面,在第二方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors invoke the computer instructions to cause the electronic device to execute:
确定第一亮度值;Determine the first brightness value;
在亮度为所述第一亮度值时,所述根据所述初始第一颜色空间的图像与所述第一颜色空间的第四图像之间的像素差,确定所述二维查找表中的第二映射。When the brightness is the first brightness value, the second mapping in the two-dimensional lookup table is determined based on the pixel difference between the image in the initial first color space and the fourth image in the first color space.
结合第二方面,在第二方面的某些实现方式中,所述第一颜色空间是指HSL颜色空间,或者HSV颜色空间;所述第二颜色空间是指RGB颜色空间。In conjunction with the second aspect, in some implementations of the second aspect, the first color space refers to the HSL color space or the HSV color space; the second color space refers to the RGB color space.
结合第二方面,在第二方面的某些实现方式中,所述第一拍摄模式是指图像的出帧率大于预设阈值的拍摄模式。In conjunction with the second aspect, in some implementations of the second aspect, the first shooting mode refers to a shooting mode in which the frame rate of the image is greater than a preset threshold.
结合第二方面,在第二方面的某些实现方式中,所述第一控件是指用于指示所述二维查找表中的第二映射表的控件。In conjunction with the second aspect, in some implementations of the second aspect, the first control refers to a control used to indicate the second mapping table in the two-dimensional lookup table.
结合第二方面,在第二方面的某些实现方式中,所述第一控件是指用于指示自动识别所述二维查找表中的第二映射表的控件。In conjunction with the second aspect, in some implementations of the second aspect, the first control refers to a control used to instruct the automatic identification of the second mapping table in the two-dimensional lookup table.
应理解,在上述第一方面中对相关内容的扩展、限定、解释和说明也适用于第二方面中相同的内容。It should be understood that the extensions, limitations, explanations and descriptions of the relevant content in the first aspect above also apply to the same content in the second aspect.
第三方面,提供了一种电子设备,所述电子设备包括:一个或多个处理器、存储器和显示屏;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行第一方面中的任一种图像处理方法。Thirdly, an electronic device is provided, comprising: one or more processors, a memory, and a display screen; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, wherein the one or more processors invoke the computer instructions to cause the electronic device to perform any of the image processing methods of the first aspect.
第四方面,提供了一种芯片系统,所述芯片系统应用于电子设备,所述芯片系统包括一个或多个处理器,所述处理器用于调用计算机指令以使得所述电子设备执行第一方面中的任一种图像处理方法。Fourthly, a chip system is provided, the chip system being applied to an electronic device, the chip system including one or more processors, the processors being configured to invoke computer instructions to cause the electronic device to perform any of the image processing methods in the first aspect.
第五方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序代码,当所述计算机程序代码被电子设备运行时,使得该电子设备执行第一方面中的任一种图像处理方法。Fifthly, a computer-readable storage medium is provided, the computer-readable storage medium storing computer program code, which, when executed by an electronic device, causes the electronic device to perform any of the image processing methods in the first aspect.
第六方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码被电子设备运行时,使得该电子设备执行第一方面中的任一种图像处理方法。In a sixth aspect, a computer program product is provided, the computer program product comprising: computer program code, which, when executed by an electronic device, causes the electronic device to perform any of the image processing methods in the first aspect.
在本申请的实施例中,电子设备响应于检测到的第一操作可以确定伽马处理中的第一映射和二维查找表中的第二映射;根据所述第一映射和所述第二映射,对待处理图像进行处理,得到第一图像;由于本申请实施例采用二维查找表中的第二映射与伽马处理中的第一映射对待处理图像进行图像,其中,第一映射与第二映射相关联;因此,与通过三维查找表对待处理图像进行处理相比,本申请的图像处理方法能够有效的降低电子设备的运算量。In embodiments of this application, the electronic device, in response to a detected first operation, can determine a first mapping in gamma processing and a second mapping in a two-dimensional lookup table; based on the first mapping and the second mapping, the image to be processed is processed to obtain a first image; since the embodiments of this application use the second mapping in the two-dimensional lookup table and the first mapping in gamma processing to process the image to be processed, wherein the first mapping is associated with the second mapping; therefore, compared with processing the image to be processed through a three-dimensional lookup table, the image processing method of this application can effectively reduce the computational load of the electronic device.
附图说明Attached Figure Description
图1是一种适用于本申请的装置的硬件系统的示意图;Figure 1 is a schematic diagram of a hardware system applicable to the device of this application;
图2是一种适用于本申请的装置的软件系统的示意图;Figure 2 is a schematic diagram of a software system applicable to the apparatus of this application;
图3是本申请实施例提供的应用场景的示意图;Figure 3 is a schematic diagram of the application scenario provided in the embodiments of this application;
图4是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 4 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图5是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 5 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图6是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 6 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图7是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 7 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图8是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 8 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图9是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 9 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图10是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 10 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图11是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 11 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图12是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 12 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图13是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 13 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图14是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 14 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图15是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 15 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图16是本申请实施例提供的图像处理器的处理流程的示意图;Figure 16 is a schematic diagram of the processing flow of the image processor provided in an embodiment of this application;
图17是本申请实施例提供的确定二维查找表的方法的示意图;Figure 17 is a schematic diagram of the method for determining a two-dimensional lookup table provided in an embodiment of this application;
图18是本申请实施例提供的一种图像处理方法的示意图;Figure 18 is a schematic diagram of an image processing method provided in an embodiment of this application;
图19是本申请实施例提供的一种图像处理方法的示意图;Figure 19 is a schematic diagram of an image processing method provided in an embodiment of this application;
图20是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 20 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图21是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 21 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图22是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 22 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图23是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 23 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图24是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 24 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图25是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 25 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图26是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 26 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图27是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 27 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图28是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 28 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图29是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 29 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图30是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 30 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图31是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 31 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图32是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 32 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图33是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 33 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图34是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 34 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图35是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 35 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图36是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 36 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图37是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 37 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图38是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 38 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图39是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 39 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图40是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 40 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图41是本申请实施例提供的一种电子设备的显示界面的示意图;Figure 41 is a schematic diagram of the display interface of an electronic device provided in an embodiment of this application;
图42是本申请实施例提供的一种图像处理方法的示意图;Figure 42 is a schematic diagram of an image processing method provided in an embodiment of this application;
图43是本申请实施例提供的一种图像处理装置的示意图;Figure 43 is a schematic diagram of an image processing apparatus provided in an embodiment of this application;
图44是本申请实施例提供的一种电子设备的示意图。Figure 44 is a schematic diagram of an electronic device provided in an embodiment of this application.
具体实施方式Detailed Implementation
下面将结合附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
图1示出了一种适用于本申请的电子设备的硬件系统。Figure 1 illustrates a hardware system for an electronic device applicable to this application.
电子设备100可以是手机、智慧屏、平板电脑、可穿戴电子设备、车载电子设备、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、投影仪等等,本申请实施例对电子设备100的具体类型不作任何限制。Electronic device 100 can be a mobile phone, smart screen, tablet computer, wearable electronic device, in-vehicle electronic device, augmented reality (AR) device, virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), projector, etc. This application embodiment does not limit the specific type of electronic device 100.
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
需要说明的是,图1所示的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图1所示的部件更多或更少的部件,或者,电子设备100可以包括图1所示的部件中某些部件的组合,或者,电子设备100可以包括图1所示的部件中某些部件的子部件。图1示的部件可以以硬件、软件、或软件和硬件的组合实现。It should be noted that the structure shown in FIG1 does not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than those shown in FIG1, or the electronic device 100 may include a combination of some of the components shown in FIG1, or the electronic device 100 may include sub-components of some of the components shown in FIG1. The components shown in FIG1 may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元。例如,处理器110可以包括以下处理单元中的至少一个:应用处理器(application processor,AP)、调制解调处理器、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、视频编解码器、数字信号处理器(digital signal processor,DSP)、基带处理器、神经网络处理器(neural-network processing unit,NPU)。其中,不同的处理单元可以是独立的器件,也可以是集成的器件。Processor 110 may include one or more processing units. For example, processor 110 may include at least one of the following processing units: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and neural network processing unit (NPU). The different processing units may be independent devices or integrated devices.
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。例如,处理器110可以包括以下接口中的至少一个:内部集成电路(inter-integrated circuit,I2C)接口、内部集成电路音频(inter-integrated circuit sound,I2S)接口、脉冲编码调制(pulse codemodulation,PCM)接口、通用异步接收传输器(universal asynchronous receiver/transmitter,UART)接口、移动产业处理器接口(mobile industry processor interface,MIPI)、通用输入输出(general-purpose input/output,GPIO)接口、SIM接口、USB接口。In some embodiments, processor 110 may include one or more interfaces. For example, processor 110 may include at least one of the following interfaces: an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a SIM interface, and a USB interface.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K、充电器、闪光灯、摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering phone calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.
MIPI接口可以被用于连接处理器110与显示屏194和摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI)、显示屏串行接口(displayserial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号接口,也可被配置为数据信号接口。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194、无线通信模块160、音频模块170和传感器模块180。GPIO接口还可以被配置为I2C接口、I2S接口、UART接口或MIPI接口。The GPIO interface can be configured via software. It can be configured as a control signal interface or a data signal interface. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display screen 194, wireless communication module 160, audio module 170, and sensor module 180. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, or MIPI interface.
USB接口130是符合USB标准规范的接口,例如可以是迷你(Mini)USB接口、微型(Micro)USB接口或C型USB(USB Type C)接口。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据,还可以用于连接耳机以通过耳机播放音频。USB接口130还可以用于连接其他电子设备100,例如AR设备。USB interface 130 is an interface compliant with USB standards, such as a Mini USB interface, a Micro USB interface, or a USB Type-C interface. USB interface 130 can be used to connect a charger to charge electronic device 100, to transfer data between electronic device 100 and peripheral devices, and to connect headphones for audio playback. USB interface 130 can also be used to connect other electronic devices 100, such as AR devices.
图1所示的各模块间的连接关系只是示意性说明,并不构成对电子设备100的各模块间的连接关系的限定。可选地,电子设备100的各模块也可以采用上述实施例中多种连接方式的组合。The connection relationships between the modules shown in Figure 1 are merely illustrative and do not constitute a limitation on the connection relationships between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of various connection methods described in the above embodiments.
充电管理模块140用于从充电器接收电力。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的电流。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收电磁波(电流路径如虚线所示)。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备100供电。The charging management module 140 receives power from a charger, which can be either a wireless or wired charger. In some wired charging embodiments, the charging management module 140 receives current from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives electromagnetic waves (current path shown as dashed lines) via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device 100 via the power management module 141.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量、电池循环次数和电池健康状态(例如,漏电、阻抗)等参数。可选地,电源管理模块141可以设置于处理器110中,或者,电源管理模块141和充电管理模块140可以设置于同一个器件中。The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (e.g., leakage current, impedance). Optionally, the power management module 141 can be located within the processor 110, or the power management module 141 and the charging management module 140 can be located in the same device.
电子设备100的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调处理器以及基带处理器等器件实现。The wireless communication function of electronic device 100 can be realized through devices such as antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
移动通信模块150可以提供应用在电子设备100上的无线通信的解决方案,例如下列方案中的至少一个:第二代(2th generation,2G)移动通信解决方案、第三代(3thgeneration,3G)移动通信解决方案、第四代(4th generation,5G)移动通信解决方案、第五代(5th generation,5G)移动通信解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波和放大等处理,随后传送至调制解调处理器进行解调。移动通信模块150还可以放大经调制解调处理器调制后的信号,放大后的该信号经天线1转变为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide a wireless communication solution applied to the electronic device 100, such as at least one of the following: a second -generation (2G) mobile communication solution, a third -generation (3G) mobile communication solution, a fourth -generation (5G) mobile communication solution, and a fifth - generation (5G) mobile communication solution. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via the antenna 1, and perform filtering and amplification on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor, and the amplified signal is converted into electromagnetic waves and radiated by the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(例如,扬声器170A、受话器170B)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. The modulator modulates a low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through audio devices (e.g., speaker 170A, receiver 170B) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
与移动通信模块150类似,无线通信模块160也可以提供应用在电子设备100上的无线通信解决方案,例如下列方案中的至少一个:无线局域网(wireless local areanetworks,WLAN)、蓝牙(bluetooth,BT)、蓝牙低功耗(bluetooth low energy,BLE)、超宽带(ultra wide band,UWB)、全球导航卫星系统(global navigation satellite system,GNSS)、调频(frequency modulation,FM)、近场通信(near field communication,NFC)、红外(infrared,IR)技术。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,并将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频和放大,该信号经天线2转变为电磁波辐射出去。Similar to the mobile communication module 150, the wireless communication module 160 can also provide a wireless communication solution for use on the electronic device 100, such as at least one of the following: wireless local area networks (WLAN), Bluetooth (BT), Bluetooth Low Energy (BLE), ultra-wideband (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technology. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification on them, and convert the signals into electromagnetic waves for radiation via antenna 2.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,电子设备100的天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络和其他电子设备通信。该无线通信技术可以包括以下通信技术中的至少一个:全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packetradio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-divisioncode division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,IR技术。该GNSS可以包括以下定位技术中的至少一个:全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigationsatellite system,GLONASS),北斗卫星导航系统(beidou navigation satellitesystem,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS),星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 of electronic device 100 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other electronic devices via wireless communication technology. This wireless communication technology may include at least one of the following communication technologies: Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and IR technologies. The GNSS may include at least one of the following positioning technologies: Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and Satellite Based Augmentation Systems (SBAS).
电子设备100可以通过GPU、显示屏194以及应用处理器实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。Electronic device 100 can implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
显示屏194可以用于显示图像或视频。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)、有源矩阵有机发光二极体(active-matrix organic light-emitting diode,AMOLED)、柔性发光二极管(flex light-emitting diode,FLED)、迷你发光二极管(mini light-emitting diode,Mini LED)、微型发光二极管(micro light-emitting diode,Micro LED)、微型OLED(Micro OLED)或量子点发光二极管(quantum dotlight emitting diodes,QLED)。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。Display screen 194 can be used to display images or videos. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini light-emitting diode (Mini LED), a micro light-emitting diode (Micro LED), a micro OLED (Micro OLED), or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
电子设备100可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP可以对图像的噪点、亮度和色彩进行算法优化,ISP还可以优化拍摄场景的曝光和色温等参数。在一些实施例中,ISP可以设置在摄像头193中。The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can perform algorithmic optimization of image noise, brightness, and color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的红绿蓝(red green blue,RGB),YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into a standard red-green-blue (RGB), YUV, or other image signal format. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1、MPEG2、MPEG3和MPEG4。Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record video in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, and MPEG 4.
NPU是一种借鉴生物神经网络结构的处理器,例如借鉴人脑神经元之间传递模式对输入信息快速处理,还可以不断地自学习。通过NPU可以实现电子设备100的智能认知等功能,例如:图像识别、人脸识别、语音识别和文本理解。An NPU (Neural Processing Unit) is a processor that borrows from the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, to rapidly process input information and continuously learn. NPUs can enable intelligent cognitive functions in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
外部存储器接口120可以用于连接外部存储卡,例如安全数码(secure digital,SD)卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external storage interface 120 can be used to connect an external memory card, such as a secure digital (SD) card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be stored on the external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能(例如,声音播放功能和图像播放功能)所需的应用程序。存储数据区可存储电子设备100使用过程中所创建的数据(例如,音频数据和电话本)。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如:至少一个磁盘存储器件、闪存器件和通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种处理方法。Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function (e.g., sound playback and image playback). The data storage area may store data created during the use of electronic device 100 (e.g., audio data and phonebook). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, and universal flash storage (UFS). Processor 110 executes various processing methods of electronic device 100 by running instructions stored in internal memory 121 and/or instructions stored in memory disposed in the processor.
电子设备100可以通过音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D以及应用处理器等实现音频功能,例如,音乐播放和录音。Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也可以用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170或者音频模块170的部分功能模块可以设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signals for output, and can also be used to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170, or some functional modules of the audio module 170, can be located in the processor 110.
扬声器170A,也称为喇叭,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐或免提通话。The speaker 170A, also known as a loudspeaker, is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.
受话器170B,也称为听筒,用于将音频电信号转换成声音信号。当用户使用电子设备100接听电话或语音信息时,可以通过将受话器170B靠近耳朵接听语音。The receiver 170B, also known as the earpiece, is used to convert audio electrical signals into sound signals. When a user uses electronic device 100 to answer a phone call or voice message, they can listen to the voice by bringing the receiver 170B close to their ear.
麦克风170C,也称为话筒或传声器,用于将声音信号转换为电信号。当用户拨打电话或发送语音信息时,可以通过靠近麦克风170C发声将声音信号输入麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个、四个或更多麦克风170C,以实现识别声音来源和定向录音等功能。处理器110可以对麦克风170C输出的电信号进行处理,例如,音频模块170与无线通信模块160可以通过PCM接口耦合,麦克风170C将环境声音转换为电信号(如PCM信号)后,通过PCM接口将该电信号传输至处理器110;从处理器110对该电信号进行音量分析和频率分析,确定环境声音的音量和频率。Microphone 170C, also known as a microphone or transducer, is used to convert sound signals into electrical signals. When a user makes a phone call or sends a voice message, they can input a sound signal into microphone 170C by speaking close to it. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C to achieve noise reduction. In other embodiments, electronic device 100 may also have three, four or more microphones 170C to achieve functions such as sound source identification and directional recording. Processor 110 can process the electrical signals output by microphone 170C. For example, audio module 170 and wireless communication module 160 may be coupled through a PCM interface. After microphone 170C converts ambient sound into an electrical signal (such as a PCM signal), it transmits the electrical signal to processor 110 through the PCM interface. Processor 110 performs volume and frequency analysis on the electrical signal to determine the volume and frequency of the ambient sound.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备100平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of theUSA,CTIA)标准接口。The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,例如可以是电阻式压力传感器、电感式压力传感器或电容式压力传感器。电容式压力传感器可以是包括至少两个具有导电材料的平行板,当力作用于压力传感器180A,电极之间的电容改变,电子设备100根据电容的变化确定压力的强度。当触摸操作作用于显示屏194时,电子设备100根据压力传感器180A检测所述触摸操作。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令;当触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. Pressure sensor 180A can be of many types, such as resistive pressure sensor, inductive pressure sensor, or capacitive pressure sensor. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes, and electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch operation based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS message is executed; when a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x轴、y轴和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。例如,当快门被按下时,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航和体感游戏等场景。The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, y-axis, and z-axis). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in scenarios such as navigation and motion-sensing games.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。电子设备100可以根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall effect sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. The electronic device 100 can set features such as automatic flip unlocking based on the detected opening and closing state of the cover or the flip cover.
加速度传感器180E可检测电子设备100在各个方向上(一般为x轴、y轴和z轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。加速度传感器180E还可以用于识别电子设备100的姿态,作为横竖屏切换和计步器等应用程序的输入参数。The accelerometer 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (typically the x-axis, y-axis, and z-axis). When the electronic device 100 is stationary, it can detect the magnitude and direction of gravity. The accelerometer 180E can also be used to identify the attitude of the electronic device 100, serving as input parameters for applications such as screen orientation switching and pedometers.
距离传感器180F用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,例如在拍摄场景中,电子设备100可以利用距离传感器180F测距以实现快速对焦。The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some embodiments, such as in a shooting scenario, the electronic device 100 can utilize the distance sensor 180F to measure distance for fast focusing.
接近光传感器180G可以包括例如发光二极管(light-emitting diode,LED)和光检测器,例如,光电二极管。LED可以是红外LED。电子设备100通过LED向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到反射光时,电子设备100可以确定附近存在物体。当检测不到反射光时,电子设备100可以确定附近没有物体。电子设备100可以利用接近光传感器180G检测用户是否手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式或口袋模式的自动解锁与自动锁屏。The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When reflected light is detected, the electronic device 100 can determine that an object is nearby. When no reflected light is detected, the electronic device 100 can determine that no object is nearby. The electronic device 100 can use the proximity sensor 180G to detect whether the user is holding the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used for automatic unlocking and automatic screen locking in folding or pocket modes.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现解锁、访问应用锁、拍照和接听来电等功能。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to perform functions such as unlocking, accessing application locks, taking photos, and answering calls.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.
触摸传感器180K,也称为触控器件。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,触摸屏也称为触控屏。触摸传感器180K用于检测作用于其上或其附近的触摸操作。触摸传感器180K可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,并且与显示屏194设置于不同的位置。Touch sensor 180K, also known as a touch device, can be disposed on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a touch screen. Touch sensor 180K is used to detect touch operations applied to or near it. Touch sensor 180K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be disposed on the surface of electronic device 100, and in a different location from display screen 194.
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.
按键190包括开机键和音量键。按键190可以是机械按键,也可以是触摸式按键。电子设备100可以接收按键输入信号,实现于案件输入信号相关的功能。Button 190 includes a power button and volume buttons. Button 190 can be a mechanical button or a touch button. Electronic device 100 can receive button input signals and implement functions related to the button input signals.
马达191可以产生振动。马达191可以用于来电提示,也可以用于触摸反馈。马达191可以对作用于不同应用程序的触摸操作产生不同的振动反馈效果。对于作用于显示屏194的不同区域的触摸操作,马达191也可产生不同的振动反馈效果。不同的应用场景(例如,时间提醒、接收信息、闹钟和游戏)可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibrations. Motor 191 can be used for incoming call notifications or for haptic feedback. Motor 191 can produce different vibration feedback effects for touch operations applied to different applications. Motor 191 can also produce different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenarios (e.g., time reminders, receiving messages, alarm clocks, and games) can correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
指示器192可以是指示灯,可以用于指示充电状态和电量变化,也可以用于指示消息、未接来电和通知。Indicator 192 can be an indicator light, which can be used to indicate charging status and power changes, or to indicate messages, missed calls and notifications.
SIM卡接口195用于连接SIM卡。SIM卡可以插入SIM卡接口195实现与电子设备100的接触,也可以从SIM卡接口195拔出实现与电子设备100的分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。同一个SIM卡接口195可以同时插入多张卡,所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用嵌入式SIM(embedded-SIM,eSIM)卡,eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into the SIM card interface 195 to make contact with the electronic device 100, or it can be removed from the SIM card interface 195 to detach from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. Multiple cards can be inserted into the same SIM card interface 195 simultaneously; the multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as voice calls and data communication. In some embodiments, the electronic device 100 uses an embedded SIM (eSIM) card, which can be embedded in the electronic device 100 and cannot be separated from it.
上文详细描述了电子设备100的硬件系统,下面介绍电子设备100的软件系统。软件系统可以采用分层架构、事件驱动架构、微核架构、微服务架构或云架构,本申请实施例以分层架构为例,示例性地描述电子设备100的软件系统。The hardware system of electronic device 100 has been described in detail above. The software system of electronic device 100 is described below. The software system can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes a layered architecture as an example to exemplarily describe the software system of electronic device 100.
如图2所示,采用分层架构的软件系统分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,软件系统可以分为四层,从上至下分别为应用程序层、应用程序框架层、安卓运行时(Android Runtime)和系统库、以及内核层。As shown in Figure 2, a layered architecture software system is divided into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into four layers, from top to bottom: the application layer, the application framework layer, the Android Runtime and system libraries, and the kernel layer.
应用程序层可以包括相机、图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频、短信息等应用程序。The application layer can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
应用程序框架层为应用程序层的应用程序提供应用程序编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层可以包括一些预定义的函数。The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer may include some predefined functions.
例如,应用程序框架层包括窗口管理器、内容提供器、视图系统、电话管理器、资源管理器和通知管理器。For example, the application framework layer includes a window manager, content providers, a view system, a phone manager, a resource manager, and a notification manager.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏、锁定屏幕和截取屏幕。The window manager is used to manage windowed applications. It can obtain the screen size, determine if a status bar is present, lock the screen, and capture the screen.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频、图像、音频、拨打和接听的电话、浏览历史和书签、以及电话簿。Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, and phone books.
视图系统包括可视控件,例如显示文字的控件和显示图片的控件。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成,例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views; for example, a display interface including a text notification icon can include views for displaying text and views for displaying images.
电话管理器用于提供电子设备100的通信功能,例如通话状态(接通或挂断)的管理。The phone manager is used to provide communication functions for electronic devices 100, such as the management of call status (connected or disconnected).
资源管理器为应用程序提供各种资源,比如本地化字符串、图标、图片、布局文件和视频文件。The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, and video files.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于下载完成告知和消息提醒。通知管理器还可以管理以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知。通知管理器还可以管理以对话窗口形式出现在屏幕上的通知,例如在状态栏提示文本信息、发出提示音、电子设备振动以及指示灯闪烁。The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of download completions and message alerts. The notification manager can also manage notifications that appear as icons or scrollbar text in the system's top status bar, such as notifications from background applications. Furthermore, the notification manager can manage notifications that appear on the screen as dialog boxes, such as text messages in the status bar, sound alerts, electronic device vibrations, and indicator light flashing.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。The Android Runtime consists of core libraries and a virtual machine. The Android Runtime is responsible for the scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理、堆栈管理、线程管理、安全和异常的管理、以及垃圾回收等功能。The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
系统库可以包括多个功能模块,例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:针对嵌入式系统的开放图形库(opengraphics library for embedded systems,OpenGL ES)和2D图形引擎(例如:skia图形库(skia graphics library,SGL))。The system library can include multiple functional modules, such as: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES for embedded systems) and 2D graphics engines (e.g., Skia graphics library (SGL)).
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D图层和3D图层的融合。The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
媒体库支持多种音频格式的回放和录制、多种视频格式回放和录制以及静态图像文件。媒体库可以支持多种音视频编码格式,例如:MPEG4、H.264、动态图像专家组音频层面3(moving picture experts group audio layer III,MP3)、高级音频编码(advancedaudio coding,AAC)、自适应多码率(adaptive multi-rate,AMR)、联合图像专家组(jointphotographic experts group,JPG)和便携式网络图形(portable network graphics,PNG)。The media library supports playback and recording of various audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, Moving Picture Experts Group Audio Layer III (MP3), Advanced Audio Coding (AAC), Adaptive Multi-rate (AMR), Joint Photographic Experts Group (JPG), and Portable Network Graphics (PNG).
三维图形处理库可以用于实现三维图形绘图、图像渲染、合成和图层处理。The 3D graphics processing library can be used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
二维图形引擎是2D绘图的绘图引擎。A 2D graphics engine is a graphics engine for 2D drawing.
内核层是硬件和软件之间的层。内核层可以包括显示驱动、摄像头驱动、音频驱动和传感器驱动等驱动模块。The kernel layer is the layer between hardware and software. It can include driver modules such as display drivers, camera drivers, audio drivers, and sensor drivers.
下面结合显示拍照场景,示例性说明电子设备100的软件系统和硬件系统的工作流程。The following example, using a photographing scenario, illustrates the workflow of the software and hardware systems of the electronic device 100.
当用户在触摸传感器180K上进行触摸操作时,相应的硬件中断被发送至内核层,内核层将触摸操作加工成原始输入事件,原始输入事件例如包括触摸坐标和触摸操作的时间戳等信息。原始输入事件被存储在内核层,应用程序框架层从内核层获取原始输入事件,识别出原始输入事件对应的控件,并通知该控件对应的应用程序(application,APP)。例如,上述触摸操作为单击操作,上述控件对应的APP为相机APP,相机APP被单击操作唤醒后,可以通过API调用内核层的摄像头驱动,通过摄像头驱动控制摄像头193进行拍摄。When a user touches the touch sensor 180K, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into raw input events, which include information such as touch coordinates and a timestamp of the touch operation. These raw input events are stored in the kernel layer. The application framework layer retrieves these raw input events from the kernel layer, identifies the corresponding control, and notifies the application (APP) that controls the control. For example, if the touch operation is a single click and the APP corresponding to the control is a camera APP, the camera APP, after being activated by the single click, can call the camera driver in the kernel layer via API to control the camera 193 to take a picture.
目前,在对图像进行处理时通常在ISP中使用3D LUT,在电子设备要实现3D LUT功能则需要进行颜色查找表的加载与三维插值的计算;颜色查找表是指离散的原始色彩数据和校正后色彩数据的三维映射表,比如,颜色数据可以由三个分量(如R、G、B分量)组成,通过在原始色彩数据的三个分量上等间隔的离散采样从而实现图像的颜色校正。但是,实现3D LUT功能对于电子设备的存储大小和运算能力均有较高的要求;在存储大小限制的情况,或者,有性能功耗约束的情况;比如,对于视频在慢动作模式下或者出帧率比较高的拍摄模式中,电子设备则无法满足使用3D LUT的要求。Currently, 3D LUTs are typically used in image processing ISPs. Implementing 3D LUT functionality in electronic devices requires loading color lookup tables and performing 3D interpolation calculations. A color lookup table is a 3D mapping table between discrete original color data and corrected color data. For example, color data can consist of three components (R, G, and B components), and color correction is achieved by discretely sampling these three components at equal intervals. However, implementing 3D LUT functionality places high demands on the storage capacity and computing power of electronic devices. In situations with storage limitations, or performance and power consumption constraints, such as slow-motion video or high frame rate shooting modes, electronic devices may not be able to meet the requirements for using 3D LUTs.
在本申请的实施例中,电子设备响应于检测到的第一操作可以确定伽马处理中的第一映射和二维查找表中的第二映射;根据所述第一映射和所述第二映射,对待处理图像进行处理,得到第一图像;由于本申请实施例采用二维查找表中的第二映射与伽马处理中的第一映射对待处理图像进行图像,其中,第一映射与第二映射相关联;因此,与通过三维查找表对待处理图像进行处理相比,本申请的图像处理方法能够有效的降低电子设备的运算量。In embodiments of this application, the electronic device, in response to a detected first operation, can determine a first mapping in gamma processing and a second mapping in a two-dimensional lookup table; based on the first mapping and the second mapping, the image to be processed is processed to obtain a first image; since the embodiments of this application use the second mapping in the two-dimensional lookup table and the first mapping in gamma processing to process the image to be processed, wherein the first mapping is associated with the second mapping; therefore, compared with processing the image to be processed through a three-dimensional lookup table, the image processing method of this application can effectively reduce the computational load of the electronic device.
下面结合本申请实施例的应用场景对本申请实施例的图像处理方法进行详细描述。The image processing method of this application embodiment will be described in detail below with reference to the application scenarios of this application.
示例性地,如图3所示,本申请的图像处理方法可以应用于图像颜色风格处理;例如,可以根据用户的需求对视频(或者图像)的颜色风格进行调整,从而实现图像的各种特殊效果。For example, as shown in FIG3, the image processing method of this application can be applied to image color style processing; for example, the color style of a video (or image) can be adjusted according to the user's needs to achieve various special effects of the image.
例如,可以获取原始图像帧,对原始图像帧进行图像处理得到目标图像帧;其中,原始图像帧可以是指RGB颜色空间的图像,根据LUT可以对原始图像帧进行图像处理得到目标图像帧;可以看作是某种函数,通过LUT可以将每个像素的色彩信息进行重新定位得到新的色彩值。For example, the original image frame can be obtained, and the target image frame can be obtained by image processing of the original image frame; where the original image frame can refer to an image in RGB color space, and the target image frame can be obtained by image processing of the original image frame according to LUT; it can be regarded as a kind of function, through which the color information of each pixel can be repositioned to obtain a new color value.
下面结合图4至图42对本申请实施例提供的图像处理方法进行详细描述。The image processing method provided in the embodiments of this application will be described in detail below with reference to Figures 4 to 42.
应用场景一:根据二维查找表对图像帧进行处理得的目标图像帧;比如,在相机中选择2D LUT对应的图像颜色风格进行视频拍摄。Application Scenario 1: Target image frame obtained by processing image frames according to a two-dimensional lookup table; for example, selecting the image color style corresponding to the 2D LUT in a camera for video recording.
应理解,图像风格可以是指相机界面中的滤镜效果。It should be understood that image style can refer to filter effects in the camera interface.
在一个示例中,本申请实施例提供的图像处理方法可以应用于视频拍摄;在拍摄视频时可以选择相机的慢动作模式,在慢动作模式中可以点击LUT,该LUT可以是指2D LUT;在2D LUT的预览界面中可以根据用户需求选择目标图像风格,相机根据目标图像风格可以实时拍摄视频得的目标视频。In one example, the image processing method provided in this application embodiment can be applied to video shooting; when shooting video, the slow motion mode of the camera can be selected, and in the slow motion mode, a LUT can be clicked, which can refer to a 2D LUT; in the preview interface of the 2D LUT, the target image style can be selected according to the user's needs, and the camera can shoot the target video in real time according to the target image style.
示例性地,图4示出了电子设备的一种图形用户界面(graphical userinterface,GUI),该GUI为电子设备的桌面210。当电子设备检测到用户点击桌面210上的相机应用(application,APP)的图标220的操作后,可以启动相机应用,显示如图5所示的另一GUI;图5所示的GUI可以是相机APP在拍照模式下的显示界面,在GUI可以包括拍摄界面230;拍摄界面230上可以包括取景框231与拍摄控件;比如,拍摄界面230中可以包括用于指示拍摄的控件232。在预览状态下,该取景框231内可以实时显示预览图像;其中,预览状态下可以是指用户打开相机且未按下拍照/录像按钮之前,此时取景框内可以实时显示预览图。For example, Figure 4 illustrates a graphical user interface (GUI) of an electronic device, which is the desktop 210 of the electronic device. When the electronic device detects that the user clicks the icon 220 of the camera application (APP) on the desktop 210, it can launch the camera application and display another GUI as shown in Figure 5. The GUI shown in Figure 5 can be the display interface of the camera APP in shooting mode, and the GUI can include a shooting interface 230. The shooting interface 230 can include a viewfinder 231 and shooting controls; for example, the shooting interface 230 can include controls 232 for indicating shooting. In preview mode, the preview image can be displayed in real time within the viewfinder 231; wherein, preview mode can refer to the state before the user opens the camera and does not press the photo/video button, at which time the preview image can be displayed in real time within the viewfinder.
应理解,在拍照模式和录像模式下,取景框231的大小可以相同,也可以不同。例如,取景框231可以为拍照模式下的取景框;在录像模式下,取景框231也可以为整个显示屏。It should be understood that the size of the viewfinder 231 can be the same or different in photo mode and video mode. For example, the viewfinder 231 can be the viewfinder in photo mode; in video mode, the viewfinder 231 can also be the entire display screen.
在相机应用启动后,可以显示拍照模式界面;电子设备可以检测到用户点击慢动作模式的操作,响应于用户的操作电子设备进入慢动作模式,如图5所示;拍摄界面230中还可以包括慢动作选项,在电子设备检测到用户点击慢动作选项后,可以显示如图8所示的界面。After the camera application is launched, the shooting mode interface can be displayed; the electronic device can detect the user's operation of clicking the slow motion mode, and in response to the user's operation, the electronic device enters the slow motion mode, as shown in Figure 5; the shooting interface 230 can also include a slow motion option, and after the electronic device detects the user's click on the slow motion option, the interface shown in Figure 8 can be displayed.
在一个示例中,如图6所示在拍摄模式下,拍摄界面230中还可以包括更多选项234;在电子设备检测到用户点击更多选项234的操作后,显示如图7所示的设置界面;在设置界面中可以包括慢动作、高像素等选项;根据用户的拍摄需求,在设置界面点击慢动作选项235,显示如图8所示的界面;即相机进入慢动作模式。In one example, as shown in Figure 6, the shooting interface 230 in shooting mode may also include more options 234; after the electronic device detects the user's operation of clicking more options 234, the settings interface shown in Figure 7 is displayed; the settings interface may include options such as slow motion and high resolution; according to the user's shooting needs, clicking the slow motion option 235 in the settings interface displays the interface shown in Figure 8; that is, the camera enters slow motion mode.
如图8所示,在相机的慢动作模式下,拍摄界面230中还可以包括LUT选项236;电子设备检测到用户点击LUT选项236的操作,显示如图9所示的界面;拍摄界面可以显示多个不同图像风格(又可以称为滤镜效果)的预览框237,预览框237中可以包括风格1、风格2、风格3以及其他图像风格;图像风格可以包括但不限于:青橙风格、温暖阳光风格、发光风格、赛博朋克风格等图像风格。As shown in Figure 8, in the slow-motion mode of the camera, the shooting interface 230 may also include a LUT option 236; the electronic device detects the user's click on the LUT option 236 and displays the interface shown in Figure 9; the shooting interface can display multiple preview frames 237 with different image styles (also known as filter effects), and the preview frames 237 may include style 1, style 2, style 3 and other image styles; the image styles may include, but are not limited to: orange-green style, warm sunlight style, glowing style, cyberpunk style and other image styles.
应理解,图9所示可以为电子设备在竖屏状态下LUT模式的拍摄界面;图10所示可以为电子设备在横屏状态下LUT模式的拍摄界面;电子设备可以根据用户使用电子设备的状态确定竖屏显示或者横屏显示。It should be understood that Figure 9 shows the shooting interface of the electronic device in portrait mode LUT mode; Figure 10 shows the shooting interface of the electronic device in landscape mode LUT mode; the electronic device can determine whether to display in portrait or landscape mode according to the user's state of using the electronic device.
还应理解,图9与图10中对预览框237中显示的图像风格进行了举例说明;预览框中还可以包括其他图像风格,上述图像风格的名称为举例说明,本申请对此不作任何限定。It should also be understood that Figures 9 and 10 provide examples of the image styles displayed in preview box 237; other image styles may also be included in the preview box, and the names of the image styles mentioned above are for illustrative purposes only, and this application does not impose any limitations on them.
在一个示例中,以图11所示的拍摄界面进行举例描述,电子设备检测到用户点击预览框237中风格2,则在取景框231中显示风格2的预览图像,如图11所示;同理,用户也可以点击预览框237中其他的图像风格进行预览;在用户选择目标图像风格(即目标滤镜效果)后,取景框231中会显示目标图像风格对应的预览图像。如图12所示,用户确定目标图像风格后,电子设备检测到用户点击指示录像的控件;响应于用户的操作,电子设备开始进入录像,即电子设备进入视频拍摄。In one example, using the shooting interface shown in Figure 11 as an example, the electronic device detects that the user clicks on Style 2 in the preview box 237, and then displays the preview image of Style 2 in the viewfinder 231, as shown in Figure 11. Similarly, the user can also click on other image styles in the preview box 237 to preview. After the user selects a target image style (i.e., the target filter effect), the viewfinder 231 will display the preview image corresponding to the target image style. As shown in Figure 12, after the user confirms the target image style, the electronic device detects that the user clicks on the control indicating recording; in response to the user's operation, the electronic device starts recording, that is, the electronic device enters video shooting.
需要说明的是,在用户选择一个图像风格后,预览框231中显示的预览图像为与图像风格对应的图像。It should be noted that after the user selects an image style, the preview image displayed in preview box 231 is the image corresponding to the image style.
在一种可能的实现方式中,在慢动作模式下(第一拍摄模式的一个示例),电子设备可以显示第一界面,第一界面包括第一控件;检测到对所述第一控件的第一操作;响应于第一操作,电子设备可以确定伽马处理中的第一映射和二维查找表中的第二映射;其中,第一界面可以是指如图9所示的界面,第一控件可以是指用于指示风格2的控件;检测到对第一控件的第一操作可以是指如图11所示,检测到用户点击用于指示模式2的控件的操作;电子设备通过检测到对第一控件的第一操作可以确定如图11所示的模式2对应的目标二维查找表,即可以是指二维查找表中的第二映射。In one possible implementation, in slow-motion mode (an example of the first shooting mode), the electronic device can display a first interface, the first interface including a first control; detect a first operation on the first control; in response to the first operation, the electronic device can determine a first mapping in gamma processing and a second mapping in a two-dimensional lookup table; wherein, the first interface may refer to the interface shown in FIG9, the first control may refer to the control used to indicate style 2; detecting the first operation on the first control may refer to detecting the operation of the user clicking the control used to indicate mode 2, as shown in FIG11; the electronic device can determine the target two-dimensional lookup table corresponding to mode 2 as shown in FIG11 by detecting the first operation on the first control, that is, it may refer to the second mapping in the two-dimensional lookup table.
需要说明的是,上述以第二操作为点击操作为例进行举例说明;第二操作还可以是指通过语音指示选择第一控件的操作,或者,还可以包括其它的指示电子设备进行选择第一控件的行为。上述为举例说明,并不对本申请作任何限定。It should be noted that the above example uses a click operation as the second operation; the second operation can also refer to the operation of selecting the first control via voice instruction, or it can include other actions that instruct the electronic device to select the first control. The above is for illustrative purposes only and does not limit this application in any way.
在一个示例中,如图13所示拍摄界面中还可以包括用于指示停止或者暂停的控件;在拍摄视频的过程中,还可以通过点击抓拍控件抓拍图像,该抓拍图像的风格与拍摄视频所选取的风格相同。In one example, the shooting interface shown in Figure 13 may also include controls for indicating stop or pause; during video shooting, images can also be captured by clicking the capture control, and the style of the captured image is the same as the style selected for the video shooting.
示例性地,在用户选择一个目标图像风格后,拍摄界面中显示的预览图像可以整体切换至目标图像风格;如图9所示的拍摄界面中可以为原图模式的预览图像;图11所示的拍摄界面可以为风格2的预览图像。For example, after a user selects a target image style, the preview image displayed in the shooting interface can be switched to the target image style as a whole; the shooting interface shown in Figure 9 can be the preview image in the original image mode; the shooting interface shown in Figure 11 can be the preview image in style 2.
示例性地,在用户选择一个目标图像风格后,拍摄界面中的预览图像也可以部分区域切换至目标图像风格。For example, after a user selects a target image style, a portion of the preview image in the shooting interface can be switched to the target image style.
例如,如图14所示,在用户点击预览框237中的风格3时,电子设备可以根据取景框231中的预览图像识别预览图像中的目标对象与背景对象,将目标对象保持原图模式的图像风格对背景对象进行风格3处理;比如,电子设备可以根据不同对象与电子设备之间的距离确定目标对象与背景对象;如图14所示,取景框231中可以包括目标对象238与背景对象239,在检测到用户选择风格3后,可以对背景对象进行风格3处理,显示如图15的界面;用户确定风格3后,电子设备检测到用户点击指示录像的控件;响应于用户的操作,电子设备开始进入录像,即采用风格3进行视频拍摄。For example, as shown in Figure 14, when the user clicks on Style 3 in the preview box 237, the electronic device can identify the target object and background object in the preview image based on the preview image in the viewfinder 231, and process the background object with Style 3 while keeping the target object in its original image style. For example, the electronic device can determine the target object and background object based on the distance between different objects and the electronic device. As shown in Figure 14, the viewfinder 231 can include the target object 238 and the background object 239. After detecting that the user has selected Style 3, the background object can be processed with Style 3, and the interface shown in Figure 15 can be displayed. After the user confirms Style 3, the electronic device detects that the user has clicked the control indicating recording. In response to the user's operation, the electronic device starts recording, that is, it uses Style 3 to shoot the video.
需要说明的是,上述图11至图15是根据用户的选择确定一个目标图像风格;在一种可能的实现方式中,电子设备也可以根据识别的拍摄场景自动确定一个目标图像风格。例如,可以对相机设置人工智能(Artificial Intelligence,AI)调色模式,使得电子设备在拍摄视频或者图像时,根据识别的拍摄场景自动确定目标图像风格。It should be noted that Figures 11 to 15 above show the determination of a target image style based on the user's selection; in one possible implementation, the electronic device can also automatically determine a target image style based on the identified shooting scene. For example, an Artificial Intelligence (AI) color grading mode can be set for the camera, enabling the electronic device to automatically determine the target image style based on the identified shooting scene when shooting videos or images.
在一种可能的实现方式中,在慢动作模式下(第一拍摄模式的一个示例),电子设备可以显示第一界面,第一界面包括第一控件;检测到对所述第一控件的第一操作;响应于第一操作,电子设备可以确定伽马处理中的第一映射和二维查找表中的第二映射;其中,第一界面可以是指相机应用程序的设置界面;第一控件可以是指AI电影调色的控件;检测到对第一控件的第一操作可以是指电子设备检测到根据识别拍摄场景确定图像风格的操作。In one possible implementation, in slow-motion mode (an example of a first shooting mode), the electronic device may display a first interface, the first interface including a first control; detect a first operation on the first control; in response to the first operation, the electronic device may determine a first mapping in gamma processing and a second mapping in a two-dimensional lookup table; wherein, the first interface may refer to the settings interface of a camera application; the first control may refer to the control for AI movie color grading; detecting the first operation on the first control may refer to the electronic device detecting an operation to determine the image style based on the identified shooting scene.
应理解,上述用户用于指示录像行为的操作可以包括用户点击录像的控件,也可以包括用户设备通过语音指示电子设备进行录像行为,或者,还可以包括用户其它的指示电子设备进行录像行为。上述为举例说明,并不对本申请作任何限定。It should be understood that the user's actions to instruct recording may include clicking a recording control, the user device instructing the electronic device to record via voice, or other user-instructed actions to record. The above are illustrative examples and do not constitute any limitation on this application.
上述结合图4至图15对用户在电子设备上进行操作的图形显示界面进行了描述,下面结合图16至图19对电子设备运行的图像处理算法进行描述。The above describes the graphical display interface for user operation on the electronic device in conjunction with Figures 4 to 15. The following describes the image processing algorithm running on the electronic device in conjunction with Figures 16 to 19.
图16是本申请实施例提供的图像处理器的处理流程的示意图。Figure 16 is a schematic diagram of the processing flow of the image processor provided in an embodiment of this application.
其中,图像传感器201用于根据光电器件的光电转换功能将感光面上的光像转换为与光像成相应比例关系的电信号。The image sensor 201 is used to convert the light image on the photosensitive surface into an electrical signal that is proportional to the light image, based on the photoelectric conversion function of the optoelectronic device.
坏点校正202(Defect Pixel Correction,DPC)用于解决传感器上光线采集的点形成的阵列所存在的缺陷,或者光信号进行转化的过程中存在的错误;通常通过在亮度域上取其他周围像素点均值来消除坏点。Defect Pixel Correction (DPC) is used to correct defects in the array of points that collect light on a sensor, or errors that occur during the conversion of light signals; it is usually done by averaging the values of surrounding pixels in the brightness domain to eliminate defective pixels.
黑电平校正203(Black Level Correction,BLC)用于对黑电平进行校正处理,黑电平是指在经过一定校准的显示装置上,没有一行光亮输出的视频信号电平。进行黑电平校正的原因在于:一方面由于图像传感器存在暗电流,导致在没有光照的情况下像素也存在电压输出的问题;另一方面,由于图像传感器进行模数转换时精度不够;例如,以8比特(bit)为例,每个像素有效范围是0至255,图像传感器可能无法将接近于0的信息转化出来;根据用户的视觉特性(对暗处细节比较敏感),图像传感器的厂商一般会在模数转换时增加一个固定的偏移量使输出的像素在5(非固定值)至255之间,然后传输至ISP处理进行减法处理,将像素5(非固定值)调整至0,使得每个像素有效范围为0至255。Black Level Correction (BLC) is used to correct black levels, which refer to the video signal level on a calibrated display device where no line of light is output. The reasons for performing black level correction are twofold: firstly, image sensors have dark current, causing pixels to output voltage even in the absence of light; secondly, image sensors lack precision during analog-to-digital conversion. For example, with 8 bits, the effective range of each pixel is 0 to 255, and the image sensor may not be able to convert information close to 0. Based on users' visual characteristics (sensitivity to details in dark areas), image sensor manufacturers typically add a fixed offset during analog-to-digital conversion to ensure the output pixel value is between 5 (not a fixed value) and 255. This offset is then sent to the ISP for subtraction, adjusting pixel 5 (not a fixed value) to 0, thus ensuring the effective range of each pixel is 0 to 255.
降噪204用于减少图像中的噪声;图像中存在的噪声会影响用户的视觉体验,通过降噪可以在一定程度上提高图像的图像质量。Noise Reduction 204 is used to reduce noise in images; noise in images can affect the user's visual experience, and noise reduction can improve image quality to a certain extent.
镜头阴影校正205(Lens Shading Correction,LSC)用于消除由于镜头光学系统原因造成的图像四周颜色以及亮度与图像中心不一致的问题。Lens Shading Correction (LSC) is used to eliminate inconsistencies in color and brightness around the edges of an image compared to the center, caused by lens optics.
自动白平衡206(Auto White Balance,AWB)用于使得白色在任何色温下相机均能把它还原成白;由于色温的影响,白纸在低色温下会偏黄,高色温下会偏蓝;白平衡的目的在于使得白色物体在任何色温下均为R=G=B呈现出白色。Auto White Balance (AWB) 206 is used to ensure that the camera can reproduce white as white at any color temperature. Due to the influence of color temperature, white paper will appear yellowish at low color temperatures and bluish at high color temperatures. The purpose of white balance is to ensure that white objects appear white at any color temperature with R=G=B.
颜色插值207用于使每个像素上同时包含RGB三个分量。Color interpolation 207 is used to ensure that each pixel contains all three components (RGB).
色彩校正208(Color Correction Matrix,CCM),用于校准除白色以外其他颜色的准确度的。伽马处理209用于通过调整伽马曲线来调整图像的亮度,对比度,动态范围等。二维查找表与三维查找表210用于图像颜色校正;其中,查找表可以视为某种函数,每个像素的色彩信息经过查找表映射后可以得到新的色彩值;RGB转换为YUV 211是指将通过查找表映射得到的色彩值转换为亮度以及色度表示;其中,Y表示明亮度(Luminance或Luma),也就是灰阶值;U和V表示的则是色度(Chrominance或Chroma)。Color Correction Matrix (CCM) 208 is used to calibrate the accuracy of colors other than white. Gamma Processing 209 is used to adjust the brightness, contrast, dynamic range, etc. of an image by adjusting the gamma curve. Two-dimensional and three-dimensional lookup tables 210 are used for image color correction; the lookup table can be regarded as a function, and the color information of each pixel can be mapped to obtain a new color value after being mapped by the lookup table; RGB to YUV conversion 211 refers to converting the color values obtained by mapping through the lookup table into luminance and chrominance representations; where Y represents luminance (Luminance or Luma), that is, grayscale value; U and V represent chrominance (Chrominance or Chroma).
需要说明的是,本申请实施例提供的图像处理方法可以应用于伽马处理209以及二维查找表/三维查找表210的处理流程中。It should be noted that the image processing method provided in this application embodiment can be applied to the processing flow of gamma processing 209 and two-dimensional lookup table/three-dimensional lookup table 210.
图17是本申请实施例提供的构建二维查找表的方法的示意图。Figure 17 is a schematic diagram of a method for constructing a two-dimensional lookup table provided in an embodiment of this application.
应理解,如图17所示三维通路表示通过3D LUT对原始图像帧进行图像处理得到第一目标图像帧;二维通路表示通过2D LUT对原始图像帧进行图像处理得到第二目标图像帧。在本申请的实施例中,在受限于电子设备性能的场景下,通过二维通路进行图像处理能够使得第二目标图像帧与第一目标图像帧的图像颜色与图像风格接近或者相同;其中,第一目标图像帧与第二目标图像帧可以是指RGB颜色空间的图像帧。It should be understood that, as shown in Figure 17, the three-dimensional path represents the image processing of the original image frame using a 3D LUT to obtain the first target image frame; the two-dimensional path represents the image processing of the original image frame using a 2D LUT to obtain the second target image frame. In the embodiments of this application, under scenarios limited by the performance of electronic devices, image processing through a two-dimensional path can make the image color and image style of the second target image frame similar to or the same as those of the first target image frame; wherein, the first target image frame and the second target image frame can refer to image frames in the RGB color space.
示例性地,如图17所示,为了使得第二目标图像帧与第一目标图像帧的图像颜色与图像风格接近或者相同,根据获取的第二伽马处理(伽马处理的第三映射的一个示例)的函数与三维查找表可以确定第一伽马处理(伽马处理的第一映射的一个示例)的函数与二维查找表。For example, as shown in Figure 17, in order to make the image color and image style of the second target image frame similar or the same as those of the first target image frame, the function of the first gamma processing (an example of the first mapping of gamma processing) and the two-dimensional lookup table can be determined based on the function of the second gamma processing (an example of the third mapping of gamma processing) and the three-dimensional lookup table.
例如,构建二维查找表的过程包括以下步骤:For example, the process of constructing a two-dimensional lookup table includes the following steps:
步骤一:获取数据;比如,将色相、饱和度、亮度(Hue Saturation Lightness,HSL)颜色空间均匀地划分成H*S*L的格点(例如,色相方向的格点数量=25,饱和度方向的格点数量=17,亮度方向的格点数量=257),生成对应的初始HSL图像(初始第一颜色空间的图像的一个示例)和初始RGB图像(初始第二颜色空间的图像的一个示例);Step 1: Acquire data; for example, evenly divide the Hue, Saturation, and Lightness (HSL) color space into H*S*L grid points (e.g., number of grid points in the Hue direction = 25, number of grid points in the Saturation direction = 17, number of grid points in the Lightness direction = 257), and generate the corresponding initial HSL image (an example of an initial first color space image) and initial RGB image (an example of an initial second color space image);
步骤二:初始RGB图像可以是三维通路中B1节点处的RGB图像;根据一个三维查找表(三维查找表中第四映射的一个示例)对B1节点处的RGB图像进行颜色校正处理,得到C1节点处的RGB图像,即第一目标RGB图像;Step 2: The initial RGB image can be the RGB image at node B1 in the 3D path; perform color correction processing on the RGB image at node B1 according to a 3D lookup table (an example of the fourth mapping in the 3D lookup table) to obtain the RGB image at node C1, which is the first target RGB image;
步骤三:对B1节点处的RGB图像进行反第二伽马处理,得到A1节点对应的RGB图像;Step 3: Perform inverse second gamma processing on the RGB image at node B1 to obtain the RGB image corresponding to node A1;
步骤四:对于二维通路,获取A1节点处的RGB图像,提取A1节点处的RGB图像的灰色像素(即色相=0,饱和度=0的像素)作为A2节点处的RGB图像的灰色像素将A2节点处的灰色像素作为输入数据,将C1节点处RGB图像对应位置的像素作为输出数据,其中,对应位置是指在根据三维查找表进行映射之前灰色像素的位置;分别对点进行拟合,拟合得到的三条曲线即为r、g、b三通道对应的伽马曲线,即得到第一伽马处理对应的参数;Step 4: For the two-dimensional path, acquire the RGB image at node A1, extract the gray pixels (i.e., pixels with hue = 0 and saturation = 0) of the RGB image at node A1 as the gray pixels of the RGB image at node A2. Use the gray pixels at node A2 as input data, and use the pixels at the corresponding positions of the RGB image at node C1 as output data. Here, the corresponding position refers to the position of the gray pixel before mapping according to the three-dimensional lookup table. Fit the points respectively, and the three curves obtained by fitting are the gamma curves corresponding to the r, g, and b channels, which are the parameters corresponding to the first gamma processing.
步骤五:将步骤一中生成的初始RGB图像作为B2节点的RGB图像,对该图像进行反第一伽马处理,得到A2节点处的RGB图像;将A2节点处的RGB图像作为A1节点处的RGB图像,再对A1节点处的RGB图像进行第二伽马处理,得到B1节点处的RGB图像;对B1节点处的RGB图像进行三维查找表处理,得到C1节点处的RGB图像;将C1节点处的RGB图像(第三图像的一个示例)转换到HSL颜色空间(第二颜色空间的一个示例),得到C1节点处的HSL图像(第四图像的一个示例);将步骤一中生成的初始HSL图像作为B2节点的HSL图像,将B2节点处的HSL图像作为输入数据,将C1节点处的HSL图像作为输出数据,计算与之间的差,得到关于色相以及饱和度对应的二维查找表。Step 5: Using the initial RGB image generated in Step 1 as the RGB image of node B2, perform inverse first gamma processing on this image to obtain the RGB image at node A2; using the RGB image at node A2 as the RGB image at node A1, and then performing second gamma processing on the RGB image at node A1 to obtain the RGB image at node B1; performing three-dimensional lookup table processing on the RGB image at node B1 to obtain the RGB image at node C1; converting the RGB image at node C1 (an example of the third image) to the HSL color space (an example of the second color space) to obtain the HSL image at node C1 (an example of the fourth image); using the initial HSL image generated in Step 1 as the HSL image of node B2, using the HSL image at node B2 as input data, and using the HSL image at node C1 as output data, calculate the difference between them to obtain a two-dimensional lookup table corresponding to hue and saturation.
在一个示例中,可以计算与之间的差,得到初始HSL图像对应的色相调整量、饱和度调整量以及亮度调整量,记为根据并对亮度值进行固定,得到关于色相以及饱和度对应的二维查找表。In one example, the difference between and can be calculated to obtain the hue adjustment, saturation adjustment, and brightness adjustment corresponding to the initial HSL image, denoted as . Based on and fixing the brightness value, a two-dimensional lookup table corresponding to hue and saturation can be obtained.
在一个示例中,可以在固定亮度值的情况下,计算与之间色相与饱和度的差,得到关于色相以及饱和度对应的二维查找表。In one example, with a fixed brightness value, the difference between hue and saturation can be calculated to obtain a two-dimensional lookup table for hue and saturation.
例如,在HSL颜色空间中固定亮度值,色相可以对应一个二维查找表;该色相对应的二维查找表的横坐标可以表示色相,纵坐标可以表示饱和度;二维表中的每个数值可以表示该色相与该饱和度下的色相的调整量,如表1所示。For example, in the HSL color space, with a fixed brightness value, the hue can correspond to a two-dimensional lookup table; the horizontal axis of the two-dimensional lookup table corresponding to this hue can represent the hue, and the vertical axis can represent the saturation; each value in the two-dimensional table can represent the adjustment amount of the hue and the hue at that saturation, as shown in Table 1.
表1Table 1
例如,在HSL颜色空间中固定亮度值,饱和度可以对应一个二维查找表;该饱和度对应的二维查找表的横坐标可以表示色相,纵坐标可以表示饱和度二维表中的每个数值可以表示该色相与该饱和度下的饱和度的调整量,如表2所示。For example, in the HSL color space, with a fixed brightness value, saturation can correspond to a two-dimensional lookup table; the horizontal axis of the two-dimensional lookup table corresponding to this saturation can represent hue, and the vertical axis can represent saturation. Each value in the two-dimensional lookup table can represent the adjustment amount of saturation for that hue and that saturation level, as shown in Table 2.
表2Table 2
在一个示例中,假设i=0~24,j=0~16,k=0~256;取k=128(即亮度=0.5,数据范围0.0~1.0);即在亮度值固定的情况下,取对应的即为二维查找表对应坐标位置的色相调整量与饱和度调整量。In one example, assume i = 0~24, j = 0~16, k = 0~256; take k = 128 (i.e., brightness = 0.5, data range 0.0~1.0); that is, with the brightness value fixed, the corresponding hue adjustment and saturation adjustment are taken as the coordinate positions of the two-dimensional lookup table.
应理解,在对亮度值进行固定取值时也可以取其他亮度值;但是,需要尽量避免过亮与过暗的亮度值,因为3D LUT可能会因为噪声或者过曝等问题对过暗或者过亮的像素进行一些其他调整。It should be understood that other brightness values can be used when a fixed brightness value is selected; however, excessively bright or dark brightness values should be avoided as much as possible, because 3D LUTs may make other adjustments to overly dark or overly bright pixels due to noise or overexposure.
还应理解,上述构建二维查找表的过程是在HSL颜色空间进行的;同理,还可以在色相、饱和度、明度(Hue Saturation Value,HSV)颜色空间进行处理,其中H表示色相、S表示饱和度、V表示明度。It should also be understood that the process of constructing the two-dimensional lookup table described above is carried out in the HSL color space; similarly, it can also be carried out in the Hue, Saturation, and Value (HSV) color space, where H represents hue, S represents saturation, and V represents value.
图18是本申请实施例提供的图像处理方法的示意性流程图。该方法300包括步骤S310至步骤S340,下面分别对这些步骤进行详细的描述。Figure 18 is a schematic flowchart of an image processing method provided in an embodiment of this application. The method 300 includes steps S310 to S340, which are described in detail below.
应理解,图18中所示的第一伽马处理、二维查找表处理与图17所示的第一伽马处理以及二维查找表处理相同;即通过如图17所示的方法可以确定第一伽马处理对应的参数与二维查找表。It should be understood that the first gamma processing and the two-dimensional lookup table processing shown in Figure 18 are the same as those shown in Figure 17; that is, the parameters and the two-dimensional lookup table corresponding to the first gamma processing can be determined by the method shown in Figure 17.
步骤S310、获取待处理图像帧(待处理图像的一个示例)。Step S310: Obtain the image frame to be processed (an example of the image to be processed).
示例性地,待处理图像帧可以是电子设备通过摄像头实时拍摄到的图像;该实时拍摄的图像可以是指CCM 208输出的图像。For example, the image frame to be processed can be an image captured in real time by an electronic device through a camera; the real-time captured image can refer to the image output by the CCM 208.
应理解,待处理图像帧可以是指具有颜色校正需求的图像。It should be understood that the image frame to be processed can refer to an image that requires color correction.
步骤S320、对待处理图像帧进行第一伽马处理(伽马处理的第一映射的一个示例)。Step S320: Perform first gamma processing on the image frame to be processed (an example of the first mapping of gamma processing).
示例性地,根据图17中步骤四中拟合得到的三条曲线即为r、g、b三通道对应的伽马曲线,对待处理RGB图像进行第一伽马处理。For example, the three curves obtained by fitting in step four of Figure 17 are the gamma curves corresponding to the three channels r, g, and b, and the first gamma processing is performed on the RGB image to be processed.
进一步地,可以将第一伽马处理后的图像从RGB颜色空间转换到HSL颜色空间。Furthermore, the image after the first gamma processing can be converted from the RGB color space to the HSL color space.
步骤S330、二维查找表处理(二维查找表的第二映射的一个示例)。Step S330, Two-dimensional lookup table processing (an example of the second mapping of a two-dimensional lookup table).
示例性地,根据上述图17所示的方法可以生成不同图像风格对应的二维查找表;此处,可以根据目标图像风格对应的二维查找表对待处理图像进行处理得到目标图像;其中,目标图像风格可以是根据用户确定的图像风格,或者,目标图像风格也可以是电子设备自动识别的图像风格。For example, a two-dimensional lookup table corresponding to different image styles can be generated according to the method shown in Figure 17 above; here, the image to be processed can be obtained by processing the image according to the two-dimensional lookup table corresponding to the target image style; wherein, the target image style can be an image style determined by the user, or the target image style can be an image style automatically recognized by the electronic device.
示例性地,根据二维查表可以得到调整量,从而得到颜色校正后的图像。For example, the adjustment amount can be obtained by looking up a two-dimensional table, thereby obtaining a color-corrected image.
在一个示例中,用户可以根据需求选择对待处理RGB图像进行颜色校正的图像风格,从而电子设备确定该图像风格对应的二维查找表;根据该二维查找表对待处理的RGB图像进行颜色校正。In one example, the user can select the image style for color correction of the RGB image to be processed according to their needs, so that the electronic device determines the two-dimensional lookup table corresponding to the image style; and performs color correction on the RGB image to be processed according to the two-dimensional lookup table.
在一个示例中,在电子设备上设置AI调色模式,则电子设备可以根据识别的拍摄场景自动确定目标图像风格;根据该目标图像风格对应的二维查找表对待处理的RGB图像进行颜色校正。In one example, by setting an AI color grading mode on an electronic device, the device can automatically determine the style of the target image based on the identified shooting scene; and then perform color correction on the RGB image to be processed according to the two-dimensional lookup table corresponding to the target image style.
在一个示例中,对于HSL颜色空间,可以固定L值,分别根据H对应的二维查找表与S对应的二维查找表,得到校正后的H值与校正后的S值;其中,校正后的H值可以是指在原始H值的基础上增加色相调整量ΔH;同理,校正后的S值是指在原始S值的基础上增加饱和度调整量ΔS,原始H值与原始S值是指将原始RGB像素转换为HSL颜色空间后得到的原始H值与原始S值,ΔH与ΔS是指通过二维查找表得到的。In one example, for the HSL color space, the L value can be fixed, and the corrected H value and corrected S value can be obtained respectively according to the two-dimensional lookup table corresponding to H and the two-dimensional lookup table corresponding to S. Here, the corrected H value can refer to the original H value with an added hue adjustment amount ΔH; similarly, the corrected S value refers to the original S value with an added saturation adjustment amount ΔS. The original H value and original S value refer to the original H value and original S value obtained after converting the original RGB pixels to the HSL color space, and ΔH and ΔS refer to the values obtained through the two-dimensional lookup table.
步骤S340、得到目标图像帧(第一图像的一个示例)。Step S340: Obtain the target image frame (an example of the first image).
例如,将步骤S330二维查找表处理后的HSL图像转换为RGB颜色空间得到目标RGB图像,该目标RGB图像可以是指目标图像帧。For example, the HSL image processed by the two-dimensional lookup table in step S330 is converted into the RGB color space to obtain the target RGB image, which can refer to the target image frame.
在一个示例中,目标图像帧可以是指根据用户选择的二维查找表对待处理图像进行颜色校正处理,得到的具备用户需求的图像效果的RGB图像。In one example, the target image frame can refer to an RGB image that has undergone color correction processing on the image to be processed according to a two-dimensional lookup table selected by the user, resulting in an image with the image effect required by the user.
在一个示例中,目标图像帧可以是指根据电子设备进行场景检测确定二维查找表,通过二维查找表对待处理图像进行颜色校正处理后得到的RGB图像。In one example, the target image frame can refer to the RGB image obtained after color correction processing of the image to be processed by determining a two-dimensional lookup table based on scene detection by an electronic device.
还应理解,上述通过图像进行举例描述;类似地,上述获取的也可以是待处理视频,可以对待处理视频中的每帧图像进行上述处理,得到目标视频。It should also be understood that the above description is based on images; similarly, the image obtained above can also be a video to be processed, and the above processing can be performed on each frame of the video to be processed to obtain the target video.
在本申请的实施例中,可以对三维查找表进行压缩得到与三维查找表的效果接近或者相同的二维查找表,通过该二维查找表对图像进行颜色校正可以实现与三维查找表相近的图像效果;在电子设备的性能受限的场景下,本申请实施例提供的图像处理方法能够满足用户的需求,实现图像的不同效果。In the embodiments of this application, a three-dimensional lookup table can be compressed to obtain a two-dimensional lookup table with an effect similar to or the same as that of a three-dimensional lookup table. Color correction of the image using this two-dimensional lookup table can achieve an image effect similar to that of a three-dimensional lookup table. In scenarios where the performance of electronic devices is limited, the image processing method provided in the embodiments of this application can meet the needs of users and achieve different image effects.
应用场景二:根据三维查找表与二维查找表获取目标视频;比如,在拍摄场景中根据不同的场景,可以在相机中切换3D LUT与2D LUT进行视频拍摄。Application Scenario 2: Obtaining target video based on 3D and 2D lookup tables; for example, in different shooting scenarios, the camera can switch between 3D LUT and 2D LUT for video shooting.
在一个示例中,本申请实施例提供的图像处理方法可以应用于视频拍摄;在拍摄视频时可以先选择相机的电影模式,在电影模式中可以点击3D LUT;在3D LUT的预览界面中可以根据用户需求选择目标图像风格,相机根据目标图像风格可以实时拍摄视频;在拍摄视频的过程中,对于电子设备的运算能力较弱的场景(比如,图像出帧率要求较高的场景),可以将相机的模式从电影模式切换至慢动作模式,在切换至慢动作模式后触发3D LUT切换至对应的2D LUT,从而继续进行视频拍摄得到目标视频。In one example, the image processing method provided in this application embodiment can be applied to video shooting. When shooting video, the camera's movie mode can be selected first, and a 3D LUT can be clicked in movie mode. In the preview interface of the 3D LUT, the target image style can be selected according to the user's needs, and the camera can shoot video in real time according to the target image style. During the video shooting process, for scenarios where the computing power of electronic devices is weak (e.g., scenarios where the image frame rate requirement is high), the camera mode can be switched from movie mode to slow motion mode. After switching to slow motion mode, the 3D LUT is triggered to switch to the corresponding 2D LUT, thereby continuing to shoot video to obtain the target video.
图19是本申请实施例提供的图像处理方法的示意性流程图。该方法400包括步骤S410至步骤S460,下面分别对这些步骤进行详细的描述。Figure 19 is a schematic flowchart of an image processing method provided in an embodiment of this application. The method 400 includes steps S410 to S460, which are described in detail below.
应理解,图19所示的图像处理方法是可以采用三维通路与二维通路并行设计的流程;即可以通过三维通路对待处理图像进行颜色校正;或者,可以通过二维通路对待处理图像进行颜色校正;或者可以根据具体需求在三维通路与二维通路间进行切换对待处理图像进行颜色校正处理。It should be understood that the image processing method shown in Figure 19 can be designed in parallel with three-dimensional and two-dimensional pathways; that is, color correction of the image to be processed can be performed through the three-dimensional pathway; or, color correction of the image to be processed can be performed through the two-dimensional pathway; or, color correction processing of the image to be processed can be performed by switching between the three-dimensional and two-dimensional pathways according to specific needs.
步骤S410、获取待处理RGB图像。Step S410: Obtain the RGB image to be processed.
示例性地,待处理RGB图像可以是电子设备通过摄像头实时拍摄到的图像。For example, the RGB image to be processed can be an image captured in real time by an electronic device through a camera.
步骤S420、第二伽马处理。Step S420, Second Gamma Processing.
示例性地,第二伽马处理可以是指通过现有技术中的3D LUT的伽马参数对待处理图像进行伽马处理。For example, the second gamma processing may refer to performing gamma processing on the image to be processed using the gamma parameters of a 3D LUT in the prior art.
步骤S430、三维查找表处理。Step S430: 3D lookup table processing.
示例性地,三维查找表处理可以是指通过现有技术中的三维查找表对待处理RGB图像进行处理。For example, three-dimensional lookup table processing can refer to processing the RGB image to be processed using a three-dimensional lookup table in the prior art.
步骤S440、第一伽马处理。Step S440, First Gamma Processing.
示例性地,可以通过如图17所示的方法确定第一伽马处理对应的参数;通过二维通路中的第一伽马处理可以对待处理RGB图像的R、G、B像素值进行调整。For example, the parameters corresponding to the first gamma processing can be determined by the method shown in Figure 17; the R, G, and B pixel values of the RGB image to be processed can be adjusted by the first gamma processing in the two-dimensional path.
进一步地,根据二维查找表的类型,确定将第一伽马处理后的RGB图像从RGB颜色空间转换为HSL颜色空间或者HSV颜色空间。Furthermore, based on the type of the two-dimensional lookup table, it is determined whether the RGB image after the first gamma processing will be converted from the RGB color space to the HSL color space or the HSV color space.
例如,若二维查找表中亮度值固定,则将第一伽马处理后的RGB图像从RGB颜色空间转换为HSL颜色空间;若二维查找表中明度值固定,则将第一伽马处理后的RGB图像从RGB颜色空间转换为HSV颜色空间。For example, if the brightness value in the two-dimensional lookup table is fixed, the RGB image after the first gamma processing is converted from the RGB color space to the HSL color space; if the luminance value in the two-dimensional lookup table is fixed, the RGB image after the first gamma processing is converted from the RGB color space to the HSV color space.
步骤S450、二维查找表处理。Step S450: Two-dimensional lookup table processing.
应理解,二维查找表与三维查找表相比,降低了一个维度;因为二维查找表与三维查找表相比,运行量在一定程度上减小。It should be understood that a two-dimensional lookup table reduces one dimension compared to a three-dimensional lookup table; this is because the computational load is reduced to some extent compared to a three-dimensional lookup table.
在一个示例中,对于HSL颜色空间可以对亮度值进行固定,根据二维查找表可以对饱和度与色相进行调整。In one example, for the HSL color space, the brightness value can be fixed, and the saturation and hue can be adjusted using a two-dimensional lookup table.
在一个示例中,对于HSL颜色空间,可以固定L值,分别根据H对应的二维查找表与S对应的二维查找表,得到校正后的H值与校正后的S值;其中,校正后的H值可以是指在原始H值的基础上增加色相调整量ΔH;同理,校正后的S值是指在原始S值的基础上增加饱和度调整量ΔS,原始H值与原始S值是指将原始RGB像素转换为HSL颜色空间后得到的原始H值与原始S值,ΔH与ΔS是指通过二维查找表得到的。In one example, for the HSL color space, the L value can be fixed, and the corrected H value and corrected S value can be obtained respectively according to the two-dimensional lookup table corresponding to H and the two-dimensional lookup table corresponding to S. Here, the corrected H value can refer to the original H value with an added hue adjustment amount ΔH; similarly, the corrected S value refers to the original S value with an added saturation adjustment amount ΔS. The original H value and original S value refer to the original H value and original S value obtained after converting the original RGB pixels to the HSL color space, and ΔH and ΔS refer to the values obtained through the two-dimensional lookup table.
在一个示例中,对于HSV颜色空间可以对亮度值进行固定,根据二维查找表可以对饱和度与色相进行调整。In one example, for the HSV color space, the brightness value can be fixed, and the saturation and hue can be adjusted using a two-dimensional lookup table.
在一个示例中,对于HSL颜色空间,可以固定明亮值,分别根据H对应的二维查找表与S对应的二维查找表,得到校正后的H值与校正后的S值;其中,校正后的H值可以是指在原始H值的基础上增加色相调整量ΔH;同理,校正后的S值是指在原始S值的基础上增加饱和度调整量ΔS,原始H值与原始S值是指将原始RGB像素转换为HSL颜色空间后得到的原始H值与原始S值,ΔH与ΔS是指通过二维查找表得到的。In one example, for the HSL color space, the luminance value can be fixed, and the corrected H value and corrected S value can be obtained respectively from the two-dimensional lookup table corresponding to H and the two-dimensional lookup table corresponding to S. Here, the corrected H value can refer to the original H value with an added hue adjustment amount ΔH; similarly, the corrected S value refers to the original S value with an added saturation adjustment amount ΔS. The original H value and original S value refer to the original H value and original S value obtained after converting the original RGB pixels to the HSL color space, and ΔH and ΔS refer to the values obtained through the two-dimensional lookup table.
进一步,将校正后的HSL图像从HSL颜色空间转换为RGB颜色空间;或者,将校正后的HSV图像从HSV颜色空间转换为RGB颜色空间。Furthermore, the corrected HSL image is converted from the HSL color space to the RGB color space; or, the corrected HSV image is converted from the HSV color space to the RGB color space.
步骤S460、目标RGB图像。Step S460: Target RGB image.
在一个示例中,电子设备在录制视频时,用户指示电影模式,用户在电影模式中选择3DLUT表中的目标图像风格对视频中的图像进行颜色校正;在某一时刻,电子设备接收到用户切换慢动作模式的操作,则电子设备响应于用户的操作,可以将3D LUT表中的目标图像风格切换至该目标图像风格对应的2D LUT表;根据2D LUT对视频中的图像进行颜色校正。In one example, when the electronic device is recording video, the user indicates movie mode. In movie mode, the user selects a target image style in the 3D LUT table to perform color correction on the images in the video. At some point, the electronic device receives an operation from the user to switch to slow motion mode. In response to the user's operation, the electronic device can switch the target image style in the 3D LUT table to the 2D LUT table corresponding to the target image style. The images in the video are then color corrected according to the 2D LUT.
示例性地,图20示出了电子设备的显示桌面510的示意图。当电子设备检测到用户点击桌面510上的相机应用的图标520的操作后,可以启动相机应用,显示如图21所示的另一GUI;图21所示的GUI可以是相机APP在电影模式下的显示界面,在GUI可以包括拍摄界面530;拍摄界面530上可以包括取景框531与拍摄控件;比如,拍摄界面530中可以包括用于指示拍摄的控件532。在预览状态下,该取景框531内可以实时显示预览图像;其中,预览状态下可以是指用户打开相机且未按下拍照/录像按钮之前,此时取景框内可以实时显示预览图。For example, Figure 20 shows a schematic diagram of the display desktop 510 of an electronic device. When the electronic device detects that the user clicks the camera application icon 520 on the desktop 510, it can launch the camera application and display another GUI as shown in Figure 21. The GUI shown in Figure 21 can be the display interface of the camera app in movie mode, and the GUI can include a shooting interface 530. The shooting interface 530 can include a viewfinder 531 and shooting controls. For example, the shooting interface 530 can include controls 532 for indicating shooting. In preview mode, the preview image can be displayed in real time within the viewfinder 531. The preview mode refers to the state before the user opens the camera and presses the photo/video button, at which time the preview image can be displayed in real time within the viewfinder.
如图21所示,在拍照模式界面,电子设备可以检测到用户点击电影模式的操作,响应于用户的操作电子设备进入电影模式;如图22所示,在电影模式下,拍摄界面530中还包括慢动作模式选项533与LUT选项534;其中,慢动作模式选项533用于指示开启慢动作模式或者关闭慢动作模式,图22所示当前为慢动作关闭模式;在慢动作模式关闭的情况下,LUT选项534用于指示三维查找表;在如图28所示的慢动作模式开启的情况下,LUT选项用于指示二维查找表;电子设备检测到用户点击LUT选项534后,摄界面可以显示多个不同图像风格的预览框535,如图23所示,预览框535中可以包括风格1、风格2、风格3以及其他图像风格;图像风格可以包括但不限于:青橙风格、温暖阳光风格、发光风格、赛博朋克风格等图像风格。As shown in Figure 21, in the shooting mode interface, the electronic device can detect the user's click on the movie mode operation and enter the movie mode in response to the user's operation. As shown in Figure 22, in movie mode, the shooting interface 530 also includes a slow motion mode option 533 and a LUT option 534. The slow motion mode option 533 is used to indicate whether the slow motion mode is turned on or off. Figure 22 shows that the slow motion mode is currently off. When the slow motion mode is off, the LUT option 534 is used to indicate a three-dimensional lookup table. When the slow motion mode is on, as shown in Figure 28, the LUT option is used to indicate a two-dimensional lookup table. After the electronic device detects that the user clicks on the LUT option 534, the shooting interface can display multiple preview boxes 535 with different image styles, as shown in Figure 23. The preview box 535 can include style 1, style 2, style 3, and other image styles. The image styles can include, but are not limited to, the following: orange-green style, warm sunlight style, glowing style, cyberpunk style, etc.
应理解,上述图23所示可以为电子设备在竖屏状态下电影模式的拍摄界面;电子设备可以根据用户使用电子设备的状态确定竖屏显示或者横屏显示。It should be understood that Figure 23 above can be the shooting interface of the electronic device in portrait mode movie mode; the electronic device can determine whether to display in portrait or landscape mode according to the user's state of using the electronic device.
还应理解,图23中对预览框535中显示的图像风格进行了举例说明;预览框中还可以包括其他图像风格,本申请对此不作任何限定。在一个示例中,以图24所示的拍摄界面进行举例描述,电子设备检测到用户点击预览框535中风格2,则在取景框531中显示风格2的预览图像;同理,用户也可以点击预览框535中其他的图像模式的图像风格进行预览;在用户选择目标图像风格后,取景框531中会显示目标图像风格对应的预览图像。如图25所示,用户确定目标图像风格后,电子设备检测到用户点击指示录像的控件;响应于用户的操作,电子设备开始进入录像即电子设备进入视频拍摄。It should also be understood that Figure 23 illustrates the image style displayed in preview frame 535; other image styles may also be included in the preview frame, and this application does not limit this. In one example, using the shooting interface shown in Figure 24 as an example, if the electronic device detects that the user clicks on style 2 in preview frame 535, then a preview image of style 2 will be displayed in viewfinder 531; similarly, the user can also click on the image styles of other image modes in preview frame 535 for preview; after the user selects a target image style, the preview image corresponding to the target image style will be displayed in viewfinder 531. As shown in Figure 25, after the user confirms the target image style, the electronic device detects that the user clicks on the control indicating recording; in response to the user's operation, the electronic device begins recording, i.e., the electronic device enters video shooting mode.
如图26所示,在视频录制的过程中,假设视频拍摄到第8秒时,当前慢动作模式处于关闭状态;电子设备检测到用户点击慢动作模式选项的操作,当用户点击慢动作模式选项后开启相机的慢动作模式,在显示界面可以出现提醒框显示“慢动作模式开启”,提醒框在显示几秒后可以自行消失,此时相机从电影模式切换至慢动作模式,显示如图28所示的显示界面;或者,如图27所示,在预览框535中可以包括一个慢动作选项,电子设备检测到用户点击慢动作选项的操作;响应于用户的操作,电子设备将相机由电影模式切换至慢动作模式,显示慢动作的显示界面,如图28所示;在慢动作的显示界面上,电子设备检测到用户指示录像的控件的操作,则电子设备继续拍摄该视频。As shown in Figure 26, during video recording, assuming the slow-motion mode is off at the 8-second mark, the electronic device detects the user clicking the slow-motion mode option. When the user clicks the slow-motion mode option, the camera's slow-motion mode is activated, and a notification box appears on the display interface saying "Slow-motion mode on." The notification box disappears automatically after a few seconds. At this time, the camera switches from movie mode to slow-motion mode, displaying the interface shown in Figure 28. Alternatively, as shown in Figure 27, a slow-motion option can be included in the preview box 535. The electronic device detects the user clicking the slow-motion option. In response to the user's operation, the electronic device switches the camera from movie mode to slow-motion mode, displaying the slow-motion display interface, as shown in Figure 28. On the slow-motion display interface, if the electronic device detects the user's operation of the recording control, the electronic device continues recording the video.
需要说明的是,在电子设备检测到用户点击慢动作选项时,电子设备可以将电影模式下的三维查找表切换至二维查找表;换而言之,在用户点击慢动作选项后,电子设备通过二维查找表中与三维查找表中风格2对应的查找表对视频中的图像进行颜色校正处理。It should be noted that when the electronic device detects that the user clicks the slow motion option, the electronic device can switch the three-dimensional lookup table in movie mode to a two-dimensional lookup table; in other words, after the user clicks the slow motion option, the electronic device performs color correction processing on the image in the video by using the lookup table in the two-dimensional lookup table that corresponds to style 2 in the three-dimensional lookup table.
应理解,上述用户用于指示录像行为的操作可以包括用户点击录像的控件,也可以包括用户设备通过语音指示电子设备进行录像行为,或者,还可以包括用户其它的指示电子设备进行录像行为。上述为举例说明,并不对本申请作任何限定。It should be understood that the user's actions to instruct recording may include clicking a recording control, the user device instructing the electronic device to record via voice, or other user-instructed actions to record. The above are illustrative examples and do not constitute any limitation on this application.
应用场景三:获取已拍摄完成的待处理视频,对待处理视频进行2D LUT处理,得到处理后的目标视频。Application Scenario 3: Acquire the captured video to be processed, perform 2D LUT processing on the video to be processed, and obtain the processed target video.
在一个示例中,本申请实施例提供的确定二维查找表的方法可以应用于图像处理;在获取与拍摄完成的视频后,可以根据2D LUT对该拍摄完成的视频的进行颜色校正,得到满足用户需求的图像风格的目标视频。In one example, the method for determining a two-dimensional lookup table provided in this application embodiment can be applied to image processing; after acquiring and capturing a video, the captured video can be color-corrected according to the 2D LUT to obtain a target video with an image style that meets the user's requirements.
示例性地,图29示出了电子设备的显示桌面610的示意图。当电子设备检测到用户点击桌面610上的相册应用的图标620的操作后,可以启动相册应用,显示如图30所示的另一GUI;图30所示为电子设备的相簿,相簿中包括视频与图像;电子设备检测到用户点击相簿中视频6的操作,响应于用户的操作将视频6显示于电子设备的显示界面,如图31所示;图31所示的显示界面630中包括取景框631,取景框631中显示视频6的内容;在拍摄界面630中还包括更多选项632,电子设备检测到用户点击更多选项632的操作,响应于用户的操作电子设备显示更多选项的设置界面,如图32所示;在更多选项的设置界面中包括LUT选项633、水印选项以及其他选项,电子设备检测到用户点击LUT选项的操作后,显示如图33所示的显示界面;在显示界面630中显示多个不同图像风格的预览框634,预览框634中可以包括风格1、风格2、风格3以及其他图像风格;图像风格可以包括但不限于:青橙风格、温暖阳光风格、发光风格、赛博朋克风格等图像风格。For example, Figure 29 shows a schematic diagram of the display desktop 610 of the electronic device. When the electronic device detects that the user clicks the album application icon 620 on the desktop 610, it can launch the album application and display another GUI as shown in Figure 30; Figure 30 shows the electronic device's album, which includes videos and images; the electronic device detects that the user clicks on video 6 in the album, and in response to the user's operation, displays video 6 on the electronic device's display interface, as shown in Figure 31; the display interface 630 shown in Figure 31 includes a viewfinder 631, which displays the content of video 6; the shooting interface 630 also includes more options 632, and the electronic device detects that the user clicks more. The operation of option 632, in response to the user's operation, the electronic device displays a settings interface with more options, as shown in Figure 32. The settings interface with more options includes LUT option 633, watermark option, and other options. After the electronic device detects the user's operation of clicking the LUT option, it displays the display interface shown in Figure 33. The display interface 630 displays multiple preview boxes 634 with different image styles. The preview boxes 634 can include style 1, style 2, style 3, and other image styles. The image styles can include, but are not limited to: orange-green style, warm sunlight style, glowing style, cyberpunk style, and other image styles.
在一个示例中,如图34所示,电子设备检测到用户点击预览框634中风格3,则电子设备根据风格3对视频6进行颜色校正处理。In one example, as shown in Figure 34, the electronic device detects that the user clicks on style 3 in the preview box 634, and then the electronic device performs color correction processing on video 6 according to style 3.
应理解,上述图33所示的LUT为二维查找表;预览框634中显示的不同风格图像是指二维查找表对应的不同图像风格(滤镜效果)。It should be understood that the LUT shown in Figure 33 above is a two-dimensional lookup table; the different style images displayed in the preview box 634 refer to the different image styles (filter effects) corresponding to the two-dimensional lookup table.
应用场景四:在图像处理应用程序中对已拍摄完成的待处理视频进行2D LUT处理,得到处理后的目标视频。Application Scenario 4: Perform 2D LUT processing on the captured video in an image processing application to obtain the processed target video.
在一个示例中,本申请实施例提供的确定二维查找表的方法可以应用于图像处理;在获取已拍摄完成的视频后,可以根据图像处理APP中的2D LUT对该拍摄完成的视频进行颜色校正,得到满足用户需求的图像风格的目标视频。In one example, the method for determining a two-dimensional lookup table provided in this application embodiment can be applied to image processing; after acquiring a video that has been captured, the video can be color-corrected according to the 2D LUT in the image processing APP to obtain a target video with an image style that meets the user's requirements.
示例性地,图35示出了电子设备的显示桌面710的示意图;当电子设备检测到用户点击桌面710上的颜色校正应用程序的图标720的操作后,可以启动颜色校正应用程序,显示如图36所示的另一GUI;图36所示的GUI可以是颜色校正应用程序的显示界面,在GUI可以包括显示界面730;显示界面730上可以包括取景框731与控件;比如,显示界面730中可以包括相册732与更多选项733;电子设备检测到用户点击相册732的操作,响应于用户的操作电子设备显示相簿,显示如图37所示的显示界面;相簿中包括视频与图像;电子设备检测到用户点击相簿中视频7的操作,响应于用户的操作将视频7显示于电子设备的显示界面,显示如图38所示的显示界面;电子设备检测到用户点击更多选项733的操作,响应于用户的操作电子设备显示更多选项的设置界面,显示如图39所示的显示界面;在更多选项的设置界面中包括LUT选项734、水印选项以及其他选项,电子设备检测到用户点击LUT选项734的操作后,显示图如40所示的显示界面;如图40所示,在显示界面730中显示多个不同图像风格的预览框735,预览框735中可以包括风格1、风格2、风格3以及其他图像风格;图像风格可以包括但不限于:青橙风格、温暖阳光风格、发光风格、赛博朋克风格等图像风格。For example, Figure 35 shows a schematic diagram of the display desktop 710 of an electronic device; when the electronic device detects that the user clicks the icon 720 of the color correction application on the desktop 710, it can launch the color correction application and display another GUI as shown in Figure 36; the GUI shown in Figure 36 can be the display interface of the color correction application, and the GUI can include a display interface 730; the display interface 730 can include a viewfinder 731 and controls; for example, the display interface 730 can include a photo album 732 and more options 733; when the electronic device detects that the user clicks the photo album 732, in response to the user's operation, the electronic device displays the photo album and displays the display interface as shown in Figure 37; the photo album includes videos and images; when the electronic device detects that the user clicks the video 7 in the photo album, in response to the user's operation, it displays the photo album and displays the display interface as shown in Figure 37; the photo album includes videos and images; when the electronic device detects that the user clicks the video 7 in the photo album, in response to the user's operation, it displays the video album 732, and ... The user's operation displays video 7 on the display interface of the electronic device, as shown in Figure 38. The electronic device detects the user's click on the more options 733 and, in response, displays the settings interface for the more options, as shown in Figure 39. The settings interface for the more options includes LUT option 734, watermark option, and other options. After the electronic device detects the user's click on LUT option 734, it displays the display interface shown in Figure 40. As shown in Figure 40, multiple preview boxes 735 with different image styles are displayed in the display interface 730. The preview boxes 735 may include style 1, style 2, style 3, and other image styles. The image styles may include, but are not limited to, the following: orange-green style, warm sunlight style, glowing style, cyberpunk style, etc.
在一个示例中,如图41所示,电子设备检测到用户点击预览框735中风格2,则电子设备根据风格2对视频7进行颜色校正处理。In one example, as shown in Figure 41, the electronic device detects that the user clicks on Style 2 in the preview box 735, and then the electronic device performs color correction processing on the video 7 according to Style 2.
应理解,上述图40所示的LUT为二维查找表;预览框735中显示的不同风格图像是指二维查找表对应的不同图像风格(滤镜效果)。It should be understood that the LUT shown in Figure 40 above is a two-dimensional lookup table; the different style images displayed in the preview box 735 refer to the different image styles (filter effects) corresponding to the two-dimensional lookup table.
上述结合图29至图41对用户在电子设备上进行操作的图形显示界面进行了描述,下面结合图42对电子设备运行的图像处理算法进行描述。The above description, in conjunction with Figures 29 to 41, describes the graphical display interface through which the user operates on the electronic device. The following description, in conjunction with Figure 42, describes the image processing algorithm running on the electronic device.
图42是本申请实施例提供图像处理方法的示意性流程图。该方法800包括步骤S810至步骤S860,下面分别对这些步骤进行详细的描述。Figure 42 is a schematic flowchart of an image processing method provided in an embodiment of this application. The method 800 includes steps S810 to S860, which are described in detail below.
应理解,上述图18与图19用于实时拍摄图像或者视频时,对图像进行颜色校正;图42所示的方法应用于获取已完成拍摄的图像或者视频,对已完成的图像或者视频进行颜色校正处理。It should be understood that Figures 18 and 19 above are used for color correction of images when capturing images or videos in real time; the method shown in Figure 42 is applied to acquiring images or videos that have already been captured and performing color correction processing on the completed images or videos.
步骤S810、获取待处理视频。Step S810: Obtain the video to be processed.
示例性地,待处理视频可以是指具有颜色校正需求的视频,待处理视频可以是从电子设备内部获得的视频(例如,电子设备的相册中存储的视频,或者,电子设备从云端获取的RGB视频)。在获取的待处理视频为其他格式的视频时,需要将待处理视频转换成RGB视频。For example, the video to be processed can refer to a video that requires color correction. This video can be obtained from within an electronic device (e.g., a video stored in the device's photo album, or an RGB video retrieved from the cloud). When the obtained video to be processed is in another format, it needs to be converted to RGB video.
步骤S820、反伽马处理。Step S820: Anti-gamma processing.
需要说明的是,由于待处理视频已经是完成拍摄的视频,若要对待处理视频进行颜色校正处理,则需要获取待处理视频中每帧图像对应的原始RGB图像,即如图16所示的色彩校正208输出的原始RGB像素。It should be noted that since the video to be processed is already a video that has been shot, if color correction is to be performed on the video to be processed, it is necessary to obtain the original RGB image corresponding to each frame of the video to be processed, that is, the original RGB pixels output by the color correction 208 as shown in Figure 16.
步骤S830、获取原始RGB像素。Step S830: Obtain the original RGB pixels.
应理解,原始RGB像素可以是指未经过伽马处理的RGB像素。It should be understood that raw RGB pixels can refer to RGB pixels that have not undergone gamma processing.
步骤S840、对原始RGB像素进行第一伽马处理。Step S840: Perform the first gamma processing on the original RGB pixels.
示例性地,根据图17中步骤四中拟合得到的三条曲线即为r、g、b三通道对应的伽马曲线,对待处理RGB图像进行第一伽马处理。For example, the three curves obtained by fitting in step four of Figure 17 are the gamma curves corresponding to the three channels r, g, and b, and the first gamma processing is performed on the RGB image to be processed.
进一步地,可以将第一伽马处理后的图像从RGB颜色空间转换为HSL颜色空间。Furthermore, the image after the first gamma processing can be converted from the RGB color space to the HSL color space.
步骤S850、二维查找表处理。Step S850: Two-dimensional lookup table processing.
示例性地,根据二维查表可以得到调整量,从而得到颜色校正后的图像。For example, the adjustment amount can be obtained by looking up a two-dimensional table, thereby obtaining a color-corrected image.
需要说明的是,不同的二维查表可以对应不同的图像风格;用户可以根据需求选择对待处理视频中的图像进行颜色校正的图像风格,从而电子设备确定该图像风格对应的二维查找表;根据该二维查找表对待处理视频中的图像进行颜色校正。It should be noted that different two-dimensional lookup tables can correspond to different image styles. Users can select the image style for color correction in the video to be processed according to their needs, and the electronic device will determine the two-dimensional lookup table corresponding to that image style; then, the color correction will be performed on the image in the video to be processed based on the two-dimensional lookup table.
在一个示例中,对于HSL颜色空间,可以固定L值,分别根据H对应的二维查找表与S对应的二维查找表,得到校正后的H值与校正后的S值;其中,校正后的H值可以是指在原始H值的基础上增加色相调整量ΔH;同理,校正后的S值是指在原始S值的基础上增加饱和度调整量ΔS,原始H值与原始S值是指将原始RGB像素转换为HSL颜色空间后得到的原始H值与原始S值,ΔH与ΔS是指通过二维查找表得到的。In one example, for the HSL color space, the L value can be fixed, and the corrected H value and corrected S value can be obtained respectively according to the two-dimensional lookup table corresponding to H and the two-dimensional lookup table corresponding to S. Here, the corrected H value can refer to the original H value with an added hue adjustment amount ΔH; similarly, the corrected S value refers to the original S value with an added saturation adjustment amount ΔS. The original H value and original S value refer to the original H value and original S value obtained after converting the original RGB pixels to the HSL color space, and ΔH and ΔS refer to the values obtained through the two-dimensional lookup table.
步骤S860、得到目标视频。Step S860: Obtain the target video.
例如,将步骤S850二维查找表处理后的HSL图像转换为RGB颜色空间得到目标视频。For example, the HSL image processed by the two-dimensional lookup table in step S850 is converted into the RGB color space to obtain the target video.
应理解,目标视频可以是指根据用户选择的二维查找表,具备用户需求的图像效果的视频。It should be understood that the target video can refer to a video that has the image effects required by the user, based on a two-dimensional lookup table selected by the user.
还应理解,上述通过视频进行举例描述;类似地,上述获取的也可以是待处理图像,可以对待处理图像进行上述处理,得到目标图像。It should also be understood that the above description is based on a video example; similarly, the image obtained above can also be an image to be processed, and the above processing can be performed on the image to be processed to obtain the target image.
在本申请的实施例中,通过三维查找表构建一个二维查找表;根据二维查找表对原始图像帧进行图像处理得到目标图像帧,能够使得到的目标图像帧的图像质量与通过三维查找表得到的图像相同或者接近;由于本申请实施例采用二维查找表对原始图像帧进行图像处理,因此,在确保图像质量的情况下,能够降低电子设备的运算量。In the embodiments of this application, a two-dimensional lookup table is constructed using a three-dimensional lookup table; the target image frame is obtained by image processing of the original image frame according to the two-dimensional lookup table, which enables the image quality of the target image frame to be the same as or close to that of the image obtained by the three-dimensional lookup table; since the embodiments of this application use a two-dimensional lookup table to process the original image frame, the computational load of the electronic device can be reduced while ensuring image quality.
应理解,上述举例说明是为了帮助本领域技术人员理解本申请实施例,而非要将本申请实施例限于所例示的具体数值或具体场景。本领域技术人员根据所给出的上述举例说明,显然可以进行各种等价的修改或变化,这样的修改或变化也落入本申请实施例的范围内。It should be understood that the above examples are provided to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments of this application to the specific values or scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of this application.
上文结合图1至图42,详细描述了本申请实施例的图像处理方法,下面将结合图43和图44,详细描述本申请的装置实施例。应理解,本申请实施例中的图像处理装置可以执行前述本申请实施例的各种图像处理方法,即以下各种产品的具体工作过程,可以参考前述方法实施例中的对应过程。The image processing method of the present application embodiment has been described in detail above with reference to Figures 1 to 42. The apparatus embodiment of the present application will be described in detail below with reference to Figures 43 and 44. It should be understood that the image processing apparatus in the embodiments of the present application can execute the various image processing methods of the foregoing embodiments of the present application. That is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.
图43是本申请实施例提供的图像处理装置的结构示意图。该图像处理装置900包括显示单元910和处理单元920。Figure 43 is a schematic diagram of the structure of an image processing apparatus provided in an embodiment of this application. The image processing apparatus 900 includes a display unit 910 and a processing unit 920.
其中,所述显示单元910用于在第一拍摄模式下,显示第一界面,所述第一界面包括第一控件;所述处理单元920用于检测到对所述第一控件的第一操作;响应于第一操作,确定伽马处理中的第一映射和二维查找表中的第二映射,所述第一映射与所述第一控件对应,所述第二映射与所述第一控件对应,所述第一映射和所述第二映射相关联;获取待处理图像;根据所述第一映射和所述第二映射,对所述待处理图像进行处理,得到第一图像。The display unit 910 is configured to display a first interface in a first shooting mode, the first interface including a first control; the processing unit 920 is configured to detect a first operation on the first control; in response to the first operation, determine a first mapping in gamma processing and a second mapping in a two-dimensional lookup table, the first mapping corresponding to the first control, the second mapping corresponding to the first control, and the first mapping and the second mapping being associated; acquire an image to be processed; and process the image to be processed according to the first mapping and the second mapping to obtain a first image.
结合第二方面,在第二方面的某些实现方式中,所述处理单元920具体用于:In conjunction with the second aspect, in some implementations of the second aspect, the processing unit 920 is specifically used for:
根据所述第一映射对所述待处理图像进行处理,得到第二图像;The image to be processed is processed according to the first mapping to obtain the second image;
根据所述第二图像与所述第二映射确定第一调整量与第二调整量,其中,所述第一调整量用于表示所述二图像中第一颜色分量的调整量,所述第二调整量用于表示所述第二图像中第二颜色分量的调整量;A first adjustment amount and a second adjustment amount are determined based on the second image and the second mapping, wherein the first adjustment amount is used to represent the adjustment amount of the first color component in the two images, and the second adjustment amount is used to represent the adjustment amount of the second color component in the second image;
根据所述第二图像、所述第一调整量与所述第二调整量得到所述第一图像。The first image is obtained based on the second image, the first adjustment amount, and the second adjustment amount.
可选地,作为一个实施例,所述第一映射和所述第二映射相关联用于指示根据所述伽马处理中的第一映射确定所述二维查找表中的第二映射。Optionally, as an embodiment, the first mapping and the second mapping are associated to indicate the determination of the second mapping in the two-dimensional lookup table based on the first mapping in the gamma processing.
可选地,作为一个实施例,所述处理单元920具体用于:Optionally, as an embodiment, the processing unit 920 is specifically used for:
获取所述伽马处理中的第三映射与三维查找表中的第四映射,所述三维查找表中的第四映射与所述二维查找表中的第二映射对应;Obtain the third mapping in the gamma processing and the fourth mapping in the three-dimensional lookup table, wherein the fourth mapping in the three-dimensional lookup table corresponds to the second mapping in the two-dimensional lookup table;
对第一颜色空间进行均匀划分,得到初始第一颜色空间的图像与初始第二颜色空间的图像;The first color space is uniformly divided to obtain an image in the initial first color space and an image in the initial second color space;
根据所述伽马处理的第一映射、所述伽马处理的第三映射、所述三维查找表中的第四映射对所述初始第二颜色空间的图像进行处理,得到第三图像,所述第三图像为所述第二颜色空间的图像;The image in the initial second color space is processed according to the first mapping of the gamma processing, the third mapping of the gamma processing, and the fourth mapping in the three-dimensional lookup table to obtain a third image, which is an image in the second color space.
将所述第三图像转换为所述第一颜色空间的第四图像;Convert the third image into a fourth image in the first color space;
根据所述初始第一颜色空间的图像与所述第一颜色空间的第四图像之间的像素差,确定所述二维查找表中的第二映射。The second mapping in the two-dimensional lookup table is determined based on the pixel difference between the image in the initial first color space and the fourth image in the first color space.
可选地,作为一个实施例,所述处理单元920具体用于:Optionally, as an embodiment, the processing unit 920 is specifically used for:
确定第一亮度值;Determine the first brightness value;
在亮度为所述第一亮度值时,所述根据所述初始第一颜色空间的图像与所述第一颜色空间的第四图像之间的像素差,确定所述二维查找表中的第二映射。When the brightness is the first brightness value, the second mapping in the two-dimensional lookup table is determined based on the pixel difference between the image in the initial first color space and the fourth image in the first color space.
可选地,作为一个实施例,所述第一颜色空间是指HSL颜色空间,或者HSV颜色空间;所述第二颜色空间是指RGB颜色空间。Optionally, as an embodiment, the first color space refers to the HSL color space or the HSV color space; the second color space refers to the RGB color space.
可选地,作为一个实施例,所述第一拍摄模式是指图像的出帧率大于预设阈值的拍摄模式。Optionally, as an embodiment, the first shooting mode refers to a shooting mode in which the frame rate of the image is greater than a preset threshold.
可选地,作为一个实施例,所述第一控件是指用于指示所述二维查找表中的第二映射表的控件。Optionally, as an embodiment, the first control refers to a control used to indicate the second mapping table in the two-dimensional lookup table.
可选地,作为一个实施例,所述第一控件是指用于指示自动识别所述二维查找表中的第二映射表的控件。Alternatively, as an embodiment, the first control refers to a control used to instruct the automatic identification of a second mapping table in the two-dimensional lookup table.
需要说明的是,上述图像处理装置900以功能单元的形式体现。这里的术语“单元”可以通过软件和/或硬件形式实现,对此不作具体限定。It should be noted that the image processing device 900 described above is embodied in the form of a functional unit. The term "unit" here can be implemented in software and/or hardware, and there is no specific limitation on this.
例如,“单元”可以是实现上述功能的软件程序、硬件电路或二者结合。所述硬件电路可能包括应用特有集成电路(application specific integrated circuit,ASIC)、电子电路、用于执行一个或多个软件或固件程序的处理器(例如共享处理器、专有处理器或组处理器等)和存储器、合并逻辑电路和/或其它支持所描述的功能的合适组件。For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and/or other suitable components that support the described functions.
因此,在本申请的实施例中描述的各示例的单元,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
图44示出了本申请提供的一种电子设备的结构示意图。图44中的虚线表示该单元或该模块为可选的。电子设备1000可用于实现上述方法实施例中描述的图像处理方法。Figure 44 shows a schematic diagram of the structure of an electronic device provided in this application. The dashed lines in Figure 44 indicate that the unit or module is optional. The electronic device 1000 can be used to implement the image processing method described in the above method embodiments.
电子设备1000包括一个或多个处理器1001,该一个或多个处理器1002可支持电子设备1000实现方法实施例中的方法。处理器1001可以是通用处理器或者专用处理器。例如,处理器1001可以是中央处理器(central processing unit,CPU)、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integratedcircuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件,如分立门、晶体管逻辑器件或分立硬件组件。Electronic device 1000 includes one or more processors 1001, which support the implementation of the methods in the method embodiments. Processor 1001 can be a general-purpose processor or a special-purpose processor. For example, processor 1001 can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, such as discrete gates, transistor logic devices, or discrete hardware components.
处理器1001可以用于对电子设备1000进行控制,执行软件程序,处理软件程序的数据。电子设备1000还可以包括通信单元1005,用以实现信号的输入(接收)和输出(发送)。The processor 1001 can be used to control the electronic device 1000, execute software programs, and process data from the software programs. The electronic device 1000 may also include a communication unit 1005 for inputting (receiving) and outputting (transmitting) signals.
例如,电子设备1000可以是芯片,通信单元1005可以是该芯片的输入和/或输出电路,或者,通信单元1005可以是该芯片的通信接口,该芯片可以作为终端设备或其它电子设备的组成部分。For example, electronic device 1000 may be a chip, communication unit 1005 may be the input and/or output circuit of the chip, or communication unit 1005 may be the communication interface of the chip, and the chip may be a component of terminal device or other electronic device.
又例如,电子设备1000可以是终端设备,通信单元1005可以是该终端设备的收发器,或者,通信单元1005可以是该终端设备的收发电路。For example, electronic device 1000 can be a terminal device, communication unit 1005 can be the transceiver of the terminal device, or communication unit 1005 can be the transceiver circuit of the terminal device.
电子设备1000中可以包括一个或多个存储器1002,其上存有程序1004,程序1004可被处理器1001运行,生成指令1003,使得处理器1001根据指令1003执行上述方法实施例中描述的图像处理方法。The electronic device 1000 may include one or more memories 1002, which store a program 1004. The program 1004 can be executed by the processor 1001 to generate instructions 1003, causing the processor 1001 to execute the image processing method described in the above method embodiments according to the instructions 1003.
可选地,存储器1002中还可以存储有数据。可选地,处理器1001还可以读取存储器1002中存储的数据,该数据可以与程序1004存储在相同的存储地址,该数据也可以与程序1004存储在不同的存储地址。Optionally, the memory 1002 may also store data. Optionally, the processor 1001 may also read data stored in the memory 1002, which may be stored at the same memory address as the program 1004, or the data may be stored at a different memory address than the program 1004.
处理器1001和存储器1002可以单独设置,也可以集成在一起;例如,集成在终端设备的系统级芯片(system on chip,SOC)上。The processor 1001 and memory 1002 can be configured separately or integrated together; for example, integrated on the system-on-chip (SOC) of the terminal device.
示例性地,存储器1002可以用于存储本申请实施例中提供的图像处理方法的相关程序1004,处理器1001可以用于在图像处理时调用存储器1002中存储的图像处理方法的相关程序1004,执行本申请实施例的图像处理方法;例如,在第一拍摄模式下,显示第一界面,所述第一界面包括第一控件;检测到对所述第一控件的第一操作;响应于第一操作,确定伽马处理中的第一映射和二维查找表中的第二映射,所述第一映射与所述第一控件对应,所述第二映射与所述第一控件对应,所述第一映射和所述第二映射相关联;获取待处理图像;根据所述第一映射和所述第二映射,对所述待处理图像进行处理,得到第一图像。For example, the memory 1002 can be used to store the related program 1004 of the image processing method provided in the embodiments of this application, and the processor 1001 can be used to call the related program 1004 of the image processing method stored in the memory 1002 during image processing to execute the image processing method of the embodiments of this application; for example, in a first shooting mode, a first interface is displayed, the first interface includes a first control; a first operation on the first control is detected; in response to the first operation, a first mapping in gamma processing and a second mapping in a two-dimensional lookup table are determined, the first mapping corresponds to the first control, the second mapping corresponds to the first control, and the first mapping and the second mapping are associated; an image to be processed is obtained; the image to be processed is processed according to the first mapping and the second mapping to obtain a first image.
本申请还提供了一种计算机程序产品,该计算机程序产品被处理器1001执行时实现本申请中任一方法实施例所述的图像处理方法。This application also provides a computer program product that, when executed by processor 1001, implements the image processing method described in any of the method embodiments of this application.
该计算机程序产品可以存储在存储器1002中,例如是程序1004,程序1004经过预处理、编译、汇编和链接等处理过程最终被转换为能够被处理器1001执行的可执行目标文件。The computer program product can be stored in memory 1002, for example, program 1004. Program 1004 is finally converted into an executable object file that can be executed by processor 1001 after processing such as preprocessing, compilation, assembly and linking.
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现本申请中任一方法实施例所述的图像方法。该计算机程序可以是高级语言程序,也可以是可执行目标程序。This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the image method described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.
可选地,该计算机可读存储介质例如是存储器1002。存储器1002可以是易失性存储器或非易失性存储器,或者,存储器1002可以同时包括易失性存储器和非易失性存储器。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlinkDRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。Optionally, the computer-readable storage medium is, for example, memory 1002. Memory 1002 can be volatile memory or non-volatile memory, or memory 1002 can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
本领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的装置和设备的具体工作过程以及产生的技术效果,可以参考前述方法实施例中对应的过程和技术效果,在此不再赘述。Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and technical effects of the above-described apparatus and equipment can be referred to the corresponding processes and technical effects in the foregoing method embodiments, and will not be repeated here.
在本申请所提供的几个实施例中,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的方法实施例的一些特征可以忽略,或不执行。以上所描述的装置实施例仅仅是示意性的,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,多个单元或组件可以结合或者可以集成到另一个系统。另外,各单元之间的耦合或各个组件之间的耦合可以是直接耦合,也可以是间接耦合,上述耦合包括电的、机械的或其它形式的连接。In the several embodiments provided in this application, the systems, apparatuses, and methods disclosed can be implemented in other ways. For example, some features of the method embodiments described above can be ignored or not performed. The apparatus embodiments described above are merely illustrative; the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Multiple units or components can be combined or integrated into another system. Furthermore, the coupling between units or components can be direct coupling or indirect coupling, including electrical, mechanical, or other forms of connection.
应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
另外,本文中术语“系统”和“网络”在本文中常被可互换使用。本文中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。Furthermore, the terms "system" and "network" are often used interchangeably in this paper. The term "and/or" in this paper merely describes the relationship between related objects, indicating that three relationships can exist. For example, A and/or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character "/" in this paper generally indicates that the preceding and following related objects have an "or" relationship.
总之,以上所述仅为本申请技术方案的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。In summary, the above description is merely a preferred embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims (11)
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK40081243A HK40081243A (en) | 2023-05-19 |
| HK40081243B true HK40081243B (en) | 2024-01-26 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20230188861A1 (en) | Light Compensation Method for Photographing and Related Apparatus | |
| CN113810600B (en) | Terminal image processing method and device and terminal equipment | |
| US12301993B2 (en) | Photographing method and apparatus | |
| CN112532892B (en) | Image processing method and electronic device | |
| WO2021135730A1 (en) | Display interface adaptation method, display interface adaptation design method and electronic device | |
| CN113810601B (en) | Terminal image processing method and device and terminal equipment | |
| EP4280586B1 (en) | Point light source image detection method and electronic device | |
| US20240119566A1 (en) | Image processing method and apparatus, and electronic device | |
| EP4231147A1 (en) | Drawing command processing method and related device therefor | |
| CN114363482B (en) | Method for determining calibration image and electronic equipment | |
| EP4576803A1 (en) | Image processing method and apparatus, electronic device and storage medium | |
| EP4156168A1 (en) | Image processing method and electronic device | |
| US12423885B2 (en) | Image processing method and electronic device | |
| CN115706869A (en) | Terminal image processing method and device and terminal equipment | |
| US20240357228A1 (en) | Method and apparatus for displaying preview image, and readable storage medium | |
| US12536629B2 (en) | Image processing method and electronic device | |
| HK40081243B (en) | Image processing method and electronic device | |
| HK40078673B (en) | Image processing method and electronic device | |
| CN119520974B (en) | Shooting method and electronic equipment | |
| HK40081243A (en) | Image processing method and electronic device | |
| HK40078673A (en) | Image processing method and electronic device | |
| WO2025200862A1 (en) | Camera color calibration method and apparatus, and electronic device | |
| CN115696067A (en) | Image processing method and device of terminal and terminal equipment | |
| CN114385282A (en) | Theme color conversion method, electronic device, and computer-readable storage medium |