TW201032578A - Method for enhancing image contrast - Google Patents

Method for enhancing image contrast Download PDF

Info

Publication number
TW201032578A
TW201032578A TW98104831A TW98104831A TW201032578A TW 201032578 A TW201032578 A TW 201032578A TW 98104831 A TW98104831 A TW 98104831A TW 98104831 A TW98104831 A TW 98104831A TW 201032578 A TW201032578 A TW 201032578A
Authority
TW
Taiwan
Prior art keywords
image
color
pixels
total number
value
Prior art date
Application number
TW98104831A
Other languages
Chinese (zh)
Inventor
Cheng-Jung Chen
Yung-Shiang Lu
Yung-Chan Lee
Original Assignee
Chi Mei Optoelectronics 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 Chi Mei Optoelectronics Corp filed Critical Chi Mei Optoelectronics Corp
Priority to TW98104831A priority Critical patent/TW201032578A/en
Publication of TW201032578A publication Critical patent/TW201032578A/en

Links

Landscapes

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

Abstract

A method for enhancing contrast of an image is provided herein. The method includes the following steps of: counting a first number of pixels of each gray level in the image; obtaining a number of none zero gray levels according to the first numbers; calculating a first threshold value according to the number of none zero gray levels and information of the image; converting the first numbers to second numbers according to the first threshold value; performing a Luminance Histogram Equalization (LHE) process of the image according to the second numbers so as to obtain a first gamma curve; obtaining a color characteristic value of each color of the image; tuning the first gamma curve to a second gamma curve according to the minimum of the color characteristic values; and matching the RGB color signals of the image with the second gamma curve so as to acquire a new image.

Description

201032578 P080365SSZ1TW 28724twf.doc/n 六、發明說明: 【發明所屬之技術領域】 本發明是有關於一種提升影像對比度的方法,且特 別是有關於可根據每一張影像的特性,而給予適當的對 比增強之提升影像對比度的方法。 【先前技術】 影像處理(image processing)是把影像資訊做顏色、明201032578 P080365SSZ1TW 28724twf.doc/n VI. Description of the Invention: [Technical Field] The present invention relates to a method for improving image contrast, and in particular to giving appropriate contrast according to the characteristics of each image. Enhanced ways to increase image contrast. [Prior Art] Image processing is to color image information.

暗度等等各種影像晝面的改變。隨著人們對於數位影像 品質的要求愈來愈高’數位影像處理技術的進步也大幅 成長許多。不管對於過暗或過亮的影像,只要經過適當 的影像處理,就能提升數位影像之對比度(Contrast)、亮 度(Brightness)與色彩飽和度(Saturation)·..等。 目刖常見的提升影像對比度的方法為利用直方圖均 勾化(Histogram Equalization)技術,其中直方圖均勻化技 術=增強影像對比度,同時也可以調整影像亮度。簡單 ,說,直方圖均勻化就是重新分配整個影像所有晝素的 亮f值,使整個影像的亮度與對比得到更平均的分配。 ^之’直方圖等化技術可以讓原本偏暗或偏亮的影像 =到較正常的色階。例如過暗的影像,使用直方圖等化 後可以得到較多亮部晝素;反之過亮 圖等化後可以得到較多暗部晝素。 豕便用1万 然而 ®句勻化技術在處理能量過於集中的影 ^ ^發生灰階不連續的情況’使得影像失真率提高。 卜’备以直方圖均勻化技術處理完影像之後,影像的 3 201032578 P〇80365SSZlTW28724twf.doc/n 色度、飽和度…等色彩資訊會與原本的影像有很大的差 異,而使直方圖均勻化後的影像嚴重地失真。 【發明内容】 、、有,於此,本發明提供一種提升影像對比度的方 法其猎由臨界值來調整直方圖均勻化過程中灰階對應 的像素總數,避免灰階不連續的情形發生,以提高影^ 的對比度。 鲁 另外’本發明另提供一種提升影像對比度的方法, 其用以調整直方圖均勻化法的強度,避免灰階不連續的 情形發生,提高影像的對比度。 再者,本發明另提供一種影像處理的方法,藉由提 升影像的色彩飽和度,以在提高影像的對比度的同時, 使其影像更加鮮豔。 為達成上述及其他目的,本發明提出一種提升影像 對比度的方法,其步驟包括:依據影像的亮度資訊,統 ⑩ 叶影像中每一灰階的第一像素總數Nj ,其中Nj為影像中 灰P自值專於j的像素之總數,j為不大於L的整數;並且 根據所統計的每一灰階的第一像素總數Nj,求得影像的 —非零統計量灰階數q ·’接下來根據非零統計量灰階數q 以及影像的資訊,計异出一臨界值s;接著依據臨界值s 以及每一灰階的第一像素總數Ν〗,求得每一灰階的一第 二像素總數Ni ’其中i為不大於L的整數,當Nj>S時, Ni=S ’而當NjSS時,NfNj ;依據所求得的每一灰階的 弟一像素總數Ni ’對影像進行一亮度直方圖均勻化 201032578 P080365SSZ1TW 28724twf.doc/n (Luminance Histogram Equalization,LHE)程序,以獲得 具有珈瑪曲線的影像;接著根據影像的像素總數p和預 定灰階數L,以決定一灰階分佈平均值ul ;統計影像中 母一顏色的次像素於每一灰階的次像素總數Nj(c),其中 變數c表示次像素所對應的顏色,Nj(c)表示當次像^所 對應的顏色為C時,其灰階值等於j的次像素之總數;依 據-外部參數St、彡像的像素缝p、灰階分佈平均值 U以及每一顏色的次像素於每一灰階的次像素總數,計 算出每-顏色所對應的顏色特徵值;以及依據所計算的 各顏色特徵值當中的最小值,調整珈瑪曲線。 本發明提出另-種提升影騎比度的方法,其步驟 包括.統計影像中每-灰階的第一像素總數叫,其中N 為影像中緖值等於j的像素之總數,』為不大於[的^ 數;依據臨界值s以及每一灰階的第—像素總數n =每:灰階的第二像素總數Ni,其中i為不大於l的整 數’當Nj>S時’ N产S,而當N# S時,N二N.; 所求得的每-灰階的第二像素總數^,對影]像二袁 度直方圖羽化料,以提升影像的對比度。 & 另外,本發明另一種提升影像對比度^方法,盆牛 根據影像的像素總數p和預定灰階數l,計;二 灰Μ佈平均值ul ;統計影像中每—顏色的 次^數⑻’其中變數C表示次像素所j #次像素所對應的顏色為c時,並 的次像素之總數,j為不大於£的整數.接 者依據外部參數st、影像的像素總數p、灰階分 5 SSZlTW28724twf.doc/n 201032578 jl ill以及每一顏色的次像素於每一灰階的次像素總數,計 算出每-顏色所對應的顏色特徵值;以及依據所計算的 各顏色特徵值當中的最小值,調整影像的珈瑪曲線。 在本發明之-實施射,上述方法更包括:根據所 統計的每-灰階的第-像素總數Nj,求得影像的非零統 言:量灰階數q;以及根據非零統計*灰階數(1以及影像的 Μ訊’计鼻出所述的臨界值s。 在本發明之-實施财,上狀提料彡像對比度的 方法’其t非零断量㈣數q #於狀灰_ L減去 影像中對應的第一像素總數Nj為零的灰階之總數。 在本發明之一實施例中,上述之提升影像對比度的 方法,其中影像的資訊包括影像的解析度以及預定灰階 數L。 在本發明之一實施例中,上述之提升影像對比度的 方法’其中臨界值s等於ux i+i ,而u=£ L q_l 叩 qDarkness and other changes in various images. As people's requirements for digital image quality become higher and higher, the progress of digital image processing technology has also grown considerably. Regardless of the image that is too dark or too bright, the contrast (Contrast), brightness (Brightness), and color saturation (Saturation) of the digital image can be improved by appropriate image processing. A common way to improve image contrast is to use histogram equalization, where histogram equalization technique = enhanced image contrast and image brightness. Simple, say, histogram homogenization is to redistribute the bright f-values of all the elements of the entire image, so that the brightness and contrast of the entire image are more evenly distributed. The ^' histogram equalization technique can make the originally darker or brighter image = to a more normal color gradation. For example, if the image is too dark, more of the bright parts can be obtained by using the histogram, and the dark part can be obtained after the equalization. I used 10,000. However, the sentence homogenization technique is used to deal with the case where the energy is too concentrated, and the gray-scale discontinuity occurs. After the image is processed by the histogram homogenization technique, the color information of the image 3 201032578 P〇80365SSZlTW28724twf.doc/n color, saturation, etc. will be greatly different from the original image, and the histogram will be evenly distributed. The resulting image is severely distorted. SUMMARY OF THE INVENTION The present invention provides a method for improving the contrast of an image. The hunting value is used to adjust the total number of pixels corresponding to the gray scale in the process of homogenizing the histogram, so as to avoid the occurrence of gray scale discontinuity. Improve the contrast of the shadow ^. The invention further provides a method for improving image contrast, which is used to adjust the intensity of the histogram homogenization method, avoids the occurrence of gray scale discontinuity, and improves the contrast of the image. Furthermore, the present invention further provides a method of image processing by increasing the color saturation of an image to enhance the contrast of the image while making the image more vivid. In order to achieve the above and other objects, the present invention provides a method for improving image contrast, the method comprising: according to the brightness information of the image, the total number of first pixels Nj of each gray level in the image of the 10 leaves, wherein Nj is the gray P in the image. The total number of pixels whose value is specific to j, j is an integer not greater than L; and according to the counted total number of first pixels Nj of each gray level, the image - non-zero statistic gray scale number q · ' According to the non-zero statistic gray scale number q and the image information, a threshold value s is calculated; then, according to the threshold value s and the total number of first pixels of each gray scale Ν, a gray scale is obtained. The total number of two pixels Ni 'where i is an integer not greater than L, when Nj > S, Ni = S ' and when NjSS, NfNj; according to the obtained total number of pixels of each gray level Ni 'image A luminance histogram homogenizes the 201032578 P080365SSZ1TW 28724twf.doc/n (Luminance Histogram Equalization, LHE) program to obtain an image with a gamma curve; then determines a gray scale based on the total number of pixels p of the image and the predetermined number of gray levels L Distribution mean ul; The total number of sub-pixels of the parent-color sub-pixel in the gray image is Nj(c), wherein the variable c represents the color corresponding to the sub-pixel, and Nj(c) represents that the color corresponding to the sub-image is C. , the grayscale value is equal to the total number of sub-pixels of j; according to the external parameter St, the pixel slit p of the 彡 image, the average value U of the gray scale distribution, and the sub-pixel of each color in the total number of sub-pixels of each gray scale, The color feature values corresponding to each color are selected; and the gamma curve is adjusted according to the minimum value among the calculated color feature values. The present invention proposes another method for improving the ratio of the shadow ride, the steps of which include: the total number of first pixels per gray scale in the statistical image, where N is the total number of pixels in the image whose value is equal to j, 』 is not greater than [^^; according to the critical value s and the total number of pixels of each gray level n = per: gray total number of second pixels Ni, where i is an integer not greater than l 'Nj> S when 'N production S And when N# S, N two N.; the total number of second pixels per gray-scale obtained, and the image is like a two-dimensional histogram feathering material to enhance the contrast of the image. In addition, another method for improving the image contrast method of the present invention is based on the total number of pixels p of the image and the predetermined number of gray levels l; the average value of the two gray ash cloths; the number of times each color of the statistical image (8) 'Where the variable C indicates the total number of sub-pixels when the color corresponding to the j-th pixel of the sub-pixel is c, and j is an integer not greater than £. The receiver depends on the external parameter st, the total number of pixels of the image p, gray scale 5 SSZlTW28724twf.doc/n 201032578 jl ill and the sub-pixel of each color in the total number of sub-pixels of each gray level, calculate the color feature value corresponding to each color; and according to the calculated color characteristic values Minimum value, adjust the gamma curve of the image. In the present invention, the method further comprises: obtaining a non-zero generalization of the image according to the counted total number of pixels Nj per gray scale: a gray level q; and according to a non-zero statistic * gray The order (1 and the image of the image) counts out the critical value s. In the method of the present invention, the method of extracting the image contrast is as follows: its t non-zero breaking amount (four) number q # The gray _L subtracts the total number of gray scales corresponding to the total number of first pixels Nj in the image. In one embodiment of the present invention, the method for improving image contrast, wherein the image information includes image resolution and predetermined Gray scale number L. In one embodiment of the invention, the above method for increasing image contrast 'where the critical value s is equal to ux i+i , and u=£ L q_l 叩 q

在本發明之一實施例中’上述之提升影像對比度的In an embodiment of the invention, the above image contrast is improved

方法,ul=I L 在本發明之一實施例中,上述之提升影像對比度的 方法,其中計算出每一顏色所對應的顏色特徵值包括: ,據灰階分佈平均值Ul以及影像中每一顏色的次像素於 每一灰階的次像素總數,計算出每一顏色所對應的溢出 值,依據外部參數St、影像的像素總數p、灰階分佈平均 值ul以及每一顏色所對應的溢出值,計算出每一顏色所 6 201032578 P080365SSZ1TW 28724twf.doc/n 對應的顏色特徵值。 在本發明之―實施财,上述之提升f彡像對比度的 方法,其中顏色C所對應之溢出值等於|細制,當顺) W時,—G,而當Nj⑹>ul時,△邮)等於⑽) —ul)。 在本發明之-實施财,上述之提升影像對比度的 b-, 甘士 含 方法,其中顏色C戶斤料 斤對應的顏色特徵值等於Method, ul=IL In an embodiment of the present invention, the method for improving image contrast, wherein calculating a color feature value corresponding to each color comprises:, according to a grayscale distribution average U1 and each color in the image The sub-pixel is calculated by the total number of sub-pixels of each gray level, and the overflow value corresponding to each color is calculated according to the external parameter St, the total number of pixels of the image p, the gray-scale distribution average ul, and the overflow value corresponding to each color. Calculate the corresponding color eigenvalues for each color 6 201032578 P080365SSZ1TW 28724twf.doc/n. In the invention of the present invention, the above method for improving the contrast of the image, wherein the overflow value corresponding to the color C is equal to | fine, when 顺), -G, and when Nj(6)>ul, △ mail) Equal to (10)) —ul). In the present invention, the b-, gay-containing method for improving the contrast of the image, wherein the color characteristic value corresponding to the color C is equal to

St v P-ulSt v P-ul

I q(c)xst) L ,而 q(c)= 2^ANj(c)。 j=〇 方法在二:提升影像對比度的 色的三個次料 ^有刀別對應至紅色、綠色和藍 方'去在實施例中,上述之提升影像對比度的 t:=,rRGB色彩空間轉換至爾 階㈣—像素數目%係依據影 像轉換至YUV色彩空間後的γ資訊統計而得。 在本發狀-實施例巾,上述之提升影像對比度的 ^法,其中每-灰階的第—像素數目&係依據影像於 B色彩空間的紅色色彩資訊r、綠色色彩資訊〇和藍 色色彩資訊B當中的一色彩資訊統計而得。 、因此,本發明提供一種提升影像對比度的方法,其 合併調整直方圖均勻化法的強度以及設定色彩飽和度的 限制’避免灰階不連續的情形發生,以提高影像的對比 7 201032578 j. uov/^^^SSZlTW 28724twf.doc/n 度。 為讓本發明之上述特徵和優點能更明顯易懂,下文 特舉較佳實施例,並配合所附圖式,作詳細說明如下。 【實施方式】 第一實施例 圖1為根據本發明一實施例之提升影像對比度的方 法流程圖。請參照圖1,首先在步驟S11〇中,會操收一 • 原始影像’該原始影像具有總數為P的像素(pixels),並且 以一預定灰階數L·顯示,其中L為正整數。接著在步驟 S120中,會將原始影像由RGB色彩空間轉換至γυν色 彩空間,其中“γ”表示明亮度(Luminance),而“U”和“V”則分 別代表色度(Chrominance)和彩度(Chroma)。接著在步驟S130 中,根據明売度“Y”資訊統計影像中每一灰階的第一像素總 數Nj以建立原始影像的第一直方圖,其中表示原始影像 中灰階值等於j的像素之總數,j為不大於[的整數。接下 鲁 來以圖2來舉例說明上述原始影像的第一直方圖。在圖2 中,為方便說明,假設原始影像可顯示第i階至第1〇階的 灰階’亦即原始影像的預定灰階數L為1G階。當然,預定 灰階數LJi不以此為限’在本發明的無實關巾,預定灰 階數L可岐其他的正錄,例如預定鏡數L可以是256, 用以表不0至共256階的灰階。此外,本實施例中,原 始影像的像素總個數P為100個,換句話說其解析度為1〇〇 像素。每個灰階所對應的第—像素總數^則如圖2所示,其 中Nj為灰階值等於j的第—像素總數,例如灰階值等於4的 8 201032578 P080365SSZlTW28724tWf.doc/n 第-像素總數&等於8、灰階值等於7的第一像素 等於35。 、'默 以下說明請合併參照圖丨與圖2。在步驟814〇令, 圖2之第一像素總數Nj以獲得非零統計量灰階數所= 非零統計量灰_ q也就是預定灰· L減去影像= 應的第像素總數叫為零的灰階之總數。以本實国 2為例’圖2之第i灰階與第1G灰階其對應的第—像= 總^:N々Ni〇為零,而預定灰階數[為1〇,因此纪 什里灰階數q則為10_2=8。接下來在步驟sl5〇中,= 非零統計量灰階數q與原始影像的資訊,推算臨界值κ據 在本發明的—實關巾,臨界值8之方程式表示如下: I '·— q S = ux 1 + ^中/表示_斜好喊,零統計 階數。上述的非零統計量平均值w U —- q 素總i中’q表紳料計量灰_,p絲影像的/ =以’在本實施例中’由於像素總數為⑽ 階,則非零統計量平均 在本實施例中,預定灰階數1為1〇階, 平均值u為12.5 ’而非零統計量灰階數q則“階°, 201032578 r^oujojoSZlTW 28724twf.doc/n 以S =12.5*[l+(10/8)卜28.125,四掩五入後,獲得臨界值 S為28。另外,上料算臨界值s的過程也可以不透過 非零統計量平均值u,直接由非零統計量灰階數q、影像 解析度以及預定灰階值L來計算臨界值s。 接下來在步驟S16G巾,會依據第—像素總數 及6a界值S推#出第二直方圖,其方法為當第一像素總 數N」若超過臨界值S,則將該第一像素總數^下修至臨 界值S’而若是灰階所對應的第—像素總數^未超過臨 • 界值S ’則像素個數保持不變。換句話說,假設修改後的 像素總數為第二像素總數Ni,則Nj>s時,风=!§,而當 ^S時’ NrNj ’其巾i為不大於L的整數。藉此依據 第-直方圖(圖2)與臨界值S以獲得第二直方圖。例如本 實施例所計算出的臨界值s為28,而第一直方圖之灰階 值等於7之第-像素總數n7=35,而灰階值科8之第一 像素總數33,皆超過臨界值s,所以第7階與第8階的 第-像素總數則被下修至28,而其餘像素總數低於臨界 ❹ 值s則保持不變,修改後所獲得的第二直方圖則如圖3 所示。 接著在步驟S170中,依據所求得的每一灰階的第二 像素總數凡,對原始影像進行一亮度直方圖均勻化 /Luminance Histogram Equalization, LHE)程序,以提升 -亥衫像的對比度。詳言之,在步驟sl7〇中,上述的第二 直:圖會,均勻化,以更新γ資訊,進而取得更新後的 Y = 5fl。最後在步驟S180中,將更新後的Y,資訊與u、 V為δί1轉換至新的色彩資訊R,、G'、B',而獲得一對比度 201032578 腦允观 1TW28724twfd〇c/n 較南的新影像。 圖,⑷域VO,圖4_原始影像的直方 後^方圖原始影像經由習知直方圖均勻化技術處理 而圖4(C)為原始影像經由本發明方法處@ 相較圖,與圖4(〇可以發現= 參 狀、xi嚴,谈域理韻直方圖,其灰随不連續的 :由本發明方法處理後的直方圖由於利用 ’因此幾乎沒有灰階不連續的狀況發生。 利用明上述建立原始影像之第—直方圖的步驟為 冗&來執行,然而在本發明的其他實施例中 或ΪΓϊί該影像於RGB色彩空間的紅色色 /貝 a色彩資讯G和藍色色彩資訊B當中的一 f:彩資訊崎而取得第—直方圖。統計舞統計量灰階 數q的細部方法可參照下列流程圖示與說明。 ❹ ㈣請5’圖5為取得非零統計量灰階數的方法流 私圖。在本H施例中,晝面的最低灰階設定為0。如圖5 所示,首先在频S41G巾,開料料零輯量灰階數 q時,先將非零統計量灰階Sq與灰階j歸零。接下來在 步驟s43〇中,判斷像素總數Nj是否等於 數Nj大於零,則進行步驟剛,以將非零_量=: q加上1 ’反之,若是像素總數β不大於零,則進行步驟 S450,以判斷灰階數j是否等於預定灰階數l,若是灰階 ^數J不等於預定灰階數L,則進行步驟S42〇,以將目 前的灰階j加上卜再重複步驟S430至S45〇,逐一增加 灰階階數i ;反之,若是灰階階數i等於預定灰階數【, 11 201032578 P080365SSZ1TW 2S724twf.doc/n 則結束運算獲得非零統計量灰階數q。 第二實施例 圖6為根據本發明另—實施例之提升影像對比度的 方法流程圖。請參照圖6,首先在步驟S510中,會接收 一原始影像,該影像具有總數為P的多個像素,且每一 像素包含有對應不同顏色的多個次像素(sub_pixel),上述 顏色可以為紅色R、綠色G與藍色B,且每個次像素以 一預定灰階數L·顯示’P和l為正整數。接著在步驟S52〇 • 中,會分析所接收到的影像,以獲得影像於RGB色彩空 間的畫面資料,並計算出灰階分佈平均值ul。其中灰階 分佈平均值ul之方程式可以表示如下: ul = ~I q(c)xst) L , and q(c)= 2^ANj(c). j=〇 method in two: three colors of the color of the image contrast enhancement ^ there is a knife corresponding to the red, green and blue squares 'in the embodiment, the above t:=, rRGB color space conversion to enhance image contrast To the order (4) - the number of pixels is based on the gamma statistics after the image is converted to the YUV color space. In the hair style-implementation towel, the above method for improving image contrast, wherein the number of pixels per gray-scale is based on red color information r, green color information, and blue of the image in the B color space. A color information in the color information B is statistically derived. Therefore, the present invention provides a method for improving the contrast of an image, which combines the intensity of the histogram equalization method and the limitation of setting the color saturation to avoid the occurrence of gray-scale discontinuities to improve the contrast of the image 7 201032578 j. uov /^^^SSZlTW 28724twf.doc/n degrees. The above described features and advantages of the present invention will be more apparent from the following description. [Embodiment] FIG. 1 is a flowchart of a method for improving image contrast according to an embodiment of the present invention. Referring to Figure 1, first in step S11, an original image is taken. The original image has a total of pixels P (pixels) and is displayed with a predetermined gray level L·, where L is a positive integer. Next, in step S120, the original image is converted from the RGB color space to the γυν color space, where “γ” represents Luminance, and “U” and “V” represent Chrominance and chroma, respectively. (Chroma). Next, in step S130, a first histogram of the original image is established according to the total number of first pixels Nj of each gray level in the image of the "Y" information, wherein the pixel of the original image with a grayscale value equal to j is represented. The total number, j is an integer not greater than [. Next, Lu will use FIG. 2 to illustrate the first histogram of the original image. In Fig. 2, for convenience of explanation, it is assumed that the original image can display the gray level of the ith order to the first order, that is, the predetermined gray level L of the original image is 1G order. Of course, the predetermined gray scale number LJi is not limited thereto. In the non-realistic towel of the present invention, the predetermined gray scale number L may be other positive recordings, for example, the predetermined mirror number L may be 256, to represent 0 to a total of Gray scale of 256 steps. Further, in the present embodiment, the total number P of pixels of the original image is 100, in other words, the resolution is 1 像素 pixel. The total number of pixels corresponding to each gray level is as shown in FIG. 2, where Nj is the total number of pixels of the grayscale value equal to j, for example, the grayscale value is equal to 4, 201032,078, P080365SSZlTW28724tWf.doc/n, the first pixel The total number & equal to 8, the first pixel with a grayscale value equal to 7 is equal to 35. , 'The following description, please refer to the figure 丨 and Figure 2. In step 814, the total number of first pixels Nj of FIG. 2 is obtained to obtain a non-zero statistic gray scale number = non-zero statistic gray _ q is the predetermined gray · L minus image = the total number of pixels to be called is zero The total number of gray levels. Take this real country 2 as an example. The i-th gray scale of Fig. 2 corresponds to the first image of the 1G gray scale. The total ^:N々Ni〇 is zero, and the predetermined gray scale number is [1, so Ji Shi The gray order q is 10_2=8. Next, in step s1, 〇, = non-zero statistic gray scale q and the original image information, the estimated critical value κ is according to the present invention - the critical value of the equation 8 is expressed as follows: I '· - q S = ux 1 + ^ Medium / indicates _ oblique yell, zero statistical order. The above-mentioned non-zero statistic mean w U --- q total i in the 'q table 计量 计量 gray _, p 影像 image / = in 'in this embodiment' because the total number of pixels is (10), then non-zero The statistic average is in this embodiment, the predetermined gray scale number 1 is 1 〇 order, the average value u is 12.5 ′ instead of the zero statistic gray scale number q, then “order°, 201032578 r^oujojoSZlTW 28724twf.doc/n to S =12.5*[l+(10/8)卜28.125, after the four masks are entered, the critical value S is obtained as 28. In addition, the process of calculating the critical value s may not pass through the non-zero statistic mean u, directly by The non-zero statistic gray scale number q, the image resolution, and the predetermined gray scale value L are used to calculate the critical value s. Next, in step S16G, the second histogram is pushed according to the total number of pixels and the 6a boundary value S. The method is that if the total number of first pixels N" exceeds the critical value S, the total number of the first pixels is reduced to the critical value S', and if the total number of pixels corresponding to the gray level does not exceed the threshold value S 'The number of pixels remains the same. In other words, assuming that the total number of modified pixels is the total number of pixels of the second pixel Ni, then Nj>s, wind = !§, and when ^S, 'NrNj', the towel i is an integer not greater than L. Thereby, the second histogram is obtained according to the first histogram (Fig. 2) and the threshold S. For example, the threshold s calculated by the embodiment is 28, and the gray level value of the first histogram is equal to the total number of pixels of the seventh pixel n7=35, and the total number of the first pixels of the grayscale value branch 8 is more than 33. The critical value s, so the total number of pixels of the 7th and 8th orders is revised down to 28, while the total number of remaining pixels below the critical threshold s remains unchanged, and the modified second histogram is as follows. Figure 3 shows. Next, in step S170, a Luminance Histogram Equalization (LHE) program is performed on the original image according to the obtained total number of second pixels of each gray scale to improve the contrast of the image. In detail, in step s17, the second straight: graph will be homogenized to update the gamma information, and then the updated Y = 5fl. Finally, in step S180, the updated Y, the information and u, V are δί1 are converted to the new color information R, G', B', and a contrast is obtained 201032578. The brain is allowed to be 1TW28724twfd〇c/n. New image. Figure 4, (4) domain VO, Figure 4 _ original image of the square image of the original image is processed by the conventional histogram homogenization technique and Figure 4 (C) is the original image by the method of the present invention, compared with the figure, and Figure 4 (〇 can be found = parametric, xi strict, talk domain rhyme histogram, its gray with discontinuity: the histogram processed by the method of the present invention due to the use of 'so there is almost no gray-scale discontinuity. The step of establishing the first histogram of the original image is performed in redundancy & however, in other embodiments of the invention or in the red color/bea color information G and blue color information B of the image in the RGB color space The first part of the f: color information is obtained by the histogram. The detailed method of the statistical dance statistic gray number q can be shown and explained with reference to the following flow chart. ❹ (4) Please 5' Figure 5 is to obtain non-zero statistic gray scale The method of the number flow is private. In the example of H, the lowest gray level of the face is set to 0. As shown in Fig. 5, first of all, in the frequency S41G towel, when the material is zero, the gray number q is first The non-zero statistic gray scale Sq and the gray scale j return to zero. Next in step s43 If it is determined whether the total number of pixels Nj is equal to the number Nj is greater than zero, then step is performed to add non-zero_quantity=:q to 1'. If the total number of pixels β is not greater than zero, step S450 is performed to determine the grayscale number j. Whether it is equal to the predetermined gray scale number l, if the gray scale number J is not equal to the predetermined gray scale number L, then step S42 is performed to add the current gray scale j to the step S430 to S45, and then increase the gray scale one by one. The order i; on the other hand, if the gray level order i is equal to the predetermined gray level number [, 11 201032578 P080365SSZ1TW 2S724twf.doc/n, the end operation obtains a non-zero statistic gray scale number q. Second Embodiment FIG. 6 is a diagram according to the present invention. In another embodiment, a method for improving image contrast is shown in FIG. 6. First, in step S510, an original image is received, the image having a plurality of pixels of total P, and each pixel includes a corresponding color. a plurality of sub-pixels (sub_pixel), the above colors may be red R, green G and blue B, and each sub-pixel displays 'P and l as a positive integer with a predetermined gray level L·. Then in step S52〇 • In, will analyze the received image To obtain the image data on a screen between the RGB color space, and calculate the average gray level distribution equation ul wherein the gray level mean of the distribution can be expressed as follows ul:. Ul = ~

L 其中P表示影像的像素總數,L表示預定灰階數。在 本貝施例中,為方便說明,假設原始影像可顯示第i階 t第10階的灰階,亦即原始影像的預定灰階數匕為10 • 階。當然,預定灰階數L·並不以此為限。此外,本實施例中, 原始影像的像素總個數P為100個,亦即原始影像的解析度 為1〇〇像素。因此,本實施例中,灰階分佈平均值ul為 100/10=10 接著分別要對r、G、B三個色彩資訊進行運算,首 先以紅色色彩資訊R作為運算過程的例子。在獲得紅色 色=寊訊R後,則在步驟s53〇中,統計紅色色彩資訊R 的夂^素於每—灰階的次像素總數Nj(r)而建立R直方 圖其中次像素總數Nj(r)之r表示紅色色彩資訊R,Nj 12 201032578 P080365SSZ1TW 28724twf.doc/n 總數 表不紅色色彩資訊R中灰階值等於j的次像素之繼取' 假5史所建立的R直方圖如圖7所示,用以表系紅色的次 像素總數Nj(r),例如N4(r)=6,N6(r)=28。接著在少驟S531 中,根據R直方圖與灰階分佈平均值U1取得紅色溢出值 q(r)。紅色溢出值q(r)之方程式可以表示為: ΣΔΝ/γ) j=0 ❿ ❹ /、中,g Nj(r)Sul 時,△N/r—o ,而當 Nj(r)>ul 時,ANjO)等於(Nj(r)—ul)。 因此紅色溢出值q(r)g R直方圖中其每一灰階所對 應之像素餘舰灰階分佈平均值ul⑽素値之總 和。以圖7為例’在灰階分佈平均值ul等於1〇的情況 2其巾只有第6階灰階、第7階灰階與第8階灰階的 '、個數超過灰階分佈平均值ul,其值分別為π、與 。所以相較於灰階分佈平均值ul,第 個數超過18個,第7階灰心後心f P白及P白像素 灰p比夕徐^ 灰像素個數超過20,第8階 火h之像素個數超過22個, 18+2〇+22=60。 口此紅色溢出值q(r)為 佈平在步驟S532中,根據—外部參數st、灰階分 U1與紅色溢出值咖刀 上迷紅色特徵值rsp之方程式可以表示如下色特徵值邶 rsp = P-ul 其令,st表示為外部參數 表示為灰階分佈平均值,p /Of::抓色溢出值’ P表不影像的像素總個數。 13 201032578 P080365SSZ1TW 28724twf.doc/n 在本實施例設定外部參數(对)為4〇,所以紅色特徵值^叩 為40-[(60*40)/(10〇-1〇)] = ΐ3·33,再四捨五入後得紅色特 徵值rsp為13。 另外,計算綠色特徵值gSp的步驟S533〜S535與計算 藍色特徵值bsp的步驟S536〜S538皆相似於計算紅色= 徵值rsp的步驟S530〜S532。其中,只要將以綠色溢出值 q(g)與藍色溢出值q(b)取代紅色溢出值q(r),則可以獲得 綠色4寸徵值gsp與藍色特徵值bSp,而綠色特徵值gSp與 藍色特徵值之方程式表示如下: bsp = st-S^l P-ul gsp = St q{g)^st~P-ul 其中,q(g)表示為綠色溢出值,q(b)表示為藍色溢出 值’而綠色溢出值q(g)與藍色溢出值q(b)之方程式可以 分別表示為:L where P represents the total number of pixels of the image and L represents the predetermined number of gray levels. In the example of the present embodiment, for the sake of convenience, it is assumed that the original image can display the gray scale of the 10th order of the i-th order t, that is, the predetermined gray scale number of the original image is 10 • order. Of course, the predetermined gray level number L· is not limited thereto. In addition, in this embodiment, the total number P of pixels of the original image is 100, that is, the resolution of the original image is 1 〇〇 pixel. Therefore, in this embodiment, the average value ul of the gray scale distribution is 100/10=10, and then the three color information of r, G, and B are respectively calculated, and the red color information R is first used as an example of the calculation process. After obtaining the red color=寊 R R, in step s53 ,, the red color information R is counted in the total number of sub-pixels Nj(r) of each gray scale to establish an R histogram in which the total number of sub-pixels Nj ( r) r represents red color information R, Nj 12 201032578 P080365SSZ1TW 28724twf.doc/n The total number of tables is not red color information R in the gray level value is equal to the sub-pixel of j 'following the 5th history of the R histogram 7 shows the total number of sub-pixels Nj(r) used to represent red, for example, N4(r)=6, N6(r)=28. Next, in a small step S531, a red overflow value q(r) is obtained from the R histogram and the grayscale distribution average value U1. The equation of the red overflow value q(r) can be expressed as: ΣΔΝ/γ) j=0 ❿ ❹ /, medium, g Nj(r)Sul, △N/r-o, and when Nj(r)>ul When ANjO) is equal to (Nj(r) - ul). Therefore, the red overflow value q(r)g R is the sum of the average ul(10) primes of the gray-scale distribution of the pixel remaining in each of the gray levels in the histogram. Taking Figure 7 as an example, the case where the average value of the gray scale distribution ul is equal to 1〇2, the towel has only the sixth-order gray scale, the seventh-order gray scale and the eighth-order gray scale, and the number exceeds the gray-scale distribution average. Ul, the values are π, and. Therefore, compared with the average value ul of the gray scale distribution, the first number is more than 18, the 7th order gray heart back center f P white and P white pixel gray p 比 ^ ^ ^ gray pixel number exceeds 20, the 8th order fire h The number of pixels exceeds 22, 18+2〇+22=60. The red overflow value q(r) is the leveling in step S532. According to the equations of the external parameter st, the gray level sub-U1 and the red overflow value coffee knife, the red characteristic value rsp can represent the following color characteristic value 邶rsp = P-ul Let, st denotes that the external parameter is expressed as the average value of the gray scale distribution, and p /Of:: the scratch color overflow value 'P is the total number of pixels of the image. 13 201032578 P080365SSZ1TW 28724twf.doc/n In this example, the external parameter (pair) is set to 4〇, so the red characteristic value ^叩 is 40-[(60*40)/(10〇-1〇)] = ΐ3·33 After rounding off, the red eigenvalue rsp is 13. Further, the steps S533 to S535 for calculating the green characteristic value gSp and the steps S536 to S538 for calculating the blue characteristic value bsp are similar to the steps S530 to S532 for calculating the red = value rsp. Wherein, as long as the green overflow value q(g) and the blue overflow value q(b) are substituted for the red overflow value q(r), the green 4-inch eigenvalue gsp and the blue eigenvalue bSp can be obtained, and the green eigenvalue is obtained. The equation for gSp and blue eigenvalues is expressed as follows: bsp = st-S^l P-ul gsp = St q{g)^st~P-ul where q(g) is expressed as a green overflow value, q(b) The equation expressed as a blue overflow value 'and the green overflow value q(g) and the blue overflow value q(b) can be expressed as:

q(g) = fJANj(g) j=〇 q(b) = fjANj(b) j=0 假設根據上述運算後獲得的綠色特徵值gsp與藍色 特徵值bsp分別為12與15。接著在步驟S540中,比較 紅色特徵值rsp、綠色特徵值gSp與藍色特徵值bsp,取 三者t最小數值為第二臨界值SP,因此本實施例之第二 臨界值SP為12。接下來在步驟S550中,根據第二臨界 201032578 办瑪曲線調替氣楚二珈瑪曲線q(g) = fJANj(g) j = 〇 q(b) = fjANj(b) j = 0 It is assumed that the green eigenvalue gsp and the blue eigenvalue bsp obtained after the above operation are 12 and 15, respectively. Next, in step S540, the red feature value rsp, the green feature value gSp, and the blue feature value bsp are compared, and the minimum value of the three t is the second threshold SP, so the second threshold SP of the embodiment is 12. Next, in step S550, according to the second critical 201032578, the horse curve is used to replace the qi and qi 珈 curve.

值sp將影像的第一办瑪曲線調替盔筮 在步驟S560中, 二珈瑪曲線取得一 飽和且對比度較高的祈影像。 —另外,圖8為取得紅色溢出值的方法流程圖 實施例中,晝面的最低灰階值設定為零。如8所示, 百先在步驟S710中’開始計算紅色溢出值q(r)時,:將 紅色溢出值q(r)與灰階j歸零。接下來在步驟s73〇中, 判斷紅色色彩資訊R之讀數總數啡)是否大於灰階分 佈平均值ul ;若錄數_吨)大於灰階分佈平均值 u卜則進行步驟S·,計算:域數紐 平均值Ul的差值,並加以累計;反之1次像數總; Nj(r)不大於ul,則進行步驟S75〇,判斷灰階數是否等於 預疋灰&數L,若灰階階數j不等於預訂灰階數L,則進 行步驟S720 ’將目前的灰階j加上卜重複步驟S73〇至 S750,逐一增加灰階階數],持續累計次像數總數叫⑺ 與灰階分佈平均值ul的差值;反之,若^嫌幻等 於預定灰階數L,則結束運算獲得紅色溢出值q(r)。至於 綠色溢出值q(g)與藍色溢出值q(b)之運算方式則可比照 上述方法求得,在此即不再贅述。 第三實施例 圖9為根據本發明另一實施例之提升影像對比度的 方法流程圖。本實施例為合併利用第一實施例之亮度直 方圖均勻化以及第二實施例之調整色彩影像飽和度的方 法,來提兩影像的對比度。請參照圖9,在本實施例之步 201032578 P080365SSZ1TW 28724twf.doc/n 中’其獲得第一臨界值s的方法,與根 據苐-臨界值s’修改原始影像之第—直方圖以獲得第二 f圖的步驟摘於第—實關,在料加贅述。在獲 得第-直方圖後’接著在步驟S870中,將所獲得的第二 直方圖均勻化,以更新原始影像之γ資訊,而取得更新 後的Υ’資訊,並根據Υ,資訊獲得第一伽瑪曲線。另外, 在步驟S821〜S851中,其用以獲得調整色彩飽和度的第 二臨界值SP之運算過賴相同於第二實關,在此便不 加以贅述。因此,在獲得第一珈瑪曲線與第二臨界值兕 後’接著進行步驟S880,根據第二臨界值sp修改第一伽 瑪曲線’而獲得第二伽瑪曲線。最後在步驟中,將 原始的RGB色彩資訊對應於第二珈瑪曲線取得-新的 RG’b’色射訊’而獲得—對比度較高的新影像。 另外,根據上述實施例可歸納出第一臨界值s盥 3界=請參考下列圖10與圖11。圖10 為弟-技界值S計鼻流程圖,請合併參照圖1〇中的 與下列敘述。首先在步驟S61G,將影像之RGB ^ 轉換至γυν色彩空間,以獲得其中的Y資訊。接著= 驟S620’統計影像中每—灰階的第—像素總數 ^ 來在步驟S630中,根據每—灰階的第—像素總數说接: 得非零統計量灰階數q。接著在步驟S64G中,根J 統計量灰階數q與影像的像素總數p計算出非 平均值『。最後在轉_巾,根_零麟量灰^ =、非零統計量平均值與預定灰階值Lt+算出第— S。另外,在上述步驟S63〇中,求得非零統計量 後,亦可以直接至步驟S650,根據根據非零統 ! 16 SSZ1TW 28724twf.doc/n 201032578 數q、影像的像素總數P與預定灰階值L計算第一臨界值 S。The value sp replaces the first imaginary curve of the image. In step S560, the gamma curve obtains a saturated and contrasting image. - In addition, FIG. 8 is a flow chart of a method for obtaining a red overflow value. In the embodiment, the lowest gray level value of the facet is set to zero. As shown in Fig. 8, when the red overflow value q(r) is started in step S710, the red overflow value q(r) and the gray level j are reset to zero. Next, in step s73, it is judged whether the total number of readings of the red color information R is greater than the grayscale distribution average ul; if the number of records_ton is greater than the average value of the grayscale distribution, then step S· is performed: The difference between the average value of the number of U1 is added and accumulated; otherwise, the total number of images is 1; if Nj(r) is not greater than ul, then step S75 is performed to determine whether the gray level is equal to the pre-ashing & number L, if grayscale If the order j is not equal to the number of reserved gray levels L, proceed to step S720 'add the current gray level j to the step S73 to S750, and increase the gray level one by one], and the total number of accumulated secondary images is called (7) and gray. The difference of the average value ul of the order distribution; conversely, if the illusion is equal to the predetermined gray level number L, the end operation obtains the red overflow value q(r). The calculation method of the green overflow value q(g) and the blue overflow value q(b) can be obtained by the above method, and will not be described here. THIRD EMBODIMENT Figure 9 is a flow chart of a method for enhancing image contrast in accordance with another embodiment of the present invention. This embodiment is to combine the brightness histogram homogenization of the first embodiment and the method of adjusting the color image saturation of the second embodiment to improve the contrast of the two images. Referring to FIG. 9, in the method of 201032578 P080365SSZ1TW 28724twf.doc/n, the method of obtaining the first critical value s and modifying the first histogram of the original image according to the 苐-threshold value s' to obtain the second The steps of the f diagram are taken from the first - the actual customs, and are described in detail. After obtaining the first histogram, then in step S870, the obtained second histogram is homogenized to update the gamma information of the original image, and the updated Υ' information is obtained, and according to Υ, the information is obtained first. Gamma curve. Further, in steps S821 to S851, the operation for obtaining the second critical value SP for adjusting the color saturation is the same as the second actual value, and will not be described herein. Therefore, after obtaining the first gamma curve and the second critical value ’, then proceeding to step S880, the first gamma curve is modified according to the second critical value sp to obtain the second gamma curve. Finally, in the step, the original RGB color information is obtained corresponding to the second gamma curve to obtain a new RG'b' color transmission, and a new image with higher contrast is obtained. In addition, according to the above embodiment, the first critical value s 盥 3 boundary can be summarized. Please refer to FIG. 10 and FIG. 11 below. Fig. 10 is a flow chart of the s-meter value of the squad-technical value. Please refer to the following and the following description. First, in step S61G, the RGB^ of the image is converted to the γυν color space to obtain the Y information therein. Then, in step S630, the total number of pixels of each gray scale is calculated. In step S630, according to the total number of pixels of each gray scale, the number of pixels is non-zero statistical gray number q. Next, in step S64G, the root J statistic gray scale number q and the total number of pixels of the image p are calculated as non-average values 『. Finally, in the _ towel, the root _ zero lining gray ^ =, the non-zero statistic mean and the predetermined gray value Lt + calculate the first - S. In addition, in the above step S63, after obtaining the non-zero statistic, it is also possible to go directly to step S650, according to the non-zero system! 16 SSZ1TW 28724twf.doc/n 201032578 The number q, the total number of pixels P of the image and the predetermined gray scale value L calculate the first critical value S.

圖11為第二臨界值計算流程圖。請合併參照圖η 之公式與下列敘述’在步驟S931中,獲得影像的紅色色 彩資訊R。接著在步驟S932中,統計紅色色彩資訊R的 次像素總數Nj(r)。另外,在步驟S9l〇中,根據影像的像 素總數P與預定灰階數L,計算灰階分佈平均值ui。接 著在步驟S933中,根據次像素總數叫⑺與灰階分佈平均 值ul計算出紅色溢出值q(r)。接著在步驟S934中,依據 外部參數st、紅色溢出值q(r)、計算灰階分佈平均值ul、 像素總數P §十算出紅色特徵值rSp。相同於上述計算紅色 特徵值rsp的步驟S931〜S934,經由計算步驟奶41〜S944 與步驟S951〜954可獲得綠色特徵值gsp與藍色特徵值 bsp。最後在步驟S960中,相較紅色特徵值rsp、綠色特 徵值gsP與藍色特徵值bSp,取三數值中最小者為第二臨 界值SP。 卜 '"个知杈咼景>像對比度的方法,可依 據每:張影像的特性,計算出不同的參數(如第—臨界值 ^第二臨界值)’給㈣像不陳度的對比增強,以避免 傳統直方圖均勻化灰階不連續的狀況發生。此外,亦可 行調整,以使先前技術中影像顏色失 以明已以較佳實施例揭露如上,然其並非用 ’因此本發明之保護範圍當視後附之乍;=圍 17 201032578 P0S0365SSZ1TW 28724twf.doc/n 所界定者為準。 【圖式簡單說明】 圖1為根據本發明一實施例之提升影像對比度的方 法流程圖。 圖2為根據本發明—實施例之第一直方圖。 圖3為根據本發明一實施例之第二直方圖。 圖4(A)為原始影像的直方圖。 φ 圖4(B)為原始影像經由習知直方圖均勻化技術處理 後的直方圖。 圖4(C)為原始影像經由本發明方法處理後的直方圖。 圖5為取得非零統計量灰階數的方法流程圖。 圖6為根據本發明另一實施例之提升影像對比度的 方法流程圖。 圖7為根據本發明一實施例紅色色彩資訊r之直方圖。 圖8為取得紅色色彩資訊R之非零階數的方法流程 圖。 ® 圖9為根據本發明另一實施例之提升影像對比度的 方法流程圖。 圖10為根據本發明一實施例之第一臨界值計算流程 圖。 圖u為根據本發明另一實施例之第二臨界值計算流 程圖。 【主要元件符號說明】 S110〜S180、S410〜S450、S510〜S560、S610〜S650、 S710〜S750、S110〜S890、S910〜S970 :步驟 18Figure 11 is a flow chart for calculating the second threshold value. Please merge the formula of the reference map η with the following description. In step S931, the red color information R of the image is obtained. Next, in step S932, the total number of sub-pixels Nj(r) of the red color information R is counted. Further, in step S9l, the grayscale distribution mean ui is calculated based on the total number of pixels P of the image and the predetermined number of gray levels L. Next, in step S933, the red overflow value q(r) is calculated based on the total number of sub-pixels (7) and the gray-scale distribution average value ul. Next, in step S934, the red feature value rSp is calculated based on the external parameter st, the red overflow value q(r), the calculated gray scale distribution average ul, and the total number of pixels P § ten. Similarly to the above-described steps S931 to S934 for calculating the red characteristic value rsp, the green feature value gsp and the blue feature value bsp are obtained via the calculation steps milk 41 to S944 and steps S951 to 954. Finally, in step S960, the smallest of the three values is the second critical value SP compared to the red feature value rsp, the green feature value gsP, and the blue feature value bSp. Bu '"杈咼景景> like contrast method, according to the characteristics of each image, calculate different parameters (such as the first - threshold ^ second threshold) 'to (four) like non-degree Contrast enhancement to avoid the situation where the traditional histogram uniformizes the gray-scale discontinuity. In addition, adjustments may be made to the extent that the color of the image in the prior art has been lost as described above in the preferred embodiment. However, it is not intended to be used as the scope of protection of the present invention; = circumference 17 201032578 P0S0365SSZ1TW 28724twf. The definitions defined by doc/n shall prevail. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a flow chart showing a method of enhancing image contrast according to an embodiment of the present invention. 2 is a first histogram in accordance with an embodiment of the present invention. 3 is a second histogram in accordance with an embodiment of the present invention. Figure 4 (A) is a histogram of the original image. φ Figure 4(B) is a histogram of the original image processed by the conventional histogram homogenization technique. Figure 4 (C) is a histogram of the original image processed by the method of the present invention. Figure 5 is a flow chart of a method for obtaining a non-zero statistic gray scale number. 6 is a flow chart of a method of enhancing image contrast in accordance with another embodiment of the present invention. Figure 7 is a histogram of red color information r in accordance with an embodiment of the present invention. Figure 8 is a flow chart showing the method of obtaining the non-zero order of the red color information R. ® Figure 9 is a flow chart of a method for enhancing image contrast in accordance with another embodiment of the present invention. FIG. 10 is a flow chart showing a first threshold value calculation according to an embodiment of the invention. Figure u is a flow chart of a second threshold calculation according to another embodiment of the present invention. [Description of Main Component Symbols] S110 to S180, S410 to S450, S510 to S560, S610 to S650, S710 to S750, S110 to S890, and S910 to S970: Step 18

Claims (1)

201032578 ruou^ojSSZlTW 28724twf.doc/n 七、申請專利範圍: L —種用以提升一影像之對比度的方法, 有總數為P的複數個像素,而每—像素包含有對=不同 顏色的多個次像素(Sub_pixel ),每個次像素以— 階數L·顯示,P和L為正整數,該方法包括:、 #依據該影像的一亮度資訊,統計該影像中每一灰階 的第-像素總數Nj ’其中Nj為該影像中灰階值等於』的 像素之總數’ j為不大於L的整數; 0 根據所統計的每一灰階的第一像素總數叫,求得該 影像的一非零統計量灰階數q ; ' 根據該非零統計量灰階數q以及該影像的資訊,計 算出一臨界值S; 依據該臨界值S以及每一灰階的第一像素總數Nj, 求得每一灰階的一第二像素總數Ni,其中丨為不大^ L 的整數,當Nj>S時,NfS,而當N# S時,NrNj ; 依據所求得的每一灰階的第二像素總數风,對該影 粵 像進行冗度直方圖均勻化(Luminance Histogram Equalization, LHE)程序; 根據該影像的像素總數P和該預定灰階數L,以決 定一灰階分佈平均值U1 ; 統計該影像中每一顏色的次像素於每一灰階的次像 素總數Nj(c) ’其中變數^表示次像素所對應的顏色,Nj(c) 表示當次像素所對應的顏色為c時,其灰階值等於j的次 像素之總數; 依據一外部參數st、該影像的像素總數P、該灰階分 19 201032578 ruou^ojoSZlTW 28724twf.doc/n 佈平均值ul以及每一顏色的次像素於每一灰階的次像素 總數’計算出每一顏色所對應的顏色特徵值;以及 依據所計算的各顏色特徵值當中的最小值,調整診 珈瑪曲線。 z 2.如申請專利範圍第丨項所述的方法,其中該非零 統計量灰階數q等於該預定灰階數L減去該影像;對; 的第一像素總數Nj為零的灰階之總數。 一 3.如申請專利範圍第1項所述的方法,其中該影像 • ㈣訊包括該影像的解析度以及該預定灰階數乙。 4. 如申請專利範圍第1項所述的方法,其中該臨界 值S等於ux 1 + i,而“!:。 L q」 q 5. 如申請專利範圍第i項所述的方法,其中。 —6.如申請專利範圍第1項所述的方法,其中叶算出 每一顏色所對應的顏色特徵值包括: ” e f ⑩ ^依據該灰階分佈平均值ul以及該影像中每一顏色的 於每—灰階的次像素總數,計算出每—顏色所對 應的溢出值; ^據該外部參數贫、該影像的像素總數p、該灰階分 平均值ul以及每一顏色所對應的溢出值, 顏色所對應的顏色特徵值。 ^ 7.如申請專利範圍第6項所述的方法,其中顏色c 所對應溢出值等於,當Nj_ul時,△刚二 20 201032578 ruoujojSSZITW 28724twf.doc/n 〇,而當 Nj(c)>ul 時,ANjCc)等於(Nj(c)—ul)。 8. 如申請專利範圍第7項所述的方法,其中顏色c f + q(c)xst、 所對應的顏色特徵值等於,而q⑻= i>Nj(c)。 j=0 9. 如申請專利範圍第1項所述的方法,其中每一像 ❿ 素包含有分別對應至紅色、綠色和藍色的三個次像素。 10. —種用以提升一影像之對比度的方法,該影像具 有複數個像素,並以一預定灰階數L顯示,L為正整數, 該方法包括: 統計該影像中每一灰階的第一像素總數N,其中N 為該影像中灰階值等於j的像素之總數,j為不大的 整數; 依據一臨界值S以及每一灰階的第一像素總數Nj, • 求得每一灰階的一第二像素總數风,其中i為不大於l 的整數’當Nj>S時,Ni=S,而當NjSS時,Ni=Nj ;以及 依據所求得的每一灰階的第二像素總數风,對該影 像進行一亮度直方圖均勻化(Luminance Histogram Equalization,LHE)程序,以提升該影像的對比度。 11. 如申請專利範圍第10項所述的方法,其中該影 像的資訊包括該影像的解析度以及該預定灰階數L。 12. 如申請專利範圍第1〇項所述的方法,其另包括: 將該影像從RGB色彩空間轉換至YXJV色彩空間; 21 SSZlTW28724twf.doc/n 201032578 其中每一灰階的第一像素數目风係依據該影像轉換 至YUV色彩空間後的Y資訊統計而得。 13. 如申請專利範圍第10項所述的方法,其中每一 灰階的第一像素數目风係依據該影像於RGB色彩空間的 紅色色彩資訊R、綠色色彩資訊G和藍色色彩資訊B當 中的一色彩資訊統計而得。 14. 如申請專利範圍第10項所述的方法,其另包括: 根據所統計的每一灰階的第一像素總數Nj,求得該201032578 ruou^ojSSZlTW 28724twf.doc/n VII. Patent application scope: L—a method for improving the contrast of an image. There are a plurality of pixels with a total of P, and each pixel contains multiple pairs of different colors. Sub-pixel (Sub_pixel), each sub-pixel is displayed with - order L·, P and L are positive integers, and the method includes: ## according to a brightness information of the image, counting the first of each gray level in the image - The total number of pixels Nj 'where Nj is the total number of pixels in the image whose grayscale value is equal to 』 is an integer not greater than L; 0 according to the total number of first pixels of each grayscale, the image is obtained. The non-zero statistic gray scale number q ; 'According to the non-zero statistic gray scale number q and the information of the image, a critical value S is calculated; according to the critical value S and the total number of first pixels of each gray scale Nj, A total number of second pixels Ni of each gray level, where 丨 is an integer less than L, when Nj>S, NfS, and when N# S, NrNj; according to each gray level obtained The second pixel total wind, the redundancy histogram uniformity of the shadow image (Luminance Histogram Equalization, LHE) program; determining a grayscale distribution average value U1 according to the total number of pixels P of the image and the predetermined gray scale number L; and counting the subpixels of each color in the image in each grayscale The total number of sub-pixels Nj(c) 'where the variable ^ represents the color corresponding to the sub-pixel, and Nj(c) represents the total number of sub-pixels whose gray-scale value is equal to j when the color corresponding to the sub-pixel is c; The parameter st, the total number of pixels of the image P, the gray level is 19 201032578 ruou^ojoSZlTW 28724twf.doc/n the cloth average ul and the sub-pixel of each color in the total number of sub-pixels of each gray level 'calculate each color Corresponding color feature values; and adjusting the diagnostic gamma curve according to the minimum value among the calculated color feature values. 2. The method of claim 2, wherein the non-zero statistic grayscale number q is equal to the predetermined grayscale number L minus the image; the first pixel total number Nj of the first pixel is zero grayscale total. 1. The method of claim 1, wherein the image comprises: (4) the resolution of the image and the predetermined gray level B. 4. The method of claim 1, wherein the critical value S is equal to ux 1 + i, and "!: L q" q 5. The method of claim i, wherein. The method of claim 1, wherein the leaf calculates a color feature value corresponding to each color, including: ef 10 ^ according to the gray scale distribution average ul and each color in the image For each gray-scale total number of sub-pixels, calculate the overflow value corresponding to each color; ^ according to the external parameter poor, the total number of pixels of the image p, the gray-scale average value ul and the overflow value corresponding to each color , the color characteristic value corresponding to the color. ^ 7. The method according to claim 6, wherein the color c corresponds to an overflow value equal to, when Nj_ul, △ just two 20 201032578 ruoujojSSZITW 28724twf.doc/n 〇, And when Nj(c)>ul, ANjCc) is equal to (Nj(c)-ul). 8. The method of claim 7, wherein the color cf + q(c)xst, corresponding The color eigenvalue is equal to, and q(8) = i > Nj(c). j=0 9. The method of claim 1, wherein each pixel contains a corresponding color corresponding to red, green, and blue. Three sub-pixels. 10. - used to enhance the contrast of an image The image has a plurality of pixels and is displayed by a predetermined gray scale number L, where L is a positive integer. The method includes: counting a total number N of first pixels of each gray level in the image, where N is gray in the image The total number of pixels whose order value is equal to j, j is a small integer; according to a threshold value S and the total number of first pixels Nj of each gray level, • a total number of second pixels of each gray level is obtained, where i For an integer not greater than l', when Nj>S, Ni=S, and when NjSS, Ni=Nj; and according to the obtained total number of second pixels of each gray level, a luminance histogram is applied to the image. A Luminance Histogram Equalization (LHE) program for improving the contrast of the image. 11. The method of claim 10, wherein the information of the image includes the resolution of the image and the predetermined gray level L. 12. The method of claim 1, further comprising: converting the image from an RGB color space to a YXJV color space; 21 SSZlTW28724twf.doc/n 201032578 wherein the first pixel of each gray level The number of winds is based on 13. The method of claim Y, wherein the first pixel number of each gray scale is based on the red color of the image in the RGB color space. The color information of the information R, the green color information G and the blue color information B is statistically obtained. 14. The method of claim 10, further comprising: according to the statistics of each gray scale a total number of pixels Nj, find this 影像的一非零統計量灰階數q;以及 根據該非零統計量灰階數q以及該影像的資訊,計 算出該臨界值S。 15. 如申請專利範圍第14項所述的方法,其中該非 零統計量灰階數q等於該預定灰階數L減去該影像中對 應的第一像素總數Nj為零的灰階之總數。 16. 如申請專利範圍第15項所述的方法,其中該臨a non-zero statistic gray scale number q of the image; and calculating the critical value S based on the non-zero statistic gray scale number q and the information of the image. 15. The method of claim 14, wherein the non-zero statistic grayscale number q is equal to the predetermined grayscale number L minus the total number of grayscales corresponding to the total number of first pixels Nj in the image being zero. 16. The method of claim 15, wherein the application 界值S等於ux 1 + L q 其中u = |,p為該影像的像素總 HL 數0 17. —種用以提升一影像之對比度的方法,該影像具 有總數為P的複數個像素,而每一像素包含有對應不同 顏色的多個次像素(sub-pixel ),每個次像素以一預定灰 階數L顯示,P和L為正整數,該方法包括: 根據該影像的像素總數P和該預定灰階數L,計算 一灰階分佈平均值ul ; 22 201032578 ^SZlTW28724twf.d〇c/„ ㈣Γ相影像巾每—顏色的次像素於每—灰階的次像 其中變數C表示次像素所對應的顏色^ 二田t像素所對應的顏色為C時,其灰階值等於j的-欠 像素之總數,j為不大於L的整數; 的 依據-外部參數st、郷像的像 =均值^及每—顏色的次像素於每—灰階的Si %數4·异出母—顏色所對應的顏色特徵值;以及-依據所計算的各顏色賴值#中 影像的料曲線。 18. 如申請專利範圍第17項所述的方法,其中 ul:f。 '、 19. 如申請專利範圍第17項所述的方法,其中 出每一顏色所對應的顏色特徵值包括: ^ 依據该灰階分佈平均值ul以及該影像甲每—顏色 次像素於每—灰_次像素缝,計算峡色對 應的溢出值; 辑 依據該外部參數st、該影像的像素總數p、該灰階分 佈平均值ul以及每一顏色所對應的溢出值,計算出每二 顏色所對應的顏色特徵值。 2〇·如申請專利範圍第19項所述的方法,其中顏色 c所對應溢出值等於|柯〇,當Nj(啦ul時, =〇,而當 Nj(c)>ul 時,ΔΝ』⑹等於(Nj(c)—ul)。 21.如申請專利範圍第20項所述的方法,其中顏色 23 201032578 一v^JSZlTW28724twf.doc/n r ^ q(c)xst^ c所對應的顏色特徵值等於、对_ p _ ui ^,而q(c)= ^>明。 j=〇 22.如申請專利範圍第17項所述的方法,其中每一 像素包含有分別對應至紅色、綠色和藍色的三個次像素。 參The boundary value S is equal to ux 1 + L q where u = |, p is the total number of HL pixels of the image. 0 17. A method for increasing the contrast of an image having a total number of P pixels, and Each pixel includes a plurality of sub-pixels corresponding to different colors, each sub-pixel is displayed with a predetermined gray level L, and P and L are positive integers. The method includes: according to the total number of pixels of the image P And the predetermined gray scale number L, calculate a gray scale distribution average ul; 22 201032578 ^SZlTW28724twf.d〇c/„ (4) The image sub-pixel of each color is in the sub-pixel of each gray scale, wherein the variable C represents The color corresponding to the pixel ^ When the color corresponding to the second pixel is C, the grayscale value is equal to the total number of the under-pixels of j, and j is an integer not greater than L; the basis of the external parameter st, the image of the image = mean ^ and the color eigenvalues of the sub-pixels of each - color in the Si % number of each - gray scale 4 - different output - color; and - according to the calculated material curve of each color lag value #. 18. The method of claim 17, wherein ul:f. 19. The method of claim 17, wherein the color characteristic values corresponding to each color include: ^ according to the gray level distribution average ul and the image A-color sub-pixel in each gray_ Sub-pixel stitching, calculating the overflow value corresponding to the gorge; according to the external parameter st, the total number of pixels of the image p, the average gray value of the gray-scale distribution ul, and the overflow value corresponding to each color, the corresponding two colors are calculated. Color eigenvalue. 2 〇 · The method of claim 19, wherein the color c corresponds to an overflow value equal to | Ke, when Nj (la ul, = 〇, and when Nj (c) > When ul, ΔΝ"(6) is equal to (Nj(c) - ul). 21. The method of claim 20, wherein the color 23 201032578 a v^JSZlTW28724twf.doc/nr ^ q(c)xst^c The corresponding color feature value is equal to, for _p_ui^, and q(c)=^> ming. j=〇22. The method of claim 17, wherein each pixel contains a difference Corresponds to three sub-pixels of red, green, and blue. 24twenty four
TW98104831A 2009-02-16 2009-02-16 Method for enhancing image contrast TW201032578A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW98104831A TW201032578A (en) 2009-02-16 2009-02-16 Method for enhancing image contrast

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW98104831A TW201032578A (en) 2009-02-16 2009-02-16 Method for enhancing image contrast

Publications (1)

Publication Number Publication Date
TW201032578A true TW201032578A (en) 2010-09-01

Family

ID=44854932

Family Applications (1)

Application Number Title Priority Date Filing Date
TW98104831A TW201032578A (en) 2009-02-16 2009-02-16 Method for enhancing image contrast

Country Status (1)

Country Link
TW (1) TW201032578A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI499311B (en) * 2011-11-04 2015-09-01 Silicon Integrated Sys Corp A device for outputting luminance signal
US10223778B2 (en) 2016-04-13 2019-03-05 Realtek Semiconductor Corp. Image contrast enhancement method and apparatus thereof
TWI817667B (en) * 2022-08-19 2023-10-01 大陸商集創北方(深圳)科技有限公司 Image contrast enhancement method, electronic chip and information processing device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI499311B (en) * 2011-11-04 2015-09-01 Silicon Integrated Sys Corp A device for outputting luminance signal
US10223778B2 (en) 2016-04-13 2019-03-05 Realtek Semiconductor Corp. Image contrast enhancement method and apparatus thereof
TWI817667B (en) * 2022-08-19 2023-10-01 大陸商集創北方(深圳)科技有限公司 Image contrast enhancement method, electronic chip and information processing device

Similar Documents

Publication Publication Date Title
US8965120B2 (en) Image processing apparatus and method of controlling the same
JP4214154B2 (en) Video device for automatically adjusting white balance and white balance adjusting method thereof
KR101998531B1 (en) Real-time video enhancement methods, terminals, and non-transitory computer readable storage media
US20200034997A1 (en) An image processing method and apparauts
TWI511559B (en) Image processing method
WO2017045218A1 (en) Adaptive conversion method for image
TWI510101B (en) Method for adjusting saturation degree and color adjusting system
WO2023098251A1 (en) Image processing method, device, and readable storage medium
CN104994363B (en) A kind of U.S. face method, device and intelligent terminal based on dress ornament
CN108830800A (en) The luminance raising Enhancement Method of image under a kind of half-light scene
CN108961299B (en) Foreground image obtaining method and device
WO2017045213A1 (en) Rgbw panel subpixel compensation method and apparatus
CN102447945A (en) JND (Just Noticeable Difference) value measurement method of image brightness
WO2016155125A1 (en) Image processing method and apparatus
CN102262536A (en) window interface processing method and device
CN105898252A (en) Television color adjustment method and device
CN113132696A (en) Image tone mapping method, device, electronic equipment and storage medium
CN107592517B (en) Skin color processing method and device
CN109636739B (en) Detail processing method and device for enhancing image saturation
CN101790101A (en) Method and device for adjusting image saturation
TW201032578A (en) Method for enhancing image contrast
WO2017113620A1 (en) Method and system for processing high dynamic-range image
JP2016177500A (en) Image processing device, image processing system and program
CN110782400A (en) Self-adaptive uniform illumination realization method and device
JP2014220815A (en) Image color adjusting method and electronic device using the same