TWI676962B - Contrast enhancement method and apparatus thereof based on histogram adjustment - Google Patents

Contrast enhancement method and apparatus thereof based on histogram adjustment Download PDF

Info

Publication number
TWI676962B
TWI676962B TW107100653A TW107100653A TWI676962B TW I676962 B TWI676962 B TW I676962B TW 107100653 A TW107100653 A TW 107100653A TW 107100653 A TW107100653 A TW 107100653A TW I676962 B TWI676962 B TW I676962B
Authority
TW
Taiwan
Prior art keywords
brightness
value
occurrences
brightness value
values
Prior art date
Application number
TW107100653A
Other languages
Chinese (zh)
Other versions
TW201931302A (en
Inventor
周暘庭
Yang Ting Chou
姜昊天
Hao Tien Chiang
李宗軒
Tsung Hsuan Li
陳世澤
Shih Tse Chen
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 瑞昱半導體股份有限公司
Priority to TW107100653A priority Critical patent/TWI676962B/en
Publication of TW201931302A publication Critical patent/TW201931302A/en
Application granted granted Critical
Publication of TWI676962B publication Critical patent/TWI676962B/en

Links

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

本發明提供一種基於直方圖調整的對比增強方法及其裝置。對比增強裝置包括一影像擷取器與一影像處理器。影像擷取器依序擷取一輸入影像中每個像素位置的一輸入亮度值。影像處理器增強直方圖中的暗部區域(即較低亮度部分)對應的出現次數,接著再根據直方圖中的一臨界亮度進行一全域映射,以調高暗部區域的亮度並維持亮部區域(即較高亮度部分)的亮度,並據此產生亮度輸出值。藉此,對比增強方法及其裝置可以避免產生習知的光暈現象,且可以在不影響亮部區域亮度的情況下調整暗部區域的亮度,進而實現較佳的對比增強。 The invention provides a contrast enhancement method and device based on histogram adjustment. The contrast enhancement device includes an image capturer and an image processor. The image capturer sequentially captures an input brightness value at each pixel position in an input image. The image processor enhances the number of occurrences of the dark areas (that is, the lower brightness parts) in the histogram, and then performs a global mapping according to a critical brightness in the histogram to increase the brightness of the dark areas and maintain the bright areas ( That is, the brightness of the higher brightness part), and a brightness output value is generated accordingly. In this way, the contrast enhancement method and its device can avoid the occurrence of the conventional halo phenomenon, and can adjust the brightness of the dark area without affecting the brightness of the bright area, thereby achieving better contrast enhancement.

Description

基於直方圖調整的對比增強方法及其裝置 Contrast enhancement method and device based on histogram adjustment

本發明提供一種對比增強方法及其裝置,特別是關於一種基於直方圖調整的對比增強方法及其裝置。 The invention provides a contrast enhancement method and a device thereof, and in particular, relates to a contrast enhancement method and a device based on histogram adjustment.

高對比的影像往往會使其影像背光處偏暗。若要將暗部區域(即較低亮度部分)拉亮,且同時不影響亮部區域(即較高亮度部分)細節,一般是利用習知的寬動態範圍方法來提升影像的暗部區域。這類方法皆以各種不同曝光程度幀(frame)來合成一張亮度最為恰當的影像,以提高暗部區域的亮度。然而,寬動態範圍方法非常仰賴影像物體的分割。若無法準確地將暗部區域的物體與亮部區域的物體分割開來,整張影像會產生光暈現象(Smear Effect),也就是在影像中的物體邊界上參考錯誤曝光程度。 High-contrast images tend to dim their backlights. If you want to brighten the dark areas (that is, the lower brightness parts) without affecting the details of the bright areas (that is, the higher brightness parts), the conventional wide dynamic range method is generally used to enhance the dark areas of the image. These methods all use a variety of frames with different exposure levels to synthesize an image with the most appropriate brightness to increase the brightness of dark areas. However, the WDR method relies heavily on the segmentation of image objects. If the objects in the dark area cannot be accurately separated from the objects in the bright area, the entire image will have a smear effect, which refers to the extent of incorrect exposure on the boundary of the object in the image.

此外,習知直方圖均化(Histogram Equalization)也常用來處理影像的全域對比度,利用整體亮度的重新分配,求出一條全域曲線,把過暗或過亮的影像區域調整到視覺可見的狀況且不會有光暈現象產生,進而達到全域對比度的提升。然而,習知直方圖均化並無法特別針對暗部區域進行處理,也就是說,當影像原本的對比度已經很高,經過習知直方圖均化後,影像不會有任何改變,且暗部區域也不會有任何的提升。 In addition, the conventional histogram equalization (Histogram Equalization) is also commonly used to process the global contrast of the image, using the redistribution of the overall brightness to find a global curve, adjusting the too dark or too bright image area to a visually visible condition There will be no halo phenomenon, and the global contrast can be improved. However, the conventional histogram equalization cannot specifically deal with the dark areas, that is, when the original contrast of the image is already high, after the conventional histogram equalization, the image will not change in any way, and the dark areas There will be no improvement.

因此,若可以準確地將暗部區域調亮、不影響亮部區域細 節,且整張影像不會產生光暈現象,影像將可以達到較佳的對比增強。 Therefore, if you can accurately brighten the dark areas without affecting the fineness of the bright areas, And the entire image will not produce halo, and the image will achieve better contrast enhancement.

本發明提供了一種基於直方圖調整的對比增強方法及其裝置,其對單張影像進行直方圖統計,並調整直方圖統計中的統計量,以避免產生習知的光暈現象,且可以在不影響亮部區域亮度的情況下調整暗部區域的亮度,進而實現較佳的對比增強。 The present invention provides a contrast enhancement method and device based on histogram adjustment, which performs histogram statistics on a single image and adjusts the statistics in the histogram statistics to avoid the occurrence of the conventional halo phenomenon. The brightness of the dark area is adjusted without affecting the brightness of the bright area, thereby achieving better contrast enhancement.

本發明實施例提供一種基於直方圖調整的對比增強方法,適用於一對比增強裝置,且用以增強一輸入影像的對比度。對比增強方法包括如下步驟:(A)接收輸入影像中每一個像素位置的一輸入亮度值;(B)將每一個輸入亮度值的一出現次數對應到一直方圖上的多個亮度值;(C)增強小於一預設亮度值的至少一亮度值對應的出現次數,且每一個亮度值對應到一更新出現次數;(D)依序累加每一個出現次數以產生一第一累加曲線,且依序累加每一個更新出現次數以產生一第二累加線條,其中第一累加曲線代表這些亮度值與這些出現次數的關係,且第二累加曲線代表這些亮度值與這些更新出現次數的關係;(E)根據這些亮度值的一動態範圍將累加後的這些出現次數進行一全域映射以分別產生一第一輸出值,且根據這些亮度值的動態範圍將累加後的這些更新出現次數進行全域映射以分別產生一第二輸出值;以及(F)依序於每一個亮度值中判斷一目前亮度值是否小於一臨界亮度值。若目前亮度值小於臨界亮度值,根據臨界亮度值混合(blending)對應的第一輸出值與對應的第二輸出值以產生一亮度輸出值。若目前亮度值大於等於臨界亮度值,將對應的第一輸出值作為亮度輸出值。 An embodiment of the present invention provides a contrast enhancement method based on histogram adjustment, which is applicable to a contrast enhancement device and is used to enhance the contrast of an input image. The contrast enhancement method includes the following steps: (A) receiving an input brightness value of each pixel position in the input image; (B) corresponding to a number of occurrences of each input brightness value to a plurality of brightness values on a histogram; ( C) enhancing the number of occurrences corresponding to at least one brightness value less than a preset brightness value, and each brightness value corresponding to an update appearance number; (D) sequentially accumulating each occurrence number to generate a first accumulation curve, and Accumulate the number of occurrences of each update in order to generate a second accumulation line, wherein the first accumulation curve represents the relationship between the brightness values and the occurrence times, and the second accumulation curve represents the relationship between the brightness values and the update appearance times; E) Perform a global mapping of the accumulated occurrences according to a dynamic range of the luminance values to generate a first output value, and perform a global mapping of the accumulated occurrences of the updated occurrences according to the dynamic range of the luminance values. Generating a second output value respectively; and (F) judging whether a current brightness value is less than a critical brightness value sequentially in each brightness value. If the current brightness value is less than the threshold brightness value, the corresponding first output value and the corresponding second output value are blended according to the threshold brightness value to generate a brightness output value. If the current brightness value is greater than or equal to the critical brightness value, the corresponding first output value is used as the brightness output value.

本發明實施例提供一種基於直方圖調整的對比增強裝置,且用以增強一輸入影像的對比度。對比增強裝置包括一影像擷取器 與一影像處理器。影像擷取器接收輸入影像,並依序擷取輸入影像中每一個像素位置的一輸入亮度值。影像處理器電連接影像擷取器,且用以執行下列步驟:(A)接收輸入影像中的每一個輸入亮度值;(B)將每一個輸入亮度值的一出現次數對應到一直方圖上的多個亮度值;(C)增強小於一預設亮度值的至少一亮度值對應的出現次數,且每一個亮度值對應到一更新出現次數;(D)依序累加每一個出現次數以產生一第一累加曲線,且依序累加每一個更新出現次數以產生一第二累加線條,其中第一累加曲線代表這些亮度值與這些出現次數的關係,且第二累加曲線代表這些亮度值與這些更新出現次數的關係;(E)根據這些亮度值的一動態範圍將累加後的這些出現次數進行一全域映射以分別產生一第一輸出值,且根據這些亮度值的動態範圍將累加後的這些更新出現次數進行全域映射以分別產生一第二輸出值;以及(F)依序於每一個亮度值中判斷一目前亮度值是否小於一臨界亮度值。若目前亮度值小於臨界亮度值,根據臨界亮度值混合(blending)對應的第一輸出值與對應的第二輸出值以產生一亮度輸出值。若目前亮度值大於等於臨界亮度值,將對應的第一輸出值作為亮度輸出值。 An embodiment of the present invention provides a contrast enhancement device based on histogram adjustment, and is used to enhance the contrast of an input image. Contrast enhancement device includes an image capturer With an image processor. The image capture device receives the input image and sequentially captures an input brightness value of each pixel position in the input image. The image processor is electrically connected to the image capture device and is used to perform the following steps: (A) receiving each input brightness value in the input image; (B) corresponding to a number of occurrences of each input brightness value on the histogram (C) enhance the number of occurrences corresponding to at least one luminance value that is less than a preset luminance value, and each luminance value corresponds to an updated occurrence number; (D) accumulate each occurrence number in order to generate A first accumulation curve and sequentially accumulating each update occurrence number to generate a second accumulation line, wherein the first accumulation curve represents the relationship between the brightness values and the occurrence times, and the second accumulation curve represents the brightness values and these Update the relationship of the number of occurrences; (E) Perform a global mapping of the accumulated occurrences according to a dynamic range of the luminance values to generate a first output value, respectively, and accumulate these accumulated values according to the dynamic range of the luminance values. Update the number of occurrences to perform global mapping to generate a second output value respectively; and (F) judge in each of the brightness values in sequence whether a current brightness value is less than one Luminance value. If the current brightness value is less than the threshold brightness value, the corresponding first output value and the corresponding second output value are blended according to the threshold brightness value to generate a brightness output value. If the current brightness value is greater than or equal to the critical brightness value, the corresponding first output value is used as the brightness output value.

為使能更進一步瞭解本發明之特徵及技術內容,請參閱以下有關本發明之詳細說明與附圖,但是此等說明與所附圖式僅係用來說明本發明,而非對本發明的權利範圍作任何的限制。 In order to further understand the features and technical contents of the present invention, please refer to the following detailed description and accompanying drawings of the present invention, but these descriptions and attached drawings are only used to illustrate the present invention, not the right to the present invention No limitation on scope.

100‧‧‧電子裝置 100‧‧‧ electronic device

110‧‧‧影像擷取器 110‧‧‧Image capture device

120‧‧‧影像處理器 120‧‧‧Image Processor

Im‧‧‧輸入影像 Im‧‧‧ input image

P0-Pi‧‧‧輸入亮度值 P0-Pi‧‧‧Enter brightness value

OUT0-OUTi‧‧‧輸出亮度值 OUT0-OUTi‧‧‧Output brightness value

S210、S220、S230、S240、S245、S250、S255、S260、S270、S280‧‧‧步驟 S210, S220, S230, S240, S245, S250, S255, S260, S270, S280‧‧‧ steps

Hgram‧‧‧直方圖 Hgram‧‧‧Histogram

Hgram1‧‧‧直方圖 Hgram1‧‧‧ Histogram

ADD1‧‧‧第一累加曲線 ADD1‧‧‧The first accumulation curve

ADD2‧‧‧第二累加曲線 ADD2‧‧‧Second Accumulation Curve

GM1‧‧‧第一全域映射曲線 GM1‧‧‧first global mapping curve

GM2‧‧‧第二全域映射曲線 GM2‧‧‧Second global mapping curve

GMout‧‧‧輸出亮度曲線 GMout‧‧‧Output brightness curve

圖1是本發明一實施例之基於直方圖調整的對比增強裝置的示意圖。 FIG. 1 is a schematic diagram of a contrast enhancement device based on histogram adjustment according to an embodiment of the present invention.

圖2是本發明一實施例之基於直方圖調整的對比增強方法的流程圖。 FIG. 2 is a flowchart of a contrast enhancement method based on histogram adjustment according to an embodiment of the present invention.

圖3A是本發明一實施例之輸入亮度值的出現次數的直方圖 統計的示意圖。 FIG. 3A is a histogram of the number of occurrences of an input brightness value according to an embodiment of the present invention Schematic illustration of statistics.

圖3B是本發明一實施例之輸入亮度值的更新出現次數的直方圖統計的示意圖。 FIG. 3B is a schematic diagram of histogram statistics of the number of occurrences of update of the input brightness value according to an embodiment of the present invention.

圖4A是本發明一實施例之第一累加曲線的示意圖。 FIG. 4A is a schematic diagram of a first accumulation curve according to an embodiment of the present invention.

圖4B是本發明一實施例之第二累加曲線的示意圖。 FIG. 4B is a schematic diagram of a second accumulation curve according to an embodiment of the present invention.

圖5A是本發明一實施例之第一全域映射曲線的示意圖。 FIG. 5A is a schematic diagram of a first global mapping curve according to an embodiment of the present invention.

圖5B是本發明一實施例之第二全域映射曲線的示意圖。 FIG. 5B is a schematic diagram of a second global mapping curve according to an embodiment of the present invention.

圖6是本發明一實施例之第一全域映射曲線與輸出亮度曲線的比較圖。 FIG. 6 is a comparison diagram of a first global mapping curve and an output brightness curve according to an embodiment of the present invention.

在下文中,將藉由圖式說明本發明之各種例示實施例來詳細描述本發明。然而,本發明概念可能以許多不同形式來實現,且不應解釋為限於本文中所闡述之例示性實施例。此外,圖式中相同參考數字可用以表示類似的元件。 Hereinafter, the present invention will be described in detail by illustrating various exemplary embodiments of the present invention with drawings. However, the inventive concepts may be implemented in many different forms and should not be construed as limited to the exemplary embodiments set forth herein. In addition, the same reference numerals may be used to indicate similar elements in the drawings.

本發明實施例提供一種基於直方圖調整的對比增強方法及其裝置,其對單張影像進行直方圖統計,並調整直方圖中的統計量。更進一步來說,對比增強方法及對比增強裝置增強直方圖中的暗部區域(即較低亮度部分)對應的出現次數,接著再根據直方圖中的一臨界亮度進行一全域映射,以調高暗部區域的亮度並維持亮部區域(即較高亮度部分)的亮度,並據此產生亮度輸出值。藉此,本發明實施例的基於直方圖調整的對比增強方法及其裝置可以避免產生習知的光暈現象,且可以在不影響亮部區域亮度的情況下調整暗部區域的亮度,進而實現較佳的對比增強。以下將進一步介紹本發明揭露之基於直方圖調整的對比增強方法及其裝置。 Embodiments of the present invention provide a contrast enhancement method and device based on histogram adjustment, which perform histogram statistics on a single image and adjust statistics in the histogram. Furthermore, the contrast enhancement method and the contrast enhancement device enhance the number of occurrences of the dark area (ie, the lower brightness portion) in the histogram, and then perform a global mapping based on a critical brightness in the histogram to increase the dark portion. The brightness of the area is maintained and the brightness of the bright area (ie, the higher brightness portion) is maintained, and a brightness output value is generated accordingly. In this way, the contrast enhancement method and device based on histogram adjustment according to the embodiments of the present invention can avoid the occurrence of the conventional halo phenomenon, and can adjust the brightness of the dark area without affecting the brightness of the bright area, thereby achieving a comparative Best contrast enhancement. The method and device for contrast enhancement based on histogram adjustment disclosed in the present invention will be further described below.

首先,請參考圖1,其顯示本發明一實施例之基於直方圖調整的對比增強裝置的示意圖。如圖1所示,對比增強裝置100 為用來增強一輸入影像Im的對比度,並輸出調整後的輸出亮度值OUT0-OUTi。在本實施例中,對比增強裝置100可為智慧型手機、錄影機、平板電腦、筆記型電腦或其他需要調整影像對比的對比增強裝置,本發明對此不作限制。 First, please refer to FIG. 1, which shows a schematic diagram of a contrast enhancement device based on histogram adjustment according to an embodiment of the present invention. As shown in FIG. 1, the contrast enhancement device 100 It is used to enhance the contrast of an input image Im and output the adjusted output brightness values OUT0-OUTi. In this embodiment, the contrast enhancement device 100 may be a smart phone, a video recorder, a tablet computer, a notebook computer, or other contrast enhancement devices that need to adjust image contrast, which is not limited in the present invention.

電子裝置100包括一影像擷取器110與一影像處理器120。如圖1所示,影像擷取器110接收輸入影像Im,並依序擷取輸入影像Im中每一個像素位置(未繪於圖式中)的輸入亮度值P0-Pi。更進一步來說,影像擷取器110為擷取連續影像,且輸入影像Im為連續影像中的其中一張。 The electronic device 100 includes an image capture device 110 and an image processor 120. As shown in FIG. 1, the image capture device 110 receives an input image Im and sequentially captures input brightness values P0-Pi at each pixel position (not shown in the figure) in the input image Im. Furthermore, the image capture unit 110 captures continuous images, and the input image Im is one of the continuous images.

影像處理器120電連接影像擷取器110,且用以執行下列步驟,以調整輸入影像Im中每一個像素位置的輸入亮度值P0-Pi,進而增強輸入影像Im的對比度。 The image processor 120 is electrically connected to the image capture unit 110 and is used to perform the following steps to adjust the input brightness value P0-Pi of each pixel position in the input image Im, thereby enhancing the contrast of the input image Im.

請同時參考圖1-2。圖2顯示本發明一實施例之基於直方圖調整的對比增強方法的流程圖。首先,影像處理器120接收輸入影像Im中的每一個輸入亮度值P0-Pi,以進一步分析每一個輸入亮度值P0-Pi的特徵(步驟S210)。 Please also refer to Figure 1-2. FIG. 2 shows a flowchart of a contrast enhancement method based on histogram adjustment according to an embodiment of the present invention. First, the image processor 120 receives each input brightness value P0-Pi in the input image Im to further analyze the characteristics of each input brightness value P0-Pi (step S210).

接著,影像處理器120將每一個輸入亮度值P0-Pi的出現次數對應到直方圖上的多個亮度值(步驟S220)。更進一步來說,每一個輸入亮度值P0-Pi是以n位元表示。因此,直方圖上的這些亮度值總共會有2的n次方個。舉例來說,輸入影像Im共有202個像素位置(未繪於圖式中)。每一個像素位置具有一個輸入亮度值,且每一個像素位置的輸入亮度值是以4位元數值表示(即以0-15表示)。故直方圖上的這些亮度值總共會有2的4次方個,即16個亮度值。而影像處理器120將會統計202個像素位置的這些輸入亮度值P0-Pi的出現次數,並對應到直方圖上的這16個亮度值0-15。 Next, the image processor 120 corresponds the number of occurrences of each input brightness value P0-Pi to a plurality of brightness values on the histogram (step S220). Furthermore, each input brightness value P0-Pi is represented by n bits. Therefore, these brightness values on the histogram will have a total of 2 nth power. For example, the input image Im has a total of 202 pixel positions (not shown in the figure). Each pixel position has an input brightness value, and the input brightness value of each pixel position is represented by a 4-bit value (that is, represented by 0-15). Therefore, these brightness values on the histogram will have a total of 2 to the 4th power, that is, 16 brightness values. The image processor 120 will count the number of occurrences of these input brightness values P0-Pi at 202 pixel positions, and correspond to the 16 brightness values 0-15 on the histogram.

如圖3A所示,影像處理器120將202個像素位置的這些輸入亮度值P0-Pi的出現次數對應到直方圖Hgram上的16個亮度 值0-15。舉例來說,直方圖Hgram上的亮度值1對應到的出現次數為10次,代表202個像素位置的這些輸入亮度值P0-Pi中共有10次數值為0。而影像處理器120同樣依此方式統計直方圖Hgram的亮度值2-15對應的出現次數,故在此不再贅述。 As shown in FIG. 3A, the image processor 120 corresponds to the number of occurrences of these input luminance values P0-Pi at 202 pixel positions to the 16 luminances on the histogram Hgram Values are 0-15. For example, the luminance value 1 on the histogram Hgram corresponds to 10 occurrences, and a total of 10 occurrences of these input luminance values P0-Pi representing 202 pixel positions are 0. The image processor 120 also counts the number of occurrences corresponding to the brightness value 2-15 of the histogram Hgram in this way, so it will not be repeated here.

在執行完直方圖統計(即步驟S220)後,影像處理器120將增強小於一預設亮度值的至少一亮度值對應的出現次數,以對輸入影像Im的暗部區域(即輸入影像Im中較暗的部分)進行增強(步驟S230)。此時,直方圖中的每一個亮度值會對應到一個更新後的更新出現次數。更進一步來說,影像處理器120增強小於一預設亮度值(例如3)的至少一亮度值對應的出現次數,以產生至少一亮度值對應的一增強出現次數。接著,影像處理器120再將增強出現次數與大於等於預設亮度值的每一個亮度值對應的出現次數作為上述更新出現次數,使得直方圖中的每一個亮度值會分別對應到這些更新出現次數。 After performing the histogram statistics (ie, step S220), the image processor 120 will enhance the number of occurrences corresponding to at least one brightness value that is less than a preset brightness value, so as to reduce the dark area of the input image Im The dark part) is enhanced (step S230). At this time, each brightness value in the histogram will correspond to an updated update occurrence number. Furthermore, the image processor 120 enhances the number of occurrences corresponding to at least one luminance value smaller than a preset luminance value (for example, 3) to generate an enhanced number of occurrences corresponding to at least one luminance value. Next, the image processor 120 uses the number of occurrences of the enhancement occurrences and each luminance value equal to or greater than the preset luminance value as the update occurrences, so that each luminance value in the histogram will correspond to these update occurrences respectively. .

承接上述圖3A的例子,如圖3B所示,預設亮度值設定為3。因此,影像處理器120將增強小於3的亮度值(即亮度值0-2)所對應的出現次數,以產生亮度值0-2對應的增強出現次數。在本實施例中,增強幅度為4倍。因此,影像處理器120將增強亮度值0的出現次數(即0次),使得對應的增強出現次數為0*4=0次。類似地,影像處理器120將增強亮度值1的出現次數(即10次),使得對應的增強出現次數為10*4=40次,以及影像處理器120將增強亮度值2的出現次數(即12次),使得對應的增強出現次數為12*4=48次。而有關增強幅度的數值亦可根據實際狀況來做設計,本發明對此不作限制。 Following the example of FIG. 3A, as shown in FIG. 3B, the preset brightness value is set to 3. Therefore, the image processor 120 will enhance the number of occurrences corresponding to the brightness value less than 3 (ie, the brightness value 0-2) to generate the number of enhanced appearances corresponding to the brightness value 0-2. In this embodiment, the enhancement amplitude is 4 times. Therefore, the image processor 120 enhances the number of occurrences of the brightness value 0 (ie, 0 times), so that the corresponding number of enhancement appearances is 0 * 4 = 0 times. Similarly, the image processor 120 will enhance the number of occurrences of the brightness value 1 (ie, 10 times), so that the corresponding number of enhanced appearances is 10 * 4 = 40 times, and the image processor 120 will enhance the number of appearances of the brightness value 2 (ie, 12 times), so that the corresponding number of enhancement occurrences is 12 * 4 = 48 times. The value of the enhancement amplitude can also be designed according to the actual situation, which is not limited in the present invention.

接著,影像處理器120再將上述3個增強出現次數與大於等於3的每個亮度值(即亮度值3-15)對應的出現次數作為上述更新出現次數,使得直方圖Hgram1中的每一個亮度值會分別對應到這些更新出現次數。透過上述說明可以整理成公式1,且公式1 如下所示。 Next, the image processor 120 further uses the number of occurrences corresponding to the above three enhancement appearances and each brightness value greater than or equal to 3 (that is, the brightness value 3-15) as the above-mentioned update appearances, so that each brightness in the histogram Hgram1 The values correspond to the number of times these updates occur. Through the above description, it can be organized into Equation 1, and Equation 1 As follows.

Figure TWI676962B_D0001
其中,i為目前的亮度值,ε為預設亮度值,a為增強幅度,H(i)為出現次數,且H'(i)為更新出現次數。因此,如圖3B所示,直方圖Hgram1中的亮度值1-15分別對應到的更新出現次數為40,48,22,30,11,10,9,8,7,5,11,13,9,15與30。據此,影像處理器120將增強小於3的亮度值對應的出現次數,以對輸入影像Im的暗部區域(即輸入影像Im中較暗的部分)進行增強。
Figure TWI676962B_D0001
Among them, i is the current brightness value, ε is the preset brightness value, a is the enhancement amplitude, H (i) is the number of occurrences, and H ′ (i) is the number of update occurrences. Therefore, as shown in FIG. 3B, the number of update occurrences corresponding to the brightness values 1-15 in the histogram Hgram1 is 40, 48, 22, 30, 11, 10, 9, 8, 7, 5, 11, 13, respectively. 9,15 and 30. According to this, the image processor 120 enhances the number of occurrences corresponding to the brightness value less than 3 to enhance the dark area of the input image Im (that is, the darker part of the input image Im).

在取得每一個亮度值對應到的出現次數與對應到的更新出現次數(步驟S230)後,影像處理器120將依序累加每一個出現次數,以產生一第一累加曲線(步驟S240)。而第一累加曲線代表這些亮度值與這些出現次數的關係。此外,影像處理器120亦將依序累加每一個更新出現次數,以產生一第二累加線條(步驟S250)。而第二累加曲線代表這些亮度值與這些更新出現次數的關係。 After obtaining the number of occurrences corresponding to each brightness value and the number of corresponding update occurrences (step S230), the image processor 120 accumulates each occurrence number in order to generate a first accumulation curve (step S240). The first cumulative curve represents the relationship between these brightness values and the number of occurrences. In addition, the image processor 120 will sequentially accumulate each update occurrence number in order to generate a second accumulated line (step S250). The second cumulative curve represents the relationship between these brightness values and the number of occurrences of these updates.

承接上述例子,請同時參考圖3A與4A,影像處理器120將依序累加每一個出現次數,以產生第一累加曲線ADD1,而第一累加曲線A1代表這些亮度值0-15與這些出現次數的關係。舉例來說,亮度值1對應的累加後的出現次數為0+10=10;亮度值2對應的累加後的出現次數為10+12=22;以及亮度值3對應的累加後的出現次數為22+22=44。而影像處理器120同樣以上述方式計算亮度值4-15對應的累加後的出現次數,故在此不再贅述。 Following the above example, please refer to FIGS. 3A and 4A at the same time. The image processor 120 will sequentially accumulate each occurrence number to generate a first accumulation curve ADD1, and the first accumulation curve A1 represents these brightness values 0-15 and these occurrence times. Relationship. For example, the number of cumulative appearances corresponding to brightness value 1 is 0 + 10 = 10; the number of cumulative appearances corresponding to brightness value 2 is 10 + 12 = 22; and the number of cumulative appearances corresponding to brightness value 3 is 22 + 22 = 44. The image processor 120 also calculates the accumulated number of occurrences corresponding to the brightness value 4-15 in the above manner, so it will not be repeated here.

類似地,請同時參考圖3B與4B,影像處理器120將依序累加每一個更新出現次數,以產生第二累加曲線ADD2,而第二累加曲線ADD2代表這些亮度值0-15與這些更新出現次數的關係。舉例來說,亮度值1對應的累加後的更新出現次數為 0+40=40;亮度值2對應的累加後的更新出現次數為40+48=88;以及亮度值3對應的累加後的更新出現次數為88+22=110。而影像處理器120同樣以上述方式計算亮度值4-15對應的累加後的更新出現次數,故在此不再贅述。 Similarly, referring to FIGS. 3B and 4B at the same time, the image processor 120 will sequentially accumulate the number of occurrences of each update in order to generate a second accumulation curve ADD2, and the second accumulation curve ADD2 represents these brightness values 0-15 and these updates appear. The relationship of times. For example, the number of accumulated update occurrences corresponding to the brightness value 1 is 0 + 40 = 40; the number of cumulative update occurrences corresponding to the brightness value 2 is 40 + 48 = 88; and the number of cumulative update occurrences corresponding to the brightness value 3 is 88 + 22 = 110. The image processor 120 also calculates the number of cumulative update occurrences corresponding to the brightness value 4-15 in the above manner, so it will not be repeated here.

在步驟S240後,影像處理器120將根據這些亮度值的一動態範圍將累加後的這些出現次數進行全域映射(Global Mapping),以分別產生一第一輸出值(步驟S245)。更進一步來說,影像處理器120將累加後的這些出現次數正規化至這些亮度值的動態範圍,以分別產生第一輸出值。而這些亮度值與對應的第一輸出值將形成一第一全域映射曲線。在本實施例中,亮度值的動態範圍為0-15,因此,影像處理器120將每一個累加後的出現次數正規化到亮度值的動態範圍0-15,以分別產生第一輸出值。 After step S240, the image processor 120 performs global mapping on the accumulated occurrences according to a dynamic range of the brightness values to generate a first output value (step S245). Furthermore, the image processor 120 normalizes the accumulated occurrence times to the dynamic range of the brightness values to generate the first output values, respectively. The brightness values and the corresponding first output values will form a first global mapping curve. In this embodiment, the dynamic range of the brightness value is 0-15. Therefore, the image processor 120 normalizes each accumulated appearance number to the dynamic range of the brightness value 0-15 to generate the first output values respectively.

承接上述例子,並請同時參考圖4A與圖5A。由圖4A可知,亮度值的動態範圍為0-15。全部的出現次數共有202個。以亮度值2對應的累加後的出現次數為例來說明。亮度值2對應的累加後的出現次數為22。因此,影像處理器120將數值22正規化到亮度值的動態範圍1-15,以對應產生第一輸出值T1(i),意即亮度值2產生的第一輸出值T1(i)=22*15/202=1.63。若影像處理器120對第一輸出值T1(i)進行無條件捨去,將產生第一輸出值T1(i)為1。 Following the above example, please refer to FIG. 4A and FIG. 5A at the same time. It can be seen from FIG. 4A that the dynamic range of the brightness value is 0-15. There are 202 occurrences in total. The number of occurrences after accumulation corresponding to the brightness value 2 is taken as an example for illustration. The number of occurrences after the accumulation corresponding to the brightness value 2 is 22. Therefore, the image processor 120 normalizes the value 22 to the dynamic range of the brightness value 1-15 to correspond to the first output value T1 (i), which means that the first output value T1 (i) = 22 generated by the brightness value 2 * 15/202 = 1.63. If the image processor 120 unconditionally rounds off the first output value T1 (i), the first output value T1 (i) will be generated as 1.

類似地,亮度值7對應的累加後的出現次數為104。因此,影像處理器120將數值104正規化到亮度值的動態範圍1-15,以對應產生第一輸出值T1(i),意即第一輸出值T1(i)=104*15/202=7.72。同樣地,影像處理器120對第一輸出值T1(i)進行無條件捨去,使得第一輸出值T1(i)為7。而影像處理器120同樣以上述方式計算亮度值3-6與8-15對應的累加後的出現次數,以對應產生第一輸出值T1(i),並顯示於下表一。據 此,亮度值與對應的第一輸出值T1(i)將形成第一全域映射曲線GM1。 Similarly, the accumulated number of occurrences corresponding to the brightness value 7 is 104. Therefore, the image processor 120 normalizes the value 104 to the dynamic range of the brightness value 1-15 to correspond to the first output value T1 (i), which means that the first output value T1 (i) = 104 * 15/202 = 7.72. Similarly, the image processor 120 unconditionally rounds off the first output value T1 (i) so that the first output value T1 (i) is 7. The image processor 120 also calculates the number of cumulative appearances corresponding to the brightness values 3-6 and 8-15 in the above manner to generate the first output value T1 (i) correspondingly, and displays it in Table 1 below. according to Therefore, the brightness value and the corresponding first output value T1 (i) will form a first global mapping curve GM1.

此外,在步驟S250後,影像處理器120亦將根據這些亮度值的動態範圍將累加後的這些更新出現次數進行全域映射,以分別產生一第二輸出值(步驟S255)。更進一步來說,影像處理器120將累加後的這些更新出現次數正規化至這些亮度值的動態範圍,以分別產生第二輸出值。而這些亮度值與對應的第二輸出值將形成一第二全域映射曲線。在本實施例中,亮度值的動態範圍為0-15,因此,影像處理器120將每一個累加後的更新出現次數正規化到亮度值的動態範圍0-15,以分別產生第二輸出值。 In addition, after step S250, the image processor 120 also performs global mapping on the accumulated occurrence times of updates according to the dynamic range of the brightness values to generate a second output value (step S255). Furthermore, the image processor 120 normalizes the accumulated occurrence times of the updates to the dynamic range of the brightness values to generate second output values, respectively. These brightness values and corresponding second output values will form a second global mapping curve. In this embodiment, the dynamic range of the brightness value is 0-15. Therefore, the image processor 120 normalizes the number of each update occurrence to the dynamic range of the brightness value 0-15 to generate the second output values respectively. .

承接上述例子,並請同時參考圖4B與圖5B。由圖4B可知,亮度值的動態範圍為0-15。全部的更新出現次數共有268個。以亮度值4對應的累加後的更新出現次數為例來說明。亮度值4對應的累加後的更新出現次數為140。因此,影像處理器120將數值96正規化到亮度值的動態範圍1-15,以對應產生第二輸出值T2(i),意即第二輸出值T2(i)=140*15/268=7.83。若影像處理器120對第二輸出值T2(i)進行無條件捨去,將產生第二輸出值 T2(i)為7。而影像處理器120同樣以上述方式計算亮度值1-3與5-15對應的累加後的更新出現次數,以對應產生第二輸出值T2(i),並顯示於下表二。據此,亮度值與對應的第二輸出值T2(i)將形成第二全域映射曲線GM2。 Following the above example, please refer to FIG. 4B and FIG. 5B at the same time. It can be seen from FIG. 4B that the dynamic range of the brightness value is 0-15. There are 268 updates in total. Take the number of accumulated update occurrences corresponding to the brightness value 4 as an example for illustration. The number of accumulated updates corresponding to the brightness value 4 is 140. Therefore, the image processor 120 normalizes the value 96 to the dynamic range of the brightness value 1-15 to generate a second output value T2 (i) correspondingly, that is, the second output value T2 (i) = 140 * 15/268 = 7.83. If the image processor 120 unconditionally rounds off the second output value T2 (i), a second output value will be generated T2 (i) is 7. The image processor 120 also calculates the number of cumulative update occurrences corresponding to the brightness values 1-3 and 5-15 in the above manner to generate a second output value T2 (i) correspondingly, and is shown in Table 2 below. Accordingly, the brightness value and the corresponding second output value T2 (i) will form a second global mapping curve GM2.

在取得第一輸出值(步驟S245)與第二輸出值(步驟S255)後,影像處理器120將依序於每一個亮度值中判斷一目前亮度值是否小於一臨界亮度值(步驟S260),並在接下來的步驟S270與S280中重新分配第一輸出值與第二輸出值,以調高暗部區域的亮度且維持亮部區域的亮度。 After obtaining the first output value (step S245) and the second output value (step S255), the image processor 120 will sequentially determine in each brightness value whether a current brightness value is less than a critical brightness value (step S260), In the next steps S270 and S280, the first output value and the second output value are redistributed to increase the brightness of the dark area and maintain the brightness of the bright area.

更進一步來說,影像處理器120是根據這些亮度值與對應的這些出現次數來計算臨界亮度值,以藉此判斷臨界亮度值落在這些亮度值中的哪個位置。舉例來說,請同時參考圖3A,影像處理器120加總每一個亮度值與對應的出現次數相乘的結果以產生一累計值,即累計值=((1*10)+(2*12)+(3*22)+(4+30)+(5*11)+(6*10)+(7*9)+(8*8)+(9*7)+(10*5)+(11*11)+(12*13)+(13*9)+(14*15)+(15*30))=1629。影像處理器120接著再將累計值除以加總這些出現次數的結果以產生臨界亮度值,即臨界亮度值 =1629/(10+12+22+30+11+10+9+8+7+5+11+13+9+15+30)=8.064。而影像處理器120將對臨界亮度值進行無條件捨去,使得臨界亮度值為8。 Furthermore, the image processor 120 calculates the critical brightness value according to the brightness values and the corresponding number of occurrences, so as to determine where the critical brightness value falls among the brightness values. For example, referring to FIG. 3A at the same time, the image processor 120 adds up the result of multiplying each brightness value by the corresponding number of occurrences to generate a cumulative value, that is, the cumulative value = ((1 * 10) + (2 * 12 ) + (3 * 22) + (4 + 30) + (5 * 11) + (6 * 10) + (7 * 9) + (8 * 8) + (9 * 7) + (10 * 5) + (11 * 11) + (12 * 13) + (13 * 9) + (14 * 15) + (15 * 30)) = 1629. The image processor 120 then divides the accumulated value by the result of summing these occurrences to generate a critical brightness value, that is, a critical brightness value = 1629 / (10 + 12 + 22 + 30 + 11 + 10 + 9 + 8 + 7 + 5 + 11 + 13 + 9 + 15 + 30) = 8.064. The image processor 120 will unconditionally cut off the critical brightness value so that the critical brightness value is 8.

透過上述例子說明可以整理成公式2,且公式2如下所示。 Through the above example, it can be summarized into Equation 2, and Equation 2 is shown below.

Figure TWI676962B_D0004
其中,i為目前的亮度值,H(i)為出現次數,Σ(i*H(i))為累計值,且δ為臨界亮度值。而上述臨界亮度值亦可以根據實際狀況而使用其他計算方式,本發明對此不作限制。
Figure TWI676962B_D0004
Among them, i is the current brightness value, H (i) is the number of occurrences, Σ (i * H (i)) is the cumulative value, and δ is the critical brightness value. The above-mentioned critical brightness value may also be calculated in other ways according to actual conditions, which is not limited in the present invention.

因此,在步驟S260中,影像處理器120將依序於每一個亮度值中判斷目前亮度值是否小於臨界亮度值,以根據臨界亮度值來重新分配第一輸出值與第二輸出值,進而調高暗部區域的亮度且維持亮部區域的亮度。 Therefore, in step S260, the image processor 120 will sequentially determine whether the current brightness value is less than the threshold brightness value in each brightness value, so as to redistribute the first output value and the second output value according to the threshold brightness value, and then adjust The brightness of the high dark area is maintained and the brightness of the bright area is maintained.

請同時參考圖5A與5B,若目前亮度值小於臨界亮度值,代表目前亮度值屬於暗部區域且需要增強。此時,影像處理器120將根據臨界亮度值混合(blending)對應的第一輸出值與對應的第二輸出值,以產生一亮度輸出值(步驟S270)。在本實施例中,影像處理器120將根據目前亮度值與臨界亮度值計算一第一權重比例與一第二權重比例,且第一權重比例與第二權重比例的總和為1。再來,影像處理器120混合第一權重比例的第一輸出值與第二權重比例的第二輸出值,以產生目前亮度值對應的亮度輸出值。 Please refer to FIGS. 5A and 5B at the same time. If the current brightness value is less than the critical brightness value, it means that the current brightness value belongs to the dark area and needs to be enhanced. At this time, the image processor 120 blends the corresponding first output value and the corresponding second output value according to the threshold brightness value to generate a brightness output value (step S270). In this embodiment, the image processor 120 calculates a first weight ratio and a second weight ratio according to the current brightness value and the critical brightness value, and the sum of the first weight ratio and the second weight ratio is 1. Furthermore, the image processor 120 mixes the first output value of the first weight ratio and the second output value of the second weight ratio to generate a brightness output value corresponding to the current brightness value.

承接上述例子,臨界亮度值為8,且以目前亮度值為2來作說明。如圖5A-5B所示,影像處理器120將判斷目前亮度值(即2)小於臨界亮度值(即8)。此時,影像處理器120將根據目前亮度值除以臨界亮度值以產生第一權重比例,即第一權重比例=2/8。接著,影像處理器120再將1減去第一權重比例以產生第二權重比例,即第二權重比例=1-2/8=6/8。再來,影像處理器120 混合第一權重比例的第一輸出值與第二權重比例的第二輸出值,以產生目前亮度值對應的亮度輸出值,即亮度輸出值=(2/8)*1+(6/8)*4=3.25。而影像處理器120將對亮度輸出值進行無條件捨去,使得亮度輸出值為3。 Following the above example, the critical brightness value is 8 and the current brightness value is 2 for description. As shown in FIGS. 5A-5B, the image processor 120 will determine that the current brightness value (ie, 2) is less than the critical brightness value (ie, 8). At this time, the image processor 120 divides the current brightness value by the threshold brightness value to generate a first weight ratio, that is, the first weight ratio = 2/8. Then, the image processor 120 subtracts 1 from the first weight ratio to generate a second weight ratio, that is, the second weight ratio = 1-2 / 8 = 6/8. Again, the image processor 120 Mix the first output value of the first weight ratio with the second output value of the second weight ratio to generate the brightness output value corresponding to the current brightness value, that is, the brightness output value = (2/8) * 1 + (6/8) * 4 = 3.25. The image processor 120 unconditionally rounds down the brightness output value so that the brightness output value is 3.

而在影像處理器120依序判斷目前亮度值是否小於臨界亮度值的過程中,若目前亮度值大於等於臨界亮度值,代表目前亮度值屬於亮部區域且不需要增強。此時,影像處理器120將目前亮度值對應的第一輸出值作為亮度輸出值(步驟S280)。 In the process of the image processor 120 sequentially determining whether the current brightness value is less than the critical brightness value, if the current brightness value is greater than or equal to the critical brightness value, it means that the current brightness value belongs to the bright area and does not need to be enhanced. At this time, the image processor 120 uses the first output value corresponding to the current brightness value as the brightness output value (step S280).

承接上述例子,臨界亮度值為8,且以目前亮度值為13來作說明。如圖5A-5B所示,影像處理器120將判斷目前亮度值(即13)大於等於臨界亮度值(即8)。此時,影像處理器120將目前亮度值對應的第一輸出值作為亮度輸出值,即亮度輸出值=11。 Following the above example, the critical brightness value is 8 and the current brightness value is 13 for explanation. As shown in FIGS. 5A-5B, the image processor 120 will determine that the current brightness value (ie, 13) is greater than or equal to the critical brightness value (ie, 8). At this time, the image processor 120 uses the first output value corresponding to the current brightness value as the brightness output value, that is, the brightness output value = 11.

透過上述亮度輸出值的例子說明可以整理成公式3,且公式3如下所示。 The above example of the brightness output value shows that it can be sorted into Equation 3, and Equation 3 is shown below.

Figure TWI676962B_D0005
其中,i為目前的亮度值,δ為臨界亮度值,A(i)為第一權重比例,T1(i)為第一輸出值,B(i)為第二權重比例,T2(i)為第二輸出值,且OUT(i)為亮度輸出值。而上述亮度輸出值亦可以根據實際狀況而使用其他計算方式,本發明對此不作限制。
Figure TWI676962B_D0005
Among them, i is the current brightness value, δ is the critical brightness value, A (i) is the first weight ratio, T1 (i) is the first output value, B (i) is the second weight ratio, and T2 (i) is The second output value, and OUT (i) is a luminance output value. The above-mentioned brightness output value may also use other calculation methods according to actual conditions, which is not limited in the present invention.

而承接上述例子,影像處理器120根據公式3計算每一個亮度值對應的亮度輸出值OUT(i),並顯示於下表三。據此,影像處理器120將依序於每一個亮度值中計算對應的亮度輸出值OUT(i),以形成一輸出亮度曲線GMout,如圖6所示。 Following the above example, the image processor 120 calculates a brightness output value OUT (i) corresponding to each brightness value according to Formula 3, and displays the brightness output value OUT (i) in Table 3 below. According to this, the image processor 120 will sequentially calculate the corresponding brightness output value OUT (i) in each brightness value to form an output brightness curve GMout, as shown in FIG. 6.

圖6是第一全域映射曲線GM1與輸出亮度曲線GMout的比較圖。因此,在目前亮度值1-7中,輸出亮度曲線GMout的亮度輸出值會高於第一全域映射曲線GM1的亮度輸出值(即調高暗部區域的亮度)。而在目前亮度值8-15中,輸出亮度曲線GMout的亮度輸出值會等於第一全域映射曲線GM1的亮度輸出值(即維持亮部區域的亮度)。 FIG. 6 is a comparison diagram of the first global mapping curve GM1 and the output brightness curve GMout. Therefore, among the current brightness values 1-7, the brightness output value of the output brightness curve GMout will be higher than the brightness output value of the first global mapping curve GM1 (that is, the brightness of the dark area is increased). In the current brightness value 8-15, the brightness output value of the output brightness curve GMout will be equal to the brightness output value of the first global mapping curve GM1 (that is, the brightness of the bright area is maintained).

綜上所述,本發明實施例所提供的一種基於直方圖調整的對比增強方法及其裝置,其增強直方圖中的暗部區域(即較低亮度部分)對應的出現次數,接著再根據直方圖中的臨界亮度進行全域映射,以調高暗部區域的亮度並維持亮部區域(即較高亮度部分)的亮度,並據此產生每一個亮度值對應的亮度輸出值(即輸出亮度曲線)。藉此,本發明實施例的基於直方圖調整的對比增強方法及其裝置可以避免產生習知的光暈現象,且可以在不影響亮部區域亮度的情況下調整暗部區域的亮度,進而實現較佳的對比增強。 In summary, a contrast enhancement method and device based on histogram adjustment provided in the embodiment of the present invention, which enhances the number of occurrences corresponding to the dark area (ie, the lower brightness part) in the histogram, and then according to the histogram The critical brightness in the global mapping is performed to increase the brightness of the dark area and maintain the brightness of the bright area (ie, the higher brightness part), and generate a brightness output value (ie, the output brightness curve) corresponding to each brightness value accordingly. In this way, the contrast enhancement method and device based on histogram adjustment according to the embodiments of the present invention can avoid the occurrence of the conventional halo phenomenon, and can adjust the brightness of the dark area without affecting the brightness of the bright area, thereby achieving a comparative Best contrast enhancement.

以上所述僅為本發明之實施例,其並非用以侷限本發明之專利範圍。 The above description is only an embodiment of the present invention, and is not intended to limit the patent scope of the present invention.

Claims (10)

一種基於直方圖調整的對比增強方法,適用於一對比增強裝置,用以增強一輸入影像的對比度,且該對比增強方法包括:接收該輸入影像中每一個像素位置的一輸入亮度值;將每一該輸入亮度值的一出現次數對應到一直方圖上的複數個亮度值;增強小於一預設亮度值的該至少一亮度值對應的該出現次數,且每一該亮度值對應到一更新出現次數;依序累加每一該出現次數以產生一第一累加曲線,且依序累加每一該更新出現次數以產生一第二累加線條,其中該第一累加曲線代表該些亮度值與該些出現次數的關係,且該第二累加曲線代表該些亮度值與該些更新出現次數的關係;根據該些亮度值的一動態範圍將累加後的該些出現次數進行一全域映射以分別產生一第一輸出值,且根據該些亮度值的該動態範圍將累加後的該些更新出現次數進行該全域映射以分別產生一第二輸出值;以及依序於每一該亮度值中判斷一目前亮度值是否小於一臨界亮度值,若該目前亮度值小於該臨界亮度值,根據該臨界亮度值混合(blending)對應的該第一輸出值與對應的該第二輸出值以產生一亮度輸出值,且若該目前亮度值大於等於該臨界亮度值,將對應的該第一輸出值作為該亮度輸出值。A contrast enhancement method based on histogram adjustment is suitable for a contrast enhancement device to enhance the contrast of an input image, and the contrast enhancement method includes: receiving an input brightness value of each pixel position in the input image; A number of occurrences of the input luminance value corresponds to a plurality of luminance values on the histogram; the number of occurrences corresponding to the at least one luminance value less than a preset luminance value is enhanced, and each luminance value corresponds to an update The number of occurrences; each of the occurrences is sequentially accumulated to generate a first accumulation curve, and each of the update occurrences is sequentially accumulated to produce a second accumulation line, wherein the first accumulation curve represents the brightness values and the Relationship between the number of occurrences, and the second accumulation curve represents the relationship between the brightness values and the number of update appearances; according to a dynamic range of the brightness values, a global mapping is performed on the accumulated occurrences to generate separately A first output value, and performing global mapping on the accumulated update times based on the dynamic range of the brightness values to divide Generating a second output value; and sequentially determining in each of the brightness values whether a current brightness value is less than a critical brightness value, and if the current brightness value is less than the critical brightness value, blending corresponding according to the critical brightness value The first output value and the corresponding second output value to generate a brightness output value, and if the current brightness value is greater than or equal to the critical brightness value, the corresponding first output value is used as the brightness output value. 如請求項1之基於直方圖調整的對比增強方法,其中,於增強小於該預設亮度值的該至少一亮度值對應的該出現次數的步驟中,更包括:增強小於該預設亮度值的該至少一亮度值對應的該出現次數,以產生該至少一亮度值對應的一增強出現次數;以及將該增強出現次數與大於等於該預設亮度值的每一該亮度值對應的該出現次數作為該些更新出現次數,且該些更新次數分別對應到該些亮度值。For example, the contrast enhancement method based on histogram adjustment of claim 1, wherein the step of enhancing the number of occurrences corresponding to the at least one brightness value smaller than the preset brightness value further includes: The number of occurrences corresponding to the at least one luminance value to generate an enhanced number of occurrences corresponding to the at least one luminance value; and the number of occurrences corresponding to each of the luminance values greater than or equal to the preset luminance value The number of occurrences of the updates is corresponding to the brightness values. 如請求項1之基於直方圖調整的對比增強方法,其中,於將累加後的該些出現次數進行該全域映射的步驟中,更包括:將累加後的該些出現次數正規化至該些亮度值的該動態範圍以分別產生該些第一輸出值,且該些亮度值與對應的該些第一輸出值形成一第一全域映射曲線。For example, the contrast enhancement method based on histogram adjustment of claim 1, wherein the step of performing global mapping on the accumulated occurrences further includes: normalizing the accumulated occurrences to the brightness The dynamic ranges of the values are used to generate the first output values respectively, and the brightness values and the corresponding first output values form a first global mapping curve. 如請求項1之基於直方圖調整的對比增強方法,其中,於將累加後的該些更新出現次數進行該全域映射的步驟中,更包括:將累加後的該些更新出現次數正規化至該些亮度值的該動態範圍以分別產生該些第二輸出值,且該些亮度值與對應的該些第二輸出值形成一第二全域映射曲線。For example, the contrast enhancement method based on histogram adjustment of claim 1, wherein the step of performing the global mapping on the accumulated occurrence times of the updates further includes normalizing the accumulated occurrence times of the updates to The dynamic ranges of the brightness values are used to generate the second output values respectively, and the brightness values and the corresponding second output values form a second global mapping curve. 如請求項1之基於直方圖調整的對比增強方法,其中,於判斷該目前亮度值是否小於該臨界亮度值的步驟中,更包括:根據該些亮度值與對應的該些出現次數計算該臨界亮度值。For example, the histogram-based contrast enhancement method of claim 1, wherein in the step of determining whether the current brightness value is less than the critical brightness value, the method further includes: calculating the threshold according to the brightness values and the corresponding number of occurrences. Brightness value. 如請求項5之基於直方圖調整的對比增強方法,其中,於計算該臨界亮度值的步驟中,更包括:加總每一該亮度值與對應的該出現次數相乘的結果以產生一累計值;以及將該累計值除以加總該些出現次數的結果以產生該臨界亮度值。For example, the histogram-based contrast enhancement method of claim 5, wherein in the step of calculating the critical brightness value, the method further comprises: adding up a result of multiplying each brightness value by a corresponding number of occurrences to generate a cumulative A value; and a result of dividing the accumulated value by adding the occurrences to generate the critical brightness value. 如請求項1之基於直方圖調整的對比增強方法,其中,於混合對應的該第一輸出值與對應的該第二輸出值的步驟中,更包括:根據該目前亮度值與該臨界亮度值計算一第一權重比例與一第二權重比例,且該第一權重比例與該第二權重比例的總和為1;以及混合該第一權重比例的該第一輸出值與該第二權重比例的該第二輸出值,以產生該目前亮度值對應的該亮度輸出值。For example, the histogram-based contrast enhancement method of claim 1, wherein the step of mixing the corresponding first output value and the corresponding second output value further includes: according to the current brightness value and the critical brightness value Calculating a first weight ratio and a second weight ratio, and a sum of the first weight ratio and the second weight ratio is 1; and mixing the first output value of the first weight ratio with the second weight ratio The second output value is used to generate the brightness output value corresponding to the current brightness value. 如請求項7之基於直方圖調整的對比增強方法,其中,於計算該第一權重比例與該第二權重比例的步驟中,更包括:將該目前亮度值除以該臨界亮度值以產生該第一權重比例;以及將1減去該第一權重比例以產生該第二權重比例。For example, the contrast enhancement method based on histogram adjustment of claim 7, wherein in the step of calculating the first weight ratio and the second weight ratio, the method further includes: dividing the current brightness value by the critical brightness value to generate the A first weighting ratio; and subtracting the first weighting ratio from 1 to produce the second weighting ratio. 一種基於直方圖調整的對比增強裝置,用以增強一輸入影像的對比度,且該對比增強裝置包括:一影像擷取器,接收該輸入影像,並依序擷取該輸入影像中每一個像素位置的一輸入亮度值;以及一影像處理器,電連接該影像擷取器,且用以執行下列步驟:接收該輸入影像中的每一該輸入亮度值;將每一該輸入亮度值的一出現次數對應到一直方圖上的複數個亮度值;增強小於一預設亮度值的該至少一亮度值對應的該出現次數,且每一該亮度值對應到一更新出現次數;依序累加每一該出現次數以產生一第一累加曲線,且依序累加每一該更新出現次數以產生一第二累加線條,其中該第一累加曲線代表該些亮度值與該些出現次數的關係,且該第二累加曲線代表該些亮度值與該些更新出現次數的關係;根據該些亮度值的一動態範圍將累加後的該些出現次數進行一全域映射以分別產生一第一輸出值,且根據該些亮度值的該動態範圍將累加後的該些更新出現次數進行該全域映射以分別產生一第二輸出值;以及依序於每一該亮度值中判斷一目前亮度值是否小於一臨界亮度值,若該目前亮度值小於該臨界亮度值,根據該臨界亮度值混合(blending)對應的該第一輸出值與對應的該第二輸出值以產生一亮度輸出值,且若該目前亮度值大於等於該臨界亮度值,將對應的該第一輸出值作為該亮度輸出值。A contrast enhancement device based on histogram adjustment is used to enhance the contrast of an input image, and the contrast enhancement device includes: an image capturer, receiving the input image, and sequentially capturing each pixel position in the input image An input brightness value; and an image processor, which is electrically connected to the image capture device, and is used to perform the following steps: receiving each of the input brightness values in the input image; and generating one occurrence of each of the input brightness values. The number of times corresponds to a plurality of brightness values on the histogram; the number of occurrences corresponding to the at least one brightness value that is less than a preset brightness value is enhanced, and each of the brightness values corresponds to an updated number of occurrences; each is sequentially accumulated The number of occurrences generates a first accumulation curve, and each of the update occurrences is sequentially accumulated to generate a second accumulation line, wherein the first accumulation curve represents a relationship between the brightness values and the occurrences, and the The second accumulation curve represents the relationship between the brightness values and the number of occurrences of the updates; the accumulated times are counted according to a dynamic range of the brightness values. A global mapping to generate a first output value separately, and performing the global mapping on the accumulated update occurrences according to the dynamic range of the luminance values to generate a second output value separately; and sequentially to each The brightness value determines whether a current brightness value is less than a critical brightness value. If the current brightness value is less than the critical brightness value, the corresponding first output value and the corresponding second output are blended according to the critical brightness value. Value to generate a brightness output value, and if the current brightness value is greater than or equal to the critical brightness value, the corresponding first output value is used as the brightness output value. 如請求項9之基於直方圖調整的對比增強裝置,其中,每一該輸入亮度值以n位元表示,且該直方圖上的該些亮度值有2的n次方個。For example, the histogram-based contrast enhancement device according to claim 9, wherein each of the input brightness values is represented by n bits, and the brightness values on the histogram are 2 to the power of n.
TW107100653A 2018-01-08 2018-01-08 Contrast enhancement method and apparatus thereof based on histogram adjustment TWI676962B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW107100653A TWI676962B (en) 2018-01-08 2018-01-08 Contrast enhancement method and apparatus thereof based on histogram adjustment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107100653A TWI676962B (en) 2018-01-08 2018-01-08 Contrast enhancement method and apparatus thereof based on histogram adjustment

Publications (2)

Publication Number Publication Date
TW201931302A TW201931302A (en) 2019-08-01
TWI676962B true TWI676962B (en) 2019-11-11

Family

ID=68315691

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107100653A TWI676962B (en) 2018-01-08 2018-01-08 Contrast enhancement method and apparatus thereof based on histogram adjustment

Country Status (1)

Country Link
TW (1) TWI676962B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0664038B1 (en) * 1992-02-18 2000-10-11 Neopath, Inc. Method for identifying objects using data processing techniques
TWI563473B (en) * 2013-07-08 2016-12-21 Lei Wang
TWI591583B (en) * 2016-04-13 2017-07-11 瑞昱半導體股份有限公司 Image contrast enhancement method and apparatus thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0664038B1 (en) * 1992-02-18 2000-10-11 Neopath, Inc. Method for identifying objects using data processing techniques
TWI563473B (en) * 2013-07-08 2016-12-21 Lei Wang
TWI591583B (en) * 2016-04-13 2017-07-11 瑞昱半導體股份有限公司 Image contrast enhancement method and apparatus thereof

Also Published As

Publication number Publication date
TW201931302A (en) 2019-08-01

Similar Documents

Publication Publication Date Title
CN109936698B (en) Automatic exposure control method and device, electronic equipment and storage medium
JP5095290B2 (en) Shadow region compensation method, medium and system
KR101128454B1 (en) Method and apparatus for contrast enhancement
CN107680056B (en) Image processing method and device
CN105407296B (en) Real-time video enhancement method and device
KR101225058B1 (en) Method and apparatus for controlling contrast
TWI697867B (en) Metering compensation method and related monitoring camera apparatus
US9396526B2 (en) Method for improving image quality
JP5855224B2 (en) Image processing apparatus and method
JP6097588B2 (en) Image processing apparatus and image processing method
CN109982012B (en) Image processing method and device, storage medium and terminal
CN110223244B (en) Image processing method and device, electronic equipment and storage medium
US8401291B2 (en) Image processing that improves contrast in light and dark portions of an image
CN112019762A (en) Video processing method and device, storage medium and electronic equipment
CN112541868A (en) Image processing method, image processing device, computer equipment and storage medium
CN108961209B (en) Pedestrian image quality evaluation method, electronic device and computer readable medium
CN1305317C (en) Image brightness correcting method of video monitoring system
CN114666512A (en) Adjusting method and system for rapid automatic exposure
US20130287299A1 (en) Image processing apparatus
TWI676962B (en) Contrast enhancement method and apparatus thereof based on histogram adjustment
CN109639929A (en) Image denoising method, computer installation and computer readable storage medium
CN110049225B (en) Contrast enhancement method and device based on histogram adjustment
TWI727306B (en) Contrast adjustment system and contrast adjustment method
Jang et al. Adaptive contrast enhancement using edge-based lighting condition estimation
CN112839180B (en) Exposure control method and device, image acquisition equipment and intraoral scanner