CN115760816A - Method and device for determining illumination quality of face image and storage medium - Google Patents
Method and device for determining illumination quality of face image and storage medium Download PDFInfo
- Publication number
- CN115760816A CN115760816A CN202211494122.1A CN202211494122A CN115760816A CN 115760816 A CN115760816 A CN 115760816A CN 202211494122 A CN202211494122 A CN 202211494122A CN 115760816 A CN115760816 A CN 115760816A
- Authority
- CN
- China
- Prior art keywords
- coefficient
- area
- brightness
- pixel value
- pixel
- 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
Images
Landscapes
- Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)
- Measuring And Recording Apparatus For Diagnosis (AREA)
Abstract
Description
技术领域technical field
本文涉及图像处理技术,尤指一种人脸图像光照质量的确定方法、装置和存储介质。This article relates to image processing technology, especially a method, device and storage medium for determining the illumination quality of a face image.
背景技术Background technique
人脸图像光照质量会影响人脸图像识别结果,当人脸图像光照质量较差,如人脸图像光照极亮、极暗或光照不均匀时,会降低人脸图像识别结果的准确率。因此,需要一种有效的人脸光照质量的确定方法,有利于指导图像数据的构成或者对图像数据进行优化处理,也有利于分析人脸识别任务的误识和拒识原因。The lighting quality of the face image will affect the recognition results of the face image. When the lighting quality of the face image is poor, such as when the illumination of the face image is extremely bright, extremely dark or uneven, the accuracy of the face image recognition result will be reduced. Therefore, there is a need for an effective method for determining the quality of face illumination, which is conducive to guiding the composition of image data or optimizing the processing of image data, and is also conducive to analyzing the reasons for misrecognition and rejection of face recognition tasks.
现有的人脸图像质量确定方法,主要包括:基于人脸图像和其背景图像进行整体的亮度衡量,该方法中,人脸图像光照质量的确定结果受背景图像光照质量影响大;如果人脸图像光照正常,但背景图像光照极暗或极亮,可能会降低人脸图像光照质量的确定结果;基于左右半脸图像特征差异为0的先验,对由光照引起的左右半脸图像不对称产生的局部变量进行质量衡量,这种方式对于先验较为严格,如果人脸偏移一定角度,那么左右半脸图像就不再对称,产生的光照质量评价指标就不再准确。The existing methods for determining the quality of face images mainly include: measuring the overall brightness based on the face image and its background image. In this method, the determination result of the light quality of the face image is greatly affected by the light quality of the background image; The image illumination is normal, but the background image illumination is extremely dark or extremely bright, which may reduce the determination result of the illumination quality of the face image; based on the priori that the feature difference of the left and right half face images is 0, the asymmetry of the left and right half face images caused by illumination The quality of the generated local variables is measured. This method is more strict with the prior. If the face is offset by a certain angle, then the left and right half-face images will no longer be symmetrical, and the resulting illumination quality evaluation indicators will no longer be accurate.
针对上述的问题,目前尚未提出有效的解决方案。For the above problems, no effective solution has been proposed yet.
发明内容Contents of the invention
本申请提供了一种人脸图像光照质量的确定方法、装置和存储介质,能够更加准确地确定人脸图像的光照质量。The present application provides a method, device and storage medium for determining the illumination quality of a human face image, which can more accurately determine the illumination quality of a human face image.
根据本发明实施例的一个方面,提供了一种人脸图像光照质量的确定方法,包括:从人脸图像中解析出人脸皮肤图像;获取所述人脸皮肤图像的亮度系数和亮度不均匀系数;根据所述亮度系数和所述亮度不均匀系数确定所述人脸图像的光照质量。According to an aspect of an embodiment of the present invention, a method for determining the illumination quality of a human face image is provided, including: parsing a human face skin image from the human face image; acquiring the brightness coefficient and brightness unevenness of the human face skin image coefficient; determine the illumination quality of the human face image according to the brightness coefficient and the brightness non-uniformity coefficient.
可选的,获取所述人脸皮肤图像的亮度系数和亮度不均匀系数,包括:依据预设的像素阈值,将所述人脸皮肤图像的直方图曲线划分为亮区和暗区;通过所述直方图曲线分别获取所述亮度系数和所述亮度不均匀系数,其中,所述亮度不均匀系数根据以下至少一个确定:用于表示所述亮区和所述暗区亮度差异的第一系数,以及,用于表示所述亮区和所述暗区面积差异的第二系数。Optionally, acquiring the brightness coefficient and brightness unevenness coefficient of the human face skin image includes: dividing the histogram curve of the human face skin image into bright areas and dark areas according to a preset pixel threshold; The histogram curve obtains the brightness coefficient and the brightness non-uniformity coefficient respectively, wherein the brightness non-uniformity coefficient is determined according to at least one of the following: a first coefficient used to represent the brightness difference between the bright area and the dark area , and a second coefficient used to represent the area difference between the bright area and the dark area.
可选的,通过所述直方图曲线获取所述亮度不均匀系数,包括:从所述亮区和所述暗区中分别确定第一像素值和第二像素值;结合所述第一像素值,所述第二像素值和所述预设的像素阈值分别确定所述第一系数和所述第二系数。Optionally, obtaining the brightness non-uniformity coefficient through the histogram curve includes: respectively determining a first pixel value and a second pixel value from the bright area and the dark area; combining the first pixel value , the second pixel value and the preset pixel threshold determine the first coefficient and the second coefficient respectively.
可选的,从所述亮区和所述暗区中分别确定第一像素值和第二像素值,包括:确定所述亮区和所述暗区中出现频次最多的像素值,其中,所述亮区的直方图曲线波峰峰值对应的像素值为第一像素值,所述暗区的直方图曲线波峰峰值对应的像素值为第二像素值。Optionally, determining the first pixel value and the second pixel value from the bright area and the dark area respectively includes: determining the pixel value that occurs most frequently in the bright area and the dark area, wherein the The pixel value corresponding to the peak value of the histogram curve in the bright area is the first pixel value, and the pixel value corresponding to the peak value of the histogram curve in the dark area is the second pixel value.
可选的,结合所述第一像素值、所述第二像素值和所述预设的像素阈值确定所述第一系数,包括:计算所述第一像素值与所述像素阈值的差值,得到第一差异;计算所述第二像素值与所述像素阈值的差值,得到第二差异;通过计算所述第一差异和所述第二差异的平均,确定所述第一系数。Optionally, determining the first coefficient in combination with the first pixel value, the second pixel value, and the preset pixel threshold includes: calculating a difference between the first pixel value and the pixel threshold , to obtain the first difference; calculate the difference between the second pixel value and the pixel threshold to obtain the second difference; and determine the first coefficient by calculating the average of the first difference and the second difference.
可选的,结合所述第一像素值、所述第二像素值和所述预设的像素阈值确定所述第二系数,包括:通过所述第一像素值、所述第二像素值和所述预设的像素阈值分别获取所述亮区的面积和暗区的面积;将所述亮区的面积与所述暗区的面积的比值作为所述第二系数。Optionally, determining the second coefficient in combination with the first pixel value, the second pixel value, and the preset pixel threshold includes: using the first pixel value, the second pixel value, and The preset pixel threshold value obtains the area of the bright area and the area of the dark area respectively; the ratio of the area of the bright area to the area of the dark area is used as the second coefficient.
可选的,获取所述亮区的面积和所述暗区的面积,包括:计算所述第一像素值,所述第二像素值,所述预设像素阈值和像素边界值两两之间差值中的最小值,将所述最小值作为峰值宽度;以所述第一像素值为中轴,第一左边界和第一右边界所包含的直方图曲线区域面积为所述亮区的面积,其中,所述第一左边界和所述第一右边界与所述中轴的距离均为所述峰值宽度;以所述第二像素值为中轴,第二左边界和第二右边界所包含的直方图曲线区域面积为所述暗区的面积,其中,所述第二左边界和所述第二右边界与所述中轴的距离均为所述峰值宽度。Optionally, obtaining the area of the bright area and the area of the dark area includes: calculating the first pixel value, the second pixel value, the preset pixel threshold value and the pixel boundary value between two pairs The minimum value in the difference, using the minimum value as the peak width; taking the first pixel value as the central axis, the area of the histogram curve area included in the first left boundary and the first right boundary is the area of the bright area Area, wherein, the distances between the first left boundary and the first right boundary and the central axis are both the peak width; the second pixel value is the central axis, the second left boundary and the second right The area of the histogram curve area included in the boundary is the area of the dark area, wherein the distances between the second left boundary and the second right boundary and the central axis are both the peak width.
可选的,通过所述直方图曲线获取所述亮度系数,包括:基于所述直方图曲线,计算所有像素点的灰度值偏离中心灰度值的均值和方差;将所述均值和所述方差比值的绝对值作为所述亮度系数。Optionally, obtaining the luminance coefficient through the histogram curve includes: calculating the mean and variance of the gray values of all pixels deviating from the central gray value based on the histogram curve; combining the mean and the The absolute value of the variance ratio is used as the brightness coefficient.
可选的,所述根据所述亮度系数和所述亮度不均匀系数确定所述人脸图像的光照质量,包括:将所述亮度系数、所述第一系数和所述第二系数进行加权求和;根据求和的结果确定所述人脸图像的光照质量。Optionally, the determining the illumination quality of the face image according to the brightness coefficient and the brightness non-uniformity coefficient includes: performing weighted calculation on the brightness coefficient, the first coefficient and the second coefficient and; determine the illumination quality of the human face image according to the result of the summation.
根据本发明实施例的一个方面,提供了一种人脸图像光照质量的确定装置,包括:解析模块,用于从人脸图像中解析出人脸皮肤图像;处理模块,用于获取所述人脸皮肤图像的亮度系数和亮度不均匀系数;评估模块,用于根据所述亮度系数和所述亮度不均匀系数确定所述人脸图像的光照质量。According to an aspect of an embodiment of the present invention, a device for determining the illumination quality of a human face image is provided, including: an analysis module for analyzing a human face skin image from a human face image; a processing module for obtaining the human face image The brightness coefficient and the brightness unevenness coefficient of the face skin image; an evaluation module, which is used to determine the illumination quality of the human face image according to the brightness coefficient and the brightness unevenness coefficient.
根据本发明实施例的一个方面,提供了一种计算机可读存储介质,所述存储介质包括存储的程序,其中,所述程序上述任意一项所述人脸图像光照质量的确定方法。According to an aspect of an embodiment of the present invention, a computer-readable storage medium is provided, and the storage medium includes a stored program, wherein the program is the method for determining the illumination quality of a face image described in any one of the above items.
根据本发明实施例的一个方面,提供了一种处理器,所述处理器用于运行程序,其中,所述程序运行时执行任意一项所述人脸图像光照质量的确定方法。According to an aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a program, wherein, when the program is running, any method for determining the illumination quality of a human face image is executed.
在本发明实施例中,通过执行以下步骤:从人脸图像中解析出人脸皮肤图像;获取所述人脸皮肤图像的亮度系数和亮度不均匀系数;根据所述亮度系数和所述亮度不均匀系数确定所述人脸图像的光照质量。通过只聚焦人脸肤色区域,并根据光照不均呈现双峰的现象来进行人脸光照均匀度评价,结合人脸亮度评价最终得到人脸光照质量评价,该评价基于整体图像的亮度像素分布进行相关维度的度量计算,既能不受限于区域语义分割,也能衡量不均匀区域亮度反差强度的高低,减少轻度脸部肤色不均匀等导致误判,能很好排除其他图像质量干扰因素,专注图像光照亮度方面的评价。In the embodiment of the present invention, by performing the following steps: analyzing the human face skin image from the human face image; obtaining the brightness coefficient and brightness unevenness coefficient of the human face skin image; The uniformity coefficient determines the lighting quality of the face image. By only focusing on the skin color area of the face, and according to the phenomenon of uneven illumination showing double peaks, the face illumination uniformity is evaluated, combined with the face brightness evaluation to finally obtain the face illumination quality evaluation, which is based on the brightness pixel distribution of the overall image. The measurement and calculation of relevant dimensions can not only be limited to regional semantic segmentation, but also measure the intensity of brightness contrast in uneven areas, reduce misjudgment caused by mild uneven skin color, and can well eliminate other image quality interference factors , focusing on the evaluation of image brightness.
本申请的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的其他优点可通过在说明书以及附图中所描述的方案来实现和获得。Additional features and advantages of the application will be set forth in the description which follows, and, in part, will be obvious from the description, or may be learned by practice of the application. Other advantages of the present application can be realized and obtained through the schemes described in the specification and drawings.
附图说明Description of drawings
附图用来提供对本申请技术方案的理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The accompanying drawings are used to provide an understanding of the technical solution of the present application, and constitute a part of the description, and are used together with the embodiments of the present application to explain the technical solution of the present application, and do not constitute a limitation to the technical solution of the present application.
图1为本申请实施例提供的人脸图像光照质量的确定方法流程图;Fig. 1 is the flow chart of the method for determining the illumination quality of a face image provided by the embodiment of the present application;
图2为本申请实施例提供的从多个区域图像中选取人脸皮肤图像示意图;Fig. 2 is a schematic diagram of selecting human face skin images from multiple regional images provided by the embodiment of the present application;
图3为本申请实施例提供的基于图2所示的图像生成的像素直方图曲线示意图;FIG. 3 is a schematic diagram of a pixel histogram curve generated based on the image shown in FIG. 2 provided by the embodiment of the present application;
图4为本申请实施例提供的人脸图像光照质量的确定装置结构示意图。FIG. 4 is a schematic structural diagram of an apparatus for determining the illumination quality of a face image provided in an embodiment of the present application.
具体实施方式Detailed ways
本申请描述了多个实施例,但是该描述是示例性的,而不是限制性的,并且对于本领域的普通技术人员来说显而易见的是,在本申请所描述的实施例包含的范围内可以有更多的实施例和实现方案。尽管在附图中示出了许多可能的特征组合,并在具体实施方式中进行了讨论,但是所公开的特征的许多其它组合方式也是可能的。除非特意加以限制的情况以外,任何实施例的任何特征或元件可以与任何其它实施例中的任何其他特征或元件结合使用,或可以替代任何其它实施例中的任何其他特征或元件。The application describes a number of embodiments, but the description is illustrative rather than restrictive, and it will be obvious to those of ordinary skill in the art that within the scope of the embodiments described in the application, There are many more embodiments and implementations. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are possible. Except where expressly limited, any feature or element of any embodiment may be used in combination with, or substituted for, any other feature or element of any other embodiment.
本申请包括并设想了与本领域普通技术人员已知的特征和元件的组合。本申请已经公开的实施例、特征和元件也可以与任何常规特征或元件组合,以形成由权利要求限定的独特的发明方案。任何实施例的任何特征或元件也可以与来自其它发明方案的特征或元件组合,以形成另一个由权利要求限定的独特的发明方案。因此,应当理解,在本申请中示出和/或讨论的任何特征可以单独地或以任何适当的组合来实现。因此,除了根据所附权利要求及其等同替换所做的限制以外,实施例不受其它限制。此外,可以在所附权利要求的保护范围内进行各种修改和改变。This application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The disclosed embodiments, features and elements of this application can also be combined with any conventional features or elements to form unique inventive solutions as defined by the claims. Any feature or element of any embodiment may also be combined with features or elements from other inventive solutions to form yet another unique inventive solution as defined by the claims. It is therefore to be understood that any of the features shown and/or discussed in this application can be implemented alone or in any suitable combination. Accordingly, the embodiments are not to be limited except in accordance with the appended claims and their equivalents. Furthermore, various modifications and changes may be made within the scope of the appended claims.
此外,在描述具有代表性的实施例时,说明书可能已经将方法和/或过程呈现为特定的步骤序列。然而,在该方法或过程不依赖于本文所述步骤的特定顺序的程度上,该方法或过程不应限于所述的特定顺序的步骤。如本领域普通技术人员将理解的,其它的步骤顺序也是可能的。因此,说明书中阐述的步骤的特定顺序不应被解释为对权利要求的限制。此外,针对该方法和/或过程的权利要求不应限于按照所写顺序执行它们的步骤,本领域技术人员可以容易地理解,这些顺序可以变化,并且仍然保持在本申请实施例的精神和范围内。Furthermore, in describing representative embodiments, the specification may have presented a method and/or process as a particular sequence of steps. However, to the extent the method or process is not dependent on the specific order of steps described herein, the method or process should not be limited to the specific order of steps described. Other sequences of steps are also possible, as will be appreciated by those of ordinary skill in the art. Therefore, the specific order of the steps set forth in the specification should not be construed as limitations on the claims. In addition, claims for the method and/or process should not be limited to performing their steps in the order written, those skilled in the art can easily understand that these orders can be changed and still remain within the spirit and scope of the embodiments of the present application Inside.
本申请实施例提供了一种人脸图像光照质量的确定方法,如图1所示,所述方法包括:The embodiment of the present application provides a method for determining the illumination quality of a face image, as shown in Figure 1, the method includes:
步骤S101从人脸图像中解析出人脸皮肤图像;Step S101 parses out the face skin image from the face image;
所述人脸图像可以仅包含人脸;也可以除包含人脸外,还包含人体的其他部分(如脖子,肩膀),以及还可以包括背景图案;The human face image may only include a human face; it may also include other parts of the human body (such as neck and shoulders) in addition to the human face, and may also include a background pattern;
进一步地,为了获取更准确的光照质量评价,本申请可以人脸设置角度和模糊度参数评估条件,能筛选出高质量的人脸皮肤图像,对达到相应参数设置范围的人脸图像进行后续解析流程,从而实现后续更准确的光照质量评价;Furthermore, in order to obtain more accurate light quality evaluation, this application can set the angle and blur parameter evaluation conditions of the face, can filter out high-quality face skin images, and perform subsequent analysis on the face images that reach the corresponding parameter setting range Process, so as to achieve subsequent more accurate light quality evaluation;
步骤S102获取上述人脸皮肤图像的亮度系数和亮度不均匀系数;Step S102 obtains the brightness coefficient and the brightness unevenness coefficient of the above-mentioned human face skin image;
步骤S103根据上述亮度系数和上述亮度不均匀系数确定上述人脸图像的光照质量。Step S103 determines the illumination quality of the human face image according to the brightness coefficient and the brightness non-uniformity coefficient.
本申请实施例记载的人脸图像光照质量的确定方法,只聚焦人脸皮肤区域,排除了图像其他部分的光照质量对人脸图像光照质量评价的干扰。此外,在确定人脸图像光照质量时,本申请不仅考虑光照亮度强弱因素,还考虑到因光照、人体姿势等造成的人脸光照亮度不均匀因素,使得最终确定的光照质量更加准确。具体的,本申请要排除部分可能只是连上小部分极强光造成的亮暗,和亮暗区别不是很明显的两大块区域等情况下对光照评价造成的干扰。The method for determining the illumination quality of a face image described in the embodiment of the present application only focuses on the skin area of the face, and eliminates the interference of the illumination quality of other parts of the image on the evaluation of the illumination quality of the face image. In addition, when determining the illumination quality of the face image, the application not only considers the strength of the illumination brightness, but also considers the uneven illumination brightness of the face caused by illumination, human body posture, etc., so that the finally determined illumination quality is more accurate. Specifically, this application should eliminate the interference to the light evaluation caused by some bright and dark areas that may only be connected to a small part of extremely strong light, and two large areas where the difference between bright and dark is not obvious.
在一示例性实施例中,从人脸图像中解析出人脸皮肤图像的方法包括:In an exemplary embodiment, the method for parsing out a human face skin image from a human face image includes:
基于人脸解析算法(如基于深度学习的face parsing算法)对人脸图像进行分解,并从中选取人脸皮肤图像。人脸图像经过解析后,对脸部区域中每个语义成分分配一个标签,多个区域包括:头发、面部皮肤、眼睛、鼻子、嘴巴;如图2所示,从解析后的多个区域中提取人脸皮肤图像,包括:鼻子区域和面部皮肤区域。Decompose the face image based on the face parsing algorithm (such as the face parsing algorithm based on deep learning), and select the face skin image from it. After the face image is parsed, a label is assigned to each semantic component in the face area, and multiple areas include: hair, facial skin, eyes, nose, and mouth; as shown in Figure 2, from the multiple areas after parsing Extract human face skin images, including: nose area and facial skin area.
通过人脸解析去除五官头发等颜色较深部分,只留下人脸皮肤部分进行人脸光照质量评价,排除了当存在背景干扰和其他特征干扰时影响评价准确度的情况,例如在人脸亮度正常但是背景极亮或者极暗的情况下,会导致评价结果不准。本申请只聚焦人脸肤色区域,获得人脸实际区域最真实的光照质量评估结果。Remove the darker parts such as facial features and hair through face analysis, leaving only the skin part of the face for face lighting quality evaluation, eliminating the situation that affects the evaluation accuracy when there is background interference and other feature interference, such as in the brightness of the face It is normal but the background is extremely bright or extremely dark, which will lead to inaccurate evaluation results. This application only focuses on the skin color area of the face to obtain the most realistic light quality evaluation results of the actual area of the face.
在一示例性实施例中,步骤S102获取上述人脸皮肤图像的亮度系数和亮度不均匀系数,包括:In an exemplary embodiment, step S102 acquires the brightness coefficient and the brightness unevenness coefficient of the above-mentioned human face skin image, including:
基于上述人脸皮肤图像生成直方图曲线;Generate a histogram curve based on the above-mentioned human face skin image;
通过上述直方图曲线分别获取上述亮度系数和上述亮度不均匀系数。The brightness coefficient and the brightness non-uniformity coefficient are respectively obtained through the histogram curve.
在一示例性实施例中,通过上述直方图曲线获取上述亮度系数,包括:In an exemplary embodiment, the above-mentioned brightness coefficient is obtained through the above-mentioned histogram curve, including:
基于上述直方图曲线,计算所有像素点的灰度值偏离中心灰度值的均值和方差;Based on the above histogram curve, calculate the mean and variance of the gray value of all pixels from the central gray value;
将上述均值和上述方差比值的绝对值作为上述亮度系数。The absolute value of the ratio of the above-mentioned mean value and the above-mentioned variance is used as the above-mentioned brightness coefficient.
具体的,生成所述人脸皮肤图像的直方图曲线(也可称为灰度直方图曲线),基于图2所示的人脸皮肤图像生成的直方图曲线如图3所示,其中,直方图横坐标代表图像中的亮度,由左向右从全黑逐渐过渡到全白,范围为[0,255];纵轴代表的则是图像中处于这个亮度范围的像素的数量(也称为频次),通过直方图曲线可获取图像的整体明暗情况,本申请实施例基于直方图曲线确定亮度系数。Specifically, generate the histogram curve (also known as the grayscale histogram curve) of the human face skin image, the histogram curve generated based on the human face skin image shown in Figure 2 is as shown in Figure 3, wherein the histogram The abscissa of the figure represents the brightness in the image, gradually transitioning from all black to all white from left to right, and the range is [0,255]; the vertical axis represents the number of pixels in this brightness range in the image (also called frequency) , the overall brightness and darkness of the image can be obtained through the histogram curve, and the embodiment of the present application determines the brightness coefficient based on the histogram curve.
进一步的,如图3所示,本申请首先计算上述像素直方图曲线的灰度偏离均值da以及灰度偏离的方差ma;再根据上述da和上述ma计算上述亮度系数。Further, as shown in FIG. 3 , the present application first calculates the mean value da of the gray scale deviation of the above-mentioned pixel histogram curve and the variance ma of the gray scale deviation; and then calculates the above-mentioned brightness coefficient according to the above-mentioned da and the above-mentioned ma.
在一示例性实施例中,计算上述直方图曲线的灰度偏离均值da以及灰度偏离的方差ma的方法,包括:In an exemplary embodiment, the method for calculating the grayscale deviation from the mean da and the variance ma of the grayscale deviation of the above-mentioned histogram curve includes:
其中,N表示上述人脸皮肤图像中包含的像素点的总数;pi表示第i个像素点的像素值(也称为灰度值);128表示中心灰度值;j表示像素值,histj表示像素值j出现的频次。Wherein, N represents the total number of pixels contained in the above-mentioned human face skin image; p i represents the pixel value (also known as the gray value) of the ith pixel point; 128 represents the central gray value; j represents the pixel value, hist j represents the frequency of occurrence of pixel value j.
灰度偏离均值da反映了人脸皮肤图像的平均亮度,如果均值适中,则目视效果良好;灰度偏离方差ma反映了像素值偏离中心灰度值的程度,值越大,则灰度等级越分散。The grayscale deviation from the mean da reflects the average brightness of the face skin image. If the average value is moderate, the visual effect is good; the grayscale deviation variance ma reflects the degree to which the pixel value deviates from the central grayscale value. The larger the value, the higher the grayscale level. The more scattered.
在一示例性实施例中,根据上述da和上述ma计算上述亮度系数K包括:In an exemplary embodiment, calculating the above-mentioned brightness coefficient K according to the above-mentioned da and the above-mentioned ma includes:
K=|da|/|ma| (3)K=|da|/|ma| (3)
亮度系数越小,亮度值偏离中心灰度值就越少。本申请依据直方图曲线的整体完成对图像的亮度评价,通过亮度系数统计衡量亮度数据分布的分散程度,以衡量亮度值偏离中心灰度值的程度。The smaller the brightness coefficient, the less the brightness value deviates from the central gray value. This application completes the brightness evaluation of the image based on the overall histogram curve, and measures the degree of dispersion of brightness data distribution through brightness coefficient statistics to measure the degree to which the brightness value deviates from the central gray value.
在一示例性实施例中,通过上述直方图曲线获取亮度不均匀系数,包括:In an exemplary embodiment, obtaining the brightness non-uniformity coefficient through the above-mentioned histogram curve includes:
依据预设的像素阈值,将上述人脸皮肤图像的直方图曲线划分为亮区和暗区;According to the preset pixel threshold, the histogram curve of the above-mentioned human face skin image is divided into a bright area and a dark area;
通过上述直方图曲线获取上述亮度不均匀系数,其中,上述亮度不均匀系数根据以下至少一个确定:用于表示上述亮区和上述暗区亮度差异的第一系数,以及,用于表示上述亮区和上述暗区面积差异的第二系数。The brightness non-uniformity coefficient is obtained through the histogram curve, wherein the brightness non-uniformity coefficient is determined according to at least one of the following: a first coefficient used to represent the brightness difference between the bright area and the dark area, and a first coefficient used to represent the bright area The second coefficient of the difference from the area of the dark zone above.
具体的,上述亮区指的是直方图曲线中对应的每个像素点的像素值大于或等于预设像素阈值的区域;上述暗区指的是直方图曲线中对应的每个像素点的像素值小于预设像素阈值的区域。本申请不限制确定预设的像素阈值的方法,可采用比如最大熵法,最小交叉熵法、最大相关法、灰度熵法和最大类间方差法等。优选的,可采用最大类间方差法寻找区分亮区和暗区的像素阈值T;对于暗区,其每个像素点的像素值小于T;对于亮区,其每个像素点的像素值大于或等于T。Specifically, the above-mentioned bright area refers to the area where the pixel value of each pixel point in the histogram curve is greater than or equal to the preset pixel threshold; the above-mentioned dark area refers to the pixel value of each pixel point in the histogram curve. Areas with values less than a preset pixel threshold. The present application does not limit the method of determining the preset pixel threshold, such as the maximum entropy method, the minimum cross-entropy method, the maximum correlation method, the gray entropy method, and the maximum inter-class variance method, etc. may be used. Preferably, the maximum inter-class variance method can be used to find the pixel threshold T for distinguishing bright areas and dark areas; for dark areas, the pixel value of each pixel is less than T; for bright areas, the pixel value of each pixel is greater than or equal to T.
具体的,本申请将人脸皮肤图像对应的直方图曲线划分为亮区和暗区,而不是首先将人脸皮肤图像先分块再对分块后的区域进行不均匀度的比较,本申请不受限于图像分块,而是基于整体像素的分布准确描述人脸部分亮暗不均匀度,避免了没有考虑上下部分阴阳脸等情况。Specifically, this application divides the histogram curve corresponding to the human face skin image into bright areas and dark areas, instead of first dividing the human face skin image into blocks and then comparing the unevenness of the divided areas. It is not limited to image blocks, but accurately describes the unevenness of the brightness and darkness of the face based on the distribution of the overall pixels, avoiding the situation that the upper and lower parts of the yin and yang faces are not considered.
本申请通过以下至少一个指标实现对不均匀度的判断:第一系数和第二系数。其中,第一系数是用于表示上述亮区和上述暗区亮度差异,即不均匀区域光照的反差强度;第二系数是用于表示上述亮区和上述暗区面积差异,即不均匀区域光照对应的比例。通过这两个指标,不仅能避免肤色等轻度不均匀对光线不均匀造成的误判,还能在不受限于图像区域划分,准确衡量不均匀区域亮度反差强度的高低,从而减少对脸部肤色不均匀程度的误判。The present application realizes the judgment of unevenness through at least one of the following indicators: the first coefficient and the second coefficient. Among them, the first coefficient is used to indicate the brightness difference between the above-mentioned bright area and the above-mentioned dark area, that is, the contrast intensity of the uneven area illumination; the second coefficient is used to indicate the area difference between the above-mentioned bright area and the above-mentioned dark area, that is, the uneven area illumination corresponding ratio. Through these two indicators, it is not only possible to avoid misjudgment caused by light unevenness caused by slight uneven skin color, but also to accurately measure the brightness and contrast intensity of uneven areas without being limited by the division of image areas, thereby reducing the risk of blurred images. Misjudgment of uneven skin tone.
针对人脸皮肤图像,其在直方图曲线中呈现的双峰值一般是人脸常规肤色区域和被光照影响的肤色区域,即为人脸肤色两种核心像素的分布情况。进一步的,本申请通过双峰峰值像素和阈值距离关系以及双波峰区域的面积关系,而不是基于语义信息将图像划分区域,或是脸部对称区域的先验。即便脸部光照存在各方向不定的不对称,各光照范围的亮度差异,本申请依旧基于准确统计和描述人脸肤色核心像素的分布,能客观评价了图像光照不均匀度。具体的,本申请中亮度不均匀系数包括第一系数和第二系数两种指标,且该两种指标都依赖于波峰像素值和预设的像素阈值。For the face skin image, the double peaks presented in the histogram curve are generally the normal skin color area of the face and the skin color area affected by the light, that is, the distribution of the two core pixels of the face skin color. Furthermore, this application uses the relationship between the double-peak peak pixel and the threshold distance and the area relationship of the double-peak area, rather than dividing the image into regions based on semantic information, or the priori of the symmetrical region of the face. Even if the facial illumination has asymmetry in various directions and the brightness of each illumination range is different, this application is still based on accurate statistics and description of the distribution of core pixels of human face skin color, and can objectively evaluate the unevenness of image illumination. Specifically, the brightness non-uniformity coefficient in this application includes two indexes, the first coefficient and the second coefficient, and both indexes depend on the peak pixel value and the preset pixel threshold.
在一示例性实施例中,通过上述直方图曲线获取上述亮度不均匀系数,包括:In an exemplary embodiment, obtaining the above-mentioned brightness non-uniformity coefficient through the above-mentioned histogram curve includes:
从上述亮区和上述暗区中分别确定第一像素值和第二像素值;determining a first pixel value and a second pixel value from said bright area and said dark area, respectively;
结合上述第一像素值,上述第二像素值和上述预设的像素阈值分别确定上述第一系数和上述第二系数。The first coefficient and the second coefficient are respectively determined in combination with the first pixel value, the second pixel value and the preset pixel threshold.
具体的,在确定亮度不均匀系数之前,本申请实施例按照相同预设条件从亮区和暗区中分别挑选出第一像素值和第二像素值。Specifically, before determining the brightness non-uniformity coefficient, the embodiment of the present application selects the first pixel value and the second pixel value respectively from the bright area and the dark area according to the same preset condition.
在一示例性实施例中,上述相同预设条件包括:区域中出现频次最多的像素值。由于像素的直方图的横坐标表示像素值,纵坐标表示对应像素值出现的频次,因此,在一示例性实施例中,从上述亮区和上述暗区中分别确定第一像素值和第二像素值,包括:确定亮区和暗区中出现频次最多的像素值,其中,上述亮区的直方图曲线波峰峰值对应的像素值为第一像素值,上述暗区的直方图曲线波峰峰值对应的像素值为第二像素值。In an exemplary embodiment, the above-mentioned same preset condition includes: the pixel value that appears most frequently in the region. Since the abscissa of the pixel histogram represents the pixel value, and the ordinate represents the occurrence frequency of the corresponding pixel value, therefore, in an exemplary embodiment, the first pixel value and the second pixel value are respectively determined from the above-mentioned bright area and the above-mentioned dark area. Pixel value, including: determining the pixel value with the most frequent occurrence in the bright area and the dark area, wherein the pixel value corresponding to the peak value of the histogram curve in the bright area is the first pixel value, and the peak value of the histogram curve in the dark area corresponds to The pixel value of is the second pixel value.
如图3所示,由于亮度不均匀会在直方图曲线像素阈值T左右出现峰值,即可分别在像素阈值T左右两侧寻找到最大值pl,pr,作为上述第二像素值和第一像素值。具体的,在亮区中寻找使人脸皮肤图像的像素直方图曲线出现波峰,将其峰值对应的像素值pr作为第一像素值;在暗区中寻找使人脸皮肤图像的像素直方图曲线出现波峰,将其峰值对应的像素值pl,作为第二像素值。As shown in Figure 3, due to uneven brightness, there will be peaks around the pixel threshold T of the histogram curve, and the maximum values pl and pr can be found on the left and right sides of the pixel threshold T, respectively, as the second pixel value and the first pixel value value. Specifically, in the bright area, search for the pixel histogram curve of the human face skin image to have a peak, and use the pixel value pr corresponding to the peak value as the first pixel value; in the dark area, search for the pixel histogram curve of the human face skin image When a peak appears, the pixel value pl corresponding to the peak value is used as the second pixel value.
本申请实施例记载的技术方案也同样适用于像素阈值T左右无峰值(即亮区暗区无波峰)的情况,若像素阈值T的左边或者右边不存在峰值,可以对应设置pl=T或者pr=T。此外,针对亮区或暗区存在多个次波峰的情况,由于光照引起的次波峰才是真正的主波峰,其余次波峰可能是脸部小部分的瑕疵或者脸部有渐变等原因引起的,并且两个次波峰相距不会太远。若次波峰高度明显不一,即次波峰之间的波峰值差距大于差异阈值,则选取具有最高波峰的次波峰,将其波峰对应的像素值作为像素阈值;若次波峰高度差距较小,即次波峰之间的波峰值差距小于差异阈值,则选取任意一个次波峰峰值对应的像素值,或者将所有次波峰的像素值平均获得的最终像素值确定为像素阈值。The technical solution described in the embodiment of the present application is also applicable to the situation where there is no peak around the pixel threshold T (that is, there is no peak in the bright area and dark area). If there is no peak on the left or right of the pixel threshold T, pl=T or pr can be set correspondingly. =T. In addition, in the case of multiple sub-peaks in bright or dark areas, the sub-peaks caused by light are the real main peaks, and the remaining sub-peaks may be caused by small blemishes on the face or gradients on the face. And the two sub-peaks are not too far apart. If the heights of the secondary peaks are obviously different, that is, the difference between the peaks of the secondary peaks is greater than the difference threshold, then select the secondary peak with the highest peak, and use the pixel value corresponding to the peak as the pixel threshold; if the difference between the secondary peak heights is small, that is If the difference between the peaks of the sub-peaks is smaller than the difference threshold, the pixel value corresponding to any one of the sub-peaks is selected, or the final pixel value obtained by averaging the pixel values of all sub-peaks is determined as the pixel threshold.
通过试验证明,通过像素阈值左右两侧的波峰峰值对应的像素值描述图像亮区和暗区的差异,可以准确的描述出人脸常规肤色区域和同一人脸被光照影响的肤色区域之间的差异。Experiments have proved that the difference between the bright and dark areas of the image can be described by the pixel values corresponding to the peaks on the left and right sides of the pixel threshold, and the difference between the normal skin color area of the face and the skin color area of the same face affected by light can be accurately described. difference.
在一示例性实施例中,结合上述第一像素值、上述第二像素值和上述预设的像素阈值确定上述第一系数,包括:In an exemplary embodiment, determining the above-mentioned first coefficient in combination with the above-mentioned first pixel value, the above-mentioned second pixel value, and the above-mentioned preset pixel threshold value includes:
计算上述第一像素值与上述像素阈值的差值,得到第一差异;calculating the difference between the first pixel value and the pixel threshold to obtain a first difference;
计算上述第二像素值与上述像素阈值的差值,得到第二差异;calculating the difference between the second pixel value and the pixel threshold to obtain a second difference;
通过计算上述第一差异和上述第二差异的平均,确定上述第一系数。The first coefficient is determined by calculating an average of the first difference and the second difference.
针对人脸皮肤图像,其直方图曲线中呈现的双峰值一般是人脸常规肤色区域和被光照影响的肤色区域(或者类似脸部红晕等自身的肤色分层区域)。进一步的,本申请通过双峰峰值像素和阈值的距离关系能描述两种核心像素的反差强度,较小的反差强度会降低最后的评分,能避免因自身肤色不均匀(脸部红晕等)的原因造成光照均匀度描述的影响。For the face skin image, the double peaks presented in the histogram curve are generally the normal skin color area of the face and the skin color area affected by the light (or the skin color layered area such as the facial blush). Further, the present application can describe the contrast intensity of the two core pixels through the distance relationship between the bimodal peak pixel and the threshold value, and a smaller contrast intensity will reduce the final score, which can avoid problems caused by uneven skin color (blush on the face, etc.) The reason for the impact of the illumination uniformity description.
具体的,根据上述第一像素值、第二像素值各自与像素阈值的距离差,可以获知亮区和暗区的像素值的差异程度,也即光照反差程度。以图3为例,上述第一像素值pr与上述像素阈值T的差异为(pr-T),上述第二像素值pl与上述像素阈值T的差异为(T-pl);Specifically, according to the distance difference between the first pixel value and the second pixel value and the pixel threshold, the degree of difference between the pixel values of the bright area and the dark area, that is, the degree of illumination contrast, can be known. Taking Fig. 3 as an example, the difference between the above-mentioned first pixel value pr and the above-mentioned pixel threshold T is (pr-T), and the difference between the above-mentioned second pixel value pl and the above-mentioned pixel threshold T is (T-pl);
则第一系数为:Then the first coefficient is:
本申请采用第一系数描述双波峰的距离阈值的平均距离,代表了光照较暗区域中像素值数量最多的点的像素值和光照较亮区域里面的对应值的一个差值,其能更准确地度量不均匀区域光照的反差强度,此外也能避免轻度肤色不均匀造成的光线不均匀误判,例如脸部红晕这类亮暗区别不是很明显的区域,其在直方图曲线中,将以较小的震荡幅度存在。本申请采取区域最高波峰,当第一系数越大则暗高峰和亮高峰之间的距离越大,光照的反差强度越大,则图像越不均匀。This application uses the first coefficient to describe the average distance of the distance threshold of the double peaks, which represents a difference between the pixel value of the point with the largest number of pixel values in the darker illuminated area and the corresponding value in the brighter illuminated area, which can be more accurate In addition, it can also avoid the misjudgment of light unevenness caused by mild uneven skin color. For example, in areas where the difference between light and dark is not obvious such as facial blush, in the histogram curve, the Exists with a small shock amplitude. This application adopts the highest peak in the area. When the first coefficient is larger, the distance between the dark peak and the bright peak is larger, and the contrast intensity of the light is larger, the image is more uneven.
此外,本申请实施例还将直方图曲线亮区的面积和暗区的面积的比值作为第二系数,其可准确地描述不同人脸肤色的核心像素的比例,避免长尾像素对脸部光照均匀度造成的不利影响。In addition, the embodiment of the present application also uses the ratio of the area of the bright area of the histogram curve to the area of the dark area as the second coefficient, which can accurately describe the proportion of core pixels of different skin colors of human faces, and avoid long-tail pixels from illuminating the face adverse effects on uniformity.
在一示例性实施例中,结合上述第一像素值、上述第二像素值和上述预设的像素阈值确定上述第二系数,包括:In an exemplary embodiment, determining the above-mentioned second coefficient in combination with the above-mentioned first pixel value, the above-mentioned second pixel value and the above-mentioned preset pixel threshold value includes:
通过上述第一像素值、上述第二像素值和上述预设的像素阈值分别获取上述亮区的面积和暗区的面积;Obtaining the area of the bright area and the area of the dark area respectively by using the first pixel value, the second pixel value, and the preset pixel threshold;
将上述亮区的面积与上述暗区的面积的比值作为上述第二系数。The ratio of the area of the bright area to the area of the dark area is used as the second coefficient.
本申请专利第二系数对应的物理意义就是整个脸部不同光照对应的比例,在评估不均匀度时可降低连上小部分极强光造成的亮暗对最终不均匀度的影响。The physical meaning corresponding to the second coefficient of the patent application is the proportion corresponding to the different lighting of the entire face. When evaluating the unevenness, it can reduce the impact of the brightness and darkness caused by connecting a small part of extremely strong light on the final unevenness.
获取上述亮区的面积和上述暗区的面积,包括:Obtain the area of the above bright area and the area of the above dark area, including:
计算上述第一像素值,上述第二像素值,上述预设像素阈值和像素边界值两两之间差值中的最小值,将上述最小值作为峰值宽度;Calculating the minimum value of the above-mentioned first pixel value, the above-mentioned second pixel value, the difference between the above-mentioned preset pixel threshold value and the pixel boundary value, and using the above-mentioned minimum value as the peak width;
以上述第一像素值为中轴,第一左边界和第一右边界所包含的直方图曲线区域面积为上述亮区的面积,其中,上述第一左边界和上述第一右边界与上述中轴的距离均为上述峰值宽度;Taking the above-mentioned first pixel value as the central axis, the area of the histogram curve area contained in the first left boundary and the first right boundary is the area of the above-mentioned bright area, wherein, the above-mentioned first left boundary and the above-mentioned first right boundary are the same as the above-mentioned center Axis distances are the above peak widths;
以上述第二像素值为中轴,第二左边界和第二右边界所包含的直方图曲线区域面积为上述暗区的面积,其中,上述第二左边界和上述第二右边界与上述中轴的距离均为上述峰值宽度。Taking the above-mentioned second pixel value as the central axis, the area of the histogram curve area contained in the second left boundary and the second right boundary is the area of the above-mentioned dark area, wherein, the above-mentioned second left boundary and the above-mentioned second right boundary are the same as the above-mentioned middle Axis distances are the above-mentioned peak widths.
此外,相较于使用区域全像素段,为了更准确描述两种核心肤色状态的像素,排除长尾像素加入衡量指标,试验表明峰值左右一小段像素距离形成的面积的面积比能较好的描述当前两种核心像素的比例。In addition, compared with using the full pixel segment of the area, in order to more accurately describe the pixels of the two core skin color states, long-tail pixels are excluded and added to the measurement index. Experiments show that the area ratio of the area formed by a small pixel distance around the peak can better describe The ratio of the current two core pixels.
具体的,本申请通过引入峰值宽度限制亮区和暗区的波峰范围,通过计算第一像素值,第二像素值,预设像素阈值和像素边界值(包括0和255)两两之间差值中的最小值,将上述最小值作为峰值宽度。采用最小值作为峰值宽度一方面可以减少长尾像素影响衡量指标,一方面可防止区域面积重合。在选择亮区的面积时,以第一像素值为中轴,第一左边界和第一右边界所包含的直方图曲线区域面积为亮区的面积,其中,第一左边界和第一右边界与上述中轴的距离均为峰值宽度,暗区同理。Specifically, this application limits the peak range of bright and dark areas by introducing peak width, and calculates the difference between the first pixel value, the second pixel value, the preset pixel threshold and the pixel boundary value (including 0 and 255) The minimum value among the values, using the above minimum value as the peak width. Using the minimum value as the peak width can reduce the influence of long-tail pixels on the measurement index, and prevent the area from overlapping on the one hand. When selecting the area of the bright area, the area of the histogram curve area contained in the first left boundary and the first right boundary is the area of the bright area, where the first left boundary and the first right The distance between the boundary and the above-mentioned central axis is the peak width, and the same is true for the dark area.
以图3为例,暗区的面积al为:Taking Figure 3 as an example, the area al of the dark area is:
亮区的面积ar为:The area ar of the bright area is:
其中,halfw=min(|256-pr|,|pr-T|,|T-pl|,|Pl-0|),T为所述像素阈值;histi为像素值i出现的频次,即为直方图曲线中横坐标为像素值i对应的纵坐标。Among them, halfw=min(|256-pr|, |pr-T|, |T-pl|, |Pl-0|), T is the pixel threshold; hist i is the frequency of occurrence of pixel value i, which is The abscissa in the histogram curve is the ordinate corresponding to the pixel value i.
对应的,上述第二系数的计算方法可以为:Correspondingly, the calculation method of the above second coefficient can be:
第二系数是亮区域和暗区域的面积比,第二系数的范围是大于1,当系数刚好为1时,代表是暗部和亮部正好相等,第二系数越大代表某种区域面积越大,图像的光照越均匀。通过关注峰值是两种肤色状态的像素,排除部分可能只是连上小部分极强光造成的亮暗,从而降低了对图像不均匀度的误判。The second coefficient is the area ratio between the bright area and the dark area. The range of the second coefficient is greater than 1. When the coefficient is exactly 1, it means that the dark part and the bright part are exactly equal. The larger the second coefficient, the larger the area of a certain area , the more uniform the illumination of the image. By paying attention to the pixels whose peaks are two kinds of skin color states, the exclusion part may only be bright and dark caused by a small part of extremely strong light, thereby reducing the misjudgment of image unevenness.
在一示例性实施例中,根据上述亮度系数和上述亮度不均匀系数确定上述人脸图像的光照质量,包括:In an exemplary embodiment, determining the illumination quality of the above-mentioned face image according to the above-mentioned brightness coefficient and the above-mentioned brightness non-uniformity coefficient includes:
将上述亮度系数、上述第一系数和上述第二系数进行加权求和;performing weighted summation of the brightness coefficient, the first coefficient and the second coefficient;
根据求和的结果确定上述人脸图像的光照质量。The illumination quality of the above-mentioned face image is determined according to the result of the summation.
将上述亮度系数、上述第一系数和上述第二系数根据权重,进行加权求和,如score=w1*K+w2*dis+w3*ratio,其中w1,w2,w3表示三个系数的权重,可以根据试验或需求自适应设定;根据求和的结果score确定上述人脸图像的光照质量,score值越大,光照质量越好;反之,score值越小,光照质量越差。Perform weighted summation of the brightness coefficient, the first coefficient and the second coefficient according to weights, such as score=w 1 *K+w 2 *dis+w 3 *ratio, wherein w 1 , w 2 , and w 3 represent The weights of the three coefficients can be adaptively set according to experiments or requirements; the illumination quality of the above-mentioned face image is determined according to the result score of the summation, the larger the score value, the better the illumination quality; conversely, the smaller the score value, the better the illumination quality. worse.
本申请只聚焦人脸肤色区域,无背景干扰进行人脸光照质量评价,并根据光照不均呈现双峰的现象来进行人脸光照均匀度评价,结合人脸亮度评价最终得到人脸光照质量评价,该评价并不依赖语义的区域分割,而是基于整体图像的亮度像素分布情况进行相关维度的度量计算,既能不受限于左右脸部分区域对称的假设,也能衡量不均匀区域亮度反差强度的高低减少轻度脸部肤色不均匀等导致误判,能很好排除其他图像质量干扰因素,专注图像光照亮度方面的评价。This application only focuses on the skin color area of the face, without background interference to evaluate the lighting quality of the face, and evaluates the uniformity of the lighting on the face according to the phenomenon of uneven lighting showing double peaks, combined with the evaluation of the brightness of the face, finally obtains the evaluation of the lighting quality of the face , this evaluation does not rely on semantic region segmentation, but is based on the brightness pixel distribution of the overall image to perform measurement calculations of relevant dimensions, which is not limited to the assumption of symmetry between the left and right face parts, and can also measure the brightness contrast of uneven regions The level of intensity reduces the misjudgment caused by mild facial uneven skin tone, which can well eliminate other image quality interference factors and focus on the evaluation of image brightness.
本申请实施例提供了一种人脸图像光照质量的确定装置,如图4所示,上述装置包括:解析模块410,用于从人脸图像中解析出人脸皮肤图像;处理模块420,用于获取上述人脸皮肤图像的亮度系数和亮度不均匀系数;评估模块430,用于根据上述亮度系数和上述亮度不均匀系数确定上述人脸图像的光照质量。The embodiment of the present application provides a device for determining the illumination quality of a human face image. As shown in FIG. Obtaining the brightness coefficient and brightness unevenness coefficient of the above-mentioned human face skin image; the evaluation module 430 is configured to determine the illumination quality of the above-mentioned human face image according to the above-mentioned brightness coefficient and the above-mentioned brightness unevenness coefficient.
本申请实施例记载的人脸图像光照质量的确定装置,只聚焦人脸皮肤区域,排除了图像其他部分的光照质量对人脸图像光照质量评价的干扰。此外,在确定人脸图像光照质量时,本申请不仅考虑光照亮度强弱因素,还考虑到因光照、人体姿势等造成的人脸光照亮度不均匀因素,使得最终确定的光照质量更加准确。具体的,本申请排除部分可能只是连上小部分极强光造成的亮暗,和亮暗区别不是很明显的两大块区域等情况下对光照评价造成的干扰。The device for determining the illumination quality of a face image described in the embodiment of the present application only focuses on the skin area of the face, and eliminates the interference of the illumination quality of other parts of the image on the evaluation of the illumination quality of the face image. In addition, when determining the illumination quality of the face image, the application not only considers the strength of the illumination brightness, but also considers the uneven illumination brightness of the face caused by illumination, human body posture, etc., so that the finally determined illumination quality is more accurate. Specifically, this application excludes the interference to the lighting evaluation caused by the bright and dark areas caused by the connection of a small part of extremely strong light, and the two large areas where the difference between bright and dark is not obvious.
在一示例性实施例中,上述处理模块410包括:In an exemplary embodiment, the above processing module 410 includes:
第一处理模块,用于依据预设的像素阈值,将上述人脸皮肤图像的直方图曲线划分为亮区和暗区;The first processing module is used to divide the histogram curve of the above-mentioned human face skin image into bright areas and dark areas according to a preset pixel threshold;
第二处理模块,用于通过上述直方图曲线分别获取上述亮度系数和上述亮度不均匀系数,其中,上述亮度不均匀系数根据以下至少一个确定:用于表示上述亮区和上述暗区亮度差异的第一系数,以及,用于表示上述亮区和上述暗区面积差异的第二系数。The second processing module is configured to respectively obtain the above-mentioned brightness coefficient and the above-mentioned brightness non-uniformity coefficient through the above-mentioned histogram curve, wherein the above-mentioned brightness non-uniformity coefficient is determined according to at least one of the following: used to represent the brightness difference between the above-mentioned bright area and the above-mentioned dark area The first coefficient, and the second coefficient used to represent the area difference between the above-mentioned bright area and the above-mentioned dark area.
具体的,上述亮区指的是直方图曲线中对应的每个像素点的像素值大于或等于预设像素阈值的区域;上述暗区指的是直方图曲线中对应的每个像素点的像素值小于预设像素阈值的区域。本申请不限制确定预设的像素阈值的方法,比如最大熵法,最小交叉熵法、最大相关法、灰度熵法和最大类间方差法等。优选的,可采用最大类间方差法寻找区分亮区和暗区的像素阈值T;对于暗区,其每个像素点的像素值小于T;对于亮区,其每个像素点的像素值大于或等于T。Specifically, the above-mentioned bright area refers to the area where the pixel value of each pixel point in the histogram curve is greater than or equal to the preset pixel threshold; the above-mentioned dark area refers to the pixel value of each pixel point in the histogram curve. Areas with values less than a preset pixel threshold. The present application does not limit the method for determining the preset pixel threshold, such as the maximum entropy method, the minimum cross-entropy method, the maximum correlation method, the gray entropy method, and the maximum inter-class variance method. Preferably, the maximum inter-class variance method can be used to find the pixel threshold T for distinguishing bright areas and dark areas; for dark areas, the pixel value of each pixel is less than T; for bright areas, the pixel value of each pixel is greater than or equal to T.
具体的,本申请将人脸皮肤图像对应的直方图曲线划分为亮区和暗区,而不是首先将人脸皮肤图像先分块再对分块后的区域进行不均匀度的比较,不受限于图像分块,本申请是基于整体像素的分布准确描述人脸部分亮暗不均匀度,避免了没有考虑上下部分阴阳脸等情况。Specifically, this application divides the histogram curve corresponding to the human face skin image into bright areas and dark areas, instead of first dividing the human face skin image into blocks and then comparing the unevenness of the divided areas. Limited to image blocks, this application is based on the distribution of the overall pixels to accurately describe the unevenness of the brightness and darkness of the human face, avoiding the situation that the upper and lower parts of the yin and yang faces are not considered.
在一示例性实施例中,上述第二处理模块包括亮度系数单元,包括:In an exemplary embodiment, the above-mentioned second processing module includes a brightness coefficient unit, including:
第一处理单元,用于基于上述直方图曲线,计算所有像素点的灰度值偏离中心灰度值的均值和方差;The first processing unit is configured to calculate, based on the above-mentioned histogram curve, the mean and variance of the gray values of all pixels deviating from the central gray value;
第二处理单元,用于将上述均值和上述方差比值的绝对值作为上述亮度系数。The second processing unit is configured to use the absolute value of the ratio of the above-mentioned mean value and the above-mentioned variance as the above-mentioned brightness coefficient.
亮度系数越小,亮度值偏离中心灰度值就越少。本申请依据直方图曲线的整体完成对图像的亮度评价,通过亮度系数统计衡量亮度数据分布的分散程度,以衡量亮度值偏离中心灰度值的程度。The smaller the brightness coefficient, the less the brightness value deviates from the central gray value. This application completes the brightness evaluation of the image based on the overall histogram curve, and measures the degree of dispersion of brightness data distribution through brightness coefficient statistics to measure the degree to which the brightness value deviates from the central gray value.
在一示例性实施例中,上述第二处理模块还包括不均匀系数单元,包括:In an exemplary embodiment, the above-mentioned second processing module also includes a non-uniform coefficient unit, including:
第三处理单元,用于从上述亮区和上述暗区中分别确定第一像素值和第二像素值;a third processing unit, configured to determine a first pixel value and a second pixel value from the bright area and the dark area, respectively;
第四处理单元,用于结合上述第一像素值,上述第二像素值和上述预设的像素阈值分别确定上述第一系数和上述第二系数。The fourth processing unit is configured to combine the first pixel value, the second pixel value and the preset pixel threshold to determine the first coefficient and the second coefficient respectively.
本申请通过以下至少一个指标实现对不均匀度的判断:第一系数和第二系数。其中,第一系数是用于表示上述亮区和上述暗区亮度差异,即不均匀度区域光照的反差强度;第二系数是用于表示上述亮区和上述暗区面积差异,即不均匀度不均匀度区域光照对应的比例,通过这两个指标,不仅能避免肤色不均匀对光线不均匀造成的误判,还能在不受限于图像区域划分的基础上衡量不均匀区域亮度反差强度的高低,从而减少脸部肤色不均匀程度的误判。The present application realizes the judgment of unevenness through at least one of the following indicators: the first coefficient and the second coefficient. Among them, the first coefficient is used to represent the brightness difference between the above-mentioned bright area and the above-mentioned dark area, that is, the contrast intensity of the illumination in the non-uniformity area; the second coefficient is used to represent the area difference between the above-mentioned bright area and the above-mentioned dark area, that is, the non-uniformity The proportion corresponding to the illumination in the unevenness area, through these two indicators, not only can avoid the misjudgment caused by uneven skin color to uneven light, but also measure the brightness contrast intensity of the uneven area on the basis of not being limited to the division of image areas to reduce the misjudgment of uneven skin tone on the face.
在一示例性实施例中,不均匀系数处理单元还包括第一不均匀系数子单元,包括:In an exemplary embodiment, the uneven coefficient processing unit further includes a first uneven coefficient subunit, including:
第一处理子单元,用于计算所述第一像素值与所述像素阈值的差值,得到第一差异;A first processing subunit, configured to calculate a difference between the first pixel value and the pixel threshold to obtain a first difference;
第二处理子单元,用于计算所述第二像素值与所述像素阈值的差值,得到第二差异;a second processing subunit, configured to calculate a difference between the second pixel value and the pixel threshold to obtain a second difference;
第三处理子单元,用于通过计算所述第一差异和所述第二差异的平均,确定所述第一系数。A third processing subunit, configured to determine the first coefficient by calculating an average of the first difference and the second difference.
本申请采用第一系数描述双波峰的距离阈值的平均距离,代表了光照较暗区域中像素值数量最多的点的像素值和光照较亮区域里面的对应值的一个差值,其能更准确地度量不均匀区域光照的反差强度,此外也能避免轻度肤色不均匀造成的光线不均匀误判,例如脸部红晕这类亮暗区别不是很明显的区域,其在直方图曲线中,将以较小的震荡幅度存在。本申请采取区域最高波峰,当第一系数越大则暗高峰和亮高峰之间的距离越大,光照的反差强度越大,则图像越不均匀。This application uses the first coefficient to describe the average distance of the distance threshold of the double peaks, which represents a difference between the pixel value of the point with the largest number of pixel values in the darker illuminated area and the corresponding value in the brighter illuminated area, which can be more accurate In addition, it can also avoid the misjudgment of light unevenness caused by mild uneven skin color. For example, in areas where the difference between light and dark is not obvious such as facial blush, in the histogram curve, the Exists with a small shock amplitude. This application adopts the highest peak in the area. When the first coefficient is larger, the distance between the dark peak and the bright peak is larger, and the contrast intensity of the light is larger, the image is more uneven.
此外,本申请实施例还将直方图曲线亮区的面积和暗区的面积的比值作为第二系数,其可准确地描述不同人脸肤色的核心像素的比例,避免长尾像素对脸部光照均匀度造成的不利影响。In addition, the embodiment of the present application also uses the ratio of the area of the bright area of the histogram curve to the area of the dark area as the second coefficient, which can accurately describe the proportion of core pixels of different skin colors of human faces, and avoid long-tail pixels from illuminating the face adverse effects on uniformity.
在一示例性实施例中,不均匀系数单元还包括第二不均匀系数子单元,包括:In an exemplary embodiment, the uneven coefficient unit further includes a second uneven coefficient subunit, including:
第四处理子单元,用于通过所述第一像素值、所述第二像素值和所述预设的像素阈值分别获取所述亮区的面积和暗区的面积;A fourth processing subunit, configured to respectively obtain the area of the bright area and the area of the dark area through the first pixel value, the second pixel value, and the preset pixel threshold;
第五处理子单元,用于将所述亮区的面积与所述暗区的面积的比值作为所述第二系数。The fifth processing subunit is configured to use the ratio of the area of the bright area to the area of the dark area as the second coefficient.
本申请专利第二系数对应的物理意义就是整个脸部不同光照对应的比例,在评估不均匀度时可降低连上小部分极强光造成的亮暗对最终不均匀度的影响。第二系数是亮区域和暗区域的面积比,第二系数的范围是大于1,当系数刚好为1时,代表是暗部和亮部正好相等,第二系数越大代表某种区域面积越大,图像的光照越均匀。The physical meaning corresponding to the second coefficient of the patent application is the proportion corresponding to the different lighting of the entire face. When evaluating the unevenness, it can reduce the impact of the brightness and darkness caused by connecting a small part of extremely strong light on the final unevenness. The second coefficient is the area ratio between the bright area and the dark area. The range of the second coefficient is greater than 1. When the coefficient is exactly 1, it means that the dark part and the bright part are exactly equal. The larger the second coefficient, the larger the area of a certain area , the more uniform the illumination of the image.
本申请只聚焦人脸肤色区域,无背景干扰进行人脸光照质量评价,并根据光照不均呈现双峰的现象来进行人脸光照均匀度评价,结合人脸亮度评价最终得到人脸光照质量评价,该评价并不依赖语义的区域分割,而是基于整体图像的亮度像素分布情况进行相关维度的度量计算,既能不受限于左右脸部分区域对称的假设,也能衡量不均匀区域亮度反差强度的高低减少轻度脸部肤色不均匀等导致误判,能很好排除其他图像质量干扰因素,专注图像光照亮度方面的评价。This application only focuses on the skin color area of the face, without background interference to evaluate the lighting quality of the face, and evaluates the uniformity of the lighting on the face according to the phenomenon of uneven lighting showing double peaks, combined with the evaluation of the brightness of the face, finally obtains the evaluation of the lighting quality of the face , this evaluation does not rely on semantic region segmentation, but is based on the brightness pixel distribution of the overall image to perform measurement calculations of relevant dimensions, which is not limited to the assumption of symmetry between the left and right face parts, and can also measure the brightness contrast of uneven regions The level of intensity reduces the misjudgment caused by mild facial uneven skin tone, which can well eliminate other image quality interference factors and focus on the evaluation of image brightness.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如前任一实施例所述的方法。The embodiment of the present application also provides a computer-readable storage medium, where one or more programs are stored in the computer-readable storage medium, and the one or more programs can be executed by one or more processors to implement the following: The method described in any of the previous examples.
根据本发明实施例的另一方面,还提供了一种处理器,处理器用于运行程序;其中,程序运行时执行上述中任意一项实施例所述的方法。According to another aspect of the embodiments of the present invention, a processor is also provided, and the processor is used to run a program; wherein, when the program is running, the method described in any one of the above-mentioned embodiments is executed.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above embodiments of the present invention are for description only, and do not represent the advantages and disadvantages of the embodiments.
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, the functional modules/units in the system, and the device can be implemented as software, firmware, hardware, and an appropriate combination thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be composed of several physical components. Components cooperate to execute. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As known to those of ordinary skill in the art, the term computer storage media includes both volatile and nonvolatile media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules, or other data. permanent, removable and non-removable media. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tape, magnetic disk storage or other magnetic storage devices, or can Any other medium used to store desired information and which can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211494122.1A CN115760816A (en) | 2022-11-25 | 2022-11-25 | Method and device for determining illumination quality of face image and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211494122.1A CN115760816A (en) | 2022-11-25 | 2022-11-25 | Method and device for determining illumination quality of face image and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115760816A true CN115760816A (en) | 2023-03-07 |
Family
ID=85338420
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211494122.1A Pending CN115760816A (en) | 2022-11-25 | 2022-11-25 | Method and device for determining illumination quality of face image and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115760816A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116645527A (en) * | 2023-04-24 | 2023-08-25 | 杭州魔点科技有限公司 | Image recognition method, system, electronic device and storage medium |
CN117975344A (en) * | 2024-04-02 | 2024-05-03 | 吉林省中农阳光数据有限公司 | Method and device for identifying uniqueness of cow face |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108875545A (en) * | 2018-04-12 | 2018-11-23 | 北京旷视科技有限公司 | Determine the method, apparatus, system and storage medium of the light condition of facial image |
CN112825120A (en) * | 2019-11-20 | 2021-05-21 | 北京眼神智能科技有限公司 | Face illumination evaluation method and device, computer readable storage medium and equipment |
CN112991159A (en) * | 2021-04-29 | 2021-06-18 | 南京甄视智能科技有限公司 | Face illumination quality evaluation method, system, server and computer readable medium |
-
2022
- 2022-11-25 CN CN202211494122.1A patent/CN115760816A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108875545A (en) * | 2018-04-12 | 2018-11-23 | 北京旷视科技有限公司 | Determine the method, apparatus, system and storage medium of the light condition of facial image |
CN112825120A (en) * | 2019-11-20 | 2021-05-21 | 北京眼神智能科技有限公司 | Face illumination evaluation method and device, computer readable storage medium and equipment |
CN112991159A (en) * | 2021-04-29 | 2021-06-18 | 南京甄视智能科技有限公司 | Face illumination quality evaluation method, system, server and computer readable medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116645527A (en) * | 2023-04-24 | 2023-08-25 | 杭州魔点科技有限公司 | Image recognition method, system, electronic device and storage medium |
CN117975344A (en) * | 2024-04-02 | 2024-05-03 | 吉林省中农阳光数据有限公司 | Method and device for identifying uniqueness of cow face |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115760816A (en) | Method and device for determining illumination quality of face image and storage medium | |
WO2017121018A1 (en) | Method and apparatus for processing two-dimensional code image, and terminal and storage medium | |
CN111079740A (en) | Image quality evaluation method, electronic device, and computer-readable storage medium | |
CN103679656B (en) | A kind of Automated sharpening of images method | |
CN112288010B (en) | Finger vein image quality evaluation method based on network learning | |
CN106503644B (en) | Glasses attribute detection method based on edge projection and color characteristic | |
CN110570360A (en) | A robust and comprehensive low-quality illumination image enhancement method based on Retinex | |
US9501689B2 (en) | Image processing apparatus and image processing method | |
CN116758528B (en) | Acrylic emulsion color change identification method based on artificial intelligence | |
CN119136064A (en) | Image strong light suppression method and system | |
CN112699760B (en) | Face target area detection method, device and equipment | |
Chen et al. | Single underwater image haze removal with a learning-based approach to blurriness estimation | |
KR20130126386A (en) | Adaptive color detection method, face detection method and apparatus | |
CN113379631B (en) | Image defogging method and device | |
CN109360189B (en) | Method for detecting pixel defect point of image of uncooled infrared movement | |
CN105184758B (en) | A kind of method of image defogging enhancing | |
Peng et al. | An underwater attenuation image enhancement method with adaptive color compensation and detail optimization | |
CN118430465A (en) | Backlight compensation method and system for intelligent display screen and display screen | |
CN114219774B (en) | Image quality evaluation method, device, terminal and computer readable storage medium | |
CN113128372B (en) | Blackhead identification method and blackhead identification device based on image processing and terminal equipment | |
CN116524877A (en) | Vehicle-mounted screen brightness adjustment method and device, electronic equipment and storage medium | |
CN104992418B (en) | A kind of abnormal color bearing calibration suitable for thermal imagery video color | |
Ji et al. | New Nighttime Dehazing Algorithm Based On Dark Channel Prior Enhancement | |
CN115205205B (en) | Intelligent evaluation method and system for display effect | |
CN118507037B (en) | Rapid dry eye detection method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |