JP2010283888A - Image processing apparatus, and image processing program - Google Patents

Image processing apparatus, and image processing program Download PDF

Info

Publication number
JP2010283888A
JP2010283888A JP2010200988A JP2010200988A JP2010283888A JP 2010283888 A JP2010283888 A JP 2010283888A JP 2010200988 A JP2010200988 A JP 2010200988A JP 2010200988 A JP2010200988 A JP 2010200988A JP 2010283888 A JP2010283888 A JP 2010283888A
Authority
JP
Japan
Prior art keywords
pixel
circuit
image
color component
image processing
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.)
Granted
Application number
JP2010200988A
Other languages
Japanese (ja)
Other versions
JP5153842B2 (en
Inventor
Taketo Tsukioka
健人 月岡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Olympus Corp
Original Assignee
Olympus Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Olympus Corp filed Critical Olympus Corp
Priority to JP2010200988A priority Critical patent/JP5153842B2/en
Publication of JP2010283888A publication Critical patent/JP2010283888A/en
Application granted granted Critical
Publication of JP5153842B2 publication Critical patent/JP5153842B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)
  • Color Television Image Signal Generators (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processing apparatus or the like which reduces the effect of variations in sensitivity among pixels so as to produce a three-chip image with high accuracy. <P>SOLUTION: This invention relates to the image processing apparatus applied to a digital camera 21. The image processing apparatus includes: a Bayer array CCD 3 for capturing an optical image formed by an optical system and creating and outputting an image lacking one or more color components for each pixel; a Green level difference detection circuit 22 for determining, for a designated type of color component in the predetermined vicinity of a pixel of interest for an image outputted from the CCD 3 through a single-chip image buffer 4, the magnitude of a sensitivity difference between pixels, in which the color component is obtained; and a Green interpolation circuit 23 and a Red and Blue interpolation circuit 27, for performing processing for interpolating the color component missing in the pixel of interest, capable of changing processing contents in accordance with a result of the determination due to the Green level difference detection circuit 22 when performing processing. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、単板撮像系、二板撮像系、または三板画素ずらし撮像系から出力された画像を処理して、画素毎に3色成分値をもつカラーデジタル画像を生成する画像処理装置、画像処理プログラムに関する。   The present invention relates to an image processing device that processes an image output from a single-plate image pickup system, a two-plate image pickup system, or a three-plate pixel shift image pickup system, and generates a color digital image having three color component values for each pixel. It relates to a processing program.

デジタルカメラ等において多く使用されている単板撮像系は、画素毎に異なる色フィルタを装着した単板撮像素子を用いたものであり、撮像素子からの出力画像は、各画素について一種類の色成分値しかもっていない。従って、カラーデジタル画像を生成するためには、各画素において欠落している色成分値を補う補間処理を行うことが必要となる。このような欠落している色成分値を補う補間処理が必要となるのは、二板撮像系や三板画素ずらし撮像系を用いた装置の場合にも同様である。   A single-plate image pickup system that is often used in digital cameras, etc. uses a single-plate image pickup device equipped with a different color filter for each pixel, and an output image from the image pickup device has one kind of color for each pixel. It has only component values. Therefore, in order to generate a color digital image, it is necessary to perform an interpolation process to compensate for missing color component values in each pixel. The interpolation processing for compensating for such missing color component values is also necessary in the case of a device using a two-plate imaging system or a three-plate pixel shifting imaging system.

この補間処理は、工夫しないと、最終的に得られるカラー画像にぼけや偽色などの劣化が生じることがある。そのために、従来より種々の方法による補間処理が提案されており、大別すると、エッジ検出の方法に基づくものと、色相関の方法に基づくものと、に分類される。   If this interpolation process is not devised, the color image finally obtained may be deteriorated such as blur or false color. For this reason, interpolation processing by various methods has been proposed in the past, and can be roughly classified into those based on the edge detection method and those based on the color correlation method.

エッジ検出に基づく技術としては、例えば特開平8−298669号公報に記載のものが挙げられる。該公報に記載の技術について、図32を参照して説明する。図32は、エッジ検出に基づく従来の補間処理を説明するための図である。   As a technique based on edge detection, for example, a technique described in JP-A-8-298669 can be cited. The technique described in this publication will be described with reference to FIG. FIG. 32 is a diagram for explaining a conventional interpolation process based on edge detection.

単板撮像素子が、例えば図32(A)に示すような3原色ベイヤー(Bayer)配列の色フィルタを備えた単板ベイヤー配列撮像素子であるとする。このとき、図32(B)に示すように、注目画素であるB5の周囲に縦方向および横方向に沿った十字状の近傍をとって、該注目画素に対する水平方向のGに対する補間値Ghと、垂直方向のGに対する補間値Gvと、を次の数式1に示すように推定する。
[数1]
Gh=(G4+G6)/2+(2×B5−B3−B7)/4
Gv=(G2+G8)/2+(2×B5−B1−B9)/4
次に、水平方向と垂直方向との何れの方向に段差が多いかを示す評価値dH,dVを、次の数式2に示すように、
[数2]
dH=|G4−G6|+|B3−2×B5+B7|
dV=|G2−G8|+|B1−2×B5+B9|
と計算する。ここに、記号|x|は、xの絶対値を表している。こうして計算した評価値dH,dVの内の、値が小さくより平坦であると判断された方向の補間値Ghまたは補間値Gvを用いるようになっている。
Assume that the single-plate image pickup device is a single-plate Bayer array image pickup device including color filters of a three-primary-color Bayer array as shown in FIG. At this time, as shown in FIG. 32B, an interpolation value Gh for G in the horizontal direction with respect to the target pixel is obtained by taking a cross-shaped neighborhood along the vertical and horizontal directions around B5 as the target pixel. The interpolation value Gv for G in the vertical direction is estimated as shown in the following equation 1.
[Equation 1]
Gh = (G4 + G6) / 2 + (2 × B5-B3-B7) / 4
Gv = (G2 + G8) / 2 + (2 × B5-B1-B9) / 4
Next, evaluation values dH and dV indicating whether there are many steps in the horizontal direction or the vertical direction are expressed by the following Equation 2,
[Equation 2]
dH = | G4-G6 | + | B3-2 × B5 + B7 |
dV = | G2-G8 | + | B1-2 × B5 + B9 |
And calculate. Here, the symbol | x | represents the absolute value of x. Of the evaluation values dH and dV calculated in this way, the interpolation value Gh or the interpolation value Gv in the direction in which the value is determined to be smaller and flatter is used.

一方、色相関に基づく技術としては、例えば特開平11−215512号公報に記載のものが挙げられる。この公報に記載の技術について、図33を参照して説明する。図33は、色相関に基づく従来の補間処理を説明するための図である。   On the other hand, as a technique based on color correlation, for example, a technique described in JP-A-11-215512 can be cited. The technique described in this publication will be described with reference to FIG. FIG. 33 is a diagram for explaining a conventional interpolation process based on color correlation.

図33に示すように、まず、注目画素Xの付近で、撮像素子に構成された色フィルタの色成分(例えば、原色系の色フィルタである場合にはr,g,b)の内の何れか2種類の色成分p,qの各成分値Vp ,Vq 同士の間に、係数αqp,βqpを用いて表現される次の数式3、
[数3]
Vq =αqp×Vp +βqp
のような直線的な相関関係が成立すると仮定する。ここに、撮像素子に構成された色フィルタが例えば原色系の色フィルタである場合には、p,qはr,g,bの何れかである。また、色成分p,qに各々対応する成分値Vp ,Vq は、注目画素Xの近傍の画素における値である。
As shown in FIG. 33, first, in the vicinity of the target pixel X, any one of the color components of the color filter configured in the image sensor (for example, r, g, b in the case of a primary color filter). The following Equation 3 expressed using coefficients αqp and βqp between the component values Vp and Vq of the two color components p and q,
[Equation 3]
Vq = αqp × Vp + βqp
It is assumed that a linear correlation such as Here, when the color filter configured in the image sensor is, for example, a primary color filter, p and q are any of r, g, and b. The component values Vp and Vq corresponding to the color components p and q are values in pixels near the target pixel X, respectively.

そして、注目画素Xの周囲に設定した近傍Uにおいて、該近傍U内の画素を、得られている色成分r,g,bの種類により分類して3つの部分集合Ur,Ug,Ubを形成し、上記係数αqp,βqpを、各部分集合における画素値の平均Ac(ここに、cはr,g,bの何れか)と標準偏差Sc(ここに、cはr,g,bの何れか)とに基づいて、次の数式4により推定する。
[数4]
αqp=Sq /Sp , βqp=Aq −αqpAp
これは、色成分pの分布幅(標準偏差Sp )に対する色成分qの分布幅(標準偏差Sq )の比が、上記数式3に示した直線的な相関関係の傾きαqpを与え、さらに求められた傾きαqpの直線は、色成分pの平均値Ap と色成分qの平均値Aq とでプロットされる点を通るという考えに基づくものである。
Then, in the neighborhood U set around the pixel of interest X, the pixels in the neighborhood U are classified according to the types of the obtained color components r, g, b to form three subsets Ur, Ug, Ub. Then, the coefficients αqp and βqp are obtained by calculating the average Ac of pixel values in each subset (here, c is r, g, or b) and the standard deviation Sc (here, c is any of r, g, or b). ) Based on the following equation (4).
[Equation 4]
αqp = Sq / Sp, βqp = Aq−αqpAp
The ratio of the distribution width (standard deviation Sq) of the color component q to the distribution width (standard deviation Sp) of the color component p gives the linear correlation slope αqp shown in Equation 3 above. The straight line with the inclination αqp is based on the idea that it passes through the points plotted by the average value Ap of the color component p and the average value Aq of the color component q.

そして、推定したαqp,βqpに基づき、注目画素Xにおいて欠落している色成分mの値Xm を、該注目画素Xにおいて得られている色成分eの値Xe から、次の数式5に示すようにして求める。
[数5]
Xm =αme×Xe +βme
ここに、m,eは、それぞれr,g,bの何れかをとる。
Then, based on the estimated αqp and βqp, the value Xm of the missing color component m in the target pixel X is expressed by the following equation 5 from the value Xe of the color component e obtained in the target pixel X. Ask for it.
[Equation 5]
Xm = αme × Xe + βme
Here, m and e are either r, g, or b, respectively.

このように、色相関に基づく従来技術は、注目画素の近傍における異なる色成分間の画素値の相関を推定することを特徴としている。
特開平8−298669号公報 特開平11−215512号公報
Thus, the prior art based on color correlation is characterized by estimating the correlation of pixel values between different color components in the vicinity of the pixel of interest.
JP-A-8-298669 JP-A-11-215512

ところで、実際の撮像系では、ライン間でゲインの差が生じたり、同じ色フィルタを有する画素同士であってもフィルタの分光特性が微妙に異なっていたりすることがあるために、同じ色成分が得られるはずの画素間に感度ばらつきが生じることがある。   By the way, in an actual imaging system, there is a difference in gain between lines, or even the pixels having the same color filter may have slightly different spectral characteristics of the filters. Sensitivity variation may occur between pixels that should be obtained.

しかし、上述した従来技術は、何れも、注目画素で得られている色成分自体を特に補正することなくそのまま補間処理の結果として用いているために、注目画素において欠落する色成分を求める際にも、注目画素自体の情報が結果にそのまま反映される特性となっている。通常は、各画素で元々得られている色成分の情報を、変更することなくそのまま補間処理の結果に使う方が効率が良いのであるが、同じ色成分が得られる画素で感度が異なっている場合には、このような処理を行うと、画素間の感度ばらつきがそのまま補間処理の結果に反映されてしまうことになり、うっすらと格子縞が見えるなどの副作用が生じていた。   However, all of the above-described conventional techniques use the color component itself obtained at the target pixel as it is as a result of the interpolation process without any correction. However, the information of the target pixel itself is reflected in the result as it is. Normally, it is more efficient to use the color component information originally obtained for each pixel as it is for the result of the interpolation process without change, but the sensitivity is different for pixels that can obtain the same color component. In such a case, when such a process is performed, the sensitivity variation between pixels is reflected in the result of the interpolation process as it is, and there is a side effect such as a slight check of the grid pattern.

本発明は上記事情に鑑みてなされたものであり、画素間の感度にばらつきがあったとしてもその影響を低減して高精度な補間処理を行い得る画像処理装置、画像処理プログラムを提供することを目的としている。   The present invention has been made in view of the above circumstances, and provides an image processing apparatus and an image processing program capable of performing high-precision interpolation processing while reducing the influence even when the sensitivity between pixels varies. It is an object.

上記の目的を達成するために、第1の発明による画像処理装置は、単板撮像系、二板撮像系、または三板画素ずらし撮像系によって光学像を撮像することにより得られた各画素につき1種類以上の色成分が欠落している画像を処理する画像処理装置であって、注目画素の所定の近傍において指定された種類の色成分に対し当該色成分が得られている画素の間の感度差の大小を判定する判定手段と、上記注目画素において欠落する色成分を補う処理を行うものであって該処理を行う際に上記判定手段による判定結果に応じて処理内容を変更可能な補間手段と、を具備したものである。   In order to achieve the above object, an image processing apparatus according to a first aspect of the present invention is one for each pixel obtained by capturing an optical image with a single-plate imaging system, a two-plate imaging system, or a three-plate pixel shifting imaging system. An image processing apparatus that processes an image in which more than one type of color component is missing, and the sensitivity between pixels for which the color component is obtained for a specified type of color component in a predetermined vicinity of the pixel of interest Determining means for determining the magnitude of the difference, and interpolating means for performing processing to compensate for missing color components in the pixel of interest and capable of changing the processing content according to the determination result by the determining means when performing the processing And.

さらに、第2の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記補間手段が、上記注目画素で得られている色成分に対して、上記近傍内で当該色成分が得られている画素の中から基準画素を定め、上記注目画素の当該色成分に対する感度を上記基準画素の当該色成分に対する感度に合わせた場合に上記注目画素がとるはずの当該色成分の画素値を補正値として計算し、上記判定手段により判定された感度差の大小に応じて、上記注目画素の当該色成分の画素値を、上記補正値に変更するものである。   Furthermore, in the image processing device according to the second invention, in the image processing device according to the first invention, the interpolation means causes the color component to be within the vicinity of the color component obtained at the pixel of interest. A pixel value of the color component that the target pixel should take when a reference pixel is determined from the obtained pixels and the sensitivity of the target pixel to the color component is matched with the sensitivity of the reference pixel to the color component Is calculated as a correction value, and the pixel value of the color component of the target pixel is changed to the correction value according to the magnitude of the sensitivity difference determined by the determination means.

第3の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記補間手段が、上記所定の近傍内の画素値を重み付け平均する重付平均手段を有して構成されており、該重付平均手段は、上記判定手段の判定結果に応じて重みを変更し重み付け平均により注目画素の画素値を算出するものである。   An image processing apparatus according to a third invention is the image processing apparatus according to the first invention, wherein the interpolation means includes weighted average means for weighted average of the pixel values in the predetermined neighborhood. The weighted average means changes the weight according to the determination result of the determination means and calculates the pixel value of the target pixel by weighted average.

第4の発明による画像処理装置は、上記第3の発明による画像処理装置において、上記重付平均手段が、上記重みを、上記判定手段において感度差が大きいと判定された種類の色成分が得られている画素に対して小さくなるように変更するものである。   An image processing apparatus according to a fourth invention is the image processing apparatus according to the third invention, wherein the weighted averaging means obtains the weight and the type of color component determined to have a large sensitivity difference by the determination means. The pixel is changed so as to be smaller with respect to the pixel being set.

第5の発明による画像処理装置は、上記第3の発明による画像処理装置において、上記重付平均手段が、上記重みを、上記近傍内で同種の色成分が得られている画素間の画素値差分の関数式として計算するものであって、上記判定手段により特定の色成分に対して感度差が大きいと判定された場合には、該関数式を、当該色成分に関する上記画素値差分の影響が小さくなるように変更するものである。   An image processing apparatus according to a fifth invention is the image processing apparatus according to the third invention, wherein the weighted averaging means uses the weights and pixel values between pixels in which the same kind of color components are obtained in the vicinity. When the determination means determines that the sensitivity difference is large with respect to a specific color component, the function expression is calculated as an effect of the pixel value difference related to the color component. Is changed so as to be smaller.

第6の発明による画像処理装置は、上記第3の発明による画像処理装置において、上記重付平均手段が、上記判定手段において感度差があると判定された種類の色成分が得られている画素に対して、上記重みが当該画素間で均等に近付くように変更するものである。   An image processing apparatus according to a sixth aspect of the present invention is the image processing apparatus according to the third aspect, wherein the weighted average means obtains the type of color component determined to have a sensitivity difference in the determination means. On the other hand, the weight is changed so as to approach the pixels equally.

第7の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記判定手段が、上記注目画素の所定の近傍内の画素値から所定の特徴量を計算する特徴量計算手段を有して構成されており、該特徴量の大小に基づいて上記感度差の大小を判定するものである。   An image processing apparatus according to a seventh aspect is the image processing apparatus according to the first aspect, wherein the determination means includes a feature quantity calculation means for calculating a predetermined feature quantity from a pixel value within a predetermined vicinity of the target pixel. And the magnitude of the sensitivity difference is determined based on the magnitude of the feature amount.

第8の発明による画像処理装置は、上記第7の発明による画像処理装置において、上記判定手段が、指定された色成分に関する上記特徴量と上記感度差の量とを対応付けたテーブルをさらに有して構成されており、該特徴量から該テーブルを参照することにより上記感度差の大小を判定するものである。   An image processing apparatus according to an eighth invention is the image processing apparatus according to the seventh invention, wherein the determination means further has a table in which the feature amount related to the designated color component is associated with the amount of the sensitivity difference. The size of the sensitivity difference is determined by referring to the table from the feature amount.

第9の発明による画像処理装置は、上記第7または第8の発明による画像処理装置において、上記判定手段が、上記近傍内において、指定された色成分が得られている画素を所定の方法で分類し、各分類における画素値の平均値と変動量とに基づき、上記特徴量を計算するものである。   An image processing apparatus according to a ninth invention is the image processing apparatus according to the seventh or eighth invention, wherein the determination means uses a predetermined method to identify pixels in which the designated color component is obtained within the vicinity. Classification is performed, and the feature amount is calculated based on the average value and the variation amount of the pixel value in each classification.

第10の発明による画像処理装置は、上記第7または第8の発明による画像処理装置において、上記判定手段が、上記近傍内において、指定された色成分が得られている画素の画素値の平均値と、指定された色成分と異なる所定の色成分が得られている画素の画素値の平均値と、に基づいて、上記特徴量を計算するものである。   An image processing device according to a tenth invention is the image processing device according to the seventh or eighth invention, wherein the determination means is an average of pixel values of pixels for which a designated color component is obtained in the vicinity. The feature amount is calculated based on the value and the average value of pixel values of pixels from which a predetermined color component different from the designated color component is obtained.

第11の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記補間手段が、上記撮像系により得られる画像サイズを所定の縮小率で縮小したカラー画像を生成し得るように構成されたものであり、上記判定手段は、該補間手段が縮小したカラー画像を生成する際には、該縮小率が所定の閾値以下である場合に、感度差の判定を行わないものである。   An image processing apparatus according to an eleventh aspect of the invention is the image processing apparatus according to the first aspect of the invention, wherein the interpolation means can generate a color image obtained by reducing the image size obtained by the imaging system at a predetermined reduction rate. The determination means does not perform sensitivity difference determination when the reduction ratio is equal to or less than a predetermined threshold when the interpolation means generates a reduced color image. .

第12の発明による画像処理プログラムは、コンピュータに、単板撮像系、二板撮像系、または三板画素ずらし撮像系によって光学像を撮像することにより得られた各画素につき1種類以上の色成分が欠落している画像を処理させるための画像処理プログラムであって、該コンピュータを、注目画素の所定の近傍において指定された種類の色成分に対し当該色成分が得られている画素の間の感度差の大小を判定する判定手段、上記注目画素において欠落する色成分を補う処理を行うものであって該処理を行う際に上記判定手段による判定結果に応じて処理内容を変更可能な補間手段、として機能させるための画像処理プログラムである。   An image processing program according to a twelfth aspect of the invention includes a computer having at least one color component for each pixel obtained by capturing an optical image with a single-plate imaging system, a two-plate imaging system, or a three-plate pixel shifting imaging system. An image processing program for processing a missing image, wherein the computer detects sensitivity between pixels for which the color component is obtained with respect to a specified type of color component in a predetermined vicinity of the pixel of interest. A determination unit for determining the magnitude of the difference, an interpolation unit for performing a process of compensating for a missing color component in the target pixel, and capable of changing a processing content according to a determination result by the determination unit when performing the process; Is an image processing program for functioning as

本発明の画像処理装置、画像処理プログラムによれば、画素間の感度にばらつきがあったとしてもその影響を低減して高精度な補間処理を行うことが可能となる。   According to the image processing apparatus and the image processing program of the present invention, even if there is variation in sensitivity between pixels, it is possible to reduce the influence and perform highly accurate interpolation processing.

本発明の実施例1におけるデジタルカメラの構成を示すブロック図。1 is a block diagram showing a configuration of a digital camera in Embodiment 1 of the present invention. 本発明の実施例2におけるデジタルカメラの構成を示すブロック図。FIG. 5 is a block diagram showing a configuration of a digital camera in Embodiment 2 of the present invention. 上記実施例2におけるG段差検出回路の処理を示すフローチャート。7 is a flowchart showing processing of a G level difference detection circuit in the second embodiment. 上記実施例2におけるG段差検出回路およびG補間回路における画素の分類を示す図。The figure which shows the classification | category of the pixel in the G level | step difference detection circuit and G interpolation circuit in the said Example 2. FIG. 上記実施例2におけるG補間回路の処理を示すフローチャート。9 is a flowchart showing processing of a G interpolation circuit in the second embodiment. 上記図5に示したG補間回路の処理におけるステップS16の処理を説明するための図。The figure for demonstrating the process of step S16 in the process of the G interpolation circuit shown in the said FIG. 上記実施例2における重み計算回路による重み計算の方向を示す図。The figure which shows the direction of the weight calculation by the weight calculation circuit in the said Example 2. FIG. 上記実施例2におけるRB補間回路の処理を示すフローチャート。9 is a flowchart showing processing of an RB interpolation circuit in the second embodiment. 上記図8に示したRB補間回路の処理におけるステップS31の画素選択を説明するための図。The figure for demonstrating the pixel selection of step S31 in the process of the RB interpolation circuit shown in the said FIG. 上記実施例2において、コンピュータにより行われるソフト処理を示すフローチャート。7 is a flowchart illustrating software processing performed by a computer in the second embodiment. 上記実施例2において、コンピュータにより行われるG補間ソフト処理を示すフローチャート。9 is a flowchart showing G interpolation software processing performed by a computer in the second embodiment. 上記実施例2において、コンピュータにより行われるRB補間ソフト処理を示すフローチャート。9 is a flowchart showing RB interpolation software processing performed by a computer in the second embodiment. 本発明の実施例3におけるデジタルカメラの構成を示すブロック図。FIG. 9 is a block diagram illustrating a configuration of a digital camera according to Embodiment 3 of the present invention. 上記実施例3における補正回路により処理を行う際に用いる画素の番号を示す図。FIG. 10 is a diagram illustrating pixel numbers used when processing is performed by the correction circuit according to the third embodiment. 上記実施例3における補正回路の処理を示すフローチャート。10 is a flowchart showing processing of a correction circuit in the third embodiment. 上記実施例3において、コンピュータにより行われるソフト処理を示すフローチャート。7 is a flowchart illustrating software processing performed by a computer in the third embodiment. 本発明の実施例4におけるデジタルカメラの構成を示すブロック図。FIG. 6 is a block diagram illustrating a configuration of a digital camera according to Embodiment 4 of the present invention. 上記実施例4における段差補正回路の一構成例を示すブロック図。FIG. 6 is a block diagram illustrating a configuration example of a step correction circuit according to the fourth embodiment. 上記実施例4におけるG段差を説明するための図。The figure for demonstrating the G level | step difference in the said Example 4. FIG. 上記実施例4における段差補正回路の処理を示すフローチャート。10 is a flowchart showing processing of a level difference correction circuit according to the fourth embodiment. 上記実施例4の段差補正回路における処理を行う際の近傍の例を示す図。The figure which shows the example of the vicinity at the time of performing the process in the level | step difference correction circuit of the said Example 4. FIG. 上記実施例4において、補正量△を求めるための関数の例を示す線図。In the said Example 4, the diagram which shows the example of the function for calculating | requiring correction amount (DELTA). 上記実施例4における段差補正回路の他の構成例を示すブロック図。FIG. 6 is a block diagram showing another configuration example of the step correction circuit in the fourth embodiment. 上記実施例4において、組み合わせ平均計算回路により計算される組み合わせ平均を説明するための図。The figure for demonstrating the combination average calculated by the combination average calculation circuit in the said Example 4. FIG. 上記実施例4において、コンピュータにより行われるソフト処理を示すフローチャート。10 is a flowchart illustrating software processing performed by a computer in the fourth embodiment. 本発明の実施例5におけるデジタルカメラの構成を示すブロック図。FIG. 10 is a block diagram illustrating a configuration of a digital camera according to Embodiment 5 of the present invention. 上記実施例5における段差平滑化回路の一構成例を示すブロック図。The block diagram which shows one structural example of the level | step difference smoothing circuit in the said Example 5. FIG. 上記実施例5における段差平滑化回路の処理を示すフローチャート。10 is a flowchart showing processing of a step smoothing circuit in the fifth embodiment. 上記実施例5において、係数混合比αを算出するための関数の例を示す線図。In the said Example 5, the diagram which shows the example of the function for calculating coefficient mixture ratio (alpha). 上記実施例5の係数設定回路により設定されるフィルタ係数の周波数特性を説明するための図。FIG. 10 is a diagram for explaining frequency characteristics of filter coefficients set by the coefficient setting circuit according to the fifth embodiment. 上記実施例5における段差平滑化回路の他の構成例を示すブロック図。FIG. 10 is a block diagram illustrating another configuration example of the step smoothing circuit according to the fifth embodiment. エッジ検出に基づく従来の補間処理を説明するための図。The figure for demonstrating the conventional interpolation process based on edge detection. 色相関に基づく従来の補間処理を説明するための図。The figure for demonstrating the conventional interpolation process based on a color correlation.

以下、図面を参照して本発明の実施例を説明する。   Embodiments of the present invention will be described below with reference to the drawings.

図1は本発明の実施例1を示したものであり、デジタルカメラの構成を示すブロック図である。   FIG. 1 shows a first embodiment of the present invention and is a block diagram showing a configuration of a digital camera.

この実施例1は、本発明の画像処理装置をデジタルカメラに適用したものである。   In the first embodiment, the image processing apparatus of the present invention is applied to a digital camera.

デジタルカメラ1は、図1に示すように、光学系2と、単板ベイヤー配列CCD3と、単板画像バッファ4と、ライン補正回路5と、WB補正回路6と、補間回路7と、カラー画像バッファ8と、画質調整回路9と、記録回路10と、制御回路11と、を有して構成されている。   As shown in FIG. 1, the digital camera 1 includes an optical system 2, a single-plate Bayer array CCD 3, a single-plate image buffer 4, a line correction circuit 5, a WB correction circuit 6, an interpolation circuit 7, and a color image. A buffer 8, an image quality adjustment circuit 9, a recording circuit 10, and a control circuit 11 are included.

上記光学系2は、被写体光束を集光するためのものである。   The optical system 2 is for condensing the subject luminous flux.

上記単板ベイヤー配列CCD3は、この光学系2により結像される被写体像を光電変換して撮像信号を出力するものである。   The single-plate Bayer array CCD 3 photoelectrically converts a subject image formed by the optical system 2 and outputs an imaging signal.

上記単板画像バッファ4は、この単板ベイヤー配列CCD3から出力され図示しないA/D変換回路等によりデジタル化された画像データを一旦記憶するものである。   The single plate image buffer 4 temporarily stores image data output from the single plate Bayer array CCD 3 and digitized by an A / D conversion circuit (not shown).

上記ライン補正回路5は、この単板画像バッファ4内に記憶されている画像に対して、ライン間でのゲインの違いを補正する感度補正手段である。   The line correction circuit 5 is a sensitivity correction unit that corrects a difference in gain between lines for an image stored in the single-plate image buffer 4.

上記WB補正回路6は、このライン補正回路5から出力される画像データに、ホワイトバランス処理を行うものである。   The WB correction circuit 6 performs white balance processing on the image data output from the line correction circuit 5.

上記補間回路7は、このWB補正回路6から出力される単板画像データにおいて各画素で欠落している色成分を、近傍画素の情報から補間することにより、カラー画像データを生成する補間手段である。   The interpolating circuit 7 is an interpolating unit that generates color image data by interpolating the color components missing in each pixel in the single-plate image data output from the WB correction circuit 6 from information on neighboring pixels. is there.

上記カラー画像バッファ8は、この補間回路7により補間された三板のカラー画像データを一旦記憶するためのものである。   The color image buffer 8 is for temporarily storing the three-plate color image data interpolated by the interpolation circuit 7.

上記画質調整回路9は、このカラー画像バッファ8に記憶されているカラー画像に対して、色変換やエッジ強調などの画質調整処理を行うものである。   The image quality adjustment circuit 9 performs image quality adjustment processing such as color conversion and edge enhancement on the color image stored in the color image buffer 8.

上記記録回路10は、この画質調整回路9により画質を調整された三板のカラー画像データを記録するものである。   The recording circuit 10 records three-plate color image data adjusted in image quality by the image quality adjusting circuit 9.

上記制御回路11は、上述したような各回路を含むこのデジタルカメラ1を統括的に制御するための制御手段である。   The control circuit 11 is a control means for comprehensively controlling the digital camera 1 including the circuits as described above.

このようなデジタルカメラ1の作用は、以下のようになっている。   The operation of the digital camera 1 is as follows.

このデジタルカメラ1に設けられている図示しないシャッタボタンがユーザーにより押下されると、まず、光学系2による光学像が単板ベイヤー配列CCD3により撮像されて、各画素当たり一種類の色成分しかない単板状態の画像が単板画像バッファ4に記憶される。   When a shutter button (not shown) provided in the digital camera 1 is pressed by the user, first, an optical image by the optical system 2 is picked up by the single-plate Bayer array CCD 3, and there is only one type of color component for each pixel. An image in a single plate state is stored in the single plate image buffer 4.

次に、WB補正回路6が動作して、白色の被写体に対するR成分とG成分との比Crg、およびB成分とG成分との比Cbg、をそれぞれ計算してホワイトバランス係数とする。本実施例では、上記単板画像バッファ4から所定サイズのブロック毎に画素値を読み出して、このブロック内において、各画素で得られている色成分の種類別に画素値の平均をとる処理を行う。   Next, the WB correction circuit 6 operates to calculate the ratio Crg between the R component and the G component and the ratio Cbg between the B component and the G component for the white subject, respectively, to obtain a white balance coefficient. In the present embodiment, pixel values are read from the single-plate image buffer 4 for each block of a predetermined size, and within this block, processing is performed to average the pixel values for each type of color component obtained at each pixel. .

その結果、各ブロックの平均色のRGB値が得られるが、さらにR成分とG成分との比、およびB成分とG成分との比を計算して、これらの比が所定の関係を満たしているブロックのみを選ぶ。そして、選んだブロックのR成分とG成分との比、およびB成分とG成分との比、をさらに平均して、最終的なホワイトバランス係数CrgおよびCbgを求める。この手法自体は公知のものである。ただし、この計算中、単板画像バッファ4から画素値を読み出す際に、ライン補正回路5が作用して、画素値の補正を行う。   As a result, an RGB value of the average color of each block is obtained. Further, the ratio between the R component and the G component and the ratio between the B component and the G component are calculated, and these ratios satisfy a predetermined relationship. Select only the blocks that are present. Then, the final white balance coefficients Crg and Cbg are obtained by further averaging the ratio between the R component and the G component and the ratio between the B component and the G component of the selected block. This method itself is known. However, during this calculation, when the pixel value is read from the single-panel image buffer 4, the line correction circuit 5 operates to correct the pixel value.

すなわち、上記ライン補正回路5は、単板ベイヤー配列CCD3からの信号読み出し時に生じる偶数ラインと奇数ラインとの間のゲイン段差を補正するものであり、回路にはその補正のための係数(a,b)が保持されている。この係数は、均一なグレー被写体を撮影した際の単板画像バッファ4内の画素値に対して、奇数ラインでG成分が得られている画素の画素値の平均をV1、偶数ラインでG成分が得られている画素の画素値の平均をV2として、
[数6]
V2=a×V1+b
となるように予め算出されている。この係数を用いて、ライン補正回路5では奇数ラインでG成分が得られている画素の画素値vを、偶数ラインの感度に合わせて次の数式7に示すように補正して、
[数7]
v’=a×v+b
この補正後の画素値(補正値)v’をWB補正回路6に出力する。
That is, the line correction circuit 5 corrects a gain step between even lines and odd lines that occur when signals are read from the single-plate Bayer array CCD 3, and the circuit includes coefficients (a, b) is retained. This coefficient is the average of the pixel values of the pixels where the G component is obtained in the odd lines with respect to the pixel values in the single-panel image buffer 4 when the uniform gray subject is photographed, and the G component in the even lines. V2 is the average of the pixel values of the pixels from which
[Equation 6]
V2 = a × V1 + b
It is calculated in advance so that Using this coefficient, the line correction circuit 5 corrects the pixel value v of the pixel for which the G component is obtained in the odd line as shown in the following Equation 7 in accordance with the sensitivity of the even line,
[Equation 7]
v ′ = a × v + b
The corrected pixel value (correction value) v ′ is output to the WB correction circuit 6.

上述したようなWB補正回路6の処理が終了すると、上記ホワイトバランス係数Crg,Cbgは、該WB補正回路6内に保持される。   When the processing of the WB correction circuit 6 as described above is completed, the white balance coefficients Crg and Cbg are held in the WB correction circuit 6.

次に、補間回路7が単板画像バッファ4内の各画素に対して補間処理を行う。この補間回路7が行う補間処理のアルゴリズムは、上述した特開平8−298669号公報に記載されているものと同様であるが、本実施例においては、単板画像バッファ4から5ラインずつ画素を読み出して補間回路7内の図示しない内部バッファに記憶させ、該バッファ内のデータに対して補間処理を行うようにしている。   Next, the interpolation circuit 7 performs an interpolation process on each pixel in the single-panel image buffer 4. The interpolation processing algorithm performed by the interpolation circuit 7 is the same as that described in the above-mentioned Japanese Patent Application Laid-Open No. 8-298669. However, in this embodiment, the pixels are obtained from the single-panel image buffer 4 by five lines. The data is read out and stored in an internal buffer (not shown) in the interpolation circuit 7, and interpolation processing is performed on the data in the buffer.

そして、単板画像バッファ4から内部バッファにデータを移す際に、ライン補正回路5およびWB補正回路6が動作して、単板画像バッファ4から読み出した画素値が変更される。   Then, when data is transferred from the single-panel image buffer 4 to the internal buffer, the line correction circuit 5 and the WB correction circuit 6 operate to change the pixel values read from the single-panel image buffer 4.

その際は、まず、ライン補正回路5が単板画像バッファ4から読み出した画素値vに対する補正結果(補正値)v’として
[数8]
v’=a×v+b (読出画素が奇数ラインでG成分が得られている場合)
v’=v (その他の場合)
を計算し、さらに、WB補正回路6が、このライン補正回路5の補正結果(補正値)v’に対して出力v”を、
[数9]
v”=v’ (読出画素でG成分が得られている場合)
v”=Crg×v’ (読出画素でR成分が得られている場合)
v”=Cbg×v’ (読出画素でB成分が得られている場合)
と計算して、補間回路7の内部バッファにv”を書き込む処理を行う。
In this case, first, the correction result (correction value) v ′ with respect to the pixel value v read out from the single-panel image buffer 4 by the line correction circuit 5 is expressed by [Equation 8].
v ′ = a × v + b (when the read pixel is an odd line and the G component is obtained)
v ′ = v (other cases)
Further, the WB correction circuit 6 outputs the output v ″ to the correction result (correction value) v ′ of the line correction circuit 5,
[Equation 9]
v ″ = v ′ (when G component is obtained in the readout pixel)
v ″ = Crg × v ′ (when R component is obtained in the readout pixel)
v ″ = Cbg × v ′ (when B component is obtained in readout pixel)
And the process of writing v ″ into the internal buffer of the interpolation circuit 7 is performed.

その後に、補間回路7によりカラー画像バッファ8に出力されたカラー画像は、画質調整回路9により色変換、エッジ強調、階調変換などの処理が施されて、上記記録回路10により図示しない記録媒体に記録される。このようにして、デジタルカメラ1の撮像動作が完了する。   Thereafter, the color image output to the color image buffer 8 by the interpolation circuit 7 is subjected to processing such as color conversion, edge enhancement and gradation conversion by the image quality adjustment circuit 9, and the recording circuit 10 displays a recording medium (not shown). To be recorded. In this way, the imaging operation of the digital camera 1 is completed.

なお、この実施例1は、基本的な構成や処理を述べたものであり、本実施例には多くの変形例が考えられる。上記補間回路7による処理は、色成分Gが得られている画素において、画素値をそのまま補間処理後のG成分の値として用いるものであれば何でも良い。   The first embodiment describes a basic configuration and processing, and many variations can be considered in this embodiment. The processing by the interpolation circuit 7 may be anything as long as the pixel value is used as it is as the value of the G component after the interpolation processing in the pixel from which the color component G is obtained.

また、本実施例では単板撮像系を例に挙げたが、二板撮像系や三板画素ずらし撮像系に対しても同様の処理を適用することが可能である。   In this embodiment, a single-plate imaging system is used as an example, but the same processing can be applied to a two-plate imaging system or a three-plate pixel shift imaging system.

例えば二板撮像系の場合には、二枚の撮像素子の一方からは全画素でG成分が得られ、他方からは市松状にR成分とB成分とが得られる。例えばR成分に対する感度差の補正は、単板ベイヤー配列CCD3において市松状に得られるG成分に対して本実施例で述べた感度補正と同様の技術を適用することができる。   For example, in the case of a two-plate imaging system, the G component is obtained from all the pixels from one of the two imaging elements, and the R component and the B component are obtained from the other in a checkered pattern. For example, for the correction of the sensitivity difference with respect to the R component, the same technique as the sensitivity correction described in this embodiment can be applied to the G component obtained in a checkered pattern in the single-plate Bayer array CCD 3.

さらに、三板画素ずらし撮像系の場合には、3枚の撮像素子の内の2枚でG成分を取得し、残りの1枚で市松状にR,B成分を取得して、これらの情報から高精細な輝度成分を生成するタイプのものがある。この場合にも、市松状に得られるR,B成分の感度補正を、上述と同様に行うことができる。   Further, in the case of a three-plate pixel shifted imaging system, the G component is acquired by two of the three image sensors, the R and B components are acquired in a checkered pattern by the remaining one, and from these information Some types generate high-definition luminance components. Also in this case, the sensitivity correction of the R and B components obtained in a checkered pattern can be performed in the same manner as described above.

このような実施例1によれば、同じ色成分が得られる画素の間で、特にライン間において感度が異なっていても、感度補正手段たるライン補正回路で補正してから補間手段たる補間回路の処理を行うようにしているために、補間後の画像に感度の相異が影響を及ぼすのを防いで、より高品質な画像を得ることができる。   According to the first embodiment, even if the sensitivity is different among pixels from which the same color component is obtained, particularly between lines, the correction is performed by the line correction circuit serving as the sensitivity correction unit, and then the interpolation circuit serving as the interpolation unit. Since the processing is performed, it is possible to prevent the difference in sensitivity from affecting the interpolated image and obtain a higher quality image.

図2から図12は本発明の実施例2を示したものであり、図2はデジタルカメラの構成を示すブロック図、図3はG段差検出回路の処理を示すフローチャート、図4はG段差検出回路およびG補間回路における画素の分類を示す図、図5はG補間回路の処理を示すフローチャート、図6は上記図5に示したG補間回路の処理におけるステップS16の処理を説明するための図、図7は重み計算回路による重み計算の方向を示す図、図8はRB補間回路の処理を示すフローチャート、図9は上記図8に示したRB補間回路の処理におけるステップS31の画素選択を説明するための図、図10はコンピュータにより行われるソフト処理を示すフローチャート、図11はコンピュータにより行われるG補間ソフト処理を示すフローチャート、図12はコンピュータにより行われるRB補間ソフト処理を示すフローチャートである。   FIGS. 2 to 12 show a second embodiment of the present invention. FIG. 2 is a block diagram showing the configuration of the digital camera. FIG. 3 is a flowchart showing the processing of the G step detection circuit. FIG. 5 is a flowchart showing processing of the G interpolation circuit, and FIG. 6 is a diagram for explaining the processing of step S16 in the processing of the G interpolation circuit shown in FIG. FIG. 7 is a diagram showing the direction of weight calculation by the weight calculation circuit, FIG. 8 is a flowchart showing the processing of the RB interpolation circuit, and FIG. 9 explains pixel selection in step S31 in the processing of the RB interpolation circuit shown in FIG. FIG. 10 is a flowchart showing software processing performed by the computer, FIG. 11 is a flowchart showing G interpolation software processing performed by the computer, and FIG. Is a flow chart showing the RB interpolation software processing performed by a computer.

この実施例2において、上述の実施例1と同様である部分については同一の符号を付して説明を省略し、主として異なる点についてのみ説明する。   In the second embodiment, the same parts as those of the first embodiment are denoted by the same reference numerals and the description thereof is omitted, and only different points will be mainly described.

この実施例2は、上述した実施例1と同様に、画像処理装置をデジタルカメラに適用したものである。   In the second embodiment, the image processing apparatus is applied to a digital camera as in the first embodiment.

この実施例2のデジタルカメラ21は、該実施例1のデジタルカメラ1に対して、判定手段であり特徴量計算手段たるG段差検出回路22が付加されており、補間回路7に代えて補間手段たるG補間回路23、G画像バッファ26、および補間手段たるRB補間回路27を設けた点が異なっている。   In the digital camera 21 of the second embodiment, a G step detection circuit 22 as a determination unit and a feature amount calculation unit is added to the digital camera 1 of the first embodiment, and an interpolation unit is used instead of the interpolation circuit 7. The difference is that a G interpolation circuit 23, a G image buffer 26, and an RB interpolation circuit 27 as interpolation means are provided.

また、上記G補間回路23は、上記G段差検出回路22からの出力に基づき補間対象の画素に関する重みを計算するための重付平均手段たる重み計算回路24と、この重み計算回路24により算出された重みに基づき重み付きの平均値を計算して補間対象の画素の画素値としG画像バッファ26へ出力する重付平均手段たる平均回路25と、を有して構成されている。   The G interpolation circuit 23 is calculated by a weight calculation circuit 24 serving as a weighted average means for calculating a weight related to a pixel to be interpolated based on an output from the G step detection circuit 22, and the weight calculation circuit 24. And an averaging circuit 25 which is a weighted average means for calculating a weighted average value based on the weights and outputting it to the G image buffer 26 as a pixel value of a pixel to be interpolated.

次に、このようなデジタルカメラ21の作用を、上述した実施例1と異なる点を主として説明する。   Next, the operation of the digital camera 21 will be described mainly with respect to differences from the first embodiment.

シャッタボタンがユーザーにより押下されると、上記実施例1と同様に、光学系2による光学像が単板ベイヤー配列CCD3により撮像されて、各画素当たり一種類の色成分しかない単板状態の画像が単板画像バッファ4に記憶される。   When the shutter button is pressed by the user, an optical image by the optical system 2 is picked up by the single-plate Bayer array CCD 3 as in the first embodiment, and an image in a single-plate state having only one kind of color component for each pixel. Is stored in the single-panel image buffer 4.

次に、ライン補正回路5およびWB補正回路6が上記実施例1と同様に動作して、ホワイトバランス係数Crg,Cbgが算出される。   Next, the line correction circuit 5 and the WB correction circuit 6 operate in the same manner as in the first embodiment, and the white balance coefficients Crg and Cbg are calculated.

次に、G補間回路23が動作する。このときには、まず、単板画像バッファ4に記憶されている画像データに係る各画素の、周囲5×5画素でなるブロックがこのG補間回路23に設けられている内部バッファに読み込まれる。その際に、上述した実施例1と同様に、ライン補正回路5とWB補正回路6とが作動して、画素値の補正がなされ、さらにG段差検出回路22が作動して、G成分が得られる画素の偶数ラインと奇数ラインとの間の段差の推定値が計算される。   Next, the G interpolation circuit 23 operates. At this time, first, a block of 5 × 5 pixels around each pixel related to the image data stored in the single-panel image buffer 4 is read into an internal buffer provided in the G interpolation circuit 23. At that time, as in the first embodiment, the line correction circuit 5 and the WB correction circuit 6 are operated to correct the pixel value, and the G step detection circuit 22 is further operated to obtain the G component. An estimate of the step between the even and odd lines of the pixel being calculated is calculated.

このG段差検出回路22による段差推定について、図3のフローチャートに沿って説明する。   The step estimation by the G step detection circuit 22 will be described with reference to the flowchart of FIG.

G段差検出回路22は、内部バッファに読み込まれた5×5画素でなるブロック内の各画素を、得られている色成分毎に分類して、分類毎に画素値の平均値を計算する。その際に、G成分については、図4に示すように、水平方向に隣接する画素から得られる色成分がRである場合をG1、水平方向に隣接する画素から得られる色成分がBである場合をG2、として、さらに2種類に分類する。従って、計算される平均値は4種類となり、R成分の平均値がAr 、B成分の平均値がAb 、G1成分の平均値がAg1、G2成分の平均値がAg2、である。そして、G1またはG2に分類された画素については、各分類内の画素値の分散Vg1,Vg2もそれぞれ計算する(ステップS1)。   The G level difference detection circuit 22 classifies each pixel in the block of 5 × 5 pixels read into the internal buffer for each obtained color component, and calculates an average value of pixel values for each classification. At that time, as shown in FIG. 4, the G component is G1 when the color component obtained from the pixel adjacent in the horizontal direction is R, and the color component obtained from the pixel adjacent in the horizontal direction is B as shown in FIG. The case is further classified into two types as G2. Accordingly, there are four types of average values to be calculated: the average value of the R component is Ar, the average value of the B component is Ab, the average value of the G1 component is Ag1, and the average value of the G2 component is Ag2. For the pixels classified as G1 or G2, the variances Vg1 and Vg2 of the pixel values within each classification are also calculated (step S1).

次に、上記分散Vg1,Vg2が、両方ともある閾値T以下であるか否かを判断する(ステップS2)。   Next, it is determined whether or not the variances Vg1 and Vg2 are both below a certain threshold T (step S2).

ここで両方とも閾値T以下であって、ブロックが比較的平坦であると判断された場合には、段差推定値dを分類G1とG2の平均値の差Ag1−Ag2として、終了する(ステップS3)。   Here, if both are equal to or less than the threshold value T and it is determined that the block is relatively flat, the step difference estimation value d is set as the difference Ag1−Ag2 between the average values of the classifications G1 and G2 (step S3). ).

また、上記ステップS2において、分散Vg1,Vg2の少なくとも一方が閾値Tを越える場合には、ブロックが平坦であるかどうかが不明である。そこでさらに、ブロック内においてR成分とB成分とがおよそどれだけ違っているかを、R成分が得られている画素の平均値Ar と、B成分が得られている画素の平均値Ab と、の差分|Ar −Ab |が、所定の閾値Trbよりも大きいか否かにより評価する(ステップS4)。   In step S2, if at least one of the variances Vg1 and Vg2 exceeds the threshold value T, it is unknown whether the block is flat. Therefore, the difference between the R component and the B component in the block is determined by the average value Ar of the pixels from which the R component is obtained and the average value Ab of the pixels from which the B component is obtained. Evaluation is made based on whether or not the difference | Ar−Ab | is larger than a predetermined threshold value Trb (step S4).

ここで、上記差分|Ar −Ab |が閾値Trbよりも大きい場合には、以下のような処理を行う。   Here, when the difference | Ar−Ab | is larger than the threshold value Trb, the following processing is performed.

まず、本実施例においては、上記G段差検出回路22が、種々の色の被写体を撮影して各画像でライン間のG成分に段差dがどれだけ生じるかを測定することにより得られたテーブルTdを、予め保持している。これは、上記WB補正回路6で処理する前にライン補正回路5によって画像データに係るライン間の感度補正がなされていても、ラインの偶奇に応じて、G成分が得られている画素の画素値に段差が生じることがあるためである。   First, in the present embodiment, a table obtained by the G step detection circuit 22 taking a subject of various colors and measuring how many steps d occur in the G component between lines in each image. Td is held in advance. This is because, even if the line correction circuit 5 performs the sensitivity correction between the lines related to the image data before the processing by the WB correction circuit 6, the pixel of the pixel from which the G component is obtained according to the even / odd of the line This is because there may be a step in the value.

そして、R成分が得られている画素の平均値Ar とB成分が得られている画素の平均値Ab との差p1(特徴量)と、G1,G2の両方を含むG成分の平均的な大きさp2(特徴量)と、の2つのインデックスに対して、生じ得るG段差量dを、d=Td(p1,p2)のようにテーブル参照して、取得する。ここでは、このテーブル参照を行ってG段差量のおよその推定値dを求めたら、このG段差検出の処理を終了する(ステップS5)。   Then, the difference p1 (feature value) between the average value Ar of the pixels from which the R component is obtained and the average value Ab of the pixels from which the B component is obtained, and the average of the G component including both G1 and G2 For the two indexes of size p2 (feature amount), the G step amount d that can be generated is obtained by referring to a table such as d = Td (p1, p2). Here, when this table is referred to and an approximate estimated value d of the G step amount is obtained, this G step detection process is terminated (step S5).

また、上記ステップS4において、上記差分|Ar −Ab |が閾値Trb以下である場合には、G段差が生じているとしても、それがどの程度あるのかをブロック内のデータからは推定することができないために、G段差量dを、推定不能を表す−255に設定して、終了する(ステップS6)。   In step S4, if the difference | Ar−Ab | is equal to or smaller than the threshold value Trb, it is possible to estimate from the data in the block how much the G step is present even if it is generated. Since this is not possible, the G step amount d is set to −255 indicating impossibility of estimation, and the process ends (step S6).

このようにして、5×5画素でなるブロックの読み出しと、ライン間のG成分の段差量の推定値dと、が得られると、G補間回路23が、ブロックの中心画素のG成分を計算して、G画像バッファ26に書きこむ。このような処理について、図5のフローチャートを参照して説明する。   When the reading of the block of 5 × 5 pixels and the estimated value d of the step amount of the G component between the lines are obtained in this way, the G interpolation circuit 23 calculates the G component of the central pixel of the block. Then, the G image buffer 26 is written. Such processing will be described with reference to the flowchart of FIG.

処理を開始すると、ブロックの中心画素の分類mが、上記図4に示した分類におけるG1であるか否かを判断する(ステップS11)。この分類mは、該図4に例示したように、得られている色成分の種類と水平隣接画素の種類とに応じて、R,G1,G2,Bの4種類の何れかになる。   When the process is started, it is determined whether or not the classification m of the central pixel of the block is G1 in the classification shown in FIG. 4 (step S11). As illustrated in FIG. 4, the classification m is any one of four types R, G1, G2, and B depending on the type of the color component that is obtained and the type of the horizontal adjacent pixel.

ここで分類mがG1である場合には、中心画素のG成分の値Vを、ブロックの中心画素の画素値U0 そのものとして(ステップS12)、終了する。   Here, when the classification m is G1, the value V of the G component of the central pixel is set as the pixel value U0 of the central pixel of the block (step S12), and the process ends.

また、上記ステップS11において、ブロックの中心画素の分類mがG1でない場合には、該分類mが図4に示した分類におけるG2であるか否かをさらに判断する(ステップS13)。   If the classification m of the central pixel of the block is not G1 in step S11, it is further determined whether or not the classification m is G2 in the classification shown in FIG. 4 (step S13).

ここでブロックの中心画素の分類mがG2である場合には、G段差推定値dが−255であるか否か、つまり推定不能に設定されているか否かを判断する(ステップS14)。   Here, when the classification m of the central pixel of the block is G2, it is determined whether or not the G step estimated value d is −255, that is, whether or not estimation is disabled (step S14).

G段差推定値dが−255でない場合には、中心画素のG成分の値Vを、ブロック中心画素の画素値U0 とG段差推定値dとに基づいてV=U0 +dと推定し(ステップS15)、終了する。   If the estimated G step value d is not −255, the G component value V of the central pixel is estimated as V = U0 + d based on the pixel value U0 of the block central pixel and the estimated G step value d (step S15). ),finish.

一方、上記ステップS14において、G段差推定値dが−255である場合には、中心画素(画素値がU0 となっている画素)に対する3×3画素の近傍を図6に示すようにとり、この近傍の四隅にあるG成分が得られている画素の画素値U1 〜U4 と、該中心画素の画素値U0 との差分dujを、以下のように計算する。
duj=|U0 −Uj |
ここにjは、1から4の整数である。これらの差分の内の、最小の差分を与えるjについて、V=(U0 +Uj )/2を中心画素のG成分の値とし(ステップS16)、終了する。
On the other hand, when the estimated G level difference d is −255 in step S14, the neighborhood of 3 × 3 pixels with respect to the central pixel (pixel having a pixel value U0) is taken as shown in FIG. The difference duj between the pixel values U1 to U4 of the pixels for which G components at the four corners in the vicinity are obtained and the pixel value U0 of the central pixel is calculated as follows.
duj = | U0−Uj |
Here, j is an integer of 1 to 4. Of these differences, for j giving the smallest difference, V = (U0 + Uj) / 2 is set as the value of the G component of the central pixel (step S16), and the process ends.

上記ステップS13において、ブロックの中心画素の分類mがG2でない場合には、G段差推定値dが−255であるか否か、つまり推定不能に設定されているか否かを判断する(ステップS17)。   In step S13, if the classification m of the central pixel of the block is not G2, it is determined whether or not the G step estimated value d is -255, that is, whether or not estimation is set (step S17). .

ここでG段差推定値dが−255でない場合には、ブロック内のG2に分類された画素kの画素値Uk を、Uk =Uk +dと補正する(ステップS18)。   If the estimated G level difference d is not −255, the pixel value Uk of the pixel k classified as G2 in the block is corrected as Uk = Uk + d (step S18).

また、上記ステップS17においてG段差推定値dが−255である場合には、後述するステップS20の計算で用いるパラメータαを、予め設定された値に対して1/2倍するとともに、該ステップS20の計算で用いるパラメータβを、予め設定された値に対して2倍する(ステップS19)。   If the estimated G level difference d is −255 in step S17, the parameter α used in the calculation in step S20, which will be described later, is halved with respect to a preset value, and the step S20 The parameter β used in the above calculation is doubled with respect to a preset value (step S19).

上記ステップS18またはステップS19が終了したら、重み計算回路24が、図7(A)〜図7(D)に示すような中心画素の上下左右の各方向の重みWj(jは1から4の整数)を以下の数式10に示すように計算する。
[数10]
E1=|B5−B7|
+α×(|G4−G6|−min(|G4−G6|,|G2−G8|))
+β
E2=|B5−B9|
+α×(|G2−G8|−min(|G4−G6|,|G2−G8|))
+β
E3=|B5−B3|
+α×(|G4−G6|−min(|G4−G6|,|G2−G8|))
+β
E4=|B5−B1|
+α×(|G2−G8|−min(|G4−G6|,|G2−G8|))
+β
Wj=(1/Ej)/(Σ(1/Ek))
この数式10におけるα,βは定数であり、予め定められた値、または上記ステップS19において変更された値をとる。また、Wの計算におけるjは上述したように1から4の整数、分母の和は1から4の整数kに対してとっている。なお、この計算式は、図7(A)〜図7(D)の配置に対するものであり、中心画素の分類がBであるときの例であるが、中心画素の分類がRである場合には、BとRとを置き換えて計算をすれば良い(ステップS20)。
When step S18 or step S19 is completed, the weight calculation circuit 24 performs weights Wj (j is an integer from 1 to 4) in the vertical and horizontal directions of the central pixel as shown in FIGS. 7 (A) to 7 (D). ) Is calculated as shown in Equation 10 below.
[Equation 10]
E1 = | B5-B7 |
+ Α × (| G4-G6 | -min (| G4-G6 |, | G2-G8 |))
+ Β
E2 = | B5-B9 |
+ Α × (| G2-G8 | -min (| G4-G6 |, | G2-G8 |))
+ Β
E3 = | B5-B3 |
+ Α × (| G4-G6 | -min (| G4-G6 |, | G2-G8 |))
+ Β
E4 = | B5-B1 |
+ Α × (| G2-G8 | -min (| G4-G6 |, | G2-G8 |))
+ Β
Wj = (1 / Ej) / (Σ (1 / Ek))
Α and β in Equation 10 are constants and take predetermined values or values changed in step S19. In the calculation of W, j is an integer from 1 to 4 as described above, and the sum of the denominators is an integer k from 1 to 4. This calculation formula is for the arrangement of FIGS. 7A to 7D, and is an example when the classification of the central pixel is B, but when the classification of the central pixel is R May be calculated by replacing B and R (step S20).

次に、平均回路25が、上記ステップS20において計算した重みWj を用いて、各方向にある画素の画素値を重み付けして、以下の数式11により最終的な中心画素のG成分を計算する(ステップS21)。
[数11]
Vg =W1×G6+W2×G8+W3×G4+W4×G2
Vb =W1×B7+W2×B9+W3×B3+W4×B1
V =Vg +(Vb −B5)/2
このような一連の処理が単板画像バッファ4内の画像の全画素に対して終了すると、G画像バッファ26にはG成分の欠落が補われた画像が得られる。すると、次にRB補間回路27が動作して、全ての画素で欠落色成分のないカラー画像を生成しカラー画像バッファ8に記憶させる。
Next, the averaging circuit 25 weights the pixel values of the pixels in each direction using the weight Wj calculated in step S20, and calculates the final G component of the center pixel by the following equation (11) ( Step S21).
[Equation 11]
Vg = W1 * G6 + W2 * G8 + W3 * G4 + W4 * G2
Vb = W1 * B7 + W2 * B9 + W3 * B3 + W4 * B1
V = Vg + (Vb-B5) / 2
When such a series of processing is completed for all the pixels of the image in the single-plate image buffer 4, an image in which the lack of the G component is compensated for in the G image buffer 26 is obtained. Then, the RB interpolation circuit 27 operates to generate a color image having no missing color component at all pixels and store it in the color image buffer 8.

すなわち、RB補間回路27は、G補間回路23と同様に、単板画像バッファ4内の各画素に対して、まず、該画素を中心とする5×5画素でなるブロックを読み出す。この読み出し時には、G補間回路23と同様に、ライン補正回路5、WB補正回路6、およびG段差検出回路22が作動して、5×5画素でなるブロックの変更後の画素値が該RB補間回路27の図示しない内部バッファに得られるとともに、ブロック内のG段差推定値dも得られる。   That is, as with the G interpolation circuit 23, the RB interpolation circuit 27 first reads, for each pixel in the single-panel image buffer 4, a block of 5 × 5 pixels centered on the pixel. At the time of reading, the line correction circuit 5, the WB correction circuit 6, and the G level difference detection circuit 22 operate in the same manner as the G interpolation circuit 23, and the pixel value after the change of the block of 5 × 5 pixels is the RB interpolation. In addition to being obtained in an internal buffer (not shown) of the circuit 27, an estimated G step value d in the block is also obtained.

次に、RB補間回路27は、読み出したブロックに対応する画素位置のG成分の値をG画像バッファ26から読み出して、同様に図示しない内部バッファに記憶する。   Next, the RB interpolation circuit 27 reads the value of the G component at the pixel position corresponding to the read block from the G image buffer 26 and similarly stores it in an internal buffer (not shown).

その後、RB補間回路27は、図8に示すような処理により、中央画素の欠落色成分を求める。この図8に示す処理は、ブロックの中央画素に対する指定された色成分cの値を、内部バッファのデータから重み付け平均により計算するものである。   Thereafter, the RB interpolation circuit 27 obtains the missing color component of the central pixel by a process as shown in FIG. In the processing shown in FIG. 8, the value of the designated color component c for the central pixel of the block is calculated from the data in the internal buffer by weighted averaging.

このとき、画素位置によって欠落する色成分が異なるために、RB補間回路27は、ブロックの中央画素の分類が、Rの場合にはc=Bとして、Bの場合にはc=Rとして、G1またはG2の場合にはc=Rおよびc=Bの各々の指定に対して、図8に示す処理を実行するようになっている。   At this time, since the missing color component varies depending on the pixel position, the RB interpolation circuit 27 sets c = B when the classification of the central pixel of the block is R, and c = R when the classification is B. Alternatively, in the case of G2, the process shown in FIG. 8 is executed for each designation of c = R and c = B.

以下では、図8に示す処理を順に説明する。   Below, the process shown in FIG. 8 is demonstrated in order.

処理を開始すると、ブロック内において、指定された色成分cが得られている画素P1 〜Pn (nは整数)を求める(ステップS31)。図9(B)は、図9(A)に示すような配置のブロックにおけるc=Rに対する結果を示したものである。この場合には、画素P1 〜P6 が得られるために、nは6となる。   When the processing is started, pixels P1 to Pn (n is an integer) from which the designated color component c is obtained are obtained in the block (step S31). FIG. 9B shows the result for c = R in the block arranged as shown in FIG. 9A. In this case, since the pixels P1 to P6 are obtained, n is 6.

次に、ブロック内のG段差推定値dが−255,つまり推定不能に設定されているか否かを判断する(ステップS32)。   Next, it is determined whether or not the estimated G level difference value d in the block is −255, that is, estimation is impossible (step S32).

ここで、G段差推定値dが−255である場合には、後述するステップS34の計算で用いるパラメータγを予め設定された値の2倍にするとともに、後述するステップS35の計算で用いるパラメータδを予め設定された値の半分にする(ステップS33)。   Here, when the estimated G level difference d is −255, the parameter γ used in the calculation in step S34 described later is doubled in advance, and the parameter δ used in the calculation in step S35 described later. Is set to half of a preset value (step S33).

このステップS33の処理が終了するか、または、上記ステップS32においてG段差推定値dが−255でない場合には、画素Pjに割り当てる重みWjを、以下の数式12に示すように計算する(ステップS34)。
[数12]
Ej =|Gj −G0 |+γ
Wj=(1/Ej)/(Σ(1/Ek))
ここに、Wの計算におけるjは1から4の整数、分母の和は1から4の整数kに対してとっている。また、γは定数であり、予め定められた値、または上記ステップS33で変更された値をとる。
When the process of step S33 ends, or when the G step estimated value d is not −255 in step S32, the weight Wj assigned to the pixel Pj is calculated as shown in the following equation 12 (step S34). ).
[Equation 12]
Ej = | Gj−G0 | + γ
Wj = (1 / Ej) / (Σ (1 / Ek))
Here, j in the calculation of W is an integer from 1 to 4, and the sum of the denominators is from an integer k from 1 to 4. Γ is a constant and takes a predetermined value or a value changed in step S33.

次に、中央画素における欠落色成分cの値Vを、以下の数式13に示すように計算する。この数式13において、CjおよびGjは、画素Pjにおいて得られている色成分cおよびGの値である(ステップS35)。
[数13]
Vc =ΣWj ×Cj (jは1からnの整数)
Vg =G0−ΣWj ×Gj (jは1からnの整数)
V =Vc +δ×Vg
ここにδは定数であり、予め定められた値、または上記ステップS33で変更された値をとる。
Next, the value V of the missing color component c in the center pixel is calculated as shown in the following Equation 13. In Expression 13, Cj and Gj are values of the color components c and G obtained in the pixel Pj (step S35).
[Equation 13]
Vc = ΣWj × Cj (j is an integer from 1 to n)
Vg = G0-.SIGMA.Wj.times.Gj (j is an integer from 1 to n)
V = Vc + δ × Vg
Here, δ is a constant and takes a predetermined value or a value changed in step S33.

ここまでの処理が単板画像バッファ4内の画像の全ての画素に対して終了すると、カラー画像バッファ8には全画素で欠落色成分が復元されたカラー画像、すなわち、いわゆる三板のカラー画像が得られる。   When the processing so far is completed for all the pixels of the image in the single-plate image buffer 4, a color image in which the missing color component is restored in all pixels, that is, a so-called three-plate color image is stored in the color image buffer 8. can get.

その後の作用は上述した実施例1と同様であり、得られたカラー画像が画質調整回路9により色変換、エッジ強調、階調変換などの処理を施され、記録回路10により図示しない記録媒体に記録されて、このデジタルカメラ21の撮像動作が完了する。   The subsequent operation is the same as that of the first embodiment described above, and the obtained color image is subjected to processing such as color conversion, edge enhancement, gradation conversion and the like by the image quality adjustment circuit 9, and is applied to a recording medium (not shown) by the recording circuit 10. This is recorded, and the imaging operation of the digital camera 21 is completed.

なお、上述では、画像処理装置であるデジタルカメラ21の内部のハードウェア(回路等)により処理を行うようにしているが、このような処理を、PC(パーソナルコンピュータ)等のコンピュータ上で画像処理プログラムにより行うようにすることも可能である。図10〜図12はコンピュータにより行われるソフト処理の例を示すフローチャートである。   In the above description, processing is performed by hardware (circuit or the like) inside the digital camera 21 that is an image processing apparatus. Such processing is performed on a computer such as a PC (personal computer). It is also possible to do this programmatically. 10 to 12 are flowcharts showing examples of software processing performed by the computer.

このソフトウェア処理は、メモリInImgに記憶されている画像、つまり、単板ベイヤー配列CCD3により得られた直後の、各画素で一種類の色成分しか得られていない画像、を処理して、メモリOutImgに3色カラー画像を出力するものである。ただし、ホワイトバランス係数Cr,Cbおよびライン間のゲイン補正係数a,bは、パラメータとして与えられるものとする。   This software processing processes the image stored in the memory InImg, that is, the image obtained by the single-plate Bayer array CCD3 and obtained with only one kind of color component at each pixel, and then outputs the memory OutImg. 3 color images are output. However, the white balance coefficients Cr and Cb and the gain correction coefficients a and b between the lines are given as parameters.

以下では、図10〜図12のフローチャートの各ステップについて説明する。   Below, each step of the flowchart of FIGS. 10-12 is demonstrated.

まず、図10は、ソフト処理の流れの概要を示している。   First, FIG. 10 shows an outline of the flow of software processing.

すなわち、処理を開始すると、この処理の途中で全画素に対するG成分をまず計算することになるために、該計算結果を記憶するためのメモリGimgを確保する(ステップS41)。   That is, when the process is started, the G component for all the pixels is first calculated in the middle of this process, so a memory Gimg for storing the calculation result is secured (step S41).

次に、後で図11を参照して説明するようなG補間ソフト処理を実行する(ステップS42)。   Next, G interpolation software processing as will be described later with reference to FIG. 11 is executed (step S42).

さらに、後で図12を参照して説明するようなRB補間ソフト処理を実行する(ステップS43)。   Further, RB interpolation software processing as will be described later with reference to FIG. 12 is executed (step S43).

その後、確保したメモリGimgを開放してから(ステップS44)、このソフト処理を終了する。   Thereafter, the secured memory Gimg is released (step S44), and this software process is terminated.

次に、図11を参照して、上記ステップS42におけるG補間ソフト処理の詳細について説明する。   Next, the details of the G interpolation software processing in step S42 will be described with reference to FIG.

処理を開始すると、メモリInImg内に未処理の画素が存在するか否かを判断する(ステップS51)。   When the process is started, it is determined whether or not an unprocessed pixel exists in the memory InImg (step S51).

ここで、メモリInImg内に未処理の画素が存在している場合には、該未処理の画素の内の1つを処理対象画素として決定し、この処理対象画素を中心とした5×5画素でなるブロックの画像データを読み出す(ステップS52)。   Here, when an unprocessed pixel exists in the memory InImg, one of the unprocessed pixels is determined as a processing target pixel, and 5 × 5 pixels centered on the processing target pixel. Is read out (step S52).

そして、上記数式8を計算することによりライン間補正を行うとともに上記数式9を計算することによりWB補正を行う(ステップS53)。   Then, line-to-line correction is performed by calculating Formula 8 and WB correction is performed by calculating Formula 9 (step S53).

さらに、上記図3に示したようなG段差推定処理を行うことにより、段差推定値dを計算する(ステップS54)。   Further, the step difference estimation value d is calculated by performing the G step estimation process as shown in FIG. 3 (step S54).

このG段差推定結果に基づいて図5に示したようなG補間処理を行い(ステップS55)、処理後のG補間結果VをメモリGimg中の処理対象画素に対応する位置の画素値として記録してから(ステップS56)、上記ステップS51に戻る。   Based on the G step estimation result, G interpolation processing as shown in FIG. 5 is performed (step S55), and the processed G interpolation result V is recorded as a pixel value at a position corresponding to the processing target pixel in the memory Gimg. (Step S56), the process returns to Step S51.

また、上記ステップS51において、メモリInImg内の画像の処理が全て終了している場合には、この処理を終了する。   In step S51, if all the processing of the image in the memory InImg has been completed, this processing ends.

続いて、図12を参照して、上記ステップS43におけるRB補間ソフト処理の詳細について説明する。   Next, the details of the RB interpolation software processing in step S43 will be described with reference to FIG.

処理を開始すると、メモリInImg内に未処理の画素が存在するか否かを判断する(ステップS61)。   When the process is started, it is determined whether or not an unprocessed pixel exists in the memory InImg (step S61).

ここで、メモリInImg内に未処理の画素が存在している場合には、該未処理の画素の内の1つを処理対象画素として決定し、この処理対象画素を中心とした5×5画素でなるブロックの画像データをメモリInImgおよびメモリGimgからそれぞれ読み出す(ステップS62)。   Here, when an unprocessed pixel exists in the memory InImg, one of the unprocessed pixels is determined as a processing target pixel, and 5 × 5 pixels centered on the processing target pixel. Are read from the memory InImg and the memory Gimg, respectively (step S62).

そして、上記数式8を計算することによりライン間補正を行うとともに上記数式9を計算することによりWB補正を行う(ステップS63)。   Then, line-to-line correction is performed by calculating Formula 8 and WB correction is performed by calculating Formula 9 (step S63).

さらに、上記図3に示したようなG段差推定処理を行うことにより、段差推定値dを計算する(ステップS64)。   Further, the step difference estimation value d is calculated by performing the G step estimation process as shown in FIG. 3 (step S64).

その後、ブロックの中央画素の種類がRであるか否かを判断し(ステップS65)、Rでない場合には、c=Rとしてから上記図8に示したようなRB補間処理を行い、その補間結果をメモリOutImgの対応する画素のR成分として記録する(ステップS66)。   Thereafter, it is determined whether or not the type of the central pixel of the block is R (step S65). If it is not R, RB interpolation processing as shown in FIG. 8 is performed after c = R, and the interpolation is performed. The result is recorded as the R component of the corresponding pixel in the memory OutImg (step S66).

このステップS66が終了するか、または上記ステップS65において中央画素の種類がRである場合には、ブロックの中央画素の種類がBであるか否かを判断する(ステップS67)。   When step S66 ends or when the type of central pixel is R in step S65, it is determined whether or not the type of central pixel of the block is B (step S67).

ここで、中央画素の種類がBである場合には、そのまま上記ステップS61へ戻り、一方、中央画素の種類がBでない場合には、c=Bとしてから上記図8に示したようなRB補間処理を行い、その補間結果をメモリOutImgの対応する画素のB成分として記録してから(ステップS68)上記ステップS61へ戻る。   Here, when the type of the central pixel is B, the process directly returns to step S61. On the other hand, when the type of the central pixel is not B, RB interpolation as shown in FIG. Processing is performed, and the interpolation result is recorded as the B component of the corresponding pixel in the memory OutImg (step S68), and the process returns to step S61.

そして、上記ステップS61において、メモリInImg内の画像の処理が全て終了している場合には、この処理を終了する。   In step S61, if all the processing of the image in the memory InImg has been completed, this processing ends.

なお、この実施例は幾つかの変形が可能である。好ましい変形例の一つは、G補間回路23およびRB補間回路27が単板画像バッファ4に保持される画像よりも画素数の少ない画像を生成する機能を有するものであって、該機能を働かせる場合に、G段差検出回路22の処理をスキップすることである。画素数を少なくして出力するモードは、デジタルカメラにおいては標準的に備えられたものであり、この場合には、G補間回路23およびRB補間回路27が単板画像バッファ4から画素を間引いて読み出しながら処理することになる。すると、G画素に感度差があっても処理結果への影響が少なくなるために、間引き率に応じて(つまり、縮小率が所定の閾値以下である場合に)G段差検出回路の処理を中止し、段差推定値としてd=−255を出力するようにすることにより、処理効率を向上し消費電力を低減することが可能となる。   This embodiment can be modified in several ways. One preferred modification is one in which the G interpolation circuit 23 and the RB interpolation circuit 27 have a function of generating an image having a smaller number of pixels than the image held in the single-panel image buffer 4, and the functions are used. In this case, the processing of the G step detection circuit 22 is skipped. A mode of outputting with a reduced number of pixels is provided as standard in a digital camera. In this case, the G interpolation circuit 23 and the RB interpolation circuit 27 thin out pixels from the single-plate image buffer 4. Processing is performed while reading. Then, even if there is a difference in sensitivity between the G pixels, the influence on the processing result is reduced. Therefore, the processing of the G level difference detection circuit is stopped according to the thinning rate (that is, when the reduction rate is equal to or less than a predetermined threshold). Then, by outputting d = −255 as the step difference estimated value, it becomes possible to improve the processing efficiency and reduce the power consumption.

また、本実施例では単板撮像系を例に挙げたが、二板撮像系や三板画素ずらし撮像系に対しても同様の処理を適用することが可能である。   In this embodiment, a single-plate imaging system is used as an example, but the same processing can be applied to a two-plate imaging system or a three-plate pixel shift imaging system.

例えば二板撮像系の場合には、二枚の撮像素子の一方からは全画素でG成分が得られ、他方からは市松状にR成分とB成分とが得られる。このときには、図3のステップS1からステップS3の処理を変更して、偶数ラインのR画素と奇数ラインのR画素との間の平均値の差を検出して、その検出量に応じて感度差補正を行うようにすれば良い。   For example, in the case of a two-plate imaging system, the G component is obtained from all the pixels from one of the two imaging elements, and the R component and the B component are obtained from the other in a checkered pattern. At this time, the processing from step S1 to step S3 in FIG. 3 is changed to detect the difference in average value between the R pixels in the even lines and the R pixels in the odd lines, and the sensitivity difference according to the detected amount. What is necessary is just to correct | amend.

さらに、三板画素ずらし撮像系の場合には、3枚の撮像素子の内の2枚でG成分を取得し、残りの1枚で市松状にR,B成分を取得して、これらの情報から高精細な輝度成分を生成するタイプのものがある。この場合にも、市松状に得られるR,B成分の感度補正を、上記二板撮像系の場合と同様に行うことができる。   Further, in the case of a three-plate pixel shifted imaging system, the G component is acquired by two of the three image sensors, the R and B components are acquired in a checkered pattern by the remaining one, and from these information Some types generate high-definition luminance components. Also in this case, the sensitivity correction of the R and B components obtained in a checkered pattern can be performed in the same manner as in the case of the two-plate imaging system.

そして、感度補正をG成分以外のこうしたR成分やB成分について行うときには、上記テーブルは、指定された色成分に対する特徴量と感度差の量とを対応付けたテーブルとなるのは勿論である。   When the sensitivity correction is performed for such R and B components other than the G component, the above table is of course a table in which the feature amount for the designated color component is associated with the amount of sensitivity difference.

また、重付平均手段たる重み計算回路24および平均回路25における重みの計算法は、重みが、判定手段である上記G段差検出回路22において感度差が大きいと判定された種類の色成分が得られている画素に対して小さくなるようなものであれば他の方法に変更しても良い。例えば、重みの計算式は、数式10以外に、上記近傍内で同種の色成分が得られている画素間の画素値差分に対する他の形の関数式でも良い。但し、上記G段差検出回路22により特定の色成分に対して感度差が大きいと判定された場合には、該関数式は、当該色成分に関する上記画素値差分の影響が小さくなるように変更することが望ましい。さらに、上記G段差検出回路22において感度差があると判定された種類の色成分が得られている画素に対する重みの計算は、最終的にG画素間の重みが均等に近づくように計算されることが望ましく、それは数式10ではβの調整で実現できているが、もちろん他の計算式を用いても良い。   Further, the weight calculation method in the weight calculation circuit 24 and the average circuit 25 as the weighted average means obtains the type of color component whose weight is determined to be large in the G step detection circuit 22 as the determination means. Any other method may be used as long as it is smaller than the pixel being used. For example, in addition to Expression 10, the weight calculation expression may be a function expression of another form for the pixel value difference between pixels in which the same kind of color component is obtained in the vicinity. However, when the G level difference detection circuit 22 determines that the sensitivity difference is large with respect to a specific color component, the function formula is changed so that the influence of the pixel value difference with respect to the color component becomes small. It is desirable. Further, the calculation of the weights for the pixels from which the type of color component determined to have a difference in sensitivity in the G level difference detection circuit 22 is finally calculated so that the weights between the G pixels approach equally. It is desirable that it can be realized by adjusting β in Expression 10, but other calculation expressions may be used as a matter of course.

このような実施例2によれば、上述した実施例1と同様に、同じ色成分が得られる画素で感度が異なっていても、感度補正手段で補正してから補間手段の処理を行うようにしているために、補間後の画像に感度の相異が影響を及ぼすのを防いで、より高品質な画像を得ることができる。   According to the second embodiment, as in the first embodiment described above, even if pixels having the same color component have different sensitivities, the correction processing is performed after the correction by the sensitivity correction device. Therefore, it is possible to prevent a difference in sensitivity from affecting the interpolated image and obtain a higher quality image.

その上、この実施例2によれば、補間手段による処理を行う前に、判定手段により同じ色成分が得られる画素に大きな感度差があるか否かを判定して、大きな感度差があると判断された場合に、補間手段の処理を、該感度差の影響を受け難い処理に変更しているために、つまり、元々得られている色成分の値を注目画素の感度が所定の基準感度である場合にとるはずの値に補正して補間結果に用いるような処理に変更しているために、処理効率をあまり落とすことなく、最終的に得られる画像の画質を向上することができる。   Moreover, according to the second embodiment, before performing the processing by the interpolation unit, the determination unit determines whether or not there is a large sensitivity difference between pixels from which the same color component is obtained. If it is determined, the processing of the interpolation means has been changed to processing that is not easily affected by the sensitivity difference, that is, the value of the color component that has been originally obtained is set to the predetermined reference sensitivity. Since the processing is corrected to a value that should be taken in the case of the above and used for the interpolation result, the image quality of the finally obtained image can be improved without significantly reducing the processing efficiency.

さらに、感度差の有無に応じて補間処理の際の重みを変更するようにしているために、感度差があると判断された部分とそうでない部分との画質が大きく切り替わらない自然な処理を、簡単な処理回路で行うことが可能となる。   Furthermore, since the weight at the time of the interpolation process is changed according to the presence or absence of the sensitivity difference, a natural process in which the image quality between the part judged to have a sensitivity difference and the part not so is not largely switched, It becomes possible to carry out with a simple processing circuit.

その際、感度の異なる画素の重みが互いに等しくなるような計算を行っているために、結果として副作用を少なくすることができる。   At this time, since the calculation is performed so that the weights of pixels having different sensitivities are equal to each other, side effects can be reduced as a result.

また、この補間処理では、複数の色成分の情報を用いて欠落する色成分の値を推定しているが、その際に感度の異なる画素を含む色成分に対する情報の利用の割合を小さくするようにしているために、格子縞が見えるなどの副作用を起き難くすることができる。   In this interpolation processing, the value of the missing color component is estimated using information on a plurality of color components. At this time, the ratio of use of information with respect to color components including pixels having different sensitivities is reduced. As a result, side effects such as the appearance of plaid can be made difficult to occur.

さらに、重み計算を同色画素の差分に基づいて行っているが、その計算においても、データとして信頼性が低い、感度差のある同色画素の差分の影響を小さくするようにしているために、結果的に生じる副作用を抑制することができる。   Furthermore, the weight calculation is performed based on the difference of the same color pixel. However, in the calculation, the influence of the difference of the same color pixel having a low sensitivity and a difference in sensitivity is reduced. Side effects can be suppressed.

加えて、感度差を生じる原因には種々のものがあるが、注目画素の近傍における画素値のパターンが特定の条件を満たす場合に感度差が生じ易いことがあるために、該近傍がこうしたパターンとなっているかどうかを特徴量を使って判定して、該パターンであると判断される率が高いほど感度差も大きいと判断することにより、局所的に生じる感度差に対しても副作用が生じないように処理することを可能にしている。   In addition, there are various causes for the sensitivity difference. However, when the pixel value pattern in the vicinity of the target pixel satisfies a specific condition, the sensitivity difference is likely to occur. Is determined using the feature amount, and the higher the rate at which the pattern is determined, the greater the sensitivity difference. It is possible to process so that there is no.

その際、感度差を生じ易い近傍の画素値パターンに関して、該パターンに対して生じる感度差とパターンの特徴量とを関連付けてテーブルとして保持しておくことにより、感度差の大小をより確実に判断することができる。   At that time, regarding the neighboring pixel value patterns that are likely to cause a sensitivity difference, the sensitivity difference generated with respect to the pattern and the feature amount of the pattern are stored as a table in association with each other, thereby determining the magnitude of the sensitivity difference more reliably. can do.

また、感度差を生じる画素の位置関係が分かっていることを利用して、位置毎に別々に統計を取って、その結果同士を比較しているので、感度差が生じているか否かを確実に判断することができる。例えばベイヤー配列の場合には、隣接するR,Bからの電荷の漏れに影響されて、ライン間のGに感度差を生じることがあるが、このような段差を検出することが可能となる。   In addition, using the fact that the positional relationship of the pixels causing the sensitivity difference is known, statistics are taken separately for each position, and the results are compared with each other, so it is certain whether there is a sensitivity difference. Can be judged. For example, in the case of a Bayer array, a sensitivity difference may occur in G between lines due to the leakage of charges from adjacent R and B, but such a step can be detected.

さらに、画素数を減らして結果を記録する場合には、最終的に感度差に起因する副作用が目立たなくなることを利用して、感度差判定処理をスキップしているために、処理の効率を向上させている。   Furthermore, when recording the results with a reduced number of pixels, the sensitivity difference determination process is skipped by taking advantage of the fact that side effects due to sensitivity differences will eventually become inconspicuous, thus improving the processing efficiency. I am letting.

図13から図16は本発明の実施例3を示したものであり、図13はデジタルカメラの構成を示すブロック図、図14は補正回路により処理を行う際に用いる画素の番号を示す図、図15は補正回路の処理を示すフローチャート、図16はコンピュータにより行われるソフト処理を示すフローチャートである。   FIGS. 13 to 16 show a third embodiment of the present invention, FIG. 13 is a block diagram showing the configuration of a digital camera, and FIG. 14 is a diagram showing pixel numbers used when processing is performed by a correction circuit. FIG. 15 is a flowchart showing processing of the correction circuit, and FIG. 16 is a flowchart showing software processing performed by the computer.

この実施例3において、上述の実施例1,2と同様である部分については同一の符号を付して説明を省略し、主として異なる点についてのみ説明する。   In the third embodiment, the same parts as those in the first and second embodiments are denoted by the same reference numerals, description thereof is omitted, and only different points will be mainly described.

この実施例3は、上述した実施例1と同様に、画像処理装置をデジタルカメラに適用したものである。   In the third embodiment, as in the first embodiment described above, the image processing apparatus is applied to a digital camera.

この実施例3のデジタルカメラ31は、該実施例1のデジタルカメラ1に対して、補間後補正手段たる補正回路32を、カラー画像バッファ8と画質調整回路9との間に付加したものとなっている。   In the digital camera 31 of the third embodiment, a correction circuit 32 as post-interpolation correction means is added between the color image buffer 8 and the image quality adjustment circuit 9 with respect to the digital camera 1 of the first embodiment. ing.

次に、このようなデジタルカメラ31の作用を、上述した実施例1と異なる点を主として説明する。   Next, the operation of the digital camera 31 will be described mainly with respect to differences from the first embodiment.

シャッタボタンがユーザーにより押下されると、上記実施例1と同様に、光学系2による光学像が単板ベイヤー配列CCD3により撮像されて、各画素当たり一種類の色成分しかない単板状態の画像が単板画像バッファ4に記憶される。   When the shutter button is pressed by the user, an optical image by the optical system 2 is picked up by the single-plate Bayer array CCD 3 as in the first embodiment, and an image in a single-plate state having only one kind of color component for each pixel. Is stored in the single-panel image buffer 4.

次に、ライン補正回路5およびWB補正回路6が動作するが、その作用は上記実施例1と同様であり、ライン間の感度補正を行いながらホワイトバランス係数Crg,Cbgを算出して保持する。   Next, the line correction circuit 5 and the WB correction circuit 6 operate. The operation is the same as in the first embodiment, and the white balance coefficients Crg and Cbg are calculated and held while performing sensitivity correction between lines.

続いて、補間回路7が、単板画像バッファ4内の各画素に対して補間処理を行うが、これも実施例1と同様であり、各画素の欠落色成分が補われたカラー画像が、カラー画像バッファ8に得られる。   Subsequently, the interpolation circuit 7 performs an interpolation process on each pixel in the single-plate image buffer 4, which is also the same as in the first embodiment, and a color image in which the missing color component of each pixel is compensated is Obtained in the color image buffer 8.

その後に、補正回路32が処理を行う。この補正回路32は、カラー画像バッファ8中の各画素を順にスキャンして、各画素の3×3画素でなる近傍を読み出し、図15に示すような処理を行うことにより、中央画素の補正RGB値を画質調整回路9に出力するものである。   Thereafter, the correction circuit 32 performs processing. This correction circuit 32 scans each pixel in the color image buffer 8 in order, reads the neighborhood of each pixel consisting of 3 × 3 pixels, and performs the process shown in FIG. The value is output to the image quality adjustment circuit 9.

以下では、図15のフローチャートの各ステップについて説明する。   Below, each step of the flowchart of FIG. 15 is demonstrated.

処理を開始すると、3×3画素でなる近傍内の各画素に対して、RGB成分から輝度値Yを計算する(ステップS71)。この輝度値の計算には、次のような標準的な定義式、
Yj =0.3×Rj +0.6×Gj +0.1×Bj
を用いる。なお、各画素に対しては、図14に示すような番号が割り振られる。以下では、各画素に関する値を、その画素番号の沿え字を用いてj=0〜8などと表すことにする。
When the process is started, the luminance value Y is calculated from the RGB components for each pixel in the vicinity of 3 × 3 pixels (step S71). This brightness value is calculated using the following standard definition formula:
Yj = 0.3 × Rj + 0.6 × Gj + 0.1 × Bj
Is used. Each pixel is assigned a number as shown in FIG. Below, the value regarding each pixel will be represented as j = 0-8 etc. using the horizontal letter of the pixel number.

次に、中央画素と周辺画素との輝度差(これは、注目画素の画素値と近傍画素の画素値との相関を示している。)を
dYj =|Y0−Yj |
として計算する(ステップS72)。ここにjは、1から8の整数である。
Next, the luminance difference between the central pixel and the peripheral pixels (this indicates the correlation between the pixel value of the pixel of interest and the pixel values of neighboring pixels).
dYj = | Y0-Yj |
(Step S72). Here, j is an integer from 1 to 8.

そして、以下の条件(1),(2)、
(1)dYk1はdY0 からdY8 の内で一番小さい
(2)dYk2はdY0 からdY8 の内で2番目に小さい
を満たすような整数k1,k2を探す(ステップS73)。
And the following conditions (1), (2),
(1) dYk1 is the smallest among dY0 to dY8. (2) Integers k1 and k2 are searched such that dYk2 satisfies the second smallest among dY0 to dY8 (step S73).

次に、所定の閾値T1,T2に対して、dYk1がT1よりも大きく、かつdYk2−dYk1がT2よりも小さくなるか否かを調べる(ステップS74)。この条件は、満たされた場合に、中央画素が孤立点であると知覚される確率が高いことを示す条件となっている。   Next, it is checked whether or not dYk1 is larger than T1 and dYk2−dYk1 is smaller than T2 with respect to predetermined threshold values T1 and T2 (step S74). This condition is a condition indicating that, when the condition is satisfied, the probability that the central pixel is perceived as an isolated point is high.

ここで、条件が満たされて孤立点と判断された場合には、中央画素に対する補正値(R0’,G0’,B0’)を、以下の数式14によって計算して、
[数14]
R0’=(Rk1+Rk2)/2
G0’=(Gk1+Gk2)/2
B0’=(Bk1+Bk2)/2
この計算結果を出力し終了する(ステップS75)。
Here, when the condition is satisfied and it is determined as an isolated point, the correction value (R0 ′, G0 ′, B0 ′) for the central pixel is calculated by the following formula 14,
[Formula 14]
R0 '= (Rk1 + Rk2) / 2
G0 '= (Gk1 + Gk2) / 2
B0 '= (Bk1 + Bk2) / 2
The calculation result is output and the process ends (step S75).

一方、上記ステップS74において、条件が満たされていない場合には、中央画素のRGB画素値を無補正のまま出力して(ステップS76)、終了する。   On the other hand, if the condition is not satisfied in step S74, the RGB pixel value of the central pixel is output without correction (step S76), and the process ends.

こうして画質調整回路9に出力された補正RGB値は、上述した実施例1と同様に、画質調整回路9で調整された後に記録回路10により記録され、全ての処理が終了する。   The corrected RGB values output to the image quality adjustment circuit 9 in this way are adjusted by the image quality adjustment circuit 9 and then recorded by the recording circuit 10 as in the first embodiment, and all the processes are completed.

なお、上述では、画像処理装置であるデジタルカメラ31の内部のハードウェア(回路等)により処理を行うようにしているが、このような処理を、PC(パーソナルコンピュータ)等のコンピュータ上で画像処理プログラムにより行うようにすることも可能である。   In the above description, processing is performed by hardware (circuit or the like) inside the digital camera 31 that is an image processing apparatus. Such processing is performed on a computer such as a PC (personal computer). It is also possible to do this programmatically.

このソフトウェアは、上述した実施例2において図10〜図12を参照して説明したものと同様に、メモリInImgに記憶されている画像、つまり、単板ベイヤー配列CCD3により得られた直後の、各画素で一種類の色成分しか得られていない画像、を処理して、メモリOutImgに3色カラー画像を出力するものである。ただし、ホワイトバランス係数Cr,Cbおよびライン間のゲイン補正係数a,bは、パラメータとして与えられるものとする。   This software is the same as that described with reference to FIG. 10 to FIG. 12 in the above-described second embodiment, and each of the images stored in the memory InImg, that is, immediately after being obtained by the single-plate Bayer array CCD3. An image in which only one type of color component is obtained by a pixel is processed, and a three-color image is output to the memory OutImg. However, the white balance coefficients Cr and Cb and the gain correction coefficients a and b between the lines are given as parameters.

以下では、図16のフローチャートの各ステップについて説明する。この図16は、ソフト処理の流れを示したものである。   Hereinafter, each step of the flowchart of FIG. 16 will be described. FIG. 16 shows the flow of software processing.

この処理を開始すると、まず、補間処理における中間結果を保持しておくためのメモリtmpimgを確保する(ステップS81)。   When this processing is started, first, a memory tmpimg for holding an intermediate result in the interpolation processing is secured (step S81).

次に、メモリInImg内に未処理の画素が存在するか否かを判断する(ステップS82)。   Next, it is determined whether or not an unprocessed pixel exists in the memory InImg (step S82).

ここで、未処理の画素が存在する場合には、該未処理の画素の内の1つを処理対象画素として決定し、この処理対象画素を中心とした5×5画素でなるブロックを上記メモリInImgから読み出す(ステップS83)。   Here, when there is an unprocessed pixel, one of the unprocessed pixels is determined as a processing target pixel, and a block of 5 × 5 pixels centering on the processing target pixel is stored in the memory. Read from InImg (step S83).

そして、メモリInImgから読み出したブロック内の画素に対して、上記数式8による計算を行うことによりライン間補正を行うとともに、上記数式9による計算を行うことによりWB補正を行う(ステップS84)。   Then, the inter-line correction is performed on the pixels in the block read from the memory InImg by performing the calculation according to the above formula 8, and the WB correction is performed by performing the calculation according to the above formula 9 (step S84).

続いて、公知の方法により補間処理を行って、各画素についてRGBの3色成分を生成する(ステップS85)。   Subsequently, interpolation processing is performed by a known method to generate RGB three-color components for each pixel (step S85).

その後、補間処理の結果をtmpimg内の対応画素位置に記録して(ステップS86)、上記ステップS82に戻り他の画素の処理に移行する。   Thereafter, the result of the interpolation process is recorded at the corresponding pixel position in tmpimg (step S86), and the process returns to step S82 to shift to the process of another pixel.

一方、上記ステップS82において、メモリInImg内に未処理の画素が存在しない場合には、さらに、メモリtmpimg内に補正処理を受けていない画素が存在するか否かを判断する(ステップS87)。   On the other hand, if there is no unprocessed pixel in the memory InImg in step S82, it is further determined whether or not there is a pixel that has not undergone correction processing in the memory tmpimg (step S87).

ここで、補正処理が行われていない画素が存在する場合には、この未補正処理の画素を中心とした3×3画素でなる近傍のデータをメモリtmpimgから読み出して(ステップS88)、上記図15に示したような補正処理を行い(ステップS89)、この補正処理の結果をメモリOutImgの対応画素位置に記録してから(ステップS90)、上記ステップS87へ戻って次の未処理の画素の処理へ移行する。   Here, if there is a pixel that has not been subjected to correction processing, neighboring data consisting of 3 × 3 pixels centered on the uncorrected pixel is read from the memory tmpimg (step S88), and 15 is performed (step S89), the result of this correction process is recorded in the corresponding pixel position of the memory OutImg (step S90), and the process returns to step S87 to return to the next unprocessed pixel. Transition to processing.

また、上記ステップS87において、メモリtmpimg内に補正処理を受けていない画素が存在しない場合には、tmpimgとして確保していたメモリ領域を開放してから(ステップS91)、終了する。   In step S87, if there is no pixel that has not undergone correction processing in the memory tmpimg, the memory area secured as tmpimg is released (step S91), and the process ends.

なお、この実施例は幾つかの変形が可能である。好ましい変形例の一つは、補間回路7が単板画像バッファ4に保持される画像よりも画素数の少ない画像を生成する機能を有するものであって、該機能を働かせる場合に、補正回路32の処理をスキップすることである。画素数を少なくして出力するモードは、上述したように、デジタルカメラにおいては標準的に備えられたものであり、この場合には、補間回路7が単板画像バッファ4から画素を間引いて読み出しながら処理することになる。すると、G画素に感度差があっても処理結果への影響が少なくなるために、間引き率に応じて(つまり、縮小率が所定の閾値以下である場合に)補正回路32の処理を中止するようにすることで、画質に影響を及ぼすことなく、処理効率を向上し消費電力を低減することが可能となる。   This embodiment can be modified in several ways. One preferred modification is one in which the interpolation circuit 7 has a function of generating an image having a smaller number of pixels than the image held in the single-plate image buffer 4, and the correction circuit 32 is used when the function is used. Is to skip the process. As described above, the mode for outputting with a reduced number of pixels is provided in a digital camera as standard, and in this case, the interpolation circuit 7 reads out the pixels from the single-plate image buffer 4 and reads them out. Will be processed. Then, even if there is a difference in sensitivity between the G pixels, the influence on the processing result is reduced. Therefore, the processing of the correction circuit 32 is stopped according to the thinning rate (that is, when the reduction rate is equal to or less than a predetermined threshold). By doing so, it is possible to improve processing efficiency and reduce power consumption without affecting image quality.

また、本実施例では単板撮像系を例に挙げたが、二板撮像系や三板画素ずらし撮像系に対しても、各方式に応じた補間処理でカラー画像を得た後に、同様の補正処理を行うことが可能である。   In this embodiment, a single-plate imaging system is used as an example. However, for a two-plate imaging system and a three-plate pixel shifted imaging system, the same correction is performed after obtaining a color image by interpolation processing according to each method. Processing can be performed.

このような実施例3によれば、上述した実施例1,2とほぼ同様の効果を奏するとともに、画素間の感度差によって生じる可能性がある副作用を、補間処理を感度差に応じて変更して防ぐのではなく、補間処理後に生じる可能性のありそうな副作用のパターンを直接補正するようにしたために、画質の改善をより簡易的に行うことができる。   According to the third embodiment, the effects similar to those of the first and second embodiments described above are obtained, and the side effects that may be caused by the sensitivity difference between the pixels are changed according to the sensitivity difference. However, since the side effect pattern that may occur after the interpolation process is directly corrected, the image quality can be improved more easily.

また、近傍画素と注目画素とが調和しているか否かを、相関により調べて、調和度の高い近傍画素の画素値を注目画素の画素値に混合するようにしているために、副作用を良好に減らすことができる。   In addition, by examining whether or not the neighboring pixel and the target pixel are in harmony with each other by correlation, the pixel value of the neighboring pixel having a high degree of harmony is mixed with the pixel value of the target pixel, so side effects are good. Can be reduced.

さらに、画素数を減らして結果を記録する場合には、最終的に感度差に起因する副作用が目立たなくなることを利用して、補間後の補正処理をスキップしているために、処理の効率を向上することができる。   Furthermore, when the result is recorded with the number of pixels reduced, the side effect caused by the sensitivity difference is finally inconspicuous, and the correction processing after interpolation is skipped, so the processing efficiency is improved. Can be improved.

図17から図25は本発明の実施例4を示したものであり、図17はデジタルカメラの構成を示すブロック図、図18は段差補正回路の一構成例を示すブロック図、図19はG段差を説明するための図、図20は段差補正回路の処理を示すフローチャート、図21は段差補正回路における処理を行う際の近傍の例を示す図、図22は補正量△を求めるための関数の例を示す線図、図23は段差補正回路の他の構成例を示すブロック図、図24は組み合わせ平均計算回路により計算される組み合わせ平均を説明するための図、図25はコンピュータにより行われるソフト処理を示すフローチャートである。   FIGS. 17 to 25 show a fourth embodiment of the present invention, FIG. 17 is a block diagram showing the configuration of a digital camera, FIG. 18 is a block diagram showing a configuration example of a step correction circuit, and FIG. FIG. 20 is a flowchart illustrating the process of the step correction circuit, FIG. 21 is a diagram illustrating an example of the vicinity when performing the process in the step correction circuit, and FIG. 22 is a function for obtaining the correction amount Δ. FIG. 23 is a block diagram showing another configuration example of the step correction circuit, FIG. 24 is a diagram for explaining the combination average calculated by the combination average calculation circuit, and FIG. 25 is performed by a computer. It is a flowchart which shows a software process.

この実施例4において、上述の実施例1〜3と同様である部分については同一の符号を付して説明を省略し、主として異なる点についてのみ説明する。   In the fourth embodiment, parts similar to those of the first to third embodiments are denoted by the same reference numerals, description thereof is omitted, and only different points will be mainly described.

