CN116017178A - Image processing method and device and electronic equipment - Google Patents
Image processing method and device and electronic equipment Download PDFInfo
- Publication number
- CN116017178A CN116017178A CN202310093332.8A CN202310093332A CN116017178A CN 116017178 A CN116017178 A CN 116017178A CN 202310093332 A CN202310093332 A CN 202310093332A CN 116017178 A CN116017178 A CN 116017178A
- Authority
- CN
- China
- Prior art keywords
- image
- pixel
- area
- value
- frequency energy
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 21
- 238000012545 processing Methods 0.000 claims abstract description 187
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 120
- 238000000034 method Methods 0.000 claims abstract description 61
- 230000008569 process Effects 0.000 claims description 17
- 238000001914 filtration Methods 0.000 claims description 6
- 230000000694 effects Effects 0.000 description 48
- 238000003384 imaging method Methods 0.000 description 24
- 238000001514 detection method Methods 0.000 description 18
- 238000011156 evaluation Methods 0.000 description 18
- 230000000875 corresponding effect Effects 0.000 description 13
- 230000006870 function Effects 0.000 description 10
- 230000002596 correlated effect Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 230000001360 synchronised effect Effects 0.000 description 5
- 230000000007 visual effect Effects 0.000 description 5
- 241001464837 Viridiplantae Species 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 230000007704 transition Effects 0.000 description 4
- 230000004075 alteration Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000005457 optimization Methods 0.000 description 3
- 238000012935 Averaging Methods 0.000 description 2
- 230000003190 augmentative effect Effects 0.000 description 2
- 230000001815 facial effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008447 perception Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 210000003128 head Anatomy 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000000704 physical effect Effects 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 230000002087 whitening effect Effects 0.000 description 1
Images
Landscapes
- Image Processing (AREA)
Abstract
本申请公开了一种图像处理方法、装置及电子设备,属于图像处理技术领域。该方法包括:获取第一图像,所述第一图像为采用图像处理算法对第二图像处理得到的图像,所述第二图像为摄像头采集得到的图像;确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量;根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,所述图像虚化参数用于指示图像虚化处理强度;在所述第一值小于或等于第一阈值的情况下,调整所述图像处理算法的图像虚化处理强度。
The application discloses an image processing method, device and electronic equipment, belonging to the technical field of image processing. The method includes: acquiring a first image, the first image is an image obtained by processing a second image using an image processing algorithm, and the second image is an image collected by a camera; determining a foreground image in the first image The first local high-frequency energy of the edge pixel in the area, and the second local high-frequency energy of the adjacent pixel of the edge pixel; according to the first local high-frequency energy and the second local high-frequency energy , determining a first value of an image blurring parameter of the first image, where the image blurring parameter is used to indicate the intensity of image blurring processing; when the first value is less than or equal to a first threshold, adjust the The image blur processing strength of the above image processing algorithm.
Description
技术领域technical field
本申请属于图像处理技术领域,具体涉及一种图像处理方法、装置及电子设备。The present application belongs to the technical field of image processing, and in particular relates to an image processing method, device and electronic equipment.
背景技术Background technique
图像处理算法的研究和开发是一个不断优化、重构的迭代过程。在这个过程中,需要频繁地对迭代前后的图像处理算法处理得到的图像进行评估,保证图像不会因为图像处理算法的迭代而退化。例如,对图像处理算法处理得到的图像进行虚化效果的评估。The research and development of image processing algorithms is an iterative process of continuous optimization and reconstruction. In this process, it is necessary to frequently evaluate the image processed by the image processing algorithm before and after iteration to ensure that the image will not be degraded due to the iteration of the image processing algorithm. For example, the blurring effect is evaluated on the image processed by the image processing algorithm.
相关技术中,评估方式通常是人眼评估,这种评估方式依赖观察人的经验,评估结果不够客观,可靠性较低,进而导致图像处理算法的调整可靠性较低。In related technologies, the evaluation method is usually human eye evaluation, which relies on the experience of observers, the evaluation results are not objective enough, and the reliability is low, which leads to low reliability of image processing algorithm adjustment.
发明内容Contents of the invention
本申请实施例的目的是提供一种图像处理方法、装置及电子设备,能够解决现有技术中对导致图像处理算法的调整可靠性较低的问题。The purpose of the embodiments of the present application is to provide an image processing method, device and electronic equipment, which can solve the problem in the prior art that the adjustment reliability of the image processing algorithm is low.
第一方面,本申请实施例提供了一种图像处理方法,该方法包括:In the first aspect, the embodiment of the present application provides an image processing method, the method comprising:
获取第一图像,所述第一图像为采用图像处理算法对第二图像处理得到的图像,所述第二图像为摄像头采集得到的图像;Acquiring a first image, the first image is an image obtained by using an image processing algorithm to process a second image, and the second image is an image collected by a camera;
确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量;determining a first local high-frequency energy of an edge pixel in a foreground image region in the first image, and a second local high-frequency energy of an adjacent pixel of the edge pixel;
根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,所述图像虚化参数用于指示图像的虚化处理强度;Determine a first value of an image blurring parameter of the first image according to the first local high-frequency energy and the second local high-frequency energy, where the image blurring parameter is used to indicate the blurring processing intensity of the image ;
在所述第一值小于或等于第一阈值的情况下,调整所述图像处理算法的图像虚化处理强度。In a case where the first value is less than or equal to a first threshold, the image blur processing intensity of the image processing algorithm is adjusted.
第二方面,本申请实施例提供了一种图像处理装置,所述装置包括:In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
第一获取模块,用于获取第一图像,所述第一图像为采用图像处理算法对第二图像处理得到的图像,所述第二图像为摄像头采集得到的图像;The first acquiring module is configured to acquire a first image, the first image is an image obtained by processing a second image using an image processing algorithm, and the second image is an image acquired by a camera;
第一确定模块,用于确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量;A first determination module, configured to determine a first local high-frequency energy of an edge pixel in the foreground image region in the first image, and a second local high-frequency energy of an adjacent pixel of the edge pixel;
第二确定模块,用于根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,所述图像虚化参数用于指示图像虚化处理强度;A second determination module, configured to determine a first value of an image blurring parameter of the first image according to the first local high-frequency energy and the second local high-frequency energy, and the image blurring parameter is used for Indicates the intensity of image blurring;
第一调整模块,用于在所述第一值小于或等于第一阈值的情况下,调整所述图像处理算法的图像虚化处理强度。A first adjustment module, configured to adjust the image blur processing strength of the image processing algorithm when the first value is less than or equal to a first threshold.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括处理器和存储器,所述存储器存储可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的方法的步骤。In the third aspect, the embodiment of the present application provides an electronic device, the electronic device includes a processor and a memory, the memory stores programs or instructions that can run on the processor, and the programs or instructions are processed by the The steps of the method described in the first aspect are realized when the controller is executed.
第四方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的方法。In the fifth aspect, the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
第六方面,本申请实施例提供一种程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如第一方面所述的方法。In a sixth aspect, an embodiment of the present application provides a program product, the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the method described in the first aspect.
在本申请实施例中,在获取到采用图像处理算法处理得到的第一图像之后,可以通过确定第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及边缘像素点的相邻像素点的第二局部高频能量,来确定第一图像的图像虚化参数的第一值,图像虚化参数用于指示图像虚化处理强度。在第一值小于或等于第一阈值,即图像处理算法的虚化效果较差的情况下,可以调整图像处理算法的图像虚化处理强度,以提高图像处理算法的虚化效果。相比于人眼评估,通过确定图像处理算法处理得到的图像的前景图像区域中边缘像素点及其相邻像素点的局部高频能量,来评估图像处理算法的图像虚化处理强度,可以提高对图像处理算法处理得到的图像的评估可靠性,进而可以提高图像处理算法的调整可靠性。In the embodiment of the present application, after the first image processed by the image processing algorithm is obtained, the first local high-frequency energy of the edge pixel in the foreground image area in the first image and the first local high-frequency energy of the edge pixel can be determined. The second local high-frequency energy of adjacent pixels is used to determine the first value of the image blurring parameter of the first image, and the image blurring parameter is used to indicate the intensity of image blurring processing. When the first value is less than or equal to the first threshold, that is, the blur effect of the image processing algorithm is poor, the image blur processing intensity of the image processing algorithm may be adjusted to improve the blur effect of the image processing algorithm. Compared with human eye evaluation, by determining the local high-frequency energy of the edge pixel and its adjacent pixels in the foreground image area of the image processed by the image processing algorithm to evaluate the image blur processing strength of the image processing algorithm, it can improve The evaluation reliability of the image processed by the image processing algorithm can further improve the adjustment reliability of the image processing algorithm.
附图说明Description of drawings
图1是本申请实施例提供的图像处理方法的流程图之一;Fig. 1 is one of the flowcharts of the image processing method provided by the embodiment of the present application;
图2是本申请实施例提供的第一图像的示意图之一;Fig. 2 is one of the schematic diagrams of the first image provided by the embodiment of the present application;
图3是本申请实施例提供的第一图像的示意图之二;Fig. 3 is the second schematic diagram of the first image provided by the embodiment of the present application;
图4是本申请实施例提供的图像处理方法的流程图之二;Fig. 4 is the second flowchart of the image processing method provided by the embodiment of the present application;
图5是本申请实施例提供的图像处理装置的结构图;FIG. 5 is a structural diagram of an image processing device provided in an embodiment of the present application;
图6是本申请实施例提供的电子设备的结构图之一;FIG. 6 is one of the structural diagrams of the electronic device provided by the embodiment of the present application;
图7是本申请实施例提供的电子设备的结构图之二。FIG. 7 is the second structural diagram of the electronic device provided by the embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。The following will clearly describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in this application belong to the protection scope of this application.
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second" and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific sequence or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application can be practiced in sequences other than those illustrated or described herein, and that references to "first," "second," etc. distinguish Objects are generally of one type, and the number of objects is not limited. For example, there may be one or more first objects. In addition, "and/or" in the specification and claims means at least one of the connected objects, and the character "/" generally means that the related objects are an "or" relationship.
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的图像处理方法进行详细地说明。The image processing method provided by the embodiment of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.
图1是本申请实施例提供的图像处理方法的流程图之一。图像处理方法可以应用于电子设备。电子设备可以通过摄像头采集图像,可以通过图像处理算法对图像进行处理,如:虚化、调色等。如图1所示,图像处理方法可以包括:FIG. 1 is one of the flowcharts of the image processing method provided by the embodiment of the present application. The image processing method can be applied to electronic devices. Electronic devices can collect images through cameras, and can process images through image processing algorithms, such as: blurring, toning, and so on. As shown in Figure 1, image processing methods can include:
步骤101,获取第一图像,所述第一图像为采用图像处理算法对第二图像处理得到的图像,所述第二图像为摄像头采集得到的图像。
第二图像可以为电子设备的摄像头采集得到的图像,也可以是其他电子设备的摄像头采集得到的图像,也就是说,第二图像可以为电子设备通过自身的摄像头采集到的图像、下载的其他电子设备的摄像头采集得到的图像或接收的其他电子设备的摄像头采集得到的图像。进一步地,摄像头可以为前置摄像头;或,摄像头可以为后置摄像头。The second image can be an image collected by the camera of the electronic device, or an image collected by the camera of other electronic devices. An image collected by a camera of an electronic device or received by a camera of another electronic device. Further, the camera may be a front camera; or, the camera may be a rear camera.
电子设备在获取到第二图像之后,可以采用自身的图像处理算法对第二图像进行处理,得到第一图像。After acquiring the second image, the electronic device may use its own image processing algorithm to process the second image to obtain the first image.
步骤102,确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量。
在本申请实施例中,可以通过确定采用图像处理算法处理得到的图像中前景图像区域中边缘像素点及其相邻像素点的局部高频能量,来评估图像处理算法的虚化效果。In the embodiment of the present application, the blurring effect of the image processing algorithm can be evaluated by determining the local high-frequency energy of the edge pixel point and its adjacent pixel points in the foreground image area of the image processed by the image processing algorithm.
可以理解地是,第一图像中的前景图像区域包括的边缘像素点的数量大于1。具体实现时,可以通过第一图像中的前景图像区域的至少两个边缘像素点及其相邻像素点的局部高频能量,来评估图像处理算法的虚化效果。It can be understood that the number of edge pixels included in the foreground image area in the first image is greater than 1. During specific implementation, the blurring effect of the image processing algorithm may be evaluated through local high-frequency energy of at least two edge pixels of the foreground image area in the first image and the local high-frequency energy of its adjacent pixels.
针对不同的边缘像素点,其相邻像素点的确定方式可以相同。边缘像素点的相邻像素点可以包括:边缘像素点的上方、下方、左方和/或右方距离最近的像素点,进一步地,上方可以包括以下至少一项:左上方、正上方和右上方;下方可以包括以下至少一项:左下方、正下方和右下方,左方和右方类似。作为一个示例,假设一个像素点的大小为1×1,记边缘像素点的坐标为(x,y),其相邻像素点可以包括X轴和Y轴方向相邻像素点,如:坐标为(x-1,y)的像素点,坐标为(x+1,y)的像素点,坐标为(x,y-1)的像素点,坐标为(x,y+1)的像素点。For different edge pixel points, the determination method of its adjacent pixel points may be the same. Adjacent pixels of the edge pixel may include: the nearest pixel above, below, left and/or right of the edge pixel, and further, above may include at least one of the following: upper left, right above and upper right square; bottom may include at least one of the following: bottom left, bottom right, and bottom right, and left and right are similar. As an example, assuming that the size of a pixel is 1×1, record the coordinates of the edge pixel as (x, y), and its adjacent pixels can include adjacent pixels in the X-axis and Y-axis directions, such as: the coordinates are The pixel point of (x-1, y), the pixel point of coordinates (x+1, y), the pixel point of coordinates of (x, y-1), the pixel point of coordinates of (x, y+1).
在步骤102中,电子设备可以先确定第一图像中的前景图像区域的至少两个边缘像素点及其相邻像素点。之后,针对确定的各像素点,可确定其局部高频能量。本申请实施例并不限定像素点的局部高频能量的确定方式,任何可用于确定像素点的局部高频能量的方式均可落入本申请实施例的保护范围之内。为方便区分,在本申请实施例中,将前景图像区域中边缘像素点的局部高频能量称为第一局部高频能量,将边缘像素点的相邻像素点的局部高频能量称为第二局部高频能量,但值得注意地是,第一局部高频能量和第二局部高频能量的确定方式可以相同。In
步骤103,根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,所述图像虚化参数用于指示图像虚化处理强度。
在步骤103中,针对每个边缘像素点,可以根据其自身的局部高频能量,以及其相邻像素点的局部高频能量,确定该边缘像素点与其相邻像素点过度是否自然。In
在本申请实施例中,若某边缘像素点与其相邻像素点过度自然,可以将该边缘像素点称为虚化自然点或第一像素点。若某边缘像素点与其相邻像素点过度自然,可以将该边缘像素点称为虚化不自然点。In the embodiment of the present application, if an edge pixel point and its adjacent pixel points are too natural, the edge pixel point may be called a blurred natural point or a first pixel point. If an edge pixel point and its adjacent pixel points are too natural, the edge pixel point can be called an unnatural blurred point.
如此,根据所述第一局部高频能量和所述第二局部高频能量,可以得到第一图像中的虚化不自然点的数量。之后,可以基于第一图像中的虚化不自然点的数量,确定第一图像的图像虚化参数的第一值。第一图像的图像虚化参数的第一值与第一图像中虚化不自然点的数量可以负正相关,即第一图像中虚化不自然点的数量越多,第一图像的图像虚化参数的第一值越小,反之越大。In this way, according to the first local high-frequency energy and the second local high-frequency energy, the number of blurred and unnatural points in the first image can be obtained. Afterwards, the first value of the image blurring parameter of the first image may be determined based on the number of blurred unnatural points in the first image. The first value of the image blurring parameter of the first image may be negatively and positively correlated with the number of blurred unnatural points in the first image, that is, the more the number of blurred unnatural points in the first image, the more blurred the image of the first image is. The smaller the first value of the optimization parameter is, the larger it is vice versa.
第一图像的图像虚化参数的第一值,用于表征第一图像的图像虚化处理强度,由于第一图像采用图像处理算法处理得到,因此,可以通过第一图像的图像虚化参数的第一值,来评估图像处理算法的图像虚化处理强度。The first value of the image blurring parameter of the first image is used to characterize the image blurring processing strength of the first image. Since the first image is obtained by using an image processing algorithm, the value of the image blurring parameter of the first image can be obtained. The first value is used to evaluate the image blur processing strength of the image processing algorithm.
第一图像的图像虚化参数的第一值越大,表征第一图像的图像虚化处理强度越高,图像处理算法的图像虚化处理强度越高。反之,第一图像的图像虚化参数的第一值越小,表征第一图像的图像虚化处理强度越低,图像处理算法的图像虚化处理强度越低。图像虚化处理强度与图像虚化效果的关系可以正相关,即图像虚化处理强度越高,图像虚化效果越好,反之越差。The larger the first value of the image blurring parameter of the first image, the higher the image blurring intensity of the first image, and the higher the image blurring intensity of the image processing algorithm. Conversely, the smaller the first value of the image blurring parameter of the first image, the lower the image blurring intensity of the first image, and the lower the image blurring intensity of the image processing algorithm. The relationship between the image blurring intensity and the image blurring effect may be positively correlated, that is, the higher the image blurring intensity is, the better the image blurring effect is, and vice versa.
因此,在通过步骤103得到第一图像的图像虚化参数的值,即第一值之后,可以将第一值与第一阈值进行比较。第一阈值为表征图像处理算法的图像虚化效果符合要求的最低值,可以根据对图像虚化效果的实际需求设定,本申请实施例对此不作限定。Therefore, after the value of the image blurring parameter of the first image, that is, the first value is obtained through
在第一值小于或等于第一阈值的情况下,说明图像处理算法的图像虚化效果较差,可执行步骤104。在第一值大于第一阈值的情况下,说明图像处理算法的图像虚化效果较好,可不对图像处理算法的图像虚化处理强度进行调整。If the first value is less than or equal to the first threshold, it means that the image blurring effect of the image processing algorithm is poor, and step 104 may be performed. If the first value is greater than the first threshold, it indicates that the image blurring effect of the image processing algorithm is better, and the image blurring processing strength of the image processing algorithm may not be adjusted.
步骤104,在所述第一值小于或等于第一阈值的情况下,调整所述图像处理算法的图像虚化处理强度。
在所述第一图像的图像虚化参数的第一值小于或等于第一阈值的情况下,说明图像处理算法的虚化效果较差,虚化自然度有待提高,可以对图像处理算法进行优化,调整图像处理算法的图像处理强度,以提高图像处理算法的虚化效果。可以理解地是,采用调整后的图像处理算法处理得到的图像的虚化效果,由于采用调整前的图像处理算法处理得到的图像的虚化效果。In the case that the first value of the image blurring parameter of the first image is less than or equal to the first threshold, it indicates that the blurring effect of the image processing algorithm is poor, and the naturalness of blurring needs to be improved, and the image processing algorithm can be optimized , adjust the image processing intensity of the image processing algorithm to improve the blur effect of the image processing algorithm. It can be understood that the blur effect of the image processed by the adjusted image processing algorithm is due to the blur effect of the image obtained by the image processing algorithm before adjustment.
本申请实施例的图像处理方法,在获取到采用图像处理算法处理得到的第一图像之后,可以通过确定第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及边缘像素点的相邻像素点的第二局部高频能量,来确定第一图像的图像虚化参数的第一值,图像虚化参数用于指示图像虚化处理强度。在第一值小于或等于第一阈值,即图像处理算法的虚化效果较差的情况下,可以调整图像处理算法的图像虚化处理强度,以提高图像处理算法的虚化效果。这样,相比于人工评估,通过确定图像处理算法处理得到的图像的前景图像区域中边缘像素点及其相邻像素点的局部高频能量,来评估图像处理算法的图像虚化处理强度,可以提高对图像处理算法处理得到的图像的评估可靠性,进而可以提高图像处理算法的调整可靠性。In the image processing method of the embodiment of the present application, after the first image processed by the image processing algorithm is obtained, the first local high-frequency energy of the edge pixel in the foreground image area in the first image can be determined, and the edge pixel The second local high-frequency energy of adjacent pixels of the point is used to determine the first value of the image blurring parameter of the first image, and the image blurring parameter is used to indicate the intensity of image blurring processing. When the first value is less than or equal to the first threshold, that is, the blur effect of the image processing algorithm is poor, the image blur processing intensity of the image processing algorithm may be adjusted to improve the blur effect of the image processing algorithm. In this way, compared with manual evaluation, by determining the local high-frequency energy of the edge pixel and its adjacent pixels in the foreground image area of the image processed by the image processing algorithm, the image blurring processing strength of the image processing algorithm can be evaluated. Improve the evaluation reliability of the image processed by the image processing algorithm, and then improve the adjustment reliability of the image processing algorithm.
在一些实施例中,所述确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量,可以包括:In some embodiments, the determining the first local high-frequency energy of an edge pixel in the foreground image region in the first image, and the second local high-frequency energy of an adjacent pixel of the edge pixel, Can include:
对至少两个像素点中的每一像素点,确定所述像素点对应的局部区域,所述局部区域包括所述像素点以及所述像素点的至少一个相邻像素点;For each of the at least two pixels, determine a local area corresponding to the pixel, the local area includes the pixel and at least one adjacent pixel of the pixel;
根据所述局部区域中各像素点的灰度值,确定所述像素点对应的第一局部灰度值;determining a first local gray value corresponding to the pixel according to the gray value of each pixel in the local area;
对所述第一局部灰度值进行高斯滤波,得到所述像素点对应的第二局部灰度值;performing Gaussian filtering on the first local gray value to obtain a second local gray value corresponding to the pixel;
根据所述第一局部灰度值和所述第二局部灰度值,确定所述像素点的局部高频能量;determining the local high-frequency energy of the pixel according to the first local gray value and the second local gray value;
其中,所述至少两个像素点包括所述第一图像中的前景图像区域中的边缘像素点,以及所述边缘像素点的相邻像素点;在所述像素点为所述边缘像素点的情况下,所述像素点的局部高频能量为第一局部高频能量;在所述像素点为所述边缘像素点的相邻像素点的情况下,所述像素点的局部高频能量为第二局部高频能量。Wherein, the at least two pixels include edge pixels in the foreground image area in the first image, and adjacent pixels of the edge pixels; In this case, the local high-frequency energy of the pixel is the first local high-frequency energy; when the pixel is an adjacent pixel of the edge pixel, the local high-frequency energy of the pixel is Second local high frequency energy.
具体实现时,可以先根据像素点的局部区域。一种可选地实现方式中,某像素点的局部区域的中心点可以为该像素点,大小可以预先确定。作为一个示例,假设各像素点的局部区域包括3×3个像素点,那么,像素点的局部区域包括其自身,以及其左上方、正上方、右上方、正左方、正右方、左下方、正下方和左下方的第一个像素点。In specific implementation, it may first be based on the local area of the pixel. In an optional implementation manner, the center point of the local area of a certain pixel point may be the pixel point, and the size may be predetermined. As an example, assuming that the local area of each pixel includes 3×3 pixels, then the local area of the pixel includes itself, and its upper left, right upper, upper right, right left, right right, lower left The first pixel on the side, right below and bottom left.
之后,可以利用像素点的局部区域中各像素点的灰度值,确定像素点对应的第一局部灰度值。Afterwards, the first local gray value corresponding to the pixel can be determined by using the gray value of each pixel in the local region of the pixel.
在一些可选地实现方式中,可以通过公式(1)确定像素点(x,y)的第一局部灰度值s(x,y):In some optional implementation manners, the first local gray value s(x, y) of the pixel point (x, y) can be determined by formula (1):
其中,U(x,y)为像素点(x,y)的局部区域;j为像素点(x,y)的局部区域的任一个像素点;f(j)为像素点j的灰度值。像素点j的灰度值可以为像素点j的任一个颜色通道的值,也可以为像素点j的全部颜色通道的均值。Among them, U(x, y) is the local area of the pixel point (x, y); j is any pixel point in the local area of the pixel point (x, y); f(j) is the gray value of the pixel point j . The grayscale value of pixel j may be the value of any color channel of pixel j, or the average value of all color channels of pixel j.
在另一些可选地实现方式中,可以将像素点的局部区域中各像素点的灰度值的均值,确定为像素点对应的第一局部灰度值。In some other optional implementation manners, the average value of the grayscale values of each pixel in the local area of the pixel may be determined as the first local grayscale value corresponding to the pixel.
之后,可以对所述第一局部灰度值进行高斯滤波,得到所述像素点对应的第二局部灰度值。具体实现时,可将第一局部灰度值输入高斯滤波器,利用高斯滤波器的标准差σ对第一局部灰度值进行高斯滤波,得到第二局部灰度值。Afterwards, Gaussian filtering may be performed on the first local grayscale value to obtain a second local grayscale value corresponding to the pixel. During specific implementation, the first local gray value may be input into the Gaussian filter, and the first local gray value may be Gaussian filtered using the standard deviation σ of the Gaussian filter to obtain the second local gray value.
之后,可以根据所述第一局部灰度值和所述第二局部灰度值,确定所述像素点的局部高频能量。Afterwards, the local high-frequency energy of the pixel point may be determined according to the first local gray value and the second local gray value.
在一些可选地实现方式中,可以通过公式(2)确定像素点(x,y)的局部高频能量h(x,y):In some optional implementation manners, the local high-frequency energy h(x, y) of a pixel point (x, y) can be determined by formula (2):
h(x,y)=(s(x,y)-sσ(x,y))2 (2)h(x,y)=(s(x,y)-s σ (x,y)) 2 (2)
其中,sσ(x,y)为像素点(x,y)的第二局部灰度值。Wherein, s σ (x, y) is the second local gray value of the pixel point (x, y).
在另一些可选地实现方式中,可以将所述第一局部灰度值和所述第二局部灰度值的差值,直接确定所述像素点的局部高频能量。In other optional implementation manners, the difference between the first local grayscale value and the second local grayscale value may be used to directly determine the local high-frequency energy of the pixel.
通过上述方式,通过像素点的局部区域的局部灰度值,以及高斯过滤后的局部灰度值,得到像素点的局部高频能量,如此,可以使得像素点的局部高频能量通过提取像素点的局部区域的高频信息得到,进而提高像素点的局部高频能量的确定可靠性。In the above way, the local high-frequency energy of the pixel is obtained through the local gray value of the local area of the pixel and the local gray value after Gaussian filtering. In this way, the local high-frequency energy of the pixel can be obtained by extracting the pixel The high-frequency information of the local area of the pixel is obtained, thereby improving the reliability of determining the local high-frequency energy of the pixel.
在一些实施例中,所述根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,包括:In some embodiments, the determining the first value of the image blurring parameter of the first image according to the first local high-frequency energy and the second local high-frequency energy includes:
对所述前景图像区域中的每一边缘像素点,在所述边缘像素点的第一局部高频能量大于所述边缘像素点的相邻像素点的第二局部高频能量的均值的情况下,将所述边缘像素点确定为第一像素点;For each edge pixel in the foreground image area, when the first local high-frequency energy of the edge pixel is greater than the mean value of the second local high-frequency energy of adjacent pixels of the edge pixel , determining the edge pixel as the first pixel;
根据所述至少两个边缘像素点中的所述第一像素点的数量,确定所述第一图像的图像虚化参数的第一值。A first value of an image blurring parameter of the first image is determined according to the number of the first pixels in the at least two edge pixels.
在此实施例中,通过比较边缘像素点的局部高频能量,以及相邻像素点的局部高频能量的均值,确定边缘像素点是否为第一像素点。In this embodiment, it is determined whether the edge pixel is the first pixel by comparing the local high-frequency energy of the edge pixel with the mean value of the local high-frequency energy of adjacent pixels.
在一些可选地实现方式中,可以将h(x,y)与1/2(h(x-1,y)+h(x+1,y))进行比较,确定像素点(x,y)是否为第一像素点。在另一些可选地实现方式中,可以将h(x,y)与1/2(h(x,y-1)、h(x,y+1))进行比较,确定像素点(x,y)是否为第一像素点。In some optional implementations, h(x, y) can be compared with 1/2(h(x-1, y)+h(x+1, y)) to determine the pixel point (x, y ) is the first pixel. In other optional implementation manners, h(x, y) can be compared with 1/2(h(x, y-1), h(x, y+1)), and the pixel point (x, y+1) can be determined y) Whether it is the first pixel.
在边缘像素点的局部高频能量大于其相邻像素点的局部高频能量的均值的情况下,说明该边缘像素点的能量渐变度较大,该边缘像素点与背景过渡不自然,可以将其确定为虚化不自然点。When the local high-frequency energy of an edge pixel is greater than the average value of local high-frequency energy of its adjacent pixels, it indicates that the energy gradient of the edge pixel is relatively large, and the transition between the edge pixel and the background is unnatural, and the It is determined as the unnatural point of blurring.
在边缘像素点的局部高频能量小于或等于其相邻像素点的局部高频能量的均值的情况下,说明该边缘像素点的能量渐变度较小,该边缘像素点与背景过渡自然,可以将其确定为第一像素点。In the case that the local high-frequency energy of an edge pixel is less than or equal to the mean value of the local high-frequency energy of its adjacent pixels, it means that the energy gradient of the edge pixel is small, and the transition between the edge pixel and the background is natural, which can be Determine it as the first pixel point.
之后,可以统计第一图像中的第一像素点的数量,并将其与第一预设值进行比较,进而确定第一图像的图像虚化参数的第一值。Afterwards, the number of first pixels in the first image may be counted and compared with the first preset value, so as to determine the first value of the image blur parameter of the first image.
在一些可选地实现方式中,第一预设值可以预先设定。在另一些可选地实现方式中,第一预设值可以基于选取的第一图像的前景图像区域的边缘像素点的数量Nhe确定,Nhe为大于1的整数,如第一预设值可以为1/4(Nhe)。In some optional implementation manners, the first preset value may be preset. In other optional implementations, the first preset value can be determined based on the number N he of edge pixels in the foreground image area of the selected first image, where N he is an integer greater than 1, such as the first preset value It can be 1/4(N he ).
在第一像素点的数量Nhn大于第一预设值的情况下,可以将所述第一图像的图像虚化参数的第一值确定为不合格,即小于或等于第一阈值。When the number N hn of the first pixels is greater than the first preset value, the first value of the image blurring parameter of the first image may be determined as unqualified, that is, less than or equal to the first threshold.
在Nhn小于或等于第一预设值的情况下,可以将所述第一图像的图像虚化参数的第一值确定为合格,即大于第一阈值。In a case where N hn is less than or equal to the first preset value, the first value of the image blur parameter of the first image may be determined as qualified, that is, greater than the first threshold.
通过上述方式,通过比较各边缘像素点的局部高频能量及其相邻像素点的局部高频能量的均值,确定第一图像中的虚化不自然点的数量,之后,基于第一图像中的虚化不自然点的数量与第一阈值的比较结果,确定第一图像的图像虚化参数的第一值,如此,可以使得第一图像的图像虚化参数的第一值真实反映第一图像的虚化效果,提高第一图像的虚化效果的评估可靠性,进而提高图像处理算法的调整可靠性。In the above manner, by comparing the local high-frequency energy of each edge pixel point with the mean value of the local high-frequency energy of adjacent pixel points, the number of blurred unnatural points in the first image is determined, and then, based on the The first value of the image blurring parameter of the first image is determined by comparing the number of blurred unnatural points with the first threshold, so that the first value of the image blurring parameter of the first image can truly reflect the first The blurring effect of the image improves the evaluation reliability of the blurring effect of the first image, thereby improving the adjustment reliability of the image processing algorithm.
在本申请实施例中,考虑到图像的质量除受到图像的虚化自然度影响之外,还可能受到图像的其他因素影响,如:色差、脸部阴影、构图倾斜度、成像距离和成像边缘偏移等。因此,本申请实施例还可以通过对图像的其他因素进行评估,来调整图像处理算法,或,指导图像的拍摄。In the embodiment of this application, it is considered that the quality of the image may be affected by other factors of the image besides the blurred naturalness of the image, such as: chromatic aberration, facial shadow, composition inclination, imaging distance and imaging edge offset etc. Therefore, in the embodiment of the present application, an image processing algorithm may be adjusted, or image shooting may be guided, by evaluating other factors of the image.
在一些实施例中,所述获取第一图像之后,所述方法还包括:In some embodiments, after the acquisition of the first image, the method further includes:
确定所述第一图像中第一区域的各色域参数的均值,所述第一区域为包括第一元素的区域;determining the mean value of each color gamut parameter of a first area in the first image, the first area being an area including a first element;
根据所述第一区域的各色域参数的均值与所述第一区域的各色域参数的参考值,确定所述第一区域的色差值;Determine the color difference value of the first area according to the mean value of each color gamut parameter of the first area and the reference value of each color gamut parameter of the first area;
根据所述色差值,确定所述第一图像的图像美化参数的第二值,所述图像美化参数用于指示图像美化处理强度;Determine a second value of an image beautification parameter of the first image according to the color difference value, where the image beautification parameter is used to indicate the intensity of image beautification processing;
在所述第二值小于或等于第二阈值的情况下,调整所述图像处理算法的图像美化处理强度。In a case where the second value is less than or equal to a second threshold, the intensity of image beautification processing of the image processing algorithm is adjusted.
在此实施例中,可以通过计算采用图像处理算法处理得到的图像的图像美化参数的值,来评估图像处理算法的图像美化处理强度。In this embodiment, the image beautification strength of the image processing algorithm can be evaluated by calculating the value of the image beautification parameter of the image processed by the image processing algorithm.
第一区域可以为包括第一元素的区域,第一元素可以为用户对颜色自然度要求较高的元素,如:人脸,绿色植物等,可以预先设定。The first area may be an area including the first element, and the first element may be an element that the user requires a high degree of color naturalness, such as a human face, a green plant, etc., and may be preset.
第一区域的各色域参数可以通过对第一区域中各个像素点的各色域参数的值求平均得到。Each color gamut parameter of the first area may be obtained by averaging values of each color gamut parameter of each pixel in the first area.
第一区域的各色域参数的参考值,可以预先设定,可以作为确定第一区域的颜色是否自然的参考色,也可以称为记忆色。因此,可以将所述第一区域的各色域参数的均值与所述第一区域的各色域参数的参考值进行比较,得到所述第一区域的色差值。The reference values of the color gamut parameters in the first area can be preset, and can be used as a reference color for determining whether the color of the first area is natural, and can also be called a memory color. Therefore, the average value of each color gamut parameter in the first area may be compared with the reference value of each color gamut parameter in the first area to obtain a color difference value in the first area.
所述第一区域的各色域参数的均值与所述第一区域的各色域参数的参考值属于同一色域,如RGB色域、Lab色域等。The mean value of each color gamut parameter in the first area and the reference value of each color gamut parameter in the first area belong to the same color gamut, such as RGB color gamut, Lab color gamut, and the like.
以Lab色域为例进行说明。在此例中,可以先对第一区域的像素点的各色域参数的值求平均,得到RGB色域的各色域参数均值C(r,g,b),其中,C(r)表示第一区域的红色通道的颜色均值,C(g)表示第一区域的颜色通道的颜色均值,C(b)表示第一区域的蓝色通道的颜色均值。之后,将RGB色域的C(r,g,b)转换为Lab色域的C(L,a,b),其中,C(L)表示第一区域的照度均值,C(a)表示第一区域的从红色至绿色的范围的颜色均值,C(b)表示第一区域的从蓝色至黄色的范围的颜色均值。记第一区域的各色域参数为V(L,a,b)。可以通过公式(3)计算得到第一区域的色差值D:The Lab color gamut is used as an example for illustration. In this example, the values of the color gamut parameters of the pixels in the first area can be averaged first to obtain the mean value C(r, g, b) of each color gamut parameter of the RGB color gamut, where C(r) represents the first The color mean value of the red channel of the region, C(g) represents the color mean value of the color channel of the first region, and C(b) represents the color mean value of the blue channel of the first region. Afterwards, convert C(r, g, b) of the RGB color gamut to C(L, a, b) of the Lab color gamut, where C(L) represents the average illuminance of the first area, and C(a) represents the C(b) represents the color mean value of the first region ranging from blue to yellow. Record each color gamut parameter of the first area as V(L, a, b). The color difference value D of the first area can be calculated by formula (3):
第一图像的图像美化参数的第二值,用于表征第一图像的图像美化处理强度,由于第一图像采用图像处理算法处理得到,因此,可以通过第一图像的图像美化参数的第二值,来评估图像处理算法的图像美化处理强度。The second value of the image beautification parameter of the first image is used to characterize the intensity of the image beautification processing of the first image. Since the first image is processed by an image processing algorithm, the second value of the image beautification parameter of the first image can be used , to evaluate the image beautification processing strength of the image processing algorithm.
第一图像的图像美化参数的第二值越大,表征第一图像的图像美化处理强度越高,图像处理算法的图像美化处理强度越高。反之,第一图像的图像美化参数的第二值越低,表征第一图像的图像美化处理强度越低,图像处理算法的图像美化处理强度越低。图像的美化处理强度与图像调色效果可以正相关,即图像美化处理强度越高,图像效果越好,反之越差。The larger the second value of the image beautification parameter of the first image, the higher the image beautification processing intensity of the first image, and the higher the image beautification processing intensity of the image processing algorithm. Conversely, the lower the second value of the image beautification parameter of the first image, the lower the image beautification processing intensity of the first image, and the lower the image beautification processing intensity of the image processing algorithm. The intensity of image beautification processing can be positively correlated with the effect of image toning, that is, the higher the intensity of image beautification processing, the better the image effect, and vice versa.
第一图像的图像美化参数的第二值与第一图像中第一区域的色差值负相关,即第一图像中第一区域的色差值越大,第一图像的图像美化参数的第二值越小,反之越大。The second value of the image beautification parameter of the first image is negatively correlated with the color difference value of the first region in the first image, that is, the larger the color difference value of the first region in the first image, the greater the value of the image beautification parameter of the first image. The smaller the binary value is, the larger it is.
在获取到第一区域的色差值后,可以将色差值与第二预设值进行比较。其中,第二预设值为预先设定的用于表征区域的颜色未失真的最大值,可以根据需求设定,本申请实施例对此不作限定。After the color difference value of the first area is acquired, the color difference value may be compared with a second preset value. Wherein, the second preset value is a preset maximum value used to characterize the undistorted color of the region, which can be set according to requirements, which is not limited in this embodiment of the present application.
在色差值大于第二预设值的情况下,说明第一区域的颜色失真,可以将第一图像的图像美化参数的第二值确定为不合格,即小于或等于第二阈值。第二值为表征图像处理算法的图像调色效果符合要求的最低值,可以根据对调色效果的实际需求设定,本申请实施例对此不作限定。If the color difference value is greater than the second preset value, it indicates that the color of the first region is distorted, and the second value of the image beautification parameter of the first image may be determined as unqualified, that is, less than or equal to the second threshold. The second value is the minimum value representing that the image toning effect of the image processing algorithm meets the requirements, which can be set according to the actual requirement on the toning effect, which is not limited in this embodiment of the present application.
在色差值小于或等于第二阈值的情况下,说明第一区域的颜色未失真,可以将第一图像的图像美化参数的第二值确定为合格,即大于第二阈值。If the color difference value is less than or equal to the second threshold, it means that the color of the first region is not distorted, and the second value of the image beautification parameter of the first image can be determined as qualified, that is, greater than the second threshold.
在所述第一图像的图像美化参数的第二值小于或等于第二阈值的情况下,说明图像处理算法的调色效果较差,有待提高,可以对图像处理算法的图像美化处理强度进行优化,提高图像处理算法的调色效果。可以理解地是,采用调整后的图像处理算法处理得到的图像的调色效果,由于采用调整前的图像处理算法处理得到的图像的调色效果。In the case that the second value of the image beautification parameter of the first image is less than or equal to the second threshold value, it indicates that the color toning effect of the image processing algorithm is poor and needs to be improved, and the image beautification processing intensity of the image processing algorithm can be optimized. , to improve the toning effect of the image processing algorithm. It can be understood that the toning effect of the image processed by the adjusted image processing algorithm is due to the toning effect of the image obtained by using the unadjusted image processing algorithm.
通过上述方式,可以通过评估采用图像处理算法处理得到的图像中的第一区域的美化处理强度进行评估,来评估图像处理算法的调色效果。在图像的图像美化参数的值较低时,可以对图像处理算法进行调整,以优化图像处理算法的调色效果。这样,可以提高图像处理算法的评估可靠性,进而可以提高图像处理算法的调整可靠性。In the manner described above, the toning effect of the image processing algorithm can be evaluated by evaluating the beautification processing intensity of the first region in the image obtained through image processing algorithm processing. When the value of the image beautification parameter of the image is low, the image processing algorithm can be adjusted to optimize the toning effect of the image processing algorithm. In this way, the evaluation reliability of the image processing algorithm can be improved, and further the adjustment reliability of the image processing algorithm can be improved.
在一些实施例中,所述获取第一图像之后,所述方法还包括:In some embodiments, after the acquisition of the first image, the method further includes:
确定所述第一图像中第二区域的灰度均值,所述第二区域为包括第二元素的区域;determining a gray mean value of a second area in the first image, the second area being an area including a second element;
对所述第二区域中的每一像素点,在所述像素点的灰度值小于所述灰度均值的情况下,将所述像素点确定为第二像素点;For each pixel in the second area, if the grayscale value of the pixel is smaller than the average grayscale value, determine the pixel as a second pixel;
根据所述第二区域中的所述第二像素点的数量,确定所述第一图像的图像阴影参数的第三值,所述图像阴影参数用于指示图像阴影处理强度;determining a third value of an image shading parameter of the first image according to the number of the second pixel points in the second area, where the image shading parameter is used to indicate the intensity of image shading processing;
在所述第三值小于或等于第三阈值的情况下,执行第一操作,所述第一操作包括以下至少一项:In a case where the third value is less than or equal to a third threshold, a first operation is performed, and the first operation includes at least one of the following:
输出第一提示信息,所述第一提示信息用于提示用户调整拍摄位置;Outputting first prompt information, the first prompt information is used to prompt the user to adjust the shooting position;
调整所述图像处理算法的图像阴影处理强度。Adjust the image shading intensity of the image processing algorithm.
在此实施例中,第二图像可以为通过电子设备自身的摄像头采集的图像,进一步地,电子设备可以处于拍摄状态。In this embodiment, the second image may be an image collected by a camera of the electronic device itself, and further, the electronic device may be in a shooting state.
第二区域可以为包括第二元素的区域,第二元素可以为用户对阴影自然度要求较高的元素,如人脸等,可以预先设定。The second area may be an area including a second element, and the second element may be an element for which the user requires high naturalness of shadows, such as a human face, and may be preset.
第二区域的阴影可能是由图像处理算法处理不当所致,也可能是用户的拍摄位置不合适所致,因此,电子设备可以通过计算采用图像处理算法处理得到的图像的第二区域的图像阴影参数的值,来执行以下至少一项:评估图像处理算法的图像阴影处理强度,决定是否指导用户调整拍摄位置,以避免因第二区域的阴影过大影响图像质量。The shadow in the second area may be caused by improper processing of the image processing algorithm, or it may be caused by the inappropriate shooting position of the user. Therefore, the electronic device can calculate the image shadow of the second area of the image obtained by using the image processing algorithm. The value of the parameter is used to perform at least one of the following: evaluate the image shadow processing strength of the image processing algorithm, and determine whether to guide the user to adjust the shooting position, so as to avoid affecting the image quality due to the excessive shadow of the second area.
具体实现时,可以先确定第一图像中第二区域的灰度均值。第二区域的灰度均值可以通过对第二区域中各像素点的灰度值求平均得到。During specific implementation, the average gray value of the second region in the first image may be determined first. The average gray value of the second area can be obtained by averaging the gray values of the pixels in the second area.
之后,可以将第二区域中各像素点的灰度值,分别与灰度均值Im进行比较。将灰度值小于灰度均值的像素点确定为第二像素点,也可以称为阴影点。进一步地,可以将灰度值大于(1/2)Im,小于Im的像素点确定为阴影点。Afterwards, the grayscale value of each pixel in the second area may be compared with the grayscale mean value I m respectively. A pixel point whose grayscale value is smaller than the average grayscale value is determined as a second pixel point, which may also be called a shadow point. Further, pixel points whose gray values are greater than (1/2)I m and less than Im can be determined as shadow points.
第一图像的图像阴影参数的值,用于表征第一图像的图像阴影处理强度,一方面,由于第一图像采用图像处理算法处理得到,因此,可以通过第一图像的图像阴影参数的值,来评估图像处理算法的图像阴影处理强度;另一方面,可以通过第一图像的图像阴影参数的值,来决定是否指导用户调整拍摄位置。第一图像的图像阴影参数的值越高,表征第一图像的图像阴影处理强度越高,图像处理算法的图像阴影处理强度越高。反之,第一图像的图像阴影参数的值越低,表征第一图像的图像阴影处理强度越低,图像处理算法的图像阴影处理强度越高。图像阴影处理强度与图像阴影效果可以正相关,图像阴影处理强度越高,图像阴影效果越好,反之越差。The value of the image shadow parameter of the first image is used to characterize the intensity of the image shadow processing of the first image. On the one hand, since the first image is processed by an image processing algorithm, the value of the image shadow parameter of the first image can be used, to evaluate the image shadow processing strength of the image processing algorithm; on the other hand, it can be determined whether to guide the user to adjust the shooting position through the value of the image shadow parameter of the first image. The higher the value of the image shading parameter of the first image, the higher the image shading processing intensity representing the first image, and the higher the image shading processing intensity of the image processing algorithm. Conversely, the lower the value of the image shading parameter of the first image, the lower the image shading processing intensity representing the first image, and the higher the image shading processing intensity of the image processing algorithm. The image shading intensity is positively correlated with the image shading effect, the higher the image shading intensity is, the better the image shading effect is, and vice versa.
第一图像的图像阴影参数的值与第一图像中第二区域的阴影点负相关,即第一图像中第二区域的阴影点越多,第一图像的图像美化参数的第二值越低,反之越高。具体实现时,可以统计第二区域中阴影点的个数,并将其与第三预设值进行比较,以确定第一图像的图像阴影参数的值。The value of the image shadow parameter of the first image is negatively correlated with the shadow points of the second area in the first image, that is, the more shadow points of the second area in the first image, the lower the second value of the image beautification parameter of the first image , and vice versa. During specific implementation, the number of shadow points in the second area may be counted and compared with the third preset value to determine the value of the image shadow parameter of the first image.
第三预设值为预先设定的用于表征第二区域的阴影在允许范围内的最大值,可根据需求设定,本申请实施例对此不作限定。一种可选地实现方式中,第三预设值可以预先设定。在另一些可选地实现方式中,第三预设值可以基于第二区域的像素点的数量Nh确定,如第三预设值可以为1/3(Nh)。The third preset value is a preset maximum value within an allowable range for representing the shadow of the second area, which can be set according to requirements, and is not limited in this embodiment of the present application. In an optional implementation manner, the third preset value may be preset. In other optional implementation manners, the third preset value may be determined based on the number N h of pixels in the second area, for example, the third preset value may be 1/3(N h ).
在阴影点的数量大于第三预设阈值的情况下,说明第二区域的阴影区域过大,可将第一图像的图像阴影参数的值确定为不合格,即小于或等于第三阈值。第三阈值可以根据对阴影效果的实际需求设定,本申请实施例对此不作限定。If the number of shadow points is greater than the third preset threshold, it means that the shadow area of the second area is too large, and the value of the image shadow parameter of the first image can be determined to be unqualified, that is, less than or equal to the third threshold. The third threshold may be set according to actual requirements for shadow effects, which is not limited in this embodiment of the present application.
在阴影点的数量小于或等于第三阈值的情况下,说明第二区域的阴影区域在允许范围之内,可以将第一图像的图像阴影参数的值确定为合格,即大于第三阈值。If the number of shadow points is less than or equal to the third threshold, it means that the shadow area of the second area is within the allowable range, and the value of the image shadow parameter of the first image can be determined to be qualified, that is, greater than the third threshold.
在所述第一图像的图像阴影参数的值小于或等于第三阈值的情况下,说明图像处理算法的阴影效果较差,有待提高,可以对图像处理算法进行优化,提高图像处理算法的阴影效果。或者,说明用户的拍摄位置不合适,需要调整拍摄位置,可以输出第一提示信息,提示用户调整拍摄位置,以避免因第二区域的阴影区域过大影响图像质量。In the case where the value of the image shadow parameter of the first image is less than or equal to the third threshold, it indicates that the shadow effect of the image processing algorithm is poor and needs to be improved, and the image processing algorithm can be optimized to improve the shadow effect of the image processing algorithm . Alternatively, it indicates that the user's shooting position is inappropriate and the shooting position needs to be adjusted, and the first prompt message may be output to remind the user to adjust the shooting position, so as to avoid affecting the image quality due to the large shadow area of the second area.
通过上述方式,可以通过评估采用图像处理算法处理得到的图像中的阴影处理参数的值,来评估图像处理算法的阴影效果,和/或,来决定是否指导用户调整拍摄位置。在图像阴影参数的值较低时,可以对图像处理算法进行调整,以执行以下至少一项:优化图像处理算法的阴影效果,进而提高采用图像处理算法处理的图像的质量;输出用于提示用户调整拍摄位置的提示信息。如此,可以避免提高图像处理算法的阴影效果,或,提高拍摄效果。Through the above method, the shadow effect of the image processing algorithm can be evaluated by evaluating the value of the shadow processing parameter in the image processed by the image processing algorithm, and/or, it can be determined whether to guide the user to adjust the shooting position. When the value of the image shadow parameter is low, the image processing algorithm can be adjusted to perform at least one of the following: optimize the shadow effect of the image processing algorithm, thereby improving the quality of the image processed by the image processing algorithm; the output is used to prompt the user Tips for adjusting the shooting position. In this way, it is possible to avoid improving the shadow effect of the image processing algorithm, or to improve the shooting effect.
在一些实施例中,所述获取第一图像之后,所述方法还包括:In some embodiments, after the acquisition of the first image, the method further includes:
确定所述人脸区域的第一关键点和第二关键点,所述第一关键点和所述第二关键点满足:在人脸未倾斜的情况下,所述第一关键点和所述第二关键点的连接线与竖直方向的夹角小于第四阈值;Determining the first key point and the second key point of the face area, the first key point and the second key point satisfying: when the face is not tilted, the first key point and the The angle between the connecting line of the second key point and the vertical direction is smaller than the fourth threshold;
确定所述第一关键点和所述第二关键点的连接线与竖直方向之间的目标夹角;determining the target angle between the connecting line between the first key point and the second key point and the vertical direction;
在所述目标夹角大于所述第四阈值的情况下,输出第二提示信息,所述第二提示信息用于提示用户调整拍摄角度。If the included target angle is greater than the fourth threshold, second prompt information is output, where the second prompt information is used to prompt the user to adjust the shooting angle.
在此实施例中,第二图像可以为通过电子设备自身的摄像头采集的图像,进一步地,电子设备可以处于拍摄状态。In this embodiment, the second image may be an image collected by a camera of the electronic device itself, and further, the electronic device may be in a shooting state.
用户在拍照时可能会旋转电子设备以寻找好看的拍摄角度,但如果旋转的角度过大会造成图像的视觉效果较差。因此,在此实施例中,可以通过检测图像中人脸区域的倾斜度,来确定是否需要提示用户调整拍摄角度,以避免因人脸区域的倾斜度过大影响图像质量。The user may rotate the electronic device to find a good shooting angle when taking a photo, but if the rotation angle is too large, the visual effect of the image will be poor. Therefore, in this embodiment, it is possible to determine whether to prompt the user to adjust the shooting angle by detecting the inclination of the face area in the image, so as to avoid affecting the image quality due to the excessive inclination of the face area.
具体实现时,可以预先选定人脸区域中的两个关键点,以用于确定人脸区域的倾斜度。值得注意地是,该两个关键点在人脸未倾斜的情况下,连接线与竖直方向平行。如:第一关键点可以为鼻头的正中点,第二关键点可以为两个眼睛的中点。During specific implementation, two key points in the face area may be pre-selected to determine the inclination of the face area. It is worth noting that when the face of the two key points is not tilted, the connecting line is parallel to the vertical direction. For example: the first key point can be the midpoint of the nose, and the second key point can be the midpoint of the two eyes.
为确定第一图像中人脸区域的倾斜度,如图2所示,可以先找到第一图像中人脸区域的第一关键点21和第二关键点22。之后,确定第一图像中人脸区域的第一关键点21和第二关键点22的连接线23与竖直方向24之间的夹角θ25。In order to determine the inclination of the face area in the first image, as shown in FIG. 2 , the first
之后,将该夹角与第四阈值进行比较,进而决定是否输出用于提示用户调整拍摄角度的第二提示信息。After that, the included angle is compared with the fourth threshold, and then it is determined whether to output the second prompt information for prompting the user to adjust the shooting angle.
第四阈值为预先设定的用于表征人脸区域的拍摄角度在允许范围内的最大值,可根据需求设定,本申请实施例对此不作限定。The fourth threshold is the preset maximum value of the shooting angle used to characterize the face area within the allowable range, which can be set according to requirements, and is not limited in this embodiment of the present application.
在夹角大于第四阈值的情况下,说明人脸区域的倾斜度过大,可以输出第二提示信息。If the included angle is greater than the fourth threshold, it indicates that the inclination of the face area is too large, and the second prompt information may be output.
在夹角小于或等于第四阈值的情况下,说明人脸区域的倾斜度在允许范围之内,可以不输出第二提示信息。If the included angle is less than or equal to the fourth threshold, it means that the inclination of the face area is within the allowable range, and the second prompt information may not be output.
通过上述方式,可以通过确定第一图像中人脸区域的倾斜度,来决定是否指导用户调整拍摄角度。在倾斜度过大时,可以输出用于提示用户调整拍摄角度的提示信息。如此,可以避免因人脸区域的倾斜度过大,从而可以提高图像质量。Through the above method, it can be determined whether to guide the user to adjust the shooting angle by determining the inclination of the face area in the first image. When the inclination is too large, prompt information for prompting the user to adjust the shooting angle may be output. In this way, excessive inclination of the face area can be avoided, thereby improving image quality.
在一些实施例中,所述获取第一图像之后,所述方法还包括:In some embodiments, after the acquisition of the first image, the method further includes:
确定所述第一图像中人脸区域包括的像素点的数量;Determining the number of pixels included in the face area in the first image;
在所述人脸区域包括的像素点的数量大于第五阈值的情况下,输出第三提示信息,所述第三提示信息用于提示用户远离摄像头。In the case that the number of pixels included in the face area is greater than the fifth threshold, third prompt information is output, where the third prompt information is used to prompt the user to stay away from the camera.
在此实施例中,第二图像可以为通过电子设备自身的摄像头采集的图像,进一步地,电子设备可以处于拍摄状态。In this embodiment, the second image may be an image collected by a camera of the electronic device itself, and further, the electronic device may be in a shooting state.
拍摄时若过于靠近摄像头景物会被拉伸,造成不自然放大。为了防止因用户过于靠近摄像头被不自然拉伸,在此实施例中,可以通过检测图像中人脸区域的占比,来确定是否需要提示用户调整自身与摄像头之间的距离,以避免因过于靠近摄像头导致被不自然拉伸影响图像质量。If you get too close to the camera when shooting, the scene will be stretched, resulting in unnatural magnification. In order to prevent the user from being unnaturally stretched because the user is too close to the camera, in this embodiment, it is possible to determine whether to prompt the user to adjust the distance between himself and the camera by detecting the proportion of the face area in the image to avoid the user being too close to the camera. Being close to the camera causes the image quality to be stretched unnaturally.
具体实现时,可以统计第一图像中人脸区域包括的像素点数,之后,将其与第五阈值进行比较,进而决定是否输出用于提示用户远离摄像头的第三提示信息。During specific implementation, the number of pixels included in the face area in the first image can be counted, and then compared with the fifth threshold to determine whether to output the third prompt information for prompting the user to stay away from the camera.
第五阈值为预先设定的用于表征人脸在图像中占比过大的最小值,可根据需求设定,本申请实施例对此不作限定。在一些可选地实现方式中,第五阈值可以预先设定。在另一些可选地实现方式中,第五阈值可以基于第一图像包括的总像素点数N确定,如第五阈值可以为(1/3)N。The fifth threshold is a preset minimum value used to indicate that the proportion of the human face in the image is too large, which can be set according to requirements, and is not limited in this embodiment of the present application. In some optional implementation manners, the fifth threshold may be preset. In other optional implementation manners, the fifth threshold may be determined based on the total number of pixels N included in the first image, for example, the fifth threshold may be (1/3)N.
在人脸区域包括的像素点数大于第五阈值的情况下,说明人脸区域在图像中占比过大,成像被不自然拉伸的可能性很高,可以输出第三提示信息。If the number of pixels included in the face area is greater than the fifth threshold, it means that the face area accounts for too much of the image, and there is a high possibility that the image is stretched unnaturally, and the third prompt information can be output.
在人脸区域包括的像素点数小于或等于第五阈值的情况下,说明人脸区域在图像中占比在允许范围内,成像被不自然拉伸的可能性较低,可以不输出第三提示信息。In the case that the number of pixels included in the face area is less than or equal to the fifth threshold, it means that the proportion of the face area in the image is within the allowable range, and the possibility of the image being stretched unnaturally is low, and the third prompt may not be output information.
通过上述方式,可以通过确定人脸区域在图像中的占比,来决定是否指导用户调整与摄像头之间的距离。在人脸区域在图像中的占比过大时,可以输出用于提示用户远离摄像头的提示信息。如此,可以避免因距离摄像头过近导致被不自然拉伸的几率,从而可以提高图像质量。Through the above method, it can be determined whether to guide the user to adjust the distance from the camera by determining the proportion of the face area in the image. When the proportion of the face area in the image is too large, a prompt message for prompting the user to stay away from the camera may be output. In this way, the possibility of being unnaturally stretched due to being too close to the camera can be avoided, thereby improving image quality.
在一些实施例中,所述获取第一图像之后,所述方法还包括:In some embodiments, after the acquisition of the first image, the method further includes:
确定所述第一图像中人脸区域的像素点中位于所述第一图像的边缘区域的目标像素点;Determining target pixels located in the edge area of the first image among the pixels of the face area in the first image;
在所述目标像素点的数量大于第六阈值的情况下,输出第四提示信息,所述第四提示信息用于提示用户调整摄像头位置。If the number of the target pixels is greater than the sixth threshold, output fourth prompt information, where the fourth prompt information is used to prompt the user to adjust the camera position.
在此实施例中,第二图像可以为通过电子设备自身的摄像头采集的图像,进一步地,电子设备可以处于拍摄状态。In this embodiment, the second image may be an image collected by a camera of the electronic device itself, and further, the electronic device may be in a shooting state.
由于凸透镜成像和摄像头传感器(sensor)大小的限制,成像于sensor边缘的部分会被挤压,影响成像视觉效果。在此实施例中,可以通过检测人脸成像位置,来确定是否需要提示用户调整摄像头位置,以避免因人脸因过于靠近边缘,导致被挤压影响图像质量。Due to the limitations of the convex lens imaging and the size of the camera sensor (sensor), the part imaged on the edge of the sensor will be squeezed, affecting the imaging visual effect. In this embodiment, it is possible to determine whether to prompt the user to adjust the camera position by detecting the imaging position of the face, so as to prevent the image quality from being squeezed because the face is too close to the edge.
具体实现时,可以先划定第一图像的边缘区域,以1:1成像比例为例,如图3所示,对第一图像划分为均匀7×7,共49块,其中边缘的24块被标记为边缘区域。对于16:9或4:3成像比例则划分为8×6,共48块,同样边缘24块被标记为边缘区域。During specific implementation, the edge area of the first image can be delineated first, taking the 1:1 imaging ratio as an example, as shown in Figure 3, the first image is divided into uniform 7×7, a total of 49 blocks, of which 24 blocks are on the edge are marked as marginal regions. For a 16:9 or 4:3 imaging ratio, it is divided into 8×6, a total of 48 blocks, and 24 blocks at the edge are marked as edge areas.
之后,可以确定第一图像中人脸区域中像素点位于第一图像的边缘区域的目标像素点的数量,并将其与第六阈值进行比较,进而决定是否输出用于提示用户调整摄像头的第四提示信息。Afterwards, it is possible to determine the number of target pixels whose pixels in the face area in the first image are located in the edge area of the first image, and compare it with the sixth threshold, and then decide whether to output the first threshold for prompting the user to adjust the camera. Four prompt information.
第六阈值为预先设定的用于表征人脸靠近边缘的最小值,可根据需求设定,本申请实施例对此不作限定。在一些可选地实现方式中,第六阈值可以预先设定。在另一些可选地实现方式中,第六阈值可以基于第一图像中人脸区域包括的总像素点数Nh确定,如第六阈值可以为(1/2)Nh。The sixth threshold is a preset minimum value used to indicate that a face is close to an edge, which can be set according to requirements, and is not limited in this embodiment of the present application. In some optional implementation manners, the sixth threshold may be preset. In other optional implementation manners, the sixth threshold may be determined based on the total number of pixels N h included in the face area in the first image, for example, the sixth threshold may be (1/2)N h .
在目标像素点的数量大于第六阈值的情况下,说明人脸靠近边缘,可以输出第四提示信息,提示用户调整摄像头位置,使得人物成像位置远离边缘。If the number of target pixels is greater than the sixth threshold, it means that the face is close to the edge, and fourth prompt information can be output to prompt the user to adjust the camera position so that the person's imaging position is far away from the edge.
在目标像素点的数量小于或等于第六阈值的情况下,说明人脸未靠近边缘,可以不输出第四提示信息。If the number of target pixels is less than or equal to the sixth threshold, it means that the human face is not close to the edge, and the fourth prompt information may not be output.
通过上述方式,可以通过确定人脸区域中位于图像的边缘区域的目标像素点的占比,来决定是否指导用户调整摄像头位置。在占比过大时,可以输出用于提示用户调整摄像头位置,使得人物成像位置远离边缘,从而可以提高图像质量。Through the above method, it can be determined whether to guide the user to adjust the camera position by determining the proportion of the target pixel points located in the edge area of the image in the face area. When the proportion is too large, the output can be used to prompt the user to adjust the camera position so that the image position of the person is far away from the edge, thereby improving the image quality.
需要说明的是,本申请实施例中介绍的多种可选的实施例,在彼此不冲突的情况下可以相互结合实现,也可以单独实现,对此本申请实施例不作限定。It should be noted that the various optional embodiments introduced in the embodiments of the present application can be implemented in combination with each other without conflicting with each other, or can be implemented independently, which is not limited in the embodiments of the present application.
为了便于理解上述实施例提供的图像处理方法,以下以一个具体的场景实施例对上述图像处理方法进行说明。In order to facilitate understanding of the image processing method provided by the above embodiment, the above image processing method will be described below using a specific scenario embodiment.
本场景实施例可以为了给用户提供更好的自拍体验,从多个角度评估自拍照片美学质量。In this scenario embodiment, in order to provide users with a better selfie experience, the aesthetic quality of selfie photos can be evaluated from multiple angles.
影响自拍效果的因素有很多,在本场景实施例中选择了其中最重要的6个因素进行检测,如图4所示,这其中包括色差、虚化自然度、脸部阴影、构图倾斜度、成像距离和成像边缘偏移。There are many factors that affect the selfie effect. In this scene example, six of the most important factors are selected for detection, as shown in Figure 4, which include chromatic aberration, blurred naturalness, face shadows, composition gradient, Image distance and image edge offset.
在本场景实施例中,首先对这六种影响因素的严重程度进行准确量化,然后根据量化结果决定是否需要反馈于用户或图像处理算法。In this scenario embodiment, the severity of these six influencing factors is first accurately quantified, and then it is determined whether feedback to the user or the image processing algorithm is required based on the quantified results.
对于色差和虚化自然度而言,其中主要原因来源于算法的处理,当影响程度较高时应当反馈于算法进行参数调整。For chromatic aberration and blur naturalness, the main reason comes from the processing of the algorithm. When the degree of influence is high, it should be fed back to the algorithm for parameter adjustment.
对于构图倾斜度、成像距离和成像边缘偏移而言,主要的因素在于用户选择的拍摄环境或拍摄角度,影响严重时应当及时反馈用户进行调整。For compositional tilt, imaging distance, and imaging edge offset, the main factor is the shooting environment or shooting angle selected by the user. If the impact is serious, it should be timely fed back to the user for adjustment.
而对于脸部阴影的影响,其中既有用户选择的原因,也应当在算法处理的范围内,此时就应当将结果实时反馈处理算法和用户两者。As for the impact of facial shadows, there are reasons for the user's choice, and it should also be within the scope of algorithm processing. At this time, the results should be fed back to both the processing algorithm and the user in real time.
本场景实施例可以通过记忆色偏移计算、虚化自然度检测、脸部阴影检测、构图倾斜度检测、成像距离检测和人像边缘偏移检测,实现用户自拍美学感知评估。可以包括以下内容:In this scene embodiment, the self-portrait aesthetic perception evaluation of the user can be realized by memory color shift calculation, blurred naturalness detection, face shadow detection, composition slope detection, imaging distance detection, and portrait edge offset detection. Can include the following:
一、色差检测。1. Color difference detection.
随着摄影技术的发展,用户开始关注拍摄照片的真实性,而不再只是追求高饱和度的画面,如过去对人的肤色追求美白的效果,对植物追求鲜艳的颜色,现在用户更加关注摄像头拍摄的效果是否能还原自然界真是的颜色样貌。为此,本场景实施例中将利用记忆色体系与自拍照片中的目标区域进行颜色比对,以衡量图像处理算法是否对拍摄图像过度美化。比较方法可划分为以下数个步骤:With the development of photography technology, users began to pay attention to the authenticity of the photos taken, instead of just pursuing high-saturation images. For example, in the past, they pursued the whitening effect of human skin and the bright colors of plants. Now users pay more attention to cameras. Whether the shooting effect can restore the real color appearance in nature. To this end, in this scenario embodiment, the memory color system will be used to compare the color of the target area in the selfie photo to measure whether the image processing algorithm is overly beautifying the captured image. The comparison method can be divided into the following steps:
(1)检测记忆色区域:利用目标识别算法识别出图像中的人脸区域和绿色植物区域。(1) Detect the memory color area: Use the target recognition algorithm to identify the face area and green plant area in the image.
(2)计算记忆色区域颜色:分别对人脸区域和绿色植物区域的像素求均值,得到对应RGB色域的颜色均值Ch(r,g,b)和Cg(r,g,b)。(2) Calculate the color of the memory color area: calculate the average value of the pixels in the face area and the green plant area respectively, and obtain the color mean C h (r, g, b) and C g (r, g, b) corresponding to the RGB color gamut .
然后将RGB色域的Ch(r,g,b)和Cg(r,g,b)转换为Lab色域的Ch(L,a,b)和Cg(L,a,b)。Then convert C h (r, g, b) and C g (r, g, b) of the RGB color gamut to C h (L, a, b) and C g (L, a, b) of the Lab color gamut .
(3)记忆色区域比较:利用公式(3)计算Ch(L,a,b)和Cg(L,a,b)与人脸记忆色V h(L,a,b),绿色植物记忆色Vh(L,a,b)的偏差,得到Dh与Dg。(3) Memory color area comparison: use formula (3) to calculate C h (L, a, b) and C g (L, a, b) and face memory color V h (L, a, b), green plants The deviation of the memory color V h (L, a, b) is obtained to obtain D h and D g .
(4)反馈评估:如果Dh与Dg中的一个或两个值大于10,则反馈给图像处理算法,小于10则不予反馈。(4) Feedback evaluation: If one or both of D h and D g is greater than 10, it will be fed back to the image processing algorithm, and if it is less than 10, no feedback will be given.
二、虚化自然度检测。2. Detection of blurred naturalness.
为了给用户提供更好的自拍效果,手机摄像头的自拍模式通常都会利用双摄计算深度图技术为人物背景增加虚化效果,以达到突出主体人物的目的。但是,过度模糊虚化容易导致前景与背景过渡不自然,使人物与背景割裂,影响视觉美学观感。为此,本场景实施例提出通过计算人物前景边缘与背景的高频能量渐变度来评估图像处理算法虚化效果的好坏。具体步骤如下:In order to provide users with a better selfie effect, the selfie mode of the mobile phone camera usually uses the dual-camera depth map technology to add a blur effect to the background of the characters, so as to achieve the purpose of highlighting the main character. However, excessive blurring can easily lead to an unnatural transition between the foreground and the background, separating the characters from the background and affecting the visual aesthetics. For this reason, this scenario embodiment proposes to evaluate the blur effect of the image processing algorithm by calculating the gradient of high-frequency energy between the foreground edge of the person and the background. Specific steps are as follows:
(1)检测边缘点:利用目标识别算法识别出自拍照片中的人脸区域,将人脸区域边缘的像素点列为候选点(后续逐点进行高频渐变自然度的计算),同时统计候选点的数量记为Nhe。(1) Detection of edge points: use the target recognition algorithm to identify the face area in the selfie photo, list the pixel points on the edge of the face area as candidate points (subsequent calculation of high-frequency gradient naturalness point by point), and count the candidates at the same time The number of points is denoted as N he .
(2)计算高频能量:计算候选像素点(x,y)的局部高频能量以及其X和Y轴方向相邻像素点的局部高频能量,其中局部高频能量h的计算公式可以为公式(2)。(2) Calculate high-frequency energy: calculate the local high-frequency energy of the candidate pixel point (x, y) and the local high-frequency energy of its adjacent pixels in the X and Y axis directions, where the calculation formula of the local high-frequency energy h can be: Formula (2).
可以分别计算得到像素点(x,y)以及其X和Y轴方向相邻像素点的局部高频能量h(x,y)、h(x-1,y)、h(x+1,y)、h(x,y-1)、h(x,y+1)。The local high-frequency energy h(x, y), h(x-1, y), h(x+1, y) of the pixel point (x, y) and its adjacent pixels in the X and Y axis directions can be calculated respectively ), h(x, y-1), h(x, y+1).
(3)计算能量渐变自然度:对像素(x,y)和相邻像素的局部高频能量进行比较。若h(x,y)>1/2(h(x-1,y)+h(x+1,y))或h(x,y)>1/2(h(x,y-1)、h(x,y+1)),则该侯选点被标记为虚化不自然点,否则被标记为虚化自然点。(3) Calculation of energy gradient naturalness: compare the local high-frequency energy of the pixel (x, y) and the adjacent pixels. If h(x, y)>1/2(h(x-1, y)+h(x+1, y)) or h(x, y)>1/2(h(x, y-1) , h(x, y+1)), then the candidate point is marked as a blurred unnatural point, otherwise it is marked as a blurred natural point.
(4)反馈评估:通过(2)和(3),可将所有候选点划分为虚化自然点和虚化不自然点。统计虚化不自然像素点的数量,记为Nhn,若Nhn>1/4(Nhe),则认为自拍照片的虚化自然度有待提高,此时将结果反馈给图像处理算法进行优化,否则不进行反馈。(4) Feedback evaluation: Through (2) and (3), all candidate points can be divided into blurred natural points and blurred unnatural points. Count the number of blurred and unnatural pixels, denoted as N hn , if N hn >1/4(N he ), it is considered that the blurred naturalness of the selfie photo needs to be improved, and the result is fed back to the image processing algorithm for optimization , otherwise no feedback is given.
三、脸部阴影检测。3. Face shadow detection.
用户在自拍时由于场景的限制,如光源在头顶后上方,光线被遮挡脸部区域无法直接收照射,导致脸部区域暗于周围环境,产生阴影区域,最终成像美学效果不佳。为此,本场景实施例提出通过划分亮度阈值来区分脸部阴影区域与非阴影区域的占比,从而判断照片阴影区域是否过大影响美学感知质量。具体步骤如下:Due to the limitation of the scene when the user takes a selfie, for example, the light source is above the top of the head, the light is blocked and the face area cannot be directly illuminated, resulting in the face area being darker than the surrounding environment, resulting in a shadow area, and the final imaging aesthetic effect is not good. For this reason, this scenario embodiment proposes to distinguish the proportion of the shadow area and the non-shadow area of the face by dividing the brightness threshold, so as to determine whether the shadow area of the photo is too large to affect the aesthetic perception quality. Specific steps are as follows:
(1)统计脸部区域大小:利用人脸识别算法识别出人脸区域,计算该区域的灰度均值记为Im,统计人脸区域的总像素点数记为Nh。(1) Count the size of the face area: Use the face recognition algorithm to identify the face area, calculate the average gray value of this area and record it as I m , and count the total number of pixels in the face area as N h .
(2)统计阴影区域大小:人脸区域像素灰度值I与Im逐像素比对,若(1/2)Im<I<Im则标记为阴影区域,记为Ns。(2) Statistics on the size of the shadow area: compare the pixel gray value I of the face area with Im m pixel by pixel, if (1/2) I m < I < I m , it is marked as a shadow area, recorded as N s .
(3)反馈评估:量化Ns的占比,若Ns>(1/3)Nh,则表示该自拍照片阴影过重,其中有图像算法处理不当以及用户拍摄场景光源位置不佳的原因,此时应当将评估结果同时反馈用户与图像处理算法。(3) Feedback evaluation: Quantify the proportion of N s , if N s >(1/3)N h , it means that the shadow of the selfie photo is too heavy, which is caused by improper processing of the image algorithm and poor light source position of the user shooting scene , at this time, the evaluation result should be fed back to the user and the image processing algorithm at the same time.
四、构图倾斜度检测。4. Composition tilt detection.
用户在自拍时往往会旋转手机寻找好看的拍摄角度,但如果旋转的角度过大会造成成像视觉效果不佳。此外如果旋转超过90度,图像处理算法会自动旋转裁切照片以调整到到居中的角度。为了辅助用户选择合适的拍摄角度,本场景实施例提出了以下方法检测拍摄的构图倾斜度,具体步骤如下:Users tend to rotate their mobile phones to find a good shooting angle when taking selfies, but if the rotation angle is too large, the imaging visual effect will be poor. In addition, if the rotation exceeds 90 degrees, the image processing algorithm will automatically rotate and crop the photo to adjust to the centered angle. In order to assist the user to choose a suitable shooting angle, the embodiment of this scenario proposes the following method to detect the inclination of the composition of the shooting, and the specific steps are as follows:
(1)构建倾斜度线:利用人脸识别算法实现人脸关键点检测,如图2所示。选取图2中标注的两个关键点连接为直线作为倾斜度线,垂直线作为基准线。(1) Construct slope line: use face recognition algorithm to realize face key point detection, as shown in Figure 2. Select the two key points marked in Figure 2 and connect them into a straight line as the slope line, and the vertical line as the reference line.
(2)计算倾斜角度:计算两直线构成的倾斜度夹角记为θ。(2) Calculate the inclination angle: calculate the inclination angle formed by two straight lines and record it as θ.
(3)反馈评估:若θ大于40°,则认为构图的倾斜度过大,将结果反馈用户并建议用户调整拍摄角度。(3) Feedback evaluation: If θ is greater than 40°, it is considered that the inclination of the composition is too large, the result is fed back to the user and the user is suggested to adjust the shooting angle.
五、成像距离检测。5. Imaging distance detection.
由于摄像头sensor和镜头物理性质的限制,拍摄时若过于靠近摄像头景物会被拉伸,造成不自然放大。为了防止用户自拍时过于靠近镜头被不自然拉伸,本场景实施例提出了通过计算脸部区域占比的方法估计成像距离。Due to the limitations of the camera sensor and the physical properties of the lens, if the scene is too close to the camera when shooting, the scene will be stretched, resulting in unnatural magnification. In order to prevent the user from getting too close to the lens and being stretched unnaturally when taking a selfie, the embodiment of this scenario proposes a method of estimating the imaging distance by calculating the proportion of the face area.
具体步骤如下:Specific steps are as follows:
(1)统计脸部区域:利用现有的人脸检测算法识别出人脸区域,并统计该区域的像素点数,记为Nh,同时统计照片像素点总数记为N。(1) Count the face area: Use the existing face detection algorithm to identify the face area, and count the number of pixels in this area, denoted as N h , and count the total number of photo pixels as N.
(2)反馈评估:比较Nh和N,若Nh>(1/3)N,则认为人物成像距离过近,此时应当提醒用户适当远离镜头。(2) Feedback evaluation: compare N h and N, if N h > (1/3) N, it is considered that the imaging distance of the person is too close, and the user should be reminded to keep away from the lens properly.
六、成像边缘偏移检测6. Imaging edge offset detection
由于凸透镜成像和摄像头sensor大小的限制,成像于sensor边缘的部分会被挤压,影响成像视觉效果。为了帮助用户拍摄更具美感的图像,本场景实施例提出了以下方法对人物成像位置进行检测用以辅助用户拍摄。Due to the limitation of the convex lens imaging and the size of the camera sensor, the part imaged on the edge of the sensor will be squeezed, which will affect the imaging visual effect. In order to help users take more aesthetically pleasing images, this scenario embodiment proposes the following method to detect the imaging position of a person to assist the user in taking pictures.
具体步骤如下:Specific steps are as follows:
(1)成像区域划分:以1:1成像比例为例,如图3所示对成像画面划分为均匀7×7,共49块,其中边缘的24块被标记为边缘区域(对于16:9,4:3成像比例则划分为8×6,共48块,同样边缘24块被标记为边缘区域)。(1) Imaging area division: Taking the 1:1 imaging ratio as an example, as shown in Figure 3, the imaging screen is divided into uniform 7×7, a total of 49 blocks, of which 24 blocks on the edge are marked as edge areas (for 16:9 , the 4:3 imaging ratio is divided into 8×6, a total of 48 blocks, and the
(2)脸部区域边缘占比:利用现有的人脸检测算法识别出人脸区域,同时统计该区域的像素点数记为Nh,并统计人脸区域位于边缘区域的像素点数记为Ne。(2) The proportion of the edge of the face area: use the existing face detection algorithm to identify the face area, and count the number of pixels in this area as N h , and count the number of pixels in the edge area of the face area as N e .
(3)反馈评估:计算Ne的边缘占比,若Ne>(1/2)Nh,则认为人物成像过于靠近边缘,建议用户调整摄像头位置。(3) Feedback evaluation: Calculate the edge ratio of Ne , if Ne >(1/2)N h , it is considered that the image of the person is too close to the edge, and the user is advised to adjust the camera position.
本场景实施例能够对用户自拍照片进行美学评估,在色差、虚化自然度、脸部阴影、构图倾斜度等六个方面检测出是否存在有待改进地方,然后将检测结果及时反馈给算法或用户进行调整以得到更好拍摄结果。The embodiment of this scenario can perform aesthetic evaluation on the user's self-portrait photos, and detect whether there is room for improvement in six aspects, including color difference, blurred naturalness, face shadow, and composition slope, and then feedback the detection results to the algorithm or the user in a timely manner Make adjustments for better shooting results.
本申请实施例提供的图像处理方法,执行主体可以为图像处理装置。本申请实施例中以图像处理装置执行图像处理方法为例,说明本申请实施例提供的图像处理装置。The image processing method provided in the embodiment of the present application may be executed by an image processing device. In the embodiment of the present application, the image processing device executed by the image processing device is taken as an example to describe the image processing device provided in the embodiment of the present application.
如图5所示,图像处理装置500可以包括:As shown in Figure 5, the
第一获取模块501,用于获取第一图像,所述第一图像为采用图像处理算法对第二图像处理得到的图像,所述第二图像为摄像头采集得到的图像;The
第一确定模块502,用于确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量;The
第二确定模块503,用于根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,所述图像虚化参数用于指示图像虚化处理强度;The
第一调整模块504,用于在所述第一值小于或等于第一阈值的情况下,调整所述图像处理算法的图像虚化处理强度。The
在一些实施例中,所述第一确定模块,包括:In some embodiments, the first determination module includes:
第一确定单元,用于对至少两个像素点中的每一像素点,确定所述像素点对应的局部区域,所述局部区域包括所述像素点以及所述像素点的至少一个相邻像素点;The first determination unit is configured to determine, for each of the at least two pixel points, a local area corresponding to the pixel point, the local area including the pixel point and at least one adjacent pixel of the pixel point point;
第二确定单元,用于根据所述局部区域中各像素点的灰度值,确定所述像素点对应的第一局部灰度值;The second determination unit is configured to determine the first local gray value corresponding to the pixel according to the gray value of each pixel in the local area;
第一获取单元,用于对所述第一局部灰度值进行高斯滤波,得到所述像素点对应的第二局部灰度值;a first acquisition unit, configured to perform Gaussian filtering on the first local gray value to obtain a second local gray value corresponding to the pixel;
第三确定单元,用于The third determination unit is used for
根据所述第一局部灰度值和所述第二局部灰度值,确定所述像素点的局部高频能量;determining the local high-frequency energy of the pixel according to the first local gray value and the second local gray value;
其中,所述至少两个像素点包括所述第一图像中的前景图像区域中的边缘像素点,以及所述边缘像素点的相邻像素点;在所述像素点为所述边缘像素点的情况下,所述像素点的局部高频能量为第一局部高频能量;在所述像素点为所述边缘像素点的相邻像素点的情况下,所述像素点的局部高频能量为第二局部高频能量。Wherein, the at least two pixels include edge pixels in the foreground image area in the first image, and adjacent pixels of the edge pixels; In this case, the local high-frequency energy of the pixel is the first local high-frequency energy; when the pixel is an adjacent pixel of the edge pixel, the local high-frequency energy of the pixel is Second local high frequency energy.
在一些实施例中,所述第二确定模块,包括:In some embodiments, the second determination module includes:
第四确定单元,用于对所述前景图像区域中的每一边缘像素点,在所述边缘像素点的第一局部高频能量大于所述边缘像素点的相邻像素点的第二局部高频能量的均值的情况下,将所述边缘像素点确定为第一像素点;The fourth determining unit is configured to, for each edge pixel in the foreground image area, the first local high-frequency energy at the edge pixel is greater than the second local high-frequency energy of adjacent pixels of the edge pixel In the case of the mean value of the frequency energy, the edge pixel is determined as the first pixel;
第五确定单元,用于根据所述至少两个边缘像素点中的所述第一像素点的数量,确定所述第一图像的图像虚化参数的第一值。The fifth determination unit is configured to determine a first value of an image blur parameter of the first image according to the number of the first pixels in the at least two edge pixels.
在一些实施例中,所述装置还包括:In some embodiments, the device also includes:
第三确定模块,用于确定所述第一图像中第一区域的各色域参数的均值,所述第一区域为包括第一元素的区域;A third determining module, configured to determine the mean value of each color gamut parameter of a first area in the first image, where the first area is an area including a first element;
根据所述第一区域的各色域参数的均值与所述第一区域的各色域参数的参考值,确定所述第一区域的色差值;Determine the color difference value of the first area according to the mean value of each color gamut parameter of the first area and the reference value of each color gamut parameter of the first area;
第四确定模块,用于根据所述色差值,确定所述第一图像的图像美化参数的第二值,所述图像美化参数用于指示图像美化处理强度;A fourth determining module, configured to determine a second value of an image beautification parameter of the first image according to the color difference value, where the image beautification parameter is used to indicate the intensity of image beautification processing;
第二调整模块,用于在所述第二值小于或等于第二阈值的情况下,调整所述图像处理算法的图像美化处理强度。The second adjustment module is configured to adjust the image beautification processing strength of the image processing algorithm when the second value is less than or equal to a second threshold.
在一些实施例中,所述装置还包括:In some embodiments, the device also includes:
第五确定模块,用于确定所述第一图像中第二区域的灰度均值,所述第二区域为包括第二元素的区域;A fifth determination module, configured to determine the gray mean value of a second area in the first image, where the second area is an area including a second element;
第六确定模块,用于对所述第二区域中的每一像素点,在所述像素点的灰度值小于所述灰度均值的情况下,将所述像素点确定为第二像素点;A sixth determination module, for each pixel in the second area, if the gray value of the pixel is smaller than the average gray value, determine the pixel as the second pixel ;
第七确定模块,用于根据所述第二区域中的所述第二像素点的数量,确定所述第一图像的图像阴影参数的第三值,所述图像阴影参数用于指示图像阴影处理强度;A seventh determination module, configured to determine a third value of an image shading parameter of the first image according to the number of the second pixels in the second area, the image shading parameter being used to indicate image shading processing strength;
执行模块,用于在所述第三值小于或等于第三阈值的情况下,执行第一操作,所述第一操作包括以下至少一项:An executing module, configured to execute a first operation when the third value is less than or equal to a third threshold, and the first operation includes at least one of the following:
输出第一提示信息,所述第一提示信息用于提示用户调整拍摄位置;Outputting first prompt information, the first prompt information is used to prompt the user to adjust the shooting position;
调整所述图像处理算法的图像阴影处理强度。Adjust the image shading intensity of the image processing algorithm.
在一些实施例中,所述装置还包括:In some embodiments, the device also includes:
第八确定模块,用于确定所述人脸区域的第一关键点和第二关键点,所述第一关键点和所述第二关键点满足:在人脸未倾斜的情况下,所述第一关键点和所述第二关键点的连接线与竖直方向的夹角小于第四阈值;The eighth determination module is used to determine the first key point and the second key point of the human face area, the first key point and the second key point satisfy: when the human face is not tilted, the The angle between the connecting line between the first key point and the second key point and the vertical direction is smaller than a fourth threshold;
第九确定模块,用于确定所述第一关键点和所述第二关键点的连接线与竖直方向之间的目标夹角;A ninth determination module, configured to determine a target angle between the connecting line between the first key point and the second key point and the vertical direction;
第一输出模块,用于在所述目标夹角大于所述第四阈值的情况下,输出第二提示信息,所述第二提示信息用于提示用户调整拍摄角度。The first output module is configured to output second prompt information when the included target angle is greater than the fourth threshold, and the second prompt information is used to prompt the user to adjust the shooting angle.
在一些实施例中,所述装置还包括:In some embodiments, the device also includes:
第十确定模块,用于确定所述第一图像中人脸区域包括的像素点的数量;A tenth determination module, configured to determine the number of pixels included in the face area in the first image;
第二输出模块,用于在所述人脸区域包括的像素点的数量大于第五阈值的情况下,输出第三提示信息,所述第三提示信息用于提示用户远离摄像头。The second output module is configured to output third prompt information when the number of pixels included in the face area is greater than a fifth threshold, and the third prompt information is used to prompt the user to stay away from the camera.
在一些实施例中,所述装置还包括:In some embodiments, the device also includes:
第十一确定模块,用于确定所述第一图像中人脸区域的像素点中位于所述第一图像的边缘区域的目标像素点;An eleventh determination module, configured to determine a target pixel located in an edge area of the first image among the pixels of the face area in the first image;
第三输出模块,用于在所述目标像素点的数量大于第六阈值的情况下,输出第四提示信息,所述第四提示信息用于提示用户调整摄像头位置。The third output module is configured to output fourth prompt information when the number of target pixels is greater than a sixth threshold, and the fourth prompt information is used to prompt the user to adjust the camera position.
本申请实施例提供的图像处理装置500能够实现方法实施例实现的各个过程,为避免重复,这里不再赘述。The
本申请实施例中的图像处理装置可以是电子设备,也可以是电子设备中的部件,例如集成电路或芯片。该电子设备可以是终端,也可以为除终端之外的其他设备。示例性的,电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、移动上网装置(Mobile Internet Device,MID)、增强现实(augmented reality,AR)/虚拟现实(virtualreality,VR)设备、机器人、可穿戴设备、超级移动个人计算机(ultra-mobile personalcomputer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,还可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personalcomputer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。The image processing apparatus in the embodiment of the present application may be an electronic device, or may be a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or other devices other than the terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) Devices, robots, wearable devices, ultra-mobile personalcomputers (ultra-mobile personalcomputer, UMPC), netbooks or personal digital assistants (personal digital assistant, PDA), etc., can also serve as servers, network attached storage (Network Attached Storage, NAS) , a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which are not specifically limited in this embodiment of the present application.
本申请实施例中的图像处理装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The image processing device in the embodiment of the present application may be a device with an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
可选地,如图6所示,本申请实施例还提供一种电子设备600,包括处理器601和存储器602,存储器602上存储有可在所述处理器601上运行的程序或指令,该程序或指令被处理器601执行时实现上述图像处理方法实施例的各个步骤,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, as shown in FIG. 6 , the embodiment of the present application also provides an
需要说明的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
图7为实现本申请实施例的一种电子设备的硬件结构图。FIG. 7 is a hardware structural diagram of an electronic device implementing an embodiment of the present application.
该电子设备700包括但不限于:射频单元701、网络模块702、音频输出单元703、输入单元704、传感器705、显示单元706、用户输入单元707、接口单元708、存储器709、以及处理器710等部件。The
本领域技术人员可以理解,电子设备700还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器710逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图7中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art can understand that the
其中,处理器710,用于:Wherein, the
获取第一图像,所述第一图像为采用图像处理算法对第二图像处理得到的图像,所述第二图像为摄像头采集得到的图像;Acquiring a first image, the first image is an image obtained by using an image processing algorithm to process a second image, and the second image is an image collected by a camera;
确定所述第一图像中的前景图像区域中边缘像素点的第一局部高频能量,以及所述边缘像素点的相邻像素点的第二局部高频能量;determining a first local high-frequency energy of an edge pixel in a foreground image region in the first image, and a second local high-frequency energy of an adjacent pixel of the edge pixel;
根据所述第一局部高频能量和所述第二局部高频能量,确定所述第一图像的图像虚化参数的第一值,所述图像虚化参数用于指示图像虚化处理强度;determining a first value of an image blurring parameter of the first image according to the first local high-frequency energy and the second local high-frequency energy, where the image blurring parameter is used to indicate an image blurring processing intensity;
在所述第一值小于或等于第一阈值的情况下,调整所述图像处理算法的图像虚化处理强度。In a case where the first value is less than or equal to a first threshold, the image blur processing intensity of the image processing algorithm is adjusted.
在一些实施例中,处理器710,用于:In some embodiments, the
对至少两个像素点中的每一像素点,确定所述像素点对应的局部区域,所述局部区域包括所述像素点以及所述像素点的至少一个相邻像素点;For each of the at least two pixels, determine a local area corresponding to the pixel, the local area includes the pixel and at least one adjacent pixel of the pixel;
根据所述局部区域中各像素点的灰度值,确定所述像素点对应的第一局部灰度值;determining a first local gray value corresponding to the pixel according to the gray value of each pixel in the local area;
对所述第一局部灰度值进行高斯滤波,得到所述像素点对应的第二局部灰度值;performing Gaussian filtering on the first local gray value to obtain a second local gray value corresponding to the pixel;
根据所述第一局部灰度值和所述第二局部灰度值,确定所述像素点的局部高频能量;determining the local high-frequency energy of the pixel according to the first local gray value and the second local gray value;
其中,所述至少两个像素点包括所述第一图像中的前景图像区域中的边缘像素点,以及所述边缘像素点的相邻像素点;在所述像素点为所述边缘像素点的情况下,所述像素点的局部高频能量为第一局部高频能量;在所述像素点为所述边缘像素点的相邻像素点的情况下,所述像素点的局部高频能量为第二局部高频能量。Wherein, the at least two pixels include edge pixels in the foreground image area in the first image, and adjacent pixels of the edge pixels; In this case, the local high-frequency energy of the pixel is the first local high-frequency energy; when the pixel is an adjacent pixel of the edge pixel, the local high-frequency energy of the pixel is Second local high frequency energy.
在一些实施例中,处理器710,用于:In some embodiments, the
对所述前景图像区域中的每一边缘像素点,在所述边缘像素点的第一局部高频能量大于所述边缘像素点的相邻像素点的第二局部高频能量的均值的情况下,将所述边缘像素点确定为第一像素点;For each edge pixel in the foreground image area, when the first local high-frequency energy of the edge pixel is greater than the mean value of the second local high-frequency energy of adjacent pixels of the edge pixel , determining the edge pixel as the first pixel;
根据所述至少两个边缘像素点中的所述第一像素点的数量,确定所述第一图像的图像虚化参数的第一值。A first value of an image blurring parameter of the first image is determined according to the number of the first pixels in the at least two edge pixels.
在一些实施例中,处理器710,用于:In some embodiments, the
确定所述第一图像中第一区域的各色域参数的均值,所述第一区域为包括第一元素的区域;determining an average value of each color gamut parameter of a first area in the first image, the first area being an area including a first element;
根据所述第一区域的各色域参数的均值与所述第一区域的各色域参数的参考值,确定所述第一区域的色差值;Determine the color difference value of the first area according to the mean value of each color gamut parameter of the first area and the reference value of each color gamut parameter of the first area;
根据所述色差值,确定所述第一图像的图像美化参数的第二值,所述图像美化参数用于指示图像美化处理强度;Determine a second value of an image beautification parameter of the first image according to the color difference value, where the image beautification parameter is used to indicate the intensity of image beautification processing;
在所述第二值小于或等于第二阈值的情况下,调整所述图像处理算法的图像美化处理强度。In a case where the second value is less than or equal to a second threshold, the intensity of image beautification processing of the image processing algorithm is adjusted.
在一些实施例中,处理器710,用于:In some embodiments, the
确定所述第一图像中第二区域的灰度均值,所述第二区域为包括第二元素的区域;determining a gray mean value of a second area in the first image, the second area being an area including a second element;
对所述第二区域中的每一像素点,在所述像素点的灰度值小于所述灰度均值的情况下,将所述像素点确定为第二像素点;For each pixel in the second area, if the grayscale value of the pixel is smaller than the average grayscale value, determine the pixel as a second pixel;
根据所述第二区域中的所述第二像素点的数量,确定所述第一图像的图像阴影参数的第三值,所述图像阴影参数用于指示图像阴影处理强度;determining a third value of an image shading parameter of the first image according to the number of the second pixel points in the second area, where the image shading parameter is used to indicate the intensity of image shading processing;
在所述第三值小于或等于第三阈值的情况下,执行第一操作,所述第一操作包括以下至少一项:In a case where the third value is less than or equal to a third threshold, a first operation is performed, and the first operation includes at least one of the following:
输出第一提示信息,所述第一提示信息用于提示用户调整拍摄位置;Outputting first prompt information, the first prompt information is used to prompt the user to adjust the shooting position;
调整所述图像处理算法的图像阴影处理强度。Adjust the image shading intensity of the image processing algorithm.
在一些实施例中,处理器710,用于:In some embodiments, the
确定所述人脸区域的第一关键点和第二关键点,所述第一关键点和所述第二关键点满足:在人脸未倾斜的情况下,所述第一关键点和所述第二关键点的连接线与竖直方向的夹角小于第四阈值;Determining the first key point and the second key point of the face area, the first key point and the second key point satisfying: when the face is not tilted, the first key point and the The angle between the connecting line of the second key point and the vertical direction is smaller than the fourth threshold;
确定所述第一关键点和所述第二关键点的连接线与竖直方向之间的目标夹角;determining the target angle between the connecting line between the first key point and the second key point and the vertical direction;
在所述目标夹角大于所述第四阈值的情况下,输出第二提示信息,所述第二提示信息用于提示用户调整拍摄角度。If the included target angle is greater than the fourth threshold, second prompt information is output, where the second prompt information is used to prompt the user to adjust the shooting angle.
在一些实施例中,处理器710,用于:In some embodiments, the
确定所述第一图像中人脸区域包括的像素点的数量;Determining the number of pixels included in the face area in the first image;
在所述人脸区域包括的像素点的数量大于第五阈值的情况下,输出第三提示信息,所述第三提示信息用于提示用户远离摄像头。In the case that the number of pixels included in the face area is greater than the fifth threshold, third prompt information is output, where the third prompt information is used to prompt the user to stay away from the camera.
在一些实施例中,处理器710,用于:In some embodiments, the
确定所述第一图像中人脸区域的像素点中位于所述第一图像的边缘区域的目标像素点;Determining target pixels located in the edge area of the first image among the pixels of the face area in the first image;
在所述目标像素点的数量大于第六阈值的情况下,输出第四提示信息,所述第四提示信息用于提示用户调整摄像头位置。If the number of the target pixels is greater than the sixth threshold, output fourth prompt information, where the fourth prompt information is used to prompt the user to adjust the camera position.
本申请实施例提供的电子设备能够实现方法实施例实现的各个过程,为避免重复,这里不再赘述。The electronic device provided in the embodiments of the present application can implement various processes implemented in the method embodiments, and details are not described here to avoid repetition.
应理解的是,本申请实施例中,输入单元704可以包括图形处理器(GraphicsProcessing Unit,GPU)7041和麦克风7042,图形处理器7041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元706可包括显示面板7061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板7061。用户输入单元707包括触控面板7071以及其他输入设备7072中的至少一种。触控面板7071,也称为触摸屏。触控面板7071可包括触摸检测装置和触摸控制器两个部分。其他输入设备7072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。It should be understood that, in the embodiment of the present application, the
存储器709可用于存储软件程序以及各种数据。存储器709可主要包括存储程序或指令的第一存储区和存储数据的第二存储区,其中,第一存储区可存储操作系统、至少一个功能所需的应用程序或指令(比如声音播放功能、图像播放功能等)等。此外,存储器709可以包括易失性存储器或非易失性存储器,或者,存储器709可以包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请实施例中的存储器709包括但不限于这些和任意其它适合类型的存储器。The
处理器710可包括一个或多个处理单元;可选的,处理器710集成应用处理器和调制解调处理器,其中,应用处理器主要处理涉及操作系统、用户界面和应用程序等的操作,调制解调处理器主要处理无线通信信号,如基带处理器。可以理解的是,上述调制解调处理器也可以不集成到处理器710中。The
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application also provides a readable storage medium, the readable storage medium stores a program or an instruction, and when the program or instruction is executed by a processor, each process of the above-mentioned image processing method embodiment is realized, and can achieve the same To avoid repetition, the technical effects will not be repeated here.
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器ROM、随机存取存储器RAM、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk, and the like.
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above image processing method embodiment Each process can achieve the same technical effect, so in order to avoid repetition, it will not be repeated here.
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application provides a computer program product, the program product is stored in a storage medium, and the program product is executed by at least one processor to implement the various processes in the above image processing method embodiment, and can achieve the same technical effect , to avoid repetition, it will not be repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present application can be embodied in the form of computer software products, which are stored in a storage medium (such as ROM/RAM, magnetic disk, etc.) , optical disc), including several instructions to enable a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementations. The above-mentioned specific implementations are only illustrative and not restrictive. Those of ordinary skill in the art will Under the inspiration of this application, without departing from the purpose of this application and the scope of protection of the claims, many forms can also be made, all of which belong to the protection of this application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310093332.8A CN116017178A (en) | 2023-01-18 | 2023-01-18 | Image processing method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310093332.8A CN116017178A (en) | 2023-01-18 | 2023-01-18 | Image processing method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116017178A true CN116017178A (en) | 2023-04-25 |
Family
ID=86024906
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310093332.8A Pending CN116017178A (en) | 2023-01-18 | 2023-01-18 | Image processing method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116017178A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008033060A (en) * | 2006-07-28 | 2008-02-14 | Kyocera Corp | Imaging apparatus, imaging method, and image processing apparatus |
CN110766606A (en) * | 2019-10-29 | 2020-02-07 | 维沃移动通信有限公司 | Image processing method and electronic equipment |
CN111491095A (en) * | 2020-02-24 | 2020-08-04 | RealMe重庆移动通信有限公司 | Image blurring method and device and electronic equipment |
WO2021102702A1 (en) * | 2019-11-26 | 2021-06-03 | 深圳市大疆创新科技有限公司 | Image processing method and apparatus |
-
2023
- 2023-01-18 CN CN202310093332.8A patent/CN116017178A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008033060A (en) * | 2006-07-28 | 2008-02-14 | Kyocera Corp | Imaging apparatus, imaging method, and image processing apparatus |
CN110766606A (en) * | 2019-10-29 | 2020-02-07 | 维沃移动通信有限公司 | Image processing method and electronic equipment |
WO2021102702A1 (en) * | 2019-11-26 | 2021-06-03 | 深圳市大疆创新科技有限公司 | Image processing method and apparatus |
CN111491095A (en) * | 2020-02-24 | 2020-08-04 | RealMe重庆移动通信有限公司 | Image blurring method and device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100556856B1 (en) | Method and device for screen control in mobile communication terminal | |
CN103024338B (en) | There is the display device of image capture and analysis module | |
US8538147B2 (en) | Methods and appartuses for restoring color and enhancing electronic images | |
KR101554403B1 (en) | Image processing device, image processing method, and recording medium for control program | |
KR20210149848A (en) | Skin quality detection method, skin quality classification method, skin quality detection device, electronic device and storage medium | |
US8525847B2 (en) | Enhancing images using known characteristics of image subjects | |
EP3664016B1 (en) | Image detection method and apparatus, and terminal | |
CN109639982A (en) | An image noise reduction method, device, storage medium and terminal | |
CN113610723B (en) | Image processing method and related device | |
CN106326823B (en) | Method and system for obtaining head portrait in picture | |
CN112351195B (en) | Image processing method, device and electronic system | |
US8731248B2 (en) | Method of performing eye circle correction an image and related computing device | |
CN111901519B (en) | Screen light supplement method and device and electronic equipment | |
CN105096267B (en) | A kind of method and apparatus that eye brightness is adjusted based on identification of taking pictures | |
US20220329729A1 (en) | Photographing method, storage medium and electronic device | |
CN108038836A (en) | A kind of image processing method, device and mobile terminal | |
CN105243371A (en) | Human face beauty degree detection method and system and shooting terminal | |
CN107911625A (en) | Light measuring method, light measuring device, readable storage medium and computer equipment | |
CN111182212A (en) | Image processing method, image processing apparatus, storage medium, and electronic device | |
EP4093015A1 (en) | Photographing method and apparatus, storage medium, and electronic device | |
WO2021128593A1 (en) | Facial image processing method, apparatus, and system | |
CN112333385B (en) | Electronic anti-shake control method and device | |
CN116017178A (en) | Image processing method and device and electronic equipment | |
CN118674646A (en) | Image smoothing processing method, device, electronic device, chip and medium | |
CN113766141B (en) | Image information processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |