Nothing Special   »   [go: up one dir, main page]

CN110717862B - Contrast enhancement method based on dynamic range compression and electronic device thereof - Google Patents

Contrast enhancement method based on dynamic range compression and electronic device thereof Download PDF

Info

Publication number
CN110717862B
CN110717862B CN201810758240.6A CN201810758240A CN110717862B CN 110717862 B CN110717862 B CN 110717862B CN 201810758240 A CN201810758240 A CN 201810758240A CN 110717862 B CN110717862 B CN 110717862B
Authority
CN
China
Prior art keywords
value
brightness value
input
luminance value
luminance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810758240.6A
Other languages
Chinese (zh)
Other versions
CN110717862A (en
Inventor
周旸庭
姜昊天
陈世泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Realtek Semiconductor Corp
Original Assignee
Realtek Semiconductor Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Realtek Semiconductor Corp filed Critical Realtek Semiconductor Corp
Priority to CN201810758240.6A priority Critical patent/CN110717862B/en
Publication of CN110717862A publication Critical patent/CN110717862A/en
Application granted granted Critical
Publication of CN110717862B publication Critical patent/CN110717862B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/92Dynamic range modification of images or parts thereof based on global image properties

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a contrast enhancement method based on dynamic range compression and an electronic device thereof, which determine a proper effective dynamic range through the occurrence times of an input brightness value of each pixel position in an input image, estimate a global mapping curve according to the effective dynamic range, and then adjust an output brightness value of an input brightness value mapping according to the regional characteristics of each pixel position in the input image so as to adaptively improve the contrast of the input image. Accordingly, the contrast enhancement method and the electronic device thereof can reduce the calculation complexity and generate better image contrast.

Description

基于动态范围压缩的对比增强方法及其电子装置Contrast enhancement method based on dynamic range compression and electronic device thereof

技术领域technical field

本发明提供一种对比增强方法及其电子装置,特别涉及一种基于动态范围压缩的对比增强方法及其电子装置。The present invention provides a contrast enhancement method and an electronic device thereof, in particular to a contrast enhancement method based on dynamic range compression and an electronic device thereof.

背景技术Background technique

高动态范围(如32位元)影像能够捕捉如真实场景一般的影像,因为它能够大量保留真实场景中的亮度、对比度、影像细节等等信息。而一般显示器能够显示的动态范围例如是0~255(即8位元)。为了让一般显示器可以呈现高动态范围影像,高动态范围影像会通过一种压缩方式并搭配合适的影像对比增强,以贴近人类视觉的感受。High dynamic range (eg 32-bit) images can capture images that look like real scenes, because they retain a lot of the brightness, contrast, image details, and so on of the real scene. The dynamic range that a general display can display is, for example, 0 to 255 (ie, 8 bits). In order to allow general monitors to present high dynamic range images, high dynamic range images are enhanced by a compression method and appropriate image contrast to be close to the perception of human vision.

影像对比增强主要可以分为全域性(global)对比增强及区域性(local)对比增强。全域性对比增强(如伽马(Gamma)校正或直方图均衡化)是估算一条具有动态范围压缩的全域性曲线,并对影像进行映射。虽然全域性对比增强可以对影像快速进行处理,但此类方法会对过亮像素过度压缩或对过暗像素过度放大,这样的缺点往往会损失结果影像的对比度。区域性对比增强(如适应性直方图均衡化、曝光与遮光技术(Dodging-and-Burning))是根据每个像素及其邻近像素的关系来产生非线性曲线条,以调整每个像素。虽然区域性对比增强可以产生较佳的影像对比度,但此类方法的计算复杂度非常高。Image contrast enhancement can be divided into global (global) contrast enhancement and regional (local) contrast enhancement. Global contrast enhancement (such as gamma correction or histogram equalization) is to estimate a global curve with dynamic range compression and map the image. Although global contrast enhancement can process images quickly, such methods can over-compress too bright pixels or over-amplify too dark pixels, which often loses the contrast of the resulting image. Regional contrast enhancement (such as adaptive histogram equalization, exposure and shading techniques (Dodging-and-Burning)) is based on the relationship between each pixel and its neighbors to generate a nonlinear curve to adjust each pixel. Although regional contrast enhancement can produce better image contrast, the computational complexity of such methods is very high.

因此,若可以结合上述全域性对比增强与区域性对比增强的优点,将可以降低计算复杂度且产生较佳的影像对比度。Therefore, if the advantages of the above-mentioned global contrast enhancement and regional contrast enhancement can be combined, the computational complexity can be reduced and better image contrast can be generated.

发明内容SUMMARY OF THE INVENTION

本发明提供了一种基于动态范围压缩的对比增强方法及其电子装置,其通过一输入影像中每个像素位置的输入亮度值的出现次数来决定合适的有效动态范围,并据此估算全域映射曲线(Global Mapping Curve),接着再根据输入影像中每个像素位置的区域特性来调整输入亮度值映射的输出亮度值,以适应性地提高输入影像的对比度。据此,本发明的对比增强方法及其电子装置可以降低计算复杂度且产生较佳的影像对比度。The present invention provides a contrast enhancement method based on dynamic range compression and an electronic device thereof, which determine an appropriate effective dynamic range by the number of occurrences of the input luminance value of each pixel position in an input image, and estimate the global map accordingly. Curve (Global Mapping Curve), and then adjust the output brightness value of the input brightness value mapping according to the regional characteristics of each pixel position in the input image, so as to adaptively improve the contrast of the input image. Accordingly, the contrast enhancement method and the electronic device thereof of the present invention can reduce computational complexity and generate better image contrast.

本发明实施例提供一种基于动态范围压缩的对比增强方法,适用于一电子装置,且用以调整一输入影像中的每一个像素位置的一输入亮度,以增强输入影像的对比度。对比增强方法包括如下步骤:(A)接收输入影像中的每一个输入亮度;(B)将每一个输入亮度值的一出现次数对应到一直方图上的多个亮度值,将这些出现次数进行平滑滤波,且根据平滑化的这些出现次数决定一有效动态范围;(C)按序累加有效动态范围中平滑化的每一个出现次数,以产生一累加曲线,其中累加曲线代表这些亮度值与累加后的这些出现次数的关系;(D)将累加后的这些出现次数正规化至有效动态范围以产生一输出亮度值,且这些亮度值与每一个亮度值对应的输出亮度值形成一全域映射曲线;(E)于全域映射曲线中,按序根据每一个像素位置的输入亮度值获取对应的输出亮度值;以及(F)于每一个像素位置中,根据对应的输出亮度值与邻近的这些输出亮度值之间的一亮度关系调整对应的输出亮度值,以产生一最后亮度值。Embodiments of the present invention provide a contrast enhancement method based on dynamic range compression, which is suitable for an electronic device and used to adjust an input brightness of each pixel position in an input image to enhance the contrast of the input image. The contrast enhancement method includes the following steps: (A) receiving each input brightness in the input image; (B) corresponding an occurrence number of each input brightness value to a plurality of brightness values on the histogram, and performing these occurrence times to Smooth filtering, and determine an effective dynamic range according to the occurrences of smoothing; (C) sequentially accumulating each occurrence of smoothing in the effective dynamic range to generate an accumulation curve, wherein the accumulation curve represents the brightness values and the accumulation (D) normalize the accumulated occurrence times to the effective dynamic range to generate an output luminance value, and these luminance values and the output luminance value corresponding to each luminance value form a global mapping curve (E) in the global mapping curve, obtain the corresponding output luminance value according to the input luminance value of each pixel position in sequence; and (F) in each pixel position, according to the corresponding output luminance value and adjacent these outputs A brightness relationship between the brightness values adjusts the corresponding output brightness value to generate a final brightness value.

本发明实施例提供一种基于动态范围压缩的电子装置,用以调整一输入影像中的每一个像素位置的一输入亮度,以增强该输入影像的对比度。电子装置包括一影像获取装置与影像处理器。影像获取装置接收输入影像,并按序获取输入影像中的每一个输入亮度。影像处理器电连接影像获取装置,且用以执行下列步骤:(A)接收输入影像中的每一个输入亮度值;(B)将每一个输入亮度的一出现次数对应到一直方图上的多个亮度值,将这些出现次数进行平滑滤波,且根据平滑化的这些出现次数决定一有效动态范围;(C)按序累加有效动态范围中平滑化的每一个出现次数,以产生一累加曲线,其中累加曲线代表这些亮度值与累加后的这些出现次数的关系;(D)将累加后的这些出现次数正规化至有效动态范围以产生一输出亮度值,且这些亮度值与每一个亮度值对应的输出亮度值形成一全域映射曲线;(E)于全域映射曲线中,按序根据每一个像素位置的输入亮度值获取对应的输出亮度值;以及(F)于每一个像素位置中,根据对应的输出亮度值与邻近的这些输出亮度值之间的一亮度关系调整对应的输出亮度值,以产生一最后亮度值。Embodiments of the present invention provide an electronic device based on dynamic range compression for adjusting an input brightness of each pixel position in an input image to enhance the contrast of the input image. The electronic device includes an image acquisition device and an image processor. The image acquisition device receives the input image, and sequentially acquires each input brightness in the input image. The image processor is electrically connected to the image acquisition device, and is used for performing the following steps: (A) receiving each input luminance value in the input image; (B) corresponding to a number of occurrences of each input luminance to multiple values on the histogram A luminance value is obtained, these occurrences are smoothed and filtered, and an effective dynamic range is determined according to the smoothed occurrences; (C) each smoothed occurrence in the effective dynamic range is sequentially accumulated to generate an accumulation curve, The accumulation curve represents the relationship between these brightness values and the accumulated occurrences; (D) normalize the accumulated occurrences to an effective dynamic range to generate an output brightness value, and these brightness values correspond to each brightness value (E) in the global mapping curve, obtain the corresponding output luminance value according to the input luminance value of each pixel position in sequence; and (F) in each pixel position, according to the corresponding A brightness relationship between the output brightness value of and the adjacent output brightness values adjusts the corresponding output brightness value to generate a final brightness value.

为使能更进一步了解本发明的特征及技术内容,请参阅以下有关本发明的详细说明与附图,但是这些说明与附图仅是用来说明本发明,而非对本发明的权利要求作任何的限制。In order to further understand the features and technical content of the present invention, please refer to the following detailed descriptions and drawings related to the present invention, but these descriptions and drawings are only used to illustrate the present invention, rather than make any claims of the present invention. limits.

附图说明Description of drawings

图1是本发明一实施例的基于动态范围压缩的电子装置的示意图。FIG. 1 is a schematic diagram of an electronic device based on dynamic range compression according to an embodiment of the present invention.

图2是本发明一实施例的基于动态范围压缩的对比增强方法的流程图。FIG. 2 is a flowchart of a contrast enhancement method based on dynamic range compression according to an embodiment of the present invention.

图2A是图2的步骤S230的细节流程图。FIG. 2A is a detailed flowchart of step S230 of FIG. 2 .

图2B是图2的步骤S270的细节流程图。FIG. 2B is a detailed flowchart of step S270 of FIG. 2 .

图3是本发明一实施例的输入影像的直方图。FIG. 3 is a histogram of an input image according to an embodiment of the present invention.

图4是图3的平滑化的直方图。FIG. 4 is a smoothed histogram of FIG. 3 .

图5是本发明一实施例的累加曲线的示意图。FIG. 5 is a schematic diagram of an accumulation curve according to an embodiment of the present invention.

图6是本发明一实施例的全域映射曲线的示意图。FIG. 6 is a schematic diagram of a global mapping curve according to an embodiment of the present invention.

图7是本发明一实施例的目前像素位置的输出亮度值与邻近的输出亮度值的示意图。FIG. 7 is a schematic diagram of an output luminance value of a current pixel position and an adjacent output luminance value according to an embodiment of the present invention.

图8是本发明一实施例的调整目前像素位置的输出亮度值的示意图。FIG. 8 is a schematic diagram of adjusting the output luminance value of the current pixel position according to an embodiment of the present invention.

图9是本发明另一实施例的调整目前像素位置的输出亮度值的示意图。FIG. 9 is a schematic diagram of adjusting the output luminance value of the current pixel position according to another embodiment of the present invention.

图10是本发明另一实施例的调整目前像素位置的输出亮度值的示意图。FIG. 10 is a schematic diagram of adjusting the output luminance value of the current pixel position according to another embodiment of the present invention.

符号说明Symbol Description

100:电子装置100: Electronics

110:影像获取装置110: Image acquisition device

120:影像处理器120: Image processor

Fr、Fr1:输入影像Fr, Fr1: Input image

P0-Pn:输入亮度值P0-Pn: Input brightness value

P0’-Pn’:最后亮度值P0'-Pn': last brightness value

S210、S220、S230、S240、S250、S260、S270:步骤S210, S220, S230, S240, S250, S260, S270: Steps

S231、S233、S235、S237、S238、S239:步骤S231, S233, S235, S237, S238, S239: Steps

S271、S273:步骤S271, S273: Steps

L0:第一个亮度值L0: The first luminance value

L1:第一有效亮度值L1: The first effective luminance value

L2:第二有效亮度值L2: Second effective luminance value

DR1:第一范围DR1: first range

DR2:第二范围DR2: Second range

Deff:有效动态范围Deff: effective dynamic range

Cuv:累加曲线Cuv: cumulative curve

F1、F2、F3:像素组F1, F2, F3: Pixel groups

P22、P47、P102:像素位置P22, P47, P102: Pixel position

具体实施方式Detailed ways

在下文中,将通过附图说明本发明的各种例示实施例来详细描述本发明。然而,本发明概念可能以许多不同形式来实现,且不应解释为限于本文中所阐述的例示性实施例。此外,附图中相同参考数字可用以表示类似的元件。Hereinafter, the present invention will be described in detail by illustrating various exemplary embodiments of the invention by means of the accompanying drawings. However, the inventive concepts may be embodied in many different forms and should not be construed as limited to the exemplary embodiments set forth herein. Furthermore, the same reference numbers may be used in the figures to refer to similar elements.

首先,请参考图1,其显示本发明一实施例的基于动态范围压缩的电子装置的示意图。如图1所示,电子装置100为用来调整一输入影像Fr中的每一个像素位置的输入亮度值P0-Pn,以增强输入影像Fr的对比度,并输出调整后的最后亮度值P0’-Pn’。在本实施例中,电子装置100可为智能手机、录影机、平板电脑、笔记本电脑或其他需要执行影像对比增强的装置,本发明对此不作限制。First, please refer to FIG. 1 , which shows a schematic diagram of an electronic device based on dynamic range compression according to an embodiment of the present invention. As shown in FIG. 1 , the electronic device 100 is used to adjust the input luminance values P0-Pn of each pixel position in an input image Fr, so as to enhance the contrast of the input image Fr, and output the adjusted final luminance values P0'-Pn. Pn'. In this embodiment, the electronic device 100 may be a smart phone, a video recorder, a tablet computer, a notebook computer, or other devices that need to perform image contrast enhancement, which is not limited in the present invention.

电子装置100包括一影像获取装置110与一影像处理器120。如图1所示,影像获取装置110接收输入影像Fr,并按序获取输入影像Fr中的每一个输入亮度值P0-Pn。更进一步来说,影像获取装置110为获取连续影像,且输入影像Fr为连续影像中的其中一张。而输入影像Fr中的每一个像素位置分别具有输入亮度值P0-Pn。The electronic device 100 includes an image acquisition device 110 and an image processor 120 . As shown in FIG. 1 , the image acquisition device 110 receives the input image Fr, and sequentially acquires each input luminance value P0-Pn in the input image Fr. More specifically, the image acquisition device 110 acquires continuous images, and the input image Fr is one of the continuous images. And each pixel position in the input image Fr has input luminance values P0-Pn respectively.

影像处理器120电连接影像获取装置110,且用以执行下列步骤,以调整输入影像Fr中的每一个像素位置的输入亮度值P0-Pn,进而增强输入影像Fr的对比度。The image processor 120 is electrically connected to the image acquisition device 110, and is used for executing the following steps to adjust the input luminance values P0-Pn of each pixel position in the input image Fr, thereby enhancing the contrast of the input image Fr.

请同时参考图1至图2。图2显示本发明一实施例的基于动态范围压缩的对比增强方法的流程图。首先,影像处理器120接收输入影像Fr中每个像素位置的输入亮度值P0-Pn,以进一步分析输入影像Fr中每一个输入亮度值P0-Pn的特征(步骤S210)。Please also refer to Figure 1 to Figure 2. FIG. 2 shows a flowchart of a contrast enhancement method based on dynamic range compression according to an embodiment of the present invention. First, the image processor 120 receives the input luminance values P0-Pn of each pixel position in the input image Fr to further analyze the characteristics of each input luminance value P0-Pn in the input image Fr (step S210).

接着,影像处理器120将每一个输入亮度值P0-Pn的一出现次数对应到一直方图上的多个亮度值(步骤S220)。如图3所示,直方图Histogram的亮度值的动态范围为9位元(bit,比特),即亮度值0-511。因此,影像处理器120将输入影像Fr中的每个输入亮度值P0-Pn的出现次数H(n)统计到直方图Histogram的亮度值上。在本实施例中,亮度值0的出现次数为10次(以H(0)=10表示)。而在其他亮度值1-511中,H(1)=15;H(2)=12;H(3)=8;H(4)=15;H(5)-H(10)=10;H(11)-H(248)=0;H(249)=10;H(250)=10;H(251)=5;H(252)=0;H(253)=1;H(254)=0;H(255)=1;H(256)=1;H(257)=0;H(258)=1;H(259)=1;以及H(260)-H(511)=0。而直方图Histogram的亮度值的动态范围亦可依照实际状况来做设计,本发明对此不作限制。Next, the image processor 120 corresponds an occurrence of each input luminance value P0-Pn to a plurality of luminance values on the histogram (step S220). As shown in FIG. 3 , the dynamic range of the luminance value of the histogram is 9 bits (bit, bit), that is, the luminance value is 0-511. Therefore, the image processor 120 counts the number of occurrences H(n) of each input luminance value P0-Pn in the input image Fr to the luminance value of the histogram. In this embodiment, the number of occurrences of the luminance value 0 is 10 times (represented by H(0)=10). In other luminance values 1-511, H(1)=15; H(2)=12; H(3)=8; H(4)=15; H(5)-H(10)=10; H(11)-H(248)=0; H(249)=10; H(250)=10; H(251)=5; H(252)=0; H(253)=1; H(254) )=0; H(255)=1; H(256)=1; H(257)=0; H(258)=1; H(259)=1; and H(260)-H(511)= 0. The dynamic range of the luminance value of the histogram can also be designed according to the actual situation, which is not limited in the present invention.

在取得直方图Histogram后,影像处理器120将这些出现次数进行平滑滤波,且根据平滑化的这些出现次数来决定一有效动态范围(步骤S230)。值得注意的是,若有效动态范围取得太小,会使得输入影像Fr较亮的地方在输出结果图上呈现过曝;反之,若有效动态范围取得太大,会使得输入影像Fr较暗的地方在输出结果图上呈现过暗。因此,适当的有效动态范围会得到较佳的输出结果图。After obtaining the histogram, the image processor 120 performs smooth filtering on the occurrences, and determines an effective dynamic range according to the smoothed occurrences (step S230 ). It is worth noting that if the effective dynamic range is too small, the brighter parts of the input image Fr will be overexposed on the output image; on the contrary, if the effective dynamic range is too large, the darker parts of the input image Fr will appear. Too dark on the output graph. Therefore, an appropriate effective dynamic range will result in a better output result map.

更进一步来说,请同时参考图2A,影像处理器120将在直方图Histogram中,由最后一个亮度值往前搜索第一个有出现次数的亮度值作为一第一有效亮度值,并将第一个亮度值至第一有效亮度值作为一第一范围(步骤S231)。以图3为例,影像处理器120由最后一个亮度值511往前搜索第一个有出现次数的亮度值259,并将亮度值259作为第一有效亮度值L1。影像处理器120接着将第一个亮度值L0至第一有效亮度值L1作为一第一范围DR1。Further, referring to FIG. 2A at the same time, the image processor 120 searches the histogram from the last luminance value forward to the first luminance value with the number of occurrences as a first effective luminance value, and uses the first luminance value as a first effective luminance value. One luminance value to the first effective luminance value is used as a first range (step S231). Taking FIG. 3 as an example, the image processor 120 searches forward from the last luminance value 511 for the first luminance value 259 that has the number of occurrences, and takes the luminance value 259 as the first effective luminance value L1 . The image processor 120 then uses the first luminance value L0 to the first effective luminance value L1 as a first range DR1.

再来,于第一范围中,影像处理器120将对应的这些出现次数进行平滑滤波,以产生一平滑化的直方图(步骤S233)。在本实施例中,如图3所示,影像处理器120利用线性滤波器(linear filter)来对第一范围DR1中的这些出现次数H(0)-H(259)进行平滑滤波以产生平滑化的出现次数H’(n),且亦可利用其他方式来对这些出现次数H(0)-H(259)进行滤波以产生图4所示的平滑化的直方图Histogram1,本发明对此不作限制。Next, in the first range, the image processor 120 performs smooth filtering on the corresponding occurrence times to generate a smoothed histogram (step S233 ). In this embodiment, as shown in FIG. 3 , the image processor 120 uses a linear filter to perform smooth filtering on the occurrence times H(0)-H(259) in the first range DR1 to generate smoothing The smoothed occurrence times H'(n), and other methods can also be used to filter these occurrence times H(0)-H(259) to generate the smoothed histogram Histogram1 shown in FIG. No restrictions apply.

请同时参考图4,承接上述例子,影像处理器120将根据亮度值的顺序来平均相邻的出现次数。因此,平滑化的出现次数H’(0)=(10+15)/2=13且H’(1)=(10+15+12)/3=12。而其他平滑化的出现次数H’(2)-H’(510)的计算方式大致上与H’(1)的计算方式相同,H’(511)的计算方式大致上与H’(0)的计算方式相同,且计算结果如图4所示,故在此不再赘述。当然,目前亮度值前后N个(N为正整数)亮度值亦可视为目前亮度值相邻的出现次数,本发明对此不作限制。Please also refer to FIG. 4 , following the above example, the image processor 120 averages the number of adjacent occurrences according to the order of the luminance values. Therefore, the number of occurrences of smoothing is H'(0)=(10+15)/2=13 and H'(1)=(10+15+12)/3=12. The calculation method of other smoothed occurrences H'(2)-H'(510) is roughly the same as that of H'(1), and the calculation method of H'(511) is roughly the same as that of H'(0) The calculation method is the same, and the calculation result is shown in Figure 4, so it is not repeated here. Of course, N (N is a positive integer) luminance values before and after the current luminance value can also be regarded as the number of occurrences of adjacent current luminance values, which is not limited in the present invention.

由图3的直方图Histogram与图4的平滑化的直方图Histogram1可知,影像处理器120可通过平滑滤波方式来消除杂讯所造成的统计量,即直方图Histogram的亮度值253、255、256、258与259映射的出现次数H(253)、H(255)、H(256)、H(258)与H(259)是杂讯。It can be seen from the histogram Histogram in FIG. 3 and the smoothed histogram Histogram1 in FIG. 4 that the image processor 120 can eliminate the statistics caused by noise through smoothing filtering, that is, the luminance values 253, 255, 256 of the histogram. The occurrences H(253), H(255), H(256), H(258) and H(259) of the , 258 and 259 mappings are noise.

接着,在步骤S233后,影像处理器120将于平滑化的直方图中,由第一有效亮度值往前搜索第一个有出现次数的亮度值作为一第二有效亮度值,并将第一个亮度值至第二有效亮度值作为一第二范围(步骤S235)。承接上述例子并请参考图4,影像处理器120于平滑化的直方图Histogram1中,由第一有效亮度值L1往前搜索第一个有出现次数的亮度值252作为第二有效亮度值L2。影像处理器120接着将第一个亮度值L0至第二有效亮度值L2作为第二范围DR2。Next, after step S233, the image processor 120 searches the smoothed histogram forward from the first effective luminance value for the first luminance value with the number of occurrences as a second effective luminance value, and uses the first effective luminance value as a second effective luminance value. The first luminance value to the second effective luminance value is used as a second range (step S235). Continuing the above example and referring to FIG. 4 , the image processor 120 searches the smoothed histogram Histogram1 from the first effective luminance value L1 forward to search for the first luminance value 252 with the number of occurrences as the second effective luminance value L2 . The image processor 120 then uses the first luminance value L0 to the second effective luminance value L2 as the second range DR2.

在步骤S235后,影像处理器120将在第二范围DR2中进一步判断第二有效亮度值L2是否小于等于一预设亮度值(步骤S237)。若第二有效亮度值L2小于等于预设亮度值,表示预设亮度值可以涵盖第二范围DR2中所有的亮度值。此时,影像处理器120将第一个亮度值L0至预设亮度值作为有效动态范围(步骤S238)。After step S235, the image processor 120 will further determine in the second range DR2 whether the second effective luminance value L2 is less than or equal to a predetermined luminance value (step S237). If the second effective brightness value L2 is less than or equal to the preset brightness value, it means that the preset brightness value can cover all the brightness values in the second range DR2. At this time, the image processor 120 uses the first luminance value L0 to the preset luminance value as the effective dynamic range (step S238 ).

反之,若第二有效亮度值L2大于预设亮度值,表示预设亮度不足以涵盖第二范围DR2中所有的亮度值。此时,影像处理器120将第一个亮度值L0至第二有效亮度值作为有效动态范围(步骤S239)。值得注意的是,预设亮度值可依照第二范围DR2的分辨率、输入亮度值P0-Pn的分辨率或其他关联于平滑化的直方图Histogram1的亮度值来设定,本发明对此不作限制。Conversely, if the second effective luminance value L2 is greater than the preset luminance value, it means that the preset luminance is insufficient to cover all the luminance values in the second range DR2. At this time, the image processor 120 uses the first luminance value L0 to the second effective luminance value as the effective dynamic range (step S239). It is worth noting that the preset luminance value can be set according to the resolution of the second range DR2, the resolution of the input luminance values P0-Pn, or other luminance values associated with the smoothed histogram Histogram1, which is not implemented in the present invention. limit.

在本实施例中,预设亮度值设定为255。因此,承接上述例子,影像处理器120将在第二范围DR2中判断出第二有效亮度值L2小于等于255。此时,影像处理器120将第一个亮度值L0至预设亮度值(即255)作为有效动态范围Deff。借此因此,影像处理器120可通过步骤S231至S239界定适当的有效动态范围,以进行后续处理。In this embodiment, the preset brightness value is set to 255. Therefore, following the above example, the image processor 120 will determine that the second effective luminance value L2 is less than or equal to 255 in the second range DR2. At this time, the image processor 120 uses the first luminance value L0 to the preset luminance value (ie, 255) as the effective dynamic range Deff. Therefore, the image processor 120 can define an appropriate effective dynamic range through steps S231 to S239 for subsequent processing.

再请回到图2,在决定有效动态范围(即步骤S230)后,影像处理器120将按序累加有效动态范围中平滑化的每一个出现次数,以产生一累加曲线。而累加曲线将代表这些亮度值与累加后的这些出现次数的关系(步骤S240)。承接上述例子,影像处理器120将按序累加如图4所示的有效动态范围Deff中,每一个亮度值0-255对应的平滑化的出现次数H’(0)-H’(255),以产生累加后的出现次数Had(n)。因此,累加后的出现次数Had(0)=13,Had(1)=13+12=25,Had(2)=13+12+12=37。而其他累加后的出现次数Had(3)-Had(255)的计算方式大致上与Had(1)的计算方式相同,且计算结果如图5的累加曲线Cuv所示,故在此不再赘述。Returning to FIG. 2 again, after determining the effective dynamic range (ie, step S230 ), the image processor 120 sequentially accumulates each occurrence of smoothing in the effective dynamic range to generate an accumulation curve. The accumulation curve will represent the relationship between these brightness values and the accumulated occurrence times (step S240). Following the above example, the image processor 120 sequentially accumulates the number of occurrences of smoothing H'(0)-H'(255) corresponding to each luminance value 0-255 in the effective dynamic range Deff shown in FIG. 4 , to produce the accumulated number of occurrences Had(n). Therefore, the accumulated number of occurrences Had(0)=13, Had(1)=13+12=25, and Had(2)=13+12+12=37. The calculation method of other accumulated occurrence times Had(3)-Had(255) is roughly the same as that of Had(1), and the calculation result is shown in the accumulated curve Cuv in Figure 5, so it is not repeated here. .

在步骤S240后,影像处理器120将累加后的这些出现次数正规化至有效动态范围以产生一输出亮度值,且这些亮度值与每一个亮度值对应的输出亮度值形成一全域映射曲线(步骤S250)。更进一步来说,影像处理器120将按序计算累加后的出现次数Had(n)与有效动态范围中的全部出现次数的比例关系,且分别将每一个比例关系乘上有效动态范围中的一最高亮度值,以产生输出亮度值Iout(n)。After step S240, the image processor 120 normalizes the accumulated occurrence times to the effective dynamic range to generate an output luminance value, and the luminance values and the output luminance value corresponding to each luminance value form a global mapping curve (step S240). S250). More specifically, the image processor 120 will sequentially calculate the proportional relationship between the accumulated number of occurrences Had(n) and all the number of occurrences in the effective dynamic range, and multiply each proportional relationship by a value in the effective dynamic range. The highest luminance value to generate the output luminance value Iout(n).

以图5的累加后的出现次数Had(0)=13为例作说明,有效动态范围Deff中的全部出现次数为147,且有效动态范围Deff中的最高亮度值为255。故累加后的出现次数Had(0)与全部出现次数的比例关系为(13/147)。输出亮度值Iout(0)为比例关系乘上最高亮度值=(13/147)*255=23。再以图5的累加后的出现次数Had(1)=25为例作说明,有效动态范围Deff中的全部出现次数为147,且有效动态范围Deff中的最高亮度值为255。故累加后的出现次数Had(1)与全部出现次数的比例关系为(25/147)。输出亮度值Iout(1)为比例关系乘上最高亮度值=(25/147)*255=43。Taking the accumulated number of occurrences Had(0)=13 in FIG. 5 as an example, the total number of occurrences in the effective dynamic range Deff is 147, and the highest luminance value in the effective dynamic range Deff is 255. Therefore, the proportional relationship between the accumulated number of occurrences Had(0) and the total number of occurrences is (13/147). The output luminance value Iout(0) is the proportional relationship multiplied by the highest luminance value=(13/147)*255=23. Taking the accumulated number of occurrences Had(1)=25 in FIG. 5 as an example, the total number of occurrences in the effective dynamic range Deff is 147, and the highest luminance value in the effective dynamic range Deff is 255. Therefore, the proportional relationship between the accumulated number of occurrences Had(1) and the total number of occurrences is (25/147). The output luminance value Iout(1) is the proportional relationship multiplied by the highest luminance value=(25/147)*255=43.

而其他输出亮度值Iout(2)-Iout(255)的计算方式大致上与Iout(1)的计算方式相同,且计算结果如图6的累加曲线Cuv所示,故在此不再赘述。据此,这些亮度值0-255与每一个亮度值0-255对应的输出亮度值Iout(0)-Iout(255)将形成全域映射曲线Cgb。The calculation method of other output luminance values Iout(2)-Iout(255) is roughly the same as that of Iout(1), and the calculation result is shown in the cumulative curve Cuv of FIG. Accordingly, these luminance values 0-255 and the output luminance values Iout(0)-Iout(255) corresponding to each luminance value 0-255 will form the global mapping curve Cgb.

在取得全域映射曲线后,接着,影像处理器120将按序根据每一个像素位置的输入亮度值获取对应的输出亮度值(步骤S260)。举例来说,请同时参考图6至图7,输入影像Fr1具有10*15个像素位置P0-P149,且每一个像素位置P0-P149具有一输入亮度值,如像素位置P22的输入亮度值为3,像素位置P47的输入亮度值为250,以及像素位置P102的输入亮度值为4。After obtaining the global mapping curve, the image processor 120 sequentially obtains the corresponding output luminance value according to the input luminance value of each pixel position (step S260 ). For example, please refer to FIG. 6 to FIG. 7 at the same time, the input image Fr1 has 10*15 pixel positions P0-P149, and each pixel position P0-P149 has an input luminance value, such as the input luminance value of the pixel position P22 3. The input luminance value of pixel position P47 is 250, and the input luminance value of pixel position P102 is 4.

因此,影像处理器120将像素位置P22的输入亮度值3对应到全域映射曲线Cgb中的亮度值3,且获取亮度值3对应的输出亮度值Iout(3)=85。影像处理器120将像素位置P47的输入亮度值250对应到全域映射曲线Cgb中的亮度值250,且获取亮度值250对应的输出亮度值Iout(250)=243。影像处理器120将像素位置P102的输入亮度值4对应到全域映射曲线Cgb中的亮度值4,且获取亮度值4对应的输出亮度值Iout(4)=104。而其他像素位置的输入亮度值同样以此方式找到对应的输出亮度值,故在此不再赘述。Therefore, the image processor 120 corresponds the input luminance value 3 of the pixel position P22 to the luminance value 3 in the global mapping curve Cgb, and obtains the output luminance value Iout(3)=85 corresponding to the luminance value 3 . The image processor 120 corresponds the input luminance value 250 at the pixel position P47 to the luminance value 250 in the global mapping curve Cgb, and obtains the output luminance value Iout(250)=243 corresponding to the luminance value 250. The image processor 120 corresponds the input luminance value 4 of the pixel position P102 to the luminance value 4 in the global mapping curve Cgb, and obtains the output luminance value Iout(4)=104 corresponding to the luminance value 4. The input luminance values of other pixel positions can also find the corresponding output luminance values in this way, so they will not be repeated here.

在步骤260后,影像处理器120将在每一个像素位置中,根据对应的输入亮度值与多个邻近输入亮度值之间的一亮度关系来调整对应的输出亮度值,以产生一最后亮度值(步骤S270)。更进一步来说,由于输入亮度值是由入射光(举例输入亮度值的低频部分)与反射光(举例输入亮度值的高频部分)合成,且在本实施例为输入亮度值=入射光*反射光。若影像处理器120可将低频部分移除,将可以针对高频部分来进行加强。After step 260, the image processor 120 adjusts the corresponding output luminance value at each pixel position according to a luminance relationship between the corresponding input luminance value and a plurality of adjacent input luminance values to generate a final luminance value (step S270). Furthermore, since the input luminance value is composed of incident light (eg, the low-frequency portion of the input luminance value) and reflected light (eg, the high-frequency portion of the input luminance value), and in this embodiment, the input luminance value=incident light* reflected light. If the image processor 120 can remove the low frequency part, it can enhance the high frequency part.

因此,请同时参考图2B,影像处理器120将根据对应的输入亮度值与邻近输入亮度值计算至少一高频像素比例,并将至少一高频像素比例作为亮度关系(步骤S271)。而至少一高频像素比例是关联于对应的像素位置的输入亮度值与至少一低频像素值。Therefore, please refer to FIG. 2B at the same time, the image processor 120 will calculate at least one high frequency pixel ratio according to the corresponding input luminance value and the adjacent input luminance value, and use the at least one high frequency pixel ratio as the luminance relationship (step S271 ). The at least one high frequency pixel ratio is associated with the input luminance value of the corresponding pixel position and the at least one low frequency pixel value.

在本实施例中,由于影响入射光的因素很多,故影像处理器120利用至少一个低频率波器来模拟影不同的入射光。因此,影像处理器120将根据对应的输入亮度值与邻近输入亮度值来计算至少一低频像素值,并计算对应的输入亮度值与至少一低频像素值的比例关系,以产生至少一高频像素比例。In this embodiment, since there are many factors affecting the incident light, the image processor 120 uses at least one low-frequency wave filter to simulate different incident light. Therefore, the image processor 120 will calculate at least one low-frequency pixel value according to the corresponding input luminance value and the adjacent input luminance value, and calculate the proportional relationship between the corresponding input luminance value and the at least one low-frequency pixel value, so as to generate at least one high-frequency pixel Proportion.

以图7的输入影像Fr1的像素位置P22以及影像处理器120通过具有3*3遮罩与5*5遮罩的平均滤波器计算两个低频像素值来作说明。像素位置P22的输入亮度值及其邻近输入亮度值组成像素组F1且表示于图8。影像处理器120将通过具有5*5遮罩的平均滤波器计算一低频像素值(即(1+2+3+4+5+1+2+3+4+5+1+2+3+4+5+1+2+3+4+5+1+2+3+4+5)/25=3)。接着,影像处理器120将计算对应的输入亮度值与低频像素值的比例关系以产生一高频像素比例(即3/3=1)。For illustration, the pixel position P22 of the input image Fr1 in FIG. 7 and the image processor 120 calculate two low-frequency pixel values through an averaging filter with a 3*3 mask and a 5*5 mask. The input luminance value of the pixel position P22 and its adjacent input luminance values form a pixel group F1 and are shown in FIG. 8 . The image processor 120 will calculate a low frequency pixel value (ie (1+2+3+4+5+1+2+3+4+5+1+2+3+ 4+5+1+2+3+4+5+1+2+3+4+5)/25=3). Next, the image processor 120 will calculate the ratio between the corresponding input luminance value and the low-frequency pixel value to generate a high-frequency pixel ratio (ie, 3/3=1).

类似地,影像处理器120将通过具有3*3遮罩的平均滤波器计算另一低频像素值(即(2+3+4+2+3+4+2+3+4)/9=3)。接着,影像处理器120将计算对应的输入亮度值与另一低频像素值的比例关系以产生另一高频像素比例(即3/3=1)。影像处理器120接着将上述两个高频像素比例相乘(即1*1=1)来作为亮度关系。Similarly, the image processor 120 will calculate another low frequency pixel value (ie (2+3+4+2+3+4+2+3+4)/9=3 through an averaging filter with a 3*3 mask ). Next, the image processor 120 will calculate the ratio between the corresponding input luminance value and another low-frequency pixel value to generate another high-frequency pixel ratio (ie, 3/3=1). The image processor 120 then multiplies the above two high-frequency pixel ratios (ie, 1*1=1) to obtain the luminance relationship.

在取得亮度关系(即步骤S271)后,影像处理器120将根据亮度关系调整对应的输出亮度值,以产生最后亮度值(步骤S273)。在本实施例中,最后亮度值=亮度关系*输出亮度值=1*3=3,以表示影像处理器120根据亮度关系(=1)调整对应的输出亮度值(=3)以产生最后亮度值(=3)。而当最后亮度值大于有效动态范围中的一最高亮度值(本实施例为255)时,影像处理器120将最高亮度值作为最后亮度值。当然影像处理器120亦可以其他计算方式与亮度关系来调整对应的输出亮度值以产生最后亮度值,本发明对此不作限制。After obtaining the luminance relationship (ie, step S271 ), the image processor 120 will adjust the corresponding output luminance value according to the luminance relationship to generate a final luminance value (step S273 ). In this embodiment, the last luminance value=luminance relation*output luminance value=1*3=3, which means that the image processor 120 adjusts the corresponding output luminance value (=3) according to the luminance relation (=1) to generate the final luminance value (=3). When the final luminance value is greater than a maximum luminance value in the effective dynamic range (255 in this embodiment), the image processor 120 takes the highest luminance value as the final luminance value. Of course, the image processor 120 can also adjust the corresponding output brightness value by other calculation methods and brightness relationship to generate the final brightness value, which is not limited in the present invention.

由上述可知,像素组F1中像素位置P22的输入亮度值与这些邻近输入亮度值差距很小(即平均分布)。因此,影像处理器120不需要调整输出亮度值,使得像素位置P22的最后亮度值等于输出亮度值。It can be seen from the above that the difference between the input luminance values of the pixel position P22 in the pixel group F1 and these adjacent input luminance values is very small (ie, evenly distributed). Therefore, the image processor 120 does not need to adjust the output luminance value so that the final luminance value of the pixel position P22 is equal to the output luminance value.

再以图7的输入影像Fr1的像素位置P47以及影像处理器120通过具有3*3遮罩与5*5遮罩的平均滤波器计算两个低频像素值来作说明。像素位置P47的输入亮度值及其邻近输入亮度值组成像素组F2且表示于图9。其中一个低频像素值=(6+6+7+8+8+6+6+250+7+8+6+6+250+10+7+9+9+250+10+10+9+9+10+10+10)/25=37.08,且对应的高频像素比例=250/37.08=6.74。另一个低频像素值=(6+250+7+6+250+10+9+250+10)/9=88.67,且对应的高频像素比例=250/88.67=2.82。而亮度关系=6.74*2.82=19。最后亮度值=亮度关系*输出亮度值=19*250=4752。而最后亮度值大于有效动态范围Deff中的一最高亮度值255,故影像处理器120将最高亮度值255作为最后亮度值。Next, the pixel position P47 of the input image Fr1 in FIG. 7 and the image processor 120 calculate two low-frequency pixel values through an averaging filter with a 3*3 mask and a 5*5 mask are used for illustration. The input luminance value of the pixel position P47 and its adjacent input luminance values form a pixel group F2 and are shown in FIG. 9 . One of the low frequency pixel value = (6+6+7+8+8+6+6+250+7+8+6+6+250+10+7+9+9+250+10+10+9+9 +10+10+10)/25=37.08, and the corresponding high frequency pixel ratio=250/37.08=6.74. Another low frequency pixel value=(6+250+7+6+250+10+9+250+10)/9=88.67, and the corresponding high frequency pixel ratio=250/88.67=2.82. And the luminance relation=6.74*2.82=19. Last luminance value=luminance relation*output luminance value=19*250=4752. The final luminance value is greater than a maximum luminance value of 255 in the effective dynamic range Deff, so the image processor 120 uses the highest luminance value of 255 as the final luminance value.

由上述可知,像素组F2中像素位置P47的输入亮度值与这些邻近输入亮度值差距很大,且像素位置P47的输入亮度值高于这些邻近输入亮度值。因此,影像处理器120将调亮输出亮度值,使得像素位置P47的最后亮度值与邻近输入亮度值差距更大,以更提高像素位置P47的对比度。It can be seen from the above that the input luminance value of the pixel position P47 in the pixel group F2 is very different from these adjacent input luminance values, and the input luminance value of the pixel position P47 is higher than these adjacent input luminance values. Therefore, the image processor 120 will brighten the output luminance value, so that the difference between the final luminance value of the pixel position P47 and the adjacent input luminance value is larger, so as to further improve the contrast ratio of the pixel position P47.

再以图7的输入影像Fr1的像素位置P102以及影像处理器120通过具有3*3遮罩与5*5遮罩的平均滤波器计算两个低频像素值来作说明。像素位置P102的输入亮度值及其邻近输入亮度值组成像素组F3且表示于图10。其中一个低频像素值=(249+249+249+249+249+249+249+249+249+249+1+4+4+4+1+250+250+250+250+250+251+251+251+253+255)/25=200.6,且对应的高频像素比例=4/200.6=0.02。另一个低频像素值=(249+249+249+4+4+4+250+250+250)/9=167.7,且对应的高频像素比例=4/167.7=0.02。而亮度关系=0.02*0.02=0。最后亮度值=亮度关系*输出亮度值=0*4=0。Next, the pixel position P102 of the input image Fr1 in FIG. 7 and the image processor 120 calculate two low-frequency pixel values through an averaging filter with a 3*3 mask and a 5*5 mask for illustration. The input luminance value of the pixel position P102 and its adjacent input luminance values form a pixel group F3 and are shown in FIG. 10 . One of the low frequency pixel value = (249+249+249+249+249+249+249+249+249+249+1+4+4+4+1+250+250+250+250+250+251+251 +251+253+255)/25=200.6, and the corresponding high frequency pixel ratio=4/200.6=0.02. Another low frequency pixel value=(249+249+249+4+4+4+250+250+250)/9=167.7, and the corresponding high frequency pixel ratio=4/167.7=0.02. And the luminance relation=0.02*0.02=0. Last luminance value=luminance relation*output luminance value=0*4=0.

由上述可知,像素组F3中像素位置P102的输入亮度值与这些邻近输入亮度值差距很大,且像素位置P102的输入亮度值低于这些邻近输入亮度值。因此,影像处理器120将调暗输出亮度值,使得像素位置P102的最后亮度值与邻近输入亮度值差距更大,以更提高像素位置P102的对比度。It can be seen from the above that the input luminance value of the pixel position P102 in the pixel group F3 is very different from these adjacent input luminance values, and the input luminance value of the pixel position P102 is lower than these adjacent input luminance values. Therefore, the image processor 120 dims the output luminance value, so that the difference between the final luminance value of the pixel position P102 and the adjacent input luminance value is larger, so as to further improve the contrast ratio of the pixel position P102.

因此,由上述输入影像Fr1的像素组F1至F3可知,当像素组中的输入亮度值差距很小(如像素组F1)时,代表目前像素位置(如像素位置P22)不是输入影像Fr1中的边缘部分,影像处理器120不会调整目前像素位置的输出亮度值,或根据差距的数值些微调整目前像素位置的输出亮度值。Therefore, from the pixel groups F1 to F3 of the above input image Fr1, it can be known that when the difference between the input luminance values in the pixel group is small (such as the pixel group F1), it means that the current pixel position (such as the pixel position P22) is not in the input image Fr1. In the edge portion, the image processor 120 does not adjust the output luminance value of the current pixel position, or slightly adjusts the output luminance value of the current pixel position according to the difference value.

而当像素组中的输入亮度值差距很大(如像素组F2与F3)时,代表目前像素位置(如像素位置P47与102)是输入影像Fr1中的边缘部分,影像处理器120将会根据差距的数值、目前输入亮度与邻近输入亮度值的数值大小来调整目前像素位置的输出亮度值。如上述像素位置P47的输入亮度值与邻近输入亮度值差距很大,且像素位置P47的输入亮度值高于这些邻近输入亮度。又例如上述像素位置P102的输入亮度值与邻近输入亮度值差距很大,且像素位置P102的输入亮度值低于这些邻近输入亮度。When the difference between the input luminance values in the pixel group is very large (such as the pixel groups F2 and F3), it means that the current pixel position (such as the pixel positions P47 and 102) is the edge part of the input image Fr1, and the image processor 120 will The value of the gap, the value of the current input brightness and the value of the adjacent input brightness value to adjust the output brightness value of the current pixel position. As mentioned above, the input luminance value of the pixel position P47 is very different from the adjacent input luminance values, and the input luminance value of the pixel position P47 is higher than these adjacent input luminances. For another example, the input luminance value of the above-mentioned pixel position P102 is very different from the adjacent input luminance values, and the input luminance value of the pixel position P102 is lower than these adjacent input luminances.

因此,影像处理器120可以根据目前像素位置的输入亮度值及其邻近输入亮度值之间的亮度关系来适应性地调整目前像素位置的输出亮度值,以据此产生最后亮度值。Therefore, the image processor 120 can adaptively adjust the output luminance value of the current pixel position according to the luminance relationship between the input luminance value of the current pixel position and its adjacent input luminance values, so as to generate the final luminance value accordingly.

综上所述,本发明实施例所提供的一种基于动态范围压缩的对比增强方法及其电子装置,其通过一输入影像中每个像素位置的输入亮度值的出现次数来决定合适的有效动态范围,并据此估算全域映射曲线(Global Mapping Curve),接着再根据输入影像中每个像素位置的区域特性来调整输入亮度值映射的输出亮度值,以适应性地提高输入影像的对比度。据此,本发明的对比增强方法及其电子装置可以降低计算复杂度且产生较佳的影像对比度。To sum up, the embodiments of the present invention provide a contrast enhancement method based on dynamic range compression and an electronic device thereof, which determine an appropriate effective dynamic range by the number of occurrences of the input luminance value of each pixel position in an input image. Then, according to the regional characteristics of each pixel position in the input image, the output luminance value of the input luminance value mapping is adjusted to adaptively improve the contrast of the input image. Accordingly, the contrast enhancement method and the electronic device thereof of the present invention can reduce computational complexity and generate better image contrast.

以上所述仅为本发明的实施例,其并非用以局限本发明的权利要求。The above descriptions are merely embodiments of the present invention, and are not intended to limit the claims of the present invention.

Claims (10)

1. A contrast enhancement method based on dynamic range compression is applicable to an electronic device and used for adjusting an input brightness value of each pixel position in an input image so as to enhance the contrast of the input image, and the contrast enhancement method comprises the following steps:
receiving each input brightness value in the input image;
corresponding the occurrence frequency of each input brightness value to a plurality of brightness values on a histogram, carrying out smooth filtering on the occurrence frequency, and determining an effective dynamic range according to the smoothed occurrence frequency;
Sequentially accumulating each of the smoothed occurrences in the effective dynamic range to generate an accumulation curve, wherein the accumulation curve represents a relationship between the luminance value and the accumulated occurrences;
normalizing the accumulated occurrence number to the effective dynamic range to generate an output brightness value, wherein the brightness value and the output brightness value corresponding to each brightness value form a global mapping curve;
in the global mapping curve, obtaining the corresponding output brightness value according to the input brightness value of each pixel position in sequence; and
in each of the pixel positions, the corresponding output luminance value is adjusted according to a luminance relationship between the corresponding input luminance value and a plurality of neighboring input luminance values to generate a final luminance value.
2. The contrast enhancement method based on dynamic range compression as claimed in claim 1, wherein the step of determining the effective dynamic range further comprises:
searching a first brightness value with occurrence times from the last brightness value in the histogram as a first effective brightness value, and taking the first brightness value to the first effective brightness value as a first range;
In the first range, smoothing and filtering the corresponding occurrence number to generate a smoothed histogram;
searching a first brightness value with occurrence times from the first effective brightness value to the second effective brightness value in the smoothed histogram as a second effective brightness value, and taking the first brightness value to the second effective brightness value as a second range; and
in the second range, determining whether the second effective brightness value is less than or equal to a predetermined brightness value, if the second effective brightness value is less than or equal to the predetermined brightness value, using the first brightness value to the predetermined brightness value as the effective dynamic range, and if the second effective brightness value is greater than the predetermined brightness value, using the first brightness value to the second effective brightness value as the effective dynamic range.
3. The dynamic range compression-based contrast enhancement method of claim 1, wherein the step of normalizing the accumulated number of occurrences to the effective dynamic range further comprises:
calculating the proportional relation between the accumulated occurrence times and all the occurrence times in the effective dynamic range in sequence; and
multiplying each of the proportional relations by a highest luminance value in the effective dynamic range to generate the output luminance value.
4. The method of claim 1, wherein the step of adjusting the corresponding output luminance value to generate the final luminance value in each pixel position further comprises:
calculating at least one high-frequency pixel proportion according to the corresponding input brightness value and the adjacent input brightness value, and taking the at least one high-frequency pixel proportion as the brightness relation, wherein the at least one high-frequency pixel proportion is associated with the input brightness value and at least one low-frequency pixel value of the corresponding pixel position; and
and adjusting the corresponding output brightness value according to the brightness relation to generate the final brightness value.
5. The contrast enhancement method according to claim 4, wherein the step of calculating the at least one high frequency pixel proportion corresponding to the pixel position further comprises:
calculating the at least one low-frequency pixel value according to the corresponding input brightness value and the adjacent input brightness value; and
calculating a proportional relationship between the corresponding input luminance value and the at least one low frequency pixel value to generate the at least one high frequency pixel proportion.
6. The contrast enhancement method according to claim 4, wherein the step of adjusting the corresponding output luminance value according to the luminance relationship further comprises:
Multiplying the corresponding output brightness value by the corresponding brightness relation to generate the final brightness value, and taking the maximum brightness value as the final brightness value when the final brightness value is larger than a maximum brightness value in the effective dynamic range.
7. An electronic device based on dynamic range compression for adjusting an input luminance value of each pixel position in an input image to enhance contrast of the input image, the electronic device comprising:
an image acquisition device for receiving the input image and sequentially acquiring each input brightness value in the input image; and
an image processor electrically connected to the image acquisition device for executing the following steps:
receiving each input brightness value in the input image;
corresponding the occurrence frequency of each input brightness value to a plurality of brightness values on a histogram, carrying out smooth filtering on the occurrence frequency, and determining an effective dynamic range according to the smoothed occurrence frequency;
sequentially accumulating each of the smoothed occurrences in the effective dynamic range to generate an accumulation curve, wherein the accumulation curve represents a relationship between the luminance value and the accumulated occurrences;
Normalizing the accumulated occurrence number to the effective dynamic range to generate an output brightness value, wherein the brightness value and the output brightness value corresponding to each brightness value form a global mapping curve;
in the global mapping curve, obtaining the corresponding output brightness value according to the input brightness value of each pixel position in sequence; and
in each of the pixel positions, the corresponding output luminance value is adjusted according to a luminance relationship between the corresponding input luminance value and a plurality of neighboring input luminance values to generate a final luminance value.
8. The electronic device according to claim 7, wherein in normalizing the accumulated occurrences, the image processor sequentially calculates a ratio of the accumulated occurrences to all occurrences in the effective dynamic range, and multiplies a highest luminance value in the effective dynamic range by each ratio to generate the output luminance value.
9. The electronic device of claim 7, wherein when adjusting the corresponding output luminance value to generate the final luminance value in each of the pixel positions, the image processor calculates at least one high frequency pixel ratio according to the corresponding input luminance value and the neighboring input luminance value, uses the at least one high frequency pixel ratio as the luminance relationship, and adjusts the corresponding output luminance value according to the luminance relationship to generate the final luminance value, wherein the at least one high frequency pixel ratio is associated with the input luminance value and at least one low frequency pixel value of the corresponding pixel position.
10. The electronic device of claim 9, wherein the image processor calculates the at least one low-frequency pixel value according to the corresponding input luminance value and the neighboring input luminance value, calculates a ratio of the corresponding input luminance value and the at least one low-frequency pixel value to generate the at least one high-frequency pixel ratio as the luminance relationship, and multiplies the corresponding output luminance value by the luminance relationship to generate the final luminance value, wherein the image processor uses the highest luminance value as the final luminance value when the final luminance value is greater than a highest luminance value in the effective dynamic range.
CN201810758240.6A 2018-07-11 2018-07-11 Contrast enhancement method based on dynamic range compression and electronic device thereof Active CN110717862B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810758240.6A CN110717862B (en) 2018-07-11 2018-07-11 Contrast enhancement method based on dynamic range compression and electronic device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810758240.6A CN110717862B (en) 2018-07-11 2018-07-11 Contrast enhancement method based on dynamic range compression and electronic device thereof

Publications (2)

Publication Number Publication Date
CN110717862A CN110717862A (en) 2020-01-21
CN110717862B true CN110717862B (en) 2022-07-19

Family

ID=69209008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810758240.6A Active CN110717862B (en) 2018-07-11 2018-07-11 Contrast enhancement method based on dynamic range compression and electronic device thereof

Country Status (1)

Country Link
CN (1) CN110717862B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101766032A (en) * 2007-09-14 2010-06-30 株式会社理光 Image forming apparatus and image forming method
CN102257531A (en) * 2008-12-19 2011-11-23 高通股份有限公司 High dynamic range image combining
CN104408752A (en) * 2014-12-11 2015-03-11 西安电子科技大学 High dynamic range image compression method based on mixed tone mapping algorithm
CN107240092A (en) * 2017-05-05 2017-10-10 浙江大华技术股份有限公司 A kind of image blur detection method and device
CN107305685A (en) * 2016-04-20 2017-10-31 瑞昱半导体股份有限公司 Image contrast enhancement method and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7738698B2 (en) * 2006-01-26 2010-06-15 Vestel Elektronik Sanayi Ve Ticaret A.S. Method and apparatus for adjusting the contrast of an image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101766032A (en) * 2007-09-14 2010-06-30 株式会社理光 Image forming apparatus and image forming method
CN102257531A (en) * 2008-12-19 2011-11-23 高通股份有限公司 High dynamic range image combining
CN104408752A (en) * 2014-12-11 2015-03-11 西安电子科技大学 High dynamic range image compression method based on mixed tone mapping algorithm
CN107305685A (en) * 2016-04-20 2017-10-31 瑞昱半导体股份有限公司 Image contrast enhancement method and apparatus
CN107240092A (en) * 2017-05-05 2017-10-10 浙江大华技术股份有限公司 A kind of image blur detection method and device

Also Published As

Publication number Publication date
CN110717862A (en) 2020-01-21

Similar Documents

Publication Publication Date Title
CN107680056B (en) Image processing method and device
US9230304B2 (en) Apparatus and method for enhancing image using color channel
US20140254928A1 (en) Method and image processing device for image dynamic range compression with local contrast enhancement
JP6097588B2 (en) Image processing apparatus and image processing method
US9396526B2 (en) Method for improving image quality
CN104240194A (en) Low-light-level image enhancement algorithm based on parabolic function
CN103218778A (en) Image and video processing method and device
KR101499461B1 (en) Histogram equalization apparatus using histogram compression
CN107993189B (en) Image tone dynamic adjustment method and device based on local blocking
CN105825489B (en) The infrared image enhancing method being combined with linear stretch is translated based on gray scale
KR101113483B1 (en) Apparatus for enhancing visibility of color image
CN107918928B (en) A color restoration method
US20170094242A1 (en) Image processing apparatus, image processing method, and storage medium
JP5648849B2 (en) Image processing apparatus and image processing method
WO2016051716A1 (en) Image processing method, image processing device, and recording medium for storing image processing program
US20130287299A1 (en) Image processing apparatus
CN110766622A (en) Underwater image enhancement method based on brightness discrimination and Gamma smoothing
KR101516632B1 (en) Bipartite histogram equalization apparatus maintain the rate of mean brightness of video using visual threshold
US10922796B2 (en) Method of presenting wide dynamic range images and a system employing same
US20120106842A1 (en) Method for image enhancement based on histogram modification and specification
CN110717862B (en) Contrast enhancement method based on dynamic range compression and electronic device thereof
CN108305234A (en) A kind of Double-histogram equalization methods based on optimal model
CN107451971A (en) The blind convolved image restoring method of low-light (level) of priori is combined based on dark and Gauss
Jang et al. Adaptive contrast enhancement using edge-based lighting condition estimation
US9210335B2 (en) Method for generating HDR images using modified weight

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant