[go: up one dir, main page]

JP7387411B2 - Image processing device, image processing method, and imaging device - Google Patents

Image processing device, image processing method, and imaging device Download PDF

Info

Publication number
JP7387411B2
JP7387411B2 JP2019218226A JP2019218226A JP7387411B2 JP 7387411 B2 JP7387411 B2 JP 7387411B2 JP 2019218226 A JP2019218226 A JP 2019218226A JP 2019218226 A JP2019218226 A JP 2019218226A JP 7387411 B2 JP7387411 B2 JP 7387411B2
Authority
JP
Japan
Prior art keywords
pixel
edge
interest
color interpolation
noise
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
JP2019218226A
Other languages
Japanese (ja)
Other versions
JP2021090104A (en
Inventor
真也 岸上
Original Assignee
シャープセミコンダクターイノベーション株式会社
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 シャープセミコンダクターイノベーション株式会社 filed Critical シャープセミコンダクターイノベーション株式会社
Priority to JP2019218226A priority Critical patent/JP7387411B2/en
Publication of JP2021090104A publication Critical patent/JP2021090104A/en
Application granted granted Critical
Publication of JP7387411B2 publication Critical patent/JP7387411B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)
  • Color Image Communication Systems (AREA)

Description

本発明は画像処理装置および画像処置方法に関し、特に、ベイヤ配列を備えた撮像装置に設けられる画像処理装置および画像処置方法、並びに撮像装置に関する。 The present invention relates to an image processing device and an image processing method, and particularly relates to an image processing device and an image processing method provided in an imaging device having a Bayer array, and an imaging device.

従来、例えばディジタルカメラやビデオカメラなどで用いられているCCDやCMOSなどの固体撮像素子からは、一般に、光の明るさに関する情報のみが出力される。したがって、固体撮像素子が1つである単板式カメラでは、色情報を得るために、CCDに含まれる1画素毎に1つの色成分のみを通過させる色フィルタがCCDの前に被せられ、動作時に各画素部から対応する色成分をそれぞれ出力するように構成されている。例えば原色フィルタの場合、色成分の種類は3原色のR(赤)、G(緑)およびB(青)の3種類である。これらの色フィルタの各色成分の配列には、いくつかの種類が提案されている。その代表的なものとして、ベイヤ配列が挙げられる。このベイヤ配列は、輝度信号に寄与する割合が大きいGが市松状に配置され、残りの箇所にRおよびBが市松状に配置されている。このようなベイヤ配列などの色フィルタが被せられたCCDから信号出力された時点では、画素毎にRGBの色成分の中で1色分の色情報しか得られていない。そこで、画像処理部によって、画素毎に残り2色分の情報を周辺画素の色信号値から推定して算出することにより、残りの色情報を得るという補間処理が行われている。 Conventionally, solid-state imaging devices such as CCDs and CMOSs used in digital cameras, video cameras, and the like generally output only information regarding the brightness of light. Therefore, in a single-chip camera with one solid-state image sensor, in order to obtain color information, a color filter is placed in front of the CCD that allows only one color component to pass through for each pixel included in the CCD. It is configured so that each pixel portion outputs a corresponding color component. For example, in the case of a primary color filter, there are three types of color components: the three primary colors R (red), G (green), and B (blue). Several types of arrangement of each color component of these color filters have been proposed. A typical example is the Bayer array. In this Bayer array, G, which contributes a large proportion to the luminance signal, is arranged in a checkerboard pattern, and R and B are arranged in the remaining locations in a checkerboard pattern. When a signal is output from a CCD covered with a color filter such as a Bayer array, color information for only one color among RGB color components is obtained for each pixel. Therefore, an interpolation process is performed in which the image processing unit estimates and calculates information for the remaining two colors for each pixel from the color signal values of surrounding pixels to obtain the remaining color information.

上記の補間処理の例として、特許文献1に開示された技術が挙げられる。 An example of the above-mentioned interpolation process is the technique disclosed in Patent Document 1.

特許文献1では、ガンマ補正後のベイヤデータを取得するデータ補間部を備えた画像処理装置が開示されている。データ補間部では、二次元状でマトリクス状に配列された各画素部に対してそれぞれ、注目画素付近におけるエッジ(輝度値が急激に変化する部分)の有無およびエッジの方向性が、注目画素とその近傍画素の色信号を用いた演算処理によって検出される。そして、データ補間部は、このエッジの有無および検出されたエッジの方向性に応じたデータ補間処理をおこない、画素毎にRGB信号を出力する。 Patent Document 1 discloses an image processing device including a data interpolation unit that acquires Bayer data after gamma correction. In the data interpolation section, for each pixel part arranged in a two-dimensional matrix, the presence or absence of an edge (a part where the brightness value changes rapidly) near the pixel of interest and the direction of the edge are determined to be the pixel of interest and the direction of the edge. It is detected by arithmetic processing using color signals of neighboring pixels. Then, the data interpolation section performs data interpolation processing according to the presence or absence of this edge and the directionality of the detected edge, and outputs an RGB signal for each pixel.

注目画素付近におけるエッジを求めて補間処理をおこなう技術については、ほかにも特許文献2に開示されているものがある。 There is another technique disclosed in Patent Document 2 that finds edges near the pixel of interest and performs interpolation processing.

特開2008-125132号公報(2008年5月29日公開)Japanese Patent Application Publication No. 2008-125132 (published on May 29, 2008) 特開2009-65671号公報(2009年3月26日公開)Japanese Patent Application Publication No. 2009-65671 (published on March 26, 2009)

上述の従来技術には、いずれも課題がある。例えば、特許文献1に開示された補間処理では、エッジ検出処理において、注目画素付近にエッジがなく輝度勾配がなだらかな平坦部分であるか否かを判定する際に、閾値で判定する技術が開示される。具体的には、エッジ検出成分の最大値(エッジと交差する方向)と閾値を比較してエッジ成分が閾値よりも小さければ平坦部分としている。しかしながら、イメージセンサからの出力データは、平坦部分であってもショットノイズ等が含まれている。ショットノイズは、同一フレーム内でも輝度が高い部分と低い部分とではノイズ量が異なる。そのため、輝度平均が高いと、ショットノイズが閾値を超える。そのため、平坦部分をエッジ部分として誤検出する虞がある。 All of the above-mentioned conventional techniques have problems. For example, in the interpolation process disclosed in Patent Document 1, a technique is disclosed that uses a threshold value to determine whether there is no edge near the pixel of interest and a flat part with a gentle luminance gradient in the edge detection process. be done. Specifically, the maximum value of the edge detection component (in the direction intersecting the edge) is compared with a threshold, and if the edge component is smaller than the threshold, it is determined to be a flat portion. However, the output data from the image sensor includes shot noise and the like even if it is a flat portion. Regarding shot noise, the amount of noise differs between a high-luminance part and a low-luminance part even within the same frame. Therefore, when the brightness average is high, shot noise exceeds the threshold. Therefore, there is a possibility that a flat portion may be erroneously detected as an edge portion.

また、特許文献2に開示された補間処理では、エッジの方向性データ算出の為に7×7ピクセルの参照画素領域内で勾配計算を行っている。これを実現するためには7行分のラインメモリ(=ラインバッファとも呼ばれる)が必要である。また、対角線方向の勾配計算において、計算式の末尾に7による除算が存在しているが、2のべき乗以外の除算はビットシフトで計算することが出来ない。そのため、対角線方向の勾配計算のために除算回路が別途必要になり、回路規模が大きくなる。 Furthermore, in the interpolation process disclosed in Patent Document 2, gradient calculation is performed within a reference pixel area of 7×7 pixels in order to calculate edge directionality data. To realize this, a line memory (also called a line buffer) for seven lines is required. Furthermore, in calculating the gradient in the diagonal direction, there is a division by 7 at the end of the calculation formula, but divisions other than powers of 2 cannot be calculated by bit shifting. Therefore, a separate division circuit is required to calculate the gradient in the diagonal direction, which increases the circuit scale.

本発明の一態様は、従前よりも平坦部分とエッジ部分とを正確に判別して精度よく色補間処理をおこなう画像処理装置および画像処理方法、並びに撮像装置を実現することを目的とする。 An object of one aspect of the present invention is to realize an image processing device, an image processing method, and an imaging device that can discriminate flat portions and edge portions more accurately than before and perform color interpolation processing with high precision.

上記の課題を解決するために、本発明の一態様に係る画像処置装置は、ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化した方向性データを用いて、エッジ方向を検出する方向検出部と、前記方向間で前記方向性データに差が有るか否かを判定する判定部と、前記近傍画素のノイズ量を算出するノイズ量算出部と、前記差が有ると判定された前記方向性データの最大値と、前記ノイズ量を含む閾値とを比較する比較部と、前記比較部の比較結果に応じて、(i)前記最大値が前記閾値より大きい場合は前記注目画素に対して前記エッジ方向を用いた色補間をおこない、(ii)前記最大値が前記閾値以下である場合は前記注目画素に対して前記(i)の色補間とは異なる色補間をおこなう色補間部と、を備えている。 In order to solve the above problems, an image processing device according to one aspect of the present invention generates directionality data that quantifies the directionality of edges in a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions. a direction detection unit that detects an edge direction using the method; a determination unit that determines whether or not there is a difference in the directional data between the directions; and a noise amount calculation unit that calculates the amount of noise of the neighboring pixels; a comparison unit that compares the maximum value of the directional data determined to have the difference with the threshold value including the noise amount; and (i) the maximum value is the threshold value, according to the comparison result of the comparison unit. (ii) If the maximum value is less than or equal to the threshold, the color interpolation of (i) is performed on the pixel of interest. and a color interpolation unit that performs different color interpolation.

上記の課題を解決するために、本発明の一態様に係る撮像装置は、上述の画像処理装置と、ベイヤ配列を有したカラーフィルタを有した撮像素子とを備えている。 In order to solve the above problems, an imaging device according to one aspect of the present invention includes the above-described image processing device and an imaging element having a color filter having a Bayer array.

上記の課題を解決するために、本発明の一態様に係る画像処理方法は、ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化した方向性データを用いて、エッジ方向を検出する方向検出ステップと、前記方向間で前記方向性データに差が有るか否かを判定する判定ステップと、前記近傍画素のノイズ量を算出するノイズ量算出ステップと、前記差が有ると判定された前記方向性データの最大値と、前記ノイズ量を含む閾値とを比較する比較ステップと、前記比較ステップの比較結果に応じて、(i)前記最大値が前記閾値より大きい場合は前記注目画素に対して前記エッジ方向を用いた色補間をおこない、(ii)前記最大値が前記閾値以下である場合は前記注目画素に対して前記(i)の色補間とは異なる色補間をおこなう色補間ステップと、を含む。 In order to solve the above problems, an image processing method according to one aspect of the present invention uses directional data that quantifies the directionality of edges in a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions. a direction detection step of detecting an edge direction using the method, a determination step of determining whether there is a difference in the directional data between the directions, and a noise amount calculation step of calculating the amount of noise of the neighboring pixels; a comparison step of comparing the maximum value of the directional data determined to have the difference with a threshold value including the noise amount; and (i) the maximum value is the threshold value, according to the comparison result of the comparison step. (ii) If the maximum value is less than or equal to the threshold, the color interpolation of (i) is performed on the pixel of interest. and a color interpolation step of performing different color interpolations.

本発明の一態様によれば、従前よりも精度よく色補間処理をおこなうことが可能な画像処理装置および画像処理方法、並びに撮像装置を実現することができる。 According to one aspect of the present invention, it is possible to realize an image processing device, an image processing method, and an imaging device that can perform color interpolation processing with higher precision than before.

本発明の一実施形態に係る撮像装置の主要構成を示す図である。1 is a diagram showing the main configuration of an imaging device according to an embodiment of the present invention. 図1に示す撮像装置の構成要素である画像処理部の詳細な構成を示すブロック図である。FIG. 2 is a block diagram showing a detailed configuration of an image processing unit that is a component of the imaging device shown in FIG. 1. FIG. 2次元的に示したベイヤデータを示しており、本明細書において用いている水平方向、垂直方向、右斜め上方向および左斜め上方向という文言について説明する図である。It is a diagram showing Bayer data shown two-dimensionally and explaining the words "horizontal direction, vertical direction, diagonally upper right direction, and diagonally upper left direction" used in this specification. エッジの方向に関して定義を説明する図である。FIG. 3 is a diagram illustrating a definition regarding the direction of an edge. 図2に示す画像処理部に設けられた仮判定部の基本的な仮判定方法を説明する図である。FIG. 3 is a diagram illustrating a basic provisional determination method of a provisional determination unit provided in the image processing unit shown in FIG. 2; 図2に示す画像処理部に設けられたノイズ量算出部によっておこなわれるノイズ量の算出方法を説明する図である。3 is a diagram illustrating a method of calculating a noise amount performed by a noise amount calculating section provided in the image processing section shown in FIG. 2. FIG. 図2に示す画像処理部に設けられたエッジ判定部においておこなわれる判定において用いられる閾値について説明する図である。3 is a diagram illustrating a threshold value used in a determination performed in an edge determination section provided in the image processing section shown in FIG. 2. FIG. 図2に示す画像処理部に設けられたエッジ判定部においておこなわれる判定手順について説明する図である。3 is a diagram illustrating a determination procedure performed in an edge determination section provided in the image processing section shown in FIG. 2. FIG. 図2に示す画像処理部に設けられたノイズ量算出部によっておこなわれるノイズ量の算出方法を説明する図である。3 is a diagram illustrating a method of calculating a noise amount performed by a noise amount calculating section provided in the image processing section shown in FIG. 2. FIG. エッジ方向が、右斜め上方向である場合の、図2に示す画像処理部に設けられた色補間部においておこなわれる色補間処理を概念的に示す図である。3 is a diagram conceptually showing color interpolation processing performed in a color interpolation section provided in the image processing section shown in FIG. 2 when the edge direction is diagonally upward to the right. FIG. 図2に示す画像処理部に設けられたエッジ決定部によって決定(確定)されたエッジ方向が、左斜め上方向である場合(エッジ検出においてDNEが最も小さい)について説明する図である。FIG. 3 is a diagram illustrating a case where the edge direction determined (confirmed) by the edge determination section provided in the image processing section shown in FIG. 2 is the diagonally upper left direction ( DNE is the smallest in edge detection). 図2に示す画像処理部に設けられた色補間部230がおこなう勾配法について説明する図である。3 is a diagram illustrating a gradient method performed by a color interpolation section 230 provided in the image processing section shown in FIG. 2. FIG. 図2に示す画像処理部に設けられた色補間部230がおこなう色相関法について説明する図である。3 is a diagram illustrating a color correlation method performed by a color interpolation section 230 provided in the image processing section shown in FIG. 2. FIG. 図2に示す画像処理部の動作フロー(画像処理フロー)を示すフローチャートである。3 is a flowchart showing an operation flow (image processing flow) of the image processing section shown in FIG. 2. FIG. 図14に示す動作フローの一部についての詳細なフロー図である。15 is a detailed flow diagram of a part of the operation flow shown in FIG. 14. FIG. 図14に示す動作フローの一部についての詳細なフロー図である。15 is a detailed flow diagram of a part of the operation flow shown in FIG. 14. FIG. 本発明の他の実施形態に係る撮像装置の構成要素である画像処理部の動作フローを示すフローチャートである。7 is a flowchart showing an operation flow of an image processing unit that is a component of an imaging device according to another embodiment of the present invention. 図17に示す動作フローの一部について説明する図である。18 is a diagram illustrating a part of the operation flow shown in FIG. 17. FIG. 図17に示す動作フローの一部について説明する図である。18 is a diagram illustrating a part of the operation flow shown in FIG. 17. FIG. 図17に示す動作フローの一部について説明する図である。18 is a diagram illustrating a part of the operation flow shown in FIG. 17. FIG.

以下、本発明の一実施形態について、図1から図16を用いて説明する。 Hereinafter, one embodiment of the present invention will be described using FIGS. 1 to 16.

(1)撮像装置
図1は、本実施形態の撮像装置1の主要構成を示す図である。図1を用いて、撮像装置1の主要構成を説明する。なお、本実施形態に係る撮像装置1の構成例は、特許文献1の撮像装置の概略構成図と同じである。このことは、画像処理部125における信号処理が特許文献1とは異なるが、本明細書に記載の技術は一般的な撮像装置に適用可能であることを意味している。
(1) Imaging device FIG. 1 is a diagram showing the main configuration of an imaging device 1 of this embodiment. The main configuration of the imaging device 1 will be explained using FIG. 1. Note that the configuration example of the imaging device 1 according to this embodiment is the same as the schematic configuration diagram of the imaging device in Patent Document 1. This means that although the signal processing in the image processing unit 125 is different from that in Patent Document 1, the technology described in this specification is applicable to general imaging devices.

撮像装置1は、撮像光学系100(結像光学系)と、アクチュエータ系110と、被写体照明用の電子フラッシュ115と、AF(オートフォーカス)補助光源116と、制御部120と、表示部131と、操作部132と、フラッシュメモリ133とを備えている。 The imaging device 1 includes an imaging optical system 100 (imaging optical system), an actuator system 110, an electronic flash 115 for object illumination, an AF (autofocus) auxiliary light source 116, a control section 120, and a display section 131. , an operation section 132, and a flash memory 133.

撮像光学系100は、第1レンズ群101と、絞り兼用シャッタ102と、第2レンズ群103と、第3レンズ群105と、光学的ローパスフィルタ106と、撮像素子107とを有する。撮像光学系100の先端に配置された第1レンズ群101は、レンズ鏡筒にて光軸方向に進退可能に保持される。絞り兼用シャッタ102は、その開口径を調節することで撮影時の光量調節を行う他、静止画撮影時には露光秒時調節用シャッタとしての機能をもつ。第2レンズ群103は、絞り兼用シャッタ102と一体となって光軸方向に進退し、第1レンズ群101の進退動作との連動により、変倍作用(ズーム機能)を有する。第3レンズ群105は、光軸方向の進退により焦点調節を行うフォーカスレンズである。光学的ローパスフィルタ106は、撮影画像の偽色やモアレを軽減するための光学素子である。撮像素子107は、例えば2次元CMOS(相補型金属酸化膜半導体)フォトセンサ(フォトダイオード部)と周辺回路からなる固体撮像素子であり、撮像光学系100の結像面に配置される。 The imaging optical system 100 includes a first lens group 101 , an aperture/shutter 102 , a second lens group 103 , a third lens group 105 , an optical low-pass filter 106 , and an image sensor 107 . A first lens group 101 arranged at the tip of the imaging optical system 100 is held by a lens barrel so as to be movable in the optical axis direction. The diaphragm/shutter 102 not only adjusts the amount of light during photographing by adjusting its aperture diameter, but also functions as a shutter for adjusting the exposure time during still image photographing. The second lens group 103 moves forward and backward in the optical axis direction integrally with the diaphragm/shutter 102, and has a variable magnification effect (zooming function) in conjunction with the movement of the first lens group 101 back and forth. The third lens group 105 is a focus lens that adjusts focus by moving back and forth in the optical axis direction. The optical low-pass filter 106 is an optical element for reducing false colors and moiré in captured images. The image sensor 107 is a solid-state image sensor that includes, for example, a two-dimensional CMOS (complementary metal oxide semiconductor) photosensor (photodiode section) and peripheral circuitry, and is arranged on the imaging plane of the imaging optical system 100.

アクチュエータ系110は、ズームアクチュエータ111と、絞りシャッタアクチュエータ112と、フォーカスアクチュエータ114とを有する。ズームアクチュエータ111は、不図示のカム筒を回動することで、第1レンズ群101および第2レンズ群103を光軸方向に移動させて変倍動作を行う。絞りシャッタアクチュエータ112は、絞り兼用シャッタ102の開口径を制御して撮影光量を調節すると共に、静止画撮影時の露光時間制御を行う。フォーカスアクチュエータ114は、第3レンズ群105を光軸方向に移動させて焦点調節動作を行う。 The actuator system 110 includes a zoom actuator 111, an aperture shutter actuator 112, and a focus actuator 114. The zoom actuator 111 rotates a cam barrel (not shown) to move the first lens group 101 and the second lens group 103 in the optical axis direction, thereby performing a zooming operation. The diaphragm shutter actuator 112 controls the aperture diameter of the diaphragm/shutter 102 to adjust the amount of photographing light, and also controls the exposure time when photographing still images. The focus actuator 114 moves the third lens group 105 in the optical axis direction to perform a focus adjustment operation.

電子フラッシュ115は、撮影時に使用し、キセノン管を用いた閃光照明装置または連続発光するLED(発光ダイオード)を備えた照明装置が用いられる。 The electronic flash 115 is used during photography, and is a flash lighting device using a xenon tube or a lighting device equipped with a continuous light emitting LED (light emitting diode).

AF補助光源116は、所定の開口パターンを有したマスクの像を、投光レンズを介して被写界に投影する。これにより、低輝度の被写体または低コントラストの被写体に対する焦点検出能力が向上する。 The AF auxiliary light source 116 projects an image of a mask having a predetermined aperture pattern onto the field through a projection lens. This improves focus detection ability for low-luminance objects or low-contrast objects.

制御部120には、中央演算処理装置であるCPU121のほか、以下で説明する各種構成が具備される。 The control unit 120 includes a CPU 121, which is a central processing unit, and various other components described below.

CPU121は、種々の制御を司る制御中枢機能をもつ。CPU121は、演算部、ROM(リード・オンリ・メモリ)、RAM(ランダム・アクセス・メモリ)、A(アナログ)/D(デジタル)コンバータ、D/Aコンバータ、通信インターフェイス回路等を有する。CPU121はROMに記憶された所定のプログラムに従って、撮像装置1内の各種構成を駆動し、AF制御、撮像処理、画像処理、記録処理等の一連の動作を実行する。CPU121は本実施形態の欠陥画素検出、欠陥画素補正の制御を行う。 The CPU 121 has a control center function that manages various controls. The CPU 121 includes an arithmetic unit, a ROM (read only memory), a RAM (random access memory), an A (analog)/D (digital) converter, a D/A converter, a communication interface circuit, and the like. The CPU 121 drives various components within the imaging device 1 according to a predetermined program stored in the ROM, and executes a series of operations such as AF control, imaging processing, image processing, and recording processing. The CPU 121 controls defective pixel detection and defective pixel correction in this embodiment.

電子フラッシュ制御部122は、制御部120に具備され、CPU121の制御指令に従い、撮影動作に同期して電子フラッシュ115を点灯制御する回路である。 The electronic flash control unit 122 is a circuit that is included in the control unit 120 and controls lighting of the electronic flash 115 in synchronization with the photographing operation according to control instructions from the CPU 121.

補助光源駆動部123は、制御部120に具備され、CPU121の制御指令に従い、焦点検出動作に同期してAF補助光源116を点灯制御する回路である。 The auxiliary light source driving section 123 is a circuit that is included in the control section 120 and controls lighting of the AF auxiliary light source 116 in synchronization with the focus detection operation according to a control command from the CPU 121.

撮像素子駆動部124は、制御部120に具備され、撮像素子107の撮像動作を制御するとともに、撮像素子107から取得した画像信号をA/D変換してCPU121に送信する回路である。 The image sensor driving section 124 is a circuit that is included in the control section 120 and controls the imaging operation of the image sensor 107, and also performs A/D conversion on an image signal acquired from the image sensor 107 and transmits the A/D converter to the CPU 121.

画像処理部125(画像処理装置)は、制御部120に具備され、CPU121の制御指令に従い、撮像素子107により取得した画像のガンマ補正、拡大縮小、JPEG(Joint Photographic Experts Group)圧縮等の処理を行う回路である。また、画像処理部125は、撮像素子107により取得した撮像画像の生成処理を行う。撮像画像の画像信号は記録処理や表示処理が行われる。また、この画像処理部125において、後述する色補間処理を含む画像処理がおこなわれる。 The image processing unit 125 (image processing device) is included in the control unit 120 and performs processing such as gamma correction, scaling, and JPEG (Joint Photographic Experts Group) compression of the image acquired by the image sensor 107 according to control instructions from the CPU 121. This is the circuit that does this. Further, the image processing unit 125 performs a process of generating a captured image acquired by the image sensor 107. The image signal of the captured image is subjected to recording processing and display processing. The image processing unit 125 also performs image processing including color interpolation processing, which will be described later.

フォーカス駆動部126は、制御部120に具備され、CPU121の制御指令に従い、焦点検出結果に基づいてフォーカスアクチュエータ114を駆動し、第3レンズ群105を光軸方向に移動させて焦点調節を行う回路である。 The focus drive unit 126 is a circuit that is included in the control unit 120 and drives the focus actuator 114 based on the focus detection result in accordance with the control command from the CPU 121 to move the third lens group 105 in the optical axis direction to adjust the focus. It is.

絞りシャッタ駆動部128は、制御部120に具備され、CPU121の制御指令に従い、絞りシャッタアクチュエータ112を駆動し、絞り兼用シャッタ102の開口径を制御する回路である。 The aperture shutter drive unit 128 is a circuit that is included in the control unit 120 and drives the aperture shutter actuator 112 in accordance with a control command from the CPU 121 to control the aperture diameter of the aperture shutter 102 .

ズーム駆動部129は、制御部120に具備され、CPU121の制御指令に従い、撮影者のズーム操作指示に応じてズームアクチュエータ111を駆動する回路である。 The zoom drive unit 129 is a circuit that is included in the control unit 120 and drives the zoom actuator 111 in accordance with control commands from the CPU 121 and in response to zoom operation instructions from the photographer.

以上が、本実施形態における制御部120の構成である。 The above is the configuration of the control unit 120 in this embodiment.

表示部131は、LCD(液晶表示装置)等の表示デバイスを有し、撮像装置1の撮影モードに関する情報、撮影前のプレビュー画像と撮影後の確認用画像、焦点検出時の合焦状態表示画像等を表示する。 The display unit 131 has a display device such as an LCD (liquid crystal display), and displays information regarding the shooting mode of the imaging device 1, a preview image before shooting, a confirmation image after shooting, and a focus state display image when detecting focus. etc. will be displayed.

操作部132は、操作スイッチとして、電源スイッチ、レリーズ(撮影トリガ)スイッチ、ズーム操作スイッチ、撮影モード選択スイッチ等を備え、操作指示信号をCPU121に出力する。 The operation unit 132 includes a power switch, a release (shooting trigger) switch, a zoom operation switch, a shooting mode selection switch, etc. as operation switches, and outputs an operation instruction signal to the CPU 121.

フラッシュメモリ133は、撮像装置1に着脱可能な記録媒体であり、撮影済み画像データ等を記録する。 The flash memory 133 is a recording medium that is removably attached to the imaging device 1, and records captured image data and the like.

(2)画像処理部
上述のように本実施形態の撮像装置1は、被写体を撮像可能とする撮像素子107と、撮像素子107からの撮像データをA/D編換するA/D変換部(不図示)と、このA/D変換部からのデジタル信号を各種信号処理する画像処理装置としての画像処理部125とを有している。
(2) Image Processing Unit As described above, the imaging device 1 of this embodiment includes the image sensor 107 that can image a subject, and the A/D converter (A/D converter) that converts the image data from the image sensor 107 into A/D. (not shown) and an image processing section 125 serving as an image processing device that performs various signal processing on the digital signal from this A/D conversion section.

撮像素子107は、被写体光が所定のカラーフィルタを通ってフォトダイオード部に入射され、フォトダイオード部によって各画素に対応する色の大きさを表すアナログ電気信号に光電変換されて出力される。なお、この場合のカラーフィルタは、RGBの3原色でベイヤ配列とする。 In the image sensor 107, subject light passes through a predetermined color filter and enters a photodiode section, and the photodiode section photoelectrically converts the signal into an analog electrical signal representing the size of a color corresponding to each pixel and outputs the signal. Note that the color filter in this case has a Bayer arrangement using the three primary colors of RGB.

A/D変換部は、撮像素子107から出力されるアナログ電気信号がデジタル信号(以下、ベイヤデータという)に変換されて出力される。 The A/D converter converts the analog electrical signal output from the image sensor 107 into a digital signal (hereinafter referred to as Bayer data) and outputs the digital signal.

画像処理部125は、A/D変換部から出力されるベイヤデータ(画像データ)が入力される。そして、後述する各種処理が施されるほか、図示しないが、ホワイトバランス、ガンマ補正等の各種画像処理が施された後に、画素部毎にRGBデータが全て揃った画像データを出力する。 The image processing section 125 receives Bayer data (image data) output from the A/D conversion section. Then, in addition to various types of processing described later, various image processing such as white balance and gamma correction (not shown) is performed, and then image data including all RGB data for each pixel portion is output.

以下、図2を用いて画像処理部125を説明する。 The image processing section 125 will be explained below using FIG. 2.

(2.1)画像処理部の構成
図2は、図1に示す撮像装置1の構成要素である画像処理部125の詳細な構成を示すブロック図である。
(2.1) Configuration of Image Processing Unit FIG. 2 is a block diagram showing a detailed configuration of the image processing unit 125, which is a component of the imaging device 1 shown in FIG. 1.

画像処理部125は、色補間方向として用いるエッジ方向を決定して、決定したエッジ方向を用いて色補間をおこなう処理をおこなう。そのために、画像処理部125は、エッジ方向を決定するエッジ予備決定部210およびエッジ決定部220と、色補間をおこなう色補間部230とを有している。より詳細には、エッジ予備決定部210においてエッジ方向を予備的に決定(仮決定)して、エッジ決定部220においてエッジ方向を決定(確定)し、色補間部230において色補間をおこなう。 The image processing unit 125 determines an edge direction to be used as a color interpolation direction, and performs a process of performing color interpolation using the determined edge direction. To this end, the image processing section 125 includes an edge preliminary determination section 210 and an edge determination section 220 that determine the edge direction, and a color interpolation section 230 that performs color interpolation. More specifically, the edge direction is preliminarily determined (tentatively determined) in the edge preliminary determination section 210, the edge direction is determined (determined) in the edge determination section 220, and color interpolation is performed in the color interpolation section 230.

ここで、色補間をおこなう際には、エッジ(画像内において輝度値が急激に変化する部分)に沿う方向のデータを用いて補間をおこなうほうが良い結果が出る。反対に、エッジと交差する方向のデータを用いて色補間をおこなうと、偽色が発生する場合がある。エッジが無い領域であれば周囲画素のデータを使用して色補間をおこなうことができる。また、ベイヤ配列の場合、輝度成分への寄与率が、G画素はR,B画素の2倍大きい。そのため、第一にR,B画素上におけるG画素を補間する。従って、エッジ予備決定部210およびエッジ決定部220は、注目画素がR,B画素の場合に動作するものとする。 Here, when performing color interpolation, better results can be obtained by performing interpolation using data in a direction along edges (portions where brightness values change rapidly in an image). On the other hand, if color interpolation is performed using data in a direction that intersects an edge, false colors may occur. If the area has no edges, color interpolation can be performed using data of surrounding pixels. Further, in the case of the Bayer array, the contribution rate to the luminance component of the G pixel is twice as large as that of the R and B pixels. Therefore, first, G pixels on R and B pixels are interpolated. Therefore, it is assumed that the edge preliminary determination section 210 and the edge determination section 220 operate when the pixel of interest is an R or B pixel.

<エッジ予備決定部>
エッジ予備決定部210は、エッジ方向を予備的に決定する。
<Edge preliminary determination section>
The edge preliminary determination unit 210 preliminarily determines the edge direction.

エッジ予備決定部210は、図2に示すように、方向性データ算出部211と、方向検出部212とを有している。 The edge preliminary determination section 210 includes a directionality data calculation section 211 and a direction detection section 212, as shown in FIG.

方向性データ算出部211は、エッジ成分値(方向性データ)を算出する。ここでいう「方向性データ」は、対象となるベイヤデータ(画像データ)の各画素に対して、少なくとも斜め方向を含む指定方向(複数の方向)と注目画素付近における実際のエッジ方向との近似度が大きいほど値が小さくなるデータである。要するに、方向性データは、ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化したデータである。方向性データ算出部211は、予め決められた複数の指定方向のそれぞれに対して、この方向性データを算出する。以下、頭文字Dを付して説明しているものが、方向性データである。 The directional data calculation unit 211 calculates edge component values (directional data). The "directional data" here refers to the degree of approximation between the specified direction (multiple directions), including at least diagonal directions, and the actual edge direction near the pixel of interest, for each pixel of the target Bayer data (image data). The larger the value, the smaller the value. In short, the directional data is data that quantifies the directionality of edges in a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions. The directional data calculation unit 211 calculates directional data for each of a plurality of predetermined specified directions. Hereinafter, what is explained with the initial letter D is directional data.

方向性データ算出部211は、詳細な算出処理は後述するが、以下に定義される方向性データD、D、DNE、DNWを算出する。
:水平方向に対して交差するエッジの有無を検出するための指標である水平方向の勾配成分の分析結果
:垂直方向に対して交差するエッジの有無を検出するための指標である垂直方向の勾配成分の分析結果
NE:右斜め上方向に対して交差するエッジの有無を検出するための指標である右斜め上方向の勾配成分の分析結果
NW:左斜め上方向に対して交差するエッジの有無を検出するための指標である左斜め上方向の勾配成分の分析結果。
The directional data calculation unit 211 calculates directional data D H , D V , D NE , and D NW defined below, although detailed calculation processing will be described later.
DH : An analysis result of the gradient component in the horizontal direction, which is an index for detecting the presence or absence of an edge that intersects with the horizontal direction.D V : An index that detects the presence or absence of an edge that intersects with the vertical direction. Analysis result of the gradient component in the vertical direction D NE : Analysis result of the gradient component in the diagonally upper right direction, which is an index for detecting the presence or absence of an edge that intersects with the diagonally upper right direction D NW : With respect to the diagonally upper left direction Analysis results of the gradient component in the diagonally upper left direction, which is an index for detecting the presence or absence of intersecting edges.

なお、ここで用いている「水平方向」および「垂直方向」という用語については、図1の撮像素子107の固体撮像素子のフォトダイオード配列の水平方向および垂直方向に対応する。すなわち、図3に示す2次元的に示したベイヤデータ3001bayerにおいて、R22を注目画素として定め、紙面左右方向が「水平方向」に相当し、紙面上下方向が「垂直方向」に相当する。同様に、図3に示す2次元的に示したベイヤデータ3002bayerにおいて、ここで用いている「右斜め上方向」が紙面右斜め上方向に相当し、「左斜め上方向」が紙面左斜め上方向に相当する。 Note that the terms "horizontal direction" and "vertical direction" used here correspond to the horizontal direction and vertical direction of the photodiode array of the solid-state image sensor of the image sensor 107 in FIG. 1. That is, in the two-dimensional Bayer data 3001 shown in FIG. 3, R 22 is determined as a pixel of interest, the left-right direction of the page corresponds to the "horizontal direction", and the up-down direction of the page corresponds to the "vertical direction". Similarly, in the two-dimensional Bayer data 3002 shown in FIG . Corresponds to the direction.

方向性データ算出部211は、具体的には、5(行)×5(列)ピクセルの参照画素領域内で勾配計算をおこなう。従って、ラインメモリは5行分必要である。ベイヤ配列において注目画素がRの場合、最近接の垂直・水平方向にGの画素データ、対角線方向にBの画素データが存在する。方向性データは、各方向に対する勾配分析を行うことによって求める。勾配量が大きい場合は、その方向に交差するエッジが存在することを示し、勾配量が小さいあるいはゼロの場合は、エッジに沿う方向であるか、エッジが存在しない平坦部分であることを意味する。 Specifically, the directional data calculation unit 211 performs gradient calculation within a reference pixel area of 5 (rows)×5 (columns) pixels. Therefore, line memory for five lines is required. When the pixel of interest is R in the Bayer array, there is G pixel data in the nearest vertical and horizontal directions, and B pixel data in the diagonal direction. Directionality data is obtained by performing gradient analysis for each direction. If the gradient amount is large, it indicates that there is an edge that intersects in that direction, and if the gradient amount is small or zero, it means that the direction is along the edge or it is a flat part with no edges. .

注目画素がRの場合の勾配分析は、下記の式(1)にて求める。本実施形態では、対角線の分析を加減算とビットシフト処理のみで可能である。なお、注目画素がBの場合は、数式および文中のRとBを読み替えるだけで同じ方法を用いて求めることができる。 Gradient analysis when the pixel of interest is R is obtained using the following equation (1). In this embodiment, diagonal analysis can be performed only by addition/subtraction and bit shift processing. Note that if the pixel of interest is B, it can be determined using the same method by simply replacing R and B in the formula and text.

Figure 0007387411000001
Figure 0007387411000001

上記の式(1)において、水平方向の勾配成分(D)は、注目画素の最近接の水平方向のG画素同士の絶対値差分と、注目画素と最近接水平方向のR画素の絶対差分(左側・右側)と、最近接のB画素の水平方向同士の絶対差分(上側・下側)とを加算したものとする。B画素の絶対差分値は後述の対角線方向のデータ成分を考慮して、2で除算する。 In the above equation (1), the horizontal gradient component (D H ) is the absolute difference between the horizontal G pixels closest to the pixel of interest, and the absolute difference between the pixel of interest and the nearest R pixel in the horizontal direction. (left side/right side) and the absolute difference between the nearest B pixels in the horizontal direction (upper side/lower side). The absolute difference value of the B pixel is divided by 2 in consideration of data components in the diagonal direction, which will be described later.

上記の式(1)において、垂直方向の勾配成分(D)は、注目画素の最近接垂直方向のG画素同士の絶対差分と、注目画素と最近接垂直方向のR画素の絶対差分(上側・下側)と、最近接のB画素の垂直方向同士の絶対差分(左側・右側)と、を加算したものとする。B画素の絶対差分値は後述の対角線方向のデータ成分を考慮して、2で除算する。 In the above equation (1), the vertical gradient component (D V ) is the absolute difference between the G pixels in the vertical direction closest to the pixel of interest, and the absolute difference between the pixel of interest and the R pixel in the vertical direction (upper side).・lower side) and the absolute difference between the closest B pixels in the vertical direction (left side/right side). The absolute difference value of the B pixel is divided by 2 in consideration of data components in the diagonal direction, which will be described later.

上記の式(1)において、右斜め上方向の勾配成分(DNE)は、注目画素の最近接の右斜め上方向のG画素同士の絶対差分と、注目画素と最近接右斜め上方向のR画素の絶対差分(右上・左下)と、最近接のB画素の右斜め上方向の絶対差分と、を加算したものとする。 In the above equation (1), the gradient component in the diagonally upper right direction (D NE ) is the absolute difference between the G pixels closest to the pixel of interest in the diagonally upper right direction, and the gradient component between the pixel of interest and the nearest diagonally upper right direction. It is assumed that the absolute difference of the R pixel (upper right and lower left) and the absolute difference of the nearest B pixel in the diagonally upper right direction are added.

上記の式(1)において、左斜め上方向の勾配成分(DNW)は、注目画素の最近接の左斜め上方向のG画素同士の絶対差分と、注目画素と最近接左斜め上方向のR画素の絶対差分(左上・右下)と、最近接のB画素の左斜め上方向の絶対差分と、を加算したものとする。 In the above equation (1), the gradient component in the diagonally upward left direction (D NW ) is the absolute difference between the G pixels closest to the pixel of interest in the diagonally upward left direction, and the gradient component between the pixel of interest and the nearest diagonally upward left direction. It is assumed that the absolute difference of the R pixel (upper left and lower right) and the absolute difference of the nearest B pixel in the diagonally upper left direction are added.

なお、対角線方向の勾配計算については、注目画素の対角線方向にG画素が存在せず、最近接のG画素で代用して計算することになるため、水平・垂直方向に比べると精度が悪くなる。そのため、エッジ検出の精度が悪くなる可能性があるため、対角線方向の勾配分析結果であるDNE、DNWについては係数Aを乗算する。これにより、対角線方向のエッジ検出精度を制御する。係数Aを大きくするほどエッジが対角線方向に交差する方向に存在することを意味するため、水平・垂直方向に沿って色の補間がおこなわれることになる。 Note that when calculating the gradient in the diagonal direction, there is no G pixel in the diagonal direction of the pixel of interest, and the calculation is performed using the nearest G pixel instead, so the accuracy is lower than in the horizontal and vertical directions. . Therefore, since the accuracy of edge detection may deteriorate, the coefficient A is multiplied with respect to D NE and D NW , which are the gradient analysis results in the diagonal direction. This controls edge detection accuracy in the diagonal direction. The larger the coefficient A is, the more edges are present in the diagonal direction, which means that color interpolation is performed along the horizontal and vertical directions.

以上の手順によって、方向性データ算出部211が各方向の方向性データ(D、D、DNE、DNW)を算出する。 Through the above procedure, the directional data calculation unit 211 calculates directional data (D H , D V , D NE , D NW ) in each direction.

方向検出部212は、方向性データ算出部211が算出した方向性データ(D、D、DNE、DNW)を取得して、注目画素およびその近傍画素(注目画素を通る付近画素)(以下、これらを纏めて注目画素付近と称する)におけるエッジの有無およびエッジ方向を検出する。先述のように色補間方向はエッジ方向(エッジに沿う方向)でおこなうと良好な結果を得ることができる。そのため、方向検出部212は、各方向性データから、いずれの方向がエッジに沿う方向であるのかを特定する。エッジに沿う方向は、すなわち勾配成分が小さい方向である。要するに、方向検出部212は、D、D、DNE、DNWのうちの最小値を示す方向性データを特定(選択)する。詳細は後述する。なお、各方向性データの取得は、図1に示すCPU121からおこなってもよいし、あるいは方向性データ算出部211からおこなってもよい。 The direction detection unit 212 acquires the directional data (D H , DV , D NE , D NW ) calculated by the directional data calculation unit 211 and determines the pixel of interest and its neighboring pixels (nearby pixels passing through the pixel of interest). (hereinafter collectively referred to as the vicinity of the pixel of interest), the presence or absence of an edge and the edge direction are detected. As mentioned above, good results can be obtained by performing color interpolation in the edge direction (direction along the edge). Therefore, the direction detection unit 212 identifies which direction is along the edge from each directional data. The direction along the edge is the direction in which the gradient component is small. In short, the direction detection unit 212 specifies (selects) the direction data indicating the minimum value among D H , D V , D NE , and D NW . Details will be described later. Note that each directional data may be acquired from the CPU 121 shown in FIG. 1 or from the directional data calculation unit 211.

ここで、図4に示す3行×3列の画素領域内で、「エッジ方向(エッジに沿う方向)」を説明する。ここでは、画素の取り得る値を0~255(8bit階調)として説明する。図4の左側の画素領域Aでは、最も左側に位置する1列目の3画素(L00、L10、L20)が画素値「0」であり、2列目および3列目の計6画素(L01、L11、L21、L02、L12、L22)が画素値「255」であると仮定する。この画素領域Aでは、1列目の3画素(L00、L10、L20)と、2列目の3画素(L01、L11、L21)との間にエッジがある。すなわち、画素領域Aでは、図示するように紙面上下方向に沿った方向が「エッジ方向(エッジに沿う方向)」である。反対に、紙面左右方向に沿った方向がエッジと交差する方向である。一方、図4の右側の画素領域Bでは、方向の定義が画素領域Aとは逆である。すなわち、図4の右側の画素領域Bでは、最も上側に位置する1行目の3画素(L00、L01、L02)が画素値「0」であり、2行目および3行目の計6画素(L10、L11、L12、L20、L21、L22)が画素値「255」であると仮定する。この画素領域Bでは、1行目の3画素(L00、L01、L02)と、2行目の3画素(L01、L11、L21)との間にエッジがある。すなわち、画素領域Bでは、図示するように紙面左右方向に沿った方向が「エッジ方向(エッジに沿う方向)」であり、紙面上下方向に沿った方向がエッジと交差する方向である。 Here, the "edge direction (direction along the edge)" within the 3 rows x 3 columns pixel area shown in FIG. 4 will be described. Here, the possible values of a pixel will be explained as 0 to 255 (8-bit gradation). In the pixel area A on the left side of FIG. 4, three pixels (L 00 , L 10 , L 20 ) in the first column located on the leftmost side have a pixel value of "0", and a total of 6 pixels in the second and third columns have a pixel value of "0". Assume that the pixels (L 01 , L 11 , L 21 , L 02 , L 12 , L 22 ) have a pixel value of “255”. In this pixel area A, there is an edge between the three pixels in the first column (L 00 , L 10 , L 20 ) and the three pixels in the second column (L 01 , L 11 , L 21 ). That is, in the pixel area A, the direction along the vertical direction of the paper surface is the "edge direction (direction along the edge)" as shown in the figure. On the other hand, the direction along the horizontal direction of the page is the direction that intersects the edge. On the other hand, in pixel region B on the right side of FIG. 4, the direction definition is opposite to that of pixel region A. That is, in the pixel area B on the right side of FIG. 4, the three pixels (L 00 , L 01 , L 02 ) in the first row located at the top have a pixel value of "0", and the pixel values in the second and third rows are "0". It is assumed that a total of six pixels (L 10 , L 11 , L 12 , L 20 , L 21 , L 22 ) have a pixel value of “255”. In this pixel region B, there is an edge between the three pixels (L 00 , L 01 , L 02 ) in the first row and the three pixels (L 01 , L 11 , L 21 ) in the second row. That is, in the pixel region B, as shown in the figure, the direction along the horizontal direction of the paper is the "edge direction (direction along the edge)" and the direction along the vertical direction of the paper is the direction intersecting the edge.

以上のように、エッジ予備決定部210によってエッジ方向が求められるが、後述する理由から、本実施形態では、更に以下に説明するエッジ決定部220を備えて、先に求めたエッジ方向を後段の色補間部230による色補間処理に用いることの適否を判定する。 As described above, the edge direction is determined by the edge preliminary determining section 210, but for the reason described later, in this embodiment, the edge determining section 220, which will be explained below, is further provided to determine the previously determined edge direction. It is determined whether the color interpolation unit 230 is suitable for use in color interpolation processing.

<エッジ決定部>
エッジ決定部220は、エッジ予備決定部210によって予備的に決定したエッジ方向について、後段の色補間部230による色補間処理に用いることの適否を判定する。そのために、エッジ決定部220は、図2に示すように、仮判定部221(判定部)と、ノイズ量算出部222と、エッジ判定部223(比較部)とを有している。
<Edge determination section>
The edge determination unit 220 determines whether or not the edge direction preliminarily determined by the edge preliminary determination unit 210 is suitable for use in color interpolation processing by the color interpolation unit 230 at the subsequent stage. For this purpose, the edge determination section 220 includes a temporary determination section 221 (determination section), a noise amount calculation section 222, and an edge determination section 223 (comparison section), as shown in FIG.

仮判定部221は、注目画素付近が平坦部分であるかエッジ部分であるかを仮判定する。なお、後述するエッジ判定部223においてエッジ部分であるか否かを確定させるため、この仮判定部221における判定結果を仮の判定結果とみなす。 The tentative determination unit 221 tentatively determines whether the vicinity of the pixel of interest is a flat portion or an edge portion. Note that in order to determine whether or not it is an edge portion in an edge determination section 223, which will be described later, the determination result in this provisional determination section 221 is regarded as a provisional determination result.

仮判定部221は、一例として、エッジ予備決定部210の演算結果である各方向の方向性データを取得し、これら方向性データのうちの最大値と最小値とが等しい場合、注目画素付近を平坦部分と仮判定する。なお、先述のとおり、最大値を示す方向性データに対応する方向は、エッジと交差する方向とみなすことができ、最小値を示す方向性データに対応する方向は、エッジに沿う方向とみなすことができる。ここで、最大値は、最小値と同様に、先のエッジ予備決定部210によって特定されていてもよい。 For example, the provisional determination unit 221 acquires directional data in each direction that is the calculation result of the edge preliminary determination unit 210, and if the maximum value and minimum value of these directional data are equal, Tentatively determined to be a flat part. As mentioned above, the direction corresponding to the directional data indicating the maximum value can be regarded as the direction that intersects the edge, and the direction corresponding to the directional data indicating the minimum value can be regarded as the direction along the edge. Can be done. Here, the maximum value may be specified by the edge preliminary determination unit 210, similar to the minimum value.

図5を用いて、仮判定部221の基本的な仮判定方法を説明する。なお、図5では、説明の便宜上、3行×3列の画素領域を用い、画素の取り得る値を0~255(8bit階調)として説明する。 The basic provisional determination method of the provisional determination unit 221 will be explained using FIG. 5. In FIG. 5, for convenience of explanation, a pixel area of 3 rows x 3 columns is used, and the possible values of the pixels are 0 to 255 (8-bit gradation).

図5に示す画素領域の縦(垂直)方向にエッジがあるa)の例において、各方向の方向性データは下記のように絶対値差分によって求められる。
=|L01-L21|=0
=|L10-L12|=255
NE=|L02-L20|=255
NW=|L00-L22|=255
このとき、Dが最も小さいため、画素領域の縦(垂直)方向に沿ってエッジが存在する、すなわちエッジ方向は縦(垂直)方向である、とみなすことができる。a)の例では、D=DNE=DNWであるため、エッジに交差する方向はこの3つのうちのどれを用いても構わない。図5に示すa)~c)に示すエッジが含まれている例では、最小値を示す方向性データと最大値を示す方向性データとが必ず存在する。
In the example of a) in which the pixel area has edges in the vertical (vertical) direction shown in FIG. 5, the directionality data in each direction is determined by the absolute value difference as shown below.
D V = |L 01 -L 21 |=0
D H = |L 10 -L 12 |=255
D NE =|L 02 -L 20 |=255
D NW = | L 00 - L 22 | = 255
At this time, since DV is the smallest, it can be considered that an edge exists along the vertical (vertical) direction of the pixel area, that is, the edge direction is the vertical (vertical) direction. In the example a), since D H =D NE =D NW , any of these three directions may be used to intersect the edge. In an example including edges a) to c) shown in FIG. 5, there is always directional data indicating a minimum value and directional data indicating a maximum value.

一方で、図5のd)~f)に示す例では、上記の計算式では最小値を示す方向性データと最大値を示す方向性データとを見出せない。しかしながら、後述するように参照画素領域を5行×5列の領域へ拡張したり、注目画素(中央部)との差分を考慮したりすることにより、図5のd)~f)に示す例であってもエッジ方向(つまり、エッジが含まれていること)を検出することが可能である。 On the other hand, in the examples shown in d) to f) in FIG. 5, the above calculation formula cannot find the directional data indicating the minimum value and the directional data indicating the maximum value. However, as will be described later, by expanding the reference pixel area to an area of 5 rows x 5 columns and considering the difference from the pixel of interest (center), the examples shown in d) to f) in FIG. It is possible to detect the edge direction (that is, the fact that an edge is included) even if

また、図5に示すg)、h)の例が示す平坦部分の場合、各方向の方向性データは下記の様に求まる。
=|L01-L21|=0
=|L10-L12|=0
NE=|L02-L20|=0
NW=|L00-L22|=0
このとき、全ての方向性データは同一の値を示しており、差が無いことがわかる。このように、方向によって方向性データに差が無い、換言すれば方向性データの最小値と最大値が同一である場合は平坦部分であると判定することができる。
Further, in the case of a flat portion shown in examples g) and h) shown in FIG. 5, the directionality data in each direction is determined as follows.
D V = |L 01 -L 21 |=0
D H = |L 10 -L 12 |=0
D NE =|L 02 -L 20 |=0
D NW = |L 00 -L 22 |=0
At this time, all the directional data show the same value, indicating that there is no difference. In this way, if there is no difference in the directional data depending on the direction, in other words, if the minimum value and the maximum value of the directional data are the same, it can be determined that it is a flat portion.

なお、平坦部分であると判定された場合には、後述するように周辺画素のデータを使用して色補間をおこなう。 Note that if it is determined that the area is a flat area, color interpolation is performed using data of surrounding pixels as described later.

このように仮判定部221では、注目画素付近がエッジ部分であるか否かを仮判定することができる。 In this manner, the tentative determination unit 221 can tentatively determine whether or not the vicinity of the pixel of interest is an edge portion.

ところで、図1の撮像素子107からの出力データは、平坦部分であっても何らかのノイズが含まれている。例えば、平坦部分である箇所において検出される値には、ショットノイズの値が含まれる場合がある。この場合、注目画素付近が本来は平坦部分であっても、算出される方向性データの最大値と最小値が等しくならないことがあり、エッジ部分であると誤判定される虞がある。エッジ部分と誤判定されてデモザイク処理がおこなわれると、ノイズ成分が強調される虞がある。 Incidentally, the output data from the image sensor 107 in FIG. 1 includes some noise even in a flat portion. For example, values detected at a flat portion may include shot noise values. In this case, even if the vicinity of the pixel of interest is originally a flat portion, the maximum value and minimum value of the calculated directional data may not be equal, and there is a risk that it may be erroneously determined to be an edge portion. If it is erroneously determined to be an edge portion and demosaic processing is performed, there is a risk that noise components will be emphasized.

そこで、そのような誤判定を抑制するべく、本実施形態では、近傍画素のノイズ量と予め定めた判定パラメータとを加えた値と、方向性データの最大値と、を比較する。これにより、注目画素付近が(真に)エッジ部分であるか否かを確定する。そして、注目画素付近がエッジ部分であると確定された場合は、後述するようなエッジ方向を色補間方向として用いる色補間処理にてエッジ成分を残しつつデモザイクを行う。一方、注目画素付近が平坦部分であると確定された場合は、例えば平均値フィルタ等の低周波通過フィルタ(LPF)手法でノイズ成分を抑制するデモザイクを行ってもよい。本実施形態では、上述のノイズ量の算出を図2に示すノイズ量算出部222がおこない、上述の比較を図2に示すエッジ判定部223がおこなう。 Therefore, in order to suppress such erroneous determinations, in this embodiment, a value obtained by adding the amount of noise of neighboring pixels and a predetermined determination parameter is compared with the maximum value of the directional data. This determines whether the vicinity of the pixel of interest is (truly) an edge portion. If it is determined that the vicinity of the pixel of interest is an edge portion, demosaicing is performed while leaving edge components in a color interpolation process that uses the edge direction as a color interpolation direction, as will be described later. On the other hand, if it is determined that the vicinity of the pixel of interest is a flat portion, demosaicing may be performed to suppress noise components using a low frequency pass filter (LPF) method such as an average value filter. In this embodiment, the noise amount calculation section 222 shown in FIG. 2 calculates the noise amount described above, and the edge determination section 223 shown in FIG. 2 performs the above comparison.

ノイズ量算出部222は、近傍画素のノイズ量VARを算出する。 The noise amount calculation unit 222 calculates the noise amount VAR of neighboring pixels.

具体的には、ノイズ量算出部222は、近傍画素のノイズ量を、例えば以下の式(2)の平均偏差を用いて求める。 Specifically, the noise amount calculation unit 222 calculates the noise amount of neighboring pixels using, for example, the average deviation of the following equation (2).

Figure 0007387411000002
Figure 0007387411000002

平均偏差は、参照画素の平均値と各画素との絶対値差分の平均値であることから、方向性データとの比較が容易である。なぜなら方向性データも平均値は使用していないが、ある画素とある画素との絶対差分値を使用しているからである。 Since the average deviation is the average value of the absolute difference between the average value of the reference pixels and each pixel, it can be easily compared with the directional data. This is because the directionality data does not use an average value, but uses an absolute difference value between a certain pixel and another pixel.

なお、ノイズ量をデータのバラつき量とした場合、統計学においてよく使用されるのは、下記の式(3)に示す標準偏差および分散である。 Note that when the amount of noise is taken as the amount of variation in data, the standard deviation and variance shown in the following equation (3) are often used in statistics.

Figure 0007387411000003
Figure 0007387411000003

しかしながら、上記の標準偏差および分散は、2乗演算や平方根演算があり計算量が多くなる。そこで、本実施形態では、標準偏差および分散を用いるのではなく、上記式(2)にある平均偏差を用いてノイズ量を求める。 However, the standard deviation and variance described above require a square calculation and a square root calculation, which increases the amount of calculation. Therefore, in this embodiment, the amount of noise is determined using the average deviation in the above equation (2) instead of using the standard deviation and variance.

ノイズ量算出部222による近傍画素のノイズ量の算出手順について、以下に一例を挙げて説明する。ちなみに、近傍画素のノイズ量は、先に求めた最小値が算出された方向性データに対応する方向(エッジに沿う方向)で求める。これは、エッジに交差する方向では、エッジ成分量が含まれており、誤判定の原因となるためである。 The procedure for calculating the amount of noise of neighboring pixels by the noise amount calculation unit 222 will be described below using an example. Incidentally, the amount of noise of neighboring pixels is determined in the direction (direction along the edge) corresponding to the directional data from which the previously determined minimum value was calculated. This is because the direction that intersects the edge contains an edge component amount, which may cause erroneous determination.

(Dが最小である場合)
以下では、注目画素がRである場合を例に取った図6を用いて、最小値が算出された方向性データに対応する方向が水平方向である場合(すなわちDが最小)のノイズ量を求める一例を説明する。
(When D H is minimum)
Below, using FIG. 6 as an example where the pixel of interest is R, we will explain the amount of noise when the direction corresponding to the directional data for which the minimum value is calculated is the horizontal direction (that is, D H is the minimum). An example of finding .

図6には、ノイズ量を算出する際に参照する画像領域(中心に位置するR22が注目画素)(F)を示している。 FIG. 6 shows an image area (R22 located at the center is the pixel of interest) (F) that is referred to when calculating the amount of noise.

ノイズ量算出部222は、まず、参照画像(F)のうちの図6の(P1)に示す画素を用いて、各行の輝度の平均値(B1AVE、G2AVE、R2AVE、B3AVE)を下記の各式(4)に基づいて求める。 The noise amount calculation unit 222 first calculates the average luminance value (B1 AVE , G2 AVE , R2 AVE , B3 AVE ) of each row using the pixel shown in (P1) in FIG. 6 of the reference image (F). It is determined based on each equation (4) below.

Figure 0007387411000004
Figure 0007387411000004

また、ノイズ量算出部222は、下記の各式(5)に基づき、輝度の平均値(B1AVE、G2AVE、R2AVE、B3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(B1var、G2var、R2var、B3var)を全て加算したノイズ量Hvarを求める。 Further, the noise amount calculation unit 222 calculates the absolute value difference between the average value of brightness (B1 AVE , G2 AVE , R2 AVE , B3 AVE ) and the brightness of each same color pixel as the number of pixels, based on each formula (5) below. The noise amount H var is obtained by adding all the noise values (B1 var , G2 var , R2 var , B3 var ) of each row obtained by dividing by .

Figure 0007387411000005
Figure 0007387411000005

(Dが最小である場合)
また、図6に示す参照画素(F)において、最小値が算出された方向性データに対応する方向が垂直方向である場合(すなわちDが最小)のノイズ量を求める場合についても、以下に説明する。
(When DV is minimum)
Also, in the reference pixel (F) shown in FIG. 6, when calculating the amount of noise when the direction corresponding to the directional data for which the minimum value has been calculated is the vertical direction (that is, DV is the minimum), the following is as follows. explain.

ノイズ量算出部222は、参照画像(F)のうちの図6の(P2)に示す画素を用いて、各行の輝度の平均値(B1AVE、G2AVE、R2AVE、B3AVE)を下記の各式(6)に基づいて求める。 The noise amount calculation unit 222 uses the pixels shown in (P2) in FIG. 6 of the reference image (F) to calculate the average luminance value (B1 AVE , G2 AVE , R2 AVE , B3 AVE ) of each row as follows. It is calculated based on each equation (6).

Figure 0007387411000006
Figure 0007387411000006

また、ノイズ量算出部222は、下記の各式(7)に基づき、輝度の平均値(B1AVE、G2AVE、R2AVE、B3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(B1var、G2var、R2var、B3var)を全て加算したノイズ量Vvarを求める。 Further, the noise amount calculation unit 222 calculates the absolute value difference between the average value of brightness (B1 AVE , G2 AVE , R2 AVE , B3 AVE ) and the brightness of each pixel of the same color as the number of pixels based on each formula (7) below. The noise amount V var is obtained by adding all the noise values (B1 var , G2 var , R2 var , B3 var ) of each row obtained by dividing by .

Figure 0007387411000007
Figure 0007387411000007

(DNEが最小である場合)
また、図6に示す参照画素(F)において、最小値が算出された方向性データに対応する方向が右斜め上方向である場合(すなわちDNEが最小)のノイズ量を求める場合についても、以下に説明する。
(When DNE is minimum)
Also, in the reference pixel (F) shown in FIG. 6, when calculating the amount of noise when the direction corresponding to the directional data for which the minimum value has been calculated is the diagonally upper right direction (that is, D NE is the minimum), This will be explained below.

ノイズ量算出部222は、参照画像(F)のうちの図6の(P3)に示す画素を用いて、右斜め上方向に配列している各列の輝度の平均値(G1AVE、B2AVE、R2AVE、G3AVE)を下記の各式(8)に基づいて求める。 The noise amount calculation unit 222 uses the pixels shown in (P3) in FIG. 6 of the reference image (F) to calculate the average luminance value (G1 AVE , B2 AVE ) of each column arranged diagonally upward to the right. , R2 AVE , G3 AVE ) are determined based on the following equations (8).

Figure 0007387411000008
Figure 0007387411000008

また、ノイズ量算出部222は、下記の各式(9)に基づき、輝度の平均値(G1AVE、B2AVE、R2AVE、G3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(G1var、B2var、R2var、G3var)を全て加算したノイズ量NEvarを求める。 Further, the noise amount calculation unit 222 calculates the absolute value difference between the average value of brightness (G1 AVE , B2 AVE , R2 AVE , G3 AVE ) and the brightness of each same color pixel based on the following equations (9) as the number of pixels. The noise amount NE var is obtained by adding all the noise values (G1 var , B2 var , R2 var , G3 var ) of each row obtained by dividing by .

Figure 0007387411000009
Figure 0007387411000009

(DNWが最小である場合)
また、図6に示す参照画素(F)において、最小値が算出されたエッジ方向性データに対応する方向が左斜め上方向である場合(すなわちDNWが最小)のノイズ量を求める場合についても、以下に説明する。
(When D NW is minimum)
In addition, regarding the case where the direction corresponding to the edge directionality data for which the minimum value is calculated is the diagonally upper left direction (that is, the D NW is the minimum) in the reference pixel (F) shown in FIG. , explained below.

ノイズ量算出部222は、参照画像(F)のうちの図6の(P4)に示す画素を用いて、右斜め上方向に配列している各列の輝度の平均値(G1AVE、B2AVE、R2AVE、G3AVE)を下記の各式(10)に基づいて求める。 The noise amount calculation unit 222 uses the pixels shown in (P4) in FIG. 6 of the reference image (F) to calculate the average luminance value (G1 AVE , B2 AVE) of each column arranged diagonally upward to the right. , R2 AVE , G3 AVE ) are determined based on the following equations (10).

Figure 0007387411000010
Figure 0007387411000010

また、ノイズ量算出部222は、下記の各式(11)に基づき、輝度の平均値(G1AVE、B2AVE、R2AVE、G3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(G1var、B2var、R2var、G3var)を全て加算したノイズ量NWvarを求める。 Further, the noise amount calculation unit 222 calculates the absolute value difference between the average value of brightness (G1 AVE , B2 AVE , R2 AVE , G3 AVE ) and the brightness of each pixel of the same color as the number of pixels, based on each formula (11) below. The noise amount NW var is obtained by adding all the noise values (G1 var , B2 var , R2 var , G3 var ) of each row obtained by dividing by .

Figure 0007387411000011
Figure 0007387411000011

以上の算出手順により、ノイズ量算出部222は近傍画素のノイズ量VAR(つまり先述のHvar、Vvar、NEvarおよびNWvarのうちの何れか)を算出する。 According to the above calculation procedure, the noise amount calculation unit 222 calculates the noise amount VAR (that is, any one of the above-mentioned H var , V var , NE var and NW var ) of the neighboring pixels.

エッジ判定部223は、ノイズ量算出部222が算出した近傍画素のノイズ量VARと予め定めた判定パラメータαとを加えた値と、方向性データの最大値と、を比較し、注目画素付近がエッジ部分か平坦部分かを判定する。 The edge determination unit 223 compares the sum of the noise amount VAR of the neighboring pixels calculated by the noise amount calculation unit 222 and a predetermined determination parameter α with the maximum value of the directional data, and determines whether the vicinity of the pixel of interest is Determine whether it is an edge part or a flat part.

具体的には、エッジ判定部223は、次の関係式;
方向性データの最大値>VAR+α
を満たすか否かを判定する。そして、当該関係式を満たす場合は注目画素付近をエッジ部分と判定(確定)し、当該関係式を満たさない場合は注目画素付近を平坦部分と判定(確定)する。
Specifically, the edge determination unit 223 uses the following relational expression;
Maximum value of directional data>VAR+α
Determine whether the following is satisfied. If the relational expression is satisfied, the area around the pixel of interest is determined (determined) to be an edge portion, and if the relational expression is not satisfied, the area around the pixel of interest is determined (determined) to be a flat area.

一例として、最大値を算出した方向性データに対応する方向(エッジ方向と交差する方向)が垂直である場合(すなわちDが最大)、エッジ判定部223は、次の関係式;
>Hvar+α
を満たすか否かを判定する。そして、満たす場合は注目画素をエッジ部分と判定し、満たさない場合は注目画素を平坦部分と判定する。
As an example, if the direction corresponding to the directionality data for which the maximum value was calculated (the direction intersecting the edge direction) is perpendicular (that is, the DV is maximum), the edge determination unit 223 calculates the following relational expression;
D V > H var + α
Determine whether the following is satisfied. If the condition is satisfied, the pixel of interest is determined to be an edge portion, and if the condition is not satisfied, the pixel of interest is determined to be a flat portion.

ここで、判定パラメータαは、ノイズ量とエッジ成分を区別する為の閾値である。ノイズの無い理想的な平坦画像であれば判定パラメータαはゼロでよい。しかし、先に述べた通り、図1の撮像素子107から出力される画像データは平坦部分であってもノイズが含まれており、判定パラメータαがゼロの場合は、本来は平坦部分である画素をエッジ部分と誤検出してしまう。そこで、エッジ判定部223は、ノイズ量VARと判定パラメータαとを加えた値を用いる。判定パラメータαについては後述する。 Here, the determination parameter α is a threshold value for distinguishing between the amount of noise and the edge component. If the image is an ideal flat image without noise, the determination parameter α may be zero. However, as mentioned earlier, the image data output from the image sensor 107 in FIG. 1 contains noise even if it is a flat part, and if the determination parameter is mistakenly detected as an edge part. Therefore, the edge determination unit 223 uses the sum of the noise amount VAR and the determination parameter α. The determination parameter α will be described later.

要するに、エッジ判定部223は、ノイズ量VARと判定パラメータαとの加算値を、判定の閾値として用いる。そして、本実施形態では、ノイズ量VARを常に求める構成となっている。 In short, the edge determination unit 223 uses the sum of the noise amount VAR and the determination parameter α as a threshold value for determination. In this embodiment, the noise amount VAR is always determined.

これを、図7に示すイメージ図を用いて説明すれば、本実施形態では、エッジに沿う方向(つまりエッジと交差しない方向)のノイズ量VARを求め、これに判定パラメータαを加えた値を、閾値(=VAR+α)とする。ここで、先述した例えばショットノイズのようなノイズが画像にある場合、画面内の輝度平均値の高低によってノイズ量が異なる。これについて、本実施形態では、ノイズ量VARを常に(一例として1ピクセル毎)求める構成となっており、閾値には、ノイズ量VARの変化が反映される。また、ノイズ量VARのみならず、判定パラメータαを加算している。以上のことから、エッジ判定部223による判定をおこなうことにより、本来は平坦部分である画素をエッジ部分であると誤検出してしまうことが無い。 To explain this using the image diagram shown in FIG. 7, in this embodiment, the noise amount VAR in the direction along the edge (that is, the direction not intersecting the edge) is calculated, and the value obtained by adding the determination parameter α to this is calculated as follows: Let the threshold value be (=VAR+α). Here, if there is noise in the image, such as the shot noise mentioned above, the amount of noise differs depending on the level of the average brightness value within the screen. Regarding this, in this embodiment, the noise amount VAR is always determined (for example, for each pixel), and the change in the noise amount VAR is reflected in the threshold value. In addition, not only the noise amount VAR but also the determination parameter α is added. From the above, by making the determination by the edge determination unit 223, pixels that are originally a flat portion are not erroneously detected as being an edge portion.

以下に、具体例に基づいてエッジ判定部223の判定手順について説明する。なお、以下では、簡単の為、エッジ部分であってノイズが無い場合と、平坦部分であってノイズが無い場合と、平坦部分であってノイズがある場合とについて説明する。なお、以下の各事例において、エッジ判定部223による判定に至るまでの内容は、先述のエッジ予備決定部210(方向性データ算出部211および方向検出部212)、仮判定部221およびノイズ量算出部222によっておこなうものとする。 The determination procedure of the edge determination unit 223 will be described below based on a specific example. In the following, for the sake of simplicity, a case where there is no noise at an edge portion, a case where there is no noise at a flat portion, and a case where there is noise at a flat portion will be explained. In each case below, the contents up to the determination by the edge determination unit 223 include the edge preliminary determination unit 210 (directionality data calculation unit 211 and direction detection unit 212), temporary determination unit 221, and noise amount calculation described above. 222.

(事例1:エッジ部分であってノイズが無い場合)
図8は、図の上段に参照画像F´を示している。この参照画像F´において、各画素には、画素を識別する符号とともに、括弧内に輝度値を示している。この参照画像F´では、紙面右上に相当する領域にエッジが有る。要するに、平坦部分の輝度値が32であり、輝度値が32から64へ変化するエッジ領域がある。
(Case 1: When there is no noise at the edge part)
FIG. 8 shows the reference image F' in the upper part of the figure. In this reference image F', each pixel has a luminance value shown in parentheses along with a code for identifying the pixel. This reference image F' has an edge in an area corresponding to the upper right of the page. In short, the brightness value of the flat portion is 32, and there is an edge region where the brightness value changes from 32 to 64.

まず、下記の式(12)に基づいてエッジ方向成分を求める。このとき、DおよびDを求める際に用いる参照画素P(D、D)を図8の下段左側に示しており、DNWおよびDNEを求める際に用いる参照画素P(DNW、DNE)を図8の下段右側に示している。 First, the edge direction component is determined based on the following equation (12). At this time, the reference pixel P (D V , D H ) used when calculating D V and D H is shown on the lower left side of FIG . 8, and the reference pixel P (D NW , D NE ) are shown on the lower right side of FIG.

Figure 0007387411000012
Figure 0007387411000012

上記より、注目画素(参照画像F´の中心にある画素R22)から見て、エッジと交差する方向は、最大値DMAXである垂直方向または右斜め上方向であることがわかる。一方、エッジに沿う方向は、最小値DMINである水平方向または左斜め上方向であることがわかる。 From the above, it can be seen that when viewed from the pixel of interest (pixel R 22 at the center of reference image F'), the direction intersecting the edge is the vertical direction or diagonally upper right direction, which is the maximum value D MAX . On the other hand, it can be seen that the direction along the edge is the horizontal direction or the diagonally upper left direction, which is the minimum value D MIN .

次に、各方向のノイズ量(Hvar、Vvar、NEvar、NWvar)を求める。図9には、Hvarを求める際に用いる参照画素P(Hvar)、Vvarを求める際に用いる参照画素P(Vvar)、NEvarを求める際に用いる参照画素P(NEvar)、NWvarを求める際に用いる参照画素P(NWvar)を示す。 Next, the amount of noise (H var , V var , NE var , NW var ) in each direction is determined. FIG. 9 shows a reference pixel P (H var ) used when calculating H var , a reference pixel P (V var ) used when calculating V var , a reference pixel P (NE var ) used when calculating NE var , A reference pixel P (NW var ) used when calculating NW var is shown.

各方向のノイズ量(Hvar、Vvar、NEvar、NWvar)は、次の通りとなる。
var=16
var=44
NEvar=44
NWvar=16
例えば、エッジと交差する方向であるDMAXと、エッジに沿う方向DMINに対応する方向のノイズ量Hvar(またはNWvar)とを比較する。
MAX>Hvar+α?
ここでαは、ノイズ量とエッジとを区別するための閾値である。本事例のようにノイズが無く、コントラストの高い画像であれば、α=0で問題無いが、後述するように平坦部分にノイズ成分が含まれるような場合は、α>0を設定することにより、ノイズ量とエッジ成分を区別することができる。
The amount of noise in each direction (H var , V var , NE var , NW var ) is as follows.
H var =16
V var =44
NE var =44
NWvar =16
For example, the noise amount H var (or NW var ) in the direction corresponding to the direction D MAX intersecting the edge and the direction D MIN along the edge is compared.
D MAX > H var +α?
Here, α is a threshold value for distinguishing between noise amount and edge. If the image is noise-free and has high contrast like in this example, there is no problem with α = 0, but if noise components are included in flat areas as described later, it is better to set α > 0. , the amount of noise and edge components can be distinguished.

本事例では、DMAX=80、Hvar=16であり、α=0とした場合に、上記の不等式を満たすため、エッジ判定部223によって、注目画素R22がエッジ部分であると判定される。 In this example, D MAX = 80, H var = 16, and when α = 0, the above inequality is satisfied, so the edge determination unit 223 determines that the pixel of interest R 22 is an edge portion. .

(事例2:平坦部分であってノイズが無い場合)
図示しないが、参照領域内の各画素が同一の輝度値を取る(つまり平坦部分である)場合は、全ての方向について方向性データがゼロであり、全ての方向のノイズ量もゼロである。そのため、先述の不等式が成立せず、エッジ判定部223によって、注目画素R22が平坦部分であると判定される。
(Case 2: When the area is flat and there is no noise)
Although not shown, if each pixel in the reference area has the same brightness value (that is, it is a flat portion), the directional data is zero in all directions, and the amount of noise in all directions is also zero. Therefore, the above-mentioned inequality does not hold, and the edge determining unit 223 determines that the pixel of interest R22 is a flat portion.

(事例3:平坦部分であってノイズを含む場合)
本事例は、R=G=B=32の画像に極少量のノイズを印加した例である。方向性データおよびノイズ量をそれぞれ求めると下記の結果が得られる。
=1
=5
NE=5
NW=1
MAX=D or DNW
MIN=D or DNE
var=1
var=2.75
NEvar=2.75
NWvar=1
MAX(エッジに交差する方向)の値は5、エッジに沿う方向のノイズ量Hvar=1である。ここで、仮にα=0とすると、上述の不等式が成立してしまう。そこで、例えば、α=4とする。α=4と設定すれば、上述の不等式が成立しなくなるため、エッジ判定部223によって、注目画素R22が平坦部分であると判定される。
(Case 3: When the area is flat and contains noise)
This example is an example in which a very small amount of noise is applied to an image of R=G=B=32. The following results are obtained by calculating the directional data and the amount of noise.
D H =1
D V =5
D NE =5
D NW =1
D MAX = D V or D NW
D MIN = D H or D NE
Hvar =1
V var =2.75
NE var =2.75
NW var = 1
The value of D MAX (direction crossing the edge) is 5, and the amount of noise in the direction along the edge H var =1. Here, if α=0, the above-mentioned inequality would hold true. Therefore, for example, let α=4. If α=4 is set, the above-mentioned inequality does not hold, so the edge determination unit 223 determines that the pixel of interest R 22 is a flat portion.

(判定パラメータα)
αの値を大きくすればするほど、エッジ部分であると判定する値の領域が小さくなる。そのため、ノイズによる誤判定を増やさない程度に判定パラメータの値を小さく設定する。
(judgment parameter α)
The larger the value of α is, the smaller the region of values determined to be an edge portion becomes. Therefore, the value of the determination parameter is set to a small value to the extent that erroneous determinations due to noise do not increase.

αは、例えば図1の撮像素子107において画像を取得した時に目でぎりぎり判断可能なストライプ画像を用意し、輝度値の高い画像と、低い画像を取得し、それらの画像からエッジ量とノイズ量を求め、エッジ部分か平坦部分かを判別できる最適な値を実験的に求めると良い。なお、αは凡そ、撮像素子毎に決まった値となる。
判定パラメータαは、1以上の値である。
For example, α is determined by preparing a stripe image that can be barely judged by the eye when the image is acquired by the image sensor 107 in FIG. It is best to experimentally find the optimal value that allows you to determine whether it is an edge portion or a flat portion. Note that α is approximately a fixed value for each image sensor.
The determination parameter α is a value of 1 or more.

以上の各構成を備えたエッジ決定部220によれば、近傍画素のノイズ量と予め定めた判定パラメータとを加えた値と、注目画素のエッジ方向成分値と、を比較することで、注目画素がエッジ部分か平坦部分かを判定する。先述の特許文献1では、エッジ方向性データの最大値(=エッジと交差する方向)を、ある閾値と比較することでエッジの有無を判定しているため、先述のような誤判定を生じる虞がある。一方、本実施形態では、エッジ判定の毎に、平均偏差を用いてノイズ量を求めて、そのノイズ量に基づいてエッジの有無およびエッジ方向を判定する。これにより、本実施形態では、先述のような誤判定を招来しない。 According to the edge determination unit 220 having each of the above configurations, the edge direction component value of the pixel of interest is compared with the sum of the amount of noise of neighboring pixels and a predetermined determination parameter, and the edge direction component value of the pixel of interest is Determine whether is an edge part or a flat part. In the above-mentioned Patent Document 1, the presence or absence of an edge is determined by comparing the maximum value of edge directionality data (=direction intersecting the edge) with a certain threshold value, so there is a possibility that the above-mentioned erroneous determination may occur. There is. On the other hand, in this embodiment, the amount of noise is determined using the average deviation every time edge determination is performed, and the presence or absence of an edge and the edge direction are determined based on the amount of noise. As a result, in this embodiment, the erroneous determination as described above does not occur.

すなわち、本実施形態によれば、エッジおよびそのエッジ方向を正確に求めることができる。 That is, according to this embodiment, edges and their edge directions can be accurately determined.

<色補間部>
色補間部230は、ベイヤデータの色補間をおこなう。
<Color interpolation part>
The color interpolation unit 230 performs color interpolation of Bayer data.

なお、エッジ方向を用いた色補間処理は、特に、注目画素がRまたはB画素であり、注目画素の対角線方向のG画素のデータを補間する場合に用いられるのが好ましい。従って、以下では、注目画素がR・B画素である場合のG画素データの補間のみを説明する。G画素上のR・B、R画素上のB、B画素上のRの補間については、後述する従来例を適用すれば良い。 Note that the color interpolation process using the edge direction is preferably used particularly when the pixel of interest is an R or B pixel and data of a G pixel in the diagonal direction of the pixel of interest is interpolated. Therefore, in the following, only interpolation of G pixel data when the pixel of interest is an R/B pixel will be described. Regarding interpolation of R and B on G pixels, B on R pixels, and R on B pixels, a conventional example described later may be applied.

色補間部230では、注目画素がRまたはB画素である場合の、エッジ方向を用いたG画素データの補間を、下記の手順で行う。なお、注目画素がBの場合は、数式・文中のRをBに読み替えて同じ方法により求めることができる。 The color interpolation unit 230 performs interpolation of G pixel data using the edge direction when the pixel of interest is an R or B pixel in the following procedure. Note that if the pixel of interest is B, it can be determined by the same method by replacing R in the formula/sentence with B.

先述のエッジ決定部220によってエッジ部分であると決定(確定)された注目画素付近に関して、左記のエッジ予備決定部210において求めたエッジ方向が右斜め上方向である場合(DNEが最も小さい)について、図10を用いて説明する。 When the edge direction determined by the edge preliminary determination unit 210 described on the left is diagonally upward to the right regarding the vicinity of the target pixel determined (confirmed) to be an edge portion by the edge determination unit 220 described above (D NE is the smallest) will be explained using FIG.

(エッジ方向が右斜め上方向であるケースの色補間処理)
図10は、エッジ方向が右斜め上方向である場合の色補間処理を概念的に示す図である。
(Color interpolation processing for the case where the edge direction is diagonally upward to the right)
FIG. 10 is a diagram conceptually showing color interpolation processing when the edge direction is diagonally upward to the right.

色補間部230は、右斜め上方向のG成分gNEを求める第1ステップと、注目画素のG成分G22を求める第2ステップとをおこなう。以下、これらのステップについて、図10に示す参照画像(R22が注目画素であり、DNEが最も小さい)を参照して説明する。 The color interpolation unit 230 performs a first step of determining the G component g NE in the diagonally upper right direction, and a second step of determining the G component G 22 of the pixel of interest. These steps will be described below with reference to the reference image shown in FIG. 10 ( R22 is the pixel of interest and DNE is the smallest).

まず、第1ステップとして、右斜め上方向のG成分gNEを求める。このgNEを求めるにあたっては、局所領域における色の低周波成分の色相関は一定であるという仮定を用いる。 First, as a first step, the G component g NE in the diagonally upper right direction is determined. In determining this g NE , it is assumed that the color correlation of low frequency components of colors in a local region is constant.

第1ステップでは、以下の式(13)に基づいて、注目画素の最近接G成分の平均値(低周波成分)gAVEを求める。また、下記の式(13)に基づいて、注目画素の最近接B成分のうちの注目画素の右斜め上方向に存在しているB成分を除く、つまり左斜め上方向に存在しているB成分の平均値(低周波成分)bAVEを求める。また、注目画素の右斜め上方向に存在しているB成分の平均値を求めて、これを注目画素のB成分b22と推定する。そして、先述の仮定に基づけば、gAVEとbAVEとの差分値は、求めたい右斜め上方向のG成分gNEと求めたb22との差分値と同じであることから、下記の式(13)に基づいて、右斜め上方向のG成分gNEを、b22と、gAVEとbAVEとの差分値と、を加算して求める。 In the first step, the average value (low frequency component) g AVE of the nearest G component of the pixel of interest is determined based on the following equation (13). Also, based on the following equation (13), among the B components closest to the pixel of interest, the B component that exists diagonally upward to the right of the pixel of interest is removed, that is, the B component that exists diagonally upward to the left of the pixel of interest is removed. Find the average value of the components (low frequency component) b AVE . Furthermore, the average value of the B components present diagonally above and to the right of the pixel of interest is determined, and this is estimated to be the B component b 22 of the pixel of interest. Based on the above assumption, the difference value between g AVE and b AVE is the same as the difference value between the G component g NE in the diagonally upper right direction that is desired to be obtained and the obtained b 22 , so the following formula can be obtained. Based on (13), the G component g NE in the diagonally upper right direction is obtained by adding b 22 and the difference value between g AVE and b AVE .

Figure 0007387411000013
Figure 0007387411000013

ところで、本来なら、上で求めたgNEをそのまま注目画素のG成分G22としても良いが、エッジ検出と同様、斜め方向のG成分は精度が悪い。そこで、色補間部230では、第1ステップに続いて、精度を担保するための第2ステップをおこなう。 Incidentally, originally, the gNE obtained above may be used as is as the G component G22 of the pixel of interest, but as with edge detection, the accuracy of the G component in the diagonal direction is poor. Therefore, following the first step, the color interpolation unit 230 performs a second step to ensure accuracy.

第2ステップでは、下記の式(14)に基づき、上で求めたgNEに、水平=垂直方向を選択した場合に求められるG成分(g、g)の平均値gVHを加算し、その平均を求める。なお、水平=垂直方向である場合の水平方向のG成分gおよび垂直方向のG成分gは、後述の式に基づいて求めることができる。 In the second step, based on the following equation (14), add the average value g VH of the G components (g V , g H ) obtained when horizontal = vertical direction is selected to g NE obtained above. , find the average. Note that when horizontal=vertical direction, the horizontal G component g H and the vertical G component g V can be determined based on the equations described below.

Figure 0007387411000014
Figure 0007387411000014

第2ステップによれば、注目画素のG成分G22を精度よく補間することができる。 According to the second step, the G component G22 of the pixel of interest can be interpolated with high precision.

(エッジ方向が左斜め上方向であるケースの色補間処理)
先述のエッジ決定部220によってエッジ部分であると決定(確定)された注目画素付近に関して、左記のエッジ予備決定部210において求めたエッジ方向が左斜め上方向である場合(DNWが最も小さい)について、図11を用いて説明する。
(Color interpolation processing for the case where the edge direction is diagonally upward to the left)
When the edge direction determined by the edge preliminary determination unit 210 described on the left is diagonally upward to the left regarding the vicinity of the pixel of interest determined (confirmed) to be an edge portion by the edge determination unit 220 described above (D NW is the smallest) will be explained using FIG. 11.

先述のエッジ方向が右斜め上方向である場合と同様、色補間部230は、2つのステップを含む色補間処理をおこなう。 As in the case where the edge direction is the diagonally upper right direction, the color interpolation unit 230 performs color interpolation processing that includes two steps.

具体的には、色補間部230は、左斜め上方向のG成分gNWを求める第1ステップと、注目画素のG成分G22を求める第2ステップとをおこなう。以下、これらのステップについて、図11に示す参照画像(R22が注目画素であり、DNWが最も小さい)を参照して説明するが、先述のエッジ方向が右斜め上方向である場合と異なる点のみを説明する。 Specifically, the color interpolation unit 230 performs a first step of determining the G component g NW in the diagonally upper left direction, and a second step of determining the G component G 22 of the pixel of interest. These steps will be explained below with reference to the reference image shown in FIG. 11 ( R22 is the pixel of interest and D NW is the smallest), but this is different from the case where the edge direction is diagonally upward to the right. I will explain only the points.

異なる点は、第1ステップにおける注目画素のB成分b22の推定に用いる画素と、bAVEの算出に用いる画素である。エッジ方向が左斜め上方向である場合には、注目画素の左斜め上方向に存在しているB成分の平均値を求めて、これを注目画素のB成分b22と推定する(下記の式(15)に基づく)。また、B成分の平均値(低周波成分)bAVEの算出に注目画素の右斜め上方向に存在している画素を用いる。これらを除いては先述と同じであり、先述の仮定を用いて、左斜め上方向のG成分gNWを下記の式のように求める。 The difference is the pixel used for estimating the B component b22 of the pixel of interest in the first step and the pixel used for calculating b AVE . If the edge direction is diagonally upward to the left, the average value of the B components existing diagonally upward to the left of the pixel of interest is calculated, and this is estimated to be the B component b22 of the pixel of interest (using the following formula (15)). Furthermore, pixels present diagonally above and to the right of the pixel of interest are used to calculate the average value (low frequency component) b AVE of the B component. Other than these, it is the same as above, and using the above assumptions, the G component g NW in the diagonally upper left direction is determined as shown in the following equation.

Figure 0007387411000015
Figure 0007387411000015

なお、本ケースでも先述と同様に第2ステップによって、下記の式(16)に基づき、上で求めたgNWに、水平方向および垂直方向を選択した場合に求められる、G成分(g、g)の平均値gVHを加算し、その平均を求める。 In addition, in this case as well, in the second step as described above , based on the following equation (16), the G component (g V , The average value g VH of g H ) is added and the average value is determined.

Figure 0007387411000016
Figure 0007387411000016

これにより、注目画素のG成分G22を精度よく補間することができる。 Thereby, the G component G22 of the pixel of interest can be interpolated with high accuracy.

(エッジ方向が垂直方向であるケースの色補間処理)
先述のエッジ決定部220によってエッジ部分であると決定(確定)された注目画素付近に関して、左記のエッジ予備決定部210において求めたエッジ方向が垂直方向である場合(Dが最も小さい)は、色補間部230は、下記の式(17)に基づいて、垂直方向のG成分gを求めることができる。
(Color interpolation processing when the edge direction is vertical)
Regarding the vicinity of the pixel of interest determined (confirmed) to be an edge portion by the edge determination unit 220 described above, if the edge direction determined by the edge preliminary determination unit 210 described on the left is the vertical direction ( DV is the smallest), The color interpolation unit 230 can obtain the vertical G component gV based on the following equation (17).

本ケースの場合には、先述の斜め方向のようにG成分の精度が悪いということは無い。従って、本ケースでは、求めたgを、注目画素のG成分G22とすることで補間する。 In this case, the precision of the G component is not poor as in the case of the diagonal direction described above. Therefore, in this case, interpolation is performed by using the obtained gV as the G component G22 of the pixel of interest.

Figure 0007387411000017
Figure 0007387411000017

(エッジ方向が水平方向であるケースの色補間処理)
先述のエッジ決定部220によってエッジ部分であると決定(確定)された注目画素付近に関して、左記のエッジ予備決定部210において求めたエッジ方向が水平方向である場合(Dが最も小さい)は、色補間部230は、下記の式(18)に基づいて、垂直方向のG成分gを求めることができる。
(Color interpolation processing when the edge direction is horizontal)
Regarding the vicinity of the pixel of interest that has been determined (confirmed) to be an edge portion by the edge determination unit 220 described above, if the edge direction determined by the edge preliminary determination unit 210 described on the left is the horizontal direction (D H is the smallest), The color interpolation unit 230 can determine the vertical G component gH based on the following equation (18).

本ケースの場合も、先述の斜め方向のようにG成分の精度が悪いということは無い。従って、本ケースでは、求めたgを、注目画素のG成分G22とすることで補間する。 In this case as well, the precision of the G component is not poor as in the case of the diagonal direction described above. Therefore, in this case, interpolation is performed by using the obtained gH as the G component G22 of the pixel of interest.

Figure 0007387411000018
Figure 0007387411000018

(エッジ方向が水平方向および垂直方向、または右斜め上方向および左斜め上方向であるケースの色補間処理)
先述のエッジ決定部220によってエッジ部分であると決定(確定)された注目画素付近に関して、左記のエッジ予備決定部210において求めたエッジ方向が水平方向および垂直方向である場合(D=D且つ最も小さい)、あるいは右斜め上方向および左斜め上方向である場合(DNE=DNW且つ最も小さい)は、色補間部230は、下記の式(19)に基づいて、水平方向および垂直方向を選択した場合に求められる、G成分(g、g)の平均値gVHを求める。
(Color interpolation processing in cases where the edge direction is horizontal and vertical, or diagonally upward to the right and diagonally upward to the left)
Regarding the vicinity of the target pixel determined (confirmed) to be an edge portion by the edge determination unit 220 described above, if the edge directions determined by the edge preliminary determination unit 210 described on the left are the horizontal direction and the vertical direction (D H =D V (and the smallest), or in the diagonally upper right direction and the diagonally upper left direction (D NE =D NW and the smallest), the color interpolation unit 230 calculates the horizontal and vertical The average value g VH of the G components (g V , g H ) obtained when the direction is selected is determined.

本ケースの場合も、先述の斜め方向のようにG成分の精度が悪いということは無い。従って、求めたgVHを、注目画素のG成分G22とすることで補間する。 In this case as well, the precision of the G component is not poor as in the case of the diagonal direction described above. Therefore, interpolation is performed by setting the obtained gVH as the G component G22 of the pixel of interest.

Figure 0007387411000019
Figure 0007387411000019

なお、先述のエッジ決定部220によって決定(確定)されたエッジ方向が、水平方向および垂直方向、あるいは右斜め上方向および左斜め上方向である場合は、平坦部分として処理してもよい。その場合は、参照画像内の全てのG画素を使用した平均値フィルタを適用して色補間をおこなってもよい。
<色補間部(G画素上のR・B、R画素上のB、B画素上のRの補間)>
G画素上のR・B、R画素上のB、B画素上のRの補間については、一般的な勾配法を適用すれば良い。あるいは、一般的な色相関法を用いても補間することができ、一般的な勾配法よりも良い結果が得られる。ただし、一般的な色相関法の場合、G画素データを記憶する必要があるため、回路規模は増える。以下、これら勾配法および色相関法について説明する。
Note that if the edge direction determined (confirmed) by the edge determination unit 220 described above is the horizontal direction and the vertical direction, or the diagonally upper right direction and the diagonally upper left direction, it may be processed as a flat portion. In that case, color interpolation may be performed by applying an average value filter using all G pixels in the reference image.
<Color interpolation unit (interpolation of R and B on G pixels, B on R pixels, and R on B pixels)>
For interpolation of R and B on G pixels, B on R pixels, and R on B pixels, a general gradient method may be applied. Alternatively, interpolation can also be performed using a general color correlation method, which provides better results than the general gradient method. However, in the case of the general color correlation method, the circuit scale increases because it is necessary to store G pixel data. The gradient method and color correlation method will be explained below.

(勾配法)
図12は、勾配法を用いて注目画素がR22である場合のB22の補間方法を説明するための参照画像8000bayerと、勾配法を用いて注目画素がG22である場のR22およびB22の補間方法を説明するための参照画像8001bayerとである。
(Gradient method)
FIG. 12 shows a reference image 8000 bayer for explaining the interpolation method of B 22 when the pixel of interest is R 22 using the gradient method, and a reference image 8000 bayer for explaining the interpolation method of B 22 when the pixel of interest is G 22 using the gradient method. and a reference image 8001 bayer for explaining the interpolation method of B22 .

参照画像8000bayerを用いてB22を求めるにあたっては、色補間部230は、予備計算として絶対値差分を、下記の式に基づいて求める。
NW=|B11-B33
NE=|B13-B31
そして、BNE=BNWであれば、次の式;
22=(B11+B13+B31+B33)/4
でB22が求められ、BNE<BNWであれば、次の式;
22=(B13+B31)/2
でB22が求められ、BNE>BNWであれば、次の式;
22=(B11+B33)/2
でB22が求められる。なお、注目画素がB22の場合は、以上の説明においてRとBを読み替えることによりR22を求めることができる。
In calculating B22 using the reference image 8000 Bayer , the color interpolation unit 230 calculates the absolute value difference based on the following formula as a preliminary calculation.
B NW = |B 11 -B 33 |
B NE = | B 13 - B 31 |
And if B NE =B NW , then the following formula;
B 22 = (B 11 +B 13 +B 31 +B 33 )/4
If B 22 is found and B NE <B NW , then the following formula;
B 22 =(B 13 +B 31 )/2
If B 22 is found and B NE >B NW , then the following formula;
B 22 = (B 11 +B 33 )/2
Then B22 can be found. Note that when the pixel of interest is B22 , R22 can be found by replacing R and B in the above explanation.

次に、注目画素がG22である場合には、参照画像8001bayerを用いて、次のように補間することができる。
22=(B12+B32)/2
22=(R21+R23)/2
なお、R画素が左右にあるG画素を一般にG、B画素が左右にあるG画素をGと記述することがあり、参照画像8001bayerはGの例である。Gの場合は、上の式のRとBを入れ替えれば良い。
Next, when the pixel of interest is G22 , interpolation can be performed as follows using the reference image 8001 bayer .
B 22 =(B 12 +B 32 )/2
R 22 =(R 21 +R 23 )/2
Note that a G pixel with R pixels on the left and right sides is generally described as G R , and a G pixel with B pixels on the left and right sides is sometimes described as G B , and the reference image 8001 bayer is an example of G R. In the case of G B , R and B in the above formula can be replaced.

(色相関法)
図13は、色相関法を用いて注目画素がR22である場合のB22の補間方法を説明するための参照画像9000bayerと、色相関法を用いて注目画素がG22である場のR22およびB22の補間方法を説明するための参照画像9001bayerとである。
(color correlation method)
FIG. 13 shows a reference image 9000 bayer for explaining the interpolation method of B 22 when the pixel of interest is R 22 using the color correlation method, and a bayer image of 9000 for explaining the interpolation method of B 22 when the pixel of interest is G 22 using the color correlation method. This is a reference image 9001 bayer for explaining the interpolation method of R 22 and B 22 .

本実施形態の手順で行けば、R,B画素位置のG成分は既に補間されていることになる。そのため、B22を求めるにあたっては、色補間部230は、予備計算として、BとGの平均値を、次のように求める。
AVE=(B11+B13+B31+B33)/4
AVE=(G11+G13+G31+G33)/4
そして、色相関に基づき、B22を求める。
22=G22+(BAVE-GAVE
なお、この例では、BAVE-GAVEのように相関差を用いているが、下記のように相関比を用いても良い。
22=G22×(BAVE/GAVE
なお、以上の説明では平均値(AVE)としているが、本来の意図は低周波成分を求めることにある。
If the procedure of this embodiment is followed, the G components at the R and B pixel positions will have already been interpolated. Therefore, in calculating B22 , the color interpolation unit 230 calculates the average value of B and G as follows as a preliminary calculation.
B AVE = (B 11 +B 13 +B 31 +B 33 )/4
GAVE =( G11 + G13 + G31 + G33 )/4
Then, B22 is determined based on the color correlation.
B 22 = G 22 + (B AVE - G AVE )
Note that in this example, a correlation difference is used, such as B AVE - G AVE , but a correlation ratio may be used as described below.
B 22 = G 22 × (B AVE /G AVE )
In the above explanation, the average value (AVE) is used, but the original intention is to obtain the low frequency component.

次に、G22を用いてB22を求める。この場合にも、本実施形態の手順で行けば、R,B画素位置のG成分は既に補間されていることになる。そのため、B22を求めるにあたっては、色補間部230は、予備計算として、BとGの平均値を、次のように求める。
AVE=(B12+B32)/2
AVE=(G12+G32)/2
そして、色相関に基づき、B22を求める。
22=G22+(BAVE-GAVE
次に、G22を用いてR22を求めるにあたって、色補間部230は、予備計算として、RとGの平均値を、次のように求める。
AVE=(B21+B23)/2
AVE=(G21+G23)/2
そして、色相関に基づき、R22を求める。
22=G22+(RAVE-GAVE
以上の方法で色補間をおこなうことができる。
Next, use G 22 to find B 22 . Even in this case, if the procedure of this embodiment is followed, the G components at the R and B pixel positions will have already been interpolated. Therefore, in calculating B22 , the color interpolation unit 230 calculates the average value of B and G as follows as a preliminary calculation.
BAVE =( B12 + B32 )/2
G AVE = (G 12 + G 32 )/2
Then, B22 is determined based on the color correlation.
B 22 = G 22 + (B AVE - G AVE )
Next, in calculating R 22 using G 22 , the color interpolation unit 230 calculates the average value of R and G as follows as a preliminary calculation.
BAVE =( B21 + B23 )/2
G AVE = (G 21 + G 23 )/2
Then, R22 is determined based on the color correlation.
R 22 = G 22 + (R AVE - G AVE )
Color interpolation can be performed using the above method.

(2.2)画像処理部の動作処理(画像処理方法)
図14は、画像処理部125の動作フロー(画像処理フロー)を示すフローチャートである。図14を用いて、画像処理部125による画像処理方法(色補間方法)を説明する。
(2.2) Operation processing of image processing unit (image processing method)
FIG. 14 is a flowchart showing the operation flow (image processing flow) of the image processing unit 125. The image processing method (color interpolation method) by the image processing unit 125 will be explained using FIG. 14.

画像処理部125にベイヤデータが入力されると、画像処理動作を開始し、ステップS1として、エッジ予備決定部210の方向性データ算出部211が、取得したベイヤデータを用いて、方向性データ(D、D、DNE、DNW)を算出する。算出方法は、先述の通りである。 When the Bayer data is input to the image processing unit 125, an image processing operation is started, and in step S1, the directionality data calculation unit 211 of the edge preliminary determination unit 210 uses the acquired Bayer data to calculate directionality data (D H , D V , D NE , D NW ). The calculation method is as described above.

次に、ステップS2(方向検出ステップ)として、エッジ予備決定部210の方向検出部212が、ステップS1にて算出された各方向性データ(D、D、DNE、DNW)を取得して、注目画素付近におけるエッジの有無およびエッジ方向を検出する。ステップS2では、方向検出部212が、D、D、DNE、DNWのうちの最小値を示す方向(エッジに沿う方向)を特定(選択)する。 Next, as step S2 (direction detection step), the direction detection unit 212 of the edge preliminary determination unit 210 acquires each directional data (D H , DV , D NE , D NW ) calculated in step S1. Then, the presence or absence of an edge and the edge direction near the pixel of interest are detected. In step S2, the direction detection unit 212 identifies (selects) the direction (direction along the edge) showing the minimum value among D H , D V , D NE , and D NW .

ステップS2については、図15を用いて更に詳述する。 Step S2 will be further detailed using FIG. 15.

ステップS2は、まず、ステップS21として、注目画素がR画素またはB画素であるかを判定する。ステップS21における判定の結果、注目画素がR画素でもB画素でもなければ、処理を終了する(ステップS21におけるNo)。要するに、本実施形態では、G画素に対しては、エッジ方向の検出をおこなわないため、注目画素がGの場合は、処理を終了する。一方、注目画素がR画素またはB画素であれば、ステップS22およびステップS23に移行する。 In step S2, first, as step S21, it is determined whether the pixel of interest is an R pixel or a B pixel. As a result of the determination in step S21, if the pixel of interest is neither an R pixel nor a B pixel, the process ends (No in step S21). In short, in this embodiment, the edge direction is not detected for the G pixel, so if the pixel of interest is G, the process ends. On the other hand, if the pixel of interest is an R pixel or a B pixel, the process moves to step S22 and step S23.

ステップS22では、水平・垂直方向の比較を行う。ステップS23では、対角線方向の比較を行う。ここで、例えば、水平方向を0、垂直方向を1、対角線右斜め上方向を2、対角線左斜め上方向を3、水平方向成分=垂直方向成分の時を4、対角線方向成分右斜め上方向=左斜め上方向成分の時を5とするインデックス番号を定義する。ステップS22では、水平方向成分と垂直方向成分とを比較し、水平方向成分が小さければ、仮の記憶変数DirVHに0を、垂直方向成分が小さければ1を、等しければ4を格納する。また、仮の記憶変数DVHに選択した方向成分を格納する。 In step S22, comparisons are made in the horizontal and vertical directions. In step S23, a diagonal comparison is performed. Here, for example, the horizontal direction is 0, the vertical direction is 1, the diagonal diagonally upward to the right is 2, the diagonal diagonally upward to the left is 3, the horizontal component = vertical component is 4, and the diagonal component is diagonally upward to the right. = Define an index number with 5 being the upper left diagonal component. In step S22, the horizontal component and the vertical component are compared, and if the horizontal component is small, 0 is stored in the temporary storage variable DirVH, if the vertical component is small, 1 is stored, and if they are equal, 4 is stored. Further, the selected direction component is stored in a temporary storage variable DVH.

ステップS23では、ステップS22と同様に、対角線右斜め上方向成分と左斜め上方向成分とを比較し、右斜め上方向成分が小さければ2を、左斜め上方向成分が小さければ3を、等しければ5を格納する。また、仮の記憶変数DNNにそれぞれ選択した方向成分を格納する。 In step S23, similarly to step S22, the diagonal upper right component and the diagonally upper left component are compared, and if the diagonal upper right component is smaller, 2 is set, and if the upper left component is smaller, 3 is set. 5 is stored. In addition, each selected direction component is stored in a temporary storage variable DNN.

ステップS24では、エッジ方向を決定する。具体的には、ステップS24では、ステップS22の水平・垂直方向比較結果DVHと、ステップS23対角線方向比較結果DNNとを比較する。比較の結果、水平・垂直方向成分DVHが小さければ、DirVHに格納している方向をエッジ方向として選択(予備的に決定)する。対角線方向成分DNNが小さければ、DirNNに格納している方向をエッジ方向として選択(予備的に決定)する。DVHとDNNが等しい場合は、例えばDirVHに格納している方向を、エッジ方向として選択(予備的に決定)する。この場合、方向性データに複数の最小値が存在するため、平坦部分と判断しても良い。 In step S24, the edge direction is determined. Specifically, in step S24, the horizontal/vertical direction comparison result DVH of step S22 is compared with the diagonal direction comparison result DNN of step S23. As a result of the comparison, if the horizontal and vertical components DVH are small, the direction stored in DirVH is selected (preliminarily determined) as the edge direction. If the diagonal direction component DNN is small, the direction stored in DirNN is selected (preliminarily determined) as the edge direction. If DVH and DNN are equal, for example, the direction stored in DirVH is selected (preliminarily determined) as the edge direction. In this case, since a plurality of minimum values exist in the directional data, it may be determined that this is a flat portion.

ステップS2において方向検出部212がエッジ方向を(予備的に)決定すると、ステップS3に移行する。 When the direction detection unit 212 (preliminarily) determines the edge direction in step S2, the process moves to step S3.

ステップS3(判定ステップ)では、エッジ決定部220の仮判定部221が、注目画素付近が平坦部分であるかエッジ部分であるかを仮判定する。ステップS3における仮判定処理は、ステップS1およびステップS2によって得られる演算結果に基づいて仮判定する。具体的な仮判定方法は、先述の通りであるが、図16に基づいて説明すれば、以下の通りである。 In step S3 (determination step), the provisional determination unit 221 of the edge determination unit 220 provisionally determines whether the vicinity of the pixel of interest is a flat portion or an edge portion. In the tentative determination process in step S3, a tentative determination is made based on the calculation results obtained in steps S1 and S2. The specific provisional determination method is as described above, but will be explained below based on FIG. 16.

ステップS3では、まずステップS31として、各方向の方向性データ(D、D、DNE、DNW)が算出される。そして、続くステップS32において、算出された方向性データの中に最小値、最大値があるかを判定する。最小値、最大値がある場合(ステップS32においてYes)は、エッジ部と仮判定され(ステップS33)、図14のステップS4に移行する。一方、ステップS3において注目画素付近が平坦部分であると仮判定された場合には、後述のステップS6Bの色補間ステップに移行する。 In step S3, first, as step S31, directional data (D V , DH , D NE , D NW ) in each direction is calculated. Then, in the subsequent step S32, it is determined whether there is a minimum value or maximum value in the calculated directional data. If there is a minimum value and a maximum value (Yes in step S32), it is tentatively determined to be an edge portion (step S33), and the process moves to step S4 in FIG. 14. On the other hand, if it is tentatively determined in step S3 that the vicinity of the pixel of interest is a flat portion, the process moves to a color interpolation step in step S6B, which will be described later.

ステップS4(ノイズ量算出ステップ)では、ノイズ量算出部222が、近傍画素のノイズ量VARを算出する。先述のように、ステップS4における近傍画素のノイズ量は、ステップS2において求めたエッジ方向に沿って求める。具体的なノイズ量算出方法は、先述の通りである。ノイズ量算出部222が近傍画素のノイズ量VARを算出すると、ステップS5に移行する。 In step S4 (noise amount calculation step), the noise amount calculation unit 222 calculates the noise amount VAR of neighboring pixels. As described above, the amount of noise of neighboring pixels in step S4 is determined along the edge direction determined in step S2. The specific noise amount calculation method is as described above. Once the noise amount calculation unit 222 calculates the noise amount VAR of the neighboring pixels, the process moves to step S5.

なお、ステップS1およびステップS2における方向性データの算出およびエッジ方向の検出処理と、ステップS4における垂直・水平・対角線方向のノイズ量の算出処理とを並列に求めてもよい。これにより、エッジ方向の検出が終わった直後に最小値の方向のノイズ量と方向性データの最大値とを比較することができ、演算時間を短縮できる。 Note that the process of calculating the directional data and detecting the edge direction in steps S1 and S2 and the process of calculating the amount of noise in the vertical, horizontal, and diagonal directions in step S4 may be performed in parallel. This makes it possible to compare the amount of noise in the direction of the minimum value with the maximum value of the directional data immediately after the detection of the edge direction is completed, thereby reducing the calculation time.

ステップS5(比較ステップ)では、ステップS4において算出した近傍画素のノイズ量VARと予め定めた判定パラメータαとを加えた値と、ステップS1において算出した方向性データの最大値と、を比較する。この比較処理は、エッジ判定部223においておこなう。ステップS5では、先述のように、以下の関係式;
エッジ方向性データの最大値>VAR+α
を満たすか否かを判定する。そして、当該関係式を満たす場合は注目画素付近をエッジ部分と判定(確定)し、当該関係式を満たさない場合は、エッジ部分と仮判定されていた注目画素付近を平坦部分と判定(確定)する。
In step S5 (comparison step), a value obtained by adding the noise amount VAR of the neighboring pixels calculated in step S4 and a predetermined determination parameter α is compared with the maximum value of the directional data calculated in step S1. This comparison process is performed by the edge determination section 223. In step S5, as mentioned above, the following relational expression;
Maximum value of edge directionality data>VAR+α
Determine whether the following is satisfied. Then, if the relational expression is satisfied, the area around the pixel of interest is determined to be an edge part (confirmed), and if the relational expression is not satisfied, the vicinity of the pixel of interest, which was tentatively determined to be an edge part, is determined to be a flat area (confirmed). do.

ステップS5において注目画素付近がエッジ部分であると確定した場合には、ステップS6Aの色補間ステップに移行する。注目画素付近が平坦部分であると確定した場合には、後述のステップS6Bの色補間ステップに移行する。 If it is determined in step S5 that the vicinity of the pixel of interest is an edge portion, the process moves to a color interpolation step in step S6A. If it is determined that the vicinity of the pixel of interest is a flat portion, the process moves to a color interpolation step in step S6B, which will be described later.

ステップS6Aでは、色補間部230が、ステップS2において求めたエッジ方向を用いて注目画素の色補間処理をおこなう。ステップS6Aでは、ステップS2のステップS24において選択された補間方向を用いる。すなわち、ステップS6Aでは、エッジ方向成分が最も小さい方向を用いて補間をおこなう。補間方法としては、先述の通りである。 In step S6A, the color interpolation unit 230 performs color interpolation processing on the pixel of interest using the edge direction determined in step S2. In step S6A, the interpolation direction selected in step S24 of step S2 is used. That is, in step S6A, interpolation is performed using the direction in which the edge direction component is the smallest. The interpolation method is as described above.

一方、ステップS6Bでは、色補間部230が、参照画像内の全てのG画素を使用した平均値フィルタ等の低周波通過フィルタ(LPF)手法でノイズ成分を抑制するようにして、注目画素の色補間をおこなう。 On the other hand, in step S6B, the color interpolation unit 230 suppresses the noise component using a low frequency pass filter (LPF) method such as an average filter using all G pixels in the reference image, so that the color of the pixel of interest is Perform interpolation.

ステップS6AまたはステップS6Bにおいて色補間が完了すると、他の注目画素における色補間が完了していれば処理を終了する(ステップS7)。色補間がおこなわれていない画素があればステップS1に戻って、当該画素の色補間をおこなう。色補間をおこなうべき全ての画素に対して色補間が完了したら、処理を終了する。 When color interpolation is completed in step S6A or step S6B, the process ends if color interpolation for other pixels of interest has been completed (step S7). If there is a pixel for which color interpolation has not been performed, the process returns to step S1 and color interpolation is performed for that pixel. When color interpolation is completed for all pixels to which color interpolation is to be performed, the process ends.

(3)効果
本実施形態によれば、従前よりも精度よく色補間処理をおこなうことが可能となる。
(3) Effects According to this embodiment, it is possible to perform color interpolation processing with higher precision than before.

特許文献1においては、エッジの有無を判定する際、エッジ方向性データの最大値(=エッジと交差する方向)を、ある閾値と比較し、閾値よりも小さければ平坦部分としている。しかしながら、イメージセンサからの出力データは、平坦部分であってもショットノイズ等が含まれている。ショットノイズは、同一フレーム内でも輝度が高い部分と低い部分とではノイズ量が異なる。そのため、輝度平均が高いと、ショットノイズが閾値を超える。そのため、平坦部分をエッジ部分として誤検出する虞がある。故に、同一フレーム内においても、輝度平均値に対して適切に閾値を変更する必要がある。 In Patent Document 1, when determining the presence or absence of an edge, the maximum value of edge directionality data (=direction intersecting the edge) is compared with a certain threshold value, and if it is smaller than the threshold value, it is considered a flat part. However, the output data from the image sensor includes shot noise and the like even if it is a flat portion. Regarding shot noise, the amount of noise differs between a high-luminance part and a low-luminance part even within the same frame. Therefore, when the brightness average is high, shot noise exceeds the threshold. Therefore, there is a possibility that a flat portion may be erroneously detected as an edge portion. Therefore, it is necessary to appropriately change the threshold value with respect to the average luminance value even within the same frame.

これに対し、本実施形態では、エッジ部分と仮判定された注目画素付近について、近傍画素のノイズ量を算出し、ノイズ量とパラメータとの加算値と、方向性データの最大値とを比較する。比較の結果、方向性データの最大値が、当該加算値よりも大きければ、注目画素付近をエッジ部分と確定する。一方で、当該加算値以下であれば、先にエッジ有りと仮判定されていた注目画素付近を平坦部分と見直す。これにより、先述したような誤判定に伴う誤った色補間処理がおこなわれる虞がない。そのため、精度よく色補間をおこない、高画質の画像を生成することに寄与することができる。 In contrast, in this embodiment, the amount of noise of neighboring pixels is calculated for the vicinity of the pixel of interest that has been tentatively determined to be an edge portion, and the sum of the amount of noise and the parameter is compared with the maximum value of the directional data. . As a result of the comparison, if the maximum value of the directional data is larger than the added value, the vicinity of the pixel of interest is determined to be an edge portion. On the other hand, if it is less than or equal to the added value, the vicinity of the pixel of interest, which was previously tentatively determined to have an edge, is reconsidered to be a flat portion. Thereby, there is no possibility that erroneous color interpolation processing will be performed due to the above-mentioned erroneous determination. Therefore, color interpolation can be performed with high precision, contributing to the generation of high-quality images.

また、特許文献2においてもエッジの方向性データを算出する。その算出方法は、7×7ピクセルの参照画素領域内で勾配計算を行っている。これを実現するためには7行分のラインメモリ(ラインバッファとも呼ばれる)が必要である。また、対角線方向の勾配計算では、計算式の末尾に7による除算が存在している。2のべき乗以外の除算はビットシフトで計算出来ないため、対角線方向の勾配計算には除算回路が別途必要になり、回路規模が大きくなる。 Furthermore, in Patent Document 2, edge directionality data is also calculated. The calculation method is to perform gradient calculation within a reference pixel area of 7×7 pixels. To realize this, a line memory (also called a line buffer) for seven lines is required. Furthermore, in the diagonal gradient calculation, there is a division by 7 at the end of the calculation formula. Since divisions other than powers of 2 cannot be calculated by bit shifting, a separate division circuit is required to calculate the gradient in the diagonal direction, which increases the circuit scale.

これに対し、本実施形態では、先述のように、エッジの方向性データ算出は、5×5ピクセルの参照画素領域内で勾配計算をおこなう。従ってラインメモリは5行分で済む。また、対角線の分析も加減算とビットシフト処理のみで可能である。したがって、従前よりも、回路規模が過大となることを抑えることが可能である。 In contrast, in this embodiment, as described above, edge directionality data calculation is performed by gradient calculation within a reference pixel area of 5×5 pixels. Therefore, the line memory only requires 5 lines. Furthermore, analysis of diagonal lines is also possible using only addition/subtraction and bit shift processing. Therefore, it is possible to prevent the circuit scale from becoming too large compared to before.

〔実施形態2〕
本発明の他の実施形態について、以下に説明する。なお、説明の便宜上、上記実施形態にて説明した部材と同じ機能を有する部材については、同じ符号を付記し、その説明を繰り返さない。
[Embodiment 2]
Other embodiments of the invention will be described below. For convenience of explanation, members having the same functions as the members described in the above embodiment are given the same reference numerals, and the description thereof will not be repeated.

本実施形態と、先述した実施形態1との違いは、仮判定において平坦部と判定された場合のそれ以降の処理にある。要するに、画像処理部125による画像処理方法の動作フロー(画像処理フロー)が、実施形態1のそれと相違する。以下、本実施形態について、図17を用いて説明する。 The difference between this embodiment and the first embodiment described above lies in the subsequent processing when a flat portion is determined in the tentative determination. In short, the operation flow (image processing flow) of the image processing method by the image processing unit 125 is different from that of the first embodiment. This embodiment will be described below using FIG. 17.

図17は、本実施形態の画像処理部125による画像処理方法の動作フローを示すフローチャートである。 FIG. 17 is a flowchart showing the operation flow of the image processing method by the image processing unit 125 of this embodiment.

ステップS1~ステップS3までは、実施形態1において説明しているため、説明を省略する。 Steps S1 to S3 have been explained in the first embodiment, so their explanation will be omitted.

上述の実施形態1では、ステップS3において注目画素付近が平坦部分であると仮判定された場合には、ステップS6Bの色補間ステップに移行する。これに対して、本実施形態では、ステップS3において注目画素付近が平坦部分であると判定される(図17におけるステップS3A)と、条件を変えて、再度、平坦部であるか否かが判定される。これが、図17におけるステップS3Bである。 In the first embodiment described above, if it is tentatively determined in step S3 that the area near the pixel of interest is a flat portion, the process moves to the color interpolation step of step S6B. In contrast, in this embodiment, when it is determined in step S3 that the vicinity of the pixel of interest is a flat portion (step S3A in FIG. 17), it is determined again whether or not it is a flat portion by changing the conditions. be done. This is step S3B in FIG.

また、上述の実施形態1では、ステップS3においてエッジ部分であるか仮判定する際に参照する画像領域が3行×3列の大きさである一方で、続くステップS4のノイズ量算出処理では、5行×5列の画像領域に基づいて算出をおこなっている。これに対して、本実施形態では、ステップS3Aにおいて3行×3列の画像領域を用いてエッジ部である仮判定された場合については、参照領域を5行×5列に広げることなく、3行×3列の画像領域においてノイズ量を演算する。 Further, in the first embodiment described above, while the image area referred to when tentatively determining whether it is an edge portion in step S3 has a size of 3 rows x 3 columns, in the noise amount calculation process of the subsequent step S4, Calculations are performed based on an image area of 5 rows x 5 columns. On the other hand, in the present embodiment, when the image area of 3 rows x 3 columns is tentatively determined to be an edge portion in step S3A, the reference area is not expanded to 5 rows x 5 columns, and 3 The amount of noise is calculated in an image area of rows and three columns.

以下では、まず、本実施形態の仮判定ステップに関して、詳細を説明する。 Below, details will first be explained regarding the provisional determination step of this embodiment.

図17のステップS3Aは、実施形態1のステップS3に相当する。ステップS3Aでは、仮判定部221が図5に示す3行×3列の画素領域を用いてエッジが有るか否かを仮判定する。図5に示す画素領域の縦(垂直)方向にエッジがあるa)の例において、各方向の方向性データは下記のように絶対値差分によって求められる。
=|L01-L21|=0
=|L10-L12|=255
NE=|L02-L20|=255
NW=|L00-L22|=255
このとき、Dが最も小さいため、画素領域の縦(垂直)方向に沿ってエッジが存在する、すなわちエッジ方向は縦(垂直)方向である、とみなすことができる。
Step S3A in FIG. 17 corresponds to step S3 in the first embodiment. In step S3A, the tentative determination unit 221 tentatively determines whether or not there is an edge using the 3 rows by 3 columns pixel area shown in FIG. In the example of a) in which the pixel area has edges in the vertical (vertical) direction shown in FIG. 5, the directionality data in each direction is determined by the absolute value difference as shown below.
D V = |L 01 -L 21 |=0
D H = |L 10 -L 12 |=255
D NE =|L 02 -L 20 |=255
D NW = | L 00 - L 22 | = 255
At this time, since DV is the smallest, it can be considered that an edge exists along the vertical (vertical) direction of the pixel area, that is, the edge direction is the vertical (vertical) direction.

一方、図5のd)、e)、f)、g)およびh)に示す例の場合は、方向性データの最小値と最大値が同一である。そのため、ステップS3Aでは、平坦部分であると仮判定される。平坦部分であると仮判定された場合には、ステップS3Bに移行する。 On the other hand, in the examples shown in d), e), f), g) and h) of FIG. 5, the minimum value and maximum value of the directional data are the same. Therefore, in step S3A, it is tentatively determined that it is a flat portion. If it is tentatively determined that it is a flat portion, the process moves to step S3B.

ステップS3Bでは、図5に示す3行×3列の画素領域を用いて、以下の演算
V(1)=|2L11-L01-L21
H(1)=|2L11-L10-L12
NE(1)=|2L11-L02-L20
NW(1)=|2L11-L00-L22
をおこなう。
In step S3B, the following calculation D V (1) = |2L 11 -L 01 -L 21 | is performed using the 3 rows x 3 columns pixel area shown in FIG.
D H(1) = |2L 11 -L 10 -L 12 |
D NE (1) = | 2L 11 -L 02 -L 20 |
D NW (1) = | 2L 11 -L 00 -L 22 |
will be carried out.

続いて、ステップS3Cにおいて、ステップS3Bの演算結果で、DV(1)=DH(1)、NE(1)=DNW(1)が、いずれか一方、もしくは両方ともを満たすか否かを判定する。成り立たない場合(ステップS3CにおいてNo)は、ステップS3Dに移行する。 Subsequently, in step S3C, it is determined whether one or both of D V (1) = D H (1) and D NE (1) = D NW (1) are satisfied based on the calculation result of Step S3B. Determine whether If this is not true (No in step S3C), the process moves to step S3D.

ステップS3Dでは、参照する画像領域の大きさを5行×5列に拡張して、ステップS3Eに移行する。 In step S3D, the size of the reference image area is expanded to 5 rows x 5 columns, and the process moves to step S3E.

ステップS3Eでは、実施形態1において説明した式(1)に基づいてエッジ方向の推定をおこなう。このとき、5行×5列における注目画素との差分による方向成分計算は、図18に示す画素を用いて以下の演算;
V(2)=|2L22-L02-L42
H(2)=|2L22-L20-L24
NE(2)=|2L22-L04-L40
NW(2)=|2L22-L00-L44
によって求められる。図5のd)に示す例において、画像領域を5×5に拡張したものを図19に示すと、この演算を用いることにより、
V(2)=0
H(2)=DNE(2)=DNW(2)=510
となり、DV(2)が最小であるため、エッジに沿う方向は垂直方向であると検出することができる。
In step S3E, the edge direction is estimated based on equation (1) described in the first embodiment. At this time, the direction component calculation based on the difference with the pixel of interest in 5 rows x 5 columns is performed using the pixels shown in FIG. 18 as follows:
D V(2) = |2L 22 -L 02 -L 42 |
D H(2) = |2L 22 -L 20 -L 24 |
D NE (2) = | 2L 22 -L 04 -L 40 |
D NW (2) = | 2L 22 -L 00 -L 44 |
It is determined by In the example shown in d) of FIG. 5, when the image area is expanded to 5×5 and shown in FIG. 19, by using this calculation,
D V (2) = 0
D H(2) =D NE(2) =D NW(2) =510
Since DV(2) is the minimum, the direction along the edge can be detected to be the vertical direction.

ステップS3Gでは、実施形態1のステップS3と同様に、エッジ部であるか否かを仮判定する。エッジ部であると仮判定された場合は、ステップS4に移行する。一方、平坦部であると判定された場合は、ステップS6Bに移行する。 In step S3G, similarly to step S3 of the first embodiment, it is tentatively determined whether or not it is an edge portion. If it is tentatively determined that it is an edge portion, the process moves to step S4. On the other hand, if it is determined that the area is a flat area, the process moves to step S6B.

一方、ステップS3Cにおいて、DV(1)=DH(1)、且つ、DNE(1)=DNW(1)の場合は(ステップ3CにおいてYes)、平坦部として、以降、実施形態1と同様に処理する。 On the other hand, in step S3C, if D V(1) =D H(1) and D NE(1) =D NW(1) (Yes in step 3C), the flat part is defined as a flat part, and henceforth, Embodiment 1 will be described. Process in the same way as .

ここで、ステップS3Aにおいて、何れかの方向性データに最小値が存在し、図5のa)、b)およびc)に示すようにエッジ部であると仮判定された場合には、ステップS4Aに移行する。 Here, in step S3A, if there is a minimum value in any of the directional data and it is tentatively determined that it is an edge portion as shown in a), b), and c) of FIG. to move to.

ステップS4Aでは、実施形態1のステップS4がノイズ量の演算に5行×5列の画像領域を用いているのに対して、3行×3列の画像領域を用いて演算する。図20に3行×3列の画像領域を示す。この図20に基づいて、ステップS4Aを説明する。なお、図20の3行×3列の画像領域は、注目画素L11がRで、注目画素L11の上下左右に隣接しているL01、L10、L12およびL21がGで、注目画素L11に対して斜め方向に隣接しているL00、L02、L20およびL22がBである。この図20の画像領域において、例えば、エッジに沿う方向が垂直方向(Dが最も小さい)である場合、ノイズ量算出部222は、各行の輝度の平均値(B1AVE、G2AVE、B3AVE)を下記の各式;
B1AVE=(L00+L20)/2
G2AVE=(L01+L21)/2
B3AVE=(L02+L22)/2
に基づいて求める。また、ノイズ量算出部222は、下記の各式に基づき、輝度の平均値(B1AVE、G2AVE、B3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(B1var、G2var、B3var)を全て加算したノイズ量Vvarを求める。
B1var=(|L00-B1AVE|+|L20-B1AVE|)/2
G2var=(|L01-G2AVE|+|L21-G2AVE|)/2
B3var=(|L02-B3AVE|+|L22-B3AVE|)/2
var=B1var+G2var+B3var
また、エッジに沿う方向が水平方向(Dが最も小さい)である場合、ノイズ量算出部222は、各行の輝度の平均値(B1AVE、G2AVE、B3AVE)を下記の各式;
B1AVE=(L00+L02)/2
G2AVE=(L10+L12)/2
B3AVE=(L20+L22)/2
に基づいて求める。また、ノイズ量算出部222は、下記の各式に基づき、輝度の平均値(B1AVE、G2AVE、B3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(B1var、G2var、B3var)を全て加算したノイズ量Hvarを求める。
B1var=(|L00-B1AVE|+|L02-B1AVE|)/2
G2var=(|L10-G2AVE|+|L12-G2AVE|)/2
B3var=(|L20-B3AVE|+|L22-B3AVE|)/2
var=B1var+G2var+B3var
また、エッジに沿う方向が右斜め上方向(DNEが最も小さい)である場合、ノイズ量算出部222は、各行の輝度の平均値(G1AVE、B2AVE、G3AVE)を下記の各式;
G1AVE=(L01+L10)/2
B2AVE=(L02+L20)/2
G3AVE=(L12+L21)/2
に基づいて求める。また、ノイズ量算出部222は、下記の各式に基づき、輝度の平均値(G1AVE、B2AVE、G3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(G1var、B2var、G3var)を全て加算したノイズ量NEvarを求める。
G1var=(|L01-G1AVE|+|L10-G1AVE|)/2
B2var=(|L02-B2AVE|+|L20-B2AVE|)/2
G3var=(|L12-G3AVE|+|L21-G3AVE|)/2
NEvar=G1var+B2var+G3var
また、エッジに沿う方向が左斜め上方向(DNWが最も小さい)である場合、ノイズ量算出部222は、各行の輝度の平均値(G1AVE、B2AVE、G3AVE)を下記の各式;
G1AVE=(L01+L12)/2
B2AVE=(L00+L22)/2
G3AVE=(L10+L21)/2
に基づいて求める。また、ノイズ量算出部222は、下記の各式に基づき、輝度の平均値(G1AVE、B2AVE、G3AVE)と各同色画素の輝度との絶対値差分を画素数にて除算して得られる各行のノイズ値(G1var、B2var、G3var)を全て加算したノイズ量NWvarを求める。
In step S4A, while step S4 of the first embodiment uses an image area of 5 rows x 5 columns to calculate the amount of noise, an image area of 3 rows x 3 columns is used for calculation. FIG. 20 shows an image area of 3 rows x 3 columns. Step S4A will be explained based on FIG. 20. In the image area of 3 rows x 3 columns in FIG. 20, the pixel of interest L 11 is R, and the pixels L 01 , L 10 , L 12 and L 21 that are adjacent to the pixel of interest L 11 on the upper, lower, left and right sides are G, and L 00 , L 02 , L 20 and L 22 that are diagonally adjacent to the pixel of interest L 11 are B. In the image area of FIG. 20, for example, if the direction along the edge is the vertical direction ( DV is the smallest), the noise amount calculation unit 222 calculates the average luminance value of each row (B1 AVE , G2 AVE , B3 AVE ) as each of the following formulas;
B1 AVE = (L 00 +L 20 )/2
G2 AVE = (L 01 +L 21 )/2
B3 AVE = (L 02 +L 22 )/2
Find it based on. In addition, the noise amount calculation unit 222 calculates a value obtained by dividing the absolute value difference between the average value of brightness (B1 AVE , G2 AVE , B3 AVE ) and the brightness of each pixel of the same color by the number of pixels, based on the following formulas. The noise amount V var is obtained by adding all the noise values (B1 var , G2 var , B3 var ) of each row.
B1 var = (|L 00 -B1 AVE |+|L 20 -B1 AVE |)/2
G2 var = (|L 01 -G2 AVE |+|L 21 -G2 AVE |)/2
B3 var = (|L 02 -B3 AVE |+|L 22 -B3 AVE |)/2
V var =B1 var +G2 var +B3 var
Further, when the direction along the edge is the horizontal direction ( DH is the smallest), the noise amount calculation unit 222 calculates the average value of the brightness of each row (B1 AVE , G2 AVE , B3 AVE ) using the following formulas;
B1 AVE = (L 00 +L 02 )/2
G2 AVE = (L 10 +L 12 )/2
B3 AVE = (L 20 +L 22 )/2
Find it based on. In addition, the noise amount calculation unit 222 calculates a value obtained by dividing the absolute value difference between the average value of brightness (B1 AVE , G2 AVE , B3 AVE ) and the brightness of each pixel of the same color by the number of pixels, based on the following formulas. The noise amount H var is calculated by adding all the noise values (B1 var , G2 var , B3 var ) of each row.
B1 var = (|L 00 -B1 AVE |+|L 02 -B1 AVE |)/2
G2 var = (|L 10 -G2 AVE |+|L 12 -G2 AVE |)/2
B3 var = (|L 20 -B3 AVE |+|L 22 -B3 AVE |)/2
H var =B1 var +G2 var +B3 var
Further, when the direction along the edge is diagonally upward to the right ( DNE is the smallest), the noise amount calculation unit 222 calculates the average value of the luminance of each row (G1 AVE , B2 AVE , G3 AVE ) using the following formulas. ;
G1 AVE = (L 01 +L 10 )/2
B2 AVE = (L 02 +L 20 )/2
G3 AVE = (L 12 +L 21 )/2
Find it based on. In addition, the noise amount calculation unit 222 calculates a value obtained by dividing the absolute value difference between the average value of brightness (G1 AVE , B2 AVE , G3 AVE ) and the brightness of each pixel of the same color by the number of pixels, based on the following formulas. The noise amount NE var is calculated by adding all the noise values (G1 var , B2 var , G3 var ) of each row.
G1 var = (|L 01 -G1 AVE |+|L 10 -G1 AVE |)/2
B2 var = (|L 02 -B2 AVE |+|L 20 -B2 AVE |)/2
G3 var = (|L 12 -G3 AVE |+|L 21 -G3 AVE |)/2
NE var = G1 var + B2 var + G3 var
Further, when the direction along the edge is the diagonally upper left direction (D NW is the smallest), the noise amount calculation unit 222 calculates the average value of the luminance of each row (G1 AVE , B2 AVE , G3 AVE ) using the following equations. ;
G1 AVE = (L 01 +L 12 )/2
B2 AVE = (L 00 +L 22 )/2
G3 AVE = (L 10 +L 21 )/2
Find it based on. In addition, the noise amount calculation unit 222 calculates a value obtained by dividing the absolute value difference between the average value of brightness (G1 AVE , B2 AVE , G3 AVE ) and the brightness of each pixel of the same color by the number of pixels, based on the following formulas. The noise amount NW var is obtained by adding all the noise values (G1 var , B2 var , G3 var ) of each row.

以上の算出手順により、ノイズ量算出部222は近傍画素のノイズ量VAR(つまり先述のHvar、Vvar、NEvarおよびNWvarのうちの何れか)を算出する。 According to the above calculation procedure, the noise amount calculation unit 222 calculates the noise amount VAR (that is, any one of the above-mentioned H var , V var , NE var and NW var ) of the neighboring pixels.

一方、ステップS3Gにおいてエッジ部であると仮判定された場合には、実施形態1のステップS4以降の処理をおこなう。 On the other hand, if it is tentatively determined in step S3G that it is an edge portion, the processes from step S4 onward in the first embodiment are performed.

ステップS5では、実施形態1と同じく、エッジ判定部223が、ノイズ量算出部222が算出した近傍画素のノイズ量VARと予め定めた判定パラメータαとを加えた値と、方向性データの最大値と、を比較し、注目画素付近がエッジ部分か平坦部分かを判定する。以降、実施形態1と同様に処理する。 In step S5, as in the first embodiment, the edge determination unit 223 calculates the sum of the noise amount VAR of the neighboring pixels calculated by the noise amount calculation unit 222 and the predetermined determination parameter α, and the maximum value of the directionality data. It is determined whether the vicinity of the pixel of interest is an edge portion or a flat portion. Thereafter, processing is performed in the same manner as in the first embodiment.

本実施形態では、上述のように、ノイズ量の演算において参照領域を5×5に広げることなく、エッジの仮判定をおこなう際の画像領域である3×3の画像領域で演算が終了する。そのため、実施形態1に比べて、演算量を低減することができる。画素数が多くなるにつれて、低画素時代には1ピクセル幅で線だったものが、高解像度化によって複数ピクセルで表現されることが多くなっている。つまり、図5のd)~f)のケースが減っている。従って、高解像の場合、図5のa)~c)のケースが多くなり、本実施形態において演算量が減少することは有意なことである。またこれに伴い、消費電力の削減に寄与すると言える。 In this embodiment, as described above, the calculation of the amount of noise does not expand the reference area to 5x5, and the calculation ends in a 3x3 image area, which is the image area for tentative edge determination. Therefore, compared to the first embodiment, the amount of calculation can be reduced. As the number of pixels increases, what used to be a line with a width of one pixel in the low-pixel era is now often expressed using multiple pixels due to higher resolution. In other words, cases d) to f) in FIG. 5 are decreasing. Therefore, in the case of high resolution, the cases a) to c) in FIG. 5 increase, and it is significant that the amount of calculations is reduced in this embodiment. Additionally, it can be said that this contributes to a reduction in power consumption.

〔ソフトウェアによる実現例〕
撮像装置1の制御ブロック(特に制御部120)は、集積回路(ICチップ)等に形成された論理回路(ハードウェア)によって実現してもよいし、ソフトウェアによって実現してもよい。
[Example of implementation using software]
The control block (particularly the control unit 120) of the imaging device 1 may be realized by a logic circuit (hardware) formed in an integrated circuit (IC chip) or the like, or may be realized by software.

後者の場合、撮像装置1は、各機能を実現するソフトウェアであるプログラム(画像処理プログラム)の命令を実行するコンピュータを備えている。このコンピュータは、例えば少なくとも1つのプロセッサ(制御装置)を備えていると共に、上記プログラムを記憶したコンピュータ読み取り可能な少なくとも1つの記録媒体を備えている。そして、上記コンピュータにおいて、上記プロセッサが上記プログラムを上記記録媒体から読み取って実行することにより、本発明の目的が達成される。上記プロセッサとしては、例えばCPU(Central Processing Unit)を用いることができる。上記記録媒体としては、「一時的でない有形の媒体」、例えば、ROM(Read Only Memory)等の他、テープ、ディスク、カード、半導体メモリ、プログラマブルな論理回路などを用いることができる。また、上記プログラムを展開するRAM(Random Access Memory)などをさらに備えていてもよい。また、上記プログラムは、該プログラムを伝送可能な任意の伝送媒体(通信ネットワークや放送波等)を介して上記コンピュータに供給されてもよい。なお、本発明の一態様は、上記プログラムが電子的な伝送によって具現化された、搬送波に埋め込まれたデータ信号の形態でも実現され得る。 In the latter case, the imaging device 1 includes a computer that executes instructions of a program (image processing program) that is software that implements each function. This computer includes, for example, at least one processor (control device) and at least one computer-readable recording medium storing the above program. In the computer, the processor reads the program from the recording medium and executes the program, thereby achieving the object of the present invention. As the processor, for example, a CPU (Central Processing Unit) can be used. As the recording medium, in addition to "non-temporary tangible media" such as ROM (Read Only Memory), tapes, disks, cards, semiconductor memories, programmable logic circuits, etc. can be used. Further, the computer may further include a RAM (Random Access Memory) for expanding the above program. Furthermore, the program may be supplied to the computer via any transmission medium (communication network, broadcast waves, etc.) that can transmit the program. Note that one aspect of the present invention can also be realized in the form of a data signal embedded in a carrier wave, in which the program is embodied by electronic transmission.

〔まとめ〕
本発明の態様1に係る画像処理装置(画像処理部125)は、ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化した方向性データを用いて、エッジ方向を検出する方向検出部212と、前記方向間で前記方向性データに差が有るか否かを判定する判定部(仮判定部221)と、前記近傍画素のノイズ量を算出するノイズ量算出部222と、前記差が有ると判定された前記方向性データの最大値と、前記ノイズ量を含む閾値とを比較する比較部(エッジ判定部223)と、前記比較部(エッジ判定部223)の比較結果に応じて、(i)前記最大値が前記閾値より大きい場合は前記注目画素に対して前記エッジ方向を用いた色補間をおこない、(ii)前記最大値が前記閾値以下である場合は前記注目画素に対して前記(i)の色補間とは異なる色補間をおこなう色補間部230と、を備えている。
〔summary〕
The image processing device (image processing unit 125) according to aspect 1 of the present invention uses directionality data that quantifies the directionality of edges in a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions. a direction detection unit 212 that detects an edge direction; a determination unit (temporary determination unit 221) that determines whether there is a difference in the directional data between the directions; and a noise amount that calculates the amount of noise of the neighboring pixels. a calculation unit 222; a comparison unit (edge determination unit 223) that compares the maximum value of the directional data determined to have the difference with a threshold value including the noise amount; ), (i) if the maximum value is greater than the threshold, color interpolation is performed on the pixel of interest using the edge direction; (ii) if the maximum value is less than or equal to the threshold; In this case, the color interpolation unit 230 performs color interpolation different from the color interpolation (i) on the pixel of interest.

前記の構成によれば、従前よりも精度よく色補間処理をおこなうことが可能となる。 According to the above configuration, it is possible to perform color interpolation processing with higher precision than before.

具体的には、前記の構成によれば、判定部(仮判定部221)において方向性データに基づいて差が有る(つまり、エッジ部分である)と判定した場合であっても、この判定の適否を、ノイズ量算出部222および比較部(エッジ判定部223)によって確認する。例えばショットノイズ等が含まれている場合、方向性データに基づいた判定だけでは、平坦部分をエッジ部分と判定してしまう。しかしながら、前記確認をおこなうことにより、方向性データに基づいた判定でエッジ部分と判定している場合であっても、近傍画素のノイズ量を含む閾値以下であればエッジ部分とせず、その場合はエッジ方向を用いた色補間をおこなわない。エッジ方向を用いた色補間を、ショットノイズを含む平坦部分に適用してしまうと、ショットノイズが残ったまま色補間がおこなわれるため、望ましくない。よって、本態様1の構成のようにノイズ量を算出して、そのノイズ量を含む閾値との比較結果に応じた色補間をおこなうことにより、精度よく色補間をおこない、高画質の画像データを生成することに寄与することができる。 Specifically, according to the above configuration, even if the determination unit (temporary determination unit 221) determines that there is a difference based on the directional data (that is, it is an edge portion), this determination is The suitability is confirmed by the noise amount calculation unit 222 and the comparison unit (edge determination unit 223). For example, if shot noise or the like is included, a flat portion will be determined to be an edge portion if only the determination is based on directional data. However, by performing the above confirmation, even if it is determined to be an edge part based on the directional data, if it is less than a threshold that includes the noise amount of neighboring pixels, it will not be considered an edge part, and in that case, Color interpolation using edge direction is not performed. If color interpolation using the edge direction is applied to a flat portion that includes shot noise, color interpolation will be performed with shot noise remaining, which is not desirable. Therefore, by calculating the noise amount and performing color interpolation according to the comparison result with a threshold value that includes the noise amount as in the configuration of this aspect 1, color interpolation can be performed with high accuracy and high-quality image data can be generated. can contribute to the generation of

本発明の態様2に係る画像処理装置(画像処理部125)は、上記態様1において、前記ノイズ量算出部222が、前記方向間で前記方向性データに差が有ると判定された場合の最小値を示す方向性データに対応する方向に沿って、前記近傍画素のノイズ量を算出する。 In the image processing device (image processing unit 125) according to aspect 2 of the present invention, in the above aspect 1, the noise amount calculation unit 222 calculates the minimum The amount of noise of the neighboring pixels is calculated along the direction corresponding to the directional data indicating the value.

上記の構成によれば、ノイズ量を、前記方向性データに差が有る場合の最大値を示す方向性データに対応する方向に沿って算出する場合に比べて、精度よくノイズ量を算出することができる。 According to the above configuration, the noise amount can be calculated with higher accuracy than when the noise amount is calculated along the direction corresponding to the directional data indicating the maximum value when there is a difference in the directional data. Can be done.

本発明の態様3に係る画像処理装置(画像処理部125)は、上記態様1または2において、前記ノイズ量算出部222が、前記方向間で前記方向性データに差が有ると判定された場合の最小値を示す方向性データに対応する方向の前記ノイズ量を、前記注目画素および近傍画素の輝度値の平均偏差によって算出する。 In the image processing device (image processing unit 125) according to aspect 3 of the present invention, in the above aspect 1 or 2, when the noise amount calculation unit 222 determines that there is a difference in the directional data between the directions, The amount of noise in the direction corresponding to the directional data indicating the minimum value of is calculated based on the average deviation of the luminance values of the pixel of interest and neighboring pixels.

上記の構成によれば、ノイズ量を、標準偏差および分散によって算出する場合に比べて、簡易な計算によって求めることができる。 According to the above configuration, the amount of noise can be determined by a simpler calculation than in the case where the amount of noise is calculated using the standard deviation and the variance.

本発明の態様4に係る画像処理装置(画像処理部125)は、上記態様1から3において、前記比較部(エッジ判定部223)が、前記ノイズ量と、予め定めた判定パラメータとを加えた値を、前記閾値として用いる。 In the image processing device (image processing section 125) according to aspect 4 of the present invention, in the above aspects 1 to 3, the comparison section (edge determination section 223) adds the noise amount and a predetermined determination parameter. value is used as the threshold value.

上記の構成によれば、エッジ部分であるか否かを精度よく判別することができる。 According to the above configuration, it is possible to accurately determine whether or not it is an edge portion.

本発明の態様5に係る画像処理装置(画像処理部125)は、上記態様1から4において、前記色補間部230が、前記注目画素が赤(R)または青(B)画素である場合に、前記(i)の色補間として、当該注目画素の緑(G)画素データの対角線方向の色補間をおこない、前記(ii)の色補間として、前記近傍画素内の全ての緑(G)画素を使用した平均値フィルタを用いて当該注目画素の緑(G)画素データの色補間をおこなう。 In the image processing device (image processing section 125) according to aspect 5 of the present invention, in the above aspects 1 to 4, when the color interpolation section 230 is a red (R) or blue (B) pixel, As the color interpolation in (i), diagonal color interpolation is performed on the green (G) pixel data of the pixel of interest, and as the color interpolation in (ii), all green (G) pixels in the neighboring pixels are Color interpolation of the green (G) pixel data of the pixel of interest is performed using an average value filter using the .

本発明の態様6に係る撮像装置1は、上記態様1から5の画像処理装置(画像処理部125)と、ベイヤ配列を有したカラーフィルタを有した撮像素子107とを備えている。 The imaging device 1 according to the sixth aspect of the present invention includes the image processing device (image processing unit 125) according to the first to fifth aspects described above, and an imaging element 107 having a color filter having a Bayer array.

本発明の態様7に係る画像処理方法は、ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化した方向性データを用いて、エッジ方向を検出する方向検出ステップと、前記方向間で前記方向性データに差が有るか否かを判定する判定ステップと、前記近傍画素のノイズ量を算出するノイズ量算出ステップと、前記差が有ると判定された前記方向性データの最大値と、前記ノイズ量を含む閾値とを比較する比較ステップと、前記比較ステップの比較結果に応じて、(i)前記最大値が前記閾値より大きい場合は前記注目画素に対して前記エッジ方向を用いた色補間をおこない、(ii)前記最大値が前記閾値以下である場合は前記注目画素に対して前記(i)の色補間とは異なる色補間をおこなう色補間ステップと、を含む。 An image processing method according to aspect 7 of the present invention detects an edge direction using directionality data obtained by quantifying the directionality of an edge in a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions. a detection step, a determination step of determining whether or not there is a difference in the directional data between the directions, a noise amount calculation step of calculating a noise amount of the neighboring pixels, and a noise amount calculation step of calculating the amount of noise of the neighboring pixels; a comparison step of comparing the maximum value of the directional data with a threshold value including the noise amount; and (i) if the maximum value is larger than the threshold value, the pixel of interest is (ii) if the maximum value is less than or equal to the threshold value, a color interpolation step that is different from the color interpolation in (i) is performed on the pixel of interest; ,including.

前記の構成によれば、従前よりも精度よく色補間処理をおこなうことが可能となる。 According to the above configuration, it is possible to perform color interpolation processing with higher precision than before.

具体的には、前記の構成によれば、判定ステップにおいて方向性データに基づいて差が有る(つまり、エッジ部分である)と判定した場合であっても、この判定の適否を、ノイズ量算出ステップおよび比較ステップによって確認する。例えばショットノイズ等が含まれている場合、方向性データに基づいた判定だけでは、平坦部分をエッジ部分と判定してしまう。しかしながら、前記確認をおこなうことにより、方向性データに基づいた判定でエッジ部分と判定している場合であっても、近傍画素のノイズ量を含む閾値以下であればエッジ部分とせず、その場合はエッジ方向を用いた色補間をおこなわない。エッジ方向を用いた色補間を、ショットノイズを含む平坦部分に適用してしまうと、ショットノイズが残ったまま色補間がおこなわれるため、望ましくない。よって、本態様6のようにノイズ量を算出して、そのノイズ量を含む閾値との比較結果に応じた色補間をおこなうことにより、精度よく色補間をおこない、高画質の画像データを生成することに寄与することができる。 Specifically, according to the above configuration, even if it is determined in the determination step that there is a difference based on the directional data (that is, it is an edge portion), the appropriateness of this determination is determined based on the noise amount calculation. Confirm by step and comparison step. For example, if shot noise or the like is included, a flat portion will be determined to be an edge portion if only the determination is based on directional data. However, by performing the above confirmation, even if it is determined to be an edge part based on the directional data, if it is less than a threshold that includes the noise amount of neighboring pixels, it will not be considered an edge part, and in that case, Color interpolation using edge direction is not performed. If color interpolation using the edge direction is applied to a flat portion that includes shot noise, color interpolation will be performed with shot noise remaining, which is not desirable. Therefore, as in this aspect 6, by calculating the noise amount and performing color interpolation according to the comparison result with a threshold value that includes the noise amount, color interpolation is performed with high accuracy and high-quality image data is generated. can contribute to this.

また、本発明の一態様に係る画像処理装置(画像処理部125)は、コンピュータによって実現してもよく、この場合には、コンピュータを上記画像処理装置が備える各部(ソフトウェア要素)として動作させることにより上記画像処理装置をコンピュータにて実現させるが画像処理装置の画像処理プログラム、およびそれを記録したコンピュータ読み取り可能な記録媒体も、本発明の範疇に入る。 Further, the image processing device (image processing unit 125) according to one aspect of the present invention may be realized by a computer, and in this case, the computer may be operated as each unit (software element) included in the image processing device. Although the image processing apparatus described above is realized by a computer, an image processing program for the image processing apparatus and a computer-readable recording medium on which the program is recorded also fall within the scope of the present invention.

本発明は上述した実施形態に限定されるものではなく、請求項に示した範囲で種々の変更が可能である。 The present invention is not limited to the embodiments described above, and various modifications can be made within the scope of the claims.

1 撮像装置
107 撮像素子
120 制御部
121 CPU
124 撮像素子駆動部
125 画像処理部(画像処理装置)
210 エッジ予備決定部
211 方向性データ算出部
212 方向検出部
220 エッジ決定部
221 仮判定部(判定部)
222 ノイズ量算出部
223 エッジ判定部(比較部)
230 色補間部
1 Imaging device 107 Imaging element 120 Control unit 121 CPU
124 Image sensor drive section 125 Image processing section (image processing device)
210 Edge preliminary determination unit 211 Directionality data calculation unit 212 Direction detection unit 220 Edge determination unit 221 Temporary determination unit (determination unit)
222 Noise amount calculation unit 223 Edge determination unit (comparison unit)
230 Color interpolation section

Claims (8)

ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化した方向性データを用いて、エッジ方向を検出する方向検出部と、
前記複数の方向毎に定量化した複数の前記方向性データの間で差が有るか否かを判定する判定部と、
前記近傍画素のノイズ量を算出するノイズ量算出部と、
前記差が有ると判定された前記方向性データの最大値と、前記ノイズ量を含む閾値とを比較する比較部と、
前記比較部の比較結果に応じて、(i)前記最大値が前記閾値より大きい場合は前記注目画素に対して前記エッジ方向を用いた色補間をおこない、(ii)前記最大値が前記閾値以下である場合は前記注目画素に対して前記(i)の色補間とは異なる色補間をおこなう色補間部と、
を備え
前記色補間部は、前記注目画素が赤(R)または青(B)画素である場合に、前記(i)の色補間として、当該注目画素の緑(G)画素データの対角線方向の色補間をおこない、前記(ii)の色補間として、前記近傍画素内の全ての緑(G)画素を使用した平均値フィルタを用いて当該注目画素の緑(G)画素データの色補間をおこなう、画像処理装置。
a direction detection unit that detects an edge direction using directionality data that quantifies the directionality of edges at a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions;
a determination unit that determines whether there is a difference between the plurality of directional data quantified for each of the plurality of directions;
a noise amount calculation unit that calculates the noise amount of the neighboring pixels;
a comparison unit that compares the maximum value of the directional data determined to have the difference with a threshold value including the noise amount;
Depending on the comparison result of the comparison unit, (i) if the maximum value is greater than the threshold, color interpolation is performed on the pixel of interest using the edge direction; (ii) if the maximum value is less than or equal to the threshold; If so, a color interpolation unit that performs color interpolation different from the color interpolation in (i) for the pixel of interest;
Equipped with
When the pixel of interest is a red (R) or blue (B) pixel, the color interpolation unit performs diagonal color interpolation of green (G) pixel data of the pixel of interest as the color interpolation of (i). As the color interpolation in (ii) above, color interpolation of the green (G) pixel data of the pixel of interest is performed using an average value filter using all the green (G) pixels in the neighboring pixels. Processing equipment.
前記ノイズ量算出部は、前記複数の方向毎に定量化した複数の前記方向性データの間で差が有ると判定された場合の最小値を示す方向性データに対応する方向に沿って、前記近傍画素のノイズ量を算出する、請求項1に記載の画像処理装置。 The noise amount calculation unit calculates the amount of noise along a direction corresponding to directional data indicating a minimum value when it is determined that there is a difference between the plurality of directional data quantified for each of the plurality of directions. The image processing device according to claim 1, which calculates the amount of noise of neighboring pixels. 前記ノイズ量算出部は、前記複数の方向毎に定量化した複数の前記方向性データの間で差が有ると判定された場合の最小値を示す方向性データに対応する方向の前記ノイズ量を、前記注目画素および近傍画素の輝度値の平均偏差によって算出する、請求項1または2に記載の画像処理装置。 The noise amount calculation unit calculates the amount of noise in a direction corresponding to directional data that indicates a minimum value when it is determined that there is a difference between the plurality of directional data quantified for each of the plurality of directions. , the image processing apparatus according to claim 1 , wherein the image processing device calculates the calculation based on an average deviation of luminance values of the pixel of interest and neighboring pixels. 前記比較部は、前記ノイズ量と、予め定めた判定パラメータとを加えた値を、前記閾値として用いる、請求項1から3の何れか1項に記載の画像処理装置。 The image processing device according to claim 1 , wherein the comparison unit uses a value obtained by adding the noise amount and a predetermined determination parameter as the threshold value. 請求項1からの何れか1項に記載の画像処理装置と、
ベイヤ配列を有したカラーフィルタを有した撮像素子と、
を備えている撮像装置。
An image processing device according to any one of claims 1 to 4 ,
an image sensor having a color filter having a Bayer array;
An imaging device equipped with
ベイヤ配列の画像データの注目画素および近傍画素におけるエッジの方向性を複数の方向毎に定量化した方向性データを用いて、エッジ方向を検出する方向検出ステップと、
前記複数の方向毎に定量化した複数の前記方向性データの間で差が有るか否かを判定する判定ステップと、
前記近傍画素のノイズ量を算出するノイズ量算出ステップと、
前記差が有ると判定された前記方向性データの最大値と、前記ノイズ量を含む閾値とを比較する比較ステップと、
前記比較ステップの比較結果に応じて、(i)前記最大値が前記閾値より大きい場合は前記注目画素に対して前記エッジ方向を用いた色補間をおこない、(ii)前記最大値が前記閾値以下である場合は前記注目画素に対して前記(i)の色補間とは異なる色補間をおこなう色補間ステップと、
を含み、
前記色補間ステップでは、前記注目画素が赤(R)または青(B)画素である場合に、前記(i)の色補間として、当該注目画素の緑(G)画素データの対角線方向の色補間をおこない、前記(ii)の色補間として、前記近傍画素内の全ての緑(G)画素を使用した平均値フィルタを用いて当該注目画素の緑(G)画素データの色補間をおこなう、画像処理方法。
a direction detection step of detecting an edge direction using directionality data obtained by quantifying the directionality of edges at a pixel of interest and neighboring pixels of Bayer array image data for each of a plurality of directions;
a determination step of determining whether there is a difference between the plurality of directional data quantified for each of the plurality of directions;
a noise amount calculation step of calculating the noise amount of the neighboring pixels;
a comparison step of comparing the maximum value of the directional data determined to have the difference with a threshold value including the noise amount;
Depending on the comparison result of the comparison step, (i) if the maximum value is greater than the threshold, color interpolation is performed on the pixel of interest using the edge direction; (ii) if the maximum value is less than or equal to the threshold; If so, a color interpolation step of performing color interpolation different from the color interpolation of (i) on the pixel of interest;
including;
In the color interpolation step, when the pixel of interest is a red (R) or blue (B) pixel, as the color interpolation of (i), color interpolation is performed in a diagonal direction of green (G) pixel data of the pixel of interest. As the color interpolation in (ii) above, color interpolation of the green (G) pixel data of the pixel of interest is performed using an average value filter using all the green (G) pixels in the neighboring pixels. Processing method.
請求項1からの何れか1項に記載の画像処理装置としてコンピュータを機能させるための画像処理プログラムであって、前記方向検出部、前記判定部、前記ノイズ量算出部、前記比較部および上記色補間部としてコンピュータを機能させるための画像処理プログラム。 5. An image processing program for causing a computer to function as the image processing apparatus according to claim 1, comprising: the direction detecting section, the determining section, the noise amount calculating section, the comparing section, and the above. An image processing program that allows a computer to function as a color interpolator. 請求項に記載の画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体。 A computer-readable recording medium on which the image processing program according to claim 7 is recorded.
JP2019218226A 2019-12-02 2019-12-02 Image processing device, image processing method, and imaging device Active JP7387411B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019218226A JP7387411B2 (en) 2019-12-02 2019-12-02 Image processing device, image processing method, and imaging device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019218226A JP7387411B2 (en) 2019-12-02 2019-12-02 Image processing device, image processing method, and imaging device

Publications (2)

Publication Number Publication Date
JP2021090104A JP2021090104A (en) 2021-06-10
JP7387411B2 true JP7387411B2 (en) 2023-11-28

Family

ID=76220476

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019218226A Active JP7387411B2 (en) 2019-12-02 2019-12-02 Image processing device, image processing method, and imaging device

Country Status (1)

Country Link
JP (1) JP7387411B2 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005295244A (en) 2004-03-31 2005-10-20 Sharp Corp Image processor, image processing method, image processing program and storage medium with image processing program stored
JP2011217001A (en) 2010-03-31 2011-10-27 Victor Co Of Japan Ltd Filter device, and filtering method
JP2015139141A (en) 2014-01-23 2015-07-30 キヤノン株式会社 image processing apparatus, image processing method and program
JP2017157999A (en) 2016-03-01 2017-09-07 キヤノン株式会社 Imaging apparatus, imaging system, and image processing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005295244A (en) 2004-03-31 2005-10-20 Sharp Corp Image processor, image processing method, image processing program and storage medium with image processing program stored
JP2011217001A (en) 2010-03-31 2011-10-27 Victor Co Of Japan Ltd Filter device, and filtering method
JP2015139141A (en) 2014-01-23 2015-07-30 キヤノン株式会社 image processing apparatus, image processing method and program
JP2017157999A (en) 2016-03-01 2017-09-07 キヤノン株式会社 Imaging apparatus, imaging system, and image processing method

Also Published As

Publication number Publication date
JP2021090104A (en) 2021-06-10

Similar Documents

Publication Publication Date Title
JP5493010B2 (en) Imaging apparatus and focus position detection method thereof
JP5616442B2 (en) Imaging apparatus and image processing method
EP1528793B1 (en) Image processing apparatus, image-taking system and image processing method
JP4210021B2 (en) Image signal processing apparatus and image signal processing method
JP5493011B2 (en) Imaging apparatus and focus position detection method thereof
CN104025574B (en) Camera head and image processing method
JP2013527483A (en) Autofocus image system
JP2006121612A (en) Image pickup device
JP5223686B2 (en) Imaging apparatus and imaging method
KR20180016385A (en) Dynamic frame skipping for automatic white balance
JP5615756B2 (en) Imaging apparatus and imaging program
JP5378283B2 (en) Imaging apparatus and control method thereof
JP3839429B2 (en) Imaging processing device
JP5948997B2 (en) Imaging apparatus and imaging method
JP7387411B2 (en) Image processing device, image processing method, and imaging device
JP4718113B2 (en) White balance adjustment method and image processing apparatus
JP6482247B2 (en) FOCUS ADJUSTMENT DEVICE, IMAGING DEVICE, FOCUS ADJUSTMENT DEVICE CONTROL METHOD, AND PROGRAM
JP2001251636A (en) Solid-state image pickup device and method for detecting pixel defect
EP4002830B1 (en) Image pick up apparatus, image pick up method, and storage medium
JP2007036438A (en) Color discrimination method and device of imaging apparatus, and exposure control method of imaging apparatus
TW201634999A (en) Auto focus method and apparatus using the same method
JP2006253970A (en) Imaging apparatus, shading correction data generating method, and program
JP5943682B2 (en) Imaging apparatus, control method thereof, and program
JP2011253099A (en) Focus detector
JP2005051773A (en) Method for eliminating color edge and apparatus thereof

Legal Events

Date Code Title Description
A625 Written request for application examination (by other person)

Free format text: JAPANESE INTERMEDIATE CODE: A625

Effective date: 20220921

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20230712

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230725

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230829

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20231107

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20231115

R150 Certificate of patent or registration of utility model

Ref document number: 7387411

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150