JP2013165482A - Image processor, image processing program and imaging apparatus - Google Patents

Image processor, image processing program and imaging apparatus Download PDF

Info

Publication number
JP2013165482A
JP2013165482A JP2012287814A JP2012287814A JP2013165482A JP 2013165482 A JP2013165482 A JP 2013165482A JP 2012287814 A JP2012287814 A JP 2012287814A JP 2012287814 A JP2012287814 A JP 2012287814A JP 2013165482 A JP2013165482 A JP 2013165482A
Authority
JP
Japan
Prior art keywords
image
gradation
interpolation
color
space
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.)
Pending
Application number
JP2012287814A
Other languages
Japanese (ja)
Inventor
Kenichi Ishiga
健一 石賀
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.)
Nikon Corp
Original Assignee
Nikon 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 Nikon Corp filed Critical Nikon Corp
Priority to JP2012287814A priority Critical patent/JP2013165482A/en
Publication of JP2013165482A publication Critical patent/JP2013165482A/en
Pending legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To perform highly precise interpolation which provides an interpolation image with high contrast while performance of a conventional image prediction space where contrast resolution which is superior on average can be performed in the whole gradation region is kept in a maximum.SOLUTION: An image processor generates three color interpolation images by using a prediction space by three interpolation gammas Γ, Γand Γ, sets a color interpolation image by the interpolation gamma Γ, which is positioned in the middle, as a reference, extracts a laplacian component between hierarchies in the same pixel from the three color interpolation images and adds it to a reference image.

Description

本発明は、画像処理装置、画像処理プログラム、および撮像装置に関する。   The present invention relates to an image processing device, an image processing program, and an imaging device.

Bayer配列のような単板撮像素子で撮影された画像データは通常、光量に比例した階調特性をもつ線形階調データとして入力されてくる。このデータに対して色補間を行う方法として、世の中の被写体像が平均的に無彩色に近いことを利用して、従来からある色成分を補間するときに他の色成分も考慮して補間する技術が用いられている。   Image data captured with a single-plate image sensor such as a Bayer array is usually input as linear gradation data having gradation characteristics proportional to the amount of light. As a method for performing color interpolation on this data, using the fact that the world's subject image is close to an achromatic color on average, interpolation is performed in consideration of other color components when interpolating a conventional color component. Technology is used.

例えば、特許文献1では線形階調の入力Bayerデータに対して、色差が一定、すなわち、R - G = 一定、B - G = 一定に保つように、ある色成分の平均値による補間値を他の色成分による補正項を加えながら補間値を算出する方法を開示している。また、別の方法として、色比が一定、すなわち、R/G = 一定、B/G = 一定に保つように、ある色成分の平均値による補間値を他の色成分で補正しながら補間値を算出する方法も開示している。   For example, in Patent Document 1, an interpolation value based on an average value of a certain color component is other than the linear Bayer input Bayer data so that the color difference is constant, that is, R−G = constant and B−G = constant. Discloses a method of calculating an interpolation value while adding a correction term based on the color components. As another method, the interpolated value is corrected by correcting the interpolated value based on the average value of one color component with other color components so that the color ratio is constant, that is, R / G = constant and B / G = constant. A method of calculating is also disclosed.

特許文献2に示されるように色比一定の補間方法は、線形階調特性の画像を対数階調特性のガンマ空間に移行して、その画像処理空間で色差一定を保つようにして補間値を算出することと等価である。これは対数階調特性に限らず、何らかの補間用のガンマ空間に移行して色差が一定に保つように補間すれば、実際の線形階調空間では色差一定と仮定した補間値予測と色比一定と仮定した補間値予測の間を行く任意の予測空間を、補間ガンマの階調特性の設定の仕方で変えることができることを意味する。   As shown in Patent Document 2, an interpolation method with a constant color ratio shifts an image having a linear gradation characteristic to a gamma space having a logarithmic gradation characteristic, and sets an interpolation value so as to maintain a constant color difference in the image processing space. Equivalent to calculating. This is not limited to logarithmic gradation characteristics. If interpolation is performed so that the color difference is kept constant by shifting to some interpolation gamma space, the interpolation value prediction and the color ratio are assumed to be constant in the actual linear gradation space. This means that an arbitrary prediction space that passes between the predicted interpolation value predictions can be changed by the setting method of the gradation characteristic of the interpolation gamma.

このような補間ガンマの階調特性を最適化して、最良の補間値を予測する空間を提供する方法が、本出願人と同一発明者による特許文献3、特許文献4に開示されている。すなわち、色差が一定という仮定を利用して、任意の画像で低輝度部、中間調、高輝度部の全ての領域で鮮明なコントラスト、解像を得るためには平方根階調の補間用ガンマ空間へ移行するのがよいと指摘している。更に高感度撮影でダーク・ノイズが存在する場合には、平方根の中に正のオフセットを加えた補間用ガンマ空間で、均等ノイズ性を常に保つ工夫も導入している。これらの平方根型の画像処理空間は、均等ノイズ空間を提供するので、色差一定の最適な補間値予測空間を実現するとともに、補間時の方向判定性能を最大化し、補間結果のノイズ増幅を最小化する効果も同時実現する。   Methods for optimizing the gradation characteristics of such interpolation gamma and providing a space for predicting the best interpolation value are disclosed in Patent Documents 3 and 4 by the same inventor as the present applicant. In other words, using the assumption that the color difference is constant, in order to obtain clear contrast and resolution in all areas of the low-brightness, halftone, and high-brightness areas in an arbitrary image, a square root gradation gamma space for interpolation is used. Point out that it is better to move to Furthermore, when dark noise is present in high-sensitivity shooting, a technique has been introduced to always maintain uniform noise in an interpolating gamma space with a positive offset added to the square root. Since these square root image processing spaces provide a uniform noise space, it realizes an optimal interpolation value prediction space with a constant color difference, maximizes the direction judgment performance during interpolation, and minimizes noise amplification of the interpolation result The effect is also realized at the same time.

米国特許第5552827号明細書US Pat. No. 5,552,827 米国特許第4642678号明細書US Pat. No. 4,642,678 日本国特許第4239483号公報Japanese Patent No. 4239483 米国特許第7957588号明細書US Pat. No. 7,957,588

前述の対数階調特性のガンマ空間は、低輝度部のコントラスト再現を極めて重視した予測する空間を提供する一方で、高輝度部はニー特性で階調が寝ているために、高輝度部のコントラスト再現性は極めて低い予測空間である欠点を持つ。一方の特許文献1の線形階調のままの色差一定の補間は、線形階調も補間用ガンマ空間の1つとして考えると、高輝度部のコントラスト再現を最も重視した予測空間を提供する一方で、低輝度部や中間調に対して割り当てられた階調領域は極めて狭く、その領域のコントラスト再現能力は極めて低い画像処理空間を提供する。すなわち、補間用ガンマ空間としてどこかのコントラスト再現を重視すれば、必ずどこかのコントラスト再現は犠牲になるトレードオフの関係にある。これらを1つの補間用ガンマ空間として、低輝度部から中間調、高輝度部に渡るまで全ての階調領域のコントラストを平均的に最良に解像するために示された解決方法が、平方根型の階調空間である。   The logarithmic gradation characteristic gamma space described above provides a prediction space that places great importance on the contrast reproduction of the low-brightness part, while the high-brightness part has a knee characteristic and the gradation is slanted. Contrast reproducibility has the disadvantage of a very low prediction space. On the other hand, interpolation with a constant color difference with linear gradation as disclosed in Patent Document 1 provides a prediction space that places the highest importance on contrast reproduction in high-luminance areas when linear gradation is considered as one of the gamma spaces for interpolation. The gradation area assigned to the low luminance part and the halftone is extremely narrow, and provides an image processing space in which the contrast reproduction capability of the area is extremely low. That is, if importance is placed on contrast reproduction as an interpolation gamma space, there is always a trade-off relationship in which some contrast reproduction is sacrificed. The solution shown to average the best contrast of all gradation areas from low luminance part to halftone and high luminance part as one gamma space for interpolation is the square root type. The gradation space.

しかしながら、平方根型の階調空間も1つの補間ガンマによる予測空間としては平均的に最良のコントラストを備えた高品質な補間画質を提供するものの、画像によってはもう少し別の補間ガンマによる予測空間を試すことによってもっと高コントラストで鮮明な画質が得られる可能性があるという潜在能力を最大限に引き出せていないという課題があった。すなわち、画像全体の印象として、全体的に被りや曇り感があったり、暗部の締まりが少し足りない、鮮鋭感が少し足りないといった傾向が見られる画像も存在していた。   However, although the square root type gradation space provides a high-quality interpolated image quality having the best contrast on average as a prediction space by one interpolation gamma, depending on the image, a prediction space by another interpolation gamma is tried a little more. As a result, there has been a problem that the potential of being able to obtain clearer image quality with higher contrast cannot be maximized. That is, as an overall impression of the image, there is an image in which there is a general tendency that the image is covered or cloudy, the dark portion is slightly tightened, or the sharpness is slightly insufficient.

(1)請求項1に記載の発明は、少なくとも2つの色成分からなり、欠落する色成分が存在する画像データに対して、入力色空間の画像信号を画像処理空間における画像信号に変換し、画像処理空間において欠落する色成分の補間処理を行い、補間処理後の画像信号を出力色空間の画像信号に変換する画像処理装置であって、少なくとも第1と第2の曲率が異なる2つの階調特性の画像信号に変換する階調変換部と、階調変換された各々の画像信号の欠落色成分を補間して、少なくとも2通りの補間画像を生成する色補間部と、少なくとも2通りの補間画像を1つの階調特性の画像処理空間の画像に変換して階調特性を合わせる階調整合部と、第1と第2の階調特性で補間され1つの階調特性に階調整合された第1と第2の補間画像を用いて、2つの画像の同一の画素間で、少なくとも第2の補間画像の画素値と第1の補間画像の画素値との間の差分値を抽出する差分値抽出部と、第2の補間画像に対して、差分値を同一の画素に加算する加算部と、を備えることを特徴とする。
(2)請求項4に記載の発明は、少なくとも2つの色成分からなり、欠落する色成分の存在する画像データに対して、入力色空間の画像信号を画像処理空間における画像信号に変換し、画像処理空間において欠落する色成分の補間処理を行い、補間処理後の画像信号を出力色空間の画像信号に変換する画像処理装置であって、第1、第2、第3の順に曲率が異なる3つの階調特性の画像信号に変換する階調変換部と、階調変換された各々の画像信号の欠落色成分を補間して、3通りの補間画像を生成する色補間部と、3通りの補間画像を1つの階調特性の画像処理空間の画像に変換して階調特性を合わせる階調整合部と、第1〜第3の階調特性で補間され1つの階調特性に階調整合された第1〜第3の補間画像を用いて、3つの画像の同一の画素間で、第2の補間画像の画素値に対する第1の補間画像の画素値と第3の補間画像の画素値との間のラプラシアン成分を抽出するラプラシアン抽出部と、第2の補間画像に対して、ラプラシアン成分を同一の画素に加算する加算部と、を備えることを特徴とする。
(3)請求項9に記載の発明による撮像装置は、被写体像を撮像する撮像部と、撮像部で撮像された画像に対して画像処理を行う請求項1〜6のいずれか一項に記載の画像処理装置と、を備えることを特徴とする。
(1) The invention according to claim 1 converts an image signal in an input color space into an image signal in an image processing space for image data including at least two color components and having a missing color component, An image processing apparatus that performs interpolation processing of missing color components in an image processing space and converts the image signal after the interpolation processing into an image signal in an output color space, at least two floors having different first and second curvatures A tone converting unit that converts the image signal into a tonal characteristic, a color interpolating unit that generates at least two types of interpolated images by interpolating the missing color component of each tone-converted image signal, and at least two types A tone matching unit that converts an interpolated image into an image in an image processing space having a single tone characteristic to match the tone characteristics, and a tone matching that is interpolated using the first and second tone characteristics and that matches one tone characteristic. Using the first and second interpolated images A difference value extraction unit that extracts a difference value between at least a pixel value of the second interpolation image and a pixel value of the first interpolation image between the same pixels of the two images; And an addition unit for adding the difference value to the same pixel.
(2) The invention according to claim 4 converts an image signal in the input color space into an image signal in the image processing space for image data that includes at least two color components and includes missing color components, An image processing apparatus that performs interpolation processing of missing color components in an image processing space and converts the image signal after the interpolation processing into an image signal in an output color space, and the curvatures are different in the first, second, and third order. A gradation conversion unit that converts the image signal into three gradation characteristics, a color interpolation unit that generates three types of interpolated images by interpolating the missing color components of the gradation-converted image signals, and three types The interpolated image is converted into an image in an image processing space having one gradation characteristic, and a gradation matching unit that adjusts the gradation characteristic is interpolated with the first to third gradation characteristics and adjusted to one gradation characteristic. Using the combined first to third interpolated images, the same of the three images A Laplacian extraction unit that extracts a Laplacian component between the pixel value of the first interpolation image and the pixel value of the third interpolation image with respect to the pixel value of the second interpolation image; On the other hand, an addition unit that adds a Laplacian component to the same pixel is provided.
(3) The image pickup apparatus according to the invention described in claim 9 performs image processing on an image pickup unit that picks up a subject image and an image picked up by the image pickup unit. And an image processing apparatus.

本発明によれば、全階調領域で平均的に優れたコントラスト解像を行うことができる従来の画像予測空間の性能を最大限に保ちつつ、更に高コントラストな補間画像を提供する高精細な補間を行える。   According to the present invention, a high-definition image that provides a higher-contrast interpolation image while maintaining the performance of a conventional image prediction space capable of performing excellent contrast resolution on average in all gradation regions while maximizing the performance of the conventional image prediction space. Interpolation can be performed.

Bayer 配列を示す図である。It is a figure which shows a Bayer arrangement | sequence. 3つの階調特性を示す図である。It is a figure which shows three gradation characteristics. 3つの階調特性を示す図である。It is a figure which shows three gradation characteristics. 3つの階調特性を示す図である。It is a figure which shows three gradation characteristics. 3つの階調特性を示す図である。It is a figure which shows three gradation characteristics. コンピュータ装置を説明する図である。It is a figure explaining a computer apparatus. CPUが実行する画像処理の流れを説明するフローチャートである。It is a flowchart explaining the flow of the image processing which CPU performs. 基準画像に対するBayer 補間処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of the Bayer interpolation process with respect to a reference | standard image. 階調間ラプラシアン成分を補正する処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of the process which correct | amends the Laplacian component between gradations. エッジ強調処理の流れを説明するフローチャートである。It is a flowchart explaining the flow of an edge emphasis process. 画像処理装置を搭載するカメラの構成を例示するブロック図である。It is a block diagram which illustrates the composition of the camera carrying an image processing device. Bayer配列における輝度解像力色解像力を周波数空間で表した図である。It is the figure which represented the luminance resolving power color resolving power in a Bayer arrangement | sequence in frequency space. CPUが実行する画像処理の流れを説明するフローチャートである。It is a flowchart explaining the flow of the image processing which CPU performs. 内分加重画像合成処理の詳細を説明するフローチャートである。It is a flowchart explaining the detail of an internal weighting image synthetic | combination process.

以下、図面を参照して本発明を実施するための形態について説明する。本説明では、R(赤)、G(緑)、B(青)が Bayer 配列されたカラーフィルタを通して撮像された画像に対して色補間する画像処理の例を説明する。画像の色は、RGB表色系で表される。   Hereinafter, embodiments for carrying out the present invention will be described with reference to the drawings. In this description, an example of image processing for performing color interpolation on an image captured through a color filter in which R (red), G (green), and B (blue) are arranged in a Bayer array will be described. The color of the image is represented by the RGB color system.

図1は、Bayer 配列を示す図である。このようなカラーフィルタを備える撮像素子から出力される画像信号は、1画素当たりRGBのうちいずれか1つの色成分の情報を有する。すなわち、R色フィルタに対応する画素からはR色の情報が出力され、G色フィルタに対応する画素からはG色の情報が出力され、B色フィルタに対応する画素からはB色の情報が出力される。R色フィルタに対応する画素情報を例にとれば、R成分の情報だけでG成分、B成分の情報がない。このため、画像を構成する全ての画素位置においてRGB全色分の情報を得るために、各画素位置において不足する色成分の情報を補間処理(Bayer 補間)によって算出する。   FIG. 1 is a diagram showing the Bayer array. An image signal output from an image sensor including such a color filter has information on any one color component of RGB per pixel. That is, the R color information is output from the pixel corresponding to the R color filter, the G color information is output from the pixel corresponding to the G color filter, and the B color information is output from the pixel corresponding to the B color filter. Is output. Taking pixel information corresponding to the R color filter as an example, there is no information on the G component and B component only by the information on the R component. For this reason, in order to obtain information for all the RGB colors at all pixel positions constituting the image, information on the color components that are insufficient at each pixel position is calculated by interpolation processing (Bayer interpolation).

<3通りの階調空間>
始めに、以降の説明において用いる3つの補間用ガンマ空間を説明する。本実施形態では、補間用ガンマ空間としての画像処理空間を3つ用意し、3通りの補間結果を得る。具体的には、3本の階調曲線として次の3つの階調空間を定義し、それぞれをΓ1、Γ2、Γ3と名付ける。入力信号をx、出力信号をyとし、入力信号の階調と出力信号の階調が共に、[0,1]の範囲で定義されるものとする。入出力特性は(x,y) = (0,0)と(1,1)を通るように階調曲線(ガンマ曲線)を定義する。実際の入力階調 X の最大値をXmax、出力階調 Y の最大値をYmaxとすると、x = X/Xmax、y = Y/Ymax であり、階調変換は、次式(1)によって行われる。

Figure 2013165482
<Three kinds of gradation spaces>
First, three interpolation gamma spaces used in the following description will be described. In this embodiment, three image processing spaces are prepared as interpolation gamma spaces, and three types of interpolation results are obtained. Specifically, the following three gradation spaces are defined as three gradation curves, and are named Γ 1 , Γ 2 , and Γ 3 , respectively. Assume that the input signal is x, the output signal is y, and both the gradation of the input signal and the gradation of the output signal are defined in the range [0, 1]. The gradation curve (gamma curve) is defined so that the input / output characteristics pass through (x, y) = (0,0) and (1,1). If the maximum value of the actual input gradation X is Xmax and the maximum value of the output gradation Y is Ymax, x = X / Xmax, y = Y / Ymax, and gradation conversion is performed by the following equation (1). Is called.
Figure 2013165482

(I)線形階調特性(Γ1
この階調特性は、高輝度部領域に階調変換後の大部分の階調幅が割り当てられているため、高輝度部のコントラスト構造をしっかりと分解する能力を有した予測空間を提供する。上式(1)における y = f(x)の階調特性は、y = x である。
(I) Linear gradation characteristics (Γ 1 )
This gradation characteristic provides a prediction space having the capability of firmly decomposing the contrast structure of the high luminance part because most of the gradation widths after gradation conversion are assigned to the high luminance part region. The gradation characteristic of y = f (x) in the above equation (1) is y = x.

(II)オフセット付き平方根階調特性(Γ2
この階調特性は、全ての階調領域のコントラスト構造を自然な形で再現する予測空間を提供する。初期のマンセル色空間や Hunter の均等知覚色空間では平方根の階調特性が人間の視感度特性と仮定されている。したがって、人間の視感度に近い階調空間を実現しつつ、均等ノイズ空間をも提供する優れた階調空間である。上式(1)における y = f(x)の階調特性は、次式(2)である。

Figure 2013165482
上式(2)における正のオフセット値εは、暗電流ノイズ成分が増える高感度の撮影条件になるほど大きな値を設定する。 (II) Square root tone characteristics with offset (Γ 2 )
This gradation characteristic provides a prediction space that reproduces the contrast structure of all gradation areas in a natural way. In the early Munsell color space and Hunter's uniform perceptual color space, the gradation characteristic of the square root is assumed to be the human visual sensitivity characteristic. Therefore, it is an excellent gradation space that provides a uniform noise space while realizing a gradation space close to human visibility. The gradation characteristic of y = f (x) in the above equation (1) is the following equation (2).
Figure 2013165482
The positive offset value ε in the above equation (2) is set to a larger value as the imaging condition with higher sensitivity in which the dark current noise component increases.

(III)立方根階調特性、対数階調特性(Γ3
この階調特性は、特に低輝度部のコントラスト構造をしっかりと分解する能力を有した予測空間を提供する。立方根階調特性は、CIE L*a*b* の均等色空間を実現する階調特性として採用されている空間である。人間の視感度特性として、Γ2で採用した階調以外にΓ3で規定するコントラストで分解することを期待されることもありえて、それに対応したコントラスト分解能を有する階調空間を提供する。上式(1)における y=f(x) の階調特性は、次式(3)である。

Figure 2013165482
(III) Cubic root gradation characteristics, logarithmic gradation characteristics (Γ 3 )
This tone characteristic provides a prediction space that has the ability to specifically resolve the contrast structure of the low-brightness part. The cubic root gradation characteristic is a space adopted as a gradation characteristic that realizes a uniform color space of CIE L * a * b *. As a human visual sensitivity characteristic, in addition to the gradation adopted in Γ 2 , it can be expected to be decomposed at a contrast defined by Γ 3 , and a gradation space having a contrast resolution corresponding to that is provided. The gradation characteristic of y = f (x) in the above equation (1) is the following equation (3).
Figure 2013165482

なお、上式(3)の代わりに低輝度部のコントラストを強く分解することができる対数階調空間を用いてもよい。この場合の上式(1)における y = f(x) の階調特性は、次式(4)を用いる。
y = log(kx + 1)/log(k + 1) …(4)
ただし、k は定数で、撮像感度が増えるに従って値を小さく設定する。例えば、線形階調データが14ビットで表されている場合、最低ISO感度では k = 214=16384のような値をとる。ISO感度が一段上がるに従い、k の値を1/2に下げていくような値の設定をすると、ノイズ増幅の危険のない階調予測空間を与えることができる。
Note that a logarithmic gradation space capable of strongly decomposing the contrast of the low luminance portion may be used instead of the above equation (3). In this case, the following equation (4) is used as the gradation characteristic of y = f (x) in the above equation (1).
y = log (kx + 1) / log (k + 1) (4)
However, k is a constant, and the value is set smaller as the imaging sensitivity increases. For example, when the linear gradation data is represented by 14 bits, the lowest ISO sensitivity takes a value such as k = 2 14 = 16384. If the value of k is set to ½ as the ISO sensitivity is further increased, a tone prediction space without the risk of noise amplification can be provided.

図2は、上述した3つの階調特性を示す図である。3本の階調特性曲線は、Γ1、Γ2、Γ3の順に曲率が増して線形階調からの差異が大きくなっているといえる。なお、3つの階調特性の選び方は、任意性があり、これらに限る必要はなく、目的に応じて曲線の形を調整することが可能である。図2は、線形階調とオフセット付き平方根階調と立方根階調を比較した例である。図3−図5に、立方根階調ではなく対数階調を使用し、平方根階調のオフセット値と対数階調の定数をISO感度に応じて変える様子を示している。 FIG. 2 is a diagram illustrating the above-described three gradation characteristics. In the three gradation characteristic curves, it can be said that the curvature increases in the order of Γ 1 , Γ 2 , and Γ 3 and the difference from the linear gradation increases. The method of selecting the three gradation characteristics is arbitrary, and is not limited to these. The shape of the curve can be adjusted according to the purpose. FIG. 2 shows an example in which a linear gradation, a square root gradation with an offset, and a cubic root gradation are compared. FIG. 3 to FIG. 5 show how the logarithmic gradation is used instead of the cubic root gradation, and the offset value of the square root gradation and the constant of the logarithmic gradation are changed according to the ISO sensitivity.

なお、本説明では Bayer 配列による画像を色補間する例を説明するが、特許文献3に示されるデルタ配列や任意の他の配列による画像にも同様に適用できる。   In this description, an example in which color interpolation is performed on an image based on the Bayer array will be described. However, the present invention can be similarly applied to an image based on the delta array shown in Patent Document 3 or any other array.

<事前の説明>
実施形態を詳細に説明する前に、本発明の本質をここで述べておく。Bayer 配列のRGB色成分が、上記3つの階調特性Γ1、Γ2、Γ3のそれぞれに変換され、それぞれの画像処理空間で色成分が公知のデモザイク技術によって色補間されたと仮定する。そして、Γ1空間での補間結果の各色面をR(Γ1)(x,y)、G(Γ1)(x,y)、B(Γ1)(x,y)とする。同様に、Γ2空間での補間結果の各色面をR(Γ2)(x,y)、G(Γ2)(x,y)、B(Γ2)(x,y)とする。さらに、Γ3空間での補間結果の各色面をR(Γ3)(x,y)、G(Γ3)(x,y)、B(Γ3)(x,y)とする。これらの全ての色面を、基準となるΓ2空間の階調特性の画像に変換する。こうして得られた画像をそれぞれ以下の記号で表すことにする。
<Preliminary explanation>
Before describing the embodiments in detail, the essence of the present invention will be described here. It is assumed that the RGB color components in the Bayer array are converted into the above three gradation characteristics Γ 1 , Γ 2 , and Γ 3 , and the color components are color-interpolated by a known demosaic technique in each image processing space. Then, R (Γ1) (x, y), G (Γ1) (x, y), and B (Γ1) (x, y) are set as the color planes of the interpolation result in the Γ 1 space. Similarly, R (Γ2) (x, y), G (Γ2) (x, y), and B (Γ2) (x, y) are set as the color planes of the interpolation result in the Γ 2 space. Further, the color planes of the interpolation result in the Γ 3 space are R (Γ3) (x, y), G (Γ3) (x, y), and B (Γ3) (x, y). All of these color planes are converted into an image having gradation characteristics in the standard Γ 2 space. The images thus obtained are represented by the following symbols.

Γ1空間で予測されΓ2空間に移行したRGB画像:R(Γ1→Γ2)(x,y)、G(Γ1→Γ2)(x,y)、B(Γ1→Γ2)(x,y)
Γ2空間で予測されΓ2空間に移行したRGB画像:R(Γ2→Γ2)(x,y)、G(Γ2→Γ2)(x,y)、B(Γ2→Γ2)(x,y)
Γ3空間で予測されΓ2空間に移行したRGB画像:R(Γ3→Γ2)(x,y)、G(Γ3→Γ2)(x,y)、B(Γ3→Γ2)(x,y)
実際には、Γ1空間で予測された画像とΓ3空間で予測された画像にのみ階調変換処理が必要となる。
RGB images predicted in Γ 1 space and shifted to Γ 2 space: R (Γ1 → Γ2) (x, y), G (Γ1 → Γ2) (x, y), B (Γ1 → Γ2) (x, y)
RGB image has shifted to the predicted gamma 2 space gamma 2 space: R (Γ2 → Γ2) ( x, y), G (Γ2 → Γ2) (x, y), B (Γ2 → Γ2) (x, y)
RGB images predicted in Γ 3 space and shifted to Γ 2 space: R (Γ3 → Γ2) (x, y), G (Γ3 → Γ2) (x, y), B (Γ3 → Γ2) (x, y)
Actually, gradation conversion processing is required only for an image predicted in the Γ 1 space and an image predicted in the Γ 3 space.

1つの考え方として、3つの予測空間を用いて補間(予測)された結果を、それぞれの空間における得手、不得手の階調領域を見分けて加重合成すればよいという考え方が成り立つ。しかしながらこの考え方では、補間で必要とするコントラスト解像は、明るい部分と暗い部分とが隣接して存在するようなときにどのような階調空間を用いればよいかという問題を投げかけられる。この問題に対して、まだ補間値が存在していない補間対象の画素は、周囲画素の情報を用いて明るい領域なのか、暗い領域なのか、中間調の領域なのかを画素単位で決める必要があり、その判断基準が容易に見分けられないという難題に直面してしまう。   One way of thinking is that the results of interpolation (prediction) using three prediction spaces may be weighted and synthesized by distinguishing the gradation areas that are good and bad in each space. However, with this concept, the contrast resolution required for interpolation raises the question of what gradation space should be used when a bright part and a dark part exist adjacent to each other. In order to solve this problem, it is necessary to determine, on a pixel-by-pixel basis, whether a pixel to be interpolated for which an interpolation value does not exist is a bright region, a dark region, or a halftone region using information on surrounding pixels. Yes, we face the challenge of not being able to easily identify the criteria.

本発明は、このような難題を容易に回避すべく、上述した3通りの階調空間における3つの補間結果によって予測された空間コントラストを最大限に最終結果に投影するものである。すなわち、3つの補間画像を用いて同一画素内における予測空間の違いを利用した階調間ラプラシアン成分を導出し、それを基準ガンマ空間の補間結果に加算してコントラスト補正を行う。   In order to easily avoid such a problem, the present invention projects the spatial contrast predicted by the above three interpolation results in the three gradation spaces to the final result to the maximum extent. That is, an inter-tone Laplacian component using a difference between prediction spaces in the same pixel is derived using three interpolation images, and added to the interpolation result of the reference gamma space to perform contrast correction.

式で表せば、次式(5)のように表すことができる。
R'(Γ2→Γ2)(x,y) = R(Γ2→Γ2)(x,y)+k*[2*R(Γ2→Γ2)(x,y)- R(Γ1→Γ2)(x,y)- R(Γ3→Γ2)(x,y)]
G'(Γ2→Γ2)(x,y) = G(Γ2→Γ2)(x,y)+k*[2*G(Γ2→Γ2)(x,y)- G(Γ1→Γ2)(x,y)- G(Γ3→Γ2)(x,y)]…(5)
B'(Γ2→Γ2)(x,y) = B(Γ2→Γ2)(x,y)+k*[2*B(Γ2→Γ2)(x,y)- B(Γ1→Γ2)(x,y)- B(Γ3→Γ2)(x,y)]
ここに、定数k は通常1程度の値をとる。
If expressed by an expression, it can be expressed as the following expression (5).
R ' (Γ2 → Γ2) (x, y) = R (Γ2 → Γ2) (x, y) + k * [2 * R (Γ2 → Γ2) (x, y)-R (Γ1 → Γ2) (x , y)-R (Γ3 → Γ2) (x, y)]
G ' (Γ2 → Γ2) (x, y) = G (Γ2 → Γ2) (x, y) + k * [2 * G (Γ2 → Γ2) (x, y)-G (Γ1 → Γ2) (x , y)-G (Γ3 → Γ2) (x, y)]… (5)
B ' (Γ2 → Γ2) (x, y) = B (Γ2 → Γ2) (x, y) + k * [2 * B (Γ2 → Γ2) (x, y)-B (Γ1 → Γ2) (x , y)-B (Γ3 → Γ2) (x, y)]
Here, the constant k usually takes a value of about 1.

こうして、従来の平方根階調特性の補間用ガンマ空間の性能を最大限に保存しつつ、平方根階調特性では予測できなかった原画像が持つコントラストの最大幅を、他の予測空間で導き出し、出力画像に反映させることが可能になる。その結果、画像として全体的な曇り感が抜け、透明感、立体感や解像感が増した高精細な補間画質を得ることが可能になる。これらは、従来の補間では得ることができなかった重要な部分での微細なコントラストを大きな振幅成分として記述する能力を提供する。また、平方根階調以外の予測空間では、例えば線形階調空間での、暗部のコントラスト解像が全く得られず画像が融けてしまうとか、高輝度部の輝点周りで激しいオーバーシュートや偽色を発するといった破綻や、立方根や対数階調での暗部のノイズを増幅しすぎるといった危険を被ることなく純粋な改善効果を得ることが可能になる。   In this way, while preserving the performance of the conventional gamma space for interpolation with the square root gradation characteristics, the maximum width of the contrast of the original image that could not be predicted with the square root gradation characteristics is derived and output in other prediction spaces. It can be reflected in the image. As a result, it is possible to obtain a high-definition interpolation image quality in which the overall cloudiness is lost as an image, and the transparency, stereoscopic effect, and resolution are increased. These provide the ability to describe a fine contrast as a large amplitude component in an important part that could not be obtained by conventional interpolation. Also, in the prediction space other than the square root gradation, for example, in the linear gradation space, the contrast resolution in the dark part cannot be obtained at all, and the image melts, or severe overshoot or false color around the bright spot in the high luminance part It is possible to obtain a pure improvement effect without incurring the dangers of failure such as generating a noise, or excessively amplifying the noise in the dark portion at the cubic root or logarithmic gradation.

上式(5)の階調間ラプラシアン成分を分解すると、例えばR成分の場合は次式(6)で示すように2つの部分に分けることができる。
[ R(Γ2→Γ2)(x,y) - R(Γ1→Γ2)(x,y)] + [ R(Γ2→Γ2)(x,y) - R(Γ3→Γ2)(x,y)] …(6)
これは、2つの部分のうちどちらか一方だけを使っても、補間コントラスト最大化の効用をその成分が存在する画像を扱っている限りにおいて得ることができることを意味する。すなわち、アクティブに補間ガンマを基準階調から1つだけでもずらした予測空間を用意し、その補間コントラストを調べて基準補間との差異を見るだけでも、補正項のラプラシアン成分を作ることができることを意味する。
When the inter-tone Laplacian component of the above equation (5) is decomposed, for example, the R component can be divided into two parts as shown in the following equation (6).
[R (Γ2 → Γ2) (x, y)-R (Γ1 → Γ2) (x, y)] + [R (Γ2 → Γ2) (x, y)-R (Γ3 → Γ2) (x, y) ] (6)
This means that even if only one of the two parts is used, the utility of maximizing the interpolation contrast can be obtained as long as the image in which the component exists is handled. In other words, it is possible to create a Laplacian component of the correction term simply by preparing a prediction space in which only one interpolation gamma is shifted from the reference gradation and examining the interpolation contrast to see the difference from the reference interpolation. means.

<第一の実施形態>
以下、本発明の第一の実施形態について詳細に説明する。第一の実施形態では、Bayer 補間の際にRGB成分の全ての色面で階調間ラプラシアンを抽出し、各色面の3成分に対して補間コントラストを補正する。
<First embodiment>
Hereinafter, the first embodiment of the present invention will be described in detail. In the first embodiment, during the Bayer interpolation, inter-tone Laplacians are extracted from all color planes of the RGB components, and the interpolation contrast is corrected for the three components of each color plane.

本実施形態は、Bayer 補間処理を行う画像処理プログラムを図6に示すコンピュータ装置100に実行させることにより、画像処理装置を提供する。プログラムをパーソナルコンピュータ100に取込む場合には、パーソナルコンピュータ100のデータストレージ装置にプログラムをローディングした上で当該プログラムを実行させることにより、画像処理装置として使用する。   The present embodiment provides an image processing apparatus by causing the computer apparatus 100 shown in FIG. 6 to execute an image processing program for performing Bayer interpolation processing. When the program is loaded into the personal computer 100, the program is loaded on the data storage device of the personal computer 100 and then executed to use the program as an image processing apparatus.

プログラムのローディングは、プログラムを格納したCD−ROMなどの記録媒体104をパーソナルコンピュータ100にセットして行ってもよいし、ネットワークなどの通信回線101を経由する方法でパーソナルコンピュータ100へローディングしてもよい。ネットワーク101を経由する場合は、ネットワーク101に接続されたサーバコンピュータ102のハードディスク装置103などにプログラムを格納しておく。このように、プログラムは記録媒体104や通信回線101を介する提供などの種々の形態のコンピュータプログラム製品として供給される。   The program may be loaded by setting a recording medium 104 such as a CD-ROM storing the program in the personal computer 100, or by loading the program into the personal computer 100 via a communication line 101 such as a network. Good. When going through the network 101, the program is stored in the hard disk device 103 of the server computer 102 connected to the network 101. In this manner, the program is supplied as various types of computer program products such as provision via the recording medium 104 or the communication line 101.

ここで、補間用ガンマ空間以外の部分であって、公知の Bayer 補間技術を記述する最も優れた例として、本出願人と同一発明者の米国特許出願公開2010/021853号明細書に示される補間アルゴリズムがある。このBayer 補間技術には、本出願人と同一発明者の方向判定の分解能を上げる技術(米国特許第6,836,572号)や、補間値算出時の斜め線ジャギー対策技術(米国特許第7,236,628号)、色判定法による適応的偽色対策技術と方向判定の分解能を上げる技術(米国特許第7,565,007号)、色勾配判定法による適応的偽色対策技術(米国特許第7,391,903号)と方向判定の分解能を上げる技術への適用が総合的に用いられた最良の高性能デモザイク技術が搭載されている。そこで、本実施形態でも、追加部分の機能を最善に目的を達するためにこれらの結果を用いる必要があるので、「補間アルゴリズムA」として本文全体を再引用する。   Here, as the best example of describing the well-known Bayer interpolation technique other than the interpolation gamma space, the interpolation shown in US Patent Application Publication No. 2010/021853 of the same inventor as the present inventor is described. There is an algorithm. This Bayer interpolation technique includes a technique for increasing the direction determination resolution of the same inventor as the present applicant (US Pat. No. 6,836,572), a technique for preventing oblique line jaggies when calculating an interpolation value (US Pat. No. 7,236,628), color Adaptive false color countermeasure technology based on judgment method and technology to increase direction resolution (US Pat. No. 7,565,007), adaptive false color countermeasure technology based on color gradient judgment method (US Pat. No. 7,391,903) and direction resolution It is equipped with the best high-performance demosaic technology that is comprehensively applied to technology. Therefore, in this embodiment as well, it is necessary to use these results in order to best achieve the purpose of the function of the additional portion. Therefore, the entire text is re-quoted as “interpolation algorithm A”.

図7は、コンピュータ装置100のCPUが実行する画像処理の流れを説明するフローチャートである。図7のステップS1において、コンピュータ装置100のCPU(以降は単にCPUとよぶ)は、Bayer 画像を入力してステップS2へ進む。本説明では、線形階調のBayer 配列面を M(x,y)で表す。M(multiplexed)は、R,G,B成分が空間的に多重化されたことを表す。入力したBayer 画像のデータは、補間処理の対象としてコンピュータ装置100のワークメモリに格納する。もし、Bayer 画像を構成する各色成分がガンマ補正された階調空間で表されている場合には、ガンマ補正前の線形階調のデータへ戻してから、以降の処理を行う。   FIG. 7 is a flowchart for explaining the flow of image processing executed by the CPU of the computer apparatus 100. In step S1 of FIG. 7, the CPU (hereinafter simply referred to as CPU) of the computer apparatus 100 inputs the Bayer image and proceeds to step S2. In this description, the linear gray scale Bayer array plane is represented by M (x, y). M (multiplexed) represents that R, G, B components are spatially multiplexed. The input Bayer image data is stored in the work memory of the computer device 100 as an interpolation processing target. If each color component constituting the Bayer image is expressed in a gamma-corrected gradation space, the subsequent processing is performed after returning to the linear gradation data before the gamma correction.

ステップS2において、CPUは、線形階調のBayer 画像のデータを、前述の3通りの補間用ガンマ空間(Γ1、Γ2、Γ3)に変換する。その結果、M(Γ1)(x,y)、M(Γ2)(x,y)、M(Γ3)(x,y)が生成される。本実施形態では、3つのガンマ空間のうち中間階調をとるΓ2空間に変換された画像を基準画像とする。これは、均等ノイズ空間を画像処理空間として色補間処理を行うためである。したがって、あらゆる明るさレベルでのノイズ幅が均質になるため、方向判定の性能が最大化され、他の色成分を利用した補間値算出ではノイズ増幅を最小限に抑えることが可能になる。 In step S2, the CPU converts the data of the linear gradation Bayer image into the above-described three interpolation gamma spaces (Γ 1 , Γ 2 , Γ 3 ). As a result, M (Γ1) (x, y), M (Γ2) (x, y), and M (Γ3) (x, y) are generated. In the present embodiment, an image converted into a Γ 2 space having an intermediate gradation among the three gamma spaces is used as a reference image. This is because color interpolation processing is performed using the uniform noise space as an image processing space. Therefore, since the noise width becomes uniform at all brightness levels, the performance of direction determination is maximized, and noise amplification can be minimized in the interpolation value calculation using other color components.

ステップS3において、CPUは、基準画像に対してBayer 補間(1通り)を行う。すなわち、基準階調である補間用ガンマ空間(Γ2空間)のBayer 配列面 M(Γ2)(x,y)に対して、上記「補間アルゴリズムA」を使用して補間画像 R(Γ2)(x,y)、G(Γ2)(x,y)、B(Γ2)(x,y)を生成する。以下に「補間アルゴリズムA」の内容を説明する。ただし、(x,y)は[i,j]の記号を用いて説明するものとする。また、M面上のG成分はG、M面上のR,B成分はZの記号を用いて参照する。 In step S3, the CPU performs Bayer interpolation (one way) on the reference image. That, Bayer array surface M (Γ2) (x, y ) of the interpolation gamma space is a reference tone (gamma 2 space) with respect to, the "interpolation algorithm A" using the interpolated image R (.GAMMA.2) ( x, y), G (Γ2) (x, y), and B (Γ2) (x, y) are generated. The contents of “interpolation algorithm A” will be described below. However, (x, y) is described using the symbol [i, j]. The G component on the M plane is referred to using G, and the R and B components on the M plane are referred to using Z.

図8は、基準画像に対して「補間アルゴリズムA」で行うBayer 補間処理の詳細を説明するフローチャートである。「補間アルゴリズムA」では、ステップS31〜S41においてCrCb面を生成し、ステップS42〜S45においてG面を生成する。図8のステップS31において、CPUは「縦横方向判定1」の処理を行う。「縦横方向判定1」の処理は、(S31-1)類似度の算出と、(S31-2)類似性判定とで構成される。具体的には、R,B画素位置について以下の計算を行う。   FIG. 8 is a flowchart for explaining the details of the Bayer interpolation process performed with the “interpolation algorithm A” on the reference image. In the “interpolation algorithm A”, a CrCb surface is generated in steps S31 to S41, and a G surface is generated in steps S42 to S45. In step S31 in FIG. 8, the CPU performs a process of “vertical / horizontal direction determination 1”. The processing of “vertical / horizontal direction determination 1” includes (S31-1) similarity calculation and (S31-2) similarity determination. Specifically, the following calculation is performed for the R and B pixel positions.

(S31-1)類似度の算出
類似度の算出は、(a)異色間類似度の算出と、(b)類似度の周辺加算とを行う。
(a)異色間類似度の算出
CPUは、次式(7)、(8)によりGR(GB)間類似度成分を算出する。
Cv0[i,j] = (|G[i,j-1] - Z[i,j]| + |G[i,j+1] - Z[i,j]|)/2 …(7)
Ch0[i,j] = (|G[i-1,j] - Z[i,j]| + |G[i+1,j] - Z[i,j]|)/2 …(8)
(S31-1) Calculation of similarity The calculation of similarity is performed by (a) calculating the similarity between different colors and (b) adding the surroundings of the similarity.
(a) Calculation of similarity between different colors The CPU calculates a similarity component between GR (GB) by the following equations (7) and (8).
Cv0 [i, j] = (| G [i, j-1]-Z [i, j] | + | G [i, j + 1]-Z [i, j] |) / 2 (7)
Ch0 [i, j] = (| G [i-1, j]-Z [i, j] | + | G [i + 1, j]-Z [i, j] |) / 2 (8)

CPUはさらに、次式(9)、(10)により(b)類似度の周辺加算を行う。この処理は、周辺画素との連続性を考慮することにより類似度の精度を上げるためのもので、簡略性を優先する場合は省いても良い。
Cv[i,j] = (4*Cv0[i,j]
+ 2*(Cv0[i-1,j-1] + Cv0[i+1,j-1] + Cv0[i-1,j+1] + Cv0[i+1,j+1])
+ Cv0[i,j-2] + Cv0[i,j+2] + Cv0[i-2,j] + Cv0[i+2,j])/16 …(9)
Ch[i,j] = (4*Ch0[i,j]
+ 2*(Ch0[i-1,j-1] + Ch0[i+1,j-1] + Ch0[i-1,j+1] + Ch0[i+1,j+1])
+ Ch0[i,j-2] + Ch0[i,j+2] + Ch0[i-2,j] + Ch0[i+2,j])/16 …(10)
The CPU further performs (b) similarity addition according to the following equations (9) and (10). This process is for increasing the accuracy of similarity by considering continuity with surrounding pixels, and may be omitted when priority is given to simplicity.
Cv [i, j] = (4 * Cv0 [i, j]
+ 2 * (Cv0 [i-1, j-1] + Cv0 [i + 1, j-1] + Cv0 [i-1, j + 1] + Cv0 [i + 1, j + 1])
+ Cv0 [i, j-2] + Cv0 [i, j + 2] + Cv0 [i-2, j] + Cv0 [i + 2, j]) / 16 (9)
Ch [i, j] = (4 * Ch0 [i, j]
+ 2 * (Ch0 [i-1, j-1] + Ch0 [i + 1, j-1] + Ch0 [i-1, j + 1] + Ch0 [i + 1, j + 1])
+ Ch0 [i, j-2] + Ch0 [i, j + 2] + Ch0 [i-2, j] + Ch0 [i + 2, j]) / 16… (10)

(S31-2)類似性判定
CPUは、上記算出した類似度に基づいて、次式(11)により類似性を判定する。
if |Cv[i,j] - Ch[i,j]| =< Th0 HVd[i,j] = 0 縦横類似性不明
else if Cv[i,j] < Ch[i,j] HVd[i,j] = 1 縦類似
else HVd[i,j] = -1 横類似 …(11)
ただし、閾値Th0 は256階調のとき10前後の値をとり、画像のノイズが多いときは高めに設定する。
(S31-2) Similarity determination The CPU determines similarity according to the following equation (11) based on the calculated similarity.
if | Cv [i, j]-Ch [i, j] | = <Th0 HVd [i, j] = 0 Unknown vertical / horizontal similarity
else if Cv [i, j] <Ch [i, j] HVd [i, j] = 1 Vertical similarity
else HVd [i, j] = -1 horizontal similarity (11)
However, the threshold value Th0 takes a value of around 10 for 256 gradations, and is set higher when there is a lot of image noise.

ステップS32において、CPUは「色差生成」する。「色差生成」の処理は、(S32-1)R位置Cr面生成と、(S32-2)Cr面補間とで構成される。
(S32-1)R位置Cr面生成
CPUは、次式(12)によりR位置Cr面を生成する。
if [i,j] is a R site in a Bayer plane{
if HVd[i,j] = 1 Cr[i,j] = R[i,j]
- {(G[i,j-1] + G[i,j+1])/2
+ (2*R[i,j] - R[i,j-2] - R[i,j+2])/4}
else if HVd[i,j] = -1 Cr[i,j] = R[i,j]
- {(G[i-1,j] + G[i+1,j])/2
+ (2*R[i,j] - R[i-2,j] - R[i+2,j])/4}
else Cr[i,j] = R[i,j]
- {(G[i,j-1] + G[i,j+1] + G[i-1,j] + G[i+1,j])/4
+ (4*R[i,j] - R[i,j-2] - R[i,j+2] - R[i-2,j] - R[i+2,j])/8}
} …(12)
In step S32, the CPU performs “color difference generation”. The “color difference generation” process includes (S32-1) R-position Cr plane generation and (S32-2) Cr plane interpolation.
(S32-1) R position Cr plane generation The CPU generates an R position Cr plane by the following equation (12).
if [i, j] is a R site in a Bayer plane {
if HVd [i, j] = 1 Cr [i, j] = R [i, j]
-{(G [i, j-1] + G [i, j + 1]) / 2
+ (2 * R [i, j]-R [i, j-2]-R [i, j + 2]) / 4}
else if HVd [i, j] = -1 Cr [i, j] = R [i, j]
-{(G [i-1, j] + G [i + 1, j]) / 2
+ (2 * R [i, j]-R [i-2, j]-R [i + 2, j]) / 4}
else Cr [i, j] = R [i, j]
-{(G [i, j-1] + G [i, j + 1] + G [i-1, j] + G [i + 1, j]) / 4
+ (4 * R [i, j]-R [i, j-2]-R [i, j + 2]-R [i-2, j]-R [i + 2, j]) / 8}
} (12)

または、上式(12)に代えて次式(13)によりR位置Cr面を算出する。
if [i,j] is a R site in a Bayer plane{
if HVd[i,j] = 1 Cr[i,j] = R[i,j]
- {(G[i,j-1] + G[i,j+1])/2
+ (2*G[i-1,j] - G[i-1,j-2] - G[i-1,j+2]
+ 2*G[i+1,j] - G[i+1,j-2] - G[i+1,j+2])/8}
else if HVd[i,j] = -1 Cr[i,j] = R[i,j]
- {(G[i-1,j] + G[i+1,j])/2
+ (2*G[i,j-1] - G[i-2,j-1] - G[i+2,j-1]
+ 2*G[i,j+1] - G[i-2,j+1] - G[i+2,j+1])/8}
else Cr[i,j] = R[i,j]
- {(G[i,j-1] + G[i,j+1] + G[i-1,j] + G[i+1,j])/4
+ (2*G[i-1,j] - G[i-1,j-2] - G[i-1,j+2]
+ 2*G[i+1,j] - G[i+1,j-2] - G[i+1,j+2]
+2*G[i, j-1]-G[i-2, j-1]-G[i+2, j-1]
+2*G[i, j+1]-G[i-2, j+1]-G[i+2, j+1])/16}
} …(13)
ここで、異色間類似度のみで類似性判定した方向指標 HVd[i,j]を用いたのは、ナイキスト周波数近傍の偽色発生を大幅に抑制できるからである。
Alternatively, the R position Cr plane is calculated by the following equation (13) instead of the above equation (12).
if [i, j] is a R site in a Bayer plane {
if HVd [i, j] = 1 Cr [i, j] = R [i, j]
-{(G [i, j-1] + G [i, j + 1]) / 2
+ (2 * G [i-1, j]-G [i-1, j-2]-G [i-1, j + 2]
+ 2 * G [i + 1, j]-G [i + 1, j-2]-G [i + 1, j + 2]) / 8}
else if HVd [i, j] = -1 Cr [i, j] = R [i, j]
-{(G [i-1, j] + G [i + 1, j]) / 2
+ (2 * G [i, j-1]-G [i-2, j-1]-G [i + 2, j-1]
+ 2 * G [i, j + 1]-G [i-2, j + 1]-G [i + 2, j + 1]) / 8}
else Cr [i, j] = R [i, j]
-{(G [i, j-1] + G [i, j + 1] + G [i-1, j] + G [i + 1, j]) / 4
+ (2 * G [i-1, j]-G [i-1, j-2]-G [i-1, j + 2]
+ 2 * G [i + 1, j]-G [i + 1, j-2]-G [i + 1, j + 2]
+ 2 * G [i, j-1] -G [i-2, j-1] -G [i + 2, j-1]
+ 2 * G [i, j + 1] -G [i-2, j + 1] -G [i + 2, j + 1]) / 16}
} (13)
Here, the reason why the direction index HVd [i, j], in which the similarity is determined only by the similarity between different colors, is used because the generation of the false color near the Nyquist frequency can be significantly suppressed.

(S32-2)Cr面補間
CPUは、次式(14)〜(16)によりCr面を補間する。
B sites
Cr[i,j] = (Cr[i-1,j-1] + Cr[i-1,j+1] + Cr[i+1,j-1] + Cr[i+1,j+1])/4 …(14)
G sites (same lines as R rows)
Cr[i,j] = (Cr[i-1,j] + Cr[i+1,j])/2 …(15)
G sites (same lines as B rows)
Cr[i,j] = (Cr[i,j-1] + Cr[i,j+1])/2 …(16)
CPUは、Cb面についても同様に行う。すなわち、R位置Cb面生成と、Cb面補間とを行う。
(S32-2) Cr surface interpolation The CPU interpolates the Cr surface according to the following equations (14) to (16).
B sites
Cr [i, j] = (Cr [i-1, j-1] + Cr [i-1, j + 1] + Cr [i + 1, j-1] + Cr [i + 1, j + 1 ]) / 4 ... (14)
G sites (same lines as R rows)
Cr [i, j] = (Cr [i-1, j] + Cr [i + 1, j]) / 2 (15)
G sites (same lines as B rows)
Cr [i, j] = (Cr [i, j-1] + Cr [i, j + 1]) / 2 (16)
The CPU performs the same for the Cb surface. That is, R position Cb surface generation and Cb surface interpolation are performed.

ステップS33において、CPUは、「仮色差補正1」を行う。ステップS32の色差生成で求まった色差面には偽色がふんだんに乗っており、色モアレや高ISO感度時における色斑ノイズの要因となっている。これらは色構造と区別して適応的に除去されるべきであるが、後述する色勾配を指標として区別するとき偽色の境界が色境界と誤認定されないように予め仮の除去をしておく。以下に方法を2つ例示するが、方法1または方法2によって行えばよい。なお、必ずしもこの方法に限らなくてもよい。   In step S33, the CPU performs “provisional color difference correction 1”. There are plenty of false colors on the color difference plane obtained by the color difference generation in step S32, which causes color moire and color spot noise at high ISO sensitivity. These should be adaptively removed in distinction from the color structure. However, provisional removal is performed in advance so that a false color boundary is not erroneously identified as a color boundary when a color gradient described later is distinguished as an index. Although two methods are illustrated below, it may be performed by Method 1 or Method 2. Note that this method is not necessarily limited to this method.

方法1(ローパス処理)
ローパスフィルタリング処理として、9×9サイズの分離型フィルタを例示する。 画素並びの水平方向、垂直方向に対し、それぞれ式(17)、(18)が対応する。
Horizontal lowpass filtering
tmp_Cr[i,j] = {70*Cr[i,j] + 56*(Cr[i-1,j] + Cr[i+1,j])
+ 28*(Cr[i-2,j] + Cr[i+2,j]) + 8*(Cr[i-3,j] + Cr[i+3,j])
+ (Cr[i-4,j] + Cr[i+4,j])}/256 …(17)
Vertical lowpass filtering
TCr1[i,j] = {70* tmp_Cr[i,j] + 56*(tmp_Cr[i,j-1] + tmp_Cr[i,j+1])
+ 28*(tmp_Cr[i,j-2] + tmp_Cr[i,j+2])
+ 8*(tmp_Cr[i,j-3] + tmp_Cr[i,j+3])
+ tmp_Cr[i,j-4] + tmp_Cr[i,j+4]}/256 …(18)
Cr面について説明したが、Cb面についても同様に TCb1[i,j]を算出する。
Method 1 (Low-pass processing)
A 9 × 9 separable filter is exemplified as the low-pass filtering process. Expressions (17) and (18) correspond to the horizontal direction and vertical direction of the pixel arrangement, respectively.
Horizontal lowpass filtering
tmp_Cr [i, j] = (70 * Cr [i, j] + 56 * (Cr [i-1, j] + Cr [i + 1, j])
+ 28 * (Cr [i-2, j] + Cr [i + 2, j]) + 8 * (Cr [i-3, j] + Cr [i + 3, j])
+ (Cr [i-4, j] + Cr [i + 4, j])} / 256 (17)
Vertical lowpass filtering
TCr1 [i, j] = (70 * tmp_Cr [i, j] + 56 * (tmp_Cr [i, j-1] + tmp_Cr [i, j + 1])
+ 28 * (tmp_Cr [i, j-2] + tmp_Cr [i, j + 2])
+ 8 * (tmp_Cr [i, j-3] + tmp_Cr [i, j + 3])
+ tmp_Cr [i, j-4] + tmp_Cr [i, j + 4]} / 256… (18)
Although the description has been given for the Cr plane, TCb1 [i, j] is calculated in the same manner for the Cb plane.

方法2(メディアン処理)
メディアン処理の場合は、次式(19)により算出する。Cb面についても同様にTCb1[i,j]を算出する。
TCr1[i,j] = Median{Cr[i+m,j+n]} …(19)
ただし、m = 0,±1,±2,±3,±4 n = m = 0,±1,±2,±3,±4
Method 2 (median processing)
In the case of median processing, calculation is performed by the following equation (19). Similarly, TCb1 [i, j] is calculated for the Cb plane.
TCr1 [i, j] = Median {Cr [i + m, j + n]} (19)
However, m = 0, ± 1, ± 2, ± 3, ± 4 n = m = 0, ± 1, ± 2, ± 3, ± 4

ステップS34において、CPUは「色勾配解析」を行う。具体的には、色構造部を破壊しないように、色勾配を調べて偽色と実在色とを判別する。実在色はステップS33の「仮色差補正1」の処理を加えても偽色に比べてコントラストが残りやすいので、その統計的性質から非常に高い確度で区別が可能である。できるだけ精度よく色構造を守るため、実在色間の色コントラストを上げて、偽色間の色コントラストを下げるような色指標面を作る。一般に、偽色は反対色間で現れやすいので、原色間で色指標を生成するのがよい。   In step S34, the CPU performs “color gradient analysis”. Specifically, the false color and the actual color are discriminated by examining the color gradient so as not to destroy the color structure portion. Even if the process of “provisional color difference correction 1” in step S33 is applied to the actual color, the contrast is likely to remain as compared with the false color, so that it is possible to distinguish the actual color with very high accuracy from its statistical properties. In order to protect the color structure as accurately as possible, a color index surface is created that increases the color contrast between the existing colors and decreases the color contrast between the false colors. In general, since false colors tend to appear between opposite colors, it is preferable to generate a color index between primary colors.

すなわち、上述のようにして求まった仮色差信号 TCr1[i,j],TCb1[i,j]から、次式(20)により画素単位の色を評価するための色指標 Cdiff[i,j]に変換する。
Cdiff[i,j] = (|TCr1[i,j]| + |TCb1[i,j]| + |TCr1[i,j] - TCb1[i,j]|)/3 …(20)
上記色指標は、RGB3原色間で組み合わせ可能な全ての色差情報を利用して、色構造の防御性能を向上させている。色差の定義式を展開すると、次式(21)のようになる。
Cdiff = (|R-G| + |G-B| + |B-R|)/3 …(21)
That is, the color index Cdiff [i, j] for evaluating the color of each pixel by the following equation (20) from the temporary color difference signals TCr1 [i, j] and TCb1 [i, j] obtained as described above. Convert to
Cdiff [i, j] = (| TCr1 [i, j] | + | TCb1 [i, j] | + | TCr1 [i, j]-TCb1 [i, j] |) / 3 (20)
The color index uses all the color difference information that can be combined between the three primary colors of RGB to improve the protection performance of the color structure. When the definition of the color difference is expanded, the following equation (21) is obtained.
Cdiff = (| RG | + | GB | + | BR |) / 3 (21)

次に、CPUは、単一の色指標面に色コントラスト情報を押し込めた面内で、色の変化の度合いを表す色勾配を調べる。このとき色勾配検出用の微分フィルタサイズを仮色差補正フィルタのサイズと同一にして色構造部の破壊の可能性がある範囲は全て調べられるようにし、色構造非破壊性を高める。色勾配は、次式(22)で表される。

Figure 2013165482
Next, the CPU examines a color gradient representing the degree of color change within the plane in which the color contrast information is pressed into a single color index plane. At this time, the size of the differential filter for detecting the color gradient is made the same as the size of the provisional color difference correction filter so that the entire range where there is a possibility of destruction of the color structure portion is examined, thereby improving the non-destructive nature of the color structure. The color gradient is expressed by the following equation (22).
Figure 2013165482

なお、演算を高速化するために、周辺全画素との微分を調べなくても、もう少し間引いた画素間微分に減らしてもよい。また、ここではステップS33の「仮色差補正1」とともに9×9サイズのフィルタを用いたが、両者で5×5サイズのものを用いてもよい。一般に、9×9サイズの方が更に強力な偽色と実在色の分離性能が得られる。   In addition, in order to speed up the calculation, it may be reduced to the inter-pixel differentiation that is thinned out a little more without examining the differentiation from all the surrounding pixels. In addition, although a 9 × 9 size filter is used together with “provisional color difference correction 1” in step S33, a 5 × 5 size filter may be used for both. In general, the 9 × 9 size provides a more powerful false color and real color separation performance.

ステップS35において、CPUは「適応的色差補正1」を行う。具体的には、色勾配の大きさに応じて色差補正処理をするか否かを切り替える。色勾配の大きい色境界部は元の Cr[i,j]がそのまま使われる。まず、次式(23)により色勾配判定マップidx_Cgrad[i,j]を作成する。
if Cgrad[i,j]≦ThG {idx_Cgrad[i,j]=1}
else {idx_Cgrad[i,j]=0} …(23)
そして、次式(24)により色勾配判定マップで色勾配が存在する領域には補正処理を行わず、色勾配が存在しない領域に補正処理を行う。
if idx_grad[i,j]=0 {Cr[i,j]=TCr1[i,j],Cb[i,j]=TCb1[i,j]} …(24)
閾値ThG は、非常に小さな値を設定するだけで、有彩色部、無彩色部を問わず色斑ノイズ、色モアレ発生領域が色差補正対象領域に該当し、色構造部はうまく除外される。閾値ThG は、256階調のときは5以下程度の値をとる。
In step S35, the CPU performs “adaptive color difference correction 1”. Specifically, whether to perform color difference correction processing is switched according to the magnitude of the color gradient. The original Cr [i, j] is used as it is for the color boundary with a large color gradient. First, a color gradient determination map idx_Cgrad [i, j] is created by the following equation (23).
if Cgrad [i, j] ≦ ThG {idx_Cgrad [i, j] = 1}
else {idx_Cgrad [i, j] = 0} (23)
Then, according to the following equation (24), the correction process is not performed on the area where the color gradient exists in the color gradient determination map, and the correction process is performed on the area where the color gradient does not exist.
if idx_grad [i, j] = 0 {Cr [i, j] = TCr1 [i, j], Cb [i, j] = TCb1 [i, j]} (24)
The threshold ThG is set to a very small value, and the color spot noise and color moire generation region corresponds to the color difference correction target region regardless of the chromatic color portion and the achromatic color portion, and the color structure portion is well excluded. The threshold ThG takes a value of about 5 or less for 256 gradations.

その後、全面に対し3×3サイズ程度の一様なローパス処理を加える。ローパス処理は、例えば次式(25)で表される。
Cr[i,j] = {4*Cr[i,j]
+ 2*(Cr[i-1,j] + Cr[i+1,j] + Cr[i,j-1] + Cr[i,j+1])
+ 1*(Cr[i-1,j-1] + Cr[i+1,j-1] + Cr[i-1,j+1] + Cr[i+1,j+1])}/16 …(25)
上式(25)はCr面について例示したが、Cb面についても同様に Cb[i,j]を算出する。
Thereafter, a uniform low pass process of about 3 × 3 size is applied to the entire surface. The low-pass process is expressed by the following equation (25), for example.
Cr [i, j] = {4 * Cr [i, j]
+ 2 * (Cr [i-1, j] + Cr [i + 1, j] + Cr [i, j-1] + Cr [i, j + 1])
+ 1 * (Cr [i-1, j-1] + Cr [i + 1, j-1] + Cr [i-1, j + 1] + Cr [i + 1, j + 1])} / 16 (25)
Although the above formula (25) has been exemplified for the Cr plane, Cb [i, j] is similarly calculated for the Cb plane.

ステップS36において、CPUは「仮色差補正2」の処理を行う。具体的には、色評価を正確に行うため、上述した色差面に生じている色モアレを更に除去する。色差メディアンフィルタも考えられるが、次式(26)に例示するローパスフィルタを使用するだけで、高速にその目的を達成することができる。
TCr2[i,j] = {4* Cr[i,j]
+ 2*(Cr[i-2,j] + Cr[i+2,j] + Cr[i,j-2] + Cr[i,j+2])
+ 1*(Cr[i-2,j-2] + Cr[i+2,j-2] + Cr[i-2,j+2] + Cr[i+2,j+2])}/16 …(26)
上式(26)はCr面について説明したが、Cb面についても同様に TCb2[i,j]を算出する。
In step S <b> 36, the CPU performs a “temporary color difference correction 2” process. Specifically, in order to accurately perform color evaluation, the above-described color moire generated on the color difference surface is further removed. Although a color difference median filter is also conceivable, the object can be achieved at high speed only by using a low-pass filter exemplified in the following equation (26).
TCr2 [i, j] = {4 * Cr [i, j]
+ 2 * (Cr [i-2, j] + Cr [i + 2, j] + Cr [i, j-2] + Cr [i, j + 2])
+ 1 * (Cr [i-2, j-2] + Cr [i + 2, j-2] + Cr [i-2, j + 2] + Cr [i + 2, j + 2])} / 16 ... (26)
Although the above equation (26) has been described for the Cr surface, TCb2 [i, j] is calculated in the same manner for the Cb surface.

ステップS37において、CPUは「色指標の導出」を行う。以上の様にして算出された色差成分は、画像の構造的要因をほぼ完全に排除して、画像が実際に持つ色あいを画素単位で計ることのできるスカラー量となっている。色指標としてCr成分が示すRG間の色差と、Cb成分が示すBG間の色差は既に求まっているが、画素単位のスカラー量であるため更にRB間の色差も評価することができ、極めて人間の視覚的判断に近い色評価が行える。次式(27)に色指標 Cdiffの導出式を示す。
Cdiff[i,j] = (|TCr2[i,j]| + |TCb2[i,j]| + |TCr2[i,j] - TCb2[i,j]|)/3 …(27)
In step S <b> 37, the CPU performs “derivation of color index”. The color difference component calculated as described above is a scalar quantity that can almost completely eliminate structural factors of the image and can measure the actual hue of the image in units of pixels. As the color index, the color difference between RGs indicated by the Cr component and the color difference between BGs indicated by the Cb component have already been obtained. However, since this is a scalar amount in units of pixels, the color difference between RBs can be further evaluated. Color evaluation close to visual judgment can be made. The following formula (27) shows the derivation formula of the color index Cdiff.
Cdiff [i, j] = (| TCr2 [i, j] | + | TCb2 [i, j] | + | TCr2 [i, j]-TCb2 [i, j] |) / 3 (27)

したがって、従来技術の色レベルでは問題となった実際の色と構造的要因に伴う撹乱要因を分離し、かつ全色成分間の色差を評価することで、非常に正確な色指標を手にすることができる。なお、この色指標は色味の度合いを表すものと言える。   Therefore, it is possible to obtain a very accurate color index by separating the disturbing factors associated with the actual color and structural factors that were problematic in the prior art color level and evaluating the color difference between all color components. be able to. This color index can be said to represent the degree of color.

なお、ここでも更に色指標の精度を上げるため、類似度の周辺加算で行ったようなことを色指標について行ってもよい。   Here, in order to further improve the accuracy of the color index, the same process as that performed by the peripheral addition of the similarity may be performed for the color index.

ステップS38において、CPUは、次式(28)を用いて「色判定」を行う。「色判定」では、上記連続的色指標を閾値判定して離散的色指標 BW[i,j]に色判定結果として変換する。
if Cdiff[i,j] =< Thbc BW[i,j] = 'b' 低彩度部
else BW[i,j] = 'c' 彩色部 …(28)
ただし、閾値Thbc は、256階調のときおよそ15程度の値をとる。
In step S38, the CPU performs “color determination” using the following equation (28). In “color determination”, the continuous color index is subjected to threshold determination and converted to a discrete color index BW [i, j] as a color determination result.
if Cdiff [i, j] = <Thbc BW [i, j] = 'b'
else BW [i, j] = 'c' coloring part (28)
However, the threshold value Thbc takes a value of about 15 at 256 gradations.

ステップS39において、CPUは、「適応的色差補正2」を行う。具体的には、次式(29)に例示するように、仮補正処理された色差面では補正前に発生していたナイキスト偽色も彩度低下しているので、S38の「色判定」結果に基づき無彩色部の偽色をできるだけ抑制し、有彩色部の色構造は残す。
if BW[i,j] ≠ 'c' {Cr[i,j] = TCr2[i,j],Cb[i,j] = TCb2[i,j]} …(29)
In step S39, the CPU performs “adaptive color difference correction 2”. Specifically, as illustrated in the following equation (29), since the Nyquist false color generated before the correction is also reduced in the color difference plane subjected to the temporary correction process, the “color determination” result in S38. Based on the above, the false color of the achromatic color part is suppressed as much as possible, and the color structure of the chromatic color part is left.
if BW [i, j] ≠ 'c' {Cr [i, j] = TCr2 [i, j], Cb [i, j] = TCb2 [i, j]} (29)

ステップS40において、CPUは「色指標の導出」を行う。上述した様にしてきれいにしかも適応的に偽色除去された色差面を用いてもう一度、色指標 Cdiffを導出する。それによって、輝度面を生成するための同色相関と異色相関の切り替えを行なうための偽色と実在色の判別精度を極限まで高める。次式(30)に色指標 Cdiffの導出式を示す。
Cdiff[i,j] = (|Cr[i,j]| + |Cb[i,j]| + |Cr[i,j] - Cb[i,j]|)/3 …(30)
なお、ここでも更に色指標の精度を上げるため、類似度の周辺加算で行ったようなことを色指標について行ってもよい。
In step S40, the CPU performs “derivation of color index”. The color index Cdiff is derived once again using the color difference surface that is cleanly and adaptively subjected to false color removal as described above. Thereby, the discrimination accuracy between the false color and the actual color for switching between the same color correlation and the different color correlation for generating the luminance plane is increased to the limit. The following formula (30) shows the derivation formula for the color index Cdiff.
Cdiff [i, j] = (| Cr [i, j] | + | Cb [i, j] | + | Cr [i, j]-Cb [i, j] |) / 3 (30)
Here, in order to further improve the accuracy of the color index, the same process as that performed by the peripheral addition of the similarity may be performed for the color index.

ステップS41において、CPUは次式(31)を用いて「色判定」を行う。「色判定」では、上記連続的色指標を閾値判定して離散的色指標 BW[i,j]に色判定結果として変換する。
if Cdiff[i,j] =< Thab BW[i,j] = 'a' 無彩色部 …(31)
ただし、閾値 Thab は、256階調のときおよそ5程度の値をとる。
In step S41, the CPU performs “color determination” using the following equation (31). In “color determination”, the continuous color index is subjected to threshold determination and converted to a discrete color index BW [i, j] as a color determination result.
if Cdiff [i, j] = <Thab BW [i, j] = 'a' Achromatic part (31)
However, the threshold value Thab takes a value of about 5 at 256 gradations.

ステップS42において、CPUは「縦横方向判定2」の処理を行う。「縦横方向判定2」の処理は、(S42-1)類似度の算出と、(S42-2)類似性判定とで構成される。具体的には、R,B画素位置について以下の計算を行う。   In step S42, the CPU performs a process of “vertical / horizontal direction determination 2”. The processing of “Vertical / Horizontal Direction Determination 2” includes (S42-1) similarity calculation and (S42-2) similarity determination. Specifically, the following calculation is performed for the R and B pixel positions.

(S42-1)類似度の算出
類似度の算出は、(a)同色間類似度の算出と、(b)類似度の周辺加算とを行う。
(a)同色間類似度の算出
CPUは、次式(32)〜(37)によりGG間類似度成分、BB(RR)間類似度成分を算出する。
Cv0[i,j] = (Cv1 + Cv2)/2 …(32)
Ch0[i,j] = (Ch1 + Ch2)/2 …(33)
ただし、GG間類似度成分は、
Cv1 = |G[i,j-1] - G[i,j+1]| …(34)
Ch1 = |G[i-1,j] - G[i+1,j]| …(35)
であり、BB(RR)間類似度成分は、
Cv2 = (|Z[i-1,j-1] - Z[i-1,j+1]| + |Z[i+1,j-1] - Z[i+1,j+1]|)/2 …(36)
Ch2 = (|Z[i-1,j-1] - Z[i+1,j-1]| + |Z[i-1,j+1] - Z[i+1,j+1]|)/2 …(37)
である。
(S42-1) Calculation of similarity The similarity is calculated by (a) calculating the similarity between the same colors and (b) adding the peripherals of the similarity.
(a) Calculation of similarity between same colors The CPU calculates a similarity component between GG and a similarity component between BB (RR) by the following equations (32) to (37).
Cv0 [i, j] = (Cv1 + Cv2) / 2 (32)
Ch0 [i, j] = (Ch1 + Ch2) / 2 (33)
However, the similarity component between GG is
Cv1 = | G [i, j-1]-G [i, j + 1] | (34)
Ch1 = | G [i-1, j]-G [i + 1, j] |… (35)
And the similarity component between BB (RR) is
Cv2 = (| Z [i-1, j-1]-Z [i-1, j + 1] | + | Z [i + 1, j-1]-Z [i + 1, j + 1] | ) / 2 (36)
Ch2 = (| Z [i-1, j-1]-Z [i + 1, j-1] | + | Z [i-1, j + 1]-Z [i + 1, j + 1] | ) / 2 (37)
It is.

(b)類似度の周辺加算
CPUはさらに、次式(38)、(39)により(b)類似度の周辺加算を行う。この処理は、周辺画素との連続性を考慮することにより類似度の精度を上げるためのもので、異色間類似度の場合と同様に、簡略性を優先する場合は省いても良い。
Cv[i,j] = (4*Cv0[i,j]
+ 2*(Cv0[i-1,j-1] + Cv0[i+1,j-1] + Cv0[i-1,j+1] + Cv0[i+1,j+1])
+ Cv0[i,j-2] + Cv0[i,j+2] + Cv0[i-2,j] + Cv0[i+2,j])/16 …(38)
Ch[i,j] = (4*Ch0[i,j]
+ 2*(Ch0[i-1,j-1] + Ch0[i+1,j-1] + Ch0[i-1,j+1] + Ch0[i+1,j+1])
+ Ch0[i,j-2] + Ch0[i,j+2] + Ch0[i-2,j] + Ch0[i+2,j])/16 …(39)
(b) Peripheral Addition of Similarity The CPU further performs (b) peripheral addition of similarity according to the following equations (38) and (39). This process is intended to increase the accuracy of similarity by considering continuity with surrounding pixels, and may be omitted when priority is given to simplicity, as in the case of similarity between different colors.
Cv [i, j] = (4 * Cv0 [i, j]
+ 2 * (Cv0 [i-1, j-1] + Cv0 [i + 1, j-1] + Cv0 [i-1, j + 1] + Cv0 [i + 1, j + 1])
+ Cv0 [i, j-2] + Cv0 [i, j + 2] + Cv0 [i-2, j] + Cv0 [i + 2, j]) / 16… (38)
Ch [i, j] = (4 * Ch0 [i, j]
+ 2 * (Ch0 [i-1, j-1] + Ch0 [i + 1, j-1] + Ch0 [i-1, j + 1] + Ch0 [i + 1, j + 1])
+ Ch0 [i, j-2] + Ch0 [i, j + 2] + Ch0 [i-2, j] + Ch0 [i + 2, j]) / 16… (39)

(S42-2)類似性判定
CPUは、上記算出した類似度に基づいて、次式(40)により類似性を判定する。
if |Cv[i,j] - Ch[i,j]| =< Th1 HVs[i,j] = 0 縦横類似性不明
else if Cv[i,j] < Ch[i,j] HVs[i,j] = 1 縦類似
else HVs[i,j] = -1 横類似 …(40)
ただし、閾値 Th1 は、Th0と同程度の値をとる。
(S42-2) Similarity determination The CPU determines similarity according to the following equation (40) based on the calculated similarity.
if | Cv [i, j]-Ch [i, j] | = <Th1 HVs [i, j] = 0 Unknown vertical / horizontal similarity
else if Cv [i, j] <Ch [i, j] HVs [i, j] = 1 Vertical similarity
else HVs [i, j] = -1 horizontal similarity (40)
However, the threshold value Th1 is approximately the same as Th0.

ステップS43において、CPUは「方向指標の選択」を行う。具体的には、色判定結果に基づいて、次式(41)により異色間類似度による方向判定結果と同色間類似度による方向判定結果とを使い分ける。
if BW[i,j] = 'a' HV[i,j] = HVd[i,j]
else HV[i,j] = HVs[i,j] …(41)
In step S43, the CPU performs “direction index selection”. Specifically, based on the color determination result, the direction determination result based on the similarity between different colors and the direction determination result based on the similarity between the same colors are properly used according to the following equation (41).
if BW [i, j] = 'a' HV [i, j] = HVd [i, j]
else HV [i, j] = HVs [i, j] (41)

ステップS44において、CPUは「斜め方向判定」を行う。「斜め方向判定」の処理は、(S44-1)類似度の算出と、(S44-2)類似性判定とで構成される。具体的には、R,B画素位置について以下の計算を行う。   In step S44, the CPU performs “diagonal direction determination”. The “diagonal direction determination” process includes (S44-1) calculation of similarity and (S44-2) similarity determination. Specifically, the following calculation is performed for the R and B pixel positions.

(S44-1)類似度の算出
類似度の算出は、(a)異色、同色間類似度の算出と、(b)類似度の周辺加算とを行う。
(a)類似度の算出
CPUは、次式(42)〜(49)により類似度成分を算出する。
C45_0[i,j] = (a1 * C45_1 + a2 * C45_2 + a3 * C45_3)/(a1 + a2 + a3) …(42)
C135_0[i,j] = (a1 * C135_1 + a2 * C135_2 + a3 * C135_3)/(a1 + a2 + a3) …(43)
ただし、BR(RB)間類似度成分は、
C45_1 = (|Z[i+1,j-1] - Z[i,j]| + |Z[i-1,j+1] - Z[i,j]|)/2 …(44)
C135_1 = (|Z[i-1,j-1] - Z[i,j]| + |Z[i+1,j+1] - Z[i,j]|)/2 …(45)
であり、GG間類似度成分は、
C45_2 = (|G[i,j-1] - G[i-1,j]| + |G[i+1,j] - G[i,j+1]|)/2 …(46)
C135_2 = (|G[i,j-1] - G[i+1,j]| + |G[i-1,j] - G[i,j+1]|)/2 …(47)
BB(RR)間類似度成分は、
C45_3 = |Z[i+1,j-1] - Z[i-1,j+1]| …(48)
C135_3 = (|Z[i-1,j-1] - Z[i+1,j+1]| …(49)
である。定数 a1,a2,a3の値は、a1 = a2 = a3 = 1や、a1 = a2 = 2, a3 = 1などに設定するとよい。
(S44-1) Calculation of similarity The calculation of similarity is performed by (a) calculating different colors and similarities between colors, and (b) performing peripheral addition of similarities.
(a) Calculation of similarity The CPU calculates a similarity component according to the following equations (42) to (49).
C45_0 [i, j] = (a1 * C45_1 + a2 * C45_2 + a3 * C45_3) / (a1 + a2 + a3)… (42)
C135_0 [i, j] = (a1 * C135_1 + a2 * C135_2 + a3 * C135_3) / (a1 + a2 + a3)… (43)
However, the BR (RB) similarity component is
C45_1 = (| Z [i + 1, j-1]-Z [i, j] | + | Z [i-1, j + 1]-Z [i, j] |) / 2 (44)
C135_1 = (| Z [i-1, j-1]-Z [i, j] | + | Z [i + 1, j + 1]-Z [i, j] |) / 2 (45)
And the GG similarity component is
C45_2 = (| G [i, j-1]-G [i-1, j] | + | G [i + 1, j]-G [i, j + 1] |) / 2 (46)
C135_2 = (| G [i, j-1]-G [i + 1, j] | + | G [i-1, j]-G [i, j + 1] |) / 2 (47)
The similarity component between BB (RR) is
C45_3 = | Z [i + 1, j-1]-Z [i-1, j + 1] |… (48)
C135_3 = (| Z [i-1, j-1]-Z [i + 1, j + 1] |… (49)
It is. The values of the constants a1, a2, and a3 are preferably set to a1 = a2 = a3 = 1, a1 = a2 = 2, a3 = 1, and the like.

(b)類似度の周辺加算
CPUはさらに、次式(50)、(51)により(b)類似度の周辺加算を行う。この処理は、周辺画素との連続性を考慮することにより類似度の精度を上げるためのもので、縦横方向の類似度の場合と同様に、簡略性を優先する場合は省いても良い。
C45[i,j] = (4*C45_0[i,j]
+ 2*(C45_0[i-1,j-1] + C45_0[i+1,j-1]
+ C45_0[i-1,j+1] + C45_0[i+1,j+1])
+ C45_0[i,j-2] + C45_0[i,j+2] + C45_0[i-2,j] + C45_0[i+2,j])/16 …(50)
C135[i,j] = (4*C135_0[i,j]
+ 2*(C135_0[i-1,j-1] + C135_0[i+1,j-1]
+ C135_0[i-1,j+1] + C135_0[i+1,j+1])
+ C135_0[i,j-2] + C135_0[i,j+2] + C135_0[i-2,j] + C135_0[i+2,j])/16 …(51)
(b) Peripheral addition of similarities The CPU further performs (b) peripheral addition of similarities according to the following equations (50) and (51). This process is intended to increase the accuracy of similarity by considering continuity with surrounding pixels, and may be omitted when priority is given to simplicity, as in the case of similarity in the vertical and horizontal directions.
C45 [i, j] = (4 * C45_0 [i, j]
+ 2 * (C45_0 [i-1, j-1] + C45_0 [i + 1, j-1]
+ C45_0 [i-1, j + 1] + C45_0 [i + 1, j + 1])
+ C45_0 [i, j-2] + C45_0 [i, j + 2] + C45_0 [i-2, j] + C45_0 [i + 2, j]) / 16… (50)
C135 [i, j] = (4 * C135_0 [i, j]
+ 2 * (C135_0 [i-1, j-1] + C135_0 [i + 1, j-1]
+ C135_0 [i-1, j + 1] + C135_0 [i + 1, j + 1])
+ C135_0 [i, j-2] + C135_0 [i, j + 2] + C135_0 [i-2, j] + C135_0 [i + 2, j]) / 16… (51)

(S44-2)類似性判定
CPUは、上記算出した類似度に基づいて、次式(52)により類似性を判定する。
if |C45[i,j] - C135[i,j]| =< Th2 DN[i,j] = 0 斜め類似性不明
else if C45[i,j] < C135[i,j] DN[i,j] = 1 斜め45゜類似
else DN[i,j] = -1 斜め135゜類似 …(52)
ただし、閾値 Th2 は、Th0 やTh1 と同程度の値をとる。
(S44-2) Similarity determination The CPU determines the similarity according to the following equation (52) based on the calculated similarity.
if | C45 [i, j]-C135 [i, j] | = <Th2 DN [i, j] = 0 Unknown diagonal similarity
else if C45 [i, j] <C135 [i, j] DN [i, j] = 1 45 ° similar
else DN [i, j] = -1 diagonally 135 ° similar (52)
However, the threshold value Th2 has the same value as Th0 and Th1.

ステップS45において、CPUは次式(53)により「G面生成」を行う。
if [i,j] is not a G site in a Bayer plane{
if HV[i,j] = 0{
if DN[i,j] = 0 G[i,j] = (Gv + Gh)/2
else if DN[i,j] = 1 G[i,j] = (Gv45 + Gh45)/2
else G[i,j] = (Gv135 + Gh135)/2
}
else if HV[i,j] = 1{
if DN[i,j] = 0 G[i,j] = Gv
else if DN[i,j] = 1 G[i,j] = Gv45
else G[i,j] = Gv135
}
else{
if DN[i,j] = 0 G[i,j] = Gh
else if DN[i,j] = 1 G[i,j] = Gh45
else G[i,j] = Gh135
}
} …(53)
ここで、
Gv = (G[i,j-1] + G[i,j+1])/2
+ (2*Z[i,j] - Z[i,j-2] - Z[i,j+2])/8
+ (2*G[i-1,j] - G[i-1,j-2] - G[i-1,j+2]
+ 2*G[i+1,j] - G[i+1,j-2] - G[i+1,j+2])/16 …(54)
Gv45 = (G[i,j-1] + G[i,j+1])/2
+ (2*Z[i,j] - Z[i,j-2] - Z[i,j+2])/8
+ (2*Z[i-1,j+1] - Z[i-1,j-1] - Z[i-1,j+3]
+ 2*Z[i+1,j-1] - Z[i+1,j-3] - Z[i+1,j+1])/16 …(55)
Gv135 = (G[i,j-1] + G[i,j+1])/2
+ (2*Z[i,j] - Z[i,j-2] - Z[i,j+2])/8
+ (2*Z[i-1,j-1] - Z[i-1,j-3] - Z[i-1,j+1]
+ 2*Z[i+1,j+1] - Z[i+1,j-1] - Z[i+1,j+3])/16 …(56)
Gh = (G[i-1,j] + G[i+1,j])/2
+ (2*Z[i,j] - Z[i-2,j] - Z[i+2,j])/8
+ (2*G[i,j-1] - G[i-2,j-1] - G[i+2,j-1]
+ 2*G[i,j+1] - G[i-2,j+1] - G[i+2,j+1])/16 …(57)
Gh45 = (G[i-1,j] + G[i+1,j])/2
+ (2*Z[i,j] - Z[i-2,j] - Z[i+2,j])/8
+ (2*Z[i+1,j-1] - Z[i-1,j-1] - Z[i+3,j-1]
+ 2*Z[i-1,j+1] - Z[i-3,j+1] - Z[i+1,j+1])/16 …(58)
Gh135 = (G[i-1,j] + G[i+1,j])/2
+ (2*Z[i,j] - Z[i-2,j] - Z[i+2,j])/8
+ (2*Z[i-1,j-1] - Z[i-3,j-1] - Z[i+1,j-1]
+ 2*Z[i+1,j+1] - Z[i-1,j+1] - Z[i+3,j+1])/16 …(59)
とする。
In step S <b> 45, the CPU performs “G plane generation” according to the following equation (53).
if [i, j] is not a G site in a Bayer plane {
if HV [i, j] = 0 {
if DN [i, j] = 0 G [i, j] = (Gv + Gh) / 2
else if DN [i, j] = 1 G [i, j] = (Gv45 + Gh45) / 2
else G [i, j] = (Gv135 + Gh135) / 2
}
else if HV [i, j] = 1 {
if DN [i, j] = 0 G [i, j] = Gv
else if DN [i, j] = 1 G [i, j] = Gv45
else G [i, j] = Gv135
}
else {
if DN [i, j] = 0 G [i, j] = Gh
else if DN [i, j] = 1 G [i, j] = Gh45
else G [i, j] = Gh135
}
} ... (53)
here,
Gv = (G [i, j-1] + G [i, j + 1]) / 2
+ (2 * Z [i, j]-Z [i, j-2]-Z [i, j + 2]) / 8
+ (2 * G [i-1, j]-G [i-1, j-2]-G [i-1, j + 2]
+ 2 * G [i + 1, j]-G [i + 1, j-2]-G [i + 1, j + 2]) / 16 ... (54)
Gv45 = (G [i, j-1] + G [i, j + 1]) / 2
+ (2 * Z [i, j]-Z [i, j-2]-Z [i, j + 2]) / 8
+ (2 * Z [i-1, j + 1]-Z [i-1, j-1]-Z [i-1, j + 3]
+ 2 * Z [i + 1, j-1]-Z [i + 1, j-3]-Z [i + 1, j + 1]) / 16… (55)
Gv135 = (G [i, j-1] + G [i, j + 1]) / 2
+ (2 * Z [i, j]-Z [i, j-2]-Z [i, j + 2]) / 8
+ (2 * Z [i-1, j-1]-Z [i-1, j-3]-Z [i-1, j + 1]
+ 2 * Z [i + 1, j + 1]-Z [i + 1, j-1]-Z [i + 1, j + 3]) / 16… (56)
Gh = (G [i-1, j] + G [i + 1, j]) / 2
+ (2 * Z [i, j]-Z [i-2, j]-Z [i + 2, j]) / 8
+ (2 * G [i, j-1]-G [i-2, j-1]-G [i + 2, j-1]
+ 2 * G [i, j + 1]-G [i-2, j + 1]-G [i + 2, j + 1]) / 16… (57)
Gh45 = (G [i-1, j] + G [i + 1, j]) / 2
+ (2 * Z [i, j]-Z [i-2, j]-Z [i + 2, j]) / 8
+ (2 * Z [i + 1, j-1]-Z [i-1, j-1]-Z [i + 3, j-1]
+ 2 * Z [i-1, j + 1]-Z [i-3, j + 1]-Z [i + 1, j + 1]) / 16… (58)
Gh135 = (G [i-1, j] + G [i + 1, j]) / 2
+ (2 * Z [i, j]-Z [i-2, j]-Z [i + 2, j]) / 8
+ (2 * Z [i-1, j-1]-Z [i-3, j-1]-Z [i + 1, j-1]
+ 2 * Z [i + 1, j + 1]-Z [i-1, j + 1]-Z [i + 3, j + 1]) / 16… (59)
And

以上説明したように、各画素位置において Cr[i,j]、Cb[i,j]、G[i,j]がそれぞれ求まるので、カラー画像が出来上がる。ステップS46において、CPUは、RGB表色系にする場合は、次式(60)により表色変換を行う。
R[i,j] = Cr[i,j] + G[i,j]
B[i,j] = Cb[i,j] + G[i,j] …(60)
As described above, since Cr [i, j], Cb [i, j], and G [i, j] are obtained at each pixel position, a color image is completed. In step S46, when the CPU uses the RGB color system, the CPU performs color conversion according to the following equation (60).
R [i, j] = Cr [i, j] + G [i, j]
B [i, j] = Cb [i, j] + G [i, j] (60)

図7のステップS4において、CPUは、アクティブに3つの補間用ガンマ空間を利用して生成する補間画像に対しても、ステップS3の処理を3回通して得る。ただし、均等ノイズ空間以外で方向判定指標や色差面平滑化のための切り替え指標を求めるのは、信頼性が低く危険である。なぜならば、均等ノイズ化されていなければ、ノイズの影響を受けて方向判断を誤る恐れがあるからである。色に関しても、均等色空間と呼ばれうる立方根階調や平方根階調から極端にずれている場合は、視覚に合った正しい色を評価できない恐れがあるからである。   In step S4 of FIG. 7, the CPU obtains the process of step S3 three times even for the interpolation image that is actively generated using the three interpolation gamma spaces. However, obtaining a direction determination index or a switching index for color difference surface smoothing in a space other than the uniform noise space is unreliable and dangerous. This is because if the noise is not uniform, the direction may be erroneously influenced by noise. This is because, when the color is extremely deviated from a cubic root gradation or a square root gradation which can be called a uniform color space, there is a possibility that a correct color suitable for vision cannot be evaluated.

このような状況に対処するため、ステップS3で生成された最終的な方向判定指標HV[i,j]、DN[i,j]、及び適応的な偽色除去の切り替え指標である色勾配判定マップidx_Cgrad[i,j]、色判定マップBW[i,j]をそのまま参照データとして保持しておき、全てに共通の指標を用いるようにする。こうすることにより、演算量が減るばかりでなく、3通りの補間画像が共通の方向判定指標や同じ偽色除去指標が参照されるので、画像としても3者間で矛盾のない同じ方向の解像と偽色抑制過程を経た補間結果が得られる。   In order to deal with such a situation, the final direction determination indexes HV [i, j] and DN [i, j] generated in step S3, and the color gradient determination that is an adaptive false color removal switching index The map idx_Cgrad [i, j] and the color determination map BW [i, j] are held as reference data as they are, and a common index is used for all. In this way, not only the amount of calculation is reduced, but also the three interpolation images refer to the common direction determination index and the same false color removal index, so that the images in the same direction without any contradiction among the three are also included. Interpolation results obtained through image and false color suppression processes are obtained.

こうして求まったΓ1、Γ2、Γ3空間における補間画像をそれぞれ次式(61)のように表す。
Γ1空間:R(Γ1)(x,y)、G(Γ1)(x,y)、B(Γ1)(x,y)
Γ2空間:R(Γ2)(x,y)、G(Γ2)(x,y)、B(Γ2)(x,y) …(61)
Γ3空間:R(Γ3)(x,y)、G(Γ3)(x,y)、B(Γ3)(x,y)
The interpolated images in the Γ 1 , Γ 2 , and Γ 3 spaces thus obtained are represented by the following equation (61), respectively.
Γ 1 space: R (Γ1) (x, y), G (Γ1) (x, y), B (Γ1) (x, y)
Γ 2 space: R (Γ2) (x, y), G (Γ2) (x, y), B (Γ2) (x, y) (61)
Γ 3 space: R (Γ3) (x, y), G (Γ3) (x, y), B (Γ3) (x, y)

ステップS5において、CPUは、補間画像の階調整合を行う。異なった3つの補間用ガンマ空間(Γ1、Γ2、Γ3)で予測された補間値が実際にどれだけの違いを持っているのかを測定するためには、共通のガンマ空間に移行した上で、その差異を見る必要がある。さもないと、補間値がガンマ特性の違いの影響をそのまま被ってしまうからである。そこで、共通のガンマ空間として基準階調である補間用ガンマ空間(Γ2空間)を選ぶ。 In step S5, the CPU performs gradation matching of the interpolation image. In order to measure how much the interpolation values predicted in three different gamma spaces for interpolation (Γ 1 , Γ 2 , Γ 3 ) actually differ, we moved to a common gamma space Above, we need to see the difference. Otherwise, the interpolation value is directly affected by the difference in gamma characteristics. Therefore, a gamma space for interpolation (Γ 2 space), which is a reference gradation, is selected as a common gamma space.

基準の補間用ガンマ空間(Γ2空間)に移行したそれぞれの補間画像を、次式(62)のように表す。
Γ1空間→Γ2空間:R(Γ1→Γ2)(x,y)、G(Γ1→Γ2)(x,y)、B(Γ1→Γ2)(x,y)
Γ2空間→Γ2空間:R(Γ2→Γ2)(x,y)、G(Γ2→Γ2)(x,y)、B(Γ2→Γ2)(x,y) …(62)
Γ3空間→Γ2空間:R(Γ3→Γ2)(x,y)、G(Γ3→Γ2)(x,y)、B(Γ3→Γ2)(x,y)
ただし、Γ2空間→Γ2空間は何も処理をする必要はない。すなわち、R(Γ2→Γ2)(x,y) = R(Γ2)(x,y)、G(Γ2→Γ2)(x,y) = G(Γ2)(x,y)、B(Γ2→Γ2)(x,y) = B(Γ2)(x,y)である。
Each interpolated image shifted to the reference interpolation gamma space (Γ 2 space) is represented by the following equation (62).
Γ 1 space → Γ 2 space: R (Γ1 → Γ2) (x, y), G (Γ1 → Γ2) (x, y), B (Γ1 → Γ2) (x, y)
Γ 2 space → Γ 2 space: R (Γ2 → Γ2) (x, y), G (Γ2 → Γ2) (x, y), B (Γ2 → Γ2) (x, y) (62)
Γ 3 space → Γ 2 space: R (Γ3 → Γ2) (x, y), G (Γ3 → Γ2) (x, y), B (Γ3 → Γ2) (x, y)
However, the Γ 2 space → Γ 2 space need not be processed. That is, R (Γ2 → Γ2) (x, y) = R (Γ2) (x, y), G (Γ2 → Γ2) (x, y) = G (Γ2) (x, y), B (Γ2 → Γ2) (x, y) = B (Γ2) (x, y).

ステップS6において、CPUは、階調間のラプラシアン抽出を行う。3通りの補間用ガンマ空間(Γ1、Γ2、Γ3)で得られた補間画像であって、基準となるΓ2空間に移行された補間画像を用いて、各色面の同一画素内でアクティブに3通りの補間値予測空間を用いて予測された補間値のコントラストの違いを、基準画像の結果に対する2次微分、すなわちラプラシアン成分という形で抽出する。 In step S6, the CPU performs Laplacian extraction between gradations. Interpolated images obtained in three different gamma spaces for interpolation (Γ 1 , Γ 2 , Γ 3 ) and transferred to the reference Γ 2 space are used in the same pixel of each color plane. Differences in the contrast of the interpolation values that are actively predicted using the three interpolation value prediction spaces are extracted in the form of a second derivative with respect to the result of the reference image, that is, a Laplacian component.

ラプラシアン成分は次式(63)で表される。
△R(Γ2)(x,y) = 2*R(Γ2→Γ2)(x,y) - R(Γ1→Γ2)(x,y) - R(Γ3→Γ2)(x,y)
△G(Γ2)(x,y) = 2*G(Γ2→Γ2)(x,y) - G(Γ1→Γ2)(x,y) - G(Γ3→Γ2)(x,y) …(63)
△B(Γ2)(x,y) = 2*B(Γ2→Γ2)(x,y) - B(Γ1→Γ2)(x,y) - B(Γ3→Γ2)(x,y)
The Laplacian component is expressed by the following equation (63).
△ R (Γ2) (x, y) = 2 * R (Γ2 → Γ2) (x, y)-R (Γ1 → Γ2) (x, y)-R (Γ3 → Γ2) (x, y)
△ G (Γ2) (x, y) = 2 * G (Γ2 → Γ2) (x, y)-G (Γ1 → Γ2) (x, y)-G (Γ3 → Γ2) (x, y)… ( 63)
△ B (Γ2) (x, y) = 2 * B (Γ2 → Γ2) (x, y)-B (Γ1 → Γ2) (x, y)-B (Γ3 → Γ2) (x, y)

こうして抽出されるラプラシアン成分は、3つの補間用ガンマ空間(Γ1、Γ2、Γ3)で予測された補間値に用いられる方向判定結果は共通の指標を用いているので、方向判定の違いによる変なパターン生成をしてしまう心配なしに、安定した微細な補正成分を抽出する。また、偽色の抑制効果も同位相に揃っているため、同様のことがいえる。 The Laplacian component extracted in this way uses a common index for the direction determination result used for the interpolation values predicted in the three interpolation gamma spaces (Γ 1 , Γ 2 , Γ 3 ). A stable fine correction component is extracted without worrying about generating a strange pattern due to. The same can be said because the false color suppression effect is also in phase.

ステップS7において、CPUは、基準補間画像の補正を行う。ステップS3で求めた補間用ガンマ空間(Γ2空間)での補間画像 R(Γ2)(x,y)、G(Γ2)(x,y)、B(Γ2)(x,y)を、ラプラシアン成分でコントラスト補正をする処理を行って、補間で抽出しうる階調コントラストを最大化する(次式(64))。
R'(Γ2)(x,y )= R(Γ2→Γ2)(x,y) + k*△R(Γ2)(x,y)
G'(Γ2)(x,y) = G(Γ2→Γ2)(x,y) + k*△G(Γ2)(x,y) …(64)
B'(Γ2)(x,y) = B(Γ2→Γ2)(x,y) + k*△B(Γ2)(x,y)
ただし、定数 kの値は、通常1ないしは0.5の値をとる。
In step S7, the CPU corrects the reference interpolation image. Interpolation in interpolation gamma space obtained in step S3 (gamma 2 space) image R (Γ2) (x, y ), G (Γ2) (x, y), B and (Γ2) (x, y) , Laplacian Processing for correcting the contrast with the components is performed to maximize the gradation contrast that can be extracted by interpolation (the following equation (64)).
R ' (Γ2) (x, y) = R (Γ2 → Γ2) (x, y) + k * △ R (Γ2) (x, y)
G ' (Γ2) (x, y) = G (Γ2 → Γ2) (x, y) + k * ΔG (Γ2) (x, y) (64)
B ' (Γ2) (x, y) = B (Γ2 → Γ2) (x, y) + k * △ B (Γ2) (x, y)
However, the value of the constant k usually takes a value of 1 to 0.5.

ステップS8において、CPUは、補間画像の出力色空間変換を行う。具体的には、上式(64)によるコントラスト補正後の補間画像(Γ2空間で補間されたRGB画像)の階調特性を逆変換して線形階調に戻した後、任意の色変換処理と出力ガンマ変換処理を行って出力色空間画像として出力する。出力色空間として代表的なものは、例えば、sRGB色空間などがある。 In step S8, the CPU performs output color space conversion of the interpolated image. Specifically, the tone characteristics of the interpolated image (RGB image interpolated in the Γ 2 space) after contrast correction according to the above equation (64) is inversely converted back to linear tone, and then an arbitrary color conversion process is performed. And output gamma conversion processing and output as an output color space image. A typical output color space is, for example, an sRGB color space.

以上説明した第一の実施形態によれば、次の作用効果が得られる。
(1)画像処理装置は、RGB色成分からなる画像データであって欠落する色成分が存在する画像データに対して、線形階調の画像信号を曲率が異なる3つの階調特性Γ1、Γ2、Γの画像処理空間の画像信号に変換する(S2)CPUと、階調変換された各々の画像信号の欠落色成分を補間して、3通りの Bayer 補間画像を生成する(S4)CPUと、3通りの補間画像を基準の階調特性Γ2の画像処理空間の画像に変換して階調特性を合わせる(S5)CPUと、3つの階調特性Γ1、Γ2、Γで補間され基準の階調特性Γ2に階調整合された3通りの Bayer 補間画像を用いて、3つの画像の同一の画素間で、階調特性Γ2の補間画像の画素値と階調特性Γの補間画像の画素値との間の差分値、および階調特性Γ2の補間画像の画素値と階調特性Γの補間画像の画素値との間の差分値をそれぞれ抽出する(S6)CPUと、階調特性Γ2の補間画像に対して、差分値を同一の画素に加算する(S7)CPUと、加算後の画像信号を出力色空間の画像信号に変換する(S8)CPUと、を備えるようにした。これにより、全階調領域で平均的に優れたコントラスト解像を行うことができる従来の画像予測空間の性能を最大限に保ちつつ、更に高コントラストな補間画像を提供できる高精細な補間を行うことができる。すなわち、3つの補間ガンマΓ1、Γ2、Γによる予測空間を用いて3通りの補間結果を生成し、中間に位置する補間ガンマΓ2による補間結果を基準とし、3者の間の同一画素内での階調間の2回微分成分を抽出して基準画像に加算する方式を導入した。それによって、従来の基準画像による補間品質を最大限に生かしつつ、基準画像のガンマ空間Γ2では抽出できなかったそれ以外のガンマ空間Γ1、Γで予測されたコントラストを最大限に反映させることが可能になった。これは、補間処理の中で抽出しうる画像が本来持つコントラストを最大化するので、画像全体の曇り感や被りが消え、全体的に非常に透明感や解像感、立体感の増した高精細な補間画像が得られる。
According to the first embodiment described above, the following operational effects can be obtained.
(1) The image processing apparatus converts linear tone image signals into three tone characteristics Γ 1 , Γ having different curvatures from image data consisting of RGB color components and having missing color components. 2 and Γ 3 are converted into image signals in the image processing space (S2), and the missing color components of each of the tone-converted image signals are interpolated to generate three Bayer interpolation images (S4). The CPU and the three kinds of interpolated images are converted into an image in the image processing space having the reference gradation characteristic Γ 2 to match the gradation characteristics (S5). The CPU and the three gradation characteristics Γ 1 , Γ 2 , Γ 3 Using the three types of Bayer interpolation images interpolated in the above and tone-matched to the reference tone characteristics Γ 2 , the pixel values and gradations of the interpolated image of the gradation characteristics Γ 2 are calculated between the same pixels of the three images. difference values, and the pixel value and the gradation of tone characteristic gamma 2 interpolation image between the pixel value of the characteristic gamma 1 interpolation image A difference value between the pixel value of sexual gamma 3 interpolation image extracting respectively (S6) CPU, relative to the tone characteristics gamma 2 interpolation image, adds the difference value to the same pixel (S7) CPU And a CPU that converts the image signal after the addition into an image signal in the output color space (S8). This enables high-definition interpolation that can provide a higher-contrast interpolated image while maximizing the performance of the conventional image prediction space that can perform excellent contrast resolution on average in all gradation regions. be able to. That is, three types of interpolation results are generated using the prediction space by the three interpolation gammas Γ 1 , Γ 2 , and Γ 3 , and the same between the three parties based on the interpolation result by the interpolation gamma Γ 2 located in the middle. A method of extracting a differential component twice between gradations in a pixel and adding it to a reference image was introduced. Accordingly, the contrast predicted by the other gamma spaces Γ 1 and Γ 3 that cannot be extracted in the gamma space Γ 2 of the reference image is reflected to the maximum while the interpolation quality of the conventional reference image is maximized. It became possible. This maximizes the contrast inherent in the image that can be extracted during the interpolation process, thus eliminating the cloudiness and fogging of the entire image and increasing the overall transparency, resolution, and stereoscopic effect. A fine interpolated image can be obtained.

(2)上記(1)の画像処理装置において、階調変換する(S2)CPUは、線形階調特性Γ1、平方根階調特性Γ、および立方根階調特性Γを、それぞれ用いるようにしたので、線形階調のガンマ空間Γ2では抽出できなかった平方根階調のガンマ空間Γ1や立方根階調のガンマ空間Γで予測されたコントラストを最大限に反映させることができる。 (2) In the image processing apparatus of (1), gradation conversion is performed. (S2) The CPU uses the linear gradation characteristic Γ 1 , the square root gradation characteristic Γ 2 , and the cubic root gradation characteristic Γ 3 , respectively. Therefore, the contrast predicted in the square root tone gamma space Γ 1 and the cubic root tone gamma space Γ 3 which could not be extracted in the linear tone gamma space Γ 2 can be reflected to the maximum.

(3)上記(1)または(2)の画像処理装置において、色成分を補間して3通りの Bayer 補間画像を生成する(S4)CPUは、欠落する色成分の補間値を、欠落する色成分の色情報のみならず他の色成分の色情報も用いて算出するので、適切に色成分を補間できる。 (3) In the image processing apparatus according to (1) or (2), the color components are interpolated to generate three Bayer interpolation images. (S4) The CPU uses the missing color component interpolation values as missing colors. Since the calculation is performed using not only the color information of the components but also the color information of other color components, the color components can be appropriately interpolated.

(4)画像処理装置は、RGB色成分からなる画像データであって欠落する色成分が存在する画像データに対して、線形階調の画像信号を曲率が異なる3つの階調特性Γ1、Γ2、Γの画像処理空間の画像信号に変換する(S2)CPUと、階調変換された各々の画像信号の欠落色成分を補間して、3通りのBayer 補間画像を生成する(S4)CPUと、3通りの補間画像を基準の階調特性Γ2の画像処理空間の画像に変換して階調特性を合わせる(S5)CPUと、3つの階調特性Γ1、Γ2、Γで補間され基準の階調特性Γ2に階調整合された3通りのBayer 補間画像を用いて、3つの画像の同一の画素間で、階調特性Γ2の補間画像の画素値に対する階調特性Γの補間画像の画素値と階調特性Γの補間画像の画素値との間のラプラシアン成分を抽出する(S6)CPUと、階調特性Γ2の補間画像に対して、ラプラシアン成分を同一の画素に加算する(S7)CPUと、を備えるようにした。これにより、全階調領域で平均的に優れたコントラスト解像を行うことができる従来の画像予測空間の性能を最大限に保ちつつ、更に高コントラストな補間画像を提供できる高精細な補間を行うことができる。 (4) The image processing apparatus converts the linear gradation image signal into three gradation characteristics Γ 1 and Γ having different curvatures with respect to image data including RGB color components and having missing color components. 2 and Γ 3 are converted into image signals in the image processing space (S2), and the missing color components of each of the tone-converted image signals are interpolated to generate three Bayer interpolated images (S4). The CPU and the three kinds of interpolated images are converted into an image in the image processing space having the reference gradation characteristic Γ 2 to match the gradation characteristics (S5). The CPU and the three gradation characteristics Γ 1 , Γ 2 , Γ 3 Using the three types of Bayer interpolation images interpolated in the above and matched in tone to the reference tone characteristic Γ 2 , the tone for the pixel value of the interpolated image of the tone characteristic Γ 2 is obtained between the same pixels of the three images. Laplacian between the pixel value of the characteristic gamma 1 of the interpolated image and the pixel value of the interpolated image tone characteristic gamma 3 Extracting a partial and (S6) CPU, relative to the tone characteristics gamma 2 of interpolated images, and so comprises adding Laplacian components in the same pixel and (S7) CPU, a. This enables high-definition interpolation that can provide a higher-contrast interpolated image while maximizing the performance of the conventional image prediction space that can perform excellent contrast resolution on average in all gradation regions. be able to.

(5)上記(4)の画像処理装置において、階調変換する(S2)CPUは、線形階調特性Γ1、平方根階調特性Γ、および立方根階調特性Γを、それぞれ用いるようにしたので、線形階調のガンマ空間Γ2では抽出できなかった平方根階調のガンマ空間Γ1や立方根階調のガンマ空間Γで予測されたコントラストを最大限に反映させることができる。 (5) In the image processing apparatus of (4), gradation conversion is performed (S2). The CPU uses the linear gradation characteristic Γ 1 , the square root gradation characteristic Γ 2 , and the cubic root gradation characteristic Γ 3 , respectively. Therefore, the contrast predicted in the square root tone gamma space Γ 1 and the cubic root tone gamma space Γ 3 which could not be extracted in the linear tone gamma space Γ 2 can be reflected to the maximum.

(6)上記(4)または(5)の画像処理装置において、色成分を補間して3通りの Bayer 補間画像を生成する(S4)CPUは、欠落する色成分の補間値を、欠落する色成分の色情報のみならず他の色成分の色情報も用いて算出するので、適切に色成分を補間できる。 (6) In the image processing apparatus according to (4) or (5), the color component is interpolated to generate three Bayer interpolation images. (S4) The CPU uses the missing color component interpolation value as the missing color. Since the calculation is performed using not only the color information of the components but also the color information of other color components, the color components can be appropriately interpolated.

(変形例1)
上記の説明では、3つの階調特性Γ1、Γ2、Γで補間され基準の階調特性Γ2に階調整合された3通りのBayer 補間画像を用いて、3つの画像の同一の画素間で、階調特性Γ2の補間画像の画素値に対する階調特性Γの補間画像の画素値と階調特性Γの補間画像の画素値との間のラプラシアン成分を抽出(S6)し、階調特性Γ2の補間画像に対して、ラプラシアン成分を同一の画素に加算する(S8)例を説明した。この代わりに、階調特性Γ2の補間画像の画素値と階調特性Γの補間画像の画素値との間の差分値、または、階調特性Γ2の補間画像の画素値と階調特性Γの補間画像の画素値との間の差分値を抽出し、階調特性Γ2の補間画像に対して、上記差分値を同一の画素に加算するように構成してもよい。この場合でも、基準階調のガンマ空間Γ2では抽出できなかったガンマ空間Γ1またはガンマ空間Γで予測されたコントラストを最大限に反映させることができる。
(Modification 1)
In the above description, three Bayer interpolation images interpolated with the three gradation characteristics Γ 1 , Γ 2 , and Γ 3 and gradation-matched with the reference gradation characteristic Γ 2 are used to identify the same three images. between pixels, it extracts the Laplacian component between the pixel values of the gradation characteristic gamma 1 of the interpolated image pixel values and the tone characteristics gamma 3 of the interpolation image with respect to the pixel value of the gradation characteristic gamma 2 interpolation image (S6) The example in which the Laplacian component is added to the same pixel with respect to the interpolation image having the gradation characteristic Γ 2 has been described (S8). Instead, the difference value between the pixel value of the interpolation image having the gradation characteristic Γ 2 and the pixel value of the interpolation image having the gradation characteristic Γ 1 , or the pixel value and the gradation of the interpolation image having the gradation characteristic Γ 2 A difference value between the pixel value of the interpolation image having the characteristic Γ 3 may be extracted, and the difference value may be added to the same pixel with respect to the interpolation image having the gradation characteristic Γ 2 . Even in this case, the contrast predicted in the gamma space Γ 1 or the gamma space Γ 3 that cannot be extracted in the reference tone gamma space Γ 2 can be reflected to the maximum extent.

<第二の実施形態>
第一の実施形態では、Bayer 補間の際にRGB成分の全ての色面で階調間ラプラシアンを抽出し、各色面の3成分に対して補間コントラストを補正する例を説明した。第二の実施形態では、これをもう少し簡便にして、輝度面に対してのみ補間コントラスト補正を行う例を示す。以降の説明では、第一の実施形態と同様の処理を行う部分の説明は省き、異なる処理を中心に説明する。
<Second Embodiment>
In the first embodiment, an example has been described in which Laplacian between gradations is extracted from all color planes of RGB components during Bayer interpolation, and interpolation contrast is corrected for the three components of each color plane. In the second embodiment, an example in which this is simplified a little more and interpolation contrast correction is performed only on the luminance surface will be described. In the following description, the description of the part that performs the same processing as in the first embodiment will be omitted, and the description will focus on different processing.

<輝度面のラプラシアン成分の生成>
CPUは、図7のステップS6において抽出した式(63)に基づくR,G,B各色成分の階調間ラプラシアン成分△R(Γ2)(x,y)、△G(Γ2)(x,y)、△B(Γ2)(x,y)から、輝度成分の階調間ラプラシアン成分△Y(Γ2)(x,y)を次式(65)により生成する。
△Y(Γ2)(x,y) = 0.3△R(Γ2)(x,y) + 0.6△G(Γ2)(x,y) + 0.1△B(Γ2)(x,y) …(65)
<Generation of Laplacian component of luminance surface>
The CPU performs inter-tone Laplacian components ΔR (Γ 2) (x, y), Δ G (Γ 2) (x, y) based on the equation (63) extracted in step S 6 of FIG. ), △ from B (Γ2) (x, y ), generated by the gradation between Laplacian component of the luminance component △ Y (Γ2) (x, y) the following equation (65).
△ Y (Γ2) (x, y) = 0.3 △ R (Γ2) (x, y) + 0.6 △ G (Γ2) (x, y) + 0.1 △ B (Γ2) (x, y)… (65)

ステップS7において、CPUは、以下のように基準補間画像の補正を行う。CPUは、図7のステップS3で求めたRGB補間画像を一旦、輝度面と色差面に変換して、輝度面に対して階調間ラプラシアン成分で補正を行った後に、元のRGB面に戻す。基準補間画像を補正する処理の流れについて、図9に例示するフローチャートを参照して説明する。   In step S7, the CPU corrects the reference interpolation image as follows. The CPU temporarily converts the RGB interpolated image obtained in step S3 of FIG. 7 into a luminance plane and a color difference plane, corrects the luminance plane with an inter-tone Laplacian component, and then returns to the original RGB plane. . The flow of processing for correcting the reference interpolation image will be described with reference to the flowchart illustrated in FIG.

図9のステップS81において、CPUは、次式(66)〜(68)によりRGB補間画像を輝度・色差面へ変換する。
Y(x,y) = 0.3R(Γ2→Γ2)(x,y) + 0.6G(Γ2→Γ2)(x,y) + 0.1B(Γ2→Γ2)(x,y) …(66)
Cr(x,y) = R(Γ2→Γ2)(x,y) - Y(x,y) …(67)
Cb(x,y) = B(Γ2→Γ2)(x,y) - Y(x,y) …(68)
In step S81 in FIG. 9, the CPU converts the RGB interpolated image into a luminance / color difference plane by the following equations (66) to (68).
Y (x, y) = 0.3R (Γ2 → Γ2) (x, y) + 0.6G (Γ2 → Γ2) (x, y) + 0.1B (Γ2 → Γ2) (x, y)… (66)
Cr (x, y) = R (Γ2 → Γ2) (x, y)-Y (x, y) (67)
Cb (x, y) = B (Γ2 → Γ2) (x, y)-Y (x, y) (68)

ステップS82において、CPUは、次式(69)により輝度面を補正する。
Y'(x,y) = Y(x,y) + △Y(Γ2)(x,y) …(69)
In step S82, the CPU corrects the luminance surface by the following equation (69).
Y ′ (x, y) = Y (x, y) + ΔY (Γ2) (x, y) (69)

ステップS83において、CPUは、次式(70)により元のRGB面へ逆変換する。
R'(Γ2)(x,y) = Cr(x,y) + Y'(x,y)
B'(Γ2)(x,y) = Cb(x,y) + Y'(x,y) …(70)
G'(Γ2)(x,y) = [Y'(x,y) - 0.3R'(Γ2)(x,y) - 0.1B'(Γ2)(x,y)]/0.6
In step S83, the CPU performs inverse conversion to the original RGB plane by the following equation (70).
R ' (Γ2) (x, y) = Cr (x, y) + Y' (x, y)
B ′ (Γ2) (x, y) = Cb (x, y) + Y ′ (x, y) (70)
G ' (Γ2) (x, y) = [Y' (x, y)-0.3R ' (Γ2) (x, y)-0.1B' (Γ2) (x, y)] / 0.6

以上説明した第二の実施形態によれば、各色面の3成分に対して補間コントラストを補正する代わりに輝度面に対してのみ補間コントラストを補正することにより、第一の実施形態より簡便に構成できる。   According to the second embodiment described above, it is simpler than the first embodiment by correcting the interpolation contrast only for the luminance plane instead of correcting the interpolation contrast for the three components of each color plane. it can.

<第三の実施形態>
第一の実施形態および第二の実施形態では、Bayer 配列などのデモザイク処理においてアクティブに補間用ガンマ空間を動かして、補間予測値として得られるコントラストの最大振幅を抽出する手法を示した。これと同様の考え方は、補間済みの一般画像に対して画像処理を行う場合にも適用することができる。例えば、エッジ強調をする場合において、入力画像の階調特性のままエッジ検出を行い、抽出されたエッジ成分に対してゲインを掛けて元画像に加算するような処理を行う。あるいは、L*a*b*のような均等色空間に変換して、輝度面L*に対してエッジ検出を行い、エッジ成分を加算するようなことを行う。あるいは、本出願人と同一発明者による米国特許第7,940,983号明細書に示されるように均等色・均等ノイズ空間に変換して輝度面に対して同様な処理を行う。
<Third embodiment>
In the first embodiment and the second embodiment, the method of actively moving the interpolation gamma space in the demosaic processing such as the Bayer array and extracting the maximum contrast amplitude obtained as the interpolation prediction value has been described. The same idea can be applied when image processing is performed on a general image that has been interpolated. For example, when edge enhancement is performed, edge detection is performed with the gradation characteristics of the input image, and processing is performed such that the extracted edge component is multiplied by a gain and added to the original image. Alternatively, it is converted to a uniform color space such as L * a * b *, edge detection is performed on the luminance plane L *, and edge components are added. Alternatively, as shown in U.S. Pat. No. 7,940,983 by the same inventor as the present applicant, it is converted into a uniform color / uniform noise space and the same processing is performed on the luminance plane.

これらの場合、エッジ検出を行う色面の階調特性がある曲線に固定されるため、例えば高輝度部のニー特性が強く寝ているような曲線の階調空間を用いていると、高輝度部のエッジコントラストが十分に抽出されないような問題が発生する。このような問題に対処するため、第一の実施形態や第二の実施形態で示したように、アクティブに階調空間を変化させ、それぞれで抽出されるエッジ成分で階調間コントラスト成分を取り出し、基準階調空間で抽出されたエッジ成分をそれで補正するという考え方が成り立つ。   In these cases, since the tone characteristic of the color plane for edge detection is fixed to a curved line, for example, if a gradation space of a curve where the knee characteristic of the high-luminance part is strongly lying is used, This causes a problem that the edge contrast of the part is not sufficiently extracted. In order to deal with such a problem, as shown in the first embodiment and the second embodiment, the gradation space is actively changed, and the contrast component between the gradations is extracted by the edge component extracted by each. The idea of correcting the edge component extracted in the reference gradation space with it is established.

第三の実施形態は、モノクロ画像に対するエッジ強調処理を例にあげて説明する。カラー画像の場合は、モノクロ画像の処理をR,G,B面の各々に対して同じ処理を行うか、輝度・色差面に変換して輝度面に対してのみモノクロ画像と同じ処理を行うかの何れかを行えばよい。   In the third embodiment, edge enhancement processing for a monochrome image will be described as an example. In the case of a color image, whether the monochrome image processing is the same for each of the R, G, and B surfaces, or is the same processing as for the monochrome image only for the luminance surface after conversion to the luminance / color difference surface Any one of the above may be performed.

エッジ強調を行うための基準階調空間Γ2は、第一の実施形態と同じく均等ノイズ空間となる平方根型の階調特性とする。そして、Γ1とΓ3空間も第一の実施形態と同様の階調特性とする。これらの階調特性の設定方法は、これらに限る必要はない。例えば、均等色空間L*を基準階調空間とする場合、Γ2空間は立方根の階調特性を持つから、Γ1空間として平方根型の均等ノイズ空間を、Γ3空間として対数特性の階調を設定することも可能である。 The reference gradation space Γ 2 for performing edge enhancement has a square root type gradation characteristic that is a uniform noise space as in the first embodiment. The Γ 1 and Γ 3 spaces have the same gradation characteristics as in the first embodiment. These gradation characteristic setting methods need not be limited to these. For example, when the uniform color space L * is used as the reference gradation space, the Γ 2 space has a cubic root gradation characteristic, so a square root type uniform noise space is used as the Γ 1 space, and a logarithmic gradation is used as the Γ 3 space. Can also be set.

<輝度面のラプラシアン成分の生成>
第三の実施形態のCPUが行うエッジ強調処理の流れについて、図10に例示するフローチャートを参照して説明する。図10のステップS91において、CPUは、標準的なガンマ曲線がかかったモノクロ画像 M(x,y)を入力する。
<Generation of Laplacian component of luminance surface>
The flow of edge emphasis processing performed by the CPU of the third embodiment will be described with reference to the flowchart illustrated in FIG. In step S91 of FIG. 10, the CPU inputs a monochrome image M (x, y) with a standard gamma curve.

ステップS92において、CPUは、モノクロ画像に対して3通りの階調変換を行う。具体的には、入力画像データのガンマ特性を線形階調に戻した後に、前述の3通りの画像処理用ガンマ空間(Γ1、Γ2、Γ3)に変換する。その結果、M(Γ1)(x,y)、M(Γ2)(x,y)、M(Γ3)(x,y)が生成される。 In step S92, the CPU performs three kinds of gradation conversion on the monochrome image. Specifically, after the gamma characteristic of the input image data is returned to the linear gradation, it is converted into the above-described three image processing gamma spaces (Γ 1 , Γ 2 , Γ 3 ). As a result, M (Γ1) (x, y), M (Γ2) (x, y), and M (Γ3) (x, y) are generated.

ステップS93において、CPUは3通りのエッジ成分を抽出する。具体的には、3通りの画像処理用ガンマ空間(Γ1、Γ2、Γ3)における各々の階調空間の画像面で、次式(71)〜(73)により平滑化した画像と原画像との差分値をとってエッジ成分を抽出する。
Γ1空間:E(Γ1)(x,y) = M(Γ1)(x,y) - <M(Γ1)(x,y)> …(71)
Γ2空間:E(Γ2)(x,y) = M(Γ2)(x,y) - <M(Γ2)(x,y)> …(72)
Γ3空間:E(Γ3)(x,y) = M(Γ3)(x,y) - <M(Γ3)(x,y)> …(73)
ただし、記号<>は複数の画素の局所平均を表す。
In step S93, the CPU extracts three types of edge components. Specifically, on the image plane in each gradation space in the three image processing gamma spaces (Γ 1 , Γ 2 , Γ 3 ), the image smoothed by the following equations (71) to (73) and the original The edge component is extracted by taking the difference value from the image.
Γ 1 space: E (Γ1) (x, y) = M (Γ1) (x, y)-<M (Γ1) (x, y)>… (71)
Γ 2 space: E (Γ2) (x, y) = M (Γ2) (x, y)-<M (Γ2) (x, y)>… (72)
Γ 3 space: E (Γ3) (x, y) = M (Γ3) (x, y)-<M (Γ3) (x, y)> (73)
The symbol <> represents a local average of a plurality of pixels.

ステップS94において、CPUは、エッジ成分の階調間のラプラシアン抽出とエッジ成分の補正を行う。具体的には、上記3つの画像処理用ガンマ空間で抽出されたエッジ成分から、同一画素内でΓ2空間のエッジ成分に対するΓ1空間のエッジ成分とΓ3空間のエッジ成分との間のラプラシアン成分を抽出し、それによってΓ2空間のエッジ成分のコントラストを補正する(次式74)。
E'(Γ2)(x,y) = E(Γ2)(x,y) + k*[2*E(Γ2)(x,y) - E(Γ1)(x,y) - E(Γ3)(x,y)] …(74)
ここに、kは定数倍である。この補正により、基準画像処理空間Γ2では、コントラスト抽出の難しかったエッジコントラスト成分がエッジ成分として拾われることになる。
In step S94, the CPU performs Laplacian extraction between the gradations of the edge component and correction of the edge component. Specifically, the Laplacian between the edge component in the Γ 1 space and the edge component in the Γ 3 space with respect to the edge component in the Γ 2 space within the same pixel from the edge components extracted in the three image processing gamma spaces. The component is extracted, thereby correcting the contrast of the edge component in the Γ 2 space (the following equation 74).
E ' (Γ2) (x, y) = E (Γ2) (x, y) + k * [2 * E (Γ2) (x, y) -E (Γ1) (x, y) -E (Γ3) (x, y)] ... (74)
Here, k is a constant multiple. By this correction, in the reference image processing space Γ 2 , the edge contrast component that is difficult to extract the contrast is picked up as an edge component.

ステップS95において、CPUは、基準画像のエッジ強調処理を行う。すなわち、コントラスト補正されたエッジ成分を用いて、次式(75)で示されるエッジ強調処理を行う。
M'(Γ2)(x,y) = M(Γ2)(x,y) + α*E'(Γ2)(x,y) …(75)
ここに、定数αはエッジ強調のゲインファクターである。
In step S95, the CPU performs edge enhancement processing of the reference image. That is, edge enhancement processing represented by the following equation (75) is performed using the edge component after contrast correction.
M ' (Γ2) (x, y) = M (Γ2) (x, y) + α * E' (Γ2) (x, y) (75)
Here, the constant α is a gain factor for edge enhancement.

ステップS96において、CPUは、エッジ強調画像の出力色空間変換を行い、図10による処理を終了する。具体的には、基準画像処理空間Γ2空間でエッジ強調された画像の階調特性を逆変換して、線形階調に戻した後、出力ガンマ変換処理を行って出力空間画像として出力する。 In step S96, the CPU performs output color space conversion of the edge-enhanced image and ends the processing in FIG. Specifically, the tone characteristics of the image edge-enhanced in the reference image processing space Γ 2 space are inversely transformed to return to linear tones, and then output gamma transformation processing is performed and output as an output space image.

以上説明した第三の実施形態によれば、第一の実施形態および第二の実施形態で説明した概念(Bayer 配列などのデモザイク処理においてアクティブに補間用ガンマ空間を動かして、補間予測値として得られるコントラストの最大振幅を抽出する点)を、エッジ強調処理の際にも導入することで、アクティブに階調空間を変化させ、それぞれで抽出されるエッジ成分で階調間コントラスト成分を取り出し、基準階調空間で抽出されたエッジ成分をそれで補正するようにした。これにより、例えば、高輝度部のニー特性が強く寝ているような曲線の階調空間を用いた場合であっても、高輝度部において十分にエッジ抽出でき、高精細なエッジ強調処理を行うことができる。   According to the third embodiment described above, the concept described in the first embodiment and the second embodiment (interpolated gamma space is actively moved in the demosaic processing such as Bayer array to obtain an interpolation predicted value. The maximum contrast amplitude that can be extracted) is also introduced during edge emphasis processing, so that the tone space is actively changed, and the contrast component between the tones is extracted with the edge components extracted by each. The edge component extracted in the gradation space is corrected by it. As a result, for example, even when a gradation space having a curve in which the knee characteristic of the high luminance part is strongly lying is used, edge extraction can be sufficiently performed in the high luminance part, and high-definition edge enhancement processing is performed. be able to.

(変形例2)
以上の説明では、画像処理プログラムをコンピュータ装置100(図6)に実行させる例を説明したが、画像処理装置を撮像装置に搭載してもよい。図11は、画像処理装置を搭載するカメラの構成を例示するブロック図である。カメラ200は、操作部材201と、撮像素子202と、制御装置203と、メモリカードスロット204と、モニタ205とを備えている。操作部材201は、使用者によって操作される種々の入力部材、例えば電源ボタン、レリーズボタン、ズームボタン等を含んでいる。
(Modification 2)
In the above description, an example in which the computer apparatus 100 (FIG. 6) executes the image processing program has been described. However, the image processing apparatus may be mounted on the imaging apparatus. FIG. 11 is a block diagram illustrating the configuration of a camera equipped with an image processing apparatus. The camera 200 includes an operation member 201, an image sensor 202, a control device 203, a memory card slot 204, and a monitor 205. The operation member 201 includes various input members operated by the user, such as a power button, a release button, a zoom button, and the like.

撮像素子202は、CMOSイメージセンサーなどによって構成される。撮像素子202は、不図示のレンズにより結像される被写体像を撮像する。そして、撮像によって得られた画像データを制御装置203へ出力する。   The image sensor 202 is configured by a CMOS image sensor or the like. The image sensor 202 captures a subject image formed by a lens (not shown). Then, the image data obtained by imaging is output to the control device 203.

制御装置203は、メモリ、およびその他の周辺回路により構成され、カメラ200が行う撮影動作を制御する。制御装置203を構成するメモリには、SDRAMやフラッシュメモリが含まれる。SDRAMは揮発性のメモリであって、制御装置203がプログラム実行時にプログラムを展開するためのワークメモリとして使用される。また、SDRAMは、データを一時的に記憶するためのバッファメモリとしても使用される。一方、フラッシュメモリは不揮発性のメモリであって、制御装置203が実行するプログラムのデータや、プログラム実行時に読込まれる種々のパラメータなどが記録される。   The control device 203 includes a memory and other peripheral circuits, and controls a photographing operation performed by the camera 200. Memory constituting the control device 203 includes SDRAM and flash memory. The SDRAM is a volatile memory, and is used as a work memory for the control device 203 to develop a program when the program is executed. The SDRAM is also used as a buffer memory for temporarily storing data. On the other hand, the flash memory is a non-volatile memory in which data of a program executed by the control device 203, various parameters read at the time of program execution, and the like are recorded.

メモリカードスロット204は、記憶媒体としてのメモリカードを挿入するためのスロットである。制御装置203は、撮影処理を行なうことによって生成した画像ファイルを、メモリカードスロット204に挿入されているメモリカードへ書込んで記録する。また、制御装置203は、メモリカードスロット204に挿入されているメモリカード内に記録されている画像ファイルを読込む。   The memory card slot 204 is a slot for inserting a memory card as a storage medium. The control device 203 writes and records the image file generated by performing the photographing process on the memory card inserted in the memory card slot 204. Further, the control device 203 reads an image file recorded in the memory card inserted in the memory card slot 204.

モニタ205は、カメラ200の背面に搭載された液晶モニタ(背面モニタ)である。当該モニタ205には、メモリカードに記録されている画像ファイルに基づく再生画像や、カメラ200を設定するための設定メニューなどが表示される。また、使用者が操作部材201を操作してカメラ200を撮影モードに設定すると、制御装置203は、撮像素子202から時系列で取得した画像の表示用画像データをモニタ205に出力する。これによってモニタ205にスルー画が表示される。   The monitor 205 is a liquid crystal monitor (rear monitor) mounted on the back surface of the camera 200. The monitor 205 displays a reproduction image based on the image file recorded on the memory card, a setting menu for setting the camera 200, and the like. When the user operates the operation member 201 to set the camera 200 to the shooting mode, the control device 203 outputs image data for display of images acquired in time series from the image sensor 202 to the monitor 205. As a result, a through image is displayed on the monitor 205.

上記撮像素子202の撮像面にはR、G、およびB色のカラーフィルタが Bayer 配列されている。すなわち、撮像素子202から制御装置203に出力される画像データは、RGB表色系で表される。制御装置203は、この画像データに対して上述した処理を行う。
なお、Bayer 配列以外のデルタ配列はハニカム配列など任意の配列の色補間で同様の考えが適用できる。
On the image pickup surface of the image pickup element 202, R, G, and B color filters are arranged in a Bayer array. That is, the image data output from the image sensor 202 to the control device 203 is expressed in the RGB color system. The control device 203 performs the above-described processing on this image data.
For delta arrangements other than Bayer arrangement, the same idea can be applied by color interpolation of arbitrary arrangement such as honeycomb arrangement.

第四の実施形態を説明する前に、もう一度デモザイク技術について述べる。上記第一の実施形態、第二の実施形態で述べてきたのは、最も曲率の大きい階調曲線として、立方根階調特性(Γ)を採用したときの話である。これは、図2に示されるように、基準階調の平方根階調特性(Γ2)から大きく外れることはないから上述のような議論が成り立つ。しかし、図3〜図5に示されるように、対数階調特性(Γ)のような極めて曲率の大きな階調曲線を採用した場合は事情が少し異なって、画質効果も別の独特の新しい性質のものを生み出す。階調間ラプラシアンは、採られる階調特性によって異なる役割を果たす。以下は、そのような実施形態の説明を行う。 Before describing the fourth embodiment, the demosaic technique will be described again. What has been described in the first embodiment and the second embodiment is a case where the cubic root gradation characteristic (Γ 3 ) is adopted as the gradation curve having the largest curvature. As shown in FIG. 2, this does not deviate significantly from the square root gradation characteristic (Γ 2 ) of the reference gradation, and thus the above argument holds. However, as shown in FIGS. 3 to 5, when a gradation curve having an extremely large curvature such as a logarithmic gradation characteristic (Γ 3 ) is adopted, the situation is slightly different, and the image quality effect is another unique new one. Produce a thing of nature. The inter-gradient Laplacian plays different roles depending on the gradation characteristics to be adopted. The following describes such an embodiment.

段落0023において、複数の予測空間による補間結果をそれぞれの空間における得手、不得手の階調領域を見分けて加重合成する考え方は、その判断基準が容易に存在せず、困難である旨を述べた。しかしながら、その判断基準が極めて合理的で適切に作用する新しい考え方を以下に説明する。   In paragraph 0023, it was stated that the concept of weighted synthesis of the interpolation results of a plurality of prediction spaces by discriminating the gradation areas of the pros and cons of each space is difficult because the judgment criteria do not exist easily. . However, the following is a description of a new concept in which the judgment criteria are extremely rational and appropriate.

<補間用ガンマ空間(予測空間)による画質の違い>
ここで、線形階調空間(Γ)と平方根階調空間(Γ)と対数階調空間(Γ)の3種類の方法で補間された画像の性質について、具体例を挙げてもう一度説明する。HDTV(high-definition television)用の透過型標準チャートの中で「看板チャート」と呼ばれるような、色と文字が多くある被写体がナイキスト解像限界付近の解像度で撮影された場合、補間用ガンマ空間による画質の違いが顕著に現れる。
<Difference in image quality due to interpolation gamma space (prediction space)>
Here, the properties of the image interpolated by the three kinds of methods of the linear gradation space (Γ 1 ), the square root gradation space (Γ 2 ), and the logarithmic gradation space (Γ 3 ) will be described again with specific examples. To do. Interpolation gamma space when a subject with a lot of colors and characters, such as a `` signboard chart '' in a transmission standard chart for HDTV (high-definition television), is shot at a resolution close to the Nyquist resolution limit. The difference in image quality due to

例えば、赤地に黒文字が入っている被写体像では、線形階調空間(Γ)で補間された画像は、黒文字が赤地の中に融けてほとんど文字が消えてしまうような解像となる。平方根階調空間(Γ)で補間された場合は、黒文字は何とか解像するものの、赤く滲んだ印象があり、不鮮明な色解像である。他方の対数階調空間(Γ)で補間された場合は、黒文字がはっきりと浮かび上がり、色解像力を最大限に発揮する。したがって、赤地に黒文字のような組み合わせの場合は、暗部のコントラストを持ち上げた対数階調である補間用ガンマ空間が有利な特性となる。 For example, in a subject image in which black characters are contained in a red background, an image interpolated in the linear gradation space (Γ 1 ) has a resolution in which the black characters are melted in the red background and the characters are almost lost. When interpolated in the square root gradation space (Γ 2 ), the black characters are somehow resolved, but there is an impression of blurring in red, resulting in an unclear color resolution. When interpolated in the other logarithmic gradation space (Γ 3 ), black characters clearly appear and color resolution is maximized. Therefore, in the case of a combination such as a black character on a red background, an interpolating gamma space having a logarithmic gradation in which the contrast of a dark part is increased is an advantageous characteristic.

一方、赤地の中に細い白枠線が入っている被写体像では反対の現象が起こる。すなわち、対数階調である補間用ガンマ空間(Γ)の場合は、白い枠線の中に周りの赤色が滲み出し、赤く色づいた白線となる。これが平方根階調である補間用ガンマ空間(Γ)の場合は、随分と抑制はされるものの、依然として白線の中に赤い滲みが残る。他方、線形階調である補間用ガンマ空間(Γ)の場合は、白線の中に赤色の滲みが生じず、この色組み合わせに於ける色解像力は最も高い。したがって、赤地に白線のような組み合わせの場合は、明るい階調域に幅広い階調コントラストを割り当てた線形階調である補間用ガンマ空間が有利な特性となる。 On the other hand, the opposite phenomenon occurs in a subject image in which a thin white frame is included in a red background. That is, in the case of an interpolating gamma space (Γ 3 ) having a logarithmic gradation, the surrounding red color oozes out into a white frame line, resulting in a white line colored red. In the case of the interpolating gamma space (Γ 2 ), which is a square root gradation, the red blur still remains in the white line, although it is considerably suppressed. On the other hand, in the case of an interpolating gamma space (Γ 1 ) having a linear gradation, no red blur occurs in the white line, and the color resolving power in this color combination is the highest. Therefore, in the case of a combination such as a white line on a red background, an interpolating gamma space which is a linear gradation in which a wide gradation contrast is assigned to a bright gradation area is an advantageous characteristic.

<3本ガンマの予測結果の合成方法>
このような状況の中で、次式(76)〜(78)により以下のように3つの補間用ガンマ空間で予測された補間値を加重合成しながら、階調間ラプラシアンによって補正することによって、補間値を算出することを考える。ただし、3つの補間用ガンマ空間で補間された結果は、共通のガンマ空間として平方根階調(Γ)である補間用ガンマ空間に変換されているものとする。RGBを共通の重みで合成する。

Figure 2013165482
<Method for synthesizing three gamma prediction results>
In such a situation, by correcting by the inter-tone Laplacian while performing weighted synthesis of the interpolation values predicted in the three interpolation gamma spaces by the following equations (76) to (78), Consider calculating an interpolation value. However, it is assumed that the result of interpolation in the three gamma spaces for interpolation is converted into a gamma space for interpolation having a square root gradation (Γ 2 ) as a common gamma space. RGB is synthesized with a common weight.
Figure 2013165482

式(76)〜(78)の第1項は、3つの補間結果の内分点を予測することができるので内挿、あるいは内分点補間と呼ぶことができる。第2項は、3つの補間結果の外分点を予測することができるので外挿、あるいは外分点補間の役割を果たすということができる。第1項は、加重平均補間であり、第2項は、階調間ラプラシアンである。   The first term of the equations (76) to (78) can be called interpolation or internal division interpolation because the internal division points of the three interpolation results can be predicted. Since the second term can predict the outer dividing point of three interpolation results, it can be said that it plays the role of extrapolation or outer dividing point interpolation. The first term is weighted average interpolation, and the second term is inter-tone Laplacian.

<内分加重と階調間ラプラシアンの効果>
第一の実施形態のように Gsqrt(x,y)に対して階調間ラプラシアンで補正した場合(外分補正のみ)と、以下で詳しく説明する方法で内分加重係数w を決めた第1項のみを使用した場合(内分加重のみ)と、第1項と第2項を併用した場合(内分加重+外分補正)の3者について画質を比較する。
<Effect of internal weighting and Laplacian between gradations>
When G sqrt (x, y) is corrected with a Laplacian between gradations (only external correction) as in the first embodiment, the internal weighting coefficient w is determined by the method described in detail below. The image quality is compared for the three cases where only one term is used (internal weighting only) and when the first term and second term are used together (internal weighting + outside weight correction).

赤地に黒文字の被写体像の場合は、「外分補正のみ」を行った画像は、第一の実施形態の効果とは逆に、黒文字に赤地が覆いかぶさって黒文字の解像がむしろ平方根階調である補間用ガンマ空間のみの補間結果に比べて低下する現象が生じる。ところが、解像コントラストを基本的に最大化するように内分加重係数が決められた「内分加重のみ」を行った補間結果は、対数階調である補間用ガンマ空間の利点を最大限に取り込んで、強いコントラストの解像性能を示す。その結果、第1項と第2項を併用した「内分加重+外分補正」の方式は、平方根階調である補間用ガンマ空間のみの従来の補間結果に比べて、総合的に色解像力と色コントラストが増した高画質な補間結果を得ることができる。   In the case of a black character subject image on a red background, an image that has been subjected to “external compensation only” is contrary to the effect of the first embodiment, the black character is covered with a red background and the resolution of the black character is rather a square root gradation. As a result, a phenomenon of lowering the interpolation result of only the interpolation gamma space is generated. However, the result of interpolation using only “internal weighting” with an internal weighting factor determined so as to basically maximize the resolution contrast maximizes the advantage of the logarithmic gradation interpolation gamma space. Incorporated to show strong contrast resolution performance. As a result, the “internal weighting + outer part correction” method using both the first term and the second term is more comprehensive than the conventional interpolation result of only the interpolation gamma space, which is a square root gradation, in terms of color resolution. High-quality interpolation results with increased color contrast can be obtained.

次に、赤地に細い白線の被写体像の場合、「内分加重のみ」を行った補間結果は、期待に反して対数階調である補間用ガンマ空間による補間結果に近く、白線が赤色に強く滲み、かつ高彩度に色再現性が歪んだ結果が得られることになる。他方の第一の実施形態の「外分補正のみ」の補間結果は、白線が滲みなく、全体の赤地部分の彩度が低い補間結果が得られる。したがって、第1項と第2項を組み合わせた「内分加重+外分補正」の方式は、うまく調和して適切な色再現性を示しつつ、平方根階調である補間用ガンマ空間のみの補間結果よりも白線がはっきりと解像した高い色解像力の補間結果が得られる。   Next, in the case of a subject image with a thin white line on a red background, the interpolation result with “internal weighting only” is close to the result of interpolation using the logarithmic gray scale interpolation gamma space, and the white line is strong against red. The result is that the color reproducibility is distorted with blurring and high saturation. The interpolation result of “external component correction only” in the other first embodiment provides an interpolation result in which the white line does not blur and the saturation of the entire red background portion is low. Therefore, the “internal weighting + outer part correction” method combining the first term and the second term is well harmonized and exhibits appropriate color reproducibility, while interpolating only the gamma space for interpolation, which is a square root gradation. Interpolation results with high color resolving power in which white lines are clearly resolved than the results are obtained.

つまり、内分加重と外分補正を併用した方式は、それぞれが得手、不得手をもつ「赤地に黒文字」の解像も、「赤地に白線」の解像も、互いに得意とする性能を共に導き出しつつ、それぞれが持つ弊害は相殺し合って従来の1つの補間用ガンマ空間による予測結果よりも高性能な補間結果を生み出すことができる。   In other words, the method that uses both internal weighting and external weight correction, both of which are good and bad, are both “black text on red background” and “white line on red background”. While deriving, it is possible to cancel each other's harmful effects and generate a higher-performance interpolation result than the prediction result by one conventional interpolation gamma space.

なお、上記説明では、赤地に黒文字と白線の例を取り上げて説明したが、他の様々な色組み合わせにおいても同様に改善する効果が導き出せる。   In the above description, an example of black characters and white lines on a red background has been described. However, the same improvement effect can be derived for other various color combinations.

<加重合成指標>
ここで、内分加重係数の決め方について説明する。3つの予測空間を用いて得られた3通りの補間結果に対して、「利得(Figure of Merit)」を計算して、利得の多い補間結果を重視した合成を行う。その利得の判断基準として、まず解像力(空間分解能)を上げることが求められる。解像力は、大きく分けて輝度解像力と色解像力の2種類の概念に分かれる。
<Weighted composite index>
Here, how to determine the internal weighting coefficient will be described. For the three types of interpolation results obtained using the three prediction spaces, a “gain (Figure of Merit)” is calculated, and synthesis is performed with emphasis on the interpolation result having a large gain. As a criterion for determining the gain, it is first required to increase the resolution (spatial resolution). The resolving power is roughly divided into two kinds of concepts of luminance resolving power and color resolving power.

それぞれの補間画像の輝度解像力が高いかどうかに関する指標は、輝度コントラストが高いかどうかを調べる。輝度コントラストは、局所的なエッジ成分であるラプラシアンを抽出すると適切な判断指標を与えると推測される。なぜならば、ナイキスト周波数に近い画素単位で白黒と入れ替わるような画像構造を捉えているとすると、その画像構造を分解する能力を持つときには、その近傍で抽出した2次微分のラプラシアンは大きな値を持っているであろうと考えられるからである。したがって、輝度面を生成し、輝度面のラプラシアンを抽出して輝度コントラストを評価する。   As an index regarding whether the luminance resolution of each interpolated image is high, it is checked whether the luminance contrast is high. The luminance contrast is estimated to give an appropriate determination index when Laplacian that is a local edge component is extracted. This is because if you have an image structure that replaces black and white in units of pixels close to the Nyquist frequency, the Laplacian of the second derivative extracted in the vicinity has a large value when it has the ability to decompose the image structure. Because it is thought that it will be. Therefore, a luminance plane is generated, a Laplacian of the luminance plane is extracted, and luminance contrast is evaluated.

同様に、補間画像の色解像力が高いかどうかに関する指標は、色コントラストが高いかどうかを調べる。色コントラストは、色差面、あるいは彩度面を作り、その面内でのラプラシアンを抽出すると適切な判断指標を与えると推測される。   Similarly, an indicator regarding whether the color resolution of the interpolated image is high examines whether the color contrast is high. The color contrast is estimated to give an appropriate judgment index when a color difference plane or a saturation plane is created and a Laplacian in the plane is extracted.

<トレードオフの関係>
ところが、補間画像にはノイズ成分や偽色成分が含まれている。上述のような輝度コントラストを最大化すると、ノイズを増幅する恐れがある。また、色コントラストを最大化すると、偽色の強い補間結果を採用してしまう恐れがある。すなわち、一般に色補間やノイズ除去、エッジ強調などにおける画像処理では、輝度コントラストとノイズは共役な関係にあり、輝度コントラストを上げようとするとノイズ増幅し、ノイズを低減しようとすると輝度コントラストが落ちるようなトレードオフが存在する。言い換えると不確定性原理が働く。
<Trade-off relationship>
However, the interpolation image contains a noise component and a false color component. Maximizing the brightness contrast as described above may amplify noise. In addition, when the color contrast is maximized, there is a risk of adopting an interpolation result with a strong false color. That is, in general, in image processing for color interpolation, noise removal, edge enhancement, etc., luminance contrast and noise are in a conjugate relationship, so that increasing the luminance contrast amplifies the noise, and reducing the noise reduces the luminance contrast. There are significant tradeoffs. In other words, the uncertainty principle works.

同様に、色コントラストと偽色(あるいは色ノイズ)は共役な関係にあり、色コントラストを上げようとすると偽色が増大し、偽色を低減しようとすると色コントラストが落ちるようなトレードオフが存在する。   Similarly, there is a conjugate relationship between color contrast and false color (or color noise), and there is a trade-off that increases false color when trying to increase color contrast and decreases color contrast when trying to reduce false color. To do.

<利得(Figure of Merit)>
このような事実に基づき、最良の「Figure of Merit」を与えるには、如何なる指標かについて考察する必要がある。これに対する解決策は、ノイズを抑制しつつ、輝度コントラストを同時に最大化するように指標を組むことである。同様に、偽色を抑制しつつ、色コントラストを同時に最大化するように指標を組むことである。更に、輝度面の最大利得と色差面の最大利得を同時化するように指標を組むことである。
<Gain (Figure of Merit)>
Based on this fact, it is necessary to consider what kind of index to give the best “Figure of Merit”. The solution to this is to set an index to simultaneously maximize brightness contrast while suppressing noise. Similarly, setting an index to simultaneously maximize the color contrast while suppressing false colors. Furthermore, an index is set so that the maximum gain of the luminance plane and the maximum gain of the color difference plane are synchronized.

したがって、各画素に於ける「Figure of Merit」をI(x,y)、輝度面Yのラプラシアンを△Y(x,y)、色差面Cのラプラシアンを△C(x,y)、R,G,B面の局所標準偏差をσR(x,y),σG(x,y),σB(x,y)、RG面間、BG面間、RB面間の色差を|R(x,y)-G(x,y)|, |B(x,y)-G(x,y)|, |R(x,y)-B(x,y)|とし、以下の式(79)、(80)で同時に指標化する。
I = (輝度コントラスト)・(ノイズ抑制度)・(色コントラスト)・(偽色抑制度)…(79)

Figure 2013165482
こうして求めた「Figure of Merit」を重み係数に比例するように設定する(式(81))。
Figure 2013165482
各画素毎に3つの補間画像に対する重み係数の間で、規格化を行うと加重係数となる。 Therefore, the `` Figure of Merit '' at each pixel is I (x, y), the Laplacian of the luminance plane Y is △ Y (x, y), the Laplacian of the color difference plane C is △ C (x, y), R, The local standard deviation of G and B surfaces is σ R (x, y), σ G (x, y), σ B (x, y), the color difference between RG, BG, and RB is | R ( x, y) -G (x, y) |, | B (x, y) -G (x, y) |, | R (x, y) -B (x, y) | 79) and (80).
I = (luminance contrast), (noise suppression), (color contrast), (false color suppression) ... (79)
Figure 2013165482
The “Figure of Merit” obtained in this way is set to be proportional to the weighting coefficient (Formula (81)).
Figure 2013165482
When normalization is performed among the weighting factors for the three interpolated images for each pixel, the weighting factor is obtained.

<画質改善効果>
このようにして求めた内分加重と外分補正を併用した3通りの補間結果の合成画像は、従来の平方根階調である単独の予測空間を用いた補間結果に比べ、次のような高性能化を達成することができる。すなわち、
a)画像全体の鮮鋭感が向上する。
b)統計的に大部分の色組み合わせの間で色解像力が劇的に向上する。
c)従来の色モアレ抑制能力を維持しつつ、高輝度部周りの偽色抑制が向上する。
d)色収差を抑制する。
<Image quality improvement effect>
The composite image of the three types of interpolation results obtained by using both the internal weighting and the external weight correction obtained in this way is compared to the interpolation result using a single prediction space that is a conventional square root tone, as shown below. Performance can be achieved. That is,
a) The sharpness of the entire image is improved.
b) Statistically, the color resolution is dramatically improved among most color combinations.
c) Suppression of false color around the high luminance part is improved while maintaining the conventional color moiré suppression capability.
d) Suppress chromatic aberration.

色解像力の向上に至っては、通常の Bayer配列がもつ色解像力範囲を超える高周波領域にまで、色解像限界を延ばす効果がある。この点について図12を参照して説明する。図12は、Bayer配列における無彩色被写体の解像力(輝度解像力)と有彩色の解像力(色解像力)を周波数空間(k空間)で表した図である。図12において、kx軸およびky軸の±π/aを横切る線で囲われた正方形の領域が、Bayer配列固有の無彩色解像の範囲である。また、kx軸およびky軸の±π/(2a)を横切る線で囲われた正方形の領域が、Bayer配列固有の有彩色解像の範囲である。   The improvement in color resolution has the effect of extending the color resolution limit to a high frequency range that exceeds the color resolution range of the normal Bayer array. This point will be described with reference to FIG. FIG. 12 is a diagram showing the resolving power (luminance resolving power) and the chromatic color resolving power (color resolving power) of an achromatic object in the Bayer array in a frequency space (k space). In FIG. 12, a square area surrounded by a line crossing ± π / a of the kx axis and the ky axis is the range of the achromatic resolution unique to the Bayer arrangement. A square area surrounded by a line crossing ± π / (2a) of the kx axis and the ky axis is a range of chromatic color resolution unique to the Bayer array.

上記色解像限界の延伸は、図12のR,B成分の色解像力を示す枠(Bayer配列固有の有彩色解像の範囲)を超え、G成分の色解像力を示す枠の近く、あるいはそれ以上にまで渡り、周波数空間で今までの2倍以上の面積の色解像力を示す色組み合わせが得られる場合が多数存在する。   The above extension of the color resolution limit exceeds the frame indicating the color resolving power of the R and B components in FIG. 12 (the chromatic color resolving range unique to the Bayer array) and is close to or near the frame indicating the color resolving power of the G component. As described above, there are many cases where a color combination showing a color resolving power having an area twice or more than that in the frequency space can be obtained.

<第四の実施形態>
−Bayer補間:RGB各面の内分加重と階調ラプラシアン−
第四の実施形態では、補間用ガンマ空間として線形階調(Γ1)、オフセット付き平方根階調(Γ)、および対数階調(Γ)の3種を用い、これら3つの補間用ガンマ空間で予測された補間値を加重合成しながら、階調間ラプラシアンによって補正することによって補間値を算出する。
<Fourth embodiment>
-Bayer interpolation: Internal weighting and gradation Laplacian of each RGB surface-
In the fourth embodiment, three types of gamma space for interpolation are used: linear tone (Γ 1 ), square root tone with offset (Γ 2 ), and logarithmic tone (Γ 3 ). The interpolation value is calculated by correcting the interpolated Laplacian while performing weighted synthesis of the interpolation value predicted in space.

図13は、第四の実施形態によるコンピュータ装置100のCPUが実行する画像処理の流れを説明するフローチャートである。ここで、第一の実施形態のフローチャート(図7)と同一処理には、同じステップ番号を付して説明を省略する。第一の実施形態と同一のステップでは、第一の実施形態と同様の作用効果を奏する。図13において、ステップS6とステップS8との間にステップS70およびステップS80を行う点が図7(第一の実施形態)と相違するので、これら相違点を中心に説明する。   FIG. 13 is a flowchart for explaining the flow of image processing executed by the CPU of the computer apparatus 100 according to the fourth embodiment. Here, the same processes as those in the flowchart of the first embodiment (FIG. 7) are denoted by the same step numbers and description thereof is omitted. In the same steps as those in the first embodiment, the same operational effects as those in the first embodiment can be obtained. 13 differs from FIG. 7 (first embodiment) in that step S70 and step S80 are performed between step S6 and step S8. Therefore, these differences will be mainly described.

図13のステップS70において、CPUは内分加重画像の合成を行う。図14は、内分加重画像合成処理の詳細を説明するフローチャートである。図14において、ステップS71〜S75で「利得計算」を行い、ステップS76〜S78で「加重係数への変換」を行う。そして、ステップS79〜S7Bにおいて「内分加重合成」を行う。   In step S70 of FIG. 13, the CPU synthesizes the internally weighted image. FIG. 14 is a flowchart for explaining the details of the internally weighted image composition processing. In FIG. 14, “gain calculation” is performed in steps S71 to S75, and “conversion to weighted coefficients” is performed in steps S76 to S78. In steps S79 to S7B, “internal weighted composition” is performed.

「利得計算」
CPUは、3通りの補間済RGB面を用いて、3通りのそれぞれに対して以下の指標計算を行う。処理内容は同様であるので、3つのうちいずれか1つの補間済RGB面をR(x,y),G(x,y),B(x,y)で表すことにする。
"Gain calculation"
The CPU performs the following index calculation for each of the three types using the three types of interpolated RGB planes. Since the processing contents are the same, any one of the three interpolated RGB planes is represented by R (x, y), G (x, y), B (x, y).

(S71)輝度コントラスト指標
CPUは、図14のステップS71において、輝度コントラスト指標の生成を行う。具体的には、次式(82)によって輝度面を生成する。
Y(x,y)=[R(x,y)+2G(x,y)+B(x,y)]/4 …(82)
(S71) Luminance Contrast Index The CPU generates a luminance contrast index in step S71 of FIG. Specifically, the luminance plane is generated by the following equation (82).
Y (x, y) = [R (x, y) + 2G (x, y) + B (x, y)] / 4 (82)

次にCPUは、輝度面のガウスぼかしを行う。デモザイクで説明した、G補間を行うときの参照画素の範囲や、色差面を生成し、色差面補間をした直後において補間に必要な参照画素の範囲から明らかなように、色補間の核となる参照画素範囲は7×7画素程度が基本である。したがって、3通りの補間結果の違いを見分けるにもこの程度の広がり範囲に関する情報を集める必要がある。ゆえに、本実施形態では7×7サイズのガウスぼかしを行う。ここで、水平方向のガウスぼかしと垂直方向のガウスぼかしとを畳み込んだ分離型フィルタ(次式(83)〜(85))を用いると簡便に行える。ここに、2rth =7と設定する。

Figure 2013165482
CPUは、輝度面のラプラシアン成分を次式(86)により抽出する。
Figure 2013165482
そして、式(87)により、輝度コントラストの指標としてラプラシアン成分の二乗を採用する。
(輝度コントラスト指標)= |△Y(x,y)|2 …(87) Next, the CPU performs Gaussian blurring on the luminance surface. As will be apparent from the reference pixel range necessary for interpolation immediately after generating the color difference plane and performing the color difference plane interpolation as described in the demosaic, it becomes the core of color interpolation. The reference pixel range is basically about 7 × 7 pixels. Therefore, it is necessary to collect information on the extent of this extent in order to distinguish between the three interpolation results. Therefore, in this embodiment, Gaussian blur of 7 × 7 size is performed. Here, it is easy to use a separation type filter (following equations (83) to (85)) that convolves a Gaussian blur in the horizontal direction and a Gaussian blur in the vertical direction. Here, 2r th = 7 is set.
Figure 2013165482
The CPU extracts the Laplacian component of the luminance surface by the following equation (86).
Figure 2013165482
Then, the square of the Laplacian component is adopted as the luminance contrast index according to the equation (87).
(Luminance contrast index) = | △ Y (x, y) | 2 (87)

(S72)色コントラスト指標
CPUは、ステップS72において、色コントラスト指標の生成を行う。具体的には、次式(88)によって彩度面を生成する。
C(x,y)=[|R(x,y)-G(x,y)|+|B(x,y)-G(x,y)|+|R(x,y)-B(x,y)|] …(88)
(S72) Color Contrast Index In step S72, the CPU generates a color contrast index. Specifically, the saturation plane is generated by the following equation (88).
C (x, y) = [| R (x, y) -G (x, y) | + | B (x, y) -G (x, y) | + | R (x, y) -B ( x, y) |] ... (88)

次にCPUは、色差面のガウスぼかしを行う。輝度面の場合と同様に、7×7サイズの範囲で行う。したがって、ガウスぼかしフィルタの定義式は次式(89)で表される。

Figure 2013165482
そして、式(91)により、色コントラストの指標としてラプラシアン成分の二乗を採用する。
(色コントラスト指標)= |△C(x,y)|2 …(91) Next, the CPU performs Gaussian blur on the color difference plane. As in the case of the luminance surface, the measurement is performed in a 7 × 7 size range. Therefore, the definition formula of the Gaussian blur filter is expressed by the following formula (89).
Figure 2013165482
Then, the square of the Laplacian component is adopted as an index of color contrast according to the equation (91).
(Color contrast index) = | ΔC (x, y) | 2 (91)

(S73)ノイズ指標
CPUは、ステップS73において、ノイズ指標の生成を行う。具体的には、ノイズの揺らぎ幅を表す指標として局所的な標準偏差を採用し、該標準偏差をR,G,B面のそれぞれについて求め、その二乗和をその補間結果のノイズ指標とする。R面を例にあげると、次式(92)および(93)で表される。なお、局所的な標準偏差を調べる領域も、補間値算出の参照画素範囲の核である7×7サイズ程度とする。ゆえに、2rth =7と設定する。

Figure 2013165482
(S73) Noise index The CPU generates a noise index in step S73. Specifically, a local standard deviation is adopted as an index representing the noise fluctuation width, the standard deviation is obtained for each of the R, G, and B planes, and the sum of squares thereof is used as a noise index of the interpolation result. Taking the R plane as an example, it is expressed by the following equations (92) and (93). Note that the region for examining the local standard deviation is also set to about 7 × 7 size, which is the core of the reference pixel range for interpolation value calculation. Therefore, 2r th = 7 is set.
Figure 2013165482

CPUは、G面、B面についても同様に求め、ノイズ指標として次式(94)を採用する。

Figure 2013165482
The CPU similarly obtains the G plane and the B plane, and adopts the following equation (94) as a noise index.
Figure 2013165482

(S74)彩度指標
CPUは、ステップS74において、彩度指標の生成を行う。具体的には、彩度指標として、各画素の無彩色度を測る。偽色の発生が少ないほど無彩色度が増す。彩度指標は、次式(95)で表される。

Figure 2013165482
(S74) Saturation index In step S74, the CPU generates a saturation index. Specifically, the achromaticity of each pixel is measured as a saturation index. The achromatic chromaticity increases as the occurrence of false colors decreases. The saturation index is expressed by the following equation (95).
Figure 2013165482

(S75)統合指標
CPUは、ステップS75において、統合指標の生成を行う。CPUは、次式(96)のように、各画素に於ける統合指標I(x,y)を4つの指標の積と商で表す。
(統合指標)=[(輝度コントラスト指標)/(ノイズ指標)]・[(色コントラスト指標)/(彩度指標)]

Figure 2013165482
(S75) Integrated Index In step S75, the CPU generates an integrated index. The CPU represents the integrated index I (x, y) in each pixel as a product and a quotient of the four indices as in the following equation (96).
(Integrated index) = [(Luminance contrast index) / (Noise index)] / [(Color contrast index) / (Saturation index)]
Figure 2013165482

「加重係数への変換」
上式(76)〜上式(78)では共通の内分加重係数の場合を説明したが、実運用上は色差面の偽色である色モアレを増幅しないために、輝度面用と色差面用の内分加重係数に分け、輝度面用の内分加重係数と色差面用の内分加重係数に同じ値を代入した上で、色差面用の加重係数に対して少しだけローパスフィルタで補正する処理を行う。以下の説明は、この流れに沿う手続きである。
"Conversion to weighting factor"
In the above formulas (76) to (78), the case of the common internal weighting coefficient has been described. However, in actual operation, the color moiré that is a false color of the chrominance plane is not amplified. The same value is assigned to the internal weighting coefficient for the luminance plane and the internal weighting coefficient for the chrominance plane, and a slight correction is made with the low-pass filter for the weighting coefficient for the chrominance plane. Perform the process. The following explanation is a procedure along this flow.

(S76)統合指標の規格化
CPUは、ステップS76において、統合指標の規格化を行う。具体的には、線形階調(Γ1)、平方根階調(Γ)、対数階調(Γ)の各々を経てデモザイク処理された補間画像の、平方根階調特性(Γ)に於いて算出されたそれぞれの統合指標を、

Figure 2013165482
と表す。 (S76) Standardization of integrated index In step S76, the CPU standardizes the integrated index. Specifically, in the square root tone characteristics (Γ 2 ) of the interpolated image demodulated through each of the linear tone (Γ 1 ), the square root tone (Γ 2 ), and the logarithmic tone (Γ 3 ). Each integrated index calculated in
Figure 2013165482
It expresses.

内分加重をするための加重係数をw(x,y)で表すと、それぞれの加重係数は次式(97)〜(99)のように表される。

Figure 2013165482
When a weighting coefficient for performing internal weighting is represented by w (x, y), each weighting coefficient is represented by the following equations (97) to (99).
Figure 2013165482

(S77)輝度面用の加重係数の設定
CPUは、ステップS77において、輝度面用の加重係数を設定する。CPUは、輝度面用の加重係数として、上式(97)〜(99)による加重係数をそのまま輝度面用に設定する(式(100)〜(102))。

Figure 2013165482
(S77) Setting of Weighting Factor for Luminance Surface In step S77, the CPU sets a weighting factor for luminance surface. The CPU sets the weighting coefficients according to the above equations (97) to (99) as they are for the luminance surface as the luminance surface weighting factors (equations (100) to (102)).
Figure 2013165482

(S78)色差面用の加重係数の設定
CPUは、ステップS78において、色差面用の加重係数を設定する。CPUは、色差面用の加重係数として、上式(97)〜(99)による加重係数に対して微小なローパスフィルタbを掛けて、次式(103)〜(105)により色差面用の加重係数を設定する。

Figure 2013165482
ただし、bは、例えば3×3サイズの微小なローパスフィルタである。上式右辺において○と×を組合わせた演算記号は、コンボリューションを表す。 (S78) Setting of Weighting Coefficient for Color Difference Surface In step S78, the CPU sets a weighting coefficient for the color difference surface. The CPU multiplies the weighting coefficients according to the above equations (97) to (99) by a small low-pass filter b as the weighting coefficient for the color difference surface, and weights for the color difference surface according to the following equations (103) to (105). Set the coefficient.
Figure 2013165482
However, b is a minute low-pass filter of 3 × 3 size, for example. In the right side of the above formula, an operation symbol combining ○ and × represents convolution.

「内分加重合成」
CPUは、ステップS79において、RGB空間からGCbCr空間への変換を行う。具体的には、3通りの補間済RGB面のそれぞれを輝度面と色差面へ変換する。ただし、輝度面はG成分のままとする。したがって色差面は、R,B成分からG成分を減算するだけでよい。なお、輝度・色差の変換方法は、これに限られない。
"Internally weighted composition"
In step S79, the CPU performs conversion from the RGB space to the GCbCr space. Specifically, each of the three interpolated RGB planes is converted into a luminance plane and a color difference plane. However, the luminance surface remains the G component. Therefore, the color difference plane only needs to subtract the G component from the R and B components. The luminance / color difference conversion method is not limited to this.

CPUは、線形階調である補間用ガンマ空間(Γ)で予測した輝度面と色差面を、次式(106)〜(108)により求める。
G(Γ1→Γ2)(x,y) …(106)
Cr(Γ1→Γ2)(x,y)=R(Γ1→Γ2)(x,y)-G(Γ1→Γ2)(x,y) …(107)
Cb(Γ1→Γ2)(x,y)=B(Γ1→Γ2)(x,y)-G(Γ1→Γ2)(x,y) …(108)
The CPU obtains the luminance plane and color difference plane predicted by the interpolation gamma space (Γ 1 ), which is a linear gradation, using the following equations (106) to (108).
G (Γ1 → Γ2) (x, y) (106)
Cr (Γ1 → Γ2) (x, y) = R (Γ1 → Γ2) (x, y) -G (Γ1 → Γ2) (x, y) (107)
Cb (Γ1 → Γ2) (x, y) = B (Γ1 → Γ2) (x, y) -G (Γ1 → Γ2) (x, y) (108)

CPUは、平方根階調である補間用ガンマ空間(Γ)で予測した輝度面と色差面を、次式(109)〜(111)により求める。
G(Γ2→Γ2)(x,y) …(109)
Cr(Γ2→Γ2)(x,y)=R(Γ2→Γ2)(x,y)-G(Γ2→Γ2)(x,y) …(110)
Cb(Γ2→Γ2)(x,y)=B(Γ2→Γ2)(x,y)-G(Γ2→Γ2)(x,y) …(111)
The CPU obtains the luminance plane and color difference plane predicted by the interpolation gamma space (Γ 2 ), which is the square root gradation, by the following equations (109) to (111).
G (Γ2 → Γ2) (x, y) (109)
Cr (Γ2 → Γ2) (x, y) = R (Γ2 → Γ2) (x, y) -G (Γ2 → Γ2) (x, y) (110)
Cb (Γ2 → Γ2) (x, y) = B (Γ2 → Γ2) (x, y) -G (Γ2 → Γ2) (x, y) (111)

CPUは、対数階調である補間用ガンマ空間(Γ)で予測した輝度面と色差面を、次式(112)〜(114)により求める。
G(Γ3→Γ2)(x,y) …(112)
Cr(Γ3→Γ2)(x,y)=R(Γ3→Γ2)(x,y)-G(Γ3→Γ2)(x,y) …(113)
Cb(Γ3→Γ2)(x,y)=B(Γ3→Γ2)(x,y)-G(Γ3→Γ2)(x,y) …(114)
The CPU obtains the luminance plane and the color difference plane predicted by the interpolating gamma space (Γ 3 ) that is logarithmic gradation, using the following equations (112) to (114).
G (Γ3 → Γ2) (x, y) (112)
Cr (Γ3 → Γ2) (x, y) = R (Γ3 → Γ2) (x, y) -G (Γ3 → Γ2) (x, y) (113)
Cb (Γ3 → Γ2) (x, y) = B (Γ3 → Γ2) (x, y) -G (Γ3 → Γ2) (x, y) (114)

CPUは、ステップS7Aにおいて、輝度・色差面の内分加重合成を行う。次式(115)は、輝度面の内分加重合成を表す式である。

Figure 2013165482
次式(116)は、Cr面の内分加重合成を表す式である。
Figure 2013165482
次式(117)は、Cb面の内分加重合成を表す式である。
Figure 2013165482
In step S7A, the CPU performs internally weighted synthesis of the luminance / color difference plane. The following equation (115) is an equation representing the internally weighted synthesis of the luminance plane.
Figure 2013165482
The following equation (116) is an equation representing the internally weighted synthesis of the Cr surface.
Figure 2013165482
The following equation (117) is an equation representing the internally weighted synthesis of the Cb surface.
Figure 2013165482

CPUは、ステップS7Bにおいて、GCbCr空間からRGB空間への変換を行う。具体的には、逆色空間変換により、基準の補間用ガンマ空間(Γ2空間)で内分加重合成したR,G,B面を得る。ただし、G面はそのままでよい。 In step S7B, the CPU performs conversion from the GCbCr space to the RGB space. Specifically, by inverse color space conversion, R, G, B planes obtained by internally weighted synthesis in a reference interpolation gamma space (Γ 2 space) are obtained. However, the G plane may be left as it is.

CPUは、内分加重合成したR,B面を、次式(118)〜(119)により求める。

Figure 2013165482
The CPU obtains the R and B planes obtained by internally weighted synthesis using the following equations (118) to (119).
Figure 2013165482

図13のステップS80において、CPUは、内分加重画像の補正を行う。CPUは、ステップS70で求めたΓ2空間での内分加重合成画像を、ステップS6(図13)で求めた階調間ラプラシアンでコントラスト補正をする処理を行う(次式(120))。
R'(Γ2)(x,y)= Rw (Γ2→Γ2)(x,y) + k*△R(Γ2)(x,y)
G'(Γ2)(x,y)= Gw (Γ2→Γ2)(x,y) + k*△G(Γ2)(x,y) …(120)
B'(Γ2)(x,y)= Bw (Γ2→Γ2)(x,y) + k*△B(Γ2)(x,y)
ただし、定数倍 kの値は、通常1ないしは0.5の値をとる。
In step S80 of FIG. 13, the CPU corrects the internally weighted image. The CPU performs processing for correcting the contrast of the internally weighted synthesized image in the Γ 2 space obtained in step S70 with the inter-tone Laplacian obtained in step S6 (FIG. 13) (the following equation (120)).
R ' (Γ2) (x, y) = R w (Γ2 → Γ2) (x, y) + k * △ R (Γ2) (x, y)
G ' (Γ2) (x, y) = G w (Γ2 → Γ2) (x, y) + k * ΔG (Γ2) (x, y) (120)
B ' (Γ2) (x, y) = B w (Γ2 → Γ2) (x, y) + k * △ B (Γ2) (x, y)
However, the value of the constant multiple k usually takes a value of 1 to 0.5.

以上説明した第四の実施形態によれば、次の作用効果が得られる。
(1)画像処理装置は、RGB色成分からなる画像データであって欠落する色成分が存在する画像データに対して、線形階調の画像信号を曲率が異なる3つの階調特性Γ1、Γ2、Γの画像処理空間の画像信号に変換する(S2)CPUと、階調変換された各々の画像信号の欠落色成分を補間して、3通りの Bayer 補間画像を生成する(S4)CPUと、3通りの補間画像を基準の階調特性Γ2の画像処理空間の画像に変換して階調特性を合わせる(S5)CPUと、3つの階調特性Γ1、Γ2、Γで補間され基準の階調特性Γ2に階調整合された3通りの Bayer 補間画像を用いて、3つの画像の同一の画素間で、階調特性Γ2の補間画像の画素値と階調特性Γの補間画像の画素値との間の差分値、および階調特性Γ2の補間画像の画素値と階調特性Γの補間画像の画素値との間の差分値をそれぞれ抽出する(S6)CPUと、階調特性Γ2の補間画像に対して、3つの補間画像を加重合成しながら差分値を同一の画素に加算する(S70、S80)CPUと、加算後の画像信号を出力色空間の画像信号に変換する(S9)CPUと、を備えるようにした。これにより、全階調領域で平均的に優れたコントラスト解像を行うことができる従来の画像予測空間の性能を最大限に保ちつつ、更に高コントラストな補間画像を提供できる高精細な補間を行うことができる。
According to the fourth embodiment described above, the following operational effects can be obtained.
(1) The image processing apparatus converts linear tone image signals into three tone characteristics Γ 1 , Γ having different curvatures from image data consisting of RGB color components and having missing color components. 2 and Γ 3 are converted into image signals in the image processing space (S2), and the missing color components of each of the tone-converted image signals are interpolated to generate three Bayer interpolation images (S4). The CPU and the three kinds of interpolated images are converted into an image in the image processing space having the reference gradation characteristic Γ 2 to match the gradation characteristics (S5). The CPU and the three gradation characteristics Γ 1 , Γ 2 , Γ 3 Using the three types of Bayer interpolation images interpolated in the above and tone-matched to the reference tone characteristics Γ 2 , the pixel values and gradations of the interpolated image of the gradation characteristics Γ 2 are calculated between the same pixels of the three images. difference values, and the pixel value and the gradation of tone characteristic gamma 2 interpolation image between the pixel value of the characteristic gamma 1 interpolation image Equalize the difference value between the pixel value of sexual gamma 3 interpolation image extracting respectively (S6) CPU, relative to the tone characteristics gamma 2 of interpolated images, the difference value with a weighted combining three interpolated images CPU (S70, S80) for adding the image signal to the pixel, and a CPU for converting the image signal after the addition into an image signal in the output color space (S9). This enables high-definition interpolation that can provide a higher-contrast interpolated image while maximizing the performance of the conventional image prediction space that can perform excellent contrast resolution on average in all gradation regions. be able to.

(2)上記(1)の画像処理装置において、階調変換する(S2)CPUは、線形階調特性Γ1、平方根階調特性Γ、および対数階調特性Γを、それぞれ用いるようにしたので、線形階調のガンマ空間Γ2では抽出できなかった平方根階調のガンマ空間Γ1や対数階調のガンマ空間Γで予測されたコントラストを最大限に反映させることができる。 (2) In the image processing apparatus of (1), gradation conversion is performed. (S2) The CPU uses the linear gradation characteristic Γ 1 , the square root gradation characteristic Γ 2 , and the logarithmic gradation characteristic Γ 3 , respectively. Therefore, the contrast predicted in the gamma space Γ 1 having the square root gradation and the gamma space Γ 3 having the logarithmic gradation that cannot be extracted in the linear gradation gamma space Γ 2 can be reflected to the maximum extent.

(3)上記(1)または(2)の画像処理装置において、色成分を補間して3通りの Bayer 補間画像を生成する(S4)CPUは、欠落する色成分の補間値を、欠落する色成分の色情報のみならず他の色成分の色情報も用いて算出するので、適切に色成分を補間できる。 (3) In the image processing apparatus according to (1) or (2), the color components are interpolated to generate three Bayer interpolation images. (S4) The CPU uses the missing color component interpolation values as missing colors. Since the calculation is performed using not only the color information of the components but also the color information of other color components, the color components can be appropriately interpolated.

(4)画像処理装置は、RGB色成分からなる画像データであって欠落する色成分が存在する画像データに対して、線形階調の画像信号を曲率が異なる3つの階調特性Γ1、Γ2、Γの画像処理空間の画像信号に変換する(S2)CPUと、階調変換された各々の画像信号の欠落色成分を補間して、3通りのBayer 補間画像を生成する(S4)CPUと、3通りの補間画像を基準の階調特性Γ2の画像処理空間の画像に変換して階調特性を合わせる(S5)CPUと、3つの階調特性Γ1、Γ2、Γで補間され基準の階調特性Γ2に階調整合された3通りのBayer 補間画像を用いて、3つの画像の同一の画素間で、階調特性Γ2の補間画像の画素値に対する階調特性Γの補間画像の画素値と階調特性Γの補間画像の画素値との間のラプラシアン成分を抽出する(S6)CPUと、階調特性Γ2の補間画像に対して、3つの補間画像を加重合成しながら、ラプラシアン成分を同一の画素に加算する(S70、S80)CPUと、を備えるようにした。これにより、全階調領域で平均的に優れたコントラスト解像を行うことができる従来の画像予測空間の性能を最大限に保ちつつ、更に高コントラストな補間画像を提供できる高精細な補間を行うことができる。 (4) The image processing apparatus converts the linear gradation image signal into three gradation characteristics Γ 1 and Γ having different curvatures with respect to image data including RGB color components and having missing color components. 2 and Γ 3 are converted into image signals in the image processing space (S2), and the missing color components of each of the tone-converted image signals are interpolated to generate three Bayer interpolated images (S4). The CPU and the three kinds of interpolated images are converted into an image in the image processing space having the reference gradation characteristic Γ 2 to match the gradation characteristics (S5). The CPU and the three gradation characteristics Γ 1 , Γ 2 , Γ 3 Using the three types of Bayer interpolation images interpolated in the above and matched in tone to the reference tone characteristic Γ 2 , the tone for the pixel value of the interpolated image of the tone characteristic Γ 2 is obtained between the same pixels of the three images. Laplacian between the pixel value of the characteristic gamma 1 of the interpolated image and the pixel value of the interpolated image tone characteristic gamma 3 Extracting a partial and (S6) CPU, relative to the tone characteristics gamma 2 interpolation image, while the weighted synthesized three interpolation image, adds the Laplacian components in the same pixel and (S70, S80) CPU, a I prepared. This enables high-definition interpolation that can provide a higher-contrast interpolated image while maximizing the performance of the conventional image prediction space that can perform excellent contrast resolution on average in all gradation regions. be able to.

(5)上記(4)の画像処理装置において、階調変換する(S2)CPUは、線形階調特性Γ1、平方根階調特性Γ、および対数階調特性Γを、それぞれ用いるようにしたので、線形階調のガンマ空間Γ2では抽出できなかった平方根階調のガンマ空間Γ1や対数階調のガンマ空間Γで予測されたコントラストを最大限に反映させることができる。 (5) In the image processing apparatus of (4), gradation conversion is performed (S2) so that the CPU uses the linear gradation characteristic Γ 1 , the square root gradation characteristic Γ 2 , and the logarithmic gradation characteristic Γ 3 , respectively. Therefore, the contrast predicted in the gamma space Γ 1 having the square root gradation and the gamma space Γ 3 having the logarithmic gradation that cannot be extracted in the linear gradation gamma space Γ 2 can be reflected to the maximum extent.

(6)上記(4)または(5)の画像処理装置において、色成分を補間して3通りの Bayer 補間画像を生成する(S4)CPUは、欠落する色成分の補間値を、欠落する色成分の色情報のみならず他の色成分の色情報も用いて算出するので、適切に色成分を補間できる。 (6) In the image processing apparatus according to (4) or (5), the color component is interpolated to generate three Bayer interpolation images. (S4) The CPU uses the missing color component interpolation value as the missing color. Since the calculation is performed using not only the color information of the components but also the color information of other color components, the color components can be appropriately interpolated.

(変形例3)
対数階調変換されたBayer面に対しては、突出点除去フィルタを掛けるとよい。対数階調である補間用ガンマ空間は、非常に暗部を高コントラストに増幅するので、暗電流で生じた突出点を増幅してしまう恐れがある。この場合は、結果的に、長秒露光撮影したときに発生する黒傷・白傷のようなものが出現することがある。上記突出点除去フィルタは、このような事態への対処に有効である。
(Modification 3)
A protrusion removal filter may be applied to the Bayer plane subjected to logarithmic gradation conversion. Since the interpolation gamma space having a logarithmic gradation amplifies a dark portion with high contrast, there is a possibility of amplifying a protruding point caused by a dark current. In this case, as a result, there are cases where black scratches or white scratches that occur during long-second exposure photography appear. The protruding point removal filter is effective in dealing with such a situation.

突出点除去フィルタは、本出願人と同一発明者による特開2011−135566号公報の第1実施形態に開示されるものや、これをさらに高性能化した特願2012−281167号に記載されるものを用いるとよい。具体的には、上述した実施形態において、「ステップS2」のBayer画像の階調変換(3通り)と「ステップS4」のBayer補間(3通り)との間において、対数階調のBayer面に対して突出点除去フィルタ掛ける。   The protruding point removal filter is disclosed in the first embodiment of Japanese Patent Application Laid-Open No. 2011-135666 by the same inventor as that of the present applicant, or described in Japanese Patent Application No. 2012-281167 in which this is further enhanced. Use a good one. Specifically, in the above-described embodiment, a logarithmic gradation Bayer plane is formed between the gradation conversion (three ways) of the Bayer image in “Step S2” and the Bayer interpolation (three ways) in “Step S4”. Apply the protruding point removal filter.

なお、上述した原理は例示したBayer 配列のみならず、その他の原色系配列においても、補色系配列においても成立する。   The above-described principle is valid not only in the illustrated Bayer array, but also in other primary color system arrays and complementary color system arrays.

以上の説明はあくまで一例であり、上記の実施形態の構成に何ら限定されるものではない。上記実施形態および変形例は、適宜組み合わせてもよい。   The above description is merely an example, and is not limited to the configuration of the above embodiment. You may combine the said embodiment and modified example suitably.

100…パーソナルコンピュータ
200…カメラ
201…操作部材
202…撮像素子
203…制御装置
205…モニタ
DESCRIPTION OF SYMBOLS 100 ... Personal computer 200 ... Camera 201 ... Operation member 202 ... Imaging element 203 ... Control apparatus 205 ... Monitor

Claims (9)

少なくとも2つの色成分からなり、欠落する色成分が存在する画像データに対して、入力色空間の画像信号を画像処理空間における画像信号に変換し、前記画像処理空間において欠落する色成分の補間処理を行い、補間処理後の画像信号を出力色空間の画像信号に変換する画像処理装置において、
少なくとも第1と第2の曲率が異なる2つの階調特性の画像信号に変換する階調変換部と、
前記階調変換された各々の画像信号の欠落色成分を補間して、少なくとも2通りの補間画像を生成する色補間部と、
前記少なくとも2通りの補間画像を1つの階調特性の画像処理空間の画像に変換して階調特性を合わせる階調整合部と、
前記第1と第2の階調特性で補間され1つの階調特性に階調整合された第1と第2の補間画像を用いて、2つの画像の同一の画素間で、少なくとも第2の補間画像の画素値と第1の補間画像の画素値との間の差分値を抽出する差分値抽出部と、
前記第2の補間画像に対して、前記差分値を同一の画素に加算する加算部と、
を備えることを特徴とする画像処理装置。
For image data consisting of at least two color components and having missing color components, an image signal in the input color space is converted into an image signal in the image processing space, and interpolation processing of the missing color components in the image processing space is performed In the image processing apparatus that converts the image signal after the interpolation processing into an image signal in the output color space,
A gradation conversion unit that converts the image signal into two gradation characteristics having different first and second curvatures;
A color interpolation unit that interpolates missing color components of each of the tone-converted image signals to generate at least two types of interpolation images;
A gradation matching unit that converts the at least two kinds of interpolated images into an image in an image processing space having one gradation characteristic and matches the gradation characteristic;
Using the first and second interpolated images interpolated with the first and second gradation characteristics and gradation-matched with one gradation characteristic, at least a second value is obtained between the same pixels of the two images. A difference value extraction unit that extracts a difference value between the pixel value of the interpolation image and the pixel value of the first interpolation image;
An adding unit that adds the difference value to the same pixel with respect to the second interpolation image;
An image processing apparatus comprising:
請求項1に記載の画像処理装置において、
前記階調変換部は、
第1の階調特性として線形階調特性、または、立方根階調特性、ないしは対数階調特性を、
第2の階調特性として平方根階調特性、ないしは平方根の中に正のオフセットを付けた階調特性を、
それぞれ用いることを特徴とする画像処理装置。
The image processing apparatus according to claim 1.
The gradation converter
As the first gradation characteristic, a linear gradation characteristic, a cubic root gradation characteristic, or a logarithmic gradation characteristic,
The second gradation characteristic is a square root gradation characteristic or a gradation characteristic with a positive offset in the square root.
An image processing apparatus using each of them.
請求項1または2に記載の画像処理装置において、
前記色補間部は、欠落する色成分の補間値を、欠落する色成分の色情報のみならず他の色成分の色情報も用いて算出することを特徴とする画像処理装置。
The image processing apparatus according to claim 1 or 2,
The color interpolation unit calculates an interpolation value of a missing color component using not only the color information of the missing color component but also the color information of another color component.
少なくとも2つの色成分からなり、欠落する色成分の存在する画像データに対して、入力色空間の画像信号を画像処理空間における画像信号に変換し、前記画像処理空間において欠落する色成分の補間処理を行い、補間処理後の画像信号を出力色空間の画像信号に変換する画像処理装置において、
第1、第2、第3の順に曲率が異なる3つの階調特性の画像信号に変換する階調変換部と、
前記階調変換された各々の画像信号の欠落色成分を補間して、3通りの補間画像を生成する色補間部と、
前記3通りの補間画像を1つの階調特性の画像処理空間の画像に変換して階調特性を合わせる階調整合部と、
前記第1〜第3の階調特性で補間され1つの階調特性に階調整合された第1〜第3の補間画像を用いて、3つの画像の同一の画素間で、第2の補間画像の画素値に対する第1の補間画像の画素値と第3の補間画像の画素値との間のラプラシアン成分を抽出するラプラシアン抽出部と、
前記第2の補間画像に対して、前記ラプラシアン成分を同一の画素に加算する加算部と、
を備えることを特徴とする画像処理装置。
Interpolation processing of the missing color component in the image processing space by converting an image signal in the input color space into an image signal in the image processing space for image data including at least two color components and having the missing color component In the image processing apparatus that converts the image signal after the interpolation processing into an image signal in the output color space,
A gradation conversion unit that converts the image signal into three gradation characteristics having different curvatures in the order of the first, second, and third;
A color interpolation unit that interpolates missing color components of each of the tone-converted image signals to generate three types of interpolated images;
A gradation matching unit that converts the three types of interpolation images into an image in an image processing space having a single gradation characteristic to match the gradation characteristic;
Using the first to third interpolation images interpolated with the first to third gradation characteristics and gradation-matched to one gradation characteristic, the second interpolation is performed between the same pixels of the three images. A Laplacian extraction unit that extracts a Laplacian component between the pixel value of the first interpolation image and the pixel value of the third interpolation image with respect to the pixel value of the image;
An adder that adds the Laplacian component to the same pixel for the second interpolated image;
An image processing apparatus comprising:
請求項4に記載の画像処理装置において、
前記階調変換部は、
第1の階調特性として線形階調特性を、
第2の階調特性として平方根階調特性、ないしは平方根の中に正のオフセットを付けた階調特性を、
第3の階調特性として立方根階調特性、ないしは対数階調特性を、
それぞれ用いることを特徴とする画像処理装置。
The image processing apparatus according to claim 4.
The gradation converter
Linear gradation characteristics as the first gradation characteristics,
The second gradation characteristic is a square root gradation characteristic or a gradation characteristic with a positive offset in the square root.
As the third gradation characteristic, a cubic root gradation characteristic or a logarithmic gradation characteristic,
An image processing apparatus using each of them.
請求項4または5に記載の画像処理装置において、
前記色補間部は、欠落する色成分の補間値を、欠落する色成分の色情報のみならず他の色成分の色情報も用いて算出することを特徴とする画像処理装置。
The image processing apparatus according to claim 4 or 5,
The color interpolation unit calculates an interpolation value of a missing color component using not only the color information of the missing color component but also the color information of another color component.
少なくとも2つの色成分からからなる画像データであって、欠落する色成分が存在する画像データに対して、入力色空間の画像信号を少なくとも第1と第2の曲率が異なる2つの階調特性の画像処理空間の画像信号に階調変換する変換処理と、
前記階調変換された各々の画像信号の欠落色成分を補間して、少なくとも2通りの補間画像を生成する生成処理と、
前記少なくとも2通りの補間画像を1つの階調特性の画像処理空間の画像に変換して階調特性を合わせる階調整合処理と、
前記異なる階調特性で補間され前記1つの階調特性に階調整合された前記2通りの補間画像を用いて、2つの画像の同一の画素間で、少なくとも第2の補間画像の画素値と第1の補間画像の画素値との間の差分値を算出する算出処理と、
前記第2の補間画像に対して、前記差分値を同一の画素に加算する加算処理と、
をコンピュータに実行させることを特徴とする画像処理プログラム。
For image data composed of at least two color components and having missing color components, an image signal in the input color space has at least two gradation characteristics having different first and second curvatures. Conversion processing for gradation conversion to an image signal in the image processing space;
Interpolating the missing color component of each of the image signals subjected to the gradation conversion to generate at least two types of interpolated images; and
A gradation matching process for converting the at least two kinds of interpolation images into an image in an image processing space having one gradation characteristic to match the gradation characteristic;
Using the two types of interpolated images interpolated with the different gradation characteristics and gradation-matched with the one gradation characteristic, at least the pixel value of the second interpolation image between the same pixels of the two images A calculation process for calculating a difference value between pixel values of the first interpolation image;
An addition process for adding the difference value to the same pixel with respect to the second interpolation image;
An image processing program for causing a computer to execute.
少なくとも2つの色成分からからなる画像データであって、欠落する色成分が存在する画像データに対して、入力色空間の画像信号を少なくとも第1、第2、第3の順に曲率が異なる3つの階調特性の画像処理空間の画像信号に階調変換する変換処理と、
前記階調変換された各々の画像信号の欠落色成分を補間して、3通りの補間画像を生成する生成処理と、
前記3通りの補間画像を1つの階調特性の画像処理空間の画像に変換して階調特性を合わせる階調整合処理と、
前記第1〜第3の階調特性で補間され前記1つの階調特性に階調整合された前記第1〜第3の補間画像を用いて、3つの画像の同一の画素間で、第2の補間画像の画素値に対する第1の補間画像の画素値と第3の補間画像の画素値との間のラプラシアン成分を算出する算出処理と、
前記第2の補間画像に対して、前記ラプラシアン成分を同一の画素に加算する加算処理と、
をコンピュータに実行させることを特徴とする画像処理プログラム。
The image data is composed of at least two color components, and the image data of the input color space is different from the image data in which the missing color component exists in three different curvatures in the order of at least the first, second, and third. A conversion process that performs gradation conversion into an image signal in an image processing space of gradation characteristics;
Generation processing for interpolating the missing color component of each image signal subjected to the gradation conversion to generate three types of interpolation images;
A gradation matching process for converting the three kinds of interpolated images into an image in an image processing space having one gradation characteristic to match the gradation characteristic;
Using the first to third interpolated images interpolated with the first to third gradation characteristics and gradation-matched to the one gradation characteristic, the second pixel is extracted between the same pixels of the three images. A calculation process for calculating a Laplacian component between the pixel value of the first interpolation image and the pixel value of the third interpolation image with respect to the pixel value of the interpolation image;
An addition process for adding the Laplacian component to the same pixel for the second interpolation image;
An image processing program for causing a computer to execute.
被写体像を撮像する撮像部と、
前記撮像部で撮像された画像に対して画像処理を行う請求項1〜6のいずれか一項に記載の画像処理装置と、
を備えることを特徴とする撮像装置。
An imaging unit that captures a subject image;
The image processing apparatus according to any one of claims 1 to 6, wherein image processing is performed on an image captured by the imaging unit;
An imaging apparatus comprising:
JP2012287814A 2012-01-13 2012-12-28 Image processor, image processing program and imaging apparatus Pending JP2013165482A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012287814A JP2013165482A (en) 2012-01-13 2012-12-28 Image processor, image processing program and imaging apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2012005156 2012-01-13
JP2012005156 2012-01-13
JP2012287814A JP2013165482A (en) 2012-01-13 2012-12-28 Image processor, image processing program and imaging apparatus

Publications (1)

Publication Number Publication Date
JP2013165482A true JP2013165482A (en) 2013-08-22

Family

ID=49176565

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012287814A Pending JP2013165482A (en) 2012-01-13 2012-12-28 Image processor, image processing program and imaging apparatus

Country Status (1)

Country Link
JP (1) JP2013165482A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015154307A (en) * 2014-02-17 2015-08-24 ソニー株式会社 Image processing system, image processing method, and program
US9838665B2 (en) 2012-04-25 2017-12-05 Nikon Corporation Image processing device, imaging device, and image processing program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9838665B2 (en) 2012-04-25 2017-12-05 Nikon Corporation Image processing device, imaging device, and image processing program
JP2015154307A (en) * 2014-02-17 2015-08-24 ソニー株式会社 Image processing system, image processing method, and program

Similar Documents

Publication Publication Date Title
US7082218B2 (en) Color correction of images
JP4910699B2 (en) Image processing device
JP5047048B2 (en) Image processing apparatus, imaging apparatus, control method, program, and storage medium
JP5574615B2 (en) Image processing apparatus, control method thereof, and program
US20110268357A1 (en) Image processing apparatus, image processing method, and program
WO2006064913A1 (en) Image processing method
US20120106841A1 (en) System and method for providing multi resolution purple fringing detection and correction
TW200838285A (en) Image processing apparatus, image capturing apparatus, image processing method in these apparatuses, and program allowing computer to execute the method
US8427560B2 (en) Image processing device
JP4986820B2 (en) Image processing apparatus and image processing method
JP4945942B2 (en) Image processing device
US8026954B2 (en) System and computer-readable medium for automatic white balancing
JP5372586B2 (en) Image processing device
JP2013165482A (en) Image processor, image processing program and imaging apparatus
JP5454156B2 (en) Image processing apparatus, imaging apparatus, and image processing program
US9071803B2 (en) Image processing apparatus, image pickup apparatus, image processing method and non-transitory computer-readable storage medium storing image processing program
JP4797478B2 (en) Image processing device
JP5274697B2 (en) Image processing apparatus and image processing method
JP4239483B2 (en) Image processing method, image processing program, and image processing apparatus
JP5178421B2 (en) Image processing apparatus, image processing method, and imaging apparatus
JP2014131175A (en) Image processing apparatus
JP4196055B2 (en) Image processing method, image processing program, and image processing apparatus
JP5494249B2 (en) Image processing apparatus, imaging apparatus, and image processing program
JP4239480B2 (en) Image processing method, image processing program, and image processing apparatus
JP2012100215A (en) Image processing device, imaging device, and image processing program