TWI357757B - Method of color quantization - Google Patents

Method of color quantization Download PDF

Info

Publication number
TWI357757B
TWI357757B TW97130969A TW97130969A TWI357757B TW I357757 B TWI357757 B TW I357757B TW 97130969 A TW97130969 A TW 97130969A TW 97130969 A TW97130969 A TW 97130969A TW I357757 B TWI357757 B TW I357757B
Authority
TW
Taiwan
Prior art keywords
color
representative
pixels
palette
pixel
Prior art date
Application number
TW97130969A
Other languages
Chinese (zh)
Other versions
TW201008250A (en
Inventor
Cheng Fa Tsai
Tsung Sheng Lin
Original Assignee
Univ Nat Pingtung Sci & Tech
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 Univ Nat Pingtung Sci & Tech filed Critical Univ Nat Pingtung Sci & Tech
Priority to TW97130969A priority Critical patent/TWI357757B/en
Publication of TW201008250A publication Critical patent/TW201008250A/en
Application granted granted Critical
Publication of TWI357757B publication Critical patent/TWI357757B/en

Links

Description

1357757· 九、發明說明: 【發明所屬之技術領域】 本發明係關於一種色彩量化方法,特別是一種先對數 個原始像素進行初步分割後,再進行分群之色彩量化方法 0 【先前技術】 色彩篁化是數位圖像處理中的一個重要課題其主要 係於原始圖像巾找尋最重要的代表色,並轉換作為2調2 盤(color palette)中之色彩,以透過該調色盤,將原始圖 像中較不重要或類似的色彩合併,以表達圖像的資料^佈 1因此’透過該調色盤㈣計,便可有效縮減記錄顏色光 譜的色彩數量’進而降低紀錄該圖像所需之資料容量。 習用色彩量化方法,如LBG演算法,其主要係分別對 ^個訓練像素(training pixel)與調色盤仏中之色彩q進 行比較’並將各個訓練像素分別分屬到較相似且失真率低 的調色盤Qt之色彩,再透過數次迭代訓練,即可 3色盤Qt之設計。首先,歧行步驟―,預設—收敛臨 Γ及該調色盤Qt中之色彩數量M,隨機初始化該調 t 並設定一迭代次數t之初始值為〇,藉此即可以 盤示該調色盤A ’而Α即表示該調色 伯由士色接者進行步驟二,利用一距離公式將一影 ^的訓練像素4顺該調色盤Μ的所有色彩進 =較並、分群至調色盤^中最接近的色彩以將所有训練 、X刀為M個群集’其中所有訓練像素X形成-集合 6 1357757. ,N},且該轉公式敎義如下所示之公 —----公式 i 練二三並::群=求得各群集内之訓 盤⑽之色彩’―色盤=:::=1357757· IX. Description of the Invention: [Technical Field] The present invention relates to a color quantization method, and more particularly to a color quantization method in which a plurality of original pixels are first divided and then subjected to grouping. [Prior Art] Color 篁It is an important subject in digital image processing. It mainly searches for the most important representative color of the original image towel, and converts it into the color in the 2 color palette to pass the original color palette. The less important or similar color combinations in the image are combined to express the image of the image. Therefore, 'by the palette (4), the number of colors of the recorded color spectrum can be effectively reduced', thereby reducing the need to record the image. The data capacity. Conventional color quantization methods, such as LBG algorithm, mainly compare the training pixels with the color q in the palette, and separate the training pixels into similar ones with low distortion rate. The color of the color palette Qt, through several iterations of training, can be designed for the 3 color disc Qt. First, the discriminating step ―presets—converges the copy and the number M of colors in the palette Qt, randomly initializes the t and sets an initial value of 迭代 the number of iterations t, thereby indicating the tune. The color wheel A ', that is, the color tone is performed by the color picker, and the second step is to use a distance formula to apply a shadow of the training pixel 4 to all the colors of the color palette. The closest color in the color palette ^ is to make all the training, X knife into M clusters, in which all training pixels X form - set 6 1357757., N}, and the conversion formula is as follows: --Formula i practice two or three and:: group = obtain the color of the training discs in each cluster (10) - color palette =:::=

β+1 = ' >- 分’,·=丄 ni \l^nf J 係可以Qt+],t = r::象素x的個數’且調色盤Q 之色彩。 b ,,…,M}表示,qt+Ii係為調色盤Q 公式2 t+1 t+1 接著,進行步驟四,透過— … 的失+ 么式3计算該調色盤Qt+1 岐真羊Dt+I,亦即將原始 V 之A夯nt+l、仓〜, 1豕京x與該調色盤Qt+1内 色tq 1進仃比較並計算失真率 所示:β+1 = ' >-minute',·=丄 ni \l^nf J can be Qt+], t = r:: the number of pixels x and the color of the palette Q. b,,...,M} indicates that qt+Ii is the palette Q formula 2 t+1 t+1 Next, proceeding to step four, the palette Qt+1 is calculated by the loss of + Real sheep Dt+I, also the original V A夯nt+l, warehouse~, 1豕京x is compared with the color palette Qt+1 inner color tq 1 and the distortion rate is shown:

Vh ’且該公式3如下Vh ' and the formula 3 is as follows

N A+1=s \xj ~<ι 7+1 公式3 其中i為訓練像素Xj所歸屬之群集 並岁=ΓΓ五’以—公式4算出:失真率差異仙,斷f 異AD是否小於該收斂臨術,若判完賴練(training);若輯結果為否, =送代次數t以w取代重新進行步驟二,使得知該 公式4如下所示: —7 — ^_|D(f + l)_D(〇| /)(/ + 1) • · ••公式4 一般而言’由於LBG演算法係以隨機初始之方式進行 且原始影像之訓練像素數量較多且較為複雜, 因此以 LBG演算法騎色彩量化必須進行好奴麟(加把邮 )方可求得較佳的解,造成其具有執行效率低落之缺點。 —另-習用色彩量化方法係為HF演算法(Hsieh and Fan 决算法)’其主要係利用最不重要位元s㈣如抓賊 LSB)取代之概念,將各個訓練像素光譜中“個不重要位 元取代為G’以提冑擁有相㈤光譜的像素數量,如此能較 容易的尋朗較具代表性_色光譜。首先,進行步驟一 ,預設調色盤巾之色純量Μ衫重要位元數量α,並利 用公式5求得一門檻值π,公式5係如下所示: η=3βΙ····公式 sN A+1=s \xj ~<ι 7+1 Equation 3 where i is the cluster to which the training pixel Xj belongs and the age = ΓΓ5' is calculated by the formula 4: the distortion rate is different, and the difference is different. If the result is no, the number of times t is replaced by w and the second step is repeated, so that the formula 4 is as follows: —7 — ^_|D( f + l)_D(〇| /)(/ + 1) • · •• Equation 4 Generally speaking, 'Because the LBG algorithm is performed in a random initial manner and the number of training pixels of the original image is large and complex, To ride the color quantization with the LBG algorithm, it is necessary to carry out a good slave (plus postal) to obtain a better solution, resulting in its shortcomings of low execution efficiency. - Another - the conventional color quantization method is the HF algorithm (Hsieh and Fan decision algorithm) 'which mainly replaces the concept with the least significant bit s (four) such as the thief LSB), and the "insignificant bits" in each training pixel spectrum The element is replaced by G' to increase the number of pixels possessing the phase (five) spectrum, so that it is easier to find a more representative _color spectrum. First, step one is performed, and the color of the color palette is preset. The number of bits α, and a 槛 value π is obtained by using Equation 5, and Equation 5 is as follows: η=3βΙ····Formula s

Mm 接著進行步驟二,將-影像中的各個訓練像素的_ 不重要位元設定為〇,以獲得數個代表像素,並將各個訓 練像素分群至龍之代祕素巾,再崎各絲像素所包 含的訓練㈣錄,並賴姆像素她乡寡由大至小將 該代表像素排列存放於一佇列中;再進行步驟三,選擇該 仵列中第-個代表像素,亦即包含最多輯像素之代表像 素,將其設定為賴色盤之主要色,並將其從該仵列中移 除;接著進行倾四,依序將㈣巾之代表像餘 中的色彩進行歐基里德距離計算,財得各個代表像素與 調色盤中色彩之_,制_求得之轉^大於門_ —8 — i^y//y/· .· · * 值77二若為「是」則將該代表像素設定為該調色盤之主要 - 色右為「否」則將該代表像素併入最接近之調色盤主要 . 色中,接著,進行步驟五,判斷調色盤中的色彩數量是否 f於調色盤中之預設色彩數量M,及佇列中所有代表像素 疋否白已完成比對’若調色盤中的色彩數量不等於Μ ’且 分列中所有代表像素尚未全部完成比對,則重複進行步驟 :’否則’進行步驟六;步驟六係判斷調色盤中之色彩數 .鲁 1疋否等於預設值Μ,若判斷結果為是,則進行步驟七, 右判斷結果為否,則依公式6降低門檻值”,再重複執行 步驟四,該公式6係如下所示: J C = 77 -4,若 Μ>64 \〇 = 77-2,若1^$64 ····公式 6 接著進行步驟八,將該佇列中剩餘的代表像素與調色 盤中的色彩作歐基里德距離計算,以便將該剩餘的代表像 素分配至調色盤中最接近之色彩;最後求出調色盤中各個 • 色彩中所分別包含之訓練像素的質心色彩,以所有質心色 彩作為調色盤中之最終色彩,便完成該習用色彩量化方法 〇 一般而言’若HF演算法之門植值η設定過大,則該 調色盤中之色彩數量可能小於該預設色彩數量Μ,而使得 影像於色彩量化後品質大幅下降;反之,則無法有效找出 具代表性之色彩。基於上述原因,有必要進一步改良上述 習用色彩量化方法。 【發明内容】 9 丄/ /37· 丄/ /37· 效率 本發月之主要目的係提供一種色彩量化方法以有效 降低-原始影像之數個原始像素之複雜度,進而提升執行 $了達到上述之發明目的,本發明的技術手段在於係 利用取不重要位凡替代方法對該原始影像之數個原始像素 進行初步分割後,再進行分群。 ’、 .其使得本發明具有維持原始影像品質及提升執行效 率之功效。 根據本發明之色彩量化方法,其包舍:一第一分 =Γ=位元替代方法將數個原始像素分割形成 絲像素’並將各該祕像素分別分 ^一代表像素中;-第二分割步驟將該數個第 t 包Γ原始像素再以該最不重要位科代方法進t 代表像素,並將進行分割之第-代表像素 原始像分群至應之第二代表像素中; -:=Γ個第一代表像素或第二代表像素填入 一頂叹之調色射,-分群步驟將所有第—代 之代 應之 ^代麵素分齡群至所對應顏色最為接近之調色盤色命 务-取代步_分财得各_色#色料所 / ^象^的質心色彩,並將各該質心色彩分躲代所對 及第像ir斷步驟以失真率對各個第—代表像素 小於-預設之收敛臨界值,則完成色彩量化,真率 於或等於顧設之收賴界值,重新進㈣分群步驟率大 —10 ~ 1357757 【實施方式】 為讓本㈣之上述及其他目的、特徵及優點能更明_ T文轉本發明之較佳實施例,並配合所附圖式, 作砰細說明如下: 一从請參照第1 _示,本發明之色彩量化方法首先 :=分割步驟Ρ1,該第—分割步驟ρι#為:透過—最 素,方法使數個原始像素形成數個第一代表像 分群騎對應之第—代表像素 代最’該衫重要位元替代方法係先預設一欲取 位-數量α 1,⑽各個縣像素最右邊〜個 =·,、、0’便可籠壯像素分鄉成數個第一代表 像素:以大幅降低需處理像素之數量。因此,先預設該欲 數量〜’以對一原始影像中所包含之 -代表像χ所組成的集合χ進行分割,以形成ζ個第 第一代表傻f將各個原始像素χ分別分群到所對應之 W,集合Χ可表干為其;’該二始影像之長寬分別為Η及 數旦Ν計I j;J,,…,叫,而原始像素X的 數里Ν貝J可表示為N=WxH,所有第 的集合L表示mu_Z} f素^所、·且成 係為第-代表像素,t原始像素x個數,且在,=:} ,該欲取代最不重要位元之數細:值 x, 影像具有六個原始像素 1豕京\之先譜值分別為56、59、1^81以1<《 及158,則分別將上述各光譜值以二進位表示,、並將各原 ^57757 始像素χ最右邊3個位元取代為 —代表像素56、136及152,_ ^便刀獅成三個第 素X分群至所對應之第-代表原始像 疋成該第-分齡驟?1後,各 :別包含數個原始像素X,較佳另將各該第 中所包含之所有原始像素χ進行計算:τ ς'二並以各該第_質心色彩分別更新咐:第: 代表!素丨1’以使該第-代表像素更具有代表性。 ㈣再參照第i圖所示,本發明接著 一代表像素1i之至少-個所二 原始進行分割之第一代表像以内之 刀別分群至所對應之第二代表像素中。 數量由多= Τ依所包含之原_ 始像素數目較多的駐少—轉率取出原 表=重要位元替代方法將該排序 代表1素象行物,以獲得該數個第二 之第二代表像ί 之縣料相分群至所對應 要位元替財法巾之最不重之衫重 割如方;'與圖第所一分 双弟j圖所不,該第一代表傻音 中含有最多之一,對第-’代== -12 — 原始像素154、155及158以最不重要位元值α2=2進行再 -分割,以形成數個第二代表像素152及156,再將各個進 . ㈣分之原鱗素X分別分群賴對應之第二代表像素 52及156巾。至此’透過先行賴原始影像進行分割, 便可大幅簡化該原始影像之複雜度。 完成該第二分割步驟Ρ2後,各該第二代表像素中係 / 刀別包含數個原始像素’較佳另將各該第二代表像素中所 ♦ 含之财原始像素進行計算,时财得—第二質心色 彩並以各該第二質心色彩分別更新所對應之第二代表像 素,以使該第二代表像素更具有代表性。 .請再參照第1圖所示,本發明接著進行一填色步驟朽 係預叹-調色盤Qt+所含之數個調色盤色彩數量μ,並 ^選擇數個第-代表像素或第二代表像储人該調色盤 3調色盤色彩之初始色彩。更詳言之,由該第一代表 & 第代表像素中隨機挑選出Μ個像素,以填入該調 • ^作為該調色盤色彩,初始化該調色盤Qt,並設定-f代次數t之初始值為〇,藉此即可以#兄,卜,m} 丁,調色盤Qt,而Α即表示該調色盤Qt中之色彩。舉 HI。’ 4參照第4圖所示’該調色盤色彩之數量M係預 2個,因此由該第一代表像素兄、…及第二代表像 L 2 156中隨機挑選出二個代表像素填入該調色盤中作 盤色κ初始色彩,於此,假設隨機挑選了第一代 、及第一代表像素152作為調色盤色彩之初始色彩 —13 — 1357757. ^之各該調色盤色彩進行比較,以將盤 色杉中。更詳言之,該第一代表像 =之調色盤 同組成—集合X,利用x={Xj十12、=代表像素係共 ❿ 離^集合χ中第j個代表像素χ ;再口’ 距離公式進行判斷,並將所有第-代表像素及第之 素===調色=Qt+最接近的調色 弟4圖所不,將第一代表像素56i3 :152、156分別透過公u與調色盤色彩56、== ,例的像素分別分群至最接近的之調色盤色彩中 56較為m ^斷’第一代表像素56與調色盤色彩 ⑶及第代==調色_56 + 士代表像素 ,而八t 6與調色盤色彩152較為接近 而刀群至調色盤色彩152内。 請再參照第i圖所示,本發明接著進行一取代步驟朽 =分別求得各賴色盤色彩情包含之代表像素的質心 、办’並將各該質心色彩分縣代所對應之調色盤色彩, 2成新的調色盤。更詳言之,由於每一調色盤色彩中皆 ^數個代表像素,以公式2求得各個質心色彩中所包含 =表像素的質心色彩,並以各該質心色彩分別取代原調 色盤Qt之調色盤色彩,以形成新的調色盤Q出其中,叫 為第i個調色盤色彩内之代表像素個數。舉例而言,請再 1357757. 參第4圖所示,以公式2求得調色盤色彩I;〗中之第一 代表像素136及第二代表像素152、156的質心色彩, 該質心色彩取代調色盤色彩152 ;而調色盤色彩兄中由於 僅有第-代表像素56,因此f心色彩仍是第—代表像素^ ♦ Μ再^照第1圖所示,本發明接著進行一判斷步驟% j失真率對各個第—代表像素及第二代表像素與調色 彩之差異進行比較,若失真率小於一預設之收敛臨界 =則完成色彩量化;否則,重新進行齡群步驟p4。更 =。之以A式3计算Qt+1的失真率D⑴,亦即將所有 表像素與調色#Qt+lf^之色彩騎比較並計算差異再 過:4進行判斷若AD小於該收斂臨界值£,則完成 色心里化’右AD大於該收斂臨界值£,則將迭代次數t 取代重新進行該分群步驟p4。至此,便可完成該調 色盤之設計,而取得較具代表性之色彩。 叫參照表1所不,其分別為本發明與習用色彩量化方 法(LBG與HF)之影像品質及處理時間之比較表表上 ,對-找多為相近色之圖片進行色彩量化。由結果可得 α ’與習用色#量化方法相較,本發明之色彩量化方法不 f大幅降低處理時間,且PSNR (喊啦㈤ω nGise咖〇 值較间’代表影像品質亦㈣後好,因此可驗證本發明 ^色彩量化方法確實可於轉影像品質之前提下,有效提 升處理速度。 〜15〜 表丨.本發明與習用色彩量化方法之影像品質及處理時間比 較表 本發明 LBG HF 16 PSNR(dB) 31.76 31.27 26.39 ^_ 處理時間(秒) 2.95 73.06 33.92 32 PSNR(dB) 34.68 33.9 28.67 ^---_ 處理時間(秒) 4 201.31 51.81 64 PSNR(dB) 36.95 35.52 32.19 處理時間(秒) 4.38 351,75 75.86 128 PSNR(dB) 38.8 37.06 33.77 '^'~~-________ 處理時間(秒) 6.69 550.09 48.97 256 PSNR(dB) 40.3 37.92 35.01 ^---- 處理時間(秒) 13.44 1325.97 72.89 分割步驟 ρι 姐〜原始像素之複雜度,以降低整體處理時間,. 夕效率;、再者,於上述初步分紐,對分割處理i 仃77群’以完成該調色盤之設計’藉此,本發1 可有效維持原始影像之品質。 雖然本發明已_上述較佳實 以限定本發明,任何孰 ”〜、並非^ 和範圍之内,相藝者在不脫離本發明之斯 相對述實施觸行各種更動解改仍屬; 1357757· » > » * 發明所保護之技術範疇,因此本發明之保護範圍當視後附 . 之申請專利範圍所界定者為準。Mm then proceeds to step two, setting the _ unimportant bit of each training pixel in the image to 〇, to obtain a plurality of representative pixels, and grouping each training pixel into a dragon's secret secret towel, and then each pixel pixel The included training (4) is recorded, and the Rim pixel is arranged in a queue from the largest to the smallest. Then, in step 3, the first representative pixel in the queue is selected, that is, the most The representative pixel of the pixel, set it as the main color of the ray tray, and remove it from the array; then perform the tilting four, and sequentially perform the Euclid distance for the representative of the (four) towel. Calculate, the value of each representative pixel and the color in the palette, the system _ get the turn ^ is greater than the gate _ - 8 - i ^ y / / y / · · · · * value 77 if "yes" then Setting the representative pixel as the main color of the color palette - "No" to the right color, then the representative pixel is merged into the color palette of the closest color palette, and then, step 5 is performed to determine the color in the color palette. Whether the quantity f is the preset number of colors M in the palette, and all the representative pixels in the array No white has completed the comparison 'If the number of colors in the palette is not equal to Μ' and all the representative pixels in the column have not been completely compared, repeat the steps: 'Otherwise' to proceed to step 6; Step 6 to determine the color The number of colors in the disk. Lu 1疋 is equal to the preset value Μ, if the judgment result is yes, proceed to step seven, if the right judgment result is no, then lower the threshold value according to formula 6, and then repeat step four, the formula The 6 series is as follows: JC = 77 -4, if Μ>64 \〇= 77-2, if 1^$64 ···· Equation 6 Then proceed to step eight, the remaining representative pixels in the array and the color The color in the disc is calculated as the Euclidean distance to distribute the remaining representative pixels to the closest color in the palette; finally, the centroid of the training pixels contained in each of the colors in the palette is determined. Color, with all the centroid colors as the final color in the palette, the conventional color quantization method is completed. Generally speaking, if the threshold value of the HF algorithm is set too large, the number of colors in the palette may be Less than the preset number of colors Μ, and The quality of the image is greatly reduced after the color is quantized; on the contrary, the representative color cannot be effectively found. For the above reasons, it is necessary to further improve the conventional color quantization method. [Abstract] 9 丄 / /37· 丄 / /37 · Efficiency The main purpose of this month is to provide a color quantization method to effectively reduce the complexity of the original pixels of the original image, thereby improving the execution of the invention. The technical means of the present invention is to take advantage of The important method is to perform preliminary segmentation on the original pixels of the original image, and then perform grouping. The invention has the effect of maintaining the original image quality and improving the execution efficiency. According to the color quantization method of the present invention, The second sub-division=Γ=bit replacement method divides a plurality of original pixels into silk pixels and separates each of the secret pixels into a representative pixel; the second dividing step divides the plurality of t Encapsulating the original pixel and then representing the pixel with the least significant bit of the co-generation method, and dividing the first-representative pixel original image The group corresponds to the second representative pixel; -:= the first representative pixel or the second representative pixel fills in a sigh of color sigh, the -grouping step applies all the first generations to the geese The age group to the corresponding color is the closest color palette color service - replace the step _ cents each _ color #色料所 / ^ like ^ the centroid color, and each of the centroid colors For the first and second ir-breaking steps, the distortion ratio is less than the preset convergence threshold for each of the first-representative pixels, and the color quantization is completed, and the true rate is equal to or equal to the revenue threshold, and the re-entry (four) grouping step rate is large. The above and other objects, features and advantages of the present invention will become more apparent. Referring to FIG. 1 , the color quantization method of the present invention firstly:=dividing step Ρ1, the first-dividing step ρι# is: transparent-most prime, the method makes a plurality of original pixels form a plurality of first representative images. Corresponding to the first - representative pixel generation, the most important way to replace the shirt is to preset a desire Bits - the number of α 1, ⑽ rightmost pixels of each county · ~ a = 0 ,,, 'cage can be strong and Township pixels into a plurality of first representative pixel: to significantly reduce the number of pixels to be processed. Therefore, the number of the desires is first preset to 'divide the set 代表 which is composed of the representative image contained in the original image to form a first representative, and the original pixels are separately grouped into the group. Corresponding to W, the set Χ can be dried as it is; 'The length and width of the second image are Η and several Ν I I j; J,,..., 叫, and the number of the original pixel X is expressed by the JJ For N=WxH, all the first sets L represent mu_Z}f, and the system is the first-representative pixel, t the original pixel x number, and at, =:}, which is to replace the least significant bit The number is fine: the value x, the image has six original pixels 1 豕 \ 之 之 之 之 之 之 \ \ \ 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 及 及 及And replacing the first 3 bits of the original pixel of the original ^57757 with the representative pixel 56, 136 and 152, and the _ ^ knife lion into three first-class X-groups to the corresponding first-representative original image The first-age age? After 1st, each: does not include a plurality of original pixels X, and preferably all of the original pixels 包含 included in each of the first χ are calculated: τ ς '2 and are updated respectively with each of the _ centroid colors: :: representative! The prime 1' is such that the first-representative pixel is more representative. (4) Referring again to Fig. i, the present invention further groups the at least one of the first representative images of the pixel 1i into the corresponding second representative pixel. The quantity is determined by the number of the original _ the number of the starting pixels is less than the number of the original _ the initial number of the number of the original table = the important bit substitution method to represent the 1 prime image line to obtain the number of the second The second representative is like ίzhi County, which is divided into groups to correspond to the most important ones for the wealth of the law towel. The figure is the same as the figure. There is one of the most, and for the first-generation == -12 - the original pixels 154, 155 and 158 are re-divided with the least significant bit value α2=2 to form a plurality of second representative pixels 152 and 156, Then, the original squama X of each of the four (fourth) points are respectively grouped into the corresponding second representative pixels 52 and 156. At this point, the complexity of the original image can be greatly simplified by dividing the original image first. After the second dividing step Ρ2 is completed, each of the second representative pixels includes a plurality of original pixels, and preferably the original pixels of the second representative pixels are calculated. a second centroid color and respectively updating the corresponding second representative pixel with each of the second centroid colors to make the second representative pixel more representative. Referring to FIG. 1 again, the present invention then performs a coloring step to pre-sigh the number of color palettes of the palettes contained in the color palette Qt+, and selects a plurality of first-representative pixels or The second represents the initial color of the color of the palette 3 color palette. More specifically, a pixel is randomly selected from the first representative & representative pixel to fill in the color of the palette, initialize the palette Qt, and set the number of times -f The initial value of t is 〇, whereby #哥,卜,m}丁, palette Qt, and Α denotes the color in the palette Qt. Give HI. '4, as shown in FIG. 4', the number M of color palettes is pre-two, so two representative pixels are randomly selected from the first representative pixel brother, ... and the second representative image L 2 156. In the palette, the initial color of the disc color κ is used. Here, it is assumed that the first generation and the first representative pixel 152 are randomly selected as the initial color of the color of the palette - 13 - 1357757. Compare it to the color of the cedar. More specifically, the first representative image = the color palette of the same composition - the set X, using x = {Xj ten 12, = represents the pixel system ❿ ^ ^ ^ χ χ χ χ χ 第 χ χ χ χ χ χ χ χ The distance formula is judged, and all the first-representative pixels and the first element===toning=Qt+ are closest to the color palette 4, and the first representative pixels 56i3: 152 and 156 are respectively transmitted through the public u Color wheel color 56, ==, the pixels of the example are grouped into the closest color palette color 56 more m ^ break 'first representative pixel 56 and color palette color (3) and first generation == color _56 + The pixels represent pixels, and the eight t 6 is closer to the palette color 152 and the knife group is within the palette color 152. Referring to FIG. 1 again, the present invention further performs a substitution step =0=determining the centroids of the representative pixels included in each color palette color, respectively, and assigning each of the centroid colors to the county generation. Color palette color, 20% new palette. More specifically, since each of the palette colors has a plurality of representative pixels, the centroid color of the pixels included in each centroid color is obtained by Equation 2, and the original color is replaced by each of the centroid colors. The palette color of the palette Qt is formed to form a new palette Q out of it, which is called the number of representative pixels in the color of the i-th palette. For example, please refer to FIG. 4 again, and find the centroid color of the first representative pixel 136 and the second representative pixel 152, 156 in the palette color I; The color replaces the palette color 152; and since the palette color brother has only the first-representative pixel 56, the f-heart color is still the first-representative pixel ^ Μ ^, as shown in FIG. 1, the present invention proceeds A determining step % j distortion rate compares the difference between each of the first representative pixel and the second representative pixel and the color adjustment, and if the distortion rate is less than a predetermined convergence threshold = then color quantization is completed; otherwise, the age group step p4 is re-executed . More =. Calculate the distortion rate D(1) of Qt+1 with A formula 3, that is, compare all the table pixels with the color ride of the color palette #Qt+lf^ and calculate the difference and then: 4 to judge if AD is less than the convergence threshold value, then Completing the color centerization 'Right AD is greater than the convergence threshold value £, then repeating the grouping step p4 by replacing the number of iterations t. At this point, the design of the color palette can be completed and a more representative color can be achieved. Referring to Table 1, the comparison is made between the image quality and the processing time of the conventional color quantization method (LBG and HF) of the present invention, and color quantization is performed on images that are mostly similar colors. From the result, the α' is compared with the conventional color # quantization method, and the color quantization method of the present invention does not greatly reduce the processing time, and the PSNR (calling (five) ω nGise curry value is better than the image quality is also good (4), therefore It can be verified that the color quantization method of the present invention can be improved before the image quality is reproduced, and the processing speed is effectively improved. ~15~ Table 丨. Comparison of image quality and processing time of the present invention and conventional color quantization method LBG HF 16 PSNR of the present invention (dB) 31.76 31.27 26.39 ^_ Processing time (seconds) 2.95 73.06 33.92 32 PSNR(dB) 34.68 33.9 28.67 ^---_ Processing time (seconds) 4 201.31 51.81 64 PSNR(dB) 36.95 35.52 32.19 Processing time (seconds) 4.38 351,75 75.86 128 PSNR(dB) 38.8 37.06 33.77 '^'~~-________ Processing time (seconds) 6.69 550.09 48.97 256 PSNR(dB) 40.3 37.92 35.01 ^---- Processing time (seconds) 13.44 1325.97 72.89 Segmentation Step ρι Sister ~ the complexity of the original pixel to reduce the overall processing time, the efficiency of the evening; and, in addition, in the above preliminary split, the segmentation process i 仃 77 group 'to complete the design of the palette Therefore, the present invention can effectively maintain the quality of the original image. Although the present invention has been described above in a preferred embodiment, it is not limited to the scope of the present invention. It is still the case that the implementation of the various changes is still carried out; 1357757· » > » * The technical scope of the invention is protected, and therefore the scope of protection of the present invention is defined by the scope of the patent application.

1357757· i · I 【圖式簡單說明】 第1圖:本發明之色彩量化法之流程圖。 第2圖:本發明之第一分割步驟之示意圖。 第3圖:本發明之第二分割步驟之示意圖。 第4圖:本發明之填色步驟之示意圖。 【主要元件符號說明】 (無)1357757· i · I [Simple description of the drawing] Fig. 1 is a flow chart of the color quantization method of the present invention. Figure 2: Schematic representation of the first segmentation step of the invention. Figure 3: Schematic representation of the second segmentation step of the invention. Figure 4: Schematic representation of the color filling step of the present invention. [Main component symbol description] (none)

Claims (1)

、申請專利範圍: 種色彩量化方法,其包含步驟: 割步驟,其係透過—最不重要位元替代方法 像素分_成數個第—代表像素,並將各該 二象素分別分群到所對應之第-代表像素中; 二第二分割步驟,其係、將該數個第-代表像素之至少 固3的原始像素再以該最不重要位元替代方法 =割’以形成數個第二代表像素,並將進行分割之 像素内之原始像素分別分群至所對應之第二 代表像素中; 色其係預設一調色盤中所含之數個調色盤 選擇數個第一代表像素或第二代表像 素真入該調色盤作為該調色盤色彩之初始色彩. =群步驟,錢將各該第—代表像錢第1代表像 =Γ=中之各該調色盤色彩進行比較,以將 == 第二代表像素分別分群至所對應 顏色最為接近之調色盤色彩中; 之ί係分财得各购&餘彩中所包含 2表像素的質心色彩’並將各該質心色彩分別取代所 對應之調色盤色彩,以形成新的調色盤.及 其Γ失真麵各料1錄素及第 二代表像切财盤色叙差料行_,若= 於一預設之收㈣界值,則完成色彩量化 丄 於或等於該預設之收韻界值,重新進行該分it大 2==::::%色,法,其-成 r原始像素進行計算;別 =各:第—質心色彩分別更新所對應之第一代表像 素後,再進行該第二分割步驟。之第代表像 17=1項所述之色彩量化方法,其中完成 該=一刀财驟後’另將各該第二代表料巾所包含之 =Γ!行計算,以分別求得-第二質心色彩, "第—貝心色彩分別更新所對應之第二代表像 常。 咖第w所述之色__,其中該分 =步驟中,_各該第-代雜素及第二代表像素分別 與該調色盤中之各該調色盤色彩以距離公式進行比較。 5、依申請專利翻帛丨項所述之色彩量切法,其中進行 該第二分割步驟之至少一個第一代表像素的選取方法 ,係將該數個第-代表像素依各該第一代表像素所包含 之原始像素數目由多至少排列,再以一預定比例 始像素數目較多的該至少一個第一代表像素。 ’、Patent application scope: A color quantization method, comprising the steps of: a cutting step, wherein the pixel is divided into a plurality of first-representative pixels by the least-discrete bit substitution method, and each of the two pixels is separately grouped to correspond to In the first-representative pixel; a second second dividing step of replacing the original pixel of at least three of the plurality of first-representative pixels with the least significant bit replacement method=cutting to form a plurality of second Representing a pixel, and grouping the original pixels in the divided pixels into the corresponding second representative pixels; the color presets a plurality of color palettes included in one color palette to select a plurality of first representative pixels Or the second representative pixel is actually entered into the palette as the initial color of the color of the palette. = group step, the money will be the color of each of the first - representative image of the first representative image = Γ = Comparing, the == second representative pixels are respectively grouped into the color of the color palette closest to the corresponding color; the ί is divided into the centroid colors of the 2 table pixels included in each purchase & Each of these centroid colors is replaced Corresponding to the palette color to form a new palette. The Γ distortion surface of each material 1 recording and the second representative image cutting the color of the color disc _, if = in a preset receipt (four) boundary Value, then complete the color quantization 丄 or equal to the preset convergence threshold value, and re-do the score of the large 2==::::% color, the method, which is calculated as the original pixel; r=each: After the first-centre color is respectively updated with the corresponding first representative pixel, the second dividing step is performed. The first representative is a color quantization method as described in item 17=1, wherein after the completion of the = one knives, the other = the Γ! line included in the second representative towel is calculated to obtain the second quality. The color of the heart, "the first-beauty color respectively update the corresponding second representative as usual. The color __ described in the coffee w, wherein the fraction = step, each of the first generation impurities and the second representative pixel are respectively compared with the color of the palette in the palette by a distance formula. 5. The color quantity cutting method according to the patent application, wherein the method of selecting at least one first representative pixel of the second dividing step is performed by each of the plurality of first representative pixels The number of original pixels included in the pixel is at least arranged at least, and the at least one first representative pixel having a larger number of pixels is started at a predetermined ratio. ’,
TW97130969A 2008-08-14 2008-08-14 Method of color quantization TWI357757B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW97130969A TWI357757B (en) 2008-08-14 2008-08-14 Method of color quantization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW97130969A TWI357757B (en) 2008-08-14 2008-08-14 Method of color quantization

Publications (2)

Publication Number Publication Date
TW201008250A TW201008250A (en) 2010-02-16
TWI357757B true TWI357757B (en) 2012-02-01

Family

ID=44827391

Family Applications (1)

Application Number Title Priority Date Filing Date
TW97130969A TWI357757B (en) 2008-08-14 2008-08-14 Method of color quantization

Country Status (1)

Country Link
TW (1) TWI357757B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9460365B1 (en) * 2015-03-24 2016-10-04 Intel Corporation Clustered palette compression

Also Published As

Publication number Publication date
TW201008250A (en) 2010-02-16

Similar Documents

Publication Publication Date Title
TWI408619B (en) Image contrast enhancement apparatus and method thereof
US9584701B2 (en) Image processing system and method
Bing et al. An adjustable algorithm for color quantization
TWI385592B (en) Codebook generating method
den Heijer et al. Investigating aesthetic measures for unsupervised evolutionary art
CN110881128B (en) JPEG image reversible data hiding method
CN111179144A (en) Efficient information hiding method for multi-embedding of multi-system secret information
TWI357757B (en) Method of color quantization
CN1650366A (en) Method and apparatus for multi-dimensionally encoding and decoding
Mare et al. Decreasing change impact using smart LSB Pixel mapping and data rearrangement
Husseis et al. Revisited histogram equalization as HDR images tone mapping operators
US20040048306A1 (en) Method and system for reproduction in a genetic optimization process
CN110086955B (en) Large-capacity image steganography method
Kumar et al. A new data hiding method using adaptive quantization & dynamic bit plane based AMBTC
CN113160028B (en) Information hiding and recovering method and equipment based on colorful character picture and storage medium
CN109194846A (en) A kind of EMD (n, m, δ) adapting to image steganographic method based on complexity
Chang et al. Secret image hiding and sharing based on the (t, n)-threshold
CN116233439A (en) Method and device for determining code rate control parameters
Wu et al. Multibit color-mapping steganography using depth-first search
CN112184841A (en) Block replacement generating type information hiding and recovering method, device and medium
Burger et al. Color quantization
Tanaka et al. Invertible color-to-monochrome transformation based on clustering with lightness constraint
Bandyopadhyay et al. An application of palette based steganography
CN111563263A (en) Carrier-free information hiding method for migration of any image style
Colton et al. Evolving approximate image filters

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees