1378401 ►1378401 ►
V » • · 九、發明說明: 【發明所屬之技術領域】 本發明係有關内插方法(interPolati0n),特別是貝 爾圖案(Bayer pattern)内插法。 【先前技術】 彩色影像的每一個像素可以使用含三顏色成分的向量 來表示’例如使用可見光譜中的紅、綠、藍波段之光強度。 為了降低尺寸大小及成本,在一般影像裝置中,針對每一 個像素僅使.用一個疼濾波單元以擷取單一的色彩 (chromatic)值。接著’再根據鄰近相同顏色的像素值 以内插方法來得到其他的色彩值。第一圖所示的貝爾 鲁(Bayer)圖案(或馬赛克式)彩色濾波陣列是經常被使 用者。貝爾圖案之設計原理係根據人眼對於綠色之感光度 較南於紅色及藍色。在貝爾圖案中,綠色像素之數量相等 於紅色及藍色像素之總和。針對影像之貝爾圖案施以内插 以知到每個像素之三個顏色成分,此方法稱為貝爾圖案内 插法或解碼赛克法(demosaicing)。 1378401 即使貝爾圖案内插法在影像處理領域被普遍使用然 而其具有-些缺點’例如色彩混疊(aliasing)現象 高頻細節㈣失,甚至產生新頻率而嚴重破壞影像。 因此返需提出-種有效方法,使得貝爾圖案内插可以 具者地降低色彩混疊(aliasing )現象。 【發明内容】 鑑於上述,本發明的發明目的之一為提供一種圖案内 插之有效方法,例如貝爾圖案(Bayer pattern)内插法, 用以顯著地降低色彩混疊現象,並提升影像品質,特別是 位於其邊緣(edge)處及影像的細節。再者,本發明所需 之計算量較傳統内插法來得少。 根據本發明實施例,首先,根據一圖案彩色濾波器之 像素,用以產生水平内插綠色、紅色、藍色像素值,及垂 直内插綠色、紅色、藍色像素值。接著,根據水平及垂直 内插像素值,選擇綠色值之内插方向。以被選擇之内插綠 色值來更新紅色及藍色像素值β 【實施方式】 1378401 第二圖顯示本發明實施例之一的圖案内插(pattern interpolation)裝置200,而第三圖貝丨j顯示本發明實施例 之圖案内插方法300的流程。在本實施例中,裝置200 及方法300係用以提升經内插之貝爾(Bayer)圖案(或 馬賽克式)彩色濾波陣列(以下簡稱為貝爾圖案)的影像 品質。雖然在本實施例中例示了貝爾圖案之内插,然而本 籲發明實施例也可以直接或經修改後適用於其他彩色濾波陣 列的内插。本實施例使用8位元來表示亮度值,因此總共 有256灰階(亦即,0至255)。然而,也可根據特定系 統設計需求而使用其他的位元數。 • - ^ 在本實施例中,先進行綠色之水平内插(步驟30,第 三圖)。綠色水平内插裝置(21,第二圖)針對所接收到 φ ▼的貝爾圖案20(如第四圖所示者),於紅色或藍色像素位 置進行綠色值之水平内插。亦即,使用水平方向的相鄰綠 色像素來内插得到某一像素。在本實施例中係使用二元 (bilinear )内插方法,然而也可以使用其他内插方法。 底下顯示水平内插的一個例子: 於紅色像素位置(2, 2)作綠色水平内插:G2fl2 = (G21 + G2i3)/2 1378401 接著,在方塊23A (第二圖)及步驟32A (第三圖)中, 於綠色像素位置(2, 3)針對紅色與綠色之差值進行二元 内插以得到紅色值:¢ = 广丄巧广丄私 :(尽,2 + 及4,2 ) ’ 2 + G3 2 -去 Gf2 -去 G4W2 依同樣原理,於綠色像:素位置(3, 2)2内插2得到紅色值: '3,2 於藍色像素位置(3, 3 )内插得到紅色值V » • · Nine, invention description: [Technical field to which the invention pertains] The present invention relates to an interpolation method (interpolate), in particular, a Bayer pattern interpolation method. [Prior Art] Each pixel of a color image can be represented by a vector containing three color components, e.g., using light intensities of the red, green, and blue bands in the visible spectrum. In order to reduce the size and cost, in a typical image device, only one pain filtering unit is used for each pixel to capture a single chromatic value. Then, other color values are obtained by interpolation according to pixel values adjacent to the same color. The Bayer pattern (or mosaic) color filter array shown in the first figure is often used. The design principle of the Bell pattern is based on the sensitivity of the human eye to green, which is more south than red and blue. In the Bell pattern, the number of green pixels is equal to the sum of the red and blue pixels. Interpolating the Bell pattern of the image to know the three color components of each pixel is called Bell Pattern Interpolation or Demosaicing. 1378401 Even though the Bell pattern interpolation method is commonly used in the field of image processing, it has some disadvantages such as color aliasing, high frequency detail (four) loss, and even new frequency and severe image destruction. Therefore, an effective method is proposed to make the Bell pattern interpolation reduce the aliasing phenomenon. SUMMARY OF THE INVENTION In view of the above, it is an object of the present invention to provide an effective method of pattern interpolation, such as Bayer pattern interpolation, to significantly reduce color aliasing and improve image quality. Especially at the edge and the details of the image. Moreover, the amount of computation required by the present invention is less than that of conventional interpolation. In accordance with an embodiment of the invention, first, pixels of a pattern color filter are used to generate horizontally interpolated green, red, and blue pixel values, and vertically interpolate green, red, and blue pixel values. Next, the interpolation direction of the green value is selected according to the horizontal and vertical interpolation pixel values. Updating the red and blue pixel values β with the selected interpolated green value. [Embodiment] 1378401 The second figure shows a pattern interpolation device 200 according to one embodiment of the present invention, and the third figure is shown in FIG. The flow of the pattern interpolation method 300 of the embodiment of the present invention is shown. In the present embodiment, apparatus 200 and method 300 are used to enhance the image quality of an interpolated Bayer pattern (or mosaic) color filter array (hereinafter referred to as a Bell pattern). Although the interpolation of the Bell pattern is exemplified in the present embodiment, the embodiment of the invention can be applied directly or modified to the interpolation of other color filter arrays. This embodiment uses 8-bits to represent luminance values, so there are a total of 256 gray levels (i.e., 0 to 255). However, other bit numbers can also be used depending on the specific system design requirements. • - ^ In this embodiment, horizontal interpolation of green is performed first (step 30, third picture). The green horizontal interpolation means (21, second picture) performs a horizontal interpolation of the green value at the red or blue pixel position for the Bell pattern 20 (as shown in the fourth figure) where φ ▼ is received. That is, a certain pixel is interpolated using adjacent green pixels in the horizontal direction. A bilinear interpolation method is used in this embodiment, however other interpolation methods may be used. An example of horizontal interpolation is shown below: Green level interpolation at red pixel position (2, 2): G2fl2 = (G21 + G2i3)/2 1378401 Next, at block 23A (second picture) and step 32A (third In the figure, the binary pixel is interpolated for the difference between red and green at the green pixel position (2, 3) to get the red value: ¢ = 丄 丄 丄 丄 :: (2, and 2, 2) 2 + G3 2 - Go to Gf2 - Go to G4W2 According to the same principle, interpolate 2 in the green image: prime position (3, 2) 2 to get the red value: '3, 2 interpolated at the blue pixel position (3, 3) Red value
A 私=(W W4+g -士% _>4 十2 上述例子使用經水平内插所得之綠色值來產生紅色 之 值。使用類似的運算,也可以藉由使祕水平内插所得 綠色值來產生藍色值。 使用與水平内插相同的原理,於步驟31 (第三圖)中 進行,亲色值之垂直内插^上述之水平内插(步驟3〇)與垂 直内插(步驟31)之進行順序可加以改變,甚至同時進行。 於垂直内插步驟31中,綠色垂直内插裝置(22,第二圖) 針對所接收到的貝爾圖案2Q,於紅色或藍色像素位置進行 、彔色值之垂直内插。亦g卩,使㈣直方向的相鄰綠色像素 來内插得到某-像素。底下顯示垂直内插的—個例子Μ 於紅色像素位置(2,2)作綠色垂直内插:.‘(㈣Μ 1378401 接著,在方塊23B (第二圖)及步驟32B (第三圖)中, 於綠色像素位置(2, 3)針對紅色與綠色之差值進行二元 内插以得到紅色值:= + 依同樣原理,於綠色像素位置(3,2)内插得到紅色值: < =(氏,2 + 及4,2 ) ’ 2 + G3,2 _ 了《2 _ 五 β2 於藍色像素位置(3, 3 )内插得到紅色值: <3 =¾ +^2,4 +^4,2 +^4)/4 + ¾ ~~〇12 -^GV2A~U[2 ~^G:a 上述例子使用經垂直内插所得之綠色值來產生紅色 值。使用類似的運算,也可以藉由使用經垂直内插所得之 綠色值來產生藍色值。 I ', ; 在得到水平内插像素值GH、RH、BH及垂直内插像素 值Gv、Rv、Bv之後,使用RGB-至-YIQ轉換器24A/24B 將這些像素值轉換為YIQ或其他適當之色彩空間(color space)(步驟33A/33B)。值得注意的是,所轉換之色彩 空間並不限定於YIQ ;甚至,在某些應用中,也可以省略 色彩空間的轉換。在本實施例中,内插之R、G、B像素值 轉換為8位元之I (亦即,同相(in phase ))值可表示如 下: = 0.596 * R^j - 0.2755 * - 0.321 * 1378401 I 1 其中’ C代表(i,j)位置之水平内插R、G、B像素值經 運算所得到的水平I值;A Private = (W W4 + g - 士% _ > 4 XX 2 The above example uses the green value obtained by horizontal interpolation to produce a red value. Using a similar operation, the resulting green value can also be interpolated by the secret level. To generate a blue value. Using the same principle as horizontal interpolation, proceed in step 31 (third image), vertical interpolation of the color value, horizontal interpolation (step 3〇) and vertical interpolation (step) 31) The order of the operations can be changed, even simultaneously. In the vertical interpolation step 31, the green vertical interpolation device (22, second image) is performed at the red or blue pixel position for the received Bell pattern 2Q. Vertical interpolation of the 彔 color value. Also, let (4) the adjacent green pixels in the straight direction interpolate to obtain a certain pixel. The bottom example shows the vertical interpolation Μ in the red pixel position (2, 2) Green vertical interpolation: .'((4)Μ 1378401 Next, in block 23B (second picture) and step 32B (third picture), in the green pixel position (2, 3) for the difference between red and green in binary Insert to get the red value: = + according to the same principle, in the green pixel position Set (3, 2) to get the red value: < = (氏, 2 + and 4, 2 ) ' 2 + G3, 2 _ "2 _ five β2 interpolated at the blue pixel position (3, 3) Get the red value: <3 =3⁄4 +^2,4 +^4,2 +^4)/4 + 3⁄4 ~~〇12 -^GV2A~U[2 ~^G:a The above example uses vertical interpolation The resulting green value produces a red value. Using a similar operation, the blue value can also be generated by using the green value obtained by vertical interpolation. I ', ; The horizontal interpolation pixel values GH, RH, BH and After vertically interpolating the pixel values Gv, Rv, Bv, these pixel values are converted to YIQ or other suitable color space using RGB-to-YIQ converters 24A/24B (steps 33A/33B). Yes, the converted color space is not limited to YIQ; even in some applications, the color space conversion can be omitted. In this embodiment, the interpolated R, G, and B pixel values are converted to 8-bit. The value of I (i.e., in phase) can be expressed as follows: = 0.596 * R^j - 0.2755 * - 0.321 * 1378401 I 1 where 'C represents the horizontal interpolation of the (i, j) position R, G, B pixel value is obtained by operation Level I value;
Jlj = 0-596 * - 0.2755 * G[j - 0.321 * 其:’(代表(i,j)俾置之垂直内插r、g、b像素值經 運算所得到的垂直I值。 接下來,根據這些水平及垂直!值,使用邊緣(edge) 偵測器25及方向選擇器26來偵測邊緣及選擇g (綠色) 内插方向(步驟34)。例如,位於紅色像素位置(2, 2) 之偵測及選擇可以表示(但不限定於)如下: (la) (lb) (lc) (ld) (le) ^ ^2,2 - + |i2ff2 - + Threshold < |/[2 -+1/[2 _ /J2| ^2,2 = 1 f |72,2 - ^2,i| +1/2^2 -/2ff3| > \ΐζ2 - + μκ2 _ 7^| + ηκβΜ(1 _ G2,2 =Jlj = 0-596 * - 0.2755 * G[j - 0.321 * which: '(Represents the vertical I value obtained by the vertical interpolation of the r, g, b pixel values of the (i, j) device. Next, Based on these horizontal and vertical! values, an edge detector 25 and a direction selector 26 are used to detect the edge and select the g (green) interpolation direction (step 34). For example, at the red pixel position (2, 2) The detection and selection can be expressed (but not limited to) as follows: (la) (lb) (lc) (ld) (le) ^ ^2,2 - + |i2ff2 - + Threshold < |/[2 - +1/[2 _ /J2| ^2,2 = 1 f |72,2 - ^2,i| +1/2^2 -/2ff3| > \ΐζ2 - + μκ2 _ 7^| + ηκβΜ( 1 _ G2, 2 =
Else g2,2 = (¾+(^)/2 當條件(la)符合時,亦即,水平方向的像素值差異 小於垂直方向的像素值差異且達到至少一臨界值 (threshold)’則選擇水平方向作為〇内插方向,表示此 時的邊緣係位於水平方向。此時,則以内插綠色值私來取 代作為位置(2,2)的綠色像素值(lb)。當條件(lc) 1378401 l Bf亦即,垂直方向的料值差異小於水平方向的像 ^值差異且達到至少—臨界值(thresh〇id),則選擇垂直 向作為G内插方向’表示此時的邊緣係位於垂直方向。 插綠色值心來取代作為位置(2,2)w 像素值(⑷。假如條件(la)及(⑷皆不符合,則. 和%之平均值來取代作為位置(2, 2)的綠色像素值(le): # 上述(la)至(le)例示紅色像素位置之偵測與選擇; 依相同原理,可針對藍色像素位置作類似的偵測與選擇。 最後,使用位於紅色或藍色像素位置之選擇G(綠色) 像素值(亦即,GH或扣以更新hpdatd這些位置的 紅色或藍色内插值(方塊27及步驟35)。例如,位於綠色 鲁像素位置(2, 3)的内插紅色值經更新為如下所示: ^Te = + r2a)/i + g2,3-\〇lr -X-Gi:y 其中’在水平方向被選擇時,#广為$ (lb);在垂直方 向被選擇時,CMUd);在兩種方向皆未被選擇Else g2,2 = (3⁄4+(^)/2 When the condition (la) is met, that is, the pixel value difference in the horizontal direction is smaller than the pixel value difference in the vertical direction and reaches at least one threshold value (threshold), then the selection level The direction is used as the interpolation direction of the 〇, indicating that the edge at this time is in the horizontal direction. At this time, the green pixel value (lb) as the position (2, 2) is replaced by the interpolated green value. When the condition (lc) 1378401 l In other words, if the difference in the material value in the vertical direction is smaller than the difference in the image value in the horizontal direction and reaches at least the threshold value (thresh〇id), the vertical direction is selected as the G interpolation direction' to indicate that the edge system at this time is in the vertical direction. Insert the green value center to replace the pixel value as the position (2, 2) w ((4). If the conditions (la) and ((4) are not met, then the average of . and % is substituted for the green pixel as position (2, 2) Value (le): # The above (la) to (le) illustrate the detection and selection of the red pixel position; according to the same principle, similar detection and selection can be made for the blue pixel position. Finally, the use is located in red or blue. Pixel position selection G (green) pixel value (ie, GH Buckle to update the red or blue interpolated values for these locations of hpdatd (blocks 27 and 35). For example, the interpolated red value at the green lu pixel position (2, 3) is updated as follows: ^Te = + r2a ) /i + g2,3-\〇lr -X-Gi:y where 'when selected in the horizontal direction, #广为$ (lb); when selected in the vertical direction, CMUd); neither in either direction be chosen
Gi,iv g22 ( le) ° 鑑於上面所述,本發明實施例提供一種圖案内插之有 效方法’例如貝爾圖案内插法’用以顯著地降低色彩混疊 11 1378401 現象,並提升影像品質,特別是位於其邊緣(edge)處及 影像的細節。再者,本發明所需之計算量較傳統内插法來 得少。 以上所述僅為本發明之較佳實施例而已,並非用以限 定本發明之申請專利範圍;凡其它未脫離發明所揭示之精 神下所完成之等效改變或修飾,均應包含在下述之申請專 暴利範圍内。 【圖式簡單說明】 第一圖顯示貝爾(Bayer)圖案(或馬賽克式)彩色濾波 陣列。 第二圖顯示本發明實施例之一的圖案内插裝置。 φ第三圖顯示本發明實施例之圖案内插方法的流程。 第四圖例示簡化之貝爾圖案像素。 【主要元件符號說明】 200 圖案内插裝置 20 貝爾圖案 21 綠色水平内插裝置 22 綠色垂直内插裝置 23A 紅色&藍色内插 12 1378401 • 1 23B 紅色&藍色内插 24A、 24B RGB-至-YIQ 轉換 25 偵測器 26 方向選擇器 27 更新紅色&藍色内插值 300 圖案内插方法 30-35 圖案内插方法的流程步驟 • 13Gi, iv g22 (le) ° In view of the above, an embodiment of the present invention provides an effective method of pattern interpolation, such as Bell Pattern Interpolation, to significantly reduce color aliasing 11 1378401 and improve image quality. Especially at the edge and the details of the image. Moreover, the amount of computation required for the present invention is less than that of conventional interpolation. The above description is only the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention; all other equivalent changes or modifications which are not departing from the spirit of the invention should be included in the following Apply for a range of special profits. [Simple description of the diagram] The first figure shows a Bayer pattern (or mosaic) color filter array. The second figure shows a pattern interpolation device according to one embodiment of the present invention. The third diagram of φ shows the flow of the pattern interpolation method of the embodiment of the present invention. The fourth figure illustrates a simplified Bell pattern pixel. [Main component symbol description] 200 pattern interpolation device 20 Bell pattern 21 Green horizontal interpolation device 22 Green vertical interpolation device 23A Red & blue interpolation 12 1378401 • 1 23B Red & blue interpolation 24A, 24B RGB -to-YIQ conversion 25 detector 26 direction selector 27 update red & blue interpolation value 300 pattern interpolation method 30-35 process step of pattern interpolation method • 13