この実施例4は、上述した実施例1と同様に、画像処理装置をデジタルカメラに適用したものである。   In the fourth embodiment, as in the first embodiment described above, the image processing apparatus is applied to a digital camera.

この実施例4のデジタルカメラ41は、図17に示すように、該実施例1のデジタルカメラ1に対して、ライン補正回路5に代えて段差補正回路43とノイズ低減回路44とを設けたものとなっている。また、単板ベイヤー配列CCD3と単板画像バッファ4との間には、該単板ベイヤー配列CCD3から出力されるアナログの映像信号をゲイン調整してからデジタルの映像信号に変換するためのA/D変換回路42が明示して設けられているが、これは上述した第1から第3の実施例のデジタルカメラにおいても同様に設けられていて、ただ単に図示を省略していただけのものである。そして、これらA/D変換回路42、段差補正回路43、およびノイズ低減回路44は、上記制御回路11により制御されるようになっている。   As shown in FIG. 17, the digital camera 41 of the fourth embodiment is provided with a step correction circuit 43 and a noise reduction circuit 44 instead of the line correction circuit 5 with respect to the digital camera 1 of the first embodiment. It has become. Further, between the single-plate Bayer array CCD 3 and the single-plate image buffer 4, an analog video signal output from the single-plate Bayer array CCD 3 is gain-adjusted and then converted into a digital video signal. Although the D conversion circuit 42 is clearly provided, this is similarly provided in the digital cameras of the first to third embodiments described above, and is simply omitted from illustration. . The A / D conversion circuit 42, the step correction circuit 43, and the noise reduction circuit 44 are controlled by the control circuit 11.

上記段差補正回路43は、単板画像バッファ4内に記憶されている画像に対して、G成分の感度差補正を行うためのものである。   The step correction circuit 43 is for correcting the sensitivity difference of the G component with respect to the image stored in the single-plate image buffer 4.

上記ノイズ低減回路44は、この段差補正回路43から出力される信号にノイズ低減処理を行うためのものである。   The noise reduction circuit 44 is for performing noise reduction processing on the signal output from the step correction circuit 43.

上記段差補正回路43は、より詳しくは図18に示すように、補正回路51と、平均計算回路52と、段差量推定回路53と、補正量算出回路54と、を有して構成されている。   More specifically, as shown in FIG. 18, the step correction circuit 43 includes a correction circuit 51, an average calculation circuit 52, a step amount estimation circuit 53, and a correction amount calculation circuit 54. .

上記平均計算回路52は、上記単板画像バッファ4から所定サイズのブロック単位で画像データを読み出して、注目画素以外のG成分の平均値を算出するものである。   The average calculation circuit 52 reads image data in units of a predetermined size block from the single-plate image buffer 4 and calculates an average value of G components other than the target pixel.

上記段差量推定回路53は、上記平均計算回路52により算出された平均値と、注目画素のG成分値と、の差を算出することにより、感度差の量を推定するものである。   The step amount estimation circuit 53 estimates the amount of sensitivity difference by calculating the difference between the average value calculated by the average calculation circuit 52 and the G component value of the target pixel.

上記補正量算出回路54は、上記単板画像バッファ4から読み出したブロック単位の画像データから特徴量を算出し、該特徴量に基づいて閾値を求め、この閾値と、上記段差量推定回路53により推定されたG成分の感度差の量と、に基づいて、上記単板画像バッファ4からブロック単位で読み出した画像データの感度差補正量を計算するものである。   The correction amount calculation circuit 54 calculates a feature amount from the block-unit image data read from the single-panel image buffer 4, obtains a threshold value based on the feature amount, and the threshold value and the step amount estimation circuit 53 Based on the estimated sensitivity difference amount of the G component, the sensitivity difference correction amount of the image data read out from the single-panel image buffer 4 in units of blocks is calculated.

上記補正回路51は、上記補正量算出回路54により計算された感度差補正量に基づいて、注目画素のG成分値を感度差補正し、上記ノイズ低減回路44へ出力するものである。   The correction circuit 51 corrects the sensitivity difference of the G component value of the pixel of interest based on the sensitivity difference correction amount calculated by the correction amount calculation circuit 54 and outputs it to the noise reduction circuit 44.

このようなデジタルカメラ41の作用について、上述した各実施例と異なる部分を説明する。   Regarding the operation of such a digital camera 41, a different part from each Example mentioned above is demonstrated.

段差補正回路43は、単板画像バッファ4の各画素毎に、近傍3×3サイズのブロック領域を読み出す。そして、読み出した3×3サイズのブロック領域の中心に位置する画素を注目画素とする。該段差補正回路43は、注目画素の色成分がG成分である場合にのみ、以下に示すように段差補正処理を行うようになっている。   The level difference correction circuit 43 reads a neighboring 3 × 3 block area for each pixel of the single-panel image buffer 4. Then, the pixel located at the center of the read 3 × 3 size block area is set as the target pixel. The step correction circuit 43 performs the step correction processing as described below only when the color component of the target pixel is the G component.

また、ここで、図19を参照して、G段差について説明する。単板ベイヤー配列CCD3は、図19(A)に示すような色フィルタ配列を有しているが、センサの特性上、ある撮影条件下では、図中の奇数行目のG画素(Grと記載している)と、偶数行目のG画素(Gbと記載している)と、の間に、同じG成分取得用であるにも関わらず、感度差が付いてしまうことがある。すなわち、例えば全ての画素について「128」の出力値が得られるような平坦な被写体を撮影した場合でも、図19(B)に示すように、Grからは「180」の画素値が得られ、Gbからは「100」の画素値が得られて、GrとGbとの画素値に差が生じてしまうことがある。このような差のことを、以下ではG段差と呼ぶことにする。   Here, the G step will be described with reference to FIG. The single-plate Bayer array CCD3 has a color filter array as shown in FIG. 19A. However, due to the characteristics of the sensor, the G pixels (denoted as Gr) in the odd-numbered rows in the figure under certain shooting conditions. ) And G pixels (denoted as Gb) in even-numbered rows, there may be a difference in sensitivity even though the same G component acquisition is performed. That is, for example, even when a flat subject that captures an output value of “128” is obtained for all pixels, a pixel value of “180” is obtained from Gr, as shown in FIG. A pixel value of “100” is obtained from Gb, and there may be a difference between the pixel values of Gr and Gb. Such a difference is hereinafter referred to as a G step.

段差補正回路43は、図20に示したような流れに沿って、このG段差を補正して、補正された画素値を出力するようになっている。   The level difference correction circuit 43 corrects this G level difference along the flow shown in FIG. 20 and outputs a corrected pixel value.

すなわち、段差補正回路43は、図20に示す処理を開始すると、まず、読み出した近傍ブロックの中心画素がGrまたはGbの何れかであるか否かを判断する(S101)。   That is, when the process shown in FIG. 20 is started, the level difference correction circuit 43 first determines whether or not the central pixel of the read neighboring block is either Gr or Gb (S101).

ここで、中心画素がGrまたはGbの何れかである場合には、平均計算回路52が、次の数式15に示すように、図21に示すような画素配列の4隅に位置するG画素G0〜G3の平均値Ag(特徴量)を算出して、段差量推定回路53へ出力する。
[数15]
Ag=(G0+G1+G2+G3)/4
段差量推定回路53は、上記平均計算回路52により算出された平均値Agと、近傍ブロックの中心画素G4の値との差を、次の数式16に示すように感度差の量たる段差量dとして算出し、算出した段差量dを補正量算出回路54へ出力する(S102)。
[数16]
d=Ag−G4
補正量算出回路54は、まず、近傍ブロックに含まれるR画素の平均値R’(特徴量)とB画素の平均値B’(特徴量)とを算出する。そして、補正量算出回路54は、これらの平均値R’,B’をインデックスにして、該補正量算出回路54の内部ROMに記憶されている予測テーブル(ルックアップテーブル:LUT)を参照することにより、適切な段差補正を行うための補正量の閾値F(感度差の量)を求める(S103)。なお、上記予測テーブルは、種々の照明条件で種々の被写体を撮影した際の、Gr画素とGb画素との間に生じた段差量の上限値と、周囲のR画素値およびB画素値と、の関係を予め整理して作成されたものである。
Here, when the central pixel is either Gr or Gb, the average calculation circuit 52 is the G pixel G0 located at the four corners of the pixel array as shown in FIG. The average value Ag (feature value) of .about.G3 is calculated and output to the step amount estimation circuit 53.
[Equation 15]
Ag = (G0 + G1 + G2 + G3) / 4
The step amount estimation circuit 53 calculates the difference between the average value Ag calculated by the average calculation circuit 52 and the value of the central pixel G4 of the neighboring block as a step amount d as an amount of sensitivity difference as shown in the following Expression 16. The calculated step amount d is output to the correction amount calculation circuit 54 (S102).
[Equation 16]
d = Ag-G4
First, the correction amount calculation circuit 54 calculates an average value R ′ (feature amount) of R pixels and an average value B ′ (feature amount) of B pixels included in the neighboring block. The correction amount calculation circuit 54 refers to a prediction table (lookup table: LUT) stored in the internal ROM of the correction amount calculation circuit 54 using the average values R ′ and B ′ as indexes. Thus, a correction amount threshold F (amount of sensitivity difference) for performing appropriate step correction is obtained (S103). The prediction table includes an upper limit value of a step amount generated between the Gr pixel and the Gb pixel when shooting various subjects under various illumination conditions, surrounding R pixel values and B pixel values, These relationships are created in advance.

次に、補正量算出回路54は、上述したように算出した補正量の閾値Fと、上記段差量推定回路53により推定された段差量dと、に基づいて、G段差を実際に補正するために適切な補正量△(感度差補正量)を算出する(S104)。この算出も、該補正量算出回路54の内部ROMに記憶されているテーブルを参照することにより、行うようになっている。この内部ROMに記憶されているテーブルは、例えば、図22に示すような関数f(所定の関数)を離散近似して作成されたテーブルとなっている。この関数f(x;p)は、pをパラメータとする独立変数xの関数であり、|x|がp以下のときにf(x;p)=x、|x|がαp(閾値)以上のときに0となるような関数である。なお、|x|がpよりも大きく、αp(閾値)よりも小さいときには、これらを連続に結ぶ(例えば直線で結ぶ)ような関数形状となっている。ここに、|x|はxの絶対値を示し、αは予め定められた1以上の定数となっている。補正量算出回路54は、このような関数fに対応するテーブルをx=d,p=Fとして参照することにより、実質的に△=f(d;F)として補正量△を求め、求めた補正量△を上記補正回路51へ出力する。   Next, the correction amount calculation circuit 54 actually corrects the G step based on the correction amount threshold F calculated as described above and the step amount d estimated by the step amount estimation circuit 53. An appropriate correction amount Δ (sensitivity difference correction amount) is calculated (S104). This calculation is also performed by referring to a table stored in the internal ROM of the correction amount calculation circuit 54. The table stored in the internal ROM is, for example, a table created by discrete approximation of a function f (predetermined function) as shown in FIG. This function f (x; p) is a function of the independent variable x having p as a parameter. When | x | is less than or equal to p, f (x; p) = x, and | x | is equal to or greater than αp (threshold). It is a function that becomes 0 at the time. When | x | is larger than p and smaller than αp (threshold), the function shape is such that these are connected continuously (for example, connected by a straight line). Here, | x | indicates the absolute value of x, and α is a predetermined constant of 1 or more. The correction amount calculation circuit 54 obtains the correction amount Δ substantially by setting Δ = f (d; F) by referring to the table corresponding to the function f as x = d, p = F. The correction amount Δ is output to the correction circuit 51.

続いて、補正回路51は、次の数式17に示すように、上記補正量算出回路54から得られた補正量△の半分を、中央画素値G4から減算して最終的な段差補正値G4’を算出し、
[数17]
G4’=G4−△/2
その後に、この値G4’を中央画素値として、上記ノイズ低減回路44へ出力する(S105)。
Subsequently, the correction circuit 51 subtracts half of the correction amount Δ obtained from the correction amount calculation circuit 54 from the central pixel value G4, as shown in the following Expression 17, to obtain a final step correction value G4 ′. To calculate
[Equation 17]
G4 ′ = G4-Δ / 2
Thereafter, the value G4 ′ is output as the central pixel value to the noise reduction circuit 44 (S105).

仮に、被写体が平坦な場合で、図21に示したブロックにおける近傍G0〜G3が同じ値V1をとるものとし、中央画素G4が値V2をとるとすると、上記S102により算出される段差量dはV2−V1となる。このV2−V1の絶対値がS103で計算される閾値F以下である場合には、上記S105により算出される補正量△はV2−V1に一致する。従って、S105で算出されるG4’の値は、V2−(V2−V1)/2=(V1+V2)/2となる。このように、段差量が閾値Fよりも小さい場合には、補正結果はGr画素の画素値とGb画素の画素値との平均値に近付くように補正されるのが、本実施例におけるG段差補正処理の特徴となっている。   If the subject is flat and the neighborhoods G0 to G3 in the block shown in FIG. 21 have the same value V1, and the central pixel G4 has the value V2, the step amount d calculated in S102 is V2-V1. When the absolute value of V2-V1 is equal to or smaller than the threshold value F calculated in S103, the correction amount Δ calculated in S105 matches V2-V1. Therefore, the value of G4 ′ calculated in S105 is V2− (V2−V1) / 2 = (V1 + V2) / 2. As described above, when the step amount is smaller than the threshold value F, the correction result is corrected so as to approach the average value of the pixel value of the Gr pixel and the pixel value of the Gb pixel. This is a feature of correction processing.

また、上記S101において、中心画素がGrとGbとの何れでもないと判断された場合には、中央画素の画素値をそのままノイズ低減回路44へ出力する(S106)。   If it is determined in S101 that the central pixel is neither Gr nor Gb, the pixel value of the central pixel is output to the noise reduction circuit 44 as it is (S106).

こうして、上記S105またはS106の処理が行われたところで、このG段差補正の処理を終了する。   Thus, when the process of S105 or S106 is performed, the G level difference correction process is terminated.

段差補正回路43により上述したような処理が行われると、ノイズ低減回路44には、単板画像バッファ4の各画素に対してG段差補正を行った後の画素値が順次入力される。ノイズ低減回路44は、単板ベイヤー配列CCD3の特性に起因するノイズ低減処理を行って、結果をWB補正回路6へ出力する。   When the above-described processing is performed by the step correction circuit 43, the pixel values after performing the G step correction on each pixel of the single-plate image buffer 4 are sequentially input to the noise reduction circuit 44. The noise reduction circuit 44 performs noise reduction processing due to the characteristics of the single-plate Bayer array CCD 3 and outputs the result to the WB correction circuit 6.

その後の処理は、上述した実施例1と同様である。   Subsequent processing is the same as that in the first embodiment.

なお、本実施例は、多くの変形例が考えられる。例えば、WB補正回路6やノイズ低減回路44と段差補正回路43の処理の順番は、上述したものに限られるものではなく、任意の順番となるように変更することが可能である。   In addition, many modifications can be considered for this embodiment. For example, the processing order of the WB correction circuit 6, the noise reduction circuit 44, and the step correction circuit 43 is not limited to that described above, and can be changed to an arbitrary order.

また、回路を簡単化するための変形例としては、段差補正回路43による処理S103において、閾値Fを、近傍画素の特徴量に基づいて予測する代わりに、固定値にすることが考えられる。この場合には、補正量算出回路54の内部ROMには、テーブルの代わりに、固定値が記憶されることになる。単板ベイヤー配列CCD3の特性によっては、このような手段を用いても実用可能範囲内となる。   As a modification for simplifying the circuit, in step S103 by the step correction circuit 43, the threshold value F may be set to a fixed value instead of being predicted based on the feature amount of the neighboring pixels. In this case, a fixed value is stored in the internal ROM of the correction amount calculation circuit 54 instead of the table. Depending on the characteristics of the single-plate Bayer array CCD 3, even if such a means is used, it is within the practical range.

あるいは、段差補正回路43を、図23に示すように構成しても良い。この図23に示す構成例では、段差補正回路43は、補正回路51と、組み合わせ平均計算回路56と、差分選択回路57と、補正量算出回路54と、を有して構成されている。つまり、この図23に示す構成は、上記図18に示した構成における平均計算回路52および段差量推定回路53に代えて、組み合わせ平均計算回路56および差分選択回路57を設けた構成になっている。   Alternatively, the step correction circuit 43 may be configured as shown in FIG. In the configuration example shown in FIG. 23, the level difference correction circuit 43 includes a correction circuit 51, a combination average calculation circuit 56, a difference selection circuit 57, and a correction amount calculation circuit 54. That is, the configuration shown in FIG. 23 is a configuration in which a combination average calculation circuit 56 and a difference selection circuit 57 are provided instead of the average calculation circuit 52 and the step amount estimation circuit 53 in the configuration shown in FIG. .

上記組み合わせ平均計算回路56は、3×3近傍に含まれるG画素のペアの特定の組み合わせを選択するセレクタと、このセレクタにより順次選択される各ペアの平均を算出する回路と、を備えて構成されている。この組み合わせ平均計算回路56により選択される組み合わせペアとその平均値とは、例えば図24に示すようなA0〜A5(特徴量)、つまり、次の数式18に示すようなA0〜A5、
[数18]
A0=(G0+G1)/2
A1=(G0+G2)/2
A2=(G1+G3)/2
A3=(G2+G3)/2
A4=(G1+G2)/2
A5=(G0+G3)/2
となる。こうして組み合わせ平均計算回路56により算出された各平均値A0〜A5は、差分選択回路57へ出力される。
The combination average calculation circuit 56 includes a selector that selects a specific combination of G pixel pairs included in the vicinity of 3 × 3, and a circuit that calculates the average of each pair sequentially selected by the selector. Has been. The combination pair selected by the combination average calculation circuit 56 and the average value thereof are, for example, A0 to A5 (features) as shown in FIG.
[Equation 18]
A0 = (G0 + G1) / 2
A1 = (G0 + G2) / 2
A2 = (G1 + G3) / 2
A3 = (G2 + G3) / 2
A4 = (G1 + G2) / 2
A5 = (G0 + G3) / 2
It becomes. The average values A0 to A5 calculated by the combination average calculation circuit 56 are output to the difference selection circuit 57.

差分選択回路57は、組み合わせ平均計算回路56から受け取った各平均値A0〜A5と中心画素値G4との差Di =G4−Ai (iは0から5までの整数)をそれぞれ計算して、これらの中から絶対値が最小となるDi を、上記図20のS102における段差量dに相当する量として、補正量算出回路54へ出力する。その後の補正量算出回路54の処理および補正回路51の処理は、上述と同様である。   The difference selection circuit 57 calculates the difference Di = G4-Ai (i is an integer from 0 to 5) between the average values A0 to A5 and the central pixel value G4 received from the combination average calculation circuit 56, respectively. Di having the smallest absolute value is output to the correction amount calculation circuit 54 as an amount corresponding to the step amount d in S102 of FIG. The subsequent processing of the correction amount calculation circuit 54 and the processing of the correction circuit 51 are the same as described above.

なお、上述では、画像処理装置であるデジタルカメラ41の内部のハードウェア(回路等)により処理を行うようにしているが、このような処理を、PC(パーソナルコンピュータ)等のコンピュータ上で画像処理プログラムにより行うようにすることも可能である。   In the above description, processing is performed by hardware (circuit or the like) inside the digital camera 41 that is an image processing apparatus. However, such processing is performed on a computer such as a PC (personal computer). It is also possible to do this programmatically.

このソフトウェアは、単板ベイヤー配列CCD3からのアナログ出力をデジタル信号に変換して得られたRAWデータファイルに対して、現像処理を行うものとなっている。   This software performs development processing on a RAW data file obtained by converting an analog output from the single-plate Bayer array CCD 3 into a digital signal.

以下では、図25のフローチャートの各ステップについて説明する。この図25は、ソフト処理の流れを示したものである。   Below, each step of the flowchart of FIG. 25 is demonstrated. FIG. 25 shows the flow of software processing.

なお、この処理を行うに当たって、例えばPCのメモリ領域に、作業用の記憶領域として、第1バッファと第2バッファとが確保されているものとする。   In performing this process, it is assumed that, for example, a first buffer and a second buffer are secured as working storage areas in the memory area of the PC.

この処理を開始すると、まず、RAWデータファイルから、単板状態の画像データを読み込んで、第1バッファに2次元配列として格納する(S111)。   When this process is started, first, image data in a single plate state is read from the RAW data file and stored as a two-dimensional array in the first buffer (S111).

次に、第1バッファをまず行方向にスキャンし、次に列方向にスキャンすることにより、画像データ内に未処理画素が存在するか否かを判断する(S112)。   Next, the first buffer is first scanned in the row direction, and then in the column direction to determine whether or not there is an unprocessed pixel in the image data (S112).

ここで、未処理画素がある場合には、選択した未処理画素の近傍3×3ブロックを第1バッファから読み出して(S113)、上記図20に示したような段差補正処理を行う(S114)。   Here, if there is an unprocessed pixel, the neighborhood 3 × 3 block of the selected unprocessed pixel is read from the first buffer (S113), and the step correction process as shown in FIG. 20 is performed (S114). .

そして、段差補正結果を、第1バッファとは別に確保された第2バッファ内の未処理画素に対応するアドレスに書き込んでから(S115)、上記S112へ戻って次の未処理画素に対する判断を行う。   Then, the step correction result is written in the address corresponding to the unprocessed pixel in the second buffer secured separately from the first buffer (S115), and the process returns to S112 to make a determination for the next unprocessed pixel. .

一方、上記S112において、第1バッファ内に未処理画素がないと判断された場合には、第2バッファの画像に対してノイズ低減処理を行い、その処理結果を第1バッファへ出力する(S116)。   On the other hand, if it is determined in S112 that there is no unprocessed pixel in the first buffer, noise reduction processing is performed on the image in the second buffer, and the processing result is output to the first buffer (S116). ).

次に、この第1バッファの画像に対して、ホワイトバランス(WB)を補正する処理を行って、その結果を再び第1バッファへ出力する(S117)。   Next, processing for correcting white balance (WB) is performed on the image in the first buffer, and the result is output again to the first buffer (S117).

さらに、第1バッファの画像に対して、欠落色成分の補間処理を行い、その結果を第2バッファへ出力する(S118)。   Further, the missing color component interpolation process is performed on the image of the first buffer, and the result is output to the second buffer (S118).

続いて、第2バッファの画像に対して、エッジ強調などの画質調整処理を行って、その結果を第1バッファへ出力する(S119)。   Subsequently, image quality adjustment processing such as edge enhancement is performed on the image in the second buffer, and the result is output to the first buffer (S119).

そして、第1バッファの画像を、指定されたファイルへ出力して(S120)、この処理を終了する。   Then, the image in the first buffer is output to the designated file (S120), and this process ends.

このような実施例4によれば、上述した実施例1〜3とほぼ同様に、同種の色成分が得られる画素間の感度の相違を、欠落画素の補間処理を行う前に、補正するようにしたために、欠落画素の補間を感度の相違の影響を低減した状態で良好に行うことができる。   According to the fourth embodiment, as in the first to third embodiments, the difference in sensitivity between pixels from which the same kind of color component can be obtained is corrected before the missing pixel interpolation process is performed. Therefore, the interpolation of missing pixels can be performed satisfactorily while reducing the influence of the difference in sensitivity.

また、注目画素と、該注目画素と同種の色成分の画素と、の感度差がどの程度あるのかを推定するようにしたために、感度差に応じた最適な感度補正を行うことができる。このとき、感度差がどの程度あるのかを、注目画素近傍のデータから抽出した特徴量に基づいて推定するようにしたために、感度差に応じた最適な感度補正を行うことができる。   Further, since the degree of sensitivity difference between the target pixel and the pixel of the same color component as the target pixel is estimated, optimum sensitivity correction according to the sensitivity difference can be performed. At this time, since the degree of sensitivity difference is estimated based on the feature amount extracted from the data in the vicinity of the target pixel, optimal sensitivity correction according to the sensitivity difference can be performed.

そして、特徴量と感度差の量との対応関係を予め調査してテーブル化しておくようにしたために、高精度な感度補正を高速に行うことが可能となる。   Since the correspondence relationship between the feature amount and the sensitivity difference amount is previously investigated and tabulated, high-precision sensitivity correction can be performed at high speed.

さらに、感度差の量から所定の関数により感度差補正量を算出して、算出した感度差補正量を注目画素の画素値に加算して感度補正を行うようにしたために、回路構成が簡単になり、かつボケをあまり生じることなく感度補正を行うことができる。   Furthermore, since the sensitivity difference correction amount is calculated from the amount of sensitivity difference using a predetermined function, and the calculated sensitivity difference correction amount is added to the pixel value of the target pixel to perform sensitivity correction, the circuit configuration is simplified. In addition, sensitivity correction can be performed without causing much blur.

このとき、感度差の量の絶対値がある閾値以上の場合に0となるような関数を用いて感度差補正量を算出するようにしているために、非常に大きな感度差の推定値が得られた場合に、補正を中止することができる。これにより、そのまま補正してエッジがぼけてしまうのを適切に防止することができる。   At this time, since the sensitivity difference correction amount is calculated using a function that becomes 0 when the absolute value of the sensitivity difference amount is equal to or greater than a certain threshold value, a very large estimated value of sensitivity difference is obtained. The correction can be stopped. As a result, it is possible to appropriately prevent the edge from being blurred as it is corrected.

また、特徴量を、注目画素と異なる種類の色成分の画素の画素値から計算するようにしたために、注目している色成分以外の色成分の要因で感度差が生じる場合にも対応することが可能となる。   In addition, since the feature amount is calculated from the pixel values of pixels of a color component different from the pixel of interest, it is possible to cope with a case where a sensitivity difference occurs due to factors of color components other than the color component of interest. Is possible.

さらに、注目画素と同種の色成分の画素の画素値のN個の平均値を計算して特徴量とし、N個の特徴量と注目画素の画素値との差の絶対値が最小となる差を感度差の量とするようにしたために、より高精度に感度差の量を推定することができる。   Furthermore, a difference that minimizes the absolute value of the difference between the N feature values and the pixel value of the target pixel is obtained by calculating N average values of pixel values of pixels of the same color component as the target pixel. Therefore, the amount of sensitivity difference can be estimated with higher accuracy.

図26から図31は本発明の実施例5を示したものであり、図26はデジタルカメラの構成を示すブロック図、図27は段差平滑化回路の一構成例を示すブロック図、図28は段差平滑化回路の処理を示すフローチャート、図29は係数混合比αを算出するための関数の例を示す線図、図30は係数設定回路により設定されるフィルタ係数の周波数特性を説明するための図、図31は段差平滑化回路の他の構成例を示すブロック図である。   FIGS. 26 to 31 show Embodiment 5 of the present invention, FIG. 26 is a block diagram showing the configuration of a digital camera, FIG. 27 is a block diagram showing an example of the configuration of a step smoothing circuit, and FIG. FIG. 29 is a flowchart showing an example of a function for calculating the coefficient mixture ratio α, and FIG. 30 is a diagram for explaining the frequency characteristics of the filter coefficient set by the coefficient setting circuit. FIG. 31 is a block diagram showing another configuration example of the step smoothing circuit.

この実施例5において、上述の実施例1〜4と同様である部分については同一の符号を付して説明を省略し、主として異なる点についてのみ説明する。   In the fifth embodiment, parts similar to those in the first to fourth embodiments described above are denoted by the same reference numerals, description thereof is omitted, and only different points will be mainly described.

この実施例5は、上述した実施例1と同様に、画像処理装置をデジタルカメラに適用したものである。   In the fifth embodiment, the image processing apparatus is applied to a digital camera as in the first embodiment.

この実施例5のデジタルカメラ61は、図26に示すように、上記実施例4のデジタルカメラ41に対して、段差補正回路43に代えて段差平滑化回路62を設けたものとなっている。そして、この段差平滑化回路62は、上記制御回路11により制御されるようになっている。   As shown in FIG. 26, the digital camera 61 of the fifth embodiment is provided with a step smoothing circuit 62 instead of the step correction circuit 43 with respect to the digital camera 41 of the fourth embodiment. The step smoothing circuit 62 is controlled by the control circuit 11.

上記段差平滑化回路62は、より詳しくは図27に示すように、フィルタ回路71と、補正量算出回路72と、係数設定回路73と、を有して構成されている。   More specifically, the step smoothing circuit 62 includes a filter circuit 71, a correction amount calculation circuit 72, and a coefficient setting circuit 73, as shown in FIG.

上記補正量算出回路72は、上記単板画像バッファ4から7×7画素のブロック単位で読み出した画像データの中心3×3画素に対して、R画素の平均値R’(特徴量)とB画素の平均値B’(特徴量)とを算出し、さらに、これらの特徴量から該補正量算出回路72の内部ROMに記憶されたテーブルを参照して適切な段差補正量の閾値F(感度差の量)を求め、この閾値Fの関数として係数混合比αを算出するものである。   The correction amount calculation circuit 72 calculates the average value R ′ (feature amount) of R pixels and B for the center 3 × 3 pixels of the image data read from the single-panel image buffer 4 in units of 7 × 7 pixels. An average value B ′ (feature amount) of the pixel is calculated, and an appropriate step correction amount threshold F (sensitivity) is calculated from these feature amounts with reference to a table stored in the internal ROM of the correction amount calculation circuit 72. The amount of difference) is obtained, and the coefficient mixture ratio α is calculated as a function of the threshold value F.

上記係数設定回路73は、上記補正量算出回路72により算出された係数混合比αに基づいて、上記フィルタ回路71で行う計算に用いるフィルタ係数を算出するものである。   The coefficient setting circuit 73 calculates a filter coefficient used for the calculation performed by the filter circuit 71 based on the coefficient mixture ratio α calculated by the correction amount calculation circuit 72.

上記フィルタ回路71は、上記係数設定回路73により算出されたフィルタ係数を用いて、上記単板画像バッファ4から読み出した画像データに所定の演算を行い、G段差の平滑化を行うものである。   The filter circuit 71 performs a predetermined calculation on the image data read from the single-plate image buffer 4 using the filter coefficient calculated by the coefficient setting circuit 73 to smooth the G step.

このような段差平滑化回路62の処理について、図28を参照して説明する。なお、この図28において、上記実施例4の図20と同様の処理を行う部分については、同一の符号を付している。また、この段差平滑化回路62は、上述したように、単板画像バッファ4の各画素毎に、近傍7×7サイズのブロック領域を読み出して、以下に示すような処理を行うようになっている。   Such processing of the level difference smoothing circuit 62 will be described with reference to FIG. In FIG. 28, the same reference numerals are given to the portions that perform the same processing as in FIG. 20 of the fourth embodiment. Further, as described above, the step smoothing circuit 62 reads out a block area of 7 × 7 size for each pixel of the single-panel image buffer 4 and performs the following processing. Yes.

この処理を開始すると、まず、上記S101の処理を行って、中心画素がGrまたはGbであるか否かを確認する。   When this process is started, first, the process of S101 is performed to check whether the central pixel is Gr or Gb.

ここで、中心画素がGrまたはGbである場合には、補正量算出回路72は、まず、近傍ブロック内の中心3×3画素に含まれるR画素の平均値R’とB画素の平均値B’とを算出する。そして、補正量算出回路72は、算出した平均値R’,B’をインデックスにして、内部ROMに記憶している予測テーブルを参照し、適切な段差補正量の閾値Fを求める(S131)。この予測テーブルは、上記実施例4の図20のS103において説明した予測テーブルと同一である。   Here, when the center pixel is Gr or Gb, the correction amount calculation circuit 72 firstly calculates the average value R ′ of the R pixels and the average value B of the B pixels included in the center 3 × 3 pixels in the neighboring block. 'And calculate. Then, the correction amount calculation circuit 72 refers to the prediction table stored in the internal ROM using the calculated average values R ′ and B ′ as indexes, and obtains an appropriate threshold correction amount threshold value F (S <b> 131). This prediction table is the same as the prediction table described in S103 of FIG.

次に、補正量算出回路72は、後段のフィルタ回路71で適用されるフィルタを決定するための係数混合比αを、段差補正量の閾値Fの関数として算出する(S132)。好ましい関数の一例としては、Fが0のときにαが1、Fがある値T以上でαが0となる図29に示すようなものを挙げることができる。なお、係数混合比の意味については、後で説明する。   Next, the correction amount calculation circuit 72 calculates a coefficient mixture ratio α for determining a filter to be applied by the subsequent filter circuit 71 as a function of the threshold value F of the step correction amount (S132). As an example of a preferable function, there is a function as shown in FIG. 29 in which α is 1 when F is 0, and α is 0 when F is a certain value T or more. The meaning of the coefficient mixture ratio will be described later.

続いて、係数設定回路73は、補正量算出回路72により算出された係数混合比αに基づいて、フィルタ回路71により行う計算に用いるフィルタ係数を算出する。つまり、フィルタ回路71は、単板画像バッファ4から読み出した7×7近傍ブロックに対して、まずG成分の得られていない位置のデータを0にセットした上で線形フィルタリングを行うが、このときのフィルタ係数として、該係数設定回路73から出力された値を用いるようになっている。   Subsequently, the coefficient setting circuit 73 calculates a filter coefficient used for the calculation performed by the filter circuit 71 based on the coefficient mixture ratio α calculated by the correction amount calculation circuit 72. That is, the filter circuit 71 first performs linear filtering on the 7 × 7 neighboring block read from the single-panel image buffer 4 after setting the data at the position where the G component is not obtained to 0. The value output from the coefficient setting circuit 73 is used as the filter coefficient.

係数設定回路73は、フィルタ回路71で用いるフィルタ係数を設定するために、予め内部に、2種類の7×7フィルタの係数を保持している。2種類のフィルタ係数の内の1つは、係数P_i,j(i,jは各々1から7までの整数)である。この係数P_i,jは、フィルタの中心に当たるP_4,4のみが1であり、その他は0の値をとる係数となっている。また、2種類のフィルタ係数の内の他の1つは、係数Q_i,j(i,jは各々1から7までの整数)である。この係数Q_i,jは、総和が2であって、かつ、その水平方向または垂直方向の特性が、図30において実線で示す曲線L0のように、ナイキスト周波数で0となるように設定された係数となっている。   The coefficient setting circuit 73 holds the coefficients of two types of 7 × 7 filters in advance in order to set filter coefficients used in the filter circuit 71. One of the two types of filter coefficients is a coefficient P_i, j (i and j are integers from 1 to 7, respectively). In this coefficient P_i, j, only P_4,4 corresponding to the center of the filter is 1, and other coefficients are 0. The other one of the two types of filter coefficients is a coefficient Q_i, j (i and j are integers from 1 to 7, respectively). This coefficient Q_i, j is a coefficient whose sum is 2 and whose horizontal or vertical characteristics are set to be 0 at the Nyquist frequency as shown by a curve L0 shown by a solid line in FIG. It has become.

従って、係数P_i,jを用いて、単板画像バッファ4から読み出した7×7近傍をフィルタリングした場合には、フィルタ回路71から出力されるのは、何の補正もされない中央画素の値である。   Therefore, when the vicinity of 7 × 7 read from the single-panel image buffer 4 is filtered using the coefficient P_i, j, the value of the center pixel that is not corrected is output from the filter circuit 71. .

一方、係数Q_i,jを用いて、単板画像バッファ4から読み出した7×7近傍をフィルタリングした場合には、ナイキスト周波数付近の周波数成分だけを急に落とし、その他の周波数成分にはあまり影響を与えないような平滑化がなされる。Gr画素とGb画素とに段差が生じている場合は、その影響が主にナイキスト周波数付近に現れる。そのために、フィルタリングを行った結果、段差の影響は平滑化されて取り除かれるが、エッジ部のボケはあまり生じていないような中央画素のG成分値が得られる。   On the other hand, when the 7 × 7 neighborhood read from the single-panel image buffer 4 is filtered using the coefficient Q_i, j, only the frequency component near the Nyquist frequency is suddenly dropped, and the other frequency components are not significantly affected. Smoothing that is not given is performed. When there is a step between the Gr pixel and the Gb pixel, the influence mainly appears near the Nyquist frequency. Therefore, as a result of filtering, the effect of the step is smoothed and removed, but the G component value of the central pixel is obtained such that the blur of the edge portion does not occur so much.

係数設定回路73は、上述したような係数P_i,jと係数Q_i,jとを、上記補正量算出回路72から取得した係数混合比αを用いて数式19に示すように混合することにより、新たなフィルタ係数C_i,jを生成して、フィルタ回路71へ出力する(S133)。
[数19]
C_i,j=α×P_i,j+(1−α)×Q_i,j
この数式19と、図29に示したような係数混合比αと、によれば、近傍ブロック内で大きな段差が発生している場合には、この段差が取り除かれる係数Q_i,jに近い特性の図30の点線に示す曲線L1のようなフィルタ係数がフィルタ回路71へ出力される。一方、近傍ブロック内で段差がほとんど発生していない場合は、係数P_i,jに近い特性の図30の一点鎖線に示す曲線L2のようなフィルタ係数がフィルタ回路71へ出力される。このようなフィルタ係数の混合を行うことにより、帯域劣化と段差補正とが最適にバランスされた処理を常に行うことが可能となる。
The coefficient setting circuit 73 newly mixes the coefficient P_i, j and the coefficient Q_i, j as described above by using the coefficient mixture ratio α acquired from the correction amount calculation circuit 72 as shown in Equation 19, thereby obtaining a new value. A simple filter coefficient C_i, j is generated and output to the filter circuit 71 (S133).
[Equation 19]
C_i, j = α × P_i, j + (1−α) × Q_i, j
According to the equation 19 and the coefficient mixture ratio α as shown in FIG. 29, when a large step is generated in the neighboring block, the characteristic close to the coefficient Q_i, j from which the step is removed. A filter coefficient such as a curve L1 indicated by a dotted line in FIG. 30 is output to the filter circuit 71. On the other hand, when almost no step is generated in the neighboring block, a filter coefficient such as a curve L2 indicated by a one-dot chain line in FIG. 30 having characteristics close to the coefficient P_i, j is output to the filter circuit 71. By mixing the filter coefficients in this way, it is possible to always perform processing in which band degradation and step correction are optimally balanced.

フィルタ回路71は、上述したように、係数設定回路73から出力されたフィルタ係数C_i,jに基づいて、近傍ブロックに対して線形フィルタリングを行う。具体的には、次のような処理を行う。ここに、7×7近傍ブロックの左上隅の座標を(1,1)としたときの位置(i,j)(i,jは1から7までの整数)における画素値をx_i,jとする。まず、G成分が得られていない位置における画素値x_i,jを0にセットする。その後、次のような数式20を用いて、フィルタリング結果vを計算する。
[数20]

Figure 2010283888
こうしてフィルタ回路71により計算されたフィルタリング結果vが、ノイズ低減回路44へ出力される。 As described above, the filter circuit 71 performs linear filtering on neighboring blocks based on the filter coefficient C_i, j output from the coefficient setting circuit 73. Specifically, the following processing is performed. Here, the pixel value at the position (i, j) (i, j is an integer from 1 to 7) when the coordinate of the upper left corner of the 7 × 7 neighboring block is (1, 1) is x_i, j. . First, the pixel value x_i, j at a position where the G component is not obtained is set to 0. Thereafter, the filtering result v is calculated using the following Expression 20.
[Equation 20]
Figure 2010283888
Thus, the filtering result v calculated by the filter circuit 71 is output to the noise reduction circuit 44.

なお、この実施例においても種々の変形を行うことが可能である。例えば、係数を混合した後に、混合された係数を用いてフィルタリングするのではなく、2種類の係数を用いてそれぞれフィルタリングを行い、フィルタリングされた結果を混合するようにして構わない。図31は、このような処理を行うための回路の構成例を示している。   In this embodiment, various modifications can be made. For example, after mixing the coefficients, instead of filtering using the mixed coefficients, filtering may be performed using two kinds of coefficients, and the filtered results may be mixed. FIG. 31 shows a configuration example of a circuit for performing such processing.

すなわち、図31に示す段差平滑化回路62は、上記図27に示した段差平滑化回路62に対して、フィルタ回路71および係数設定回路73の代わりに、2つのフィルタ回路71a,71bおよび混合回路75を設けたものであり、また、補正量算出回路72の出力は該混合回路75へ接続されている。   That is, the step smoothing circuit 62 shown in FIG. 31 is different from the step smoothing circuit 62 shown in FIG. 27 in that two filter circuits 71 a and 71 b and a mixing circuit are used instead of the filter circuit 71 and the coefficient setting circuit 73. 75, and the output of the correction amount calculation circuit 72 is connected to the mixing circuit 75.

上記フィルタ回路71aは、上記係数P_i,jによるフィルタリングを行って、結果V1を出力するものである。   The filter circuit 71a performs filtering by the coefficient P_i, j and outputs a result V1.

上記フィルタ回路71bは、上記係数Q_i,jによるフィルタリングを行って、結果V2を出力するものである。   The filter circuit 71b performs filtering using the coefficient Q_i, j and outputs a result V2.

混合回路75は、上記補正量算出回路72から係数混合比αを受けて、上記フィルタ回路71aからの出力V1と上記フィルタ回路71bからの出力V2とを用いて、以下のような数式21により最終結果V3を算出し、算出した結果V3を上記ノイズ低減回路44へ出力するものである。
[数21]
V3=α×V1+(1−α)×V2
また、図27に示した構成と、図31に示した構成と、の何れにおいても、混合するフィルタの数は2つに限るものではなく、3つ以上であっても構わない。この場合には、補正量算出回路72は、複数の混合比を段差補正量の閾値Fの関数として算出する。
The mixing circuit 75 receives the coefficient mixture ratio α from the correction amount calculation circuit 72, and finally uses the output V1 from the filter circuit 71a and the output V2 from the filter circuit 71b to calculate the final value by the following equation (21). The result V3 is calculated, and the calculated result V3 is output to the noise reduction circuit 44.
[Equation 21]
V3 = α × V1 + (1−α) × V2
Further, in any of the configuration shown in FIG. 27 and the configuration shown in FIG. 31, the number of filters to be mixed is not limited to two, and may be three or more. In this case, the correction amount calculation circuit 72 calculates a plurality of mixture ratios as a function of the threshold value F of the step correction amount.

さらに簡単な回路としては、図31に示す構成において、混合回路の代わりに切換回路を設けて、係数混合比αに応じてフィルタ回路71aとフィルタ回路71bとの出力を切り換えるようにすることも可能である。   As a simpler circuit, in the configuration shown in FIG. 31, it is also possible to provide a switching circuit instead of the mixing circuit and switch the outputs of the filter circuit 71a and the filter circuit 71b in accordance with the coefficient mixing ratio α. It is.

加えて、図25の処理において、S114の段差補正処理として、上記図20に示したような処理を行う代わりに、図28に示したような処理を行うことにより、本実施例に対応するソフトウェア処理を実現することが可能となる。   In addition, in the process of FIG. 25, as the level difference correction process of S114, instead of performing the process as shown in FIG. 20, the process shown in FIG. Processing can be realized.

このような実施例5によれば、上述した実施例4とほぼ同様の効果を奏するとともに、感度差の量に基づいて設定したフィルタ係数により、注目画素と同種の色成分の画素に線形フィルタを適用するようにしたために、感度差補正量を画素値に加算する場合に比べて、感度差の推定を間違った場合であっても、より確実に感度差を補正することが可能となる。   According to the fifth embodiment, the same effect as that of the fourth embodiment described above can be obtained, and a linear filter can be applied to a pixel having the same color component as the target pixel by a filter coefficient set based on the amount of sensitivity difference. As a result, the sensitivity difference can be corrected more reliably even when the estimation of the sensitivity difference is wrong, compared to the case where the sensitivity difference correction amount is added to the pixel value.

なお、本発明は上述した実施例に限定されるものではなく、発明の主旨を逸脱しない範囲内において種々の変形や応用が可能であることは勿論である。   In addition, this invention is not limited to the Example mentioned above, Of course, a various deformation | transformation and application are possible within the range which does not deviate from the main point of invention.

本発明は、単板撮像系、二板撮像系、または三板画素ずらし撮像系から出力された画像を処理して、画素毎に3色成分値をもつカラーデジタル画像を生成する画像処理装置、画像処理プログラムに好適に利用することができる。   The present invention relates to an image processing device that processes an image output from a single-plate image pickup system, a two-plate image pickup system, or a three-plate pixel shift image pickup system, and generates a color digital image having three color component values for each pixel. It can utilize suitably for a processing program.

1,21,31,41,61…デジタルカメラ
2…光学系
3…単板ベイヤー配列CCD
4…単画像バッファ
5…ライン補正回路(感度補正手段)
6…WB補正回路
7…補間回路(補間手段)
8…カラー画像バッファ
9…画質調整回路
10…記録回路
11…制御回路
22…G段差検出回路(判定手段、特徴量計算手段)
23…G補間回路(補間手段)
24…重み計算回路(重付平均手段)
25…平均回路(重付平均手段)
26…G画像バッファ
27…RB補間回路(補間手段)
32…補正回路(補間後補正手段)
42…A/D回路
43…段差補正回路(感度補正手段)
44…ノイズ低減回路
51…補正回路
52…平均計算回路(特徴計算手段)
53…段差量推定回路(推定手段)
54…補正量算出回路(推定手段、特徴計算手段)
56…組み合わせ平均計算回路(特徴計算手段)
57…差分選択回路
62…段差平滑化回路(感度補正手段)
71,71a,71b…フィルタ回路(フィルタ手段)
72…補正量算出回路(推定手段、特徴計算手段)
73…係数設定回路(係数設定手段)
75…混合回路
1, 21, 31, 41, 61 ... Digital camera 2 ... Optical system 3 ... Single plate Bayer array CCD
4 ... Single image buffer 5 ... Line correction circuit (sensitivity correction means)
6 ... WB correction circuit 7 ... Interpolation circuit (interpolation means)
8 ... Color image buffer 9 ... Image quality adjustment circuit 10 ... Recording circuit 11 ... Control circuit 22 ... G step detection circuit (determination means, feature amount calculation means)
23 ... G interpolation circuit (interpolation means)
24 ... Weight calculation circuit (weighted averaging means)
25 ... Average circuit (weighted average means)
26: G image buffer 27 ... RB interpolation circuit (interpolation means)
32. Correction circuit (correction means after interpolation)
42 ... A / D circuit 43 ... Step correction circuit (sensitivity correction means)
44 ... Noise reduction circuit 51 ... Correction circuit 52 ... Average calculation circuit (feature calculation means)
53. Step amount estimation circuit (estimating means)
54 ... Correction amount calculating circuit (estimating means, feature calculating means)
56. Combination average calculation circuit (feature calculation means)
57 ... Difference selection circuit 62 ... Step smoothing circuit (sensitivity correction means)
71, 71a, 71b ... Filter circuit (filter means)
72. Correction amount calculation circuit (estimation means, feature calculation means)
73 ... Coefficient setting circuit (coefficient setting means)
75 ... Mixed circuit

Claims (12)

単板撮像系、二板撮像系、または三板画素ずらし撮像系によって光学像を撮像することにより得られた、各画素につき1種類以上の色成分が欠落している画像、を処理する画像処理装置であって、
注目画素の所定の近傍において、指定された種類の色成分に対し、当該色成分が得られている画素の間の感度差の大小を判定する判定手段と、
上記注目画素において欠落する色成分を補う処理を行うものであって、該処理を行う際に、上記判定手段による判定結果に応じて処理内容を変更可能な補間手段と、
を具備したことを特徴とする画像処理装置。
An image processing apparatus that processes an image obtained by capturing an optical image with a single-plate imaging system, a two-plate imaging system, or a three-plate pixel shifting imaging system and lacking one or more types of color components for each pixel Because
A determination unit that determines, for a specified type of color component in a predetermined vicinity of the pixel of interest, a sensitivity difference between pixels from which the color component is obtained;
Interpolating means that compensates for missing color components in the pixel of interest and that can change the processing content according to the determination result by the determining means when performing the processing;
An image processing apparatus comprising:
上記補間手段は、上記注目画素で得られている色成分に対して、上記近傍内で当該色成分が得られている画素の中から基準画素を定め、上記注目画素の当該色成分に対する感度を上記基準画素の当該色成分に対する感度に合わせた場合に上記注目画素がとるはずの当該色成分の画素値を補正値として計算し、上記判定手段により判定された感度差の大小に応じて、上記注目画素の当該色成分の画素値を、上記補正値に変更するものであることを特徴とする請求項1に記載の画像処理装置。   The interpolation means determines a reference pixel from among pixels in which the color component is obtained in the vicinity of the color component obtained from the pixel of interest, and sets the sensitivity of the pixel of interest to the color component. The pixel value of the color component that should be taken by the pixel of interest when matched with the sensitivity of the reference pixel to the color component is calculated as a correction value, and depending on the sensitivity difference determined by the determination unit, The image processing apparatus according to claim 1, wherein the pixel value of the color component of the target pixel is changed to the correction value. 上記補間手段は、上記所定の近傍内の画素値を重み付け平均する重付平均手段を有して構成されており、該重付平均手段は、上記判定手段の判定結果に応じて重みを変更し重み付け平均により注目画素の画素値を算出するものであることを特徴とする請求項1に記載の画像処理装置。   The interpolation means includes weighted average means for weighted average of pixel values in the predetermined neighborhood, and the weighted average means changes the weight according to the determination result of the determination means. The image processing apparatus according to claim 1, wherein the pixel value of the target pixel is calculated by weighted averaging. 上記重付平均手段は、上記重みを、上記判定手段において感度差が大きいと判定された種類の色成分が得られている画素に対して小さくなるように変更するものであることを特徴とする請求項3に記載の画像処理装置。   The weighted averaging means is characterized in that the weight is changed so as to be small with respect to a pixel from which a kind of color component determined to have a large sensitivity difference in the determining means. The image processing apparatus according to claim 3. 上記重付平均手段は、上記重みを、上記近傍内で同種の色成分が得られている画素間の画素値差分の関数式として計算するものであって、上記判定手段により特定の色成分に対して感度差が大きいと判定された場合には、該関数式を、当該色成分に関する上記画素値差分の影響が小さくなるように変更するものであることを特徴とする請求項3に記載の画像処理装置。   The weighted average means calculates the weight as a function expression of a pixel value difference between pixels in which the same kind of color component is obtained in the vicinity, and the weight is averaged by the determination means. 4. The method according to claim 3, wherein when it is determined that the sensitivity difference is large, the function formula is changed so that the influence of the pixel value difference on the color component is reduced. Image processing device. 上記重付平均手段は、上記判定手段において感度差があると判定された種類の色成分が得られている画素に対して、上記重みが当該画素間で均等に近付くように変更するものであることを特徴とする請求項3に記載の画像処理装置。   The weighted average unit is configured to change the weights so that the pixels are evenly approached with respect to pixels from which the color component of the type determined to have a sensitivity difference is obtained in the determination unit. The image processing apparatus according to claim 3. 上記判定手段は、上記注目画素の所定の近傍内の画素値から所定の特徴量を計算する特徴量計算手段を有して構成されており、該特徴量の大小に基づいて上記感度差の大小を判定するものであることを特徴とする請求項1に記載の画像処理装置。   The determination unit includes a feature amount calculation unit that calculates a predetermined feature amount from pixel values within a predetermined vicinity of the pixel of interest, and the magnitude of the sensitivity difference is determined based on the size of the feature amount. The image processing apparatus according to claim 1, wherein: 上記判定手段は、指定された色成分に関する上記特徴量と上記感度差の量とを対応付けたテーブルをさらに有して構成されており、該特徴量から該テーブルを参照することにより上記感度差の大小を判定するものであることを特徴とする請求項7に記載の画像処理装置。   The determination unit further includes a table in which the feature amount related to the specified color component is associated with the amount of the sensitivity difference, and the sensitivity difference is referred to by referring to the table from the feature amount. The image processing apparatus according to claim 7, wherein the size of the image processing apparatus is determined. 上記判定手段は、上記近傍内において、指定された色成分が得られている画素を所定の方法で分類し、各分類における画素値の平均値と変動量とに基づき、上記特徴量を計算するものであることを特徴とする請求項7または請求項8に記載の画像処理装置。   The determination means classifies pixels for which a designated color component is obtained within the vicinity by a predetermined method, and calculates the feature amount based on an average value and a variation amount of pixel values in each classification. The image processing apparatus according to claim 7, wherein the image processing apparatus is an image processing apparatus. 上記判定手段は、上記近傍内において、指定された色成分が得られている画素の画素値の平均値と、指定された色成分と異なる所定の色成分が得られている画素の画素値の平均値と、に基づいて、上記特徴量を計算するものであることを特徴とする請求項7または請求項8に記載の画像処理装置。   The determination means includes an average value of pixel values of pixels in which the designated color component is obtained and a pixel value of pixels in which a predetermined color component different from the designated color component is obtained in the vicinity. The image processing apparatus according to claim 7, wherein the feature amount is calculated based on an average value. 上記補間手段は、上記撮像系により得られる画像サイズを所定の縮小率で縮小したカラー画像を生成し得るように構成されたものであり、
上記判定手段は、該補間手段が縮小したカラー画像を生成する際には、該縮小率が所定の閾値以下である場合に、感度差の判定を行わないものであることを特徴とする請求項1に記載の画像処理装置。
The interpolation means is configured to generate a color image obtained by reducing the image size obtained by the imaging system at a predetermined reduction rate,
The determination means does not perform a sensitivity difference determination when the interpolation means generates a reduced color image when the reduction ratio is equal to or less than a predetermined threshold. The image processing apparatus according to 1.
コンピュータに、単板撮像系、二板撮像系、または三板画素ずらし撮像系によって光学像を撮像することにより得られた、各画素につき1種類以上の色成分が欠落している画像、を処理させるための画像処理プログラムであって、
該コンピュータを、
注目画素の所定の近傍において、指定された種類の色成分に対し、当該色成分が得られている画素の間の感度差の大小を判定する判定手段、
上記注目画素において欠落する色成分を補う処理を行うものであって、該処理を行う際に、上記判定手段による判定結果に応じて処理内容を変更可能な補間手段、
として機能させることを特徴とする画像処理プログラム。
Let a computer process an image in which one or more color components are missing for each pixel, which is obtained by capturing an optical image with a single-plate imaging system, a two-plate imaging system, or a three-plate pixel shifting imaging system. An image processing program for
The computer
Determination means for determining the magnitude of a sensitivity difference between pixels for which the color component is obtained for a specified type of color component in a predetermined vicinity of the pixel of interest;
Interpolating means that compensates for missing color components in the pixel of interest and that can change the processing content according to the determination result by the determining means when performing the processing;
An image processing program that functions as an image processing program.
JP2010200988A 2003-06-05 2010-09-08 Image processing apparatus and image processing program Expired - Fee Related JP5153842B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010200988A JP5153842B2 (en) 2003-06-05 2010-09-08 Image processing apparatus and image processing program

Applications Claiming Priority (5)

Application Number Priority Date Filing Date Title
JP2003161185 2003-06-05
JP2003161185 2003-06-05
JP2004155244 2004-05-25
JP2004155244 2004-05-25
JP2010200988A JP5153842B2 (en) 2003-06-05 2010-09-08 Image processing apparatus and image processing program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2004158924A Division JP4610930B2 (en) 2003-06-05 2004-05-28 Image processing apparatus and image processing program

Publications (2)

Publication Number Publication Date
JP2010283888A true JP2010283888A (en) 2010-12-16
JP5153842B2 JP5153842B2 (en) 2013-02-27

Family

ID=43540141

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010200988A Expired - Fee Related JP5153842B2 (en) 2003-06-05 2010-09-08 Image processing apparatus and image processing program

Country Status (1)

Country Link
JP (1) JP5153842B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013143727A (en) * 2012-01-12 2013-07-22 Nikon Corp Image processing apparatus, imaging apparatus, and image processing program
CN109658358A (en) * 2018-12-25 2019-04-19 辽宁工程技术大学 A kind of quick bayer color reconstruction method based on more Steerable filters

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11146410A (en) * 1997-11-10 1999-05-28 Minolta Co Ltd Video camera
JP2000341700A (en) * 1999-05-31 2000-12-08 Sony Corp Color image pickup device
JP2001218073A (en) * 1999-10-14 2001-08-10 Hitachi Kokusai Electric Inc Image signal processing method, image signal processor using the method and recording medium recorded with program code representing the method procedure
JP2002238057A (en) * 2001-02-08 2002-08-23 Ricoh Co Ltd Imaging device, luminance correction method, and program for executing the method by computer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11146410A (en) * 1997-11-10 1999-05-28 Minolta Co Ltd Video camera
JP2000341700A (en) * 1999-05-31 2000-12-08 Sony Corp Color image pickup device
JP2001218073A (en) * 1999-10-14 2001-08-10 Hitachi Kokusai Electric Inc Image signal processing method, image signal processor using the method and recording medium recorded with program code representing the method procedure
JP2002238057A (en) * 2001-02-08 2002-08-23 Ricoh Co Ltd Imaging device, luminance correction method, and program for executing the method by computer

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013143727A (en) * 2012-01-12 2013-07-22 Nikon Corp Image processing apparatus, imaging apparatus, and image processing program
CN109658358A (en) * 2018-12-25 2019-04-19 辽宁工程技术大学 A kind of quick bayer color reconstruction method based on more Steerable filters

Also Published As

Publication number Publication date
JP5153842B2 (en) 2013-02-27

Similar Documents

Publication Publication Date Title
JP4610930B2 (en) Image processing apparatus and image processing program
US7710470B2 (en) Image processing apparatus that reduces noise, image processing method that reduces noise, electronic camera that reduces noise, and scanner that reduces noise
JP5315158B2 (en) Image processing apparatus and image processing method
US7454057B2 (en) Image processing apparatus and image processing program
EP1898624B1 (en) Image processing device, image processing method, image processing program product, and image-capturing device
US7177463B2 (en) Image processing apparatus and method
JP5067499B2 (en) Image processing device
JP4322781B2 (en) Imaging device
US8259202B2 (en) Image processing device and image processing program for acquiring specific color component based on sensitivity difference between pixels of an imaging device
EP1515545A1 (en) Image processing apparatus and method, recording medium, and program for correcting shading of a captured image
EP1395041A2 (en) Colour correction of images
JP4065155B2 (en) Image processing apparatus and image processing program
US20080266428A1 (en) Imaging apparatus capable of highly accurate defective pixel correction processing
JP5096291B2 (en) Image reading apparatus, image forming apparatus, and image data processing program
JP6282123B2 (en) Image processing apparatus, image processing method, and program
US7995120B2 (en) Image brightness compensating apparatus and method, recorded medium recorded the program performing it
JP2008258909A (en) Signal processing circuit
US8655058B2 (en) Method and apparatus for spatial noise adaptive filtering for digital image and video capture systems
JP5153842B2 (en) Image processing apparatus and image processing program
JP3730063B2 (en) Color component generation apparatus, color component generation method, and multicolor image pickup apparatus using the same
JP3711402B2 (en) Imaging apparatus and color imaging signal processing method
JP4053362B2 (en) Interpolation processing method, interpolation processing program, recording medium recording the same, image processing apparatus, and image forming apparatus provided with the same
US20090244321A1 (en) Multi-segment reading ccd correcting apparatus and method
EP1833263A1 (en) Correction approximating straight line group information generating method of multi-divided reading ccd, and correction processing device manufacturing method of multi-divided reading ccd
JP4334498B2 (en) Image processing apparatus, image forming apparatus, image processing method, and computer program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100908

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121101

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: 20121113

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20121204

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20151214

Year of fee payment: 3

R151 Written notification of patent or utility model registration

Ref document number: 5153842

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20151214

Year of fee payment: 3

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees