TW201520972A - Multitone image processing method and image processing apparatus - Google Patents

Multitone image processing method and image processing apparatus Download PDF

Info

Publication number
TW201520972A
TW201520972A TW102143506A TW102143506A TW201520972A TW 201520972 A TW201520972 A TW 201520972A TW 102143506 A TW102143506 A TW 102143506A TW 102143506 A TW102143506 A TW 102143506A TW 201520972 A TW201520972 A TW 201520972A
Authority
TW
Taiwan
Prior art keywords
pixel
current
gradation
output
input
Prior art date
Application number
TW102143506A
Other languages
Chinese (zh)
Inventor
Jing-Ming Guo
yun-fu Liu
jia-yu Chang
Original Assignee
Top Guide Internat 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 Top Guide Internat Corp filed Critical Top Guide Internat Corp
Priority to TW102143506A priority Critical patent/TW201520972A/en
Publication of TW201520972A publication Critical patent/TW201520972A/en

Links

Landscapes

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

Abstract

A multitone image processing method leveraging an error diffusion algorithm as well as a tone-replacement algorithm is provided in the present invention. Besides preserving the processing efficiency of the error diffusion algorithm, the method provides a high quality of a multitone output image by adopting a tone-replacement switch mechanism within an area caused by a banding effect according to a blue noise mask and a tone-replacement probability. The output level corresponding to the banding effect area is replaced by a next output level or a previous output level with respect to the output level obtained from the multitone error diffusion algorithm so that the banding effect is reduced and the aperiodic distribution is destructed. An image processing apparatus is further provided in the present invention so as to implement the multitone image processing method.

Description

多色調影像處理方法及影像處理裝置 Multi-tone image processing method and image processing device

本發明是有關於一種多色調影像處理方法及影像處理裝置,且特別是有關於一種無帶狀效應的多色調影像處理方法及影像處理裝置。 The present invention relates to a multi-tone image processing method and image processing device, and more particularly to a multi-tone image processing method and image processing device for a bandless effect.

有鑑於現今資訊傳播媒體業、書報雜誌業、學術研究單位等產業對於紙本輸出之需求,印表機的普及率越來越高,數位半色調(halftoning)技術在實體平面輸出的應用上扮演著重要的角色。所謂「半色調技術」是利用較少的色調來表現一連續色調影像,一般被廣泛地應用在輸出色階受到限制的影像輸出裝置。以印表機為例,由於印表機僅能透過打點來輸出黑色並以不打點來表示白色,因此需藉由半色調技術控制黑白色調的疏密程度變化,進而製造出能模擬灰階影像效果的半色調影像。進一步來說,由於人眼的視覺系統具備低通濾波(Optical Low Pass Filter,OLPF)的效果,因此在一定距離之外,半色調影像便能帶給人眼類同於灰階影像的視覺感受。 In view of the demand for paper output in the information media industry, book and magazine industry, academic research units and other industries, the popularity of printers is getting higher and higher, and the digital halftone (halftoning) technology is applied to the physical plane output. play an important role. The "halftone technique" is to express a continuous tone image with less color tone, and is generally widely applied to an image output device whose output color gradation is limited. Taking the printer as an example, since the printer can only output black through dot punching and white without dotting, it is necessary to control the density of black and white tones by halftone technology to create a grayscale image. A halftone image of the effect. Furthermore, since the human eye's vision system has the effect of low-pass filtering (OLPF), half-tone images can give the human eye the same visual perception as gray-scale images beyond a certain distance. .

目前廣為人知的數位半色調技術多半採用錯誤擴散法(Error Diffusion)、有序抖動法(Order Dithering)、點擴散法(Dot Diffusion)、及直接二元搜尋法(Direct Binary Search)等演算方式,而為能持續的提升輸出結果之品質,數位半色調技術在目前的印刷產業從硬體設備、演算法、材料等方面進行改良。舉例而言,在前述的方法中都是設定輸出設備只能以黑(打印墨水)與白(不打印墨水)來表現8位元(8-bit)灰階的輸出結果。數位多色調(multitoning)技術則為半色調技術的延伸,其在硬體設備能夠支援多色階表現8-bit灰階。 Currently known digital halftone techniques mostly use Error Diffusion, Order Dithering, Dot Diffusion, and Direct Binary Search. In order to continuously improve the quality of output results, digital halftone technology has been improved in the current printing industry from hardware devices, algorithms, materials and so on. For example, in the foregoing method, it is set that the output device can only express 8-bit (8-bit) gray scale output results in black (printing ink) and white (not printing ink). Digital multitoning technology is an extension of the halftone technology, which supports multi-color scale 8-bit grayscale in hardware devices.

半色調影像中不可避免的失真是由於將多色階影像轉換至二元半色調影像所造成的,因此在多色調技術中則是增加輸出色階來減少失真,以提升輸出品質。當輸出色階越多時,則輸出的結果能越接近想要表達的原始灰階。然而,設備設計成本與輸出品質存在著權衡的問題。當越多色階時,則對應的硬體必須能夠支援對應的色階,並且在墨水材料上也必須要有一定的品質管理才能使輸出結果能有更好的品質。 The inevitable distortion in halftone images is caused by the conversion of multi-tone images to binary halftone images. Therefore, in multi-tone technology, the output color gradation is increased to reduce distortion to improve output quality. When the output gradation is more, the output result can be closer to the original gray level that you want to express. However, there is a trade-off between equipment design cost and output quality. When there are more gradations, the corresponding hardware must be able to support the corresponding color gradation, and there must be some quality management on the ink material to make the output result have better quality.

然而,在一般的數位多色調技術中,往往存在著色彩帶狀(color banding)的現象。此現象的發生是因為在帶狀區域(banding area)原本的灰階值與輸出色階是非常相似的甚至是相同,因此在周圍區域都會以某一個輸出色階轉換這個區域,但相對於周圍區域開始有變化,因此開始出現不同的輸出色階。由於人眼視覺系統對於低頻訊號較於敏感,因此這樣的分佈會很容易 被觀察出來且造成相對不夠平滑的質感。有鑑於此,如何在有效地消除帶狀效應之前提下快速地產生多色調影像,已成為亟欲解決的問題之一。 However, in general digital multi-tone technology, there is often a phenomenon of color banding. This phenomenon occurs because the original grayscale value in the banding area is very similar or even the same as the output color gradation, so the surrounding area will be converted to an area with an output gradation, but relative to the surrounding area. The area begins to change, so different output levels begin to appear. Since the human visual system is sensitive to low frequency signals, such a distribution is easy. Observed and resulting in a relatively unsmooth texture. In view of this, how to quickly generate multi-tone images before effectively eliminating the band effect has become one of the problems to be solved.

本發明提供一種多色調影像處理方法及影像處理裝置,其可產生無帶狀效應(banding effect)的多色調影像。 The present invention provides a multi-tone image processing method and an image processing apparatus that can generate a multi-tone image without a banding effect.

本發明的多色調影像處理方法,適用於影像處理裝置,包括下列步驟。(a)接收一輸入影像的多個輸入像素,並且選擇所述輸入像素其中之一作為目前輸入像素。(b)根據目前輸入像素的錯誤擴散權重,調整目前輸入像素的像素值。(c)取得目前輸入像素所對應的第一目前輸出色階,其中第一目前輸出色階為輸出色階集合中的多個輸出色階與目前輸入像素具有最小誤差的輸出色階。(d)根據目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關,其中藍雜訊遮罩圖樣包括多個藍雜訊遮罩像素,目前藍雜訊遮罩像素為所述藍雜訊遮罩像素中對應於目前輸入像素的藍雜訊遮罩像素。(e)當開啟色調替***關時,取得目前輸入像素所對應的第二目前輸出色階,並且將對應於該目前輸入像素的目前輸出像素的色階值設定為第二目前輸出色階,其中第二目前輸出色階為所述輸出色階中與目前輸入像素具有第二最小誤差的輸出色階。(f)當關閉色調替***關時,將對應於目前輸入像素的目前輸出像素的色階值設定為第一 目前輸出色階。(g)當所述輸入像素中有尚未被選擇的輸入像素時根據目前輸出像素的色階值,執行錯誤擴散程序,以產生相對於目前輸入像素的多個鄰近輸入像素的錯誤擴散權重,並且選擇所述輸入像素之另一作為目前輸入像素,以重覆執行步驟(b)至步驟(f)。(h)當各所述輸入像素皆被選擇時,根據各所述輸入像素所分別對應的目前輸出像素的色階值產生一多色調輸出影像。 The multi-tone image processing method of the present invention is applicable to an image processing apparatus and includes the following steps. (a) receiving a plurality of input pixels of an input image and selecting one of the input pixels as the current input pixel. (b) Adjust the pixel value of the current input pixel according to the error diffusion weight of the current input pixel. (c) obtaining a first current output gradation corresponding to the current input pixel, wherein the first current output gradation is an output gradation having a plurality of output gradations in the output gradation set and a minimum error of the current input pixel. (d) determining whether to turn on or off the tone replacement switch according to the current blue noise mask pixel, the color tone replacement probability, and the first current output level, wherein the blue noise mask pattern includes a plurality of blue noise mask pixels, currently blue The noise mask pixel is a blue noise mask pixel corresponding to the current input pixel in the blue noise mask pixel. (e) when the color tone replacement switch is turned on, obtaining a second current output color gradation corresponding to the current input pixel, and setting a gradation value corresponding to the current output pixel of the current input pixel to a second current output gradation, wherein The second current output level is an output level in the output level having a second minimum error from the current input pixel. (f) when the tone replacement switch is turned off, the gradation value corresponding to the current output pixel of the current input pixel is set to the first The color level is currently output. (g) when there is an input pixel that has not been selected among the input pixels, performing an error diffusion procedure according to the gradation value of the current output pixel to generate an error diffusion weight with respect to a plurality of adjacent input pixels of the current input pixel, and The other of the input pixels is selected as the current input pixel to repeatedly perform steps (b) through (f). (h) when each of the input pixels is selected, generating a multi-tone output image according to the gradation values of the current output pixels respectively corresponding to the input pixels.

在本發明的一實施例中,上述的步驟(c)中取得目前輸入像素所對應的第一目前輸出色階之演算方式包括方程式(1): 其中g s 為第一目前輸出色階,v(i,j)為目前輸入像素的像素值並且位於輸入影像中的第i列第j行;其中Q為輸出色階集合,Q具有q色階,Q={g 1,g 2g q },並且g 1<g 2<…< gq In an embodiment of the present invention, the calculation method of obtaining the first current output gradation corresponding to the current input pixel in the above step (c) includes the equation (1): Where g s is the first current output level, v ( i , j ) is the pixel value of the current input pixel and is located in the i-th column j-th row in the input image; where Q is the output level set and Q has the q level , Q ={ g 1 , g 2 ... g q }, and g 1 < g 2 <...< gq .

在本發明的一實施例中,上述的步驟(d)中根據目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關之前,多色調影像處理方法更包括下列步驟。比較藍雜訊遮罩圖樣與輸入影像的大小。當藍雜訊遮罩圖樣與輸入影像的大小相同時,目前輸入像素與目前藍雜訊遮罩像素具有i'=i以及j'=j之對應關係,其中ii'分別為目前輸入像素與目前藍雜訊遮罩像素的列座標,jj'分別為目前輸入像素與目前藍雜訊遮罩像素的行座標。當藍雜訊遮罩圖樣與該輸入影像的大小不同時,目前輸入像素與目前藍雜訊遮罩像素具有i'=i mod M以及j'=j mod N之對應關係,其中MN分別為輸入影像的高與寬。 In an embodiment of the present invention, in the step (d), the multi-tone image processing method is determined before the color tone replacement switch is turned on or off according to the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation. Also includes the following steps. Compare the blue noise mask pattern with the size of the input image. When the blue noise mask pattern is the same size as the input image, the current input pixel has a correspondence relationship with the current blue noise mask pixel i '= i and j '= j , where i and i ' are the current input pixels respectively. With the column coordinates of the current blue noise mask pixel, j and j ' are the row coordinates of the current input pixel and the current blue noise mask pixel, respectively. When the blue noise mask pattern is different from the size of the input image, the current input pixel has a correspondence relationship with the current blue noise mask pixel i '= i mod M and j '= j mod N , where M and N respectively Enter the height and width of the image.

在本發明的一實施例中,上述的步驟(d)中根據目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關包括:判斷目前藍雜訊遮罩像素的像素值是否等於1;產生一隨機值,並且判斷隨機值是否小於或等於色調替代機率;判斷第一目前輸出色階是否為輸出色階集合中的最大輸出色階或最小輸出色階;當判斷目前藍雜訊遮罩像素的像素值等於1、隨機值小於或等於色調替代機率並且第一目前輸出色階不為輸出色階集合中的最大輸出色階或最小輸出色階時,開啟色調替***關,否則,關閉色調替***關。 In an embodiment of the present invention, in the step (d), determining, according to the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation, determining whether to turn the color tone switch on or off includes: determining the current blue noise. Whether the pixel value of the mask pixel is equal to 1; generating a random value, and determining whether the random value is less than or equal to the tone replacement probability; determining whether the first current output level is the maximum output level or the minimum output color in the output level set When determining that the pixel value of the current blue noise mask pixel is equal to 1, the random value is less than or equal to the tone replacement probability, and the first current output level is not the maximum output level or the minimum output level in the output level set; , turn on the tone replacement switch, otherwise, turn off the tone replacement switch.

在本發明的一實施例中,上述的步驟(d)中根據目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關的演算公式包括方程式(2): 其中bn(i',j')為目前藍雜訊遮罩像素的像素值,RAND(0,1)為隨機值並且介於0到1之間,p為色調替代機率,g s 為第一目前輸出色階,g 1g q 分別為輸出色階集合中的最大輸出色階與最小輸出色階。 In an embodiment of the present invention, in the above step (d), according to the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation, the calculation formula for determining whether to turn the color tone replacement switch on or off includes the equation (2). ): Where bn ( i ', j ') is the pixel value of the current blue noise mask pixel, RAND (0, 1) is a random value and is between 0 and 1, p is the tone replacement probability, g s is the first The current output gradation, g 1 and g q are the maximum output gradation and the minimum output gradation in the output gradation set, respectively.

在本發明的一實施例中,上述的步驟(e)中當開啟色調替***關時,取得目前輸入像素所對應的第二目前輸出色階的演算公式包括方程式(3): 其中g' s 為第二目前輸出色階,v(i,j)為輸入影像中第i列第j行的目 前輸入像素的像素值;Q'=Q-{g s },Q為輸出色階集合,其中Q具有q色階,Q={g 1,g 2g q }並且g 1<g 2<…<g q g s 為第一目前輸出色階。 In an embodiment of the invention, when the color tone replacement switch is turned on in the above step (e), the calculation formula for obtaining the second current output color gradation corresponding to the current input pixel includes equation (3): Where g ' s is the second current output level, v ( i , j ) is the pixel value of the current input pixel of the jth row of the i-th column in the input image; Q '= Q -{ g s }, Q is the output color a set of orders, where Q has q gradation, Q = { g 1 , g 2 ... g q } and g 1 < g 2 <... < g q , g s is the first current output gradation.

在本發明的一實施例中,上述的步驟(g)中根據目前輸出像素的色階值,執行錯誤擴散程序,以產生相對於目前輸入像素的所述鄰近輸入像素的錯誤擴散權重包括:利用Floyd-Steinberg錯誤濾波器,針對目前輸入像素執行錯誤擴散程序,以產生所述鄰近輸入像素的錯誤擴散權重,其中所述鄰近輸入像素為位於目前輸入像素的右方、右下方、正下方以及左下方的鄰近輸入像素。 In an embodiment of the present invention, in step (g) above, performing an error diffusion procedure according to the gradation value of the current output pixel to generate an error diffusion weight relative to the adjacent input pixel of the current input pixel includes: utilizing A Floyd-Steinberg error filter that performs an error diffusion procedure for the current input pixel to generate an error diffusion weight of the adjacent input pixel, wherein the adjacent input pixel is located to the right, bottom right, directly below, and bottom left of the current input pixel The adjacent input pixels of the square.

在本發明的一實施例中,上述的步驟(g)中選擇所述輸入像素之另一作為目前輸入像素,並且重覆執行步驟(b)至步驟(f)的步驟包括:根據蜿蜒蛇形掃描路徑逐一對各所述輸入像素執行上述步驟(b)至上述步驟(f)。 In an embodiment of the invention, in step (g) above, selecting the other of the input pixels as the current input pixel, and repeating the steps of step (b) to step (f) includes: according to the python The shape scan path performs the above step (b) to the above step (f) one by one for each of the input pixels.

本發明的影像處理裝置,包括儲存單元以及一或多個處理單元,其中處理單元耦接儲存單元。儲存單元是用以記錄多個模組,而處理單元用以存取並執行記錄在儲存單元中的模組。所述模組包括像素選擇模組、像素調整模組、色調替代模組、錯誤擴散模組以及影像輸出模組,其中色調替代模組包括第一搜尋子模組、第二搜尋子模組、開關控制子模組、第一色階設定子模組以及第二色階設定子模組。像素選擇模組用以接收一輸入影像的多個輸入像素,並且選擇所述輸入像素其中之一作為目前輸入像素。像素調整模組用以根據目前輸入像素的錯誤擴散權重,調整目前輸入像素的像素值。第一搜尋子模組用以取得目前輸入像素 所對應的第一目前輸出色階,其中第一目前輸出色階為輸出色階集合中的多個輸出色階與目前輸入像素具有最小誤差的輸出色階。第二搜尋子模組用以取得目前輸入像素所對應的第二目前輸出色階,其中第二目前輸出色階為所述輸出色階中與目前輸入像素具有第二最小誤差的輸出色階。開關控制子模組用以根據目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關,其中藍雜訊遮罩圖樣包括多個藍雜訊遮罩像素,目前藍雜訊遮罩像素為所述藍雜訊遮罩像素中對應於目前輸入像素的藍雜訊遮罩像素。當開關控制子模組關閉色調替***關時,第一色階設定子模組用以將對應於目前輸入像素的目前輸出像素的色階值設定為第一目前輸出色階;當開關控制子模組開啟色調替***關時,第二色階設定子模組用以將對應於目前輸入像素的目前輸出像素的色階值設定為第二目前輸出色階。當所述輸入像素中有尚未被像素選擇模組選擇的輸入像素時,錯誤擴散模組用以根據目前輸出像素的色階值,執行錯誤擴散程序,以產生相對於目前輸入像素的多個鄰近輸入像素的錯誤擴散權重,並且像素選擇模組再選擇所述輸入像素之另一作為目前輸入像素。此外,當各所述輸入像素皆被像素選擇模組選擇時,影像輸出模組用以根據所述輸入像素所分別對應的目前輸出像素的色階值產生一多色調輸出影像。 The image processing device of the present invention comprises a storage unit and one or more processing units, wherein the processing unit is coupled to the storage unit. The storage unit is for recording a plurality of modules, and the processing unit is configured to access and execute the modules recorded in the storage unit. The module includes a pixel selection module, a pixel adjustment module, a color tone replacement module, a error diffusion module, and an image output module, wherein the color tone replacement module includes a first search sub-module and a second search sub-module. The switch control sub-module, the first color gradation setting sub-module, and the second color gradation setting sub-module. The pixel selection module is configured to receive a plurality of input pixels of an input image, and select one of the input pixels as the current input pixel. The pixel adjustment module is configured to adjust the pixel value of the current input pixel according to the error diffusion weight of the current input pixel. The first search sub-module is used to obtain the current input pixel Corresponding first current output gradation, wherein the first current output gradation is an output gradation with a plurality of output gradations in the output gradation set and a minimum error of the current input pixel. The second search sub-module is configured to obtain a second current output gradation corresponding to the current input pixel, where the second current output gradation is an output gradation of the output gradation having a second minimum error with the current input pixel. The switch control sub-module is configured to turn on or off the tone replacement switch according to the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation, wherein the blue noise mask pattern includes a plurality of blue noise masks Pixel, the current blue noise mask pixel is a blue noise mask pixel corresponding to the current input pixel in the blue noise mask pixel. When the switch control sub-module turns off the tone replacement switch, the first level setting sub-module is configured to set the tone value of the current output pixel corresponding to the current input pixel to the first current output level; when the switch controls the sub-mode When the group is turned on, the second level setting sub-module is configured to set the level value of the current output pixel corresponding to the current input pixel to the second current output level. When there are input pixels in the input pixel that have not been selected by the pixel selection module, the error diffusion module is configured to perform an error diffusion process according to the color gradation value of the current output pixel to generate multiple neighbors with respect to the current input pixel. The error diffusion weight of the pixel is input, and the pixel selection module selects the other of the input pixels as the current input pixel. In addition, when each of the input pixels is selected by the pixel selection module, the image output module is configured to generate a multi-tone output image according to the color gradation values of the current output pixels corresponding to the input pixels.

在本發明的一實施例中,上述的第一搜尋子模組取得目前輸入像素所對應的第一目前輸出色階之演算方式包括方程式 (1): 其中g s 為第一目前輸出色階,v(i,j)為目前輸入像素的像素值並且位於輸入影像中的第i列第j行;Q為輸出色階集合,Q具有q色階,Q={g 1,g 2g q }並且g 1<g 2<…<g q In an embodiment of the invention, the first search sub-module obtains a calculation method of the first current output gradation corresponding to the current input pixel, including equation (1): Where g s is the first current output level, v ( i , j ) is the pixel value of the current input pixel and is located in the i-th column j-th row in the input image; Q is the output level set, Q has q level, Q = { g 1 , g 2 ... g q } and g 1 < g 2 <... < g q .

在本發明的一實施例中,上述的開關控制子模組比較藍雜訊遮罩圖樣與輸入影像的大小。當藍雜訊遮罩圖樣與輸入影像的大小相同時,開關控制子模組設定目前輸入像素與目前藍雜訊遮罩像素具有i'=i以及j'=j之對應關係,其中ii'分別為目前輸入像素與目前藍雜訊遮罩像素的列座標,jj'分別為目前輸入像素與目前藍雜訊遮罩像素的行座標。當藍雜訊遮罩圖樣與輸入影像的大小不同時,開關控制子模組設定目前輸入像素與目前藍雜訊遮罩像素具有i'=i mod M以及j'=j mod N之對應關係,其中MN分別為輸入影像的高與寬。 In an embodiment of the invention, the switch control sub-module compares the size of the blue noise mask pattern with the input image. When the blue noise mask pattern is the same size as the input image, the switch control sub-module sets the correspondence between the current input pixel and the current blue noise mask pixel with i '= i and j '= j , where i and i 'The column coordinates of the current input pixel and the current blue noise mask pixel, j and j ' are the row coordinates of the current input pixel and the current blue noise mask pixel, respectively. When the size of the blue noise mask pattern is different from the size of the input image, the switch control sub-module sets the correspondence between the current input pixel and the current blue noise mask pixel having i '= i mod M and j '= j mod N , Where M and N are the height and width of the input image, respectively.

在本發明的一實施例中,上述的開關控制子模組判斷目前藍雜訊遮罩像素的像素值是否等於1。開關控制子模組又產生一隨機值,並且判斷隨機值是否小於或等於色調替代機率。開關控制子模組更判斷第一目前輸出色階是否為輸出色階集合中的最大輸出色階或最小輸出色階。當開關控制子模組判斷目前藍雜訊遮罩像素的像素值等於1、隨機值小於或等於色調替代機率並且第一目前輸出色階不為輸出色階集合中的最大輸出色階或最小輸出色階時,開關控制子模組開啟色調替***關,否則,開關控制子模 組關閉色調替***關。 In an embodiment of the invention, the switch control sub-module determines whether the pixel value of the current blue noise mask pixel is equal to 1. The switch control sub-module again generates a random value and determines whether the random value is less than or equal to the tone replacement probability. The switch control sub-module further determines whether the first current output level is the maximum output level or the minimum output level in the output level set. When the switch control sub-module determines that the pixel value of the current blue noise mask pixel is equal to 1, the random value is less than or equal to the tone replacement probability, and the first current output level is not the maximum output level or minimum output in the output level set. In the color gradation, the switch control sub-module turns on the tone replacement switch, otherwise, the switch controls the sub-mode The group turns off the tone override switch.

在本發明的一實施例中,上述的開關控制子模組根據目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關的演算公式包括方程式(2): 其中bn(i',j')為目前藍雜訊遮罩像素的像素值,RAND(0,1)為隨機值並且介於0到1之間,p為色調替代機率,g s 為第一目前輸出色階,g 1g q 分別為輸出色階集合中的最大輸出色階與最小輸出色階。 In an embodiment of the invention, the switch control sub-module determines, according to the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation, the calculation formula for turning on or off the tone replacement switch includes the equation (2). ): Where bn ( i ', j ') is the pixel value of the current blue noise mask pixel, RAND (0, 1) is a random value and is between 0 and 1, p is the tone replacement probability, g s is the first The current output gradation, g 1 and g q are the maximum output gradation and the minimum output gradation in the output gradation set, respectively.

在本發明的一實施例中,上述的第二搜尋子模組取得目前輸入像素所對應的第二目前輸出色階的演算公式包括方程式(3): 其中g' s 為第二目前輸出色階,v(i,j)為輸入影像中第i列第j行的目前輸入像素的像素值;Q'=Q-{g s },Q為輸出色階集合,其中Q具有q色階,Q={g 1,g 2g q },並且g 1<g 2<…<g q g s 為第一目前輸出色階。 In an embodiment of the invention, the second search sub-module obtains a calculation formula of the second current output color gradation corresponding to the current input pixel, including equation (3): Where g ' s is the second current output level, v ( i , j ) is the pixel value of the current input pixel of the jth row of the i-th column in the input image; Q '= Q -{ g s }, Q is the output color a set of orders, where Q has q gradation, Q = { g 1 , g 2 ... g q }, and g 1 < g 2 <... < g q , g s is the first current output gradation.

在本發明的一實施例中,上述的錯誤擴散模組利用Floyd-Steinberg錯誤濾波器,針對目前輸入像素執行錯誤擴散程序,以產生所述鄰近輸入像素的錯誤擴散權重,其中所述鄰近輸入像素為位於目前輸入像素的右方、右下方、正下方以及左下方的鄰近輸入像素。 In an embodiment of the invention, the error diffusion module uses a Floyd-Steinberg error filter to perform an error diffusion procedure for the current input pixel to generate an error diffusion weight of the adjacent input pixel, wherein the adjacent input pixel The adjacent input pixels are located to the right, bottom right, directly below, and bottom left of the current input pixel.

在本發明的一實施例中,上述的像素選擇模組根據蜿蜒 蛇形掃描路徑逐一選擇所述輸入像素之另一作為目前輸入像素。 In an embodiment of the invention, the pixel selection module is configured according to The serpentine scan path selects one of the input pixels one by one as the current input pixel.

基於上述,本發明所提出的多色調影像處理方法與影像處理裝置結合多色調錯誤擴散法以及色調替代演算法,除了保留多色調錯誤擴散法的處理效能,更利用藍雜訊遮罩圖樣以及色調替代機率,設定色調開關的開啟機制,在帶狀效應的帶狀區域內,以前一個輸出色階或是下一個輸出色階替代習知錯誤擴散法所得到的輸出色階,不但可快速地產生多色調影像,更可有效地消除帶狀效應與無週期性分布,提升輸出影像的品質。此多色調影像處理方法與影像處理裝置所產生的多色調影像可供噴墨印表機、雷射印表機等產品上執行,適用於書報雜誌等輸出,增強本發明在實際應用中的適用性。 Based on the above, the multi-tone image processing method and the image processing apparatus proposed by the present invention combine the multi-tone error diffusion method and the color tone replacement algorithm, in addition to retaining the processing performance of the multi-tone error diffusion method, and further utilizing the blue noise mask pattern and color tone. Alternative probability, set the opening mechanism of the tone switch. In the strip region of the strip effect, the output gradation obtained by the previous output gradation or the next output gradation instead of the conventional error diffusion method can not only be generated quickly. Multi-tone images can effectively eliminate the band effect and non-periodic distribution, and improve the quality of the output image. The multi-tone image processing method and the multi-tone image generated by the image processing device can be executed on products such as an inkjet printer and a laser printer, and are suitable for output of books, magazines, etc., and enhance the practical application of the present invention. applicability.

為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。 The above described features and advantages of the invention will be apparent from the following description.

100‧‧‧電子裝置 100‧‧‧Electronic devices

102‧‧‧儲存單元 102‧‧‧ storage unit

104‧‧‧處理單元 104‧‧‧Processing unit

110‧‧‧像素選擇模組 110‧‧‧Pixel selection module

120‧‧‧像素調整模組 120‧‧‧pixel adjustment module

130‧‧‧色調替代模組 130‧‧‧tone replacement module

131‧‧‧第一搜尋子模組 131‧‧‧First search submodule

132‧‧‧第二搜尋子模組 132‧‧‧Second search submodule

133‧‧‧開關控制模組 133‧‧‧Switch Control Module

134‧‧‧第一色階設定子模組 134‧‧‧First Level Setting Sub-module

135‧‧‧第二色階設定子模組 135‧‧‧Second level setting sub-module

140‧‧‧錯誤擴散模組 140‧‧‧Error Diffusion Module

150‧‧‧影像輸出模組 150‧‧‧Image output module

S202~S224‧‧‧多色調影像處理方法的流程 S202~S224‧‧‧Multi-tone image processing method flow

A‧‧‧輸入影像 A‧‧‧ input image

Spath‧‧‧蜿蜒蛇形掃描路徑 S path ‧‧‧蜿蜒 serpentine scan path

圖1繪示依據本發明一實施例的一種影像處理裝置的方塊示意圖。 FIG. 1 is a block diagram of an image processing apparatus according to an embodiment of the invention.

圖2繪示依據本發明一實施例的多色調影像處理方法的流程圖。 2 is a flow chart of a multi-tone image processing method according to an embodiment of the invention.

圖3繪示為藍雜訊遮罩圖樣的範例。 FIG. 3 illustrates an example of a blue noise mask pattern.

圖4繪示為蜿蜒蛇形掃描路徑。 Figure 4 illustrates a serpentine scan path.

本發明的部份實施例接下來將會配合附圖來詳細描述,以下的描述所引用的元件符號,當不同附圖出現相同的元件符號將視為相同或相似的元件。這些實施例只是本發明的一部份,並未揭示所有本發明的可實施方式。更確切的說,這些實施例只是本發明的專利申請範圍中的裝置與方法的範例。 The components of the present invention will be described in detail in the following description in conjunction with the accompanying drawings. These examples are only a part of the invention and do not disclose all of the embodiments of the invention. Rather, these embodiments are merely examples of devices and methods within the scope of the patent application of the present invention.

圖1繪示依據本發明一實施例的一種影像處理裝置的方塊示意圖,但此僅是為了方便說明,並不用以限制本發明。首先圖1先介紹影像處理裝置的所有構件以及配置關係,詳細功能將配合圖2一併揭露。 1 is a block diagram of an image processing apparatus according to an embodiment of the invention, but is for convenience of description and is not intended to limit the present invention. First, all components and configuration relationships of the image processing apparatus will be described first in FIG. 1. The detailed functions will be disclosed in conjunction with FIG.

請參照圖1,本實施例的影像處理裝置100可針對一輸入影像進行多色調處理,其結合多色調之錯誤擴散法(error diffusion)以及色調替代(tone-replacement)演算法,用以產生無帶狀效應的多色調輸出影像。影像處理裝置100可以為個人電腦、筆記型電腦、平板電腦、數位相機、智慧型手機、掃描機、噴墨印表機、雷射印表機等電子裝置,其中包括儲存單元102及一或多個處理單元104,其功能分述如下。 Referring to FIG. 1, the image processing apparatus 100 of the present embodiment can perform multi-tone processing on an input image, which combines multi-tone error diffusion and tone-replacement algorithms to generate no Multi-tone output image with band effect. The image processing device 100 can be an electronic device such as a personal computer, a notebook computer, a tablet computer, a digital camera, a smart phone, a scanner, an inkjet printer, a laser printer, and the like, including a storage unit 102 and one or more The processing unit 104 has functions as described below.

儲存單元102例如是任意型式的固定式或可移動式隨機存取記憶體(Random Access Memory,RAM)、唯讀記憶體(Read-Only Memory,ROM)、快閃記憶體(Flash memory)、硬碟或其他類似裝置或這些裝置的組合,而用以記錄可由處理單元 104執行的多個模組,這些模組可載入處理單元104以對輸入影像進行多色調處理,並且產生多色調的輸出影像。 The storage unit 102 is, for example, any type of fixed or removable random access memory (RAM), read-only memory (ROM), flash memory (Flash memory), hard Disc or other similar device or a combination of these devices for recording by processing unit 104 executes a plurality of modules that can be loaded into the processing unit 104 to perform multi-tone processing on the input image and to produce a multi-tone output image.

處理單元104例如是中央處理單元(Central Processing Unit,CPU),或是其他可程式化之一般用途或特殊用途的微處理器(Microprocessor)、數位訊號處理器(Digital Signal Processor,DSP)、可程式化控制器、特殊應用積體電路(Application Specific Integrated Circuits,ASIC)、可程式化邏輯裝置(Programmable Logic Device,PLD)或其他類似裝置或這些裝置的組合。處理單元104耦接至儲存單元102,其可存取並執行記錄在儲存單元102中的模組。 The processing unit 104 is, for example, a central processing unit (CPU), or other programmable general purpose or special purpose microprocessor (Microprocessor), digital signal processor (DSP), programmable Controllers, Application Specific Integrated Circuits (ASICs), Programmable Logic Devices (PLDs), or other similar devices or combinations of these devices. The processing unit 104 is coupled to the storage unit 102, which can access and execute the modules recorded in the storage unit 102.

上述模組包括像素選擇模組110、像素調整模組120、色調替代模組130、錯誤擴散模組140以及影像輸出模組150,其中色調替代模組130更包括第一搜尋子模組131、第二搜尋子模組132、開關控制子模組133、第一色階設定子模組134以及第二色階設定子模組135。這些模組例如是電腦程式,其可載入處理單元104,從而對輸入影像執行多色調影像處理的功能。以下即列舉實施例說明影像處理裝置100執行多色調影像處理的詳細步驟。 The module includes a pixel selection module 110, a pixel adjustment module 120, a color tone replacement module 130, an error diffusion module 140, and an image output module 150. The tone replacement module 130 further includes a first search sub-module 131. The second search sub-module 132, the switch control sub-module 133, the first color-gradation setting sub-module 134, and the second color-grading setting sub-module 135. These modules are, for example, computer programs that can be loaded into the processing unit 104 to perform multi-tone image processing functions on the input image. The detailed steps of the image processing apparatus 100 performing multi-tone image processing will be described below by way of examples.

圖2繪示依據本發明一實施例的多色調影像處理方法的流程圖。請參照圖2,本實施例的方法適用於圖1的影像處理裝置100,以下即搭配影像處理裝置100中的各項元件說明本發明之多色調影像處理方法的詳細步驟。 2 is a flow chart of a multi-tone image processing method according to an embodiment of the invention. Referring to FIG. 2, the method of the present embodiment is applied to the image processing apparatus 100 of FIG. 1. Hereinafter, the detailed steps of the multi-tone image processing method of the present invention will be described with reference to various elements in the image processing apparatus 100.

首先,像素選擇模組110接收輸入影像的多個輸入像素 (步驟S202),並且選擇所述輸入像素其中之一作為目前輸入像素(步驟S204)。詳言之,輸入影像包括多個輸入像素,且這些輸入像素是以行(column)與列(row)的方式排列成一個矩陣。在此,所謂的目前輸入像素為即將被進行處理的其中一個輸入像素。 First, the pixel selection module 110 receives a plurality of input pixels of the input image. (Step S202), and one of the input pixels is selected as the current input pixel (step S204). In detail, the input image includes a plurality of input pixels, and the input pixels are arranged in a matrix in a row and a row. Here, the so-called current input pixel is one of the input pixels to be processed.

接著,像素調整模組120根據目前輸入像素的錯誤擴散權重,調整目前輸入像素的像素值(步驟S206)。換言之,像素調整模組120將自錯誤擴散模組140取得對應於目前輸入像素的錯誤擴散權重,據以調整像素選擇模組110所選擇的目前輸入像素的像素值。在一實施例中,錯誤擴散模組140可根據習知的Floyd-Steinberg錯誤擴散法來產生錯誤擴散權重,其中產生錯誤擴散權重的方式將在後續步驟進行更詳盡的說明。 Next, the pixel adjustment module 120 adjusts the pixel value of the current input pixel according to the error diffusion weight of the current input pixel (step S206). In other words, the pixel adjustment module 120 obtains the error diffusion weight corresponding to the current input pixel from the error diffusion module 140, thereby adjusting the pixel value of the current input pixel selected by the pixel selection module 110. In one embodiment, the error diffusion module 140 may generate error diffusion weights according to the conventional Floyd-Steinberg error diffusion method, wherein the manner in which the error diffusion weights are generated will be described in more detail in subsequent steps.

在半色調技術中,要轉換一個灰階值為0.5的區塊時,是使用兩個輸出色階0與1進行轉換。本發明所採用的多色調技術可視為半色調技術的延伸。一般而言,q色階的多色調技術則表示為使用q個輸出色階,其中Q={g 1,g 2g q }則表示所有輸出色階的輸出色階集合,並且g 1<g 2<…<g q 。然而,以三色階為例,灰階值0.5同時存在於輸出色階集合{0,0.5,1}中,若按照此方式直接對此區塊進行轉換將會產生負面的帶狀效應(banding effect)。本發明將根據半色調的概念,在產生帶狀效應的帶狀區域內,色調替代模組130將使用前一個輸出色階或是下一個輸出色階,以改善使用習知錯誤擴散法所得到的輸出色階所造成的帶狀效應。 In the halftone technique, when converting a block with a grayscale value of 0.5, two output levels 0 and 1 are used for conversion. The multi-tone technique employed by the present invention can be considered an extension of the halftone technique. In general, the multi-tone technique of q gradation is expressed as using q output gradations, where Q = { g 1 , g 2 ... g q } represents the output gradation set of all output gradations, and g 1 < g 2 <...< g q . However, taking the three gradation as an example, the grayscale value of 0.5 exists in the output gradation set {0, 0.5, 1} at the same time. If the block is directly converted in this way, a negative banding effect will occur. Effect). According to the invention, according to the concept of halftone, in the strip region where the strip effect is generated, the tone replacement module 130 will use the previous output level or the next output level to improve the use of the conventional error diffusion method. The band effect caused by the output level.

據此,色調替代模組130中的第一搜尋子模組131先將 取得目前輸入像素所對應的第一目前輸出色階(步驟S208),在此的「第一目前輸出色階」為一個具有多個輸出色階的輸出色階集合中與目前輸入像素存在最小誤差的輸出色階。第一搜尋子模組131可根據方程式(1)取得目前輸入像素所對應的第一目前輸出色階: 其中g s 為第一目前輸出色階,v(i,j)為目前輸入像素的像素值並且位於輸入影像中的第i列第j行;Q為輸出色階集合,Q具有q色階,Q={g 1,g 2g q }並且g 1<g 2<…<g q Accordingly, the first search sub-module 131 in the tone replacement module 130 first obtains the first current output level corresponding to the current input pixel (step S208), where the "first current output level" is one. An output gradation having a minimum error with the current input pixel in the output gradation set having a plurality of output gradations. The first search sub-module 131 can obtain the first current output level corresponding to the current input pixel according to the equation (1): Where g s is the first current output level, v ( i , j ) is the pixel value of the current input pixel and is located in the i-th column j-th row in the input image; Q is the output level set, Q has q level, Q = { g 1 , g 2 ... g q } and g 1 < g 2 <... < g q .

之後,色調替代模組130中的開關控制子模組133將根據藍雜訊遮罩圖樣(blue noise mask)中對應於目前輸入像素的目前藍雜訊遮罩像素、色調替代機率以及第一目前輸出色階,決定開啟或關閉色調替***關(步驟S210)。在此的藍雜訊遮罩像素以及色調替代機率為用以提供更好輸出影像品質所設定的參數。色調替代模組130將利用藍雜訊遮罩像素以及色調替代機率產生一個機制,以決定是否以第一目前輸出色階做為目前輸入像素的輸出,或是以其它輸出色階做為目前輸入像素的輸出。 Thereafter, the switch control sub-module 133 in the tone replacement module 130 will according to the current blue noise mask pixel corresponding to the current input pixel in the blue noise mask, the tone replacement probability, and the first current The color gradation is output, and it is decided to turn the tone replacement switch on or off (step S210). The blue noise mask pixels and color tone replacement factors here are parameters set to provide better output image quality. The tone replacement module 130 will use a blue noise mask pixel and a tone replacement probability to generate a mechanism to decide whether to use the first current output level as the output of the current input pixel, or to use other output levels as the current input. The output of the pixel.

詳言之,圖3繪示為藍雜訊遮罩圖樣的範例,其產生方式為使用一個單一色階為0.5的影像,接著使用直接二元搜尋法(direct binary search algorithm)產生對應的半色調影像,即可完成藍雜訊遮罩圖樣。在此將藍雜訊遮罩圖樣的每一個像素定義為「藍雜訊遮罩像素」。此外,藍雜訊遮罩圖樣可預先被儲存於儲存 單元102中。在此步驟中,開關控制子模組133會將目前輸入像素與藍雜訊遮罩圖樣中對應的藍雜訊遮罩像素(在此定義為「目前藍雜訊遮罩像素」)進行比較,以做為決定是否開啟色調替***關的條件之一,其可有效地改善帶狀效應,以產生無週期性(aperiodic)的輸出影像。 In more detail, FIG. 3 illustrates an example of a blue noise mask pattern generated by using a single image having a scale of 0.5, and then using a direct binary search algorithm to generate a corresponding halftone. Image, you can complete the blue noise mask pattern. Here, each pixel of the blue noise mask pattern is defined as a "blue noise mask pixel". In addition, the blue noise mask pattern can be stored in advance in storage. In unit 102. In this step, the switch control sub-module 133 compares the current input pixel with the corresponding blue noise mask pixel (defined herein as "current blue noise mask pixel") in the blue noise mask pattern. As one of the conditions for deciding whether to turn on the tone replacement switch, it can effectively improve the band effect to produce an aperiodic output image.

另一方面,色調替代機率亦會影響影像的輸出品質,這是由於色調替代之錯誤擴散法在轉換多色調影像時,進行色調替代之程序時將會取代掉原本擁有最小誤差的輸出色階,改以上一個輸出色階或下一個輸出色階當作最後的結果。當色調替代機率越高時,也就表示越多原本最小誤差的輸出色階是被取代的,因此會造成降低影像品質。不過由於錯誤擴散法本身的擴散錯誤的特性,能夠進行誤差的補償,使得影像品質不至於下降的太過嚴重。 On the other hand, the color substitution probability will also affect the output quality of the image. This is because the error diffusion method of color substitution replaces the output level with the smallest error when converting the multi-tone image. Change the above output level or the next output level as the final result. When the probability of color substitution is higher, it means that the more the output gradation of the original minimum error is replaced, thus causing the image quality to be degraded. However, due to the diffuse error characteristics of the error diffusion method itself, the error can be compensated, so that the image quality does not fall too much.

具體來說,在本實施例中,由於藍雜訊遮罩圖樣已預先被設定,在進行步驟S210之前,開關控制子模組133先比較藍雜訊遮罩圖樣與輸入影像的大小。當藍雜訊遮罩圖樣與輸入影像的大小相同時,開關控制子模組133將設定目前輸入像素與目前藍雜訊遮罩像素具有i'=i以及j'=j之對應關係,也就是說目前輸入像素與目前藍雜訊遮罩像素具有相同的行列座標,其中,ii'分別為目前輸入像素與目前藍雜訊遮罩像素的列座標,jj'分別為目前輸入像素與目前藍雜訊遮罩像素的行座標。當藍雜訊遮罩圖樣與輸入影像的大小不同時,開關控制子模組133將設定目前輸 入像素與目前藍雜訊遮罩像素具有i'=i mod M以及j'=j mod N之對應關係,其中MN分別為輸入影像的高與寬。 Specifically, in this embodiment, since the blue noise mask pattern has been previously set, the switch control sub-module 133 compares the size of the blue noise mask pattern and the input image before performing step S210. When the blue noise mask pattern is the same size as the input image, the switch control sub-module 133 sets the correspondence between the current input pixel and the current blue noise mask pixel with i '= i and j '= j , that is, It is said that the input pixel has the same row and column coordinates as the current blue noise mask pixel, wherein i and i ' are respectively the column coordinates of the current input pixel and the current blue noise mask pixel, and j and j ' are the current input pixels respectively. The row coordinates of the pixel with the current blue noise mask. When the blue noise mask pattern is different from the size of the input image, the switch control sub-module 133 sets the current input pixel to correspond to the current blue noise mask pixel with i '= i mod M and j '= j mod N Relationship, where M and N are the height and width of the input image, respectively.

接著,開關控制子模組133根據方程式(2)決定開啟或關閉色調替***關: 其中bn(i',j')為目前藍雜訊遮罩像素的像素值,RAND(0,1)為隨機值並且介於0到1之間,p為色調替代機率,g s 為第一目前輸出色階,g 1g q 分別為輸出色階集合中的最大輸出色階與最小輸出色階。 Next, the switch control sub-module 133 determines to turn the tone replacement switch on or off according to equation (2): Where bn ( i ', j ') is the pixel value of the current blue noise mask pixel, RAND (0, 1) is a random value and is between 0 and 1, p is the tone replacement probability, g s is the first The current output gradation, g 1 and g q are the maximum output gradation and the minimum output gradation in the output gradation set, respectively.

換言之,開關控制子模組133除了會判斷目前藍雜訊遮罩像素的像素值bn(i',j')是否等於1以做為色調替***關的一個開啟條件之外,更會產生一個隨機值RAND(0,1),以判斷隨機值RAND(0,1)是否小於或等於色調替代機率p。根據影像品質與消除帶狀效應所會造成的假邊現象,在一實施例中,色調替代機率可以設定為p=0.65。再者,開關控制子模組133會判斷第一目前輸出色階是否為輸出色階集合中的最大輸出色階g q 或最小輸出色階g 1。這是由於當g s =g 1或是g s =g q 時,在後續的色階替代步驟將會缺少上一個輸出色階g s-1或是下一個輸出色階g s+1,故只會用另一個色階進行替代,而無法達到錯誤補償之功效。以g s =g 1為例,若原本是要採用輸出色階g s-1,但是輸出色階g s-1卻不存在,因此會造成較大的誤差而降低輸出影像的品質。 In other words, the switch control sub-module 133 not only determines whether the pixel value bn ( i ', j ') of the current blue noise mask pixel is equal to 1 but also generates a random condition as an open condition of the color tone replacement switch. The value RAND (0, 1) is used to determine whether the random value RAND (0, 1) is less than or equal to the tone replacement probability p . According to the image quality and the false edge phenomenon caused by eliminating the band effect, in one embodiment, the tone replacement probability can be set to p = 0.65. Moreover, the switch control sub-module 133 determines whether the first current output level is the maximum output level g q or the minimum output level g 1 in the output level set. This is because when g s = g 1 or g s = g q , the previous output level g s -1 or the next output level g s +1 will be missing in the subsequent level replacement step. It will only be replaced by another level, and the effect of error compensation will not be achieved. Taking g s = g 1 as an example, if the output level g s -1 is originally used, but the output level g s -1 does not exist, it will cause a large error and degrade the quality of the output image.

當開關控制子模組133關閉色調替***關時,第一色階 設定子模組134將對應於目前輸入像素的目前輸出像素的色階值設定為第一目前輸出色階(步驟S212)。換言之,第一色階設定子模組134設定原本多色調錯誤擴散法所得到的輸出色階為目前色階值。 When the switch control sub-module 133 turns off the tone replacement switch, the first level The setting sub-module 134 sets the gradation value corresponding to the current output pixel of the current input pixel as the first current output gradation (step S212). In other words, the first gradation setting sub-module 134 sets the output gradation obtained by the original multi-tone error diffusion method to the current gradation value.

當開關控制子模組133開啟該色調替***關時,第二搜尋子模組132取得目前輸入像素所對應的第二目前輸出色階(步驟S214),並且將對應於目前輸入像素的目前輸出像素的色階值設定為第二目前輸出色階(步驟S216)。在此的第二目前輸出色階為所述輸出色階中與目前輸入像素具有第二最小誤差的輸出色階。換言之,第二搜尋子模組132可根據方程式(3)取得第二目前輸出色階: 其中g' s 為第二目前輸出色階,v(i,j)為輸入影像中第i列第j行的目前輸入像素的像素值;Q'為不包括第一目前輸出色階的輸出色階集合。由於輸出色階集合Q中的輸出色階是以色階值的大小排序,因此第二目前輸出色階g' s 在輸出色階集合Q中為第一目前輸出色階g s 的上一個輸出色階g s-1或是下一個輸出色階g s+1When the switch control sub-module 133 turns on the tone replacement switch, the second search sub-module 132 obtains the second current output level corresponding to the current input pixel (step S214), and will correspond to the current output pixel of the current input pixel. The gradation value is set to the second current output gradation (step S216). The second current output level is herein an output level of the output level having a second minimum error with the current input pixel. In other words, the second search sub-module 132 can obtain the second current output level according to equation (3): Where g ' s is the second current output level, v ( i , j ) is the pixel value of the current input pixel of the jth row of the ith column in the input image; Q ' is the output color not including the first current output level Order set. Since the output gradation of the output tone set Q is the size of the sort gradation value, and thus the second current output tone g 's at the set Q output tone for a first output current to an output gradation g s The level g s -1 or the next output level g s +1 .

上述步驟S208至步驟S216可視為一個色調替代的程序。色調替代模組130將根據上述的色調開關機制,據以將目前輸出像素的色階值設定為第一目前輸出色階或是第二目前輸出色階。在執行完步驟S216之後,像素選擇模組110會先判斷是否所有的輸入像素皆已被選擇處理過(步驟S218)。當所述輸入像素中 有尚未被像素選擇模組110選擇的輸入像素時,錯誤擴散模組140將會根據目前輸出像素的色階值,執行錯誤擴散程序,以產生相對於目前輸入像素的多個鄰近輸入像素的錯誤擴散權重(步驟S220)。在本實施例中,錯誤擴散模組140利用Floyd-Steinberg錯誤濾波器,針對目前輸入像素執行錯誤擴散程序,以產生其鄰近輸入像素的錯誤擴散權重,在此的鄰近輸入像素為位於該目前輸入像素的右方、右下方、正下方以及左下方的鄰近輸入像素。 The above steps S208 to S216 can be regarded as a procedure of tone replacement. The tone replacement module 130 will set the gradation value of the current output pixel to the first current output gradation or the second current output gradation according to the tone switching mechanism described above. After step S216 is performed, the pixel selection module 110 first determines whether all of the input pixels have been selected for processing (step S218). When in the input pixel When there is an input pixel that has not been selected by the pixel selection module 110, the error diffusion module 140 will perform an error diffusion procedure according to the color gradation value of the current output pixel to generate an error with respect to a plurality of adjacent input pixels of the current input pixel. Diffusion weights (step S220). In this embodiment, the error diffusion module 140 utilizes a Floyd-Steinberg error filter to perform an error diffusion procedure for the current input pixel to generate an error diffusion weight adjacent to the input pixel, where the adjacent input pixel is located at the current input. Adjacent input pixels to the right, bottom right, directly below, and bottom left of the pixel.

詳言之,基於Floyd-Steinberg錯誤濾波器所產生的錯誤濾波器方向以及錯誤擴散權重如表1所示: 其中(i,j)為目前輸入像素的所在位置,w 0w 1w 2w 3分別為位於(i+1,j)、(i+1,j+1)、(i,j+1)與(i-1,j+1)的輸入像素的錯誤擴散權重。由於這些錯誤擴散權重是為比例關係,因此可假設這些錯誤擴散權重的總和為1,亦即In detail, the error filter direction and error diffusion weight generated based on the Floyd-Steinberg error filter are shown in Table 1: Where ( i , j ) is the location of the current input pixel, w 0 , w 1 , w 2 and w 3 are located at ( i +1, j ), ( i +1, j +1), ( i , j +1) and ( i -1, j +1) the error diffusion weight of the input pixel. Since these error diffusion weights are proportional, it can be assumed that the sum of these error diffusion weights is 1, that is, .

在訓練的階段可先將所有可能的錯誤擴散列成方程式(4)的形式: 其中q為輸出色階集合中的輸出色階的數量,p為色調替代機率,i為這一組錯誤擴散權重的索引。因此,在已知qp的情況下, 表示使用這一組錯誤擴散權重所產生的多色調輸出影像,其中n表示該影像是使用N張訓練影像中第n張訓練影像。接著,給予一個AF(˙)函數作為評估函數,對原始灰階訓練影像k n 與多色調輸出影像進行評估而產生一個如方程式(5)所示的對應結果: 之後,所有的訓練影像所對應的結果將用來當作最佳化參考依據,其可以方程式(6)所表示: 據此,每一組錯誤擴散權重都可在已知qp的情況下獲得其對應的ε q,p,i ,因此接著從這些ε q,p,i 的數據中挑出最好效能的錯誤擴散權重組合。 In the training phase, all possible errors can be diffused into the form of equation (4): Where q is the number of output levels in the output level set, p is the tone replacement probability, and i is the index of the set of error diffusion weights. Therefore, in the case where q and p are known, Indicates use This set of multi-tone output image error diffusion weights produced, wherein n represents the image using the N pieces of n-th image Training Training images. Next, an AF (̇) function is given as an evaluation function for the original grayscale training image k n and the multi-tone output image. The evaluation is performed to produce a corresponding result as shown in equation (5): After that, the results of all the training images will be used as the basis for optimization, which can be expressed by equation (6): According to this, each set of error diffusion weights can obtain its corresponding ε q , p , i with q and p known, so then pick the best performance from the data of ε q , p , i . Error diffusion weight combination.

在一實施例中,錯誤擴散權重的最小尺度是採用10-4,而AF(˙)函數是採用HPSNR的評估方式(Human-visual Peak Signal-to-Noise Ratio Evaluation),其使用一個低通濾波器(Low-pass Filter)以模擬人類視覺之特性,並且使用這個低通濾波器對原始影像與待測影像進行迴旋積(convolution)以模擬人眼實際所感受到的結果,對應的公式下列方程式所示: 其中w(m,n) W表示模擬人類視覺系統之特性所採用的低通濾波器,如此可將該評估工具加入其視覺特性並以數值的方式表示人 眼觀看兩者之間所產生的差距。此低通濾波器的產生,可以使用對比敏感函數(Contrast Sensitivity Function,CSF)在頻率域中產生一個對應的濾波器,接著再使用反向傅立葉轉換(Inverse Fourier Transform)轉換至空間域(Spatial Domain)以獲得低通濾波器。在本實施例中,HPSNR之結果評估將以7×7大小的高斯濾波器(Gaussian Filter)作為低通濾波器。 In one embodiment, the minimum scale of error diffusion weight is 10 -4 , and the AF ( ̇ ) function is a Human-visual Peak Signal-to-Noise Ratio Evaluation, which uses a low pass filter. Low-pass filter to simulate the characteristics of human vision, and use this low-pass filter to converge the original image and the image to be tested to simulate the actual feelings of the human eye. The corresponding formula is the following equation. Show: Where w ( m , n ) W represents a low-pass filter used to simulate the characteristics of the human visual system, so that the evaluation tool can be added to its visual characteristics and numerically represent the gap between the two. The low-pass filter can be generated using a Contrast Sensitivity Function (CSF) to generate a corresponding filter in the frequency domain, and then converted to the spatial domain using Inverse Fourier Transform (Spatial Domain). ) to obtain a low pass filter. In the present embodiment, the result of HPSNR evaluation will be a Gaussian filter of 7 × 7 size as a low pass filter.

在一實施例中,假設p=0.65,則表2A至表2D將分別列出不同q值所產生的錯誤擴散權重組合: In an embodiment, assuming p = 0.65, Tables 2A through 2D will respectively list the combinations of error diffusion weights resulting from different q values:

因此,在前述的步驟S206中,像素調整模組120便是根據之前被處理的輸入像素所產生的錯誤擴散權重調整目前輸入像素的像素值。 Therefore, in the foregoing step S206, the pixel adjustment module 120 adjusts the pixel value of the current input pixel according to the error diffusion weight generated by the previously processed input pixel.

步驟S204至步驟S218為一個輸入像素的處理流程,因此當錯誤擴散模組140執行完錯誤擴散程序後,像素選擇模組110將選擇所述輸入像素之另一作為目前輸入像素(步驟S222),並且重覆執行步驟S206至步驟S222直到各所述輸入像素被選擇為止。在本實施例中,像素選擇模組110根據例如是圖4的蜿蜒蛇形掃描路徑(serpentine scanning path)Spath逐一對輸入影像A的各所述輸入像素執行步驟(b)至步驟(h),以避免產生不自然之紋理圖樣的輸出影像。最後,當各所述輸入像素皆被像素選擇模組131選擇處理時,影像輸出模組150會根據每一輸入像素所分別對應的輸出像素的色階值產生輸出影像(步驟S224),此輸出影像即為無帶狀效應的多色調影像。 Step S204 to step S218 is a processing flow of an input pixel. Therefore, after the error diffusion module 140 performs the error diffusion process, the pixel selection module 110 selects the other of the input pixels as the current input pixel (step S222). And step S206 to step S222 are repeatedly performed until each of the input pixels is selected. In this embodiment, the pixel selection module 110 performs steps (b) to (h) according to each input pixel of the input image A one by one according to the serpentine scanning path S path of FIG. 4, for example. ) to avoid producing an output image of an unnatural texture pattern. Finally, when each of the input pixels is selected and processed by the pixel selection module 131, the image output module 150 generates an output image according to the color gradation values of the output pixels corresponding to each input pixel (step S224), and the output is output. The image is a multi-tone image with no band effect.

綜上所述,本發明所提出的多色調影像處理方法與影像處理裝置結合多色調錯誤擴散法以及色調替代演算法,除了保留多色調錯誤擴散法的處理效能,更利用藍雜訊遮罩圖樣以及色調替代機率,設定色調開關的開啟機制,在帶狀效應的帶狀區域內,以前一個輸出色階或是下一個輸出色階替代習知錯誤擴散法所得到的輸出色階,不但可快速地產生多色調影像,更可有效地消除帶狀效應與無週期性分布,提升輸出影像的品質。此多色調影像處理方法與影像處理裝置所產生的多色調影像可供噴墨印表機、雷射印表機等產品上執行,適用於書報雜誌等輸出,增強本發明在實際應用中的適用性。 In summary, the multi-tone image processing method and the image processing apparatus proposed by the present invention combine the multi-tone error diffusion method and the tone replacement algorithm, in addition to retaining the processing performance of the multi-tone error diffusion method, and further utilizing the blue noise mask pattern. And the tone replacement probability, setting the opening mechanism of the tone switch, in the strip-shaped region of the strip effect, the output gradation obtained by the conventional output gradation or the next output gradation instead of the conventional error diffusion method can be quickly The multi-tone image is generated, which can effectively eliminate the band effect and the non-periodic distribution, and improve the quality of the output image. The multi-tone image processing method and the multi-tone image generated by the image processing device can be executed on products such as an inkjet printer and a laser printer, and are suitable for output of books, magazines, etc., and enhance the practical application of the present invention. applicability.

雖然本發明已以實施例揭露如上,然其並非用以限定本 發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。 Although the present invention has been disclosed above by way of example, it is not intended to limit the present invention. The scope of the present invention is defined by the scope of the appended claims, which are defined by the scope of the appended claims, without departing from the spirit and scope of the invention. quasi.

S202~S224‧‧‧多色調影像處理方法的流程 S202~S224‧‧‧Multi-tone image processing method flow

Claims (16)

一種多色調影像處理方法,適用於一影像處理裝置,該多色調影像處理方法包括:(a)接收一輸入影像的多個輸入像素,並且選擇所述輸入像素其中之一作為一目前輸入像素;(b)根據該目前輸入像素的一錯誤擴散權重,調整該目前輸入像素的像素值;(c)取得該目前輸入像素所對應的一第一目前輸出色階,其中該第一目前輸出色階為一輸出色階集合中的多個輸出色階與該目前輸入像素具有最小誤差的輸出色階;(d)根據一目前藍雜訊遮罩像素、一色調替代機率以及該第一目前輸出色階,決定開啟或關閉一色調替***關,其中該藍雜訊遮罩圖樣包括多個藍雜訊遮罩像素,該目前藍雜訊遮罩像素為所述藍雜訊遮罩像素中對應於該目前輸入像素的藍雜訊遮罩像素;(e)當開啟該色調替***關時,取得該目前輸入像素所對應的一第二目前輸出色階,並且設定對應於該目前輸入像素的一目前輸出像素的色階值為該第二目前輸出色階,其中該第二目前輸出色階為所述輸出色階中與該目前輸入像素具有第二最小誤差的輸出色階;(f)當關閉該色調替***關時,設定對應於該目前輸入像素的該目前輸出像素的色階值為該第一目前輸出色階;(g)當所述輸入像素中有尚未被選擇的輸入像素時,根據該目 前輸出像素的色階值,執行一錯誤擴散程序,以產生相對於該目前輸入像素的多個鄰近輸入像素的多個錯誤擴散權重,並且選擇所述輸入像素之另一作為該目前輸入像素,以重覆執行步驟(b)至步驟(f);以及(h)當各所述輸入像素皆被選擇時,根據各所述輸入像素所分別對應的該目前輸出像素的色階值產生一多色調輸出影像。 A multi-tone image processing method is applicable to an image processing device. The multi-tone image processing method includes: (a) receiving a plurality of input pixels of an input image, and selecting one of the input pixels as a current input pixel; (b) adjusting a pixel value of the current input pixel according to an error diffusion weight of the current input pixel; (c) obtaining a first current output level corresponding to the current input pixel, wherein the first current output level An output gradation having a plurality of output gradations in the output gradation set having a minimum error with the current input pixel; (d) a current blue noise mask pixel, a tone replacement probability, and the first current output color Deciding to turn on or off a tone replacement switch, wherein the blue noise mask pattern includes a plurality of blue noise mask pixels, wherein the current blue noise mask pixel corresponds to the blue noise mask pixel The blue noise mask pixel of the input pixel is currently input; (e) when the color tone replacement switch is turned on, a second current output color gradation corresponding to the current input pixel is obtained, and the setting corresponds to The gradation value of a current output pixel of the input pixel is the second current output gradation, wherein the second current output gradation is an output gradation of the output gradation having a second minimum error with the current input pixel. (f) when the tone replacement switch is turned off, setting a gradation value of the current output pixel corresponding to the current input pixel to the first current output gradation; (g) when the input pixel has not been selected When inputting pixels, according to the item a gradation value of the front output pixel, performing an error diffusion procedure to generate a plurality of erroneous diffusion weights relative to the plurality of adjacent input pixels of the current input pixel, and selecting the other of the input pixels as the current input pixel, Steps (b) through (f) are performed repeatedly; and (h) when each of the input pixels is selected, generating a plurality of gradation values corresponding to the current output pixels respectively corresponding to the input pixels Tone output image. 如申請專利範圍第1項所述的多色調影像處理方法,其中步驟(c)中取得該目前輸入像素所對應的該第一目前輸出色階之演算方式包括方程式(1): 其中g s 為該第一目前輸出色階,v(i,j)為該目前輸入像素的像素值並且位於該輸入影像中的第i列第j行,其中Q為該輸出色階集合,Q具有q色階,Q={g 1,g 2g q },並且g 1<g 2<…<g q The multi-tone image processing method of claim 1, wherein the calculating the first current output gradation corresponding to the current input pixel in the step (c) comprises the equation (1): Where g s is the first current output level, v ( i , j ) is the pixel value of the current input pixel and is located in the i th column j row of the input image, where Q is the output level set, Q Has q gradation, Q = { g 1 , g 2 ... g q }, and g 1 < g 2 <... < g q . 如申請專利範圍第1項所述的多色調影像處理方法,其中在該步驟(d)中根據該目前藍雜訊遮罩像素、該色調替代機率以及該第一目前輸出色階,決定開啟或關閉該色調替***關之前,該多色調影像處理方法更包括:比較該藍雜訊遮罩圖樣與該輸入影像的大小;當該藍雜訊遮罩圖樣與該輸入影像的大小相同時,該目前輸入像素與該目前藍雜訊遮罩像素具有i'=i以及j'=j之對應關係,其中ii'分別為該目前輸入像素與該目前藍雜訊遮罩像素的列座 標,jj'分別為該目前輸入像素與該目前藍雜訊遮罩像素的行座標;當該藍雜訊遮罩圖樣與該輸入影像的大小不同時,該目前輸入像素與該目前藍雜訊遮罩像素具有i'=i mod M以及j'=j mod N之對應關係,其中MN分別為該輸入影像的高與寬。 The multi-tone image processing method according to claim 1, wherein in the step (d), the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation are determined to be turned on or Before the color tone replacement switch is turned off, the multi-tone image processing method further includes: comparing the blue noise mask pattern with the size of the input image; when the blue noise mask pattern is the same size as the input image, the current The input pixel and the current blue noise mask pixel have a correspondence relationship between i '= i and j '= j , where i and i ' are column coordinates of the current input pixel and the current blue noise mask pixel, respectively, j And j ' are the row coordinates of the current input pixel and the current blue noise mask pixel respectively; when the blue noise mask pattern is different from the size of the input image, the current input pixel and the current blue noise cover The mask pixel has a correspondence of i '= i mod M and j '= j mod N , where M and N are respectively the height and width of the input image. 如申請專利範圍第3項所述的多色調影像處理方法,其中在該步驟(d)中根據該目前藍雜訊遮罩像素、該色調替代機率以及該第一目前輸出色階,決定開啟或關閉該色調替***關的步驟包括:判斷該目前藍雜訊遮罩像素的像素值是否等於1;產生一隨機值,並且判斷該隨機值是否小於或等於該色調替代機率;判斷該第一目前輸出色階是否為該輸出色階集合中的最大輸出色階或最小輸出色階;以及當判斷該目前藍雜訊遮罩像素的像素值等於1、該隨機值小於或等於該色調替代機率並且該第一目前輸出色階不為該輸出色階集合中的最大輸出色階或最小輸出色階時,開啟該色調替***關,否則,關閉該色調替***關。 The multi-tone image processing method according to claim 3, wherein in the step (d), the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation are determined to be turned on or The step of turning off the tone replacement switch includes: determining whether the pixel value of the current blue noise mask pixel is equal to 1; generating a random value, and determining whether the random value is less than or equal to the tone replacement probability; determining the first current output Whether the color gradation is the maximum output gradation or the minimum output gradation in the output gradation set; and when determining that the pixel value of the current blue noise mask pixel is equal to 1, the random value is less than or equal to the tone replacement probability and the When the first current output level is not the maximum output level or the minimum output level in the output level set, the tone replacement switch is turned on; otherwise, the tone replacement switch is turned off. 如申請專利範圍第4項所述的多色調影像處理方法,其中該步驟(d)中根據該目前藍雜訊遮罩像素、該色調替代機率以及該第一目前輸出色階,決定開啟或關閉該色調替***關的演算公式包括方程式(2): 其中bn(i',j')為該目前藍雜訊遮罩像素的像素值,RAND(0,1)為該隨機值並且介於0到1之間,p為該色調替代機率,g s 為該第一目前輸出色階,g 1g q 分別為該輸出色階集合中的最大輸出色階與最小輸出色階。 The multi-tone image processing method of claim 4, wherein the step (d) determines whether to turn on or off according to the current blue noise mask pixel, the tone replacement probability, and the first current output level. The calculation formula for the tone replacement switch includes equation (2): Where bn ( i ', j ') is the pixel value of the current blue noise mask pixel, RAND (0, 1) is the random value and is between 0 and 1, p is the tone replacement probability, g s For the first current output level, g 1 and g q are the maximum output level and the minimum output level in the output level set, respectively. 如申請專利範圍第1項所述的多色調影像處理方法,其中該步驟(e)中當開啟該色調替***關時,取得該目前輸入像素所對應的該第二目前輸出色階的演算公式包括方程式(3): 其中g' s 為該第二目前輸出色階,v(i,j)為該輸入影像中第i列第j行的該目前輸入像素的像素值,其中Q'=Q-{g s },Q為該輸出色階集合,其中Q具有q色階,Q={g 1,g 2g q }並且g 1<g 2<…<g q g s 為該第一目前輸出色階。 The multi-tone image processing method of claim 1, wherein when the color tone replacement switch is turned on in the step (e), obtaining a calculation formula of the second current output color gradation corresponding to the current input pixel includes: Equation (3): Where g ' s is the second current output level, v ( i , j ) is the pixel value of the current input pixel of the jth row of the i-th column in the input image, where Q '= Q -{ g s }, Q is the set of output gradations, where Q has q gradation, Q = { g 1 , g 2 ... g q } and g 1 < g 2 <... < g q , g s is the first current output gradation. 如申請專利範圍第1項所述的方法,其中該步驟(g)中根據該目前輸出像素的色階值,執行該錯誤擴散程序,以產生相對於該目前輸入像素的所述鄰近輸入像素的所述錯誤擴散權重的步驟包括:利用一Floyd-Steinberg錯誤濾波器,針對該目前輸入像素執行該錯誤擴散程序,以產生所述鄰近輸入像素的所述錯誤擴散權重,其中所述鄰近輸入像素為位於該目前輸入像素的右方、右下方、正下方以及左下方的鄰近輸入像素。 The method of claim 1, wherein the step (g) performs the error diffusion process according to the gradation value of the current output pixel to generate the adjacent input pixel relative to the current input pixel. The step of erroneously spreading the weights includes: performing the error diffusion procedure for the current input pixel using a Floyd-Steinberg error filter to generate the error diffusion weight of the adjacent input pixel, wherein the adjacent input pixel is Adjacent input pixels located to the right, bottom right, directly below, and bottom left of the current input pixel. 如申請專利範圍第7項所述的多色調影像處理方法,其中該步驟(g)中選擇所述輸入像素之另一作為該目前輸入像素,並且重覆執行步驟(b)至步驟(f)的步驟包括:根據一蜿蜒蛇形掃描路徑逐一對各所述輸入像素執行該步驟(b)至該步驟(f)。 The multi-tone image processing method according to claim 7, wherein in the step (g), the other one of the input pixels is selected as the current input pixel, and steps (b) to (f) are repeatedly performed. The step of performing the step (b) to the step (f) is performed on a pair of the input pixels according to a serpentine scan path. 一種影像處理裝置,包括:一儲存單元,記錄多個模組;以及一或多個處理單元,耦接該儲存單元,以存取並執行該儲存單元中記錄的所述模組,所述模組包括:一像素選擇模組,接收一輸入影像的多個輸入像素,並且選擇所述輸入像素其中之一作為一目前輸入像素;一像素調整模組,根據該目前輸入像素的一錯誤擴散權重,調整該目前輸入像素的像素值;一色調替代模組,包括:一第一搜尋子模組,取得該目前輸入像素所對應的一第一目前輸出色階,其中該第一目前輸出色階為一輸出色階集合中的多個輸出色階與該目前輸入像素具有最小誤差的輸出色階;一第二搜尋子模組,取得該目前輸入像素所對應的一第二目前輸出色階,其中該第二目前輸出色階為所述輸出色階中與該目前輸入像素具有第二最小誤差的輸出色階;一開關控制子模組,根據一目前藍雜訊遮罩像素、 一色調替代機率以及該第一目前輸出色階,決定開啟或關閉一色調替***關,其中該藍雜訊遮罩圖樣包括多個藍雜訊遮罩像素,該目前藍雜訊遮罩像素為所述藍雜訊遮罩像素中對應於該目前輸入像素的藍雜訊遮罩像素;一第一色階設定子模組,當該開關控制子模組關閉該色調替***關時,設定對應於該目前輸入像素的一目前輸出像素的色階值為該第一目前輸出色階;以及一第二色階設定子模組,當該開關控制子模組開啟該色調替***關時,設定對應於該目前輸入像素的該目前輸出像素的色階值為該第二目前輸出色階;一錯誤擴散模組,當所述輸入像素中有尚未被像素選擇模組選擇的輸入像素時,根據該目前輸出像素的色階值,執行一錯誤擴散程序,以產生相對於該目前輸入像素的多個鄰近輸入像素的多個錯誤擴散權重,並且該像素選擇模組再選擇所述輸入像素之另一作為目前輸入像素;以及一影像輸出模組,當各所述輸入像素皆被像素選擇模組選擇時,根據各所述輸入像素所分別對應的目前輸出像素的色階值產生一多色調輸出影像。 An image processing apparatus includes: a storage unit that records a plurality of modules; and one or more processing units coupled to the storage unit to access and execute the module recorded in the storage unit, the module The group includes: a pixel selection module, receiving a plurality of input pixels of an input image, and selecting one of the input pixels as a current input pixel; a pixel adjustment module, according to an error diffusion weight of the current input pixel Adjusting the pixel value of the current input pixel; the color tone replacement module includes: a first search sub-module, and obtaining a first current output color gradation corresponding to the current input pixel, wherein the first current output color gradation An output gradation of a plurality of output gradations in the output gradation set and the current input pixel; and a second search sub-module, obtaining a second current output gradation corresponding to the current input pixel, The second current output gradation is an output gradation of the output gradation having a second minimum error with the current input pixel; a switch control sub-module, according to one Former blue noise mask pixels, a tone replacement probability and the first current output level, determining to turn on or off a tone replacement switch, wherein the blue noise mask pattern comprises a plurality of blue noise mask pixels, the current blue noise mask pixel is a blue noise mask pixel corresponding to the current input pixel in the blue noise mask pixel; a first color gradation setting sub-module, when the switch control sub-module turns off the color tone replacement switch, the setting corresponds to the At present, the gradation value of a current output pixel of the input pixel is the first current output gradation; and a second gradation setting sub-module, when the switch control sub-module turns on the gradation replacement switch, the setting corresponds to the The gradation value of the current output pixel of the input pixel is the second current output gradation; an error diffusion module, when the input pixel has an input pixel that has not been selected by the pixel selection module, according to the current output a color gradation value of the pixel, performing an error diffusion procedure to generate a plurality of error diffusion weights relative to the plurality of adjacent input pixels of the current input pixel, and the pixel selection module reselecting The other one of the input pixels is the current input pixel; and an image output module, when each of the input pixels is selected by the pixel selection module, according to the gradation value of the current output pixel corresponding to each of the input pixels Produces a multi-tone output image. 如申請專利範圍第9項所述的影像處理裝置,其中該第一搜尋子模組取得該目前輸入像素所對應的該第一目前輸出色階之演算方式包括方程式(1): 其中g s 為該第一目前輸出色階,v(i,j)為該目前輸入像素的像素值並且位於該輸入影像中的第i列第j行,其中Q為該輸出色階集合,Q具有q色階,Q={g 1,g 2g q }並且g 1<g 2<…<g q The image processing device of claim 9, wherein the calculation method of the first current output color gradation corresponding to the current input pixel by the first search sub-module comprises the equation (1): Where g s is the first current output level, v ( i , j ) is the pixel value of the current input pixel and is located in the i th column j row of the input image, where Q is the output level set, Q Has q gradation, Q = { g 1 , g 2 ... g q } and g 1 < g 2 <... < g q . 如申請專利範圍第10項所述的影像處理裝置,其中該開關控制子模組比較該藍雜訊遮罩圖樣與該輸入影像的大小,當該藍雜訊遮罩圖樣與該輸入影像的大小相同時,該開關控制子模組設定該目前輸入像素與該目前藍雜訊遮罩像素具有i'=i以及j'=j之對應關係,其中ii'分別為該目前輸入像素與該目前藍雜訊遮罩像素的列座標,jj'分別為該目前輸入像素與該目前藍雜訊遮罩像素的行座標;當該藍雜訊遮罩圖樣與該輸入影像的大小不同時,該開關控制子模組設定該目前輸入像素與該目前藍雜訊遮罩像素具有i'=i mod M以及j'=j mod N之對應關係,其中MN分別為該輸入影像的高與寬。 The image processing device of claim 10, wherein the switch control sub-module compares the blue noise mask pattern with the size of the input image, and the blue noise mask pattern and the size of the input image When the same, the switch control sub-module sets the correspondence between the current input pixel and the current blue noise mask pixel with i '= i and j '= j , where i and i ' are the current input pixel and the At present, the column coordinates of the blue noise mask pixel, j and j ' are the row coordinates of the current input pixel and the current blue noise mask pixel respectively; when the blue noise mask pattern is different from the size of the input image The switch control sub-module sets a correspondence between the current input pixel and the current blue noise mask pixel having i '= i mod M and j '= j mod N , where M and N are respectively the height of the input image With wide. 如申請專利範圍第11項所述的影像處理裝置,其中該開關控制子模組判斷該目前藍雜訊遮罩像素的像素值是否等於1;該開關控制子模組又產生一隨機值,並且判斷該隨機值是否小於或等於該色調替代機率;該開關控制子模組判斷該第一目前輸出色階是否為該輸出色階集合中的最大輸出色階或最小輸出色階;以及 當該開關控制子模組判斷該目前藍雜訊遮罩像素的像素值等於1、該隨機值小於或等於該色調替代機率並且該第一目前輸出色階不為該輸出色階集合中的最大輸出色階或最小輸出色階時,該開關控制子模組開啟該色調替***關,否則,該開關控制子模組關閉該色調替***關。 The image processing device of claim 11, wherein the switch control sub-module determines whether a pixel value of the current blue noise mask pixel is equal to 1; the switch control sub-module generates a random value again, and Determining whether the random value is less than or equal to the tone replacement probability; the switch control sub-module determines whether the first current output level is the maximum output level or the minimum output level in the output level set; When the switch control sub-module determines that the pixel value of the current blue noise mask pixel is equal to 1, the random value is less than or equal to the tone replacement probability, and the first current output level is not the largest of the output level sets. When the output level or the minimum output level is output, the switch control sub-module turns on the tone replacement switch; otherwise, the switch control sub-module turns off the tone replacement switch. 如申請專利範圍第12項所述的影像處理裝置,其中該開關控制子模組根據該目前藍雜訊遮罩像素、該色調替代機率以及該第一目前輸出色階,決定開啟或關閉該色調替***關的演算公式包括方程式(2): 其中bn(i',j')為該目前藍雜訊遮罩像素的像素值,RAND(0,1)為該隨機值並且介於0到1之間,p為該色調替代機率,g s 為該第一目前輸出色階,g 1g q 分別為該輸出色階集合中的最大輸出色階與最小輸出色階。 The image processing device of claim 12, wherein the switch control sub-module determines to turn the color tone on or off according to the current blue noise mask pixel, the color tone replacement probability, and the first current output color gradation. The calculation formula for the alternative switch includes equation (2): Where bn ( i ', j ') is the pixel value of the current blue noise mask pixel, RAND (0, 1) is the random value and is between 0 and 1, p is the tone replacement probability, g s For the first current output level, g 1 and g q are the maximum output level and the minimum output level in the output level set, respectively. 如申請專利範圍第9項所述的影像處理裝置,其中該第二搜尋子模組取得該目前輸入像素所對應的該第二目前輸出色階的演算公式包括方程式(3): 其中g' s 為該第二目前輸出色階,v(i,j)為該輸入影像中第i列第j行的該目前輸入像素的像素值,其中Q'=Q-{g s },Q為該輸出色階集合,其中Q具有q色階, Q={g 1,g 2g q }並且g 1<g 2<…<g q gs 為該第一目前輸出色階。 The image processing device of claim 9, wherein the second search sub-module obtains a calculation formula of the second current output level corresponding to the current input pixel, comprising equation (3): Where g ' s is the second current output level, v ( i , j ) is the pixel value of the current input pixel of the jth row of the i-th column in the input image, where Q '= Q -{ g s }, Q is the set of output gradations, where Q has q gradation, Q = { g 1 , g 2 ... g q } and g 1 < g 2 <... < g q , gs is the first current output gradation. 如申請專利範圍第9項所述的影像處理裝置,其中該錯誤擴散模組利用一Floyd-Steinberg錯誤濾波器,針對該目前輸入像素執行該錯誤擴散程序,以產生所述鄰近輸入像素的所述錯誤擴散權重,其中所述鄰近輸入像素為位於該目前輸入像素的右方、右下方、正下方以及左下方的鄰近輸入像素。 The image processing device of claim 9, wherein the error diffusion module performs the error diffusion process on the current input pixel to generate the adjacent input pixel by using a Floyd-Steinberg error filter. The error diffusion weight, wherein the adjacent input pixels are adjacent input pixels located to the right, bottom right, directly below, and to the lower left of the current input pixel. 如申請專利範圍第15項所述的影像處理裝置,其中該像素選擇模組根據一蜿蜒蛇形掃描路徑逐一選擇所述輸入像素之另一作為該目前輸入像素。 The image processing device of claim 15, wherein the pixel selection module selects one of the input pixels one by one as the current input pixel according to a serpentine scan path.
TW102143506A 2013-11-28 2013-11-28 Multitone image processing method and image processing apparatus TW201520972A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW102143506A TW201520972A (en) 2013-11-28 2013-11-28 Multitone image processing method and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW102143506A TW201520972A (en) 2013-11-28 2013-11-28 Multitone image processing method and image processing apparatus

Publications (1)

Publication Number Publication Date
TW201520972A true TW201520972A (en) 2015-06-01

Family

ID=53935086

Family Applications (1)

Application Number Title Priority Date Filing Date
TW102143506A TW201520972A (en) 2013-11-28 2013-11-28 Multitone image processing method and image processing apparatus

Country Status (1)

Country Link
TW (1) TW201520972A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473139A (en) * 2018-05-11 2019-11-19 台达电子工业股份有限公司 Using the image of bilateral scanning apart from conversion equipment and its method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473139A (en) * 2018-05-11 2019-11-19 台达电子工业股份有限公司 Using the image of bilateral scanning apart from conversion equipment and its method

Similar Documents

Publication Publication Date Title
US7440139B2 (en) Systems and methods for controlling a tone reproduction curve using error diffusion
US7898693B2 (en) Fast generation of dither matrix
JP4610802B2 (en) Gray level image edge enhancement
JP2009100228A (en) Image processing apparatus and control method therefor
Goyal et al. Clustered-dot halftoning with direct binary search
JP2007106097A (en) High-image-quality halftone process
JP2007116432A (en) High-quality halftone processing
JP2005354231A (en) Image processing apparatus, image processing method, image processing program, and storage medium
JP2006115500A (en) High-speed low memory paper color suppression algorithm
JP2007049443A (en) Generation of dither matrix
US7532755B2 (en) Image classification using concentration ratio
TW201520972A (en) Multitone image processing method and image processing apparatus
US7515748B2 (en) Controlled moving window adaptive histogram equalization
JP2003051004A (en) System and method for selecting image processing path by utilizing estimated appearance of noise
JP2019176406A (en) Image processing apparatus
TWI394094B (en) Co-optimization method for class matrix and diffusion weighting used in halftone image processing technique and co-optimization system thereof
JP2007208639A (en) Image processing method, image processing device, image recording device and recording medium
JP2012095173A (en) Image processing device, image formation device, and image processing method
JPH08214159A (en) Image processing method and image processing unit
US7317556B2 (en) Method for error diffusion employing a stamp field
US10339628B2 (en) Image processing apparatus, image processing method and computer readable medium
JP2020069717A (en) Image processing device, image formation apparatus, image processing method, image processing program and recording medium
JP5915410B2 (en) Image processing apparatus and program
Mao Digital imaging and halftoning algorithms design: Parallel processing, printed image artifacts modeling, and learning-based image analysis
US8670157B2 (en) Dot growth system and method