JP5032914B2 - Image processing apparatus, image processing program, and image processing method - Google Patents

Image processing apparatus, image processing program, and image processing method Download PDF

Info

Publication number
JP5032914B2
JP5032914B2 JP2007209033A JP2007209033A JP5032914B2 JP 5032914 B2 JP5032914 B2 JP 5032914B2 JP 2007209033 A JP2007209033 A JP 2007209033A JP 2007209033 A JP2007209033 A JP 2007209033A JP 5032914 B2 JP5032914 B2 JP 5032914B2
Authority
JP
Japan
Prior art keywords
color difference
color
pixel
signal
interpolation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2007209033A
Other languages
Japanese (ja)
Other versions
JP2009044594A5 (en
JP2009044594A (en
Inventor
佐々木  寛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Olympus Corp
Original Assignee
Olympus Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Olympus Corp filed Critical Olympus Corp
Priority to JP2007209033A priority Critical patent/JP5032914B2/en
Priority to PCT/JP2008/063686 priority patent/WO2009022541A1/en
Publication of JP2009044594A publication Critical patent/JP2009044594A/en
Publication of JP2009044594A5 publication Critical patent/JP2009044594A5/ja
Application granted granted Critical
Publication of JP5032914B2 publication Critical patent/JP5032914B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4007Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4015Image demosaicing, e.g. colour filter arrays [CFA] or Bayer patterns
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/843Demosaicing, e.g. interpolating colour pixel values

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Color Television Image Signal Generators (AREA)

Description

本発明は、RGBベイヤ配列画像を処理する画像処理装置、画像処理プログラム、画像処理方法に関する。   The present invention relates to an image processing apparatus, an image processing program, and an image processing method for processing an RGB Bayer array image.

光学像を撮像して電気的なカラー画像を取得する撮像装置は、1つの画素位置において3つの色(例えば、RGB3原色)信号を得ることができる3板撮像素子構成のものと、1つの画素位置毎に3つの色信号の内の1つの色信号しか得ることができない単板撮像素子構成のものと、に大別される。   An image pickup apparatus that picks up an optical image and obtains an electrical color image has a configuration of a three-plate image pickup device capable of obtaining signals of three colors (for example, RGB three primary colors) at one pixel position, and one pixel. It is roughly divided into those having a single-plate image pickup device configuration that can obtain only one of the three color signals for each position.

現在市販されているデジタルカメラは、単板撮像素子構成のものが一般的である。一方、現在市販されているデジタルビデオカメラについては、3板撮像素子構成のものと、単板撮像素子構成のものと、が混在した状態にある。   Digital cameras that are currently on the market generally have a single-plate image sensor configuration. On the other hand, digital video cameras currently on the market are in a state where a three-plate image sensor configuration and a single-plate image sensor configuration are mixed.

撮像装置を3板撮像素子構成にすると、撮像時点で撮像画像の各画素位置において3つの色信号を得ることができるために、一般的に高画質であるが、構造が複雑となって部品点数も多くなるために高価格となる。   When the imaging device has a three-plate imaging device configuration, three color signals can be obtained at each pixel position of the captured image at the time of imaging. The price increases because of the increase.

一方、撮像装置を単板撮像素子構成にすると、3板撮像素子構成に比して構造が簡単となる利点があるが、3種類の色信号を得るためには画素毎にR,G,Bフィルタをモザイク状(本発明の図5に示すようなベイヤ配列参照)に配置する必要があり、撮像画像の各画素位置において単一色の信号だけしか得ることができない。そこで、このようなベイヤ配列の単板撮像素子構成の撮像素子では、各画素位置において欠落している色信号を周辺の画素位置の色信号を用いて補間することにより、画素当り3つの色信号を得るようにしている。   On the other hand, when the image pickup apparatus has a single-plate image pickup device configuration, there is an advantage that the structure is simple as compared with the three-plate image pickup device configuration. However, in order to obtain three types of color signals, R, G, B for each pixel It is necessary to arrange the filters in a mosaic pattern (see the Bayer array as shown in FIG. 5 of the present invention), and only a single color signal can be obtained at each pixel position of the captured image. Therefore, in an image sensor having such a Bayer array single-plate image sensor configuration, three color signals per pixel are obtained by interpolating the missing color signals at each pixel position using the color signals at the surrounding pixel positions. Like to get.

ところで、上述したようなベイヤ配列は、2×2画素を画素配列の基本単位として、この2×2画素中の一方の対角方向にGフィルタを2画素分、他方の対角方向にRフィルタとBフィルタとを1画素ずつ、ぞれぞれ配置したものとなっている。従って、G画素のサンプリング密度は、R画素のサンプリング密度およびB画素のサンプリング密度の2倍の密度である。このような、色信号によってサンプリング密度の異なる撮像素子を用いて撮像を行うと、エッジなどの高い空間周波数をもった撮像領域においては、G信号で表現可能な高い空間周波数が、R信号とB信号とでは低周波数側に折り返してしまうことになる。従って、それぞれの色信号毎に補間処理を行うと、エッジ部およびその近傍等において、偽色(本来は存在しない色)が発生する場合があることが知られている。   By the way, the Bayer array as described above has 2 × 2 pixels as a basic unit of the pixel array, and two G filters in one diagonal direction in the 2 × 2 pixels and an R filter in the other diagonal direction. And B filters are arranged one pixel at a time. Therefore, the sampling density of the G pixel is twice the sampling density of the R pixel and the sampling density of the B pixel. When imaging is performed using imaging elements having different sampling densities depending on color signals, in an imaging region having a high spatial frequency such as an edge, a high spatial frequency that can be expressed by a G signal is R signal and B The signal is folded back to the low frequency side. Therefore, it is known that when interpolation processing is performed for each color signal, false colors (colors that do not exist originally) may occur in the edge portion and the vicinity thereof.

こうした偽色を低減する最も簡単な手段は、ベイヤ配列のR信号またはB信号のサンプリング間隔を再現することができる空間周波数まで、レンズまたは光学ローパスフィルタの特性を落として、該空間周波数の光学像を撮像素子上に結像させることである。ただし、この手段を採用すると、再現可能な空間周波数の半分の空間周波数の撮像画像しか得ることができず、解像度の低いボケた画像となってしまうことになる。そこで、撮像素子上に結像させる光学像の解像度が、G信号のサンプリング間隔において折り返し歪みによるモワレが発生しない空間周波数特性となるように、光学系を設計するのが一般的である。   The simplest means for reducing such false colors is to reduce the characteristics of the lens or the optical low-pass filter to a spatial frequency that can reproduce the sampling interval of the R signal or the B signal of the Bayer array, and the optical image of the spatial frequency. Is imaged on the image sensor. However, if this means is employed, only a captured image having a spatial frequency that is half the reproducible spatial frequency can be obtained, resulting in a blurred image with low resolution. Therefore, the optical system is generally designed so that the resolution of the optical image formed on the image sensor has a spatial frequency characteristic that does not cause moire due to aliasing distortion at the G signal sampling interval.

このように設計された光学系を用いて、かつ偽色低減を行う技術は、従来より種々のものが提案されている。   Various techniques for reducing false colors using the optical system designed in this way have been proposed.

例えば特開平8−237672号公報には、3つの色(RとGとB)信号の補間位置を、水平方向および垂直方向ともに画素同士の中間の位置とする補間処理を施す技術が記載されている。この技術は、上記位置への補間処理を行うと、ナイキスト周波数の半分の周波数でR,G,Bの各周波数特性を近似させることができることに着目したものである。該公報に記載の技術は、このようにして偽色低減を図っているものの、ナイキスト周波数に近い周波数成分を含んだエッジ領域での偽色抑圧は十分とはいえなかった。さらに、該公報に記載の技術は、水平、垂直ともに半画素位置に画素を補間するものとなっており、高周波成分の減衰が生じるのは避けられないが、この補間フィルタの周波数特性はナイキスト周波数の半分の周波数でR,G,Bの各周波数特性を近似させることを要求するために、その周波数帯域をナイキスト周波数ギリギリまで持たせることができず、解像度が低下してしまっていた。   For example, Japanese Patent Application Laid-Open No. 8-237672 describes a technique for performing an interpolation process in which interpolation positions of three color (R, G, and B) signals are set to intermediate positions between pixels in both the horizontal direction and the vertical direction. Yes. This technique pays attention to the fact that R, G, and B frequency characteristics can be approximated at half the Nyquist frequency when interpolation processing is performed on the position. Although the technique described in this publication reduces false color in this way, false color suppression in an edge region including a frequency component close to the Nyquist frequency has not been sufficient. Furthermore, the technique described in the publication interpolates pixels at half-pixel positions both horizontally and vertically, and it is inevitable that high-frequency components are attenuated. However, the frequency characteristic of this interpolation filter is the Nyquist frequency. In order to request that the frequency characteristics of R, G, and B be approximated at half the frequency, the frequency band cannot be provided to the limit of the Nyquist frequency, and the resolution has been lowered.

また、上述した特開平8−237672号公報のような各色信号の補間処理を画像内で均一の特性のフィルタで実現するのとは異なる、他の偽色低減の技術としては、画像の局所領域のG信号類似度、G信号とR信号の色信号間類似度、G信号とB信号の色信号間類似度、の内の少なくとも1つの方向依存に適応して、補間フィルタを切り替える方法が提案されている。   Further, as another technique for reducing false colors, which is different from the method of implementing interpolation processing of each color signal as described above in JP-A-8-237672 with a filter having uniform characteristics in an image, there is a local region of an image. Proposed a method of switching the interpolation filter to adapt to at least one direction dependency among the G signal similarity of G, the similarity between color signals of G signal and R signal, and the similarity between color signals of G signal and B signal Has been.

例えば特開平7−59098号公報には、欠落しているG信号の画素位置に対して、該画素位置の周辺の4つのG信号間の水平方向の類似度および垂直方向の類似度(本発明に係る図19〜図21を参照して説明すると、垂直類似度=|G1−G2|、および水平類似度=|G3−G4|)を算出して、算出した類似度と予め決定された閾値とを比較することにより、本発明に係る図19〜図21に示すようなG信号を用いた3つの線形補間方法により得られるG画素補間候補{(G1+G2)/2、(G3+G4)/2、(G1+G2+G3+G4)/4}の中から、1つのG画素補間候補を欠落しているG信号の補間値として選択するものとなっている。   For example, Japanese Patent Laid-Open No. 7-59098 discloses a horizontal similarity and a vertical similarity between four G signals around a pixel position of the missing G signal (the present invention). 19 to FIG. 21 according to FIG. 19, vertical similarity = | G1−G2 | and horizontal similarity = | G3−G4 |) are calculated, and the calculated similarity and a predetermined threshold value are calculated. And G pixel interpolation candidates {(G1 + G2) / 2, (G3 + G4) / 2, which are obtained by three linear interpolation methods using G signals as shown in FIGS. 19 to 21 according to the present invention, One G pixel interpolation candidate is selected from (G1 + G2 + G3 + G4) / 4} as an interpolation value of the missing G signal.

ただし、この技術においては、画素間隔の2倍のG信号間の類似度を使用しているために、水平方向または垂直方向にナイキスト周波数の1/2よりも高い周波数でG画素値が変化すると、補間方法の選択判定エラーを起こす可能性が高くなり、判定エラーによる偽色の発生が問題となる場合がある。   However, in this technique, since the similarity between G signals that is twice the pixel interval is used, if the G pixel value changes at a frequency higher than ½ of the Nyquist frequency in the horizontal direction or the vertical direction. There is a high possibility that an interpolation method selection determination error will occur, and the generation of a false color due to the determination error may be a problem.

また、特開平11−275373号公報に記載されている技術は、補間G信号を作成する画素位置のR信号またはB信号と、周辺の4つのG信号(本発明に係る図21に示すようなG1、G2、G3、G4)と、の類似度{垂直類似度=|X−G1|+|X−G2|、水平類似度=|X−G3|+|X−G4|、(ここに、Xは、R信号またはB信号である)}に応じて、垂直補間と、水平補間と、これら2つの補間を重み付け平均した補間と、の中から1つを選択するものとなっている。この技術を用いると、無彩色のエッジ領域の偽色を効果的に低減することができる利点がある一方で、彩度が高い領域では彩度が低下する場合があるという問題が発生する。   Further, the technique described in Japanese Patent Application Laid-Open No. 11-275373 discloses an R signal or a B signal at a pixel position for generating an interpolated G signal, and four peripheral G signals (as shown in FIG. 21 according to the present invention). G1, G2, G3, G4) and the similarity {vertical similarity = | X−G1 | + | X−G2 |, horizontal similarity = | X−G3 | + | X−G4 | X is an R signal or a B signal)}, and one of vertical interpolation, horizontal interpolation, and interpolation obtained by weighted averaging of these two interpolations is selected. When this technique is used, there is an advantage that false colors in the achromatic edge region can be effectively reduced, but there is a problem that the saturation may be lowered in a region with high saturation.

偽色は、無彩色のエッジ領域において、より目立って検知されるものである。無彩色領域は、R信号とG信号とB信号とがほぼ同じ値をとる領域であり、G信号に対するR信号の比、およびG信号に対するB信号の比が、ほぼ1となる領域を意味している。偽色は、これらR信号とG信号とB信号との比が、補間処理を行った結果、本来とるべき比である1と異なってしまう、つまり該比が1から離れてしまうことにより発生するものである。   The false color is detected more conspicuously in the achromatic edge region. The achromatic region is a region in which the R signal, the G signal, and the B signal have substantially the same value, and means a region in which the ratio of the R signal to the G signal and the ratio of the B signal to the G signal are approximately 1. ing. The false color is generated when the ratio of the R signal, the G signal, and the B signal is different from 1, which is the ratio that should be originally obtained, as a result of performing the interpolation process. Is.

上記特開平11−275373号公報に記載された技術は、G信号に対するR信号の比、またはG信号に対するB信号の比を、1に近付ける補間を、複数用意された補間候補の中から選択する技術であるといえるために、無彩色領域での偽色の発生は必然的に抑制される。   The technique described in the above-mentioned Japanese Patent Application Laid-Open No. 11-275373 selects an interpolation from among a plurality of interpolation candidates that makes an R signal to G signal ratio or a B signal to G signal ratio close to 1. Since this is a technology, the occurrence of false colors in the achromatic region is inevitably suppressed.

しかしこの技術を用いると、G信号に対するR信号の比、またはG信号に対するB信号の比が元来1とは異なる有彩色領域についても、無彩色領域と同様に、G信号に対するR信号の比、またはG信号に対するB信号の比を、1に近付ける補間が選択されてしまうために、有彩色領域では本来再現されるべき彩度が低下してしまうという課題がある。   However, when this technique is used, the ratio of the R signal to the G signal in the chromatic color region in which the ratio of the R signal to the G signal or the ratio of the B signal to the G signal is originally different from 1 is similar to the achromatic color region. In other words, since the interpolation that brings the ratio of the B signal to the G signal close to 1 is selected, there is a problem that the saturation that should be originally reproduced is reduced in the chromatic color region.

この課題について、簡単な例を挙げて説明する。すなわち、ここでは、水平方向の色は同一であって、垂直方向には色が変化するような領域について考えるものとする。   This problem will be described with a simple example. That is, here, an area where the color in the horizontal direction is the same and the color changes in the vertical direction is considered.

ベイヤ配列におけるR信号を含むある1ラインについて、R信号の値が全て200、G信号の値が全て10の一定値をとるものとする。さらに、この着目ラインの上のラインに位置するG信号の値が全て5の一定値をとり、該着目ラインの下のラインに位置するG信号の値が全て45の一定値をとるものとする。なお、着目ラインの上下のラインにおけるB信号については、説明を簡単にするために考慮しない。   Assume that a certain line including an R signal in a Bayer array has a constant value of 200 for all R signals and 10 for all G signals. Further, the values of the G signal positioned on the line above the target line all take a constant value of 5, and the values of the G signal positioned on the line below the target line all take a constant value of 45. . Note that the B signals in the lines above and below the line of interest are not considered in order to simplify the description.

このような具体的な数値例に対して、上記特開平11−275373号公報に記載された技術を適用すると、垂直類似度が|200−5|+|200−45|=350、水平類似度が|200−10|+|200−10|=380となり、垂直類似度の方が水平類似度よりも高いと判定される。従って、本来は水平補間が選択されるべきであるにも関わらず、垂直補間が選択されることになってしまい、着目ラインのR信号位置において得られるG信号補間値は(5+45)/2=25となってしまう。この場合には、この着目ラインの色差R−Gは200−25=175となり、本来再現されるべき色差R−G=200−10=190に対して小さい値となるために、彩度が低下してしまうことになる。
特開平8−237672号公報 特開平7−59098号公報 特開平11−275373号公報
When the technique described in Japanese Patent Laid-Open No. 11-275373 is applied to such a specific numerical example, the vertical similarity is | 200-5 | + | 200-45 | = 350, and the horizontal similarity is Becomes | 200−10 | + | 200−10 | = 380, and it is determined that the vertical similarity is higher than the horizontal similarity. Therefore, although the vertical interpolation should be selected originally, the vertical interpolation is selected, and the G signal interpolation value obtained at the R signal position of the line of interest is (5 + 45) / 2 = 25. In this case, the color difference RG of the line of interest is 200-25 = 175, which is a smaller value than the color difference RG = 200-10 = 190 that should be reproduced originally, so that the saturation is lowered. Will end up.
JP-A-8-237672 JP 7-59098 A JP 11-275373 A

上述したような従来の技術では、単板撮像素子により撮像された各画素1色のベイヤ配列画像に対して、欠落色信号を周辺の色信号に基づき補間し、各画素について複数色の色信号を備えるカラー画像を生成する際に、エッジ部分において偽色が発生したり、この偽色を低減しようとして解像度の低下が生じたり、これら偽色や解像度低下を抑制するための画素相関を利用した適応補間方法を適用するときに適応誤りによる画質劣化が生じたりすることがあった。こうして、従来の技術は、偽色の発生、解像度の低下、および彩度の低下を抑制するについては不十分なものであった。   In the conventional technology as described above, a missing color signal is interpolated based on the surrounding color signal for a Bayer array image of one color of each pixel imaged by a single-plate image sensor, and a plurality of color signals are obtained for each pixel. When generating a color image having a false color at the edge portion, a decrease in resolution occurs in an attempt to reduce the false color, or pixel correlation is used to suppress the false color or resolution decrease When applying the adaptive interpolation method, image quality degradation may occur due to an adaptation error. Thus, the prior art has been insufficient for suppressing the generation of false colors, the reduction in resolution, and the reduction in saturation.

本発明は上記事情に鑑みてなされたものであり、RGBベイヤ配列画像に対して欠落色信号を補間する際に、該補間処理に伴って発生する偽色と解像度低下とを十分に抑制しつつ、彩度低下がさらに発生しないようにすることができる画像処理装置、画像処理プログラム、画像処理方法を提供することを目的としている。   The present invention has been made in view of the above circumstances, and when interpolating a missing color signal with respect to an RGB Bayer array image, while sufficiently suppressing false color and resolution reduction that occur in association with the interpolation processing. An object of the present invention is to provide an image processing apparatus, an image processing program, and an image processing method that can prevent further reduction in saturation.

上記の目的を達成するために、第1の発明による画像処理装置は、複数の色信号のうち少なくとも一つの色信号が欠落している画素を含む画像を処理して、複数の色信号のうち少なくとも第1の色信号が補間された画素を含む画像を生成する画像処理装置であって、上記画像における位置を(x,y)(ここに、xは横方向の画素位置を示す整数、yは縦方向の画素位置を示す整数)として表し、上記第1の色信号を有する画素が欠落している位置(x0,y0)の上記第1の色信号とは異なる第2の色信号を有する画素をX(x0,y0)としたときに、このX(x0,y0)に対して、M種類(Mは2以上の整数)の補間態様で補間されたM種類の上記第1の色信号Gt(x0,y0)(ここに、t=1,…,M)を算出する画素補間候補算出手段と、上記X(x0,y0)に対して周辺の同種色信号を用いて帯域制限したXL(x0,y0)を算出する帯域制限手段と、上記画素補間候補算出手段により算出されたM種類の上記第1の色信号Gtに基づいて、色差候補X(x0,y0)−Gt(x0,y0)または色差候補XL(x0,y0)−Gt(x0,y0)でなるM種類の色差候補を算出する色差候補算出手段と、上記色差候補X(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号Gt(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出された上記第1の色信号Gt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補X(x0,y0)−Gt(x0,y0)とに基づいて、または、上記色差候補XL(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号Gt(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出されたGt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXLの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補XL(x0,y0)−Gt(x0,y0)とに基づいて、M種類の色差類似度を算出し、この算出したM種類の色差類似度に基づいて、M種類の上記第1の色信号Gt(x0,y0)の内のp種類の上記第1の色信号Gp(x0,y0)(ここに、1≦p≦M)またはq種類の上記第1の色信号Gq(x0,y0)(ここに、1≦q≦M)に基づき算出された色差候補X(x0,y0)−Gp(x0,y0)または色差候補XL(x0,y0)−Gq(x0,y0)を色差として選択する最適色差選択手段と、 上記X(x0,y0)から上記最適色差選択手段により選択された色差X(x0,y0)−Gp(x0,y0)または色差XL(x0,y0)−Gq(x0,y0)を減算することにより、位置(x0,y0)に対する上記第1の色信号G(x0,y0)を算出する算出手段と、を具備したものである。 In order to achieve the above object, an image processing apparatus according to a first invention processes an image including a pixel in which at least one color signal is missing among a plurality of color signals, and An image processing apparatus for generating an image including pixels interpolated with at least a first color signal, wherein the position in the image is (x, y) (where x is an integer indicating a pixel position in the horizontal direction, y Is an integer indicating the pixel position in the vertical direction) and has a second color signal different from the first color signal at the position (x0, y0) where the pixel having the first color signal is missing. When the pixel is X (x0, y0), M types of the first color signals interpolated in this manner of M (M is an integer of 2 or more) with respect to X (x0, y0). Pixel interpolation candidate calculating means for calculating Gt (x0, y0) (where t = 1,..., M); And band limiting means for calculating an XL (x0, y0) which has been band-limited using the same type color signals near to said X (x0, y0), the first M types calculated by the pixel interpolation candidate calculating means Based on one color signal Gt, M types of color difference candidates, which are color difference candidates X (x0, y0) −Gt (x0, y0) or color difference candidates XL (x0, y0) −Gt (x0, y0), are calculated. A peripheral position (of the same type t as the first color signal Gt (x0, y0) used when calculating the color difference candidate calculation means and the color difference candidate X (x0, y0) -Gt (x0, y0) ( Based on the first color signal Gt (x0 + n, y0 + m) calculated in (x0 + n, y0 + m) (here, n and m are arbitrary integers which are not simultaneously 0), the peripheral position (x0 + n, y0 + m) A plurality of X color difference candidates X (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) and the color difference candidate X (x0, y0) −Gt (x0, y0) or when calculating the color difference candidate XL (x0, y0) −Gt (x0, y0). Gt calculated at the peripheral position (x0 + n, y0 + m) of the same type t as the first color signal Gt (x0, y0) used (where n and m are any integers that are not 0 simultaneously). Based on (x0 + n, y0 + m), a plurality of XL color difference candidates XL (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) calculated for the peripheral position (x0 + n, y0 + m) and the color difference candidates XL (x0, Based on y0) −Gt (x0, y0), M types of color difference similarities are calculated, and based on the calculated M types of color difference similarities, M types of the first color signals Gt (x0, p types of the above y0) first color signal Gp (x0, y0) (here, 1 ≦ p ≦ M) or Type of the first color signal Gq (x0, y0) (here, 1 ≦ q ≦ M) based on the calculated color difference candidate X (x0, y0) -Gp ( x0, y0) or color difference candidate XL (x0 , Y0) −Gq (x0, y0) as the color difference, and the color difference X (x0, y0) −Gp (x0, x0, x0, y0) selected from the above X (x0, y0) by the optimum color difference selecting means. calculating means for calculating the first color signal G (x0, y0) for the position (x0, y0) by subtracting y0) or the color difference XL (x0, y0) −Gq (x0, y0). It is equipped.

第1の発明によれば、RGBベイヤ配列画像に対して欠落色信号を補間する際に、該補間処理に伴って発生する偽色を抑制し、本来再現されるべき彩度を保ったカラー画像を得ることができる。   According to the first aspect of the present invention, when a missing color signal is interpolated with respect to an RGB Bayer array image, a color image that suppresses a false color generated in association with the interpolation process and maintains a saturation that should be originally reproduced. Can be obtained.

また、第2の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記最適色差選択手段によっては色差が算出されない位置の色差を、該最適色差選択手段により算出された該位置の周辺の同一色の色差に基づいて補間する処理を行う色差補間手段と、上記最適色差選択手段または上記色差補間手段により算出された色差と、この色差と同一位置の上記第1の色信号を有する画素と、に基づいて、複数の色信号を含む画素を算出する画素算出手段と、をさらに具備したものである。 The image processing apparatus according to a second aspect of the invention is the image processing apparatus according to the first aspect of the invention, wherein the color difference at a position where the color difference is not calculated by the optimum color difference selecting unit is calculated by the optimum color difference selecting unit. A color difference interpolation unit that performs an interpolation process based on a color difference of the same color around the color difference, a color difference calculated by the optimum color difference selection unit or the color difference interpolation unit, and the first color signal at the same position as the color difference. And a pixel calculation means for calculating a pixel including a plurality of color signals based on the pixel.

第2の発明によれば、RGBベイヤ配列画像に対して欠落色信号を補間する際に、該補間処理に伴って発生する偽色を抑制し、本来再現されるべき彩度を保ちつつ、高解像度のカラー画像を得ることができる。   According to the second invention, when the missing color signal is interpolated with respect to the RGB Bayer array image, the false color generated by the interpolation processing is suppressed, and the saturation that should be reproduced is kept high. A resolution color image can be obtained.

さらに、第3の発明による画像処理装置は、上記第1の発明による画像処理装置において、所定位置の周辺の同一色の色差に基づいて、該所定位置に対する補間色差を算出する色差補間手段と、上記所定位置の周辺の上記第1の色信号を有する画素に基づいて、該所定位置に対して補間された上記第1の色信号を算出する補間手段と、上記所定位置に算出された補間色差と上記補間された第1の色信号とに基づいて、該所定位置において、複数の色信号を含む画素を算出する画素算出手段と、をさらに具備したものである。 Further, an image processing apparatus according to a third invention is the image processing apparatus according to the first invention, wherein a color difference interpolation means for calculating an interpolated color difference for the predetermined position based on a color difference of the same color around the predetermined position; based on the pixels having the first color signal around the predetermined position, said predetermined interpolation means place in pairs to calculate the interpolated said first color signal, interpolation calculated in the predetermined position Pixel calculation means for calculating pixels including a plurality of color signals at the predetermined position based on the color difference and the interpolated first color signal is further provided.

第3の発明によれば、RGBベイヤ配列画像に対して欠落色信号を補間する際に、該補間処理に伴って発生する偽色を抑制し、本来再現されるべき彩度を保ちつつ、高解像度のカラー画像を得ることができるとともに、エッジ境界のガタツキを減らしてより滑らかなエッジを再現することができる。さらに、補間画素数を変更することができ、補間画素数に見合った帯域制限補間フィルタ係数を選ぶことにより、所定解像度の画像を作成することができる。   According to the third invention, when the missing color signal is interpolated with respect to the RGB Bayer array image, the false color generated by the interpolation processing is suppressed, and the saturation that should be reproduced is kept high. A color image with a resolution can be obtained, and a smoother edge can be reproduced by reducing the backlash of the edge boundary. Furthermore, the number of interpolation pixels can be changed, and an image with a predetermined resolution can be created by selecting a band-limited interpolation filter coefficient corresponding to the number of interpolation pixels.

第4の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記最適色差選択手段が、上記色差類似度を、上記色差候補X(x0,y0)−Gt(x0,y0)と、該色差候補X(x0,y0)−Gt(x0,y0)と同一色Xかつ同一種類tの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、に基づいた類似度と、上記色差候補X(x0,y0)−Gt(x0,y0)とは異なる色X^かつ同一種類tの複数の色差候補X^(x0+n,y0+m)−Gt(x0+n,y0+m)に基づいた類似度と、に基づき算出するものである。   An image processing apparatus according to a fourth invention is the image processing apparatus according to the first invention, wherein the optimum color difference selection means calculates the color difference similarity by using the color difference candidates X (x0, y0) −Gt (x0, y0). And a plurality of color difference candidates X (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) of the same color X and the same type t as the color difference candidates X (x0, y0) −Gt (x0, y0) And a plurality of color difference candidates X ^ (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) of a color X ^ different from the color difference candidate X (x0, y0) -Gt (x0, y0) and of the same type t. It is calculated based on the similarity.

第4の発明によれば、画像のエッジ方向に合ったG画素補間により算出した色差を選択することができる。   According to the fourth aspect, it is possible to select the color difference calculated by G pixel interpolation that matches the edge direction of the image.

第5の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記最適色差選択手段が、上記色差類似度を、上記色差候補XL(x0,y0)−Gt(x0,y0)と、該色差候補XL(x0,y0)−Gt(x0,y0)と同一色Xかつ同一種類tの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、に基づいた類似度と、上記色差候補XL(x0,y0)−Gt(x0,y0)とは異なる色X^かつ同一種類tの複数の色差候補X^L(x0+n,y0+m)−Gt(x0+n,y0+m)に基づいた類似度と、に基づき算出するものである。   An image processing apparatus according to a fifth aspect of the present invention is the image processing apparatus according to the first aspect, wherein the optimum color difference selection means determines the color difference similarity as the color difference candidate XL (x0, y0) -Gt (x0, y0). And a plurality of color difference candidates XL (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) of the same color X and the same type t as the color difference candidates XL (x0, y0) -Gt (x0, y0) And a plurality of color difference candidates X ^ L (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) of a color X ^ different from the color difference candidate XL (x0, y0) -Gt (x0, y0) and of the same type t. The similarity is calculated based on the similarity.

第5の発明によれば、画像のエッジ方向に合ったG画素補間により算出した色差を選択することができる。   According to the fifth aspect, it is possible to select the color difference calculated by G pixel interpolation that matches the edge direction of the image.

第6の発明による画像処理装置は、上記第4または第5の発明による画像処理装置において、上記類似度が、同一色Xかつ同一種類tの色差候補同士の差分絶対値の和であり、上記最適色差選択手段は、M種類の上記色差類似度の内の最小値を与える色差類似度の1つに対応する色差候補を1つ選択する選択手段を含み、該選択手段により選択された色差候補を色差とするものである。   An image processing apparatus according to a sixth invention is the image processing apparatus according to the fourth or fifth invention, wherein the similarity is a sum of absolute differences between color difference candidates of the same color X and the same type t, The optimum color difference selection means includes selection means for selecting one color difference candidate corresponding to one of the color difference similarities that gives the minimum value among the M types of color difference similarities, and the color difference candidates selected by the selection means Is a color difference.

第6の発明によれば、ハード化を行う際の回路規模を小さく抑制しつつ、最適な色差とG画素補間とを決定することができる。   According to the sixth aspect of the invention, it is possible to determine the optimum color difference and G pixel interpolation while suppressing the circuit scale when performing hardware.

第7の発明による画像処理装置は、上記第1の発明による画像処理装置において、上記最適色差選択手段によって選択された色差がXL(x0,y0)−Gt(x0,y0)である場合に、該色差を所定の閾値と比較することにより高色差であるか否かを判定する高色差判定手段と、上記高色差判定手段により高色差であると判定された位置(x0,y0)に対するG(x0,y0)をGt(x0,y0)に変更する変更手段と、をさらに具備したものである。   An image processing apparatus according to a seventh invention is the image processing apparatus according to the first invention, wherein the color difference selected by the optimum color difference selection means is XL (x0, y0) -Gt (x0, y0). The color difference is compared with a predetermined threshold value to determine whether the color difference is a high color difference, and G () for the position (x0, y0) determined to be a high color difference by the high color difference determination unit. change means for changing x0, y0) to Gt (x0, y0).

第7の発明によれば、高色差でかつ斜めエッジ領域においてジャギーの発生を抑制することができる。   According to the seventh aspect of the invention, it is possible to suppress the occurrence of jaggy in a high color difference and oblique edge region.

第8の発明による画像処理装置は、上記第1の発明による画像処理装置において、位置(x0,y0)におけるX(x0,y0)と、該位置(x0,y0)の周辺の位置におけるX(x0+u,y0+v)(ここに、uとvとは同時に0とはならない任意の整数)とに基づいて、該位置(x0,y0)に対する飽和状態を判定する飽和状態判定手段と、上記飽和状態判定手段により飽和状態にあると判定された場合には、上記最適色差選択手段によってM種類の色差候補から選択される色差を、上記飽和状態に基づいて予め決定された1種類の色差に固定化する固定化手段と、をさらに具備したものである。   An image processing apparatus according to an eighth invention is the image processing apparatus according to the first invention, wherein X (x0, y0) at a position (x0, y0) and X ( x0 + u, y0 + v) (where u and v are arbitrary integers that are not 0 at the same time), a saturation state determination means for determining a saturation state for the position (x0, y0), and the saturation state determination When it is determined that the saturation state is detected by the means, the color difference selected from the M kinds of color difference candidates by the optimum color difference selection means is fixed to one kind of color difference determined in advance based on the saturation state. And immobilization means.

第8の発明によれば、R画素またはB画素の飽和状態を判定し、複数選択可能な色差候補を予め決められた1つの種類に絞ることにより、R画素またはB画素においてブルーミングにより周辺G画素に不均一に電荷が漏れた場合であっても不自然なアーティファクトの発生を抑制することができる。   According to the eighth invention, the saturation state of the R pixel or the B pixel is determined, and a plurality of selectable color difference candidates are narrowed down to one predetermined type, so that the peripheral G pixel by blooming in the R pixel or the B pixel. Even when charges are leaked unevenly, the occurrence of unnatural artifacts can be suppressed.

第9の発明による画像処理装置は、上記第1から第8の発明による画像処理装置において、上記第1の色信号はG成分、上記第2の色信号はB成分またはR成分である。 An image processing apparatus according to a ninth aspect is the image processing apparatus according to any one of the first to eighth aspects, wherein the first color signal is a G component and the second color signal is a B component or an R component.

第10の発明よる画像処理装置は、上記第1から第9の発明による画像処理装置において、上記画像はRGBベイヤ配列画像である。 An image processing apparatus according to a tenth aspect is the image processing apparatus according to any one of the first to ninth aspects, wherein the image is an RGB Bayer array image.

第11の発明による画像処理装置は、上記第9の発明による画像処理装置において、上記画素補間候補算出手段は、上記X画素の上下に隣接する2つのG画素の平均を上記M種類のG成分信号の内の1種類のG成分信号として算出する第1の補間算出手段と、該X画素の左右に隣接する2つのG画素の平均を上記M種類のG成分信号の内の1種類のG成分信号として算出する第2の補間算出手段と、該X画素の上下左右に隣接する4つのG画素の平均を上記M種類のG成分信号の内の1種類のG成分信号として算出する第3の補間算出手段と、
を有して構成されたものである。
An image processing apparatus according to an eleventh aspect is the image processing apparatus according to the ninth aspect, wherein the pixel interpolation candidate calculation means calculates an average of two G pixels adjacent above and below the X pixel as the M types of G components. A first interpolation calculating means for calculating as one kind of G component signal of the signals, and an average of two G pixels adjacent to the left and right of the X pixel, and one kind of G of the M kinds of G component signals. A second interpolation calculating means for calculating as a component signal, and a third for calculating an average of four G pixels adjacent to the top, bottom, left and right of the X pixel as one type of G component signal among the M types of G component signals. Interpolation calculation means of
It is comprised with having.

第12の発明による画像処理装置は、上記第11の発明による画像処理装置において、上記最適色差選択手段は、G成分信号を有する画素が欠落している位置を示すG画素欠落位置の周辺のG画素値の変動量を算出して、該変動量に基づいた重み係数を算出するG画素変動量算出手段と、上記第3の補間算出手段により算出されたG成分信号に基づいて算出された上記G画素欠落位置の色差候補の周辺色差候補との類似度に、上記重み係数を乗算する乗算手段と、を有して構成されたものである。 An image processing apparatus according to a twelfth invention is the image processing apparatus according to the eleventh invention, wherein the optimum color difference selection means includes a G pixel around a G pixel missing position indicating a position where a pixel having a G component signal is missing. The G pixel fluctuation amount calculating means for calculating the fluctuation amount of the pixel value and calculating a weighting coefficient based on the fluctuation amount, and the G component signal calculated based on the G component signal calculated by the third interpolation calculating means. Multiplier means for multiplying the similarity between the color difference candidate at the G pixel missing position and the surrounding color difference candidates by the weighting factor.

第13の発明による画像処理装置は、上記第12の発明による画像処理装置において、位置(x0,y0)におけるX(x0,y0)と、該位置(x0,y0)の周辺の位置におけるX(x0+u,y0+v)(ここに、uとvとは同時に0とはならない任意の整数)とに基づいて、該位置(x0,y0)に対する飽和状態を判定する飽和状態判定手段と、上記飽和状態判定手段により飽和状態にあると判定された場合には、上記G画素変動量算出手段により算出される重み係数を最小値に変更する重み係数変更手段と、をさらに具備したものである。 An image processing device according to a thirteenth invention is the image processing device according to the twelfth invention , wherein X (x0, y0) at the position (x0, y0) and X ( x0 + u, y0 + v) (where u and v are arbitrary integers that are not 0 at the same time), a saturation state determination means for determining a saturation state for the position (x0, y0), and the saturation state determination And a weighting factor changing unit that changes the weighting factor calculated by the G pixel variation calculation unit to a minimum value when it is determined that the unit is saturated.

第13の発明によれば、R画素またはB画素の飽和状態を判定し、複数選択可能な色差候補を予め決められた1つの種類に絞ることにより、R画素またはB画素においてブルーミングにより周辺G画素に不均一に電荷が漏れた場合であっても不自然なアーティファクトの発生を抑制することができる。   According to the thirteenth invention, the saturation state of the R pixel or the B pixel is determined, and a plurality of selectable color difference candidates are narrowed down to one predetermined type, so that the peripheral G pixel by blooming in the R pixel or the B pixel. Even when charges are leaked unevenly, the occurrence of unnatural artifacts can be suppressed.

第14の発明による画像処理プログラムは、コンピュータに、複数の色信号の内の少なくとも一つの色信号が欠落している画素を含む画像を処理させて、複数の色信号の内の少なくとも第1の色信号が補間された画素を含む画像を生成させるための画像処理プログラムであって、コンピュータに、上記画像における位置を(x,y)(ここに、xは横方向の画素位置を示す整数、yは縦方向の画素位置を示す整数)として表し、上記第1の色信号を有する画素が欠落している位置(x0,y0)の上記第1の色信号とは異なる第2の色信号を有する画素をX(x0,y0)としたときに、このX(x0,y0)に対して、M種類(Mは2以上の整数)の補間態様で補間されたM種類の上記第1の色信号t(x0,y0)(ここに、t=1,…,M)を算出する画素補間候補算出ステップと、上記X(x0,y0)に対して周辺の同種色信号を用いて帯域制限したXL(x0,y0)を算出する帯域制限ステップと、上記画素補間候補算出ステップにより算出されたM種類の上記第1の色信号tに基づいて、色差候補X(x0,y0)−Gt(x0,y0)または色差候補XL(x0,y0)−Gt(x0,y0)でなるM種類の色差候補を算出する色差候補算出ステップと、上記色差候補X(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出された上記第1の色信号t(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補X(x0,y0)−Gt(x0,y0)とに基づいて、または、上記色差候補XL(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出されたGt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXLの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補XL(x0,y0)−Gt(x0,y0)とに基づいて、M種類の色差類似度を算出し、この算出したM種類の色差類似度に基づいて、M種類の上記第1の色信号t(x0,y0)の内の1つの種類pの上記第1の色信号p(x0,y0)(ここに、1≦p≦M)または1つの種類qの上記第1の色信号q(x0,y0)(ここに、1≦q≦M)に基づき算出された色差候補X(x0,y0)−Gp(x0,y0)または色差候補XL(x0,y0)−Gq(x0,y0)を色差として選択する最適色差選択ステップと、上記X(x0,y0)から上記最適色差選択ステップにより選択された色差X(x0,y0)−Gp(x0,y0)または色差XL(x0,y0)−Gq(x0,y0)を減算することにより、位置(x0,y0)に対する上記第1の色信号G(x0,y0)を算出する算出ステップと、を実行させるためのプログラムである。 An image processing program according to a fourteenth aspect of the invention causes a computer to process an image including a pixel in which at least one color signal of a plurality of color signals is missing, and at least a first of the plurality of color signals. An image processing program for generating an image including a pixel in which a color signal is interpolated, wherein the computer determines a position in the image (x, y) (where x is an integer indicating a pixel position in the horizontal direction, y is an integer indicating the pixel position in the vertical direction), and a second color different from the first color signal at the position (x 0 , y 0 ) where the pixel having the first color signal is missing. pixels having a signal when the X (x 0, y 0) , the X (x 0, y 0) with respect to, M kinds (M is an integer of 2 or more) M type interpolated by the interpolation manner the first color signal G t (x 0, y 0 ) ( here, t = 1, , The band is calculated and a pixel interpolation candidate calculating a M), the X and (x 0, y 0) X has been band-limited using the same type color signals near against L (x 0, y 0) limits Color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ) or color difference based on the step and the M types of first color signals G t calculated in the pixel interpolation candidate calculation step A color difference candidate calculation step for calculating M types of color difference candidates consisting of candidates X L (x 0 , y 0 ) −G t (x 0 , y 0 ), and the color difference candidates X (x 0 , y 0 ) −G t. the (x 0, y 0) of the first color signal used for calculating the G t (x 0, y 0) and the same type t, the peripheral position (x 0 + n, y 0 + m) ( where Based on the first color signal G t (x 0 + n, y 0 + m) calculated in (n and m are arbitrary integers that are not 0 at the same time) A plurality of X color difference candidates X (x 0 + n, y 0 + m) −G t (x 0 + n, y 0 + m) calculated for the side position (x 0 + n, y 0 + m), and the color difference candidates Based on X (x 0 , y 0 ) −G t (x 0 , y 0 ) or the color difference candidate X L (x 0 , y 0 ) −G t (x 0 , y 0 ) is calculated. The peripheral position (x 0 + n, y 0 + m) of the same type t as the first color signal G t (x 0 , y 0 ) used here (where n and m are not 0 simultaneously) Based on G t (x 0 + n, y 0 + m) calculated in (any integer), a plurality of color difference candidates X L of X L calculated for the peripheral position (x 0 + n, y 0 + m) ( Based on x 0 + n, y 0 + m) −G t (x 0 + n, y 0 + m) and the color difference candidate X L (x 0 , y 0 ) −G t (x 0 , y 0 ), M Calculate the color difference similarity of the type Based on the M types of color difference similarity issued, first color signal M types of the G t (x 0, y 0 ) 1 single type p of the first color signal G p (x 0 of the, y 0 ) (where 1 ≦ p ≦ M) or one type q of the first color signal G q (x 0 , y 0 ) (where 1 ≦ q ≦ M) Optimal color difference selection step of selecting candidate X (x 0 , y 0 ) −G p (x 0 , y 0 ) or color difference candidate X L (x 0 , y 0 ) −G q (x 0 , y 0 ) as a color difference And the color difference X (x 0 , y 0 ) −G p (x 0 , y 0 ) or color difference X L (x 0 , y 0 ) selected from the above X (x 0 , y 0 ) by the optimum color difference selection step. ) -G q (x 0 , y 0 ) is subtracted to perform the calculation step of calculating the first color signal G (x 0 , y 0 ) for the position (x 0 , y 0 ). for Is a program.

第14の発明によれば、第1の発明とほぼ同様の効果を奏することができる。   According to the fourteenth aspect, substantially the same effect as the first aspect can be achieved.

第15の発明による画像処理方法は、複数の色信号の内の少なくとも一つの色信号が欠落している画素を含む画像を処理して、複数の色信号の内の少なくとも第1の色信号が補間された画素を含む画像を生成するための画像処理方法であって、上記画像における位置を(x,y)(ここに、xは横方向の画素位置を示す整数、yは縦方向の画素位置を示す整数)として表し、上記第1の色信号を有する画素が欠落している位置(x0,y0)の上記第1の色信号とは異なる第2の色信号を有する画素をX(x0,y0)としたときに、このX(x0,y0)に対して、M種類(Mは2以上の整数)の補間態様で補間されたM種類の上記第1の色信号t(x0,y0)(ここに、t=1,…,M)を算出する画素補間候補算出ステップと、上記X(x0,y0)に対して周辺の同種色信号を用いて帯域制限したXL(x0,y0)を算出する帯域制限ステップと、上記画素補間候補算出ステップにより算出されたM種類の上記第1の色信号tに基づいて、色差候補X(x0,y0)−Gt(x0,y0)または色差候補XL(x0,y0)−Gt(x0,y0)でなるM種類の色差候補を算出する色差候補算出ステップと、上記色差候補X(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出された上記第1の色信号t(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補X(x0,y0)−Gt(x0,y0)とに基づいて、または、上記色差候補XL(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出されたGt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXLの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補XL(x0,y0)−Gt(x0,y0)とに基づいて、M種類の色差類似度を算出し、この算出したM種類の色差類似度に基づいて、M種類の上記第1の色信号t(x0,y0)の内の1つの種類pの上記第1の色信号p(x0,y0)(ここに、1≦p≦M)または1つの種類qの上記第1の色信号q(x0,y0)(ここに、1≦q≦M)に基づき算出された色差候補X(x0,y0)−Gp(x0,y0)または色差候補XL(x0,y0)−Gq(x0,y0)を色差として選択する最適色差選択ステップと、上記X(x0,y0)から上記最適色差選択ステップにより選択された色差X(x0,y0)−Gp(x0,y0)または色差XL(x0,y0)−Gq(x0,y0)を減算することにより、位置(x0,y0)に対する上記第1の色信号G(x0,y0)を算出する算出ステップと、を有する方法である。 An image processing method according to a fifteenth aspect of the invention processes an image including a pixel in which at least one of the plurality of color signals is missing, so that at least the first color signal of the plurality of color signals is obtained. An image processing method for generating an image including interpolated pixels, wherein a position in the image is (x, y) (where x is an integer indicating a horizontal pixel position, and y is a vertical pixel. A pixel having a second color signal different from the first color signal at the position (x 0 , y 0 ) where the pixel having the first color signal is missing. When (x 0 , y 0 ), M types of the first colors interpolated in this manner of M (M is an integer of 2 or more) with respect to X (x 0 , y 0 ) (herein, t = 1, ..., M ) signal G t (x 0, y 0 ) and a pixel interpolation candidate calculating a upper X (x 0, y 0) and band limiting step of calculating the band-limited by the X L (x 0, y 0 ) by using the same type color signals near relative, calculated by the pixel interpolation candidate calculating step M Based on the type of the first color signal G t , the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ) or the color difference candidate X L (x 0 , y 0 ) −G t ( The color difference candidate calculation step for calculating M types of color difference candidates consisting of x 0 , y 0 ) and the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ) are used. Peripheral position (x 0 + n, y 0 + m) of the same type t as the first color signal G t (x 0 , y 0 ) (where n and m are any integers that are not 0 simultaneously) X calculated for the peripheral position (x 0 + n, y 0 + m) based on the first color signal G t (x 0 + n, y 0 + m) calculated in step Color candidate X (x 0 + n, y 0 + m) −G t (x 0 + n, y 0 + m) and the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ) Or the first color signal G t (x 0 , y 0 ) used in calculating the color difference candidate X L (x 0 , y 0 ) −G t (x 0 , y 0 ). ) And G t (x 0 + n, y 0 + m) calculated at the peripheral position (x 0 + n, y 0 + m) (where n and m are not any integers that are not 0 at the same time). based on), the peripheral position (x 0 + n, y 0 + multiple color difference X L calculated for m) candidate X L (x 0 + n, y 0 + m) -G t (x 0 + n, y 0 + M) and the color difference candidates X L (x 0 , y 0 ) −G t (x 0 , y 0 ), M types of color difference similarities are calculated, and the calculated M types of color difference similarities are calculated. based on the, on the M types (Here, 1 ≦ p ≦ M) first color signal G t (x 0, y 0 ) in the first one type p of the color signal G p (x 0, y 0 ) or one Color difference candidate X (x 0 , y 0 ) −G p (x 0 , x, calculated based on the first color signal G q (x 0 , y 0 ) (here 1 ≦ q ≦ M) of type q y 0 ) or a color difference candidate X L (x 0 , y 0 ) −G q (x 0 , y 0 ) as an optimum color difference selection step, and the optimum color difference selection from X (x 0 , y 0 ) By subtracting the color difference X (x 0 , y 0 ) −G p (x 0 , y 0 ) or the color difference X L (x 0 , y 0 ) −G q (x 0 , y 0 ) selected by the step. And calculating the first color signal G (x 0 , y 0 ) for the position (x 0 , y 0 ).

第15の発明によれば、第1の発明とほぼ同様の効果を奏することができる。
According to the fifteenth aspect, substantially the same effect as in the first aspect can be achieved.

本発明の画像処理装置、画像処理プログラム、画像処理方法によれば、RGBベイヤ配列画像に対して欠落色信号を補間する際に、該補間処理に伴って発生する偽色と解像度低下とを十分に抑制しつつ、彩度低下がさらに発生しないようにすることができる。   According to the image processing apparatus, the image processing program, and the image processing method of the present invention, when the missing color signal is interpolated with respect to the RGB Bayer array image, the false color generated due to the interpolation processing and the resolution reduction are sufficiently obtained. It is possible to prevent further reduction in saturation while suppressing the color saturation.

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

[実施形態1]
図1から図7および図19から図29は本発明の実施形態1を示したものであり、図1は画像処理装置の全体的な構成を示すブロック図である。
[Embodiment 1]
FIGS. 1 to 7 and FIGS. 19 to 29 show Embodiment 1 of the present invention, and FIG. 1 is a block diagram showing the overall configuration of the image processing apparatus.

この画像処理装置は、図1に示すように、撮像部101と、G補間色差算出部102と、色差補間処理部103と、RGB算出部104と、圧縮記録部105と、を有している。   As shown in FIG. 1, this image processing apparatus includes an imaging unit 101, a G interpolation color difference calculation unit 102, a color difference interpolation processing unit 103, an RGB calculation unit 104, and a compression recording unit 105. .

撮像部101は、図示はしないが、レンズと、IRカットフィルタと、光学ローパスフィルタと、単板撮像素子(以下では単に「撮像素子」などと省略する。)と、増幅器と、A/D変換器と、撮像素子コントローラと、を有して構成されている。ここに、レンズは、被写体の光学像を撮像素子上に結像するためのものである。IRカットフィルタは、レンズを通過する光束から赤外領域の光をカットするためのものである。光学ローパスフィルタは、レンズにより撮像素子上に結像される光学像の解像度が、G信号のサンプリング間隔において折り返し歪みによるモワレが許容レベル以上に発生しない空間周波数特性となるように帯域制限を行う光学フィルタである。撮像素子は、図5に示すようなベイヤ配列のカラーフィルタを備える単板式の撮像素子であり、例えばCCDやCMOS等により構成されている。ここに図5は、撮像部101の単板撮像素子により撮像された色信号のベイヤ配列を示す図である。増幅器は、この撮像素子から出力される信号をアナログ的に増幅するものである。A/D変換器は、この増幅器により増幅されたアナログ信号をデジタル信号に変換するものである。撮像素子コントローラは、撮像素子を制御しながら駆動して撮像を行わせ、撮像後にA/D変換器から出力されるデジタル信号を色成分に応じてG補間色差算出部102へ後述するように出力するものである。   Although not shown, the imaging unit 101 includes a lens, an IR cut filter, an optical low-pass filter, a single-plate imaging device (hereinafter simply referred to as “imaging device”), an amplifier, and A / D conversion. And an image sensor controller. Here, the lens is used to form an optical image of the subject on the image sensor. The IR cut filter is for cutting light in the infrared region from the light beam passing through the lens. The optical low-pass filter is an optical device that limits the band so that the resolution of the optical image formed on the image pickup device by the lens has a spatial frequency characteristic that does not cause over-permissible moire due to aliasing distortion at the G signal sampling interval. It is a filter. The image pickup device is a single-plate image pickup device having a Bayer array color filter as shown in FIG. 5, and is composed of, for example, a CCD or a CMOS. FIG. 5 is a diagram illustrating a Bayer array of color signals captured by the single-plate image sensor of the imaging unit 101. The amplifier amplifies the signal output from the image sensor in an analog manner. The A / D converter converts the analog signal amplified by this amplifier into a digital signal. The image pickup device controller drives the image pickup device while controlling the image pickup device, and outputs a digital signal output from the A / D converter after the image pickup to the G interpolation color difference calculation unit 102 according to the color component as described later. To do.

このような構成において、レンズ、IRカットフィルタ、光学ローパスフィルタを介して単板撮像素子上に結像した光は、図5に示すようにベイヤ配列された色フィルタ付き画素により光電変換される。こうして光電変換された各画素の電気信号は、増幅器によって増幅され、A/D変換器によってデジタル信号に変換されて、デジタルの色信号Rs,Gs,Bsとして出力される。撮像素子コントローラは、A/D変換器から出力される色信号Rs,Gs,Bsを、RsおよびBsと、Gsと、にそれぞれ分けて、G補間色差算出部102へ出力する。さらに、撮像素子コントローラは、各色信号Rs,Gs,Bsに対するノイズ低減処理機能およびホワイトバランス処理機能等を備えており、G補間色差算出部102へ出力されるRs,Gs,Bsにはこれらの処理が施されている。   In such a configuration, the light imaged on the single-plate image sensor through the lens, the IR cut filter, and the optical low-pass filter is photoelectrically converted by the color filter-equipped pixels arranged as shown in FIG. The electric signal of each pixel thus photoelectrically converted is amplified by an amplifier, converted into a digital signal by an A / D converter, and output as digital color signals Rs, Gs, Bs. The image sensor controller divides the color signals Rs, Gs, and Bs output from the A / D converter into Rs, Bs, and Gs, respectively, and outputs them to the G interpolation color difference calculation unit 102. Further, the image pickup device controller has a noise reduction processing function and a white balance processing function for the color signals Rs, Gs, and Bs, and these processing is performed on Rs, Gs, and Bs output to the G interpolation color difference calculation unit 102. Is given.

G補間色差算出部102は、入力された色信号Rs,Bsの画素位置に対応する補間G画素であるGiと、この画素位置における色差信号R−Gi,B−Giと、を算出する。そして、G補間色差算出部102は、色差信号R−Gi,B−Giについては図7に示すような2次元配列として、この2次元配列の色差信号をラスタスキャン順に色差補間処理部103へ出力する。ここに図7は、G補間色差算出部102から出力されるR−Gi,B−Gi信号(X−Gi信号の一例)の2次元配列を示す図である。また、G補間色差算出部102は、G信号については図6に示すような2次元配列として、この2次元配列のG信号をラスタスキャン順にRGB算出部104へ出力する。ここに図6は、G補間色差算出部102から出力されるG信号の2次元配列を示す図である。このG補間色差算出部102については、後でより詳しく説明する。   The G interpolation color difference calculation unit 102 calculates Gi that is an interpolation G pixel corresponding to the pixel position of the input color signals Rs and Bs, and color difference signals R-Gi and B-Gi at the pixel position. Then, the G-interpolation color difference calculation unit 102 converts the color difference signals R-Gi and B-Gi into a two-dimensional array as shown in FIG. 7 and outputs the two-dimensional array of color difference signals to the color difference interpolation processing unit 103 in the raster scan order. To do. FIG. 7 is a diagram showing a two-dimensional array of R-Gi, B-Gi signals (an example of X-Gi signals) output from the G interpolation color difference calculation unit 102. Further, the G interpolation color difference calculation unit 102 outputs the G signal of the two-dimensional array to the RGB calculation unit 104 in the raster scan order as a two-dimensional array as shown in FIG. 6 for the G signal. FIG. 6 is a diagram showing a two-dimensional array of G signals output from the G interpolation color difference calculation unit 102. The G interpolation color difference calculation unit 102 will be described in more detail later.

色差補間処理部103は、色差補間手段であって、図7に示すような2次元配列中において、全画素の中で欠落している色差R−G、および全画素の中で欠落している色差B−Gを、周辺の同一色に係る色差R−GiまたはB−Giを用いてそれぞれ補間し、補間して得られた全画素位置の色差R−Gと全画素位置の色差B−Gとを、RGB算出部104へそれぞれ出力する。   The chrominance interpolation processing unit 103 is a chrominance interpolation unit, and is missing in all pixels in the two-dimensional array as shown in FIG. The color difference BG is interpolated using the color difference R-Gi or B-Gi relating to the same surrounding color, and the color difference RG at all pixel positions and the color difference BG at all pixel positions obtained by the interpolation are interpolated. Are output to the RGB calculation unit 104, respectively.

RGB算出部104は、RGB画素算出手段であって、色差補間処理部103から入力される2種類の色差信号R−G,B−Gと、G補間色差算出部102から入力されるG信号と、に基づいて、RGB信号を算出し、該算出したRGB信号に対してカラーマッチング処理とγ補正処理とを行ってRγ,Gγ,Bγ信号を算出し、算出したRγ,Gγ,Bγ信号を圧縮記録部105へ出力する。   The RGB calculation unit 104 is an RGB pixel calculation unit, and includes two types of color difference signals RG and BG input from the color difference interpolation processing unit 103 and a G signal input from the G interpolation color difference calculation unit 102. , RGB signals are calculated, color matching processing and γ correction processing are performed on the calculated RGB signals to calculate Rγ, Gγ, Bγ signals, and the calculated Rγ, Gγ, Bγ signals are compressed. Output to the recording unit 105.

圧縮記録部105は、RGB算出部104から入力されたRγ,Gγ,Bγ信号をY,U,V信号に変換し、さらに、このY,U,V信号をJPEGやMPEG等の高能率圧縮符号化処理がなされた圧縮データに変換して、この圧縮データを記録媒体(例えば、フラッシュメモリやハードディスク、磁気テープや光ディスク等)に保存する。   The compression recording unit 105 converts the Rγ, Gγ, and Bγ signals input from the RGB calculation unit 104 into Y, U, and V signals, and further converts the Y, U, and V signals into a high-efficiency compression code such as JPEG or MPEG. The compressed data is converted to compressed data, and the compressed data is stored in a recording medium (for example, a flash memory, a hard disk, a magnetic tape, an optical disk, etc.).

次に、図2は、G補間色差算出部102の構成を示すブロック図である。この図2に示すG補間色差算出部102の構成は、後述する他の実施形態のG補間色差算出部102の構成の基本形となっている。   Next, FIG. 2 is a block diagram illustrating a configuration of the G interpolation color difference calculation unit 102. The configuration of the G interpolation color difference calculation unit 102 shown in FIG. 2 is a basic form of the configuration of the G interpolation color difference calculation unit 102 of another embodiment described later.

このG補間色差算出部102は、メモリ201と、メモリ202と、縦補間G算出部203と、横補間G算出部204と、4画素平均G算出部205と、ローパスフィルタ206と、減算部207と、減算部208と、減算部209と、メモリ210と、メモリ211と、メモリ212と、周辺類似度算出部213と、周辺類似度算出部214と、周辺類似度算出部215と、G変動量算出部216と、メモリ217と、乗算部218と、判定部219と、色差選択部220と、メモリ221と、メモリ222と、減算部223と、を有している。   The G interpolation color difference calculation unit 102 includes a memory 201, a memory 202, a vertical interpolation G calculation unit 203, a horizontal interpolation G calculation unit 204, a four-pixel average G calculation unit 205, a low-pass filter 206, and a subtraction unit 207. A subtractor 208, a subtractor 209, a memory 210, a memory 211, a memory 212, a peripheral similarity calculator 213, a peripheral similarity calculator 214, a peripheral similarity calculator 215, and a G variation. An amount calculation unit 216, a memory 217, a multiplication unit 218, a determination unit 219, a color difference selection unit 220, a memory 221, a memory 222, and a subtraction unit 223 are included.

撮像部101から出力された色信号Rs、Bsはメモリ201に、色信号Gsはメモリ202に、欠落G画素位置の2次元的な補間処理を実施可能とする画素が揃うまでの遅延を得るために、所定ライン分だけ格納される。図2に示す例においては、メモリ201およびメモリ202に格納されるライン数は、少なくとも3ラインである。   The color signals Rs and Bs output from the imaging unit 101 are obtained in the memory 201, and the color signal Gs is obtained in the memory 202 in order to obtain a delay until the pixels that can perform the two-dimensional interpolation processing of the missing G pixel position are completed. Are stored for a predetermined number of lines. In the example shown in FIG. 2, the number of lines stored in the memory 201 and the memory 202 is at least three lines.

ここで、欠落G画素位置にはR画素またはB画素が配置されていることになるが、これら2つの色信号をまとめてX、あるいはX画素などと記載して、以後は説明することにする。   Here, although the R pixel or the B pixel is arranged at the position of the missing G pixel, these two color signals are collectively described as X or X pixel, and will be described hereinafter. .

縦補間G算出部203は、図19に示すような縦方向の近傍G画素を用いて、補間式Gv=(G1+G2)/2によりG画素補間候補を算出し、減算部207へ出力するG画素補間候補算出手段、第1の補間算出手段である。ここに図19は、欠落G信号位置の縦方向補間として用いる上下方向の隣接G信号のベイヤ配列上における位置を示す図である。   The vertical interpolation G calculation unit 203 calculates G pixel interpolation candidates by the interpolation formula Gv = (G1 + G2) / 2 using the vertical neighboring G pixels as shown in FIG. Interpolation candidate calculation means and first interpolation calculation means. FIG. 19 is a diagram showing positions on the Bayer array of adjacent G signals in the vertical direction used as vertical interpolation of the missing G signal positions.

横補間G算出部204は、図20に示すような横方向の近傍G画素を用いて、補間式Gh=(G3+G4)/2によりG画素補間候補を算出し、減算部208へ出力するG画素補間候補算出手段、第2の補間算出手段である。ここに図20は、欠落G信号位置の横方向補間として用いる左右方向の隣接G信号のベイヤ配列上における位置を示す図である。   The horizontal interpolation G calculation unit 204 calculates a G pixel interpolation candidate by using an interpolation formula Gh = (G3 + G4) / 2 using the neighboring G pixels in the horizontal direction as shown in FIG. Interpolation candidate calculation means and second interpolation calculation means. FIG. 20 is a diagram showing the positions on the Bayer array of the adjacent G signals in the left-right direction used as the horizontal interpolation of the missing G signal positions.

4画素平均G算出部205は、図21に示すような縦横4方向の近傍G画素を用いて、補間式Ga=(G1+G2+G3+G4)/4によりG画素補間候補を算出し、減算部209へ出力するG画素補間候補算出手段、第3の補間算出手段である。ここに図21は、欠落G信号位置の隣接4画素補間として用いる上下左右方向の隣接G信号のベイヤ配列上における位置を示す図である。   The 4-pixel average G calculation unit 205 calculates G pixel interpolation candidates by using the interpolation formula Ga = (G 1 + G 2 + G 3 + G 4) / 4 using the neighboring G pixels in the four vertical and horizontal directions as shown in FIG. 21, and outputs them to the subtraction unit 209. G pixel interpolation candidate calculation means and third interpolation calculation means. FIG. 21 is a diagram showing positions on the Bayer array of adjacent G signals in the vertical and horizontal directions used as adjacent 4-pixel interpolation of missing G signal positions.

また、メモリ201に格納されている欠落G画素と同一位置にあるX画素は、減算部207,208に入力されるとともに、さらに帯域制限手段たるローパスフィルタ206を介してXL画素として減算部209に入力される。   Further, the X pixel located at the same position as the missing G pixel stored in the memory 201 is input to the subtracting units 207 and 208 and further passed to the subtracting unit 209 as an XL pixel via the low pass filter 206 serving as a band limiting unit. Entered.

ここでローパスフィルタ206は、図27に示すように、処理対象となっている欠落G画素X(i,j)と、その上下左右に位置する同種X画素X(i,j+2),X(i,j−2),X(i−2,j),X(i+2,j)と、に基づき、位置(i,j)におけるXL画素を算出する。ここに、図27は、ローパスフィルタ206においてローパスフィルタを構成するために使用する色信号Xのベイヤ配列上の位置を示す図である。このとき、ローパスフィルタの周波数特性は、後述する図28の曲線fcに示すようになる。そして、上記ローパスフィルタは、以下の通りである。
XL(i,j)=αX(i,j)+β{X(i,j+2)+X(i,j−2)
+X(i−2,j)+X(i+2,j)}
ここに、α,βは、XL画素の空間周波数特性を、欠落G画素の周辺4画素平均で算出したGaの斜め45度方向の空間周波数特性に近似させる重み値である。
Here, as shown in FIG. 27, the low-pass filter 206 has a missing G pixel X (i, j) to be processed, and the same type X pixel X (i, j + 2), X (i) positioned above, below, left and right. , J−2), X (i−2, j), and X (i + 2, j), the XL pixel at the position (i, j) is calculated. FIG. 27 is a diagram showing the positions on the Bayer array of the color signals X used for configuring the low-pass filter in the low-pass filter 206. At this time, the frequency characteristic of the low-pass filter is as shown by a curve fc in FIG. The low-pass filter is as follows.
XL (i, j) = [alpha] X (i, j) + [beta] {X (i, j + 2) + X (i, j-2)
+ X (i−2, j) + X (i + 2, j)}
Here, α and β are weight values for approximating the spatial frequency characteristics of the XL pixel to the spatial frequency characteristics of Ga, which is calculated by averaging the four surrounding pixels of the missing G pixel, in a 45-degree oblique direction.

色差候補算出手段たる減算部207,208,209によりそれぞれ算出される色差信号X−Gv,X−Gh,XL−Gaは、メモリ210,211,212にそれぞれ格納される。   The color difference signals X-Gv, X-Gh, and XL-Ga calculated by the subtraction units 207, 208, and 209, which are color difference candidate calculation means, are stored in the memories 210, 211, and 212, respectively.

メモリ210,211,212は、後段の周辺類似度算出部213,214,215により類似度算出処理を実施することができるだけの遅延を得るために設けられたものである。本実施形態においては、周辺類似度算出部213,214,215は、図22、図23、図24に示すように、色差信号が3行3列分含まれる近傍領域を用いて類似度を算出するようになっているために、メモリ210,211,212に格納されるライン数は少なくとも5ラインとなっている。   The memories 210, 211, and 212 are provided in order to obtain a delay that can perform the similarity calculation processing by the peripheral similarity calculation units 213, 214, and 215 in the subsequent stage. In the present embodiment, the peripheral similarity calculation units 213, 214, and 215 calculate the similarity using a neighborhood area that includes three rows and three columns of color difference signals, as shown in FIGS. For this reason, the number of lines stored in the memories 210, 211, and 212 is at least five.

ここに、図22は欠落G信号位置において縦方向補間により算出した色差の内の周辺類似度算出に使用する色差信号のベイヤ配列上の位置を示す図、図23は欠落G信号位置において横方向補間により算出した色差の内の周辺類似度算出に使用する色差信号のベイヤ配列上の位置を示す図、図24は欠落G信号位置において隣接4画素補間により算出した色差の内の周辺類似度算出に使用する色差信号のベイヤ配列上の位置を示す図である。   FIG. 22 is a diagram showing the position on the Bayer array of the color difference signals used for calculating the peripheral similarity among the color differences calculated by the vertical interpolation at the missing G signal position, and FIG. 23 is the horizontal direction at the missing G signal position. FIG. 24 is a diagram showing the position on the Bayer array of color difference signals used for calculating the peripheral similarity among the color differences calculated by interpolation; FIG. 24 is a calculation of the peripheral similarity of the color differences calculated by adjacent 4-pixel interpolation at the missing G signal position. It is a figure which shows the position on the Bayer arrangement | sequence of the color difference signal used for FIG.

こうして、メモリ210,211,212に色差の周辺類似度算出処理を実行可能なだけの色差信号が格納された時点で、メモリ210,211,212から色差信号X−Gv,X−Gh,XL−Gaが周辺類似度算出部213,214,215へそれぞれ出力される。   In this way, when the memory 210, 211, 212 stores the color difference signals sufficient to execute the color difference peripheral similarity calculation process, the memory 210, 211, 212 stores the color difference signals X-Gv, X-Gh, XL-. Ga is output to the peripheral similarity calculation units 213, 214, and 215, respectively.

周辺類似度算出部213は、最適色差選択手段、選択手段であって、欠落G画素位置(k,l)における色差周辺類似度Sv(k,l)を、図22に示すように、中央の色差信号(X−Gv)k,l(ここに、「(X−Gv)k,l」は、「X(k,l)−Gv(k,l)」を省略して記載したものである。以下同様。)とその周辺位置の8つの色差(X−Gv)k-2,l-2、(X−Gv)k,l-2、(X−Gv)k+2,l-2、(X−Gv)k-2,l、(X−Gv)k+2,l、(X−Gv)k-2,l+2、(X−Gv)k,l+2、(X−Gv)k+2,l+2とに基づくSv1(k,l)と、(X^−Gv)k-1,l-1、(X^−Gv)k+1,l-1、(X^−Gv)k-1,l+1、(X^−Gv)k+1,l+1に基づくSv2(k,l)と、の和として定義し算出する。
Sv(k,l)=Sv1(k,l)+Sv2(k,l)
Sv1(k,l)={|(X−Gv)k,l-2−(X−Gv)k,l|
+|(X−Gv)k,l+2−(X−Gv)k,l|}×WvcX
+{|(X−Gv)k-2,l-2−(X−Gv)k-2,l|
+|(X−Gv)k-2,l+2−(X−Gv)k-2,l|
+|(X−Gv)k+2,l-2−(X−Gv)k+2,l|
+|(X−Gv)k+2,l+2−(X−Gv)k+2,l|}×WvaX
Sv2(k,l)={|(X^−Gv)k-1,l-1−(X^−Gv)k-1,l+1|
+|(X^−Gv)k+1,l-1−(X^−Gv)k+1,l+1|}×WvX^
ここに、算出に用いられる重みであるWvcXとWvaXとWvX^とは、
WvcX+2×WvaX=WvX^
の関係にある。
The peripheral similarity calculation unit 213 is an optimum color difference selection unit, a selection unit, and calculates the color difference peripheral similarity Sv (k, l) at the missing G pixel position (k, l) as shown in FIG. Color difference signal (X-Gv) k, l (where "(X-Gv) k, l" is abbreviated as "X (k, l) -Gv (k, l)") The same applies hereinafter.) And eight color differences (X-Gv) k-2, l-2, (X-Gv) k, l-2, (X-Gv) k + 2, l-2, (X-Gv) k-2, l, (X-Gv) k + 2, l, (X-Gv) k-2, l + 2, (X-Gv) k, l + 2, (X-Gv ) Sv1 (k, l) based on k + 2, l + 2, (X ^ -Gv) k-1, l-1, (X ^ -Gv) k + 1, l-1, (X ^ It is defined and calculated as the sum of -Gv) k-1, l + 1 and (X ^ -Gv) k + 1, l + 1.
Sv (k, l) = Sv1 (k, l) + Sv2 (k, l)
Sv1 (k, l) = {| (X-Gv) k, l-2- (X-Gv) k, l |
+ | (X−Gv) k, l + 2− (X−Gv) k, l |} × WvcX
+ {| (X-Gv) k-2, l-2- (X-Gv) k-2, l |
+ | (X-Gv) k-2, l + 2- (X-Gv) k-2, l |
+ | (X−Gv) k + 2, l−2− (X−Gv) k + 2, l |
+ | (X−Gv) k + 2, l + 2− (X−Gv) k + 2, l |} × WvaX
Sv2 (k, l) = {| (X ^ -Gv) k-1, l-1- (X ^ -Gv) k-1, l + 1 |
+ | (X ^ −Gv) k + 1, l−1− (X ^ −Gv) k + 1, l + 1 |} × WvX ^
Here, the weights WvcX, WvaX and WvX ^ used for the calculation are
WvcX + 2 × WvaX = WvX ^
Are in a relationship.

同様に、周辺類似度算出部214は、最適色差選択手段、選択手段であって、欠落G画素位置(k,l)における色差周辺類似度Sh(k,l)を、図23に示すように、中央の色差信号(X−Gh)k,lとその周辺位置の8つの色差(X−Gh)k-2,l-2、(X−Gh)k,l-2、(X−Gh)k+2,l-2、(X−Gh)k-2,l、(X−Gh)k+2,l、(X−Gh)k-2,l+2、(X−Gh)k,l+2、(X−Gh)k+2,l+2とに基づくSh1(k,l)と、(X^−Gh)k-1,l-1、(X^−Gh)k+1,l-1、(X^−Gh)k-1,l+1、(X^−Gh)k+1,l+1に基づくSh2(k,l)と、の和として定義し算出する。
Sh(k,l)=Sh1(k,l)+Sh2(k,l)
Sh1(k,l)={|(X−Gh)k-2,l−(X−Gh)k,l|
+|(X−Gh)k+2,l−(X−Gh)k,l|}×WhcX
+{|(X−Gh)k-2,l-2−(X−Gh)k,l-2|
+|(X−Gh)k+2,l-2−(X−Gh)k,l-2|
+|(X−Gh)k-2,l+2−(X−Gh)k,l+2|
+|(X−Gh)k+2,l+2−(X−Gh)k,l+2|}×WhaX
Sh2(k,l)={|(X^−Gh)k-1,l-1−(X^−Gh)k+1,l-1|
+|(X^−Gh)k-1,l+1−(X^−Gh)k+1,l+1|}×WhX^
ここに、算出に用いられる重みであるWhcXとWhaXとWhX^とは、
WhcX+2×WhaX=WhX^
の関係にある。
Similarly, the peripheral similarity calculation unit 214 is an optimum color difference selection unit and selection unit, and the color difference peripheral similarity Sh (k, l) at the missing G pixel position (k, l) is shown in FIG. , Center color difference signal (X-Gh) k, l and its surrounding eight color differences (X-Gh) k-2, l-2, (X-Gh) k, l-2, (X-Gh) k + 2, l-2, (X-Gh) k-2, l, (X-Gh) k + 2, l, (X-Gh) k-2, l + 2, (X-Gh) k, Sh + (k, l) based on l + 2, (X-Gh) k + 2, l + 2, (X ^ -Gh) k-1, l-1, and (X ^ -Gh) k + 1 , l−1, (X ^ −Gh) k−1, l + 1, and (X ^ −Gh) k + 1, l + 1, and Sh2 (k, l).
Sh (k, l) = Sh1 (k, l) + Sh2 (k, l)
Sh1 (k, l) = {| (X-Gh) k-2, l- (X-Gh) k, l |
+ | (X−Gh) k + 2, l− (X−Gh) k, l |} × WhcX
+ {| (X-Gh) k-2, l-2- (X-Gh) k, l-2 |
+ | (X-Gh) k + 2, l-2- (X-Gh) k, l-2 |
+ | (X-Gh) k-2, l + 2- (X-Gh) k, l + 2 |
+ | (X−Gh) k + 2, l + 2− (X−Gh) k, l + 2 |} × WhaX
Sh2 (k, l) = {| (X ^ -Gh) k-1, l-1- (X ^ -Gh) k + 1, l-1 |
+ | (X ^ -Gh) k-1, l + 1- (X ^ -Gh) k + 1, l + 1 |} × WhX ^
Here, WhcX, WhaX and WhX ^ which are weights used for calculation are
WhcX + 2 × WhaX = WhX ^
Are in a relationship.

さらに、周辺類似度算出部215は、最適色差選択手段、選択手段であって、欠落G画素位置(k,l)における色差周辺類似度Sa(k,l)を、図24に示すように、中央の色差信号(XL−Ga)k,lとその周辺位置の8つの色差(XL−Ga)k-2,l-2、(XL−Ga)k,l-2、(XL−Ga)k+2,l-2、(XL−Ga)k-2,l、(XL−Ga)k+2,l、(XL−Ga)k-2,l+2、(XL−Ga)k,l+2、(XL−Ga)k+2,l+2とに基づくSa1(k,l)と、(X^L−Ga)k-1,l-1、(X^L−Ga)k+1,l-1、(X^L−Ga)k-1,l+1、(X^L−Ga)k+1,l+1に基づくSa2(k,l)と、の和として定義し算出する。
Sa(k,l)=Sa1(k,l)+Sa2(k,l)
Sa1(k,l)={|(XL−Ga)k-2,l-2−(XL−Ga)k,l|
+|(XL−Ga)k,l-2−(XL−Ga)k,l|
+|(XL−Ga)k+2,l-2−(XL−Ga)k,l|
+|(XL−Ga)k-2,l−(XL−Ga)k,l|
+|(XL−Ga)k+2,l−(XL−Ga)k,l|
+|(XL−Ga)k-2,l+2−(XL−Ga)k,l|
+|(XL−Ga)k,l+2−(XL−Ga)k,l|
+|(XL−Ga)k+2,l+2−(XL−Ga)k,l|}×WaX
Sa2(k,l)={|(X^L−Ga)k-1,l-1−(X^L−Ga)k+1,l+1|
+|(X^L−Ga)k-1,l+1−(X^L−Ga)k+1,l-1|}×WaX^
ここに、算出に用いられる重みであるWaXとWaX^とは、
4×WaX=WaX^
の関係にある。
Further, the peripheral similarity calculation unit 215 is an optimum color difference selection unit and selection unit, and the color difference peripheral similarity Sa (k, l) at the missing G pixel position (k, l) is shown in FIG. Central color difference signal (XL-Ga) k, l and eight color differences (XL-Ga) k-2, l-2, (XL-Ga) k, l-2, (XL-Ga) k + 2, l-2, (XL-Ga) k-2, l, (XL-Ga) k + 2, l, (XL-Ga) k-2, l + 2, (XL-Ga) k, l +2, (XL-Ga) k + 2, l + 2, Sa1 (k, l), (X ^ L-Ga) k-1, l-1, and (X ^ L-Ga) k + 1, l-1, (X ^ L-Ga) k-1, l + 1, and (X ^ L-Ga) K + 1, l + 1 based on Sa2 (k, l) calculate.
Sa (k, l) = Sa1 (k, l) + Sa2 (k, l)
Sa1 (k, l) = {| (XL-Ga) k-2, l-2- (XL-Ga) k, l |
+ | (XL-Ga) k, l-2- (XL-Ga) k, l |
+ | (XL-Ga) k + 2, l-2- (XL-Ga) k, l |
+ | (XL-Ga) k-2, l- (XL-Ga) k, l |
+ | (XL-Ga) k + 2, l- (XL-Ga) k, l |
+ | (XL-Ga) k-2, l + 2- (XL-Ga) k, l |
+ | (XL-Ga) k, l + 2- (XL-Ga) k, l |
+ | (XL-Ga) k + 2, l + 2- (XL-Ga) k, l |} × Wax
Sa2 (k, l) = {| (X ^ L-Ga) k-1, l-1- (X ^ L-Ga) k + 1, l + 1 |
+ | (X ^ L-Ga) k-1, l + 1- (X ^ L-Ga) k + 1, l-1 |} × Wax
Here, WaX and WaX ^ which are weights used for calculation are
4 x WaX = WaX ^
Are in a relationship.

このようにして算出された3つの色差周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)の内の、Sv(k,l)およびSh(k,l)はそのまま直接、Sa(k,l)は最適色差選択手段であり乗算手段たる乗算部218によりメモリ217に格納されているG変動量重み係数w(k,l)と乗算された後に、それぞれ判定部219に入力される。   Of the three color difference peripheral similarities Sv (k, l), Sh (k, l) and Sa (k, l) calculated in this way, Sv (k, l) and Sh (k, l) Is directly determined, and Sa (k, l) is an optimum color difference selection means and is multiplied by the G variation amount weighting coefficient w (k, l) stored in the memory 217 by the multiplication section 218 as the multiplication means, respectively, and then determined. Input to the unit 219.

ここで、G変動量重み係数w(k,l)について説明する。   Here, the G variation amount weighting coefficient w (k, l) will be described.

G変動量算出部216は、最適色差選択手段、G画素変動量算出手段であって、メモリ202に格納されているGs信号の内の、図25に示すような欠落G画素位置(i,j)の周辺に配置されたGs信号を読み込んで、次に示すようにG変動量(i,j)を算出する。ここに、図25はG変動量算出部216によって使用するG信号のベイヤ配列上の位置を示す図である。
G変動量(i,j)=Dc(i,j)/P
+{Dr1(i,j)+Dr2(i,j)+Dr3(i,j)+Dr4(i,j)}/Q
ここに、Pは中央部分の変動量の重み係数、Qは周辺部分の変動量の重み係数であり、P>0、Q>0を満たす任意の定数である。そして、
Dc(i,j)=|Gs(i−1,j)−Gs(i,j−1)
+Gs(i+1,j)−Gs(i,j+1)|
+|Gs(i−1,j)+Gs(i,j−1)
−Gs(i+1,j)−Gs(i,j+1)|
+|Gs(i−1,j)−Gs(i,j−1)
−Gs(i+1,j)+Gs(i,j+1)|
Dr1(i,j)=|Gs(i−2,j−1)−Gs(i−1,j−2)
+Gs(i,j−1)−Gs(i−1,j)|
+|Gs(i−2,j−1)+Gs(i−1,j−2)
−Gs(i,j−1)−Gs(i−1,j)|
+|Gs(i−2,j−1)−Gs(i−1,j−2)
−Gs(i,j−1)+Gs(i−1,j)|
Dr2(i,j)=|Gs(i,j−1)−Gs(i+1,j−2)
+Gs(i+2,j−1)−Gs(i+1,j)|
+|Gs(i,j−1)+Gs(i+1,j−2)
−Gs(i+2,j−1)−Gs(i+1,j)|
+|Gs(i,j−1)−Gs(i+1,j−2)
−Gs(i+2,j−1)+Gs(i+1,j)|
Dr3(i,j)=|Gs(i,j+1)−Gs(i+1,j)
+Gs(i+2,j+1)−Gs(i+1,j+2)|
+|Gs(i,j+1)+Gs(i+1,j)
−Gs(i+2,j+1)−Gs(i+1,j+2)|
+|Gs(i,j+1)−Gs(i+1,j)
−Gs(i+2,j+1)+Gs(i+1,j+2)|
Dr4(i,j)=|Gs(i−2,j+1)−Gs(i−1,j)
+Gs(i,j+1)−Gs(i−1,j+2)|
+|Gs(i−2,j+1)+Gs(i−1,j)
−Gs(i,j+1)−Gs(i−1,j+2)|
+|Gs(i−2,j+1)−Gs(i−1,j)
−Gs(i,j+1)+Gs(i−1,j+2)|
である。
The G variation amount calculation unit 216 is an optimum color difference selection unit and a G pixel variation amount calculation unit, and among the Gs signals stored in the memory 202, a missing G pixel position (i, j) as shown in FIG. ) Is read, and the G fluctuation amount (i, j) is calculated as shown below. FIG. 25 is a diagram showing the position of the G signal used by the G fluctuation amount calculation unit 216 on the Bayer array.
G variation (i, j) = Dc (i, j) / P
+ {Dr1 (i, j) + Dr2 (i, j) + Dr3 (i, j) + Dr4 (i, j)} / Q
Here, P is a weighting coefficient for the fluctuation amount in the central portion, Q is a weighting coefficient for the fluctuation amount in the peripheral portion, and is an arbitrary constant satisfying P> 0 and Q> 0. And
Dc (i, j) = | Gs (i-1, j) -Gs (i, j-1)
+ Gs (i + 1, j) -Gs (i, j + 1) |
+ | Gs (i-1, j) + Gs (i, j-1)
−Gs (i + 1, j) −Gs (i, j + 1) |
+ | Gs (i-1, j) -Gs (i, j-1)
−Gs (i + 1, j) + Gs (i, j + 1) |
Dr1 (i, j) = | Gs (i-2, j-1) -Gs (i-1, j-2)
+ Gs (i, j-1) -Gs (i-1, j) |
+ | Gs (i-2, j-1) + Gs (i-1, j-2)
−Gs (i, j−1) −Gs (i−1, j) |
+ | Gs (i-2, j-1) -Gs (i-1, j-2)
-Gs (i, j-1) + Gs (i-1, j) |
Dr2 (i, j) = | Gs (i, j-1) -Gs (i + 1, j-2)
+ Gs (i + 2, j-1) -Gs (i + 1, j) |
+ | Gs (i, j-1) + Gs (i + 1, j-2)
−Gs (i + 2, j−1) −Gs (i + 1, j) |
+ | Gs (i, j-1) -Gs (i + 1, j-2)
−Gs (i + 2, j−1) + Gs (i + 1, j) |
Dr3 (i, j) = | Gs (i, j + 1) -Gs (i + 1, j)
+ Gs (i + 2, j + 1) -Gs (i + 1, j + 2) |
+ | Gs (i, j + 1) + Gs (i + 1, j)
−Gs (i + 2, j + 1) −Gs (i + 1, j + 2) |
+ | Gs (i, j + 1) -Gs (i + 1, j)
-Gs (i + 2, j + 1) + Gs (i + 1, j + 2) |
Dr4 (i, j) = | Gs (i-2, j + 1) -Gs (i-1, j)
+ Gs (i, j + 1) -Gs (i-1, j + 2) |
+ | Gs (i-2, j + 1) + Gs (i-1, j)
−Gs (i, j + 1) −Gs (i−1, j + 2) |
+ | Gs (i-2, j + 1) -Gs (i-1, j)
-Gs (i, j + 1) + Gs (i-1, j + 2) |
It is.

G変動量算出部216は、このように算出した上記G変動量(i,j)に基づいて、図26に示すような形状の関数を用いて、重み係数w(i,j)を算出する。ここに、図26は、G変動量算出部216において算出するG変動量と、隣接4画素補間を用いて算出した周辺類似度に対する重み係数と、の関係を示す線図である。この図26に示す関数は、G変動量が所定の閾値Th以上である場合には重みを1とし、G変動量がこの閾値Th未満である場合にはG変動量に比例するような(つまり、G変動量が小さくなるに従って、重みが小さくなるような)、関数となっている。このようなG変動量に対する重み係数w(i,j)の関係は、所定の計算式に基づき算出されるか、あるいは予め記憶されているルックアップテーブルを参照することにより変換されるようになっている。   Based on the G variation amount (i, j) calculated in this way, the G variation amount calculation unit 216 calculates a weight coefficient w (i, j) using a function having a shape as shown in FIG. . FIG. 26 is a diagram showing the relationship between the G fluctuation amount calculated by the G fluctuation amount calculation unit 216 and the weighting coefficient for the peripheral similarity calculated using the adjacent four-pixel interpolation. The function shown in FIG. 26 sets the weight to 1 when the G fluctuation amount is equal to or greater than the predetermined threshold Th, and is proportional to the G fluctuation amount when the G fluctuation amount is less than the threshold Th (that is, , The weight becomes smaller as the G variation becomes smaller). Such a relationship of the weight coefficient w (i, j) with respect to the G fluctuation amount is calculated based on a predetermined calculation formula or converted by referring to a lookup table stored in advance. ing.

G変動量算出部216が算出した重み係数w(i,j)は、メモリ217に出力されて格納される。   The weighting coefficient w (i, j) calculated by the G variation calculation unit 216 is output to the memory 217 and stored.

このように、4画素補間Gaを使用して求めた色差XL−Gaの周辺類似度Saに1以下の重み係数wを乗算することにより、G変動量が所定閾値Th未満の場合(すなわち、w<1の場合)にはSa×wはSa単体よりも小さい値となるために、判定部219の判定においてSa×wが最小値となる可能性が増大することになる。つまり、G変動量が小さい平坦な領域においては、縦補間Gや横補間Gが選択される可能性が低減され、4画素補間Gがより高い確率で選択されて、ノイズによる影響がキャンセルされるようになっている。   As described above, when the G variation amount is less than the predetermined threshold Th by multiplying the peripheral similarity Sa of the color difference XL−Ga obtained by using the 4-pixel interpolation Ga by a weighting coefficient w of 1 or less (that is, w In the case of <1>, Sa × w becomes a value smaller than that of Sa alone, so that the possibility that Sa × w becomes the minimum value in the determination by the determination unit 219 increases. That is, in a flat region where the amount of G fluctuation is small, the possibility of selecting vertical interpolation G or horizontal interpolation G is reduced, and 4-pixel interpolation G is selected with a higher probability, and the influence of noise is cancelled. It is like that.

最適色差選択手段たる判定部219は、上述したような3つの色差周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)×w(k,l)の値を比較して、最小となる色差周辺類似度を与えるG補間方法を1つ選択し、選択した補間方法に対応する選択信号を、色差選択部220へ出力する。なお、最小となる色差周辺類似度が複数存在する場合には、判定部219は、例えばSa(k,l)×w(k,l)、Sh(k,l)、Sv(k,l)の順番で優先順位の高さを決めて、この優先順位に沿ってG補間方法を1つ選択するようになっている。   The determination unit 219 serving as the optimum color difference selection unit calculates the values of the three color difference peripheral similarities Sv (k, l), Sh (k, l), and Sa (k, l) × w (k, l) as described above. In comparison, one G interpolation method that gives the minimum color difference peripheral similarity is selected, and a selection signal corresponding to the selected interpolation method is output to the color difference selection unit 220. When there are a plurality of minimum color difference peripheral similarities, the determination unit 219 determines, for example, Sa (k, l) × w (k, l), Sh (k, l), Sv (k, l). The order of priority is determined in this order, and one G interpolation method is selected along this priority.

色差選択部220は、最適色差選択手段、選択手段であって、判定部219から入力される選択信号に基づいて、該選択信号に対応する1つの欠落G画素位置(k,l)の色差候補、すなわち、メモリ210に記憶されている色差候補(X−Gv)k,l、メモリ211に記憶されている色差候補(X−Gh)k,l、メモリ212に記憶されている色差候補(XL−Ga)k,lの何れかを選択して入力し、色差補間処理部103へ色差として出力する。より具体的には、色差選択部220は、色差周辺類似度Sv(k,l)が最小である場合には(X−Gv)k,lを、Sh(k,l)が最小である場合には(X−Gh)k,lを、Sa(k,l)×w(k,l)が最小である場合には(XL−Ga)k,lを、減算部223と色差補間処理部103とへそれぞれ出力するようになっている。なお、色差信号は、図7に示したような2次元配列における左上から右下へのラスタスキャン順で出力される。   The color difference selection unit 220 is an optimum color difference selection unit, a selection unit, and based on the selection signal input from the determination unit 219, the color difference candidate of one missing G pixel position (k, l) corresponding to the selection signal That is, the color difference candidate (X−Gv) k, l stored in the memory 210, the color difference candidate (X−Gh) k, l stored in the memory 211, and the color difference candidate (XL) stored in the memory 212 -Ga) Either k or l is selected and input, and is output as a color difference to the color difference interpolation processing unit 103. More specifically, the color difference selection unit 220 sets (X−Gv) k, l when the color difference peripheral similarity Sv (k, l) is the minimum, and sh (k, l) when the Sh (k, l) is the minimum. (X−Gh) k, l, and when Sa (k, l) × w (k, l) is minimum, (XL−Ga) k, l is subtracted by the subtracting unit 223 and the color difference interpolation processing unit. 103, respectively. The color difference signals are output in the raster scan order from the upper left to the lower right in the two-dimensional array as shown in FIG.

色差選択部220から色差補間処理部103へ出力された色差信号は、色差補間処理部103においてR−GiとB−Giとに分けられ、R−Giが欠落している画素位置については周辺のR−Giを用いて補間され、同様に、B−Giが欠落している画素位置については周辺のB−Giを用いて補間される。   The color difference signal output from the color difference selection unit 220 to the color difference interpolation processing unit 103 is divided into R-Gi and B-Gi in the color difference interpolation processing unit 103, and the pixel position where R-Gi is missing is the peripheral. Interpolation is performed using R-Gi, and similarly, pixel positions where B-Gi is missing are interpolated using neighboring B-Gi.

さらに、メモリ221は、撮像画素として存在するX画素値の一時退避用であって、上述した色差信号X−Gv、またはX−Gh、またはXL−Gaの何れか1つが選択され出力されるタイミングに合わせるためのものである。   Further, the memory 221 is for temporarily saving the X pixel value existing as the imaging pixel, and the timing at which any one of the color difference signals X-Gv, X-Gh, or XL-Ga described above is selected and output. It is for adjusting to.

続いて、減算部223は、色差選択部220から出力される色差X−Gv、またはX−Gh、またはXL−Gaと、この色差と同一画素位置のXと、に基づき以下に示すような減算処理を行い、欠落G画素位置のGi信号を算出する減算手段である。
色差X−Gvが選択された場合 :Gi=X−(X−Gv)
色差X−Ghが選択された場合 :Gi=X−(X−Gh)
色差XL−Gaが選択された場合 :Gi=X−(XL−Ga)
Subsequently, the subtraction unit 223 performs subtraction as shown below based on the color difference X-Gv, X-Gh, or XL-Ga output from the color difference selection unit 220 and X at the same pixel position as this color difference. Subtracting means that performs processing and calculates a Gi signal at the position of the missing G pixel.
When color difference X-Gv is selected: Gi = X- (X-Gv)
When color difference X-Gh is selected: Gi = X- (X-Gh)
When color difference XL-Ga is selected: Gi = X- (XL-Ga)

また、メモリ222は、撮像画素として存在するGs画素の一時退避用であって、上述した欠落G画素位置に対するGiが算出され出力されるタイミングに合わせるためのものである。   The memory 222 is for temporarily saving Gs pixels existing as image pickup pixels, and is for adjusting the timing at which Gi for the above-mentioned missing G pixel position is calculated and output.

こうして、図6に示すような欠落のない2次元配列のG信号が、左上から右下へのラスタスキャン順でRGB算出部104へ出力される。   Thus, a two-dimensional array of G signals having no omission as shown in FIG. 6 is output to the RGB calculation unit 104 in the raster scan order from the upper left to the lower right.

次に、図3は、色差補間処理部103の構成を示すブロック図である。   Next, FIG. 3 is a block diagram illustrating a configuration of the color difference interpolation processing unit 103.

色差補間処理部103は、色差選別部301と、メモリ302と、メモリ303と、補間算出部304と、補間算出部305と、を有している。   The color difference interpolation processing unit 103 includes a color difference selection unit 301, a memory 302, a memory 303, an interpolation calculation unit 304, and an interpolation calculation unit 305.

G補間色差算出部102からの色差信号X−Giは、色差補間処理部103の色差選別部301に入力されるようになっている。色差選別部301は、色差信号X−Giが入力されると、該色差信号X−GiがR−Giである場合にはメモリ302へ、色差信号X−GiがB−Giである場合にはメモリ303へ、それぞれ分けて出力する。   The color difference signal X-Gi from the G interpolation color difference calculation unit 102 is input to the color difference selection unit 301 of the color difference interpolation processing unit 103. When the color difference signal X-Gi is input, the color difference selection unit 301 inputs the color difference signal X-Gi to the memory 302 when the color difference signal X-Gi is R-Gi, and when the color difference signal X-Gi is B-Gi. Separately output to the memory 303.

メモリ302は、色差選別部301から色差信号R−Giが入力されると、それを記憶する。このとき、メモリ302は、色差信号R−Giの欠落画素部分を補間処理するために必要なライン数分を記憶することができるようなメモリ容量のものとなっている。   When the color difference signal R-Gi is input from the color difference selection unit 301, the memory 302 stores it. At this time, the memory 302 has a memory capacity that can store the number of lines necessary for interpolation processing of the missing pixel portion of the color difference signal R-Gi.

同様に、メモリ303は、色差選別部301から色差信号B−Giが入力されると、それを記憶する。このとき、メモリ303は、色差信号B−Giの欠落画素部分を補間処理するために必要なライン数分を記憶することができるようなメモリ容量のものとなっている。   Similarly, when the color difference signal B-Gi is input from the color difference selection unit 301, the memory 303 stores it. At this time, the memory 303 has a memory capacity that can store the number of lines necessary for interpolation processing of the missing pixel portion of the color difference signal B-Gi.

こうして、補間処理が開始可能となった時点で、メモリ302,303から、補間処理に必要な画素データが、補間算出部304,305へそれぞれ出力される。   Thus, when the interpolation process can be started, pixel data necessary for the interpolation process is output from the memories 302 and 303 to the interpolation calculation units 304 and 305, respectively.

補間算出部304は、例えば次に示すような線形補間式を用いることにより色差信号R−Gの補間を行い、全ての画素位置における色差信号R−Gを生成して、RGB算出部104へ出力する。

Figure 0005032914
ここに、Noは、上述した3×3行列内における非欠落画素R−Giの数である。なお、欠落位置におけるR−Giの値はゼロである。 The interpolation calculation unit 304 performs interpolation of the color difference signal RG by using, for example, the following linear interpolation formula, generates the color difference signal RG at all pixel positions, and outputs the color difference signal RG to the RGB calculation unit 104. To do.
Figure 0005032914
Here, No is the number of non-missing pixels R-Gi in the 3 × 3 matrix described above. Note that the value of R-Gi at the missing position is zero.

同様に、補間算出部305は、例えば次に示すような線形補間式を用いることにより色差信号B−Gの補間を行い、全ての画素位置における色差信号B−Gを生成して、RGB算出部104へ出力する。

Figure 0005032914
ここに、Noは、上述した3×3行列内における非欠落画素B−Giの数である。なお、欠落位置におけるB−Giの値はゼロである。 Similarly, the interpolation calculation unit 305 interpolates the color difference signal BG by using, for example, a linear interpolation formula as shown below, generates the color difference signal BG at all pixel positions, and generates an RGB calculation unit. To 104.
Figure 0005032914
Here, No is the number of non-missing pixels B-Gi in the 3 × 3 matrix described above. Note that the value of B-Gi at the missing position is zero.

次に、図4は、RGB算出部104の構成を示すブロック図である。   Next, FIG. 4 is a block diagram illustrating a configuration of the RGB calculation unit 104.

RGB算出部104は、メモリ401と、加算部402と、加算部403と、カラーマトリックス処理部404と、γ補正部405と、γ補正部406と、γ補正部407と、を有している。   The RGB calculation unit 104 includes a memory 401, an addition unit 402, an addition unit 403, a color matrix processing unit 404, a γ correction unit 405, a γ correction unit 406, and a γ correction unit 407. .

G補間色差算出部102からのG信号は、RGB算出部104のメモリ401に入力されて格納される。このメモリ401は、色差補間処理部103からG信号と同一画素位置の色差信号R−G、および色差信号B−Gが入力されるまで、該G信号を保持しておくためのものである(つまり、遅延用として機能するものである)。   The G signal from the G interpolation color difference calculation unit 102 is input and stored in the memory 401 of the RGB calculation unit 104. This memory 401 is for holding the G signal until the color difference signal RG and the color difference signal BG at the same pixel position as the G signal are input from the color difference interpolation processing unit 103 ( That is, it functions as a delay).

また、色差補間処理部103からの色差信号R−Gは、RGB算出部104の加算部402に入力される。すると、加算部402は、入力された色差信号R−Gと同一位置のG信号をメモリ401から読み出して、色差信号R−GとG信号とを加算することによりR信号を生成し、カラーマトリックス処理部404へ出力する。   Further, the color difference signal RG from the color difference interpolation processing unit 103 is input to the addition unit 402 of the RGB calculation unit 104. Then, the adding unit 402 reads out the G signal at the same position as the input color difference signal RG from the memory 401, adds the color difference signal RG and the G signal, generates an R signal, and generates a color matrix. The data is output to the processing unit 404.

さらに、色差補間処理部103からの色差信号B−Gは、RGB算出部104の加算部403に入力される。すると、加算部403は、入力された色差信号B−Gと同一位置のG信号をメモリ401から読み出して、色差信号B−GとG信号とを加算することによりB信号を生成し、カラーマトリックス処理部404へ出力する。   Further, the color difference signal BG from the color difference interpolation processing unit 103 is input to the addition unit 403 of the RGB calculation unit 104. Then, the adder 403 reads out the G signal at the same position as the input color difference signal BG from the memory 401, adds the color difference signal BG and the G signal, generates a B signal, and generates a color matrix. The data is output to the processing unit 404.

そして、メモリ401は、加算部402により算出されたR信号および加算部403により算出されたB信号と同一画素位置のG信号を、カラーマトリックス処理部404へ出力する。   Then, the memory 401 outputs the R signal calculated by the adding unit 402 and the G signal at the same pixel position as the B signal calculated by the adding unit 403 to the color matrix processing unit 404.

このような処理を行うことにより、各画素位置におけるR信号、G信号、B信号が復元されることになる。   By performing such processing, the R signal, the G signal, and the B signal at each pixel position are restored.

カラーマトリックス処理部404は、復元されたR信号、G信号、およびB信号が入力されると、これらを例えばsRGB空間等の所定の色空間の信号に変換する。そして、カラーマトリックス処理部404は、変換したR信号をγ補正部405へ、変換したB信号をγ補正部406へ、変換したG信号をγ補正部407へ、それぞれ出力する。   When the restored R signal, G signal, and B signal are input, the color matrix processing unit 404 converts them into signals in a predetermined color space such as an sRGB space. Then, the color matrix processing unit 404 outputs the converted R signal to the γ correction unit 405, the converted B signal to the γ correction unit 406, and the converted G signal to the γ correction unit 407, respectively.

γ補正部405,406,407は、カラーマトリックス処理部404から入力される変換後のR,B,G信号が例えば12ビットの信号であるとすると、これらの信号をそれぞれγ補正して8ビットに変換されたRγ信号、Bγ信号、Gγ信号をそれぞれ生成し、圧縮記録部105へ出力する。   If the converted R, B, and G signals input from the color matrix processing unit 404 are, for example, 12-bit signals, the γ correction units 405, 406, and 407 respectively perform γ correction on these signals to obtain 8 bits. R γ signal, B γ signal, and G γ signal converted to γ are generated and output to the compression recording unit 105.

その後の圧縮記録部105による処理は、上述した通りである。   The subsequent processing by the compression recording unit 105 is as described above.

次に、図29は、図2に示す構成のG補間色差算出部102により行われる処理を示すフローチャートである。   Next, FIG. 29 is a flowchart showing processing performed by the G interpolation color difference calculation unit 102 having the configuration shown in FIG.

このG補間色差算出部102には、撮像部101により撮像されてメモリに格納されている単板ベイヤ配列画像が、ラスタスキャン順に入力されるようになっている。そして、G補間色差算出部102は、上述したように、ラスタスキャン順に入力される単板ベイヤ配列画像の内の、Rs信号およびBs信号をメモリ201に、Gs信号をメモリ202に、所定データ分だけそれぞれ格納するようになっている。   The G-interpolation color difference calculation unit 102 is input with the single-plate Bayer array image captured by the imaging unit 101 and stored in the memory in the raster scan order. Then, as described above, the G interpolation color difference calculation unit 102 stores the Rs signal and the Bs signal in the memory 201 and the Gs signal in the memory 202 in the single-plate Bayer array image input in the raster scan order. Only to store each one.

このように、メモリ201,202に所定データ分が格納されている状態において、欠落G信号の補間候補値と色差候補値とをメモリに格納するライン数×ライン画素数=N画素数を所定の初期値(本実施形態ではライン数の初期値=5)にセット(ステップS2900)する。   As described above, in a state where the predetermined amount of data is stored in the memories 201 and 202, the interpolation candidate value and the color difference candidate value of the missing G signal are stored in the memory. The number of lines × the number of line pixels = the number of N pixels is predetermined. The initial value (in this embodiment, the initial value of the number of lines = 5) is set (step S2900).

次に、G信号欠落位置(i,j)に対して、図19に示すような上下に隣接するG信号の平均値Gv(i,j)を補間候補として算出し、G信号欠落位置(i,j)にあるX(i,j)(XはR信号またはB信号を示す)と該補間候補Gv(i,j)とに基づき色差(X−Gv)i,jを算出して、メモリ210に格納する(ステップS2901)。   Next, an average value Gv (i, j) of vertically adjacent G signals as shown in FIG. 19 is calculated as an interpolation candidate for the G signal missing position (i, j), and the G signal missing position (i , J) calculates a color difference (X−Gv) i, j based on X (i, j) (where X represents an R signal or B signal) and the interpolation candidate Gv (i, j), and the memory 210 is stored (step S2901).

続いて、G信号欠落位置(i,j)に対して、図20に示すような左右に隣接するG信号の平均値Gh(i,j)を補間候補として算出し、G信号欠落位置(i,j)にあるX(i,j)(XはR信号またはB信号を示す)と該補間候補Gh(i,j)とに基づき色差(X−Gh)i,jを算出して、メモリ211に格納する(ステップS2902)。   Subsequently, for the G signal missing position (i, j), an average value Gh (i, j) of the G signals adjacent to the left and right as shown in FIG. 20 is calculated as an interpolation candidate, and the G signal missing position (i , J) calculates a color difference (X−Gh) i, j based on X (i, j) (where X represents an R signal or B signal) and the interpolation candidate Gh (i, j), and the memory It stores in 211 (step S2902).

さらに、G信号欠落位置(i,j)に対して、図21に示すような上下左右に隣接するG信号の平均値Ga(i,j)を補間候補として算出し、G信号欠落位置(i,j)にあるX(i,j)(XはR信号またはB信号を示す)とその周辺上下左右のX(i−2,j),X(i+2,j),X(i,j−2),X(i,j+2)とを用いて斜め45度方向の周波数特性を該平均値Ga(i,j)算出時の補間フィルタの特性に近似させる帯域制限処理(ローパスフィルタ)を実施し、算出したXL(i,j)と該補間候補Ga(i,j)とに基づき色差(XL−Ga)i,jを算出して、メモリ212に格納する(ステップS2903)。   Further, for the G signal missing position (i, j), an average value Ga (i, j) of G signals adjacent vertically and horizontally as shown in FIG. 21 is calculated as an interpolation candidate, and the G signal missing position (i , J) and X (i, j), X (i-2, j), X (i + 2, j), X (i, j−) 2) and X (i, j + 2) are used to perform a band limiting process (low-pass filter) that approximates the frequency characteristic in the oblique 45 degree direction to the characteristic of the interpolation filter when calculating the average value Ga (i, j). The color difference (XL−Ga) i, j is calculated based on the calculated XL (i, j) and the interpolation candidate Ga (i, j) and stored in the memory 212 (step S2903).

そして、G信号欠落位置(i,j)に対して周辺12画素のG信号に基づいてG変動量を算出し、該G変動量に対応する重み係数w(i,j)に変換して、メモリ217に格納する(ステップS2904)。   Then, the G variation amount is calculated based on the G signal of the surrounding 12 pixels with respect to the G signal missing position (i, j), converted into a weighting coefficient w (i, j) corresponding to the G variation amount, The data is stored in the memory 217 (step S2904).

この時点で、N画素分の処理が終了したか否かを判定する(ステップS2905)。   At this time, it is determined whether or not the processing for N pixels has been completed (step S2905).

ここで、N画素分の処理がまだ終了していない場合には上述したステップS2901に戻って、(X−Gv)i,j、(X−Gh)i,j、(XL−Ga)i,j、w(i,j)を算出してメモリに格納する処理を続けて行う。   If the processing for N pixels has not been completed yet, the process returns to step S2901, and (X-Gv) i, j, (X-Gh) i, j, (XL-Ga) i, The process of calculating j and w (i, j) and storing them in the memory is continued.

一方、ステップS2905において、N画素分の処理が終了したと判定された場合には、Nを1にセットする(ステップS2906)。   On the other hand, if it is determined in step S2905 that the processing for N pixels has been completed, N is set to 1 (step S2906).

そして、メモリに格納されているG信号欠落位置(k,l)の同一補間種(Xが同一色であってかつGの種類が同一のGvである)により算出された色差(X−Gv)k,lと、その近傍8方向の同種色差(X−Gv)k+n,l+m(ここに、n=−2,0,2、m=−2,0,2であってかつnとmとは同時には0にならない。)と、に基づいて周辺類似度Sv1(k,l)を算出するとともに、色差(X−Gv)k,lの周辺異種色差、つまり色がXとは異なる色X^であってかつGの種類が同一のGvである色差(X^−Gv)k+n,l+m(ここに、n=−1,1、m=−1,1)に基づいて周辺類似度Sv2(k,l)を算出して、これら2つの周辺類似度Sv1(k,l)とSv2(k,l)とを加算して周辺類似度Sv(k,l)を算出する(ステップS2907)。   Then, the color difference (X−Gv) calculated by the same interpolation type (X is the same color and G type is the same Gv) of the G signal missing position (k, l) stored in the memory. k, l and the same kind of color difference (X−Gv) k + n, l + m in the eight directions nearby (where n = −2, 0, 2, m = −2, 0, 2 and n And m are not equal to 0 at the same time), and the peripheral similarity Sv1 (k, l) is calculated based on the above, and the peripheral different color difference of the color difference (X−Gv) k, l, that is, the color is X Color difference (X ^ −Gv) k + n, l + m (where n = −1, 1, m = −1, 1) of different colors X ^ and G having the same Gv Based on this, the peripheral similarity Sv2 (k, l) is calculated, and these two peripheral similarities Sv1 (k, l) and Sv2 (k, l) are added to obtain the peripheral similarity Sv (k, l). Calculate (step S2907).

続いて、メモリに格納されているG信号欠落位置(k,l)の同一補間種(Xが同一色であってかつGの種類が同一のGhである)により算出された色差(X−Gh)k,lとその近傍8方向の同種色差(X−Gh)k+n,l+m(ここに、n=−2,0,2、m=−2,0,2であってかつnとmとは同時には0にならない。)と、に基づいて周辺類似度Sh1(k,l)を算出するとともに、色差(X−Gh)k,lの周辺異種色差、つまり色がXとは異なる色X^であってかつGの種類が同一のGhである色差(X^−Gh)k+n,l+m(ここに、n=−1,1、m=−1,1)に基づいて周辺類似度Sh2(k,l)を算出して、これら2つの周辺類似度Sh1(k,l)とSh2(k,l)とを加算して周辺類似度Sh(k,l)を算出する(ステップS2908)。   Subsequently, the color difference (X−Gh) calculated by the same interpolation type (X is the same color and G type is the same Gh) of the G signal missing position (k, l) stored in the memory. ) K, l and its adjacent eight-direction color difference (X−Gh) k + n, l + m (where n = −2, 0, 2, m = −2, 0, 2 and n And m are not equal to 0 at the same time) and the peripheral similarity Sh1 (k, l) is calculated based on the above, and the peripheral different color difference of the color difference (X−Gh) k, l, that is, the color is X Color difference (X ^ −Gh) k + n, l + m (where n = −1, 1, m = −1, 1) of different colors X ^ and G having the same Gh Based on this, the peripheral similarity Sh2 (k, l) is calculated, and these two peripheral similarities Sh1 (k, l) and Sh2 (k, l) are added to obtain the peripheral similarity Sh (k, l). Calculate (step S2908).

さらに、メモリに格納されているG信号欠落位置(k,l)の同一補間種(XLが同一色であってかつGの種類が同一のGaである)により算出された色差(XL−Ga)k,lとその近傍8方向の同種色差(XL−Ga)k+n,l+m(ここに、n=−2,0,2、m=−2,0,2であってかつnとmとは同時には0にならない。)と、に基づいて周辺類似度Sa1(k,l)を算出するとともに、色差(XL−Ga)k,lの周辺異種色差、つまり色がXLとは異なる色X^LであってかつGの種類が同一のGaである色差(X^L−Ga)k+n,l+m(ここに、n=−1,1、m=−1,1)に基づいて周辺類似度Sa2(k,l)を算出して、これら2つの周辺類似度Sa1(k,l)とSa2(k,l)とを加算して周辺類似度Sa(k,l)を算出し、さらに、メモリ217に格納されているG変動量重み係数w(k,l)と乗算する(ステップS2909)。   Further, the color difference (XL−Ga) calculated by the same interpolation type (XL is the same color and G type is the same Ga) of the G signal missing position (k, l) stored in the memory. k, l and the same kind of color difference (XL−Ga) k + n, l + m in the eight directions nearby (where n = −2, 0, 2, m = −2, 0, 2 and n m is not 0 at the same time.) and the peripheral similarity Sa1 (k, l) is calculated based on the above, and the peripheral different color difference of the color difference (XL−Ga) k, l, that is, the color is different from XL. Color difference (X ^ L-Ga) k + n, l + m of color X ^ L and G of the same type Ga (where n = -1,1, m = -1,1) The peripheral similarity Sa2 (k, l) is calculated based on the above, and the two peripheral similarities Sa1 (k, l) and Sa2 (k, l) are added to obtain the peripheral similarity Sa (k, l). Is calculated in memory 217. Paid has been that G variation weighting factor w (k, l) and multiplying (step S2909).

このようにして算出される各周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)×w(k,l)は、値が小さい程、類似性が高いことを示す量となっている。そして、続く処理において、類似性が最大(類似度の値としては最小)となる色差候補を1つ選択する処理を行う。   Each of the peripheral similarity Sv (k, l), Sh (k, l), and Sa (k, l) × w (k, l) calculated in this way has a higher similarity as the value is smaller. It is the quantity which shows. In the subsequent process, a process of selecting one color difference candidate having the maximum similarity (minimum similarity value) is performed.

すなわち、上述したようにして3つの周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)×w(k,l)が算出されたところで、まず、周辺類似度Sv(k,l)と周辺類似度Sh(k,l)とを比較する(ステップS2910)。   That is, when the three peripheral similarity Sv (k, l), Sh (k, l), and Sa (k, l) × w (k, l) are calculated as described above, first, the peripheral similarity is calculated. Sv (k, l) is compared with the peripheral similarity Sh (k, l) (step S2910).

ここで、周辺類似度Sv(k,l)が周辺類似度Sh(k,l)よりも小さいと判定された場合には、さらに、周辺類似度Sv(k,l)と周辺類似度Sa(k,l)×w(k,l)とを比較する(ステップS2912)。   If it is determined that the peripheral similarity Sv (k, l) is smaller than the peripheral similarity Sh (k, l), the peripheral similarity Sv (k, l) and the peripheral similarity Sa ( k, l) × w (k, l) is compared (step S2912).

一方、ステップS2910において、周辺類似度Sv(k,l)が周辺類似度Sh(k,l)以上であると判定された場合には、さらに、周辺類似度Sh(k,l)と周辺類似度Sa(k,l)×w(k,l)とを比較する(ステップS2911)。   On the other hand, if it is determined in step S2910 that the peripheral similarity Sv (k, l) is equal to or higher than the peripheral similarity Sh (k, l), the peripheral similarity Sh (k, l) and the peripheral similarity are further increased. The degree Sa (k, l) × w (k, l) is compared (step S2911).

そして、上述したステップS2912において、周辺類似度Sv(k,l)が周辺類似度Sa(k,l)×w(k,l)よりも小さいと判定された場合には、G信号欠落位置(k,l)の色差を(X−Gv)k,lに決定して、メモリに格納する(ステップS2913)。   If it is determined in step S2912 that the peripheral similarity Sv (k, l) is smaller than the peripheral similarity Sa (k, l) × w (k, l), the G signal missing position ( The color difference of k, l) is determined as (X−Gv) k, l and stored in the memory (step S2913).

また、上述したステップS2912において周辺類似度Sv(k,l)が周辺類似度Sa(k,l)×w(k,l)以上であると判定された場合、または、上述したステップS2911において周辺類似度Sh(k,l)が周辺類似度Sa(k,l)×w(k,l)以上であると判定された場合には、G信号欠落位置(k,l)の色差を(XL−Ga)k,lに決定して、メモリに格納する(ステップS2914)。   Further, when it is determined in step S2912 that the peripheral similarity Sv (k, l) is equal to or higher than the peripheral similarity Sa (k, l) × w (k, l), or in the above-described step S2911 When it is determined that the similarity Sh (k, l) is equal to or higher than the peripheral similarity Sa (k, l) × w (k, l), the color difference of the G signal missing position (k, l) is expressed as (XL -Ga) k, l is determined and stored in the memory (step S2914).

さらに、上述したステップS2911において周辺類似度Sh(k,l)が周辺類似度Sa(k,l)×w(k,l)よりも小さいと判定された場合には、G信号欠落位置(k,l)の色差を(X−Gh)k,lに決定して、メモリに格納する(ステップS2915)。   Further, if it is determined in step S2911 that the peripheral similarity Sh (k, l) is smaller than the peripheral similarity Sa (k, l) × w (k, l), the G signal missing position (k , L) is determined as (X−Gh) k, l and stored in the memory (step S2915).

こうして、ステップS2913、ステップS2914、またはステップS2915の何れかの処理を行った後に、上記決定された色差(k,l)をX(k,l)から減算することによりG(k,l)を算出して、算出したGをメモリに格納する(ステップS2916)。   Thus, after performing any of the processing of step S2913, step S2914, or step S2915, G (k, l) is obtained by subtracting the determined color difference (k, l) from X (k, l). The calculated G is stored in the memory (step S2916).

その後、出力画像としての総画素数の処理を終了したか否かを判定する(ステップS2917)。   Thereafter, it is determined whether or not the processing for the total number of pixels as the output image has been completed (step S2917).

ここで、総画素数の処理がまだ終了していないと判定された場合には、上述したステップS2901に戻って、メモリに格納されている不必要となった(X−Gv)、(X−Gh)、(XL−Ga)、w、Sv、Sh、Saを新しく算出される値で置き換えながら、上述したような処理を続けて行う。   If it is determined that the processing of the total number of pixels has not been completed yet, the process returns to the above-described step S2901, and is unnecessary (X-Gv), (X-) stored in the memory. Gh), (XL−Ga), w, Sv, Sh, and Sa are replaced with newly calculated values, and the above-described processing is continuously performed.

一方、ステップS2917において、総画素数の処理が終了したと判定された場合には、このG補間色差算出処理を終了する。   On the other hand, if it is determined in step S2917 that the process for the total number of pixels has been completed, the G interpolation color difference calculation process ends.

ここで、G補間色差算出部102を上述したように構成した理由について、詳細に説明する。   Here, the reason why the G interpolation color difference calculation unit 102 is configured as described above will be described in detail.

3つの色差候補(X−Gv)、(X−Gh)、(XL−Ga)は、周辺色差類似性が最大(類似度の値としては最小)となる1つを選択することにより、それぞれ垂直エッジ領域、水平エッジ領域、斜めエッジを含むその他の領域に概ね割り当てられる。その理由は、局所領域内の色差信号は空間的に類似性が高い(つまり色の変化が少ない)と仮定すると、その局所領域に含まれているエッジ方向と同じ方向で補間されたGtに基づき算出した複数色差X−Gtと、異なった方向で補間されたGt’に基づき算出した複数色差X−Gt’とを比べた場合に、前者の方が被写体が本来もつG信号を近似的に再現することができるために、その色差が被写体が本来もっている色差により近くなり、周辺の色差類似度がより高くなることにある。ここで斜めエッジを担う色差に(X−Ga)ではなく(XL−Ga)を用いる理由を、図28を参照して説明すると、以下のようになる。ここに、図28は、撮像画像および補間画素等の水平方向に対して斜め45度方向の周波数特性を示す図である。   The three color difference candidates (X-Gv), (X-Gh), and (XL-Ga) are each vertically selected by selecting one that has the maximum peripheral color difference similarity (the minimum is the similarity value). Almost all are assigned to edge regions, horizontal edge regions, and other regions including diagonal edges. The reason is that, assuming that the color difference signals in the local area are spatially similar (that is, the color change is small), it is based on Gt interpolated in the same direction as the edge direction included in the local area. When the calculated multiple color differences X-Gt and the calculated multiple color differences X-Gt ′ based on Gt ′ interpolated in different directions are compared, the former approximates the G signal inherent in the subject. Therefore, the color difference becomes closer to the color difference originally possessed by the subject, and the color difference similarity in the surrounding area becomes higher. The reason why (XL-Ga) instead of (X-Ga) is used for the color difference bearing the oblique edge will be described below with reference to FIG. FIG. 28 is a diagram illustrating frequency characteristics in a 45-degree oblique direction with respect to the horizontal direction of the captured image, the interpolation pixel, and the like.

この図28において、曲線faは、レンズおよび光学ローパスフィルタを経由して撮像素子上に結像された画像の、水平画素配列方向を0度としたときの斜め45度方向の空間周波数特性を示している。また、曲線fbは、欠落G画素位置に周辺の上下左右Gの平均により作成したGaの、斜め45度方向の空間周波数特性を示している。さらに、曲線fcは、Xに対して周辺の同種Xを用いて帯域制限したXLの斜め45度方向の空間周波数特性を示している。   In FIG. 28, a curve fa indicates a spatial frequency characteristic in an oblique 45 ° direction when an image formed on the image sensor via the lens and the optical low-pass filter is set to 0 ° in the horizontal pixel arrangement direction. ing. A curve fb shows the spatial frequency characteristics of Ga, which is created by averaging the top, bottom, left, and right G around the missing G pixel position in a 45-degree oblique direction. Further, the curve fc shows the spatial frequency characteristic in the oblique 45 degree direction of XL which is band-limited with respect to X by using the same kind of surrounding X.

斜めエッジに色差(X−Ga)を用いると、第1に、XとGaの斜め方向の周波数特性が図28の曲線faと曲線fbとのように異なるために、この周波数特性の違いにより偽色を多く含む色差を生成してしまうことになる。   When the color difference (X-Ga) is used for the oblique edge, first, the frequency characteristics in the oblique direction of X and Ga are different as shown by the curves fa and fb in FIG. A color difference including many colors will be generated.

第2に、欠落G画素位置に生成されるGiがGi=X−(X−Ga)=Gaとなるために、斜め方向の周波数特性が図28の曲線fbとなる一方で、撮像素子上のG画素の周波数特性は図28の曲線faとなって曲線fbとは異なるために、斜めエッジ領域においてコントラストが低い画素値と高い画素値とが交互に混在して現れてしまい、斜めエッジ境界が滑らかにつながらないことが課題として挙げられる。   Second, since Gi generated at the position of the missing G pixel is Gi = X− (X−Ga) = Ga, the frequency characteristic in the oblique direction becomes the curve fb in FIG. Since the frequency characteristic of the G pixel is the curve fa in FIG. 28 and is different from the curve fb, pixel values with low contrast and pixel values with high contrast appear alternately in the diagonal edge region, and the diagonal edge boundary appears. The problem is that it does not connect smoothly.

これらに対して、色差(XL−Ga)を使用した場合には、XLとGaの斜め45度方向の周波数特性がそれぞれ図28の曲線fcと曲線fbとなり、近似した帯域をもつために、斜めエッジ領域での偽色の発生をより抑制することができることになる。   On the other hand, when the color difference (XL−Ga) is used, the frequency characteristics of XL and Ga in the oblique 45 degree direction are the curve fc and the curve fb in FIG. The generation of false colors in the edge region can be further suppressed.

さらに、欠落G画素位置に生成されるGiは、Gi=X−(XL−Ga)=Ga+(X−XL)となり、第1項は図28の曲線fbに示すような周波数特性をもち、第2項は原信号帯域である図28の曲線faから帯域制限した図28の曲線fcを除いた高域成分となるために、これらの加算であるGiは図28の曲線faに近似した周波数特性を得ることになる。つまり、斜めエッジ領域において撮像素子上のG画素と同等の画素値となり、斜めエッジ領域をより自然に再現することができることになる。   Further, Gi generated at the position of the missing G pixel is Gi = X− (XL−Ga) = Ga + (X−XL), the first term has frequency characteristics as shown by the curve fb in FIG. Since the second term is a high-frequency component excluding the curve fc of FIG. 28 that is band-limited from the curve fa of FIG. 28 that is the original signal band, Gi that is the addition of these is a frequency characteristic approximated to the curve fa of FIG. Will get. That is, the pixel value is the same as that of the G pixel on the image sensor in the oblique edge region, and the oblique edge region can be reproduced more naturally.

従って、斜めエッジの再現性を向上することができ、さらに斜めエッジ用に別途のG補間を用意する必要がなくなるために回路規模も小さくすることができる。   Therefore, the reproducibility of the oblique edge can be improved, and further, it is not necessary to prepare a separate G interpolation for the oblique edge, so that the circuit scale can be reduced.

ちなみに、縦エッジ領域に割り当てられる(X−Gv)、または横エッジ領域に割り当てられる(X−Gh)により欠落G画素位置に生成されるGiは、Gi=X−(X−Gv)=Gv、またはGi=X−(X−Gh)=Ghとなる。これらGv,Ghは、エッジに直交する周波数特性がそれぞれ保存されるために、G画素と同等の画素値となり、縦、横エッジ領域において不自然なアーティファクトが発生することはなく、綺麗なエッジを再現することができる。   Incidentally, Gi generated at the missing G pixel position by (X−Gv) assigned to the vertical edge region or (X−Gh) assigned to the horizontal edge region is Gi = X− (X−Gv) = Gv, Or Gi = X- (X-Gh) = Gh. Since Gv and Gh each store frequency characteristics orthogonal to the edges, the pixel values are the same as those of the G pixels, and unnatural artifacts do not occur in the vertical and horizontal edge regions, and clean edges can be obtained. Can be reproduced.

また、G補間色差算出部102において欠落G画素位置に3つの補間候補により作成した3つの色差候補(X−Gv)、(X−Gh)、(XL−Ga)から周辺色差類似性が最大(類似度の値としては最小)となる1つを選択する例を示したが、回路規模の増加を許す場合には4つ以上の色差候補を作成したとしても同様の処理を行うことが可能であるのはいうまでもない。すなわち、上記(XL−Ga)のXLは図28の曲線fcに示すように斜め45度の周波数特性を近似させる帯域制限がなされた信号であったが、この場合には、45度以外の適宜のθ度方向の周波数特性を、Gaの同一方向の周波数特性に近似させるように帯域制限がなされたXLθを作成して、色差候補(XLθ−Ga)として追加するようにしても良い。この場合には、XLθを算出するのに必要な同色X画素は{X(i,j),X(i,j−2),X(i,j+2),X(i−2,j),X(i+2,j)}だけでなく、さらに周辺の同色X画素を使ってローパスフィルタを設計する必要があると考えられる。こうすることにより、斜め45度方向以外の斜めエッジに対しても更なる偽色低減を行うことができる。   Further, the G-interpolation color difference calculation unit 102 maximizes the peripheral color difference similarity from the three color difference candidates (X-Gv), (X-Gh), and (XL-Ga) created by the three interpolation candidates at the missing G pixel position ( Although an example in which one of the minimum similarity values is selected has been shown, the same processing can be performed even if four or more color difference candidates are created when an increase in circuit scale is allowed. Needless to say, there are. That is, XL in the above (XL-Ga) is a signal whose band is limited to approximate the frequency characteristic of 45 degrees obliquely as shown by the curve fc in FIG. It is also possible to create XLθ that is band-limited so as to approximate the frequency characteristic in the θ-degree direction to the frequency characteristic in the same direction of Ga, and add it as a color difference candidate (XLθ-Ga). In this case, the same color X pixels necessary to calculate XLθ are {X (i, j), X (i, j-2), X (i, j + 2), X (i-2, j), It is considered that it is necessary to design a low-pass filter using not only X (i + 2, j)} but also surrounding peripheral X-color pixels. By doing so, it is possible to further reduce the false color with respect to an oblique edge other than the oblique 45 degree direction.

このような実施形態1によれば、色差を算出するときの未確定パラメータである欠落G画素を、色差信号は局所的に相関性が高いという前提条件に基づいた最も確からしいものとして、複数種類のG画素補間候補の中から1つ選択することができる。その結果として、画像の局所的なエッジに最適な欠落G画素が補間されるために、偽色の発生を抑制することができるとともに、さらに、エッジ部の解像度劣化を抑制しつつ、回路規模を小さくすることができる。   According to the first embodiment, a missing G pixel that is an undetermined parameter when calculating a color difference is considered to be the most probable based on the premise that the color difference signal is locally highly correlated. One of the G pixel interpolation candidates can be selected. As a result, since the optimum missing G pixel is interpolated at the local edge of the image, generation of false colors can be suppressed, and further, the circuit scale can be reduced while suppressing the resolution deterioration of the edge portion. Can be small.

[実施形態2]
図8から図18は本発明の実施形態2を示したものであり、図8は画像処理装置の全体的な構成を示すブロック図である。この実施形態2において、上述の実施形態1と同様である部分については同一の符号を付して説明を省略し、主として異なる点についてのみ説明する。
[Embodiment 2]
8 to 18 show Embodiment 2 of the present invention, and FIG. 8 is a block diagram showing the overall configuration of the image processing apparatus. In the second embodiment, parts that are the same as those in the first embodiment are given the same reference numerals and description thereof is omitted, and only differences are mainly described.

この実施形態2は、実施形態1に対して微小エッジ領域での色差判定エラーや、R,G,B信号のノイズレベルの違いによる画質劣化改善をさらに可能とし、加えて記録する画像サイズを変更可能とするものとなっている。   The second embodiment further improves the image quality degradation due to the color difference determination error in the minute edge region and the difference in the noise level of the R, G and B signals, and additionally changes the image size to be recorded. It has become possible.

本実施形態の画像処理装置は、図8に示すように構成されていて、図1に示した実施形態1との違いは色差補間処理部103が補間処理部801に置き換わったことにある。この違いは、RGB算出部104へ出力される補間されたG、R−G、B−Gの画素位置の違いに起因する。すなわち、実施形態1ではこれらの画素位置は撮像素子によって撮像された画素と同一位置となるが、この実施形態2では撮像素子の画素位置に対して任意の位置に生成可能となっている。特に、補間後の画像の解像度が撮像素子の解像度と同一である場合には、水平、垂直ともに1/2画素ずれた位置に生成するようになっている。そして、これに伴って、G補間色差算出部102から出力されるG信号は、RGB算出部104に代えて補間処理部801へ入力されるようになっている。また、補間処理部801からは、色差R−G,B−Gに加えて、さらにG信号がRGB算出部104へ出力されるようになっている。さらに、補間処理部801には、記録画像サイズが入力されるようになっている。   The image processing apparatus of the present embodiment is configured as shown in FIG. 8, and the difference from the first embodiment shown in FIG. 1 is that the color difference interpolation processing unit 103 is replaced with an interpolation processing unit 801. This difference is caused by a difference in the interpolated G, RG, and BG pixel positions output to the RGB calculation unit 104. That is, in the first embodiment, these pixel positions are the same positions as the pixels imaged by the image sensor, but in the second embodiment, the pixel positions can be generated at arbitrary positions with respect to the pixel positions of the image sensor. In particular, when the resolution of the image after interpolation is the same as the resolution of the image sensor, the image is generated at a position shifted by 1/2 pixel both horizontally and vertically. Along with this, the G signal output from the G interpolation color difference calculation unit 102 is input to the interpolation processing unit 801 instead of the RGB calculation unit 104. In addition to the color differences RG and BG, the interpolation processing unit 801 further outputs a G signal to the RGB calculation unit 104. Further, the recorded image size is input to the interpolation processing unit 801.

図9は、補間処理部801の構成を示すブロック図である。   FIG. 9 is a block diagram illustrating a configuration of the interpolation processing unit 801.

この補間処理部801は、色差選別部301と、メモリ901と、メモリ902と、メモリ903と、補間算出部904と、補間算出部905と、補間算出部906と、補間係数算出部907と、制御部908と、メモリ909と、を有している。   The interpolation processing unit 801 includes a color difference selection unit 301, a memory 901, a memory 902, a memory 903, an interpolation calculation unit 904, an interpolation calculation unit 905, an interpolation calculation unit 906, an interpolation coefficient calculation unit 907, A control unit 908 and a memory 909 are included.

補間処理部801には、G補間色差算出部102から出力される図6に示すような2次元配列構造をもったG信号と、図7に示すような2次元配列構造をもった色差X−Gi信号と、が入力される。   The interpolation processing unit 801 includes a G signal having a two-dimensional array structure as shown in FIG. 6 and a color difference X− having a two-dimensional array structure as shown in FIG. Gi signal is input.

G補間色差算出部102からの色差X−Gi信号は、色差選別部301に入力されてR−GiとB−Giとに分離され、メモリ901,902にそれぞれ格納される。ここに、メモリ901,902には、所定位置への補間処理に必要なライン数分のR−GiとB−Giとがそれぞれ格納される。   The color difference X-Gi signal from the G interpolation color difference calculation unit 102 is input to the color difference selection unit 301, separated into R-Gi and B-Gi, and stored in the memories 901 and 902, respectively. Here, the memories 901 and 902 store R-Gi and B-Gi corresponding to the number of lines necessary for interpolation processing to a predetermined position, respectively.

そして、補間処理が開始可能となった時点で、その補間処理に必要な画素が色差補間手段たる補間算出部904,905にそれぞれ入力され、制御部908から出力される補間フィルタ係数に基づいて補間画素である色差R−G、B−Gが算出され、RGB算出部104へ出力される。   When the interpolation process can be started, the pixels necessary for the interpolation process are respectively input to the interpolation calculation units 904 and 905 serving as the color difference interpolation unit, and are interpolated based on the interpolation filter coefficients output from the control unit 908. Color differences RG and BG as pixels are calculated and output to the RGB calculation unit 104.

一方、G補間色差算出部102からのG信号は、メモリ903に格納される。メモリ903には、所定位置への補間処理に必要なライン数分のGがそれぞれ格納される。   On the other hand, the G signal from the G interpolation color difference calculation unit 102 is stored in the memory 903. The memory 903 stores G corresponding to the number of lines necessary for interpolation processing to a predetermined position.

そして、補間処理が開始可能となった時点で、その補間処理に必要な画素がG補間手段たる補間算出部906に入力され、制御部908から出力される補間フィルタ係数に基づいて補間画素Gが算出され、RGB算出部104へ出力される。   When the interpolation process can be started, pixels necessary for the interpolation process are input to the interpolation calculation unit 906 that is a G interpolation unit, and the interpolation pixel G is determined based on the interpolation filter coefficient output from the control unit 908. Calculated and output to the RGB calculation unit 104.

制御部908は、ユーザーが決定した記録画像サイズが図示しないシステムコントローラから入力されると、補間係数算出部907に対して、該記録画像サイズに対応する補間フィルタを作用させる画素位置とそのフィルタ係数の算出とを指示する。   When the recording image size determined by the user is input from a system controller (not shown), the control unit 908 causes the interpolation coefficient calculation unit 907 to apply an interpolation filter corresponding to the recording image size and its filter coefficient. Is instructed.

補間係数算出部907は、補間フィルタ係数を算出して、算出した補間フィルタ係数をその補間画素位置に応じてメモリ909に格納する。   The interpolation coefficient calculation unit 907 calculates an interpolation filter coefficient, and stores the calculated interpolation filter coefficient in the memory 909 according to the interpolation pixel position.

制御部908は、メモリ909に格納されているフィルタ係数を補間処理する画素位置に応じて読み出し、補間算出部904,905,906へ出力する。   The control unit 908 reads out the filter coefficient stored in the memory 909 according to the pixel position to be interpolated, and outputs it to the interpolation calculation units 904, 905, and 906.

なお、上述においては、記録画像サイズが入力された時点でフィルタ係数を作成する例について説明したが、複数種類の記録画像サイズに対応したフィルタ係数を予めメモリ909に格納しておいても良い。この場合には、補間係数算出部907が不要となる。そして、制御部908は、ユーザーにより指定された記録画像サイズに基づいてメモリ909に格納されている係数ルックアップテーブルを読み出し、補間算出部904,905,906へ供給することになる。   In the above description, the example in which the filter coefficient is created when the recording image size is input has been described. However, filter coefficients corresponding to a plurality of types of recording image sizes may be stored in the memory 909 in advance. In this case, the interpolation coefficient calculation unit 907 is not necessary. Then, the control unit 908 reads the coefficient lookup table stored in the memory 909 based on the recorded image size designated by the user, and supplies the coefficient lookup table to the interpolation calculation units 904, 905, and 906.

補間算出部904,905,906における補間算出処理は、例えば図10〜図12に示すような8×8画素の領域に対するものとなっている。ここに、図10は補間処理部801におけるG信号の補間処理単位の一例を示す図、図11は補間処理部801におけるR−Gi信号の補間処理単位の一例を示す図、図12は補間処理部801におけるB−Gi信号の補間処理単位の一例を示す図である。そして、補間算出部904,905,906は、撮像素子と同一解像度の画像サイズを指定した場合の例として、水平、垂直ともに1/2画素位置(図10〜図12において、中央の×印で示す位置)に画素を作成するものとなっている。   The interpolation calculation processing in the interpolation calculation units 904, 905, and 906 is for an 8 × 8 pixel region as shown in FIGS. 10 is a diagram showing an example of the G signal interpolation processing unit in the interpolation processing unit 801. FIG. 11 is a diagram showing an example of the R-Gi signal interpolation processing unit in the interpolation processing unit 801. FIG. FIG. 10 is a diagram illustrating an example of a B-Gi signal interpolation processing unit in a unit 801. The interpolation calculation units 904, 905, and 906, as an example of designating an image size having the same resolution as that of the image sensor, are arranged at 1/2 pixel positions in both the horizontal and vertical directions (in FIG. 10 to FIG. The pixel is created at the position shown.

この補間算出処理において使用する補間フィルタの例としては、Lanczosフィルタ等の畳み込みフィルタを挙げることができる。このときのフィルタ処理は、水平方向に処理した1次元フィルタの結果に垂直方向の1次元フィルタを施して、補間画素を算出する処理となる。   As an example of the interpolation filter used in this interpolation calculation process, a convolution filter such as a Lanczos filter can be cited. The filtering process at this time is a process of calculating an interpolation pixel by applying a one-dimensional filter in the vertical direction to the result of the one-dimensional filter processed in the horizontal direction.

なお、ここでは1次元のフィルタについて述べたが、これに代えて2次元フィルタとすることも可能である。図13および図15〜図18は、8×8タップの2次元フィルタの例を示す図である。ここに、図13は、G信号に対するフィルタ係数を示す図、図15〜図18はR−Gi信号またはB−Gi信号に対する補間フィルタ係数を示す図である。これら図15〜図18に示す4つのフィルタ係数は、補間画素位置と処理対象の色差R−GiまたはB−Giの位置関係とに応じて、切換えて使用されるようになっている。   Although a one-dimensional filter has been described here, a two-dimensional filter may be used instead. FIGS. 13 and 15 to 18 are diagrams illustrating examples of an 8 × 8 tap two-dimensional filter. FIG. 13 is a diagram showing filter coefficients for the G signal, and FIGS. 15 to 18 are diagrams showing interpolation filter coefficients for the R-Gi signal or the B-Gi signal. These four filter coefficients shown in FIGS. 15 to 18 are switched and used in accordance with the interpolation pixel position and the positional relationship of the color difference R-Gi or B-Gi to be processed.

ここで、G信号に対する補間フィルタ係数fijと色差に対する補間フィルタ係数f*ijとは同一係数fij=f*ijであっても良いし、あるいは色差に対してはより帯域制限をかけた異なるフィルタ係数f*ij≠fijを用いるようにしても構わない。   Here, the interpolation filter coefficient fij for the G signal and the interpolation filter coefficient f * ij for the color difference may be the same coefficient fij = f * ij, or different filter coefficients that are more band-limited for the color difference. It is possible to use f * ij ≠ fij.

また、上述では補間フィルタのタップ数を8×8タップとしたが、ハードウェア規模とフィルタ特性の設計自由度とのトレードオフでN×Nタップ(ここに、Nは4の倍数)としても良い。このときには当然にして、G信号と色差信号とで異なるタップ数としても良いのはいうまでもなく、この場合のG信号はNが2の倍数のタップ数のフィルタでも構わない。   In the above description, the number of taps of the interpolation filter is 8 × 8 taps. However, N × N taps (where N is a multiple of 4) may be used as a trade-off between the hardware scale and the degree of freedom in design of the filter characteristics. . In this case, as a matter of course, the G signal and the color difference signal may have different tap numbers. In this case, the G signal may be a filter having a tap number in which N is a multiple of 2.

特に、記録画像サイズが撮像素子と同一解像度となるG信号に対する補間フィルタの周波数特性は、図14の実線に示すように、ナイキスト周波数(NF)でレスポンスがゼロ、もしくはほぼゼロとなるローパスフィルタを用いることになる。ここに、図14は、補間処理部801において用いられる補間フィルタの周波数特性を示す線図である。   In particular, the frequency characteristics of the interpolation filter for the G signal, whose recorded image size is the same resolution as that of the image sensor, is a low-pass filter whose response is zero or almost zero at the Nyquist frequency (NF) as shown by the solid line in FIG. Will be used. FIG. 14 is a diagram showing the frequency characteristics of the interpolation filter used in the interpolation processing unit 801.

また、画像を拡大する場合には、画素間に複数の補間画素位置を設けて、この補間画素位置に応じて上記補間フィルタ係数を変更することにより、上記補間フィルタと同等の周波数特性の画素補間を実現することができる。   Also, when enlarging an image, a plurality of interpolation pixel positions are provided between the pixels, and the interpolation filter coefficient is changed according to the interpolation pixel position, whereby pixel interpolation having the same frequency characteristics as the interpolation filter is performed. Can be realized.

一方、画像を縮小する場合には、画素間引きに対応して発生する折り返し歪みを抑圧するために、縮小画像のサンプリング間隔に対応するナイキスト周波数でカットするローパス特性の補間フィルタ係数を用いて、補間画素位置に応じて補間フィルタ係数を変更しながら補間画素(G、R−G、B−G)を作成することにより、実現することができる。上述した図14における破線は、一例として、水平、垂直ともに1/2に縮小する場合の周波数帯域のフィルタ特性を示したものである。この場合の補間画素位置は、図10〜図12に示した位置と同様に、水平、垂直ともに1/2画素位置(図13,図15〜図18において、中央の×印で示す位置)に作成される。そして当然にして、補間画素は、水平、垂直方向ともに撮像素子の画素間隔の2倍の間隔で作成されることになる。   On the other hand, when reducing the image, in order to suppress aliasing distortion that occurs in response to pixel decimation, interpolation is performed using an interpolation filter coefficient having a low-pass characteristic that cuts at the Nyquist frequency corresponding to the sampling interval of the reduced image. This can be realized by creating the interpolation pixels (G, RG, BG) while changing the interpolation filter coefficient according to the pixel position. The broken lines in FIG. 14 described above indicate, as an example, the filter characteristics of the frequency band when both horizontal and vertical are reduced to ½. In this case, the interpolated pixel position is ½ pixel position in both horizontal and vertical positions (indicated by a cross in the center in FIGS. 13 and 15 to 18), similarly to the positions illustrated in FIGS. 10 to 12. Created. Naturally, the interpolated pixels are created at twice the pixel interval of the image sensor in both the horizontal and vertical directions.

こうして補間処理部801で同時化された補間画素(G、R−G、B−G)は、RGB算出部104により、上述した実施形態1と同様にカラーマトリックス処理、および非線形なトーンカーブによりγ補正されたRγ、Gγ、Bγ信号が作成されて、圧縮記録部105によって画像圧縮されフラッシュメモリやハードディスク、磁気テープ等の所定の記録媒体に記録される。   The interpolation pixels (G, RG, BG) synchronized in the interpolation processing unit 801 in this way are converted into γ by the RGB matrix calculation unit 104 by color matrix processing and a non-linear tone curve as in the first embodiment. Corrected Rγ, Gγ, and Bγ signals are created, compressed by the compression recording unit 105, and recorded on a predetermined recording medium such as a flash memory, a hard disk, or a magnetic tape.

このような実施形態2によれば、上述した実施形態1とほぼ同様に偽色の発生と彩度低下とを抑制することができるとともに、リサイズ画像を作成することができ、さらに一般的に行われている従来の技術に比べて回路規模を小さく抑制することができる。ここに、一般的に行われる画像リサイズ処理とは、実施形態1のRGB算出部104から出力される撮像素子の画素数と同数の画素をもったRGB画像に対して別途のリサイズ処理をする場合を指している。   According to the second embodiment, it is possible to suppress generation of a false color and a decrease in saturation as in the first embodiment, and to create a resized image. The circuit scale can be reduced as compared with the conventional technology. Here, the image resizing process generally performed is a case in which a separate resizing process is performed on an RGB image having the same number of pixels as the number of pixels of the image sensor output from the RGB calculation unit 104 of the first embodiment. Pointing.

さらに、この実施形態2によれば、以下に説明するような実施形態1の点をさらに改善することができる。   Furthermore, according to the second embodiment, the points of the first embodiment described below can be further improved.

まず第1に、実施形態1は、特定方向の微小エッジ領域に撮像素子のノイズ等に起因して色差選択エラーが発生した場合に、欠落G画素位置に生成されるG画素値と本来の撮像素子上のG画素位置のG画素値とが大きく異なることになり、エッジが刃こぼれしたようなナイキスト周波数近辺の周波数成分をもった劣化パターンとなって現れる場合がある。このような劣化パターンは、実施形態2の上記補間フィルタの特性(図14)がナイキスト周波数でレスポンスゼロとなることにより抑圧することができ、エッジを綺麗に再現することができるようになる。   First, in the first embodiment, when a color difference selection error occurs in a minute edge region in a specific direction due to noise or the like of the image sensor, the G pixel value generated at the missing G pixel position and the original imaging The G pixel value at the G pixel position on the element is greatly different, and may appear as a deterioration pattern having a frequency component in the vicinity of the Nyquist frequency such that the edge is spilled. Such a deterioration pattern can be suppressed when the characteristic of the interpolation filter of the second embodiment (FIG. 14) becomes zero response at the Nyquist frequency, and the edge can be reproduced clearly.

第2に、G補間色差算出部102に入力されるRGB各画素は、G画素に比べてR,B画素の感度が低いことが一般的である。このような場合には、ホワイトバランスを取るために、R,B画素をG画素よりも大きいゲイン値で増幅することになるために、G画素に比べてR,B画素のノイズは大きくなることになる。このような条件下において実施形態1の技術を用いると、欠落G画素位置のG画素値を、ノイズを多く含むRまたはB画素値を用いて生成することになるために、G画素位置のG画素値に比べてより大きなノイズを含むことになる。このような場合であっても、本実施形態2の技術によれば、上記補間フィルタによりノイズレベルが平均化されるために、SN比を改善できることになる。   Second, the RGB pixels input to the G interpolation color difference calculation unit 102 generally have lower R and B pixel sensitivities than the G pixels. In such a case, in order to obtain white balance, the R and B pixels are amplified with a gain value larger than that of the G pixel, so that the noise of the R and B pixels becomes larger than that of the G pixel. become. When the technique of the first embodiment is used under such conditions, the G pixel value at the missing G pixel position is generated using the R or B pixel value including a lot of noise. The noise is larger than the pixel value. Even in such a case, according to the technique of the second embodiment, since the noise level is averaged by the interpolation filter, the SN ratio can be improved.

第3に、撮像素子自体の特性により奇数ラインのG画素と偶数ラインのG画素とにゲインバラツキが発生する場合があるが、このようなゲインバラツキは特に平坦部においてナイキスト周波数近傍の成分をもった段差となって目立って現れる。このような場合にも、この実施形態2によれば、上述した補間フィルタを用いることにより、この段差を抑圧することができるために、平坦部において滑らかな階調変化を得ることができる。   Third, gain variation may occur between odd-numbered G pixels and even-numbered G pixels depending on the characteristics of the image pickup device itself. Such gain variation has a component near the Nyquist frequency particularly in a flat portion. Appears as a step. Even in such a case, according to the second embodiment, this step can be suppressed by using the above-described interpolation filter, so that a smooth gradation change can be obtained in the flat portion.

以上のように、この実施形態2によれば、エッジ部分では上述した実施形態1と同様に偽色の発生を抑制しつつ、さらにエッジ境界や平坦部における不自然なパターンの発生を抑制することができるとともに、ユーザーが指定した任意サイズの画像を作成することができる。   As described above, according to the second embodiment, the occurrence of false color is suppressed at the edge portion as in the first embodiment, and the generation of an unnatural pattern at the edge boundary or flat portion is further suppressed. And an image of an arbitrary size designated by the user can be created.

[実施形態3]
図30から図32は本発明の実施形態3を示したものであり、図30はG補間色差算出部の構成を示すブロック図である。この実施形態3において、上述の実施形態1,2と同様である部分については同一の符号を付して説明を省略し、主として異なる点についてのみ説明する。
[Embodiment 3]
30 to 32 show the third embodiment of the present invention, and FIG. 30 is a block diagram showing the configuration of the G interpolation color difference calculation unit. In the third embodiment, parts that are the same as those in the first and second embodiments are given the same reference numerals, description thereof is omitted, and only differences are mainly described.

この実施形態3は、上述した実施形態1の構成が最適に機能しない条件下における画質改善を可能にするものとなっている。ここに、実施形態1の構成が最適に機能しない条件の領域とは、例えば、撮像素子のブルーミング発生領域や、RまたはBとGとの相関が低く特にRまたはBがGより大きい値を取る領域、などが挙げられる。   The third embodiment makes it possible to improve image quality under conditions where the configuration of the first embodiment described above does not function optimally. Here, the region under the condition where the configuration of the first embodiment does not function optimally includes, for example, a blooming occurrence region of the image sensor, a correlation between R or B and G is low, and particularly R or B is greater than G. Area, etc.

ここに、ブルーミング発生領域とは、撮像素子の各画素に許容量よりも強い光が入射した場合に、各画素に発生する電荷量が蓄積可能な電荷量を超えて飽和状態になり、飽和量以上の電荷が周囲の画素に漏れ出している領域である。例えば赤の波長の強い光が入射されるとR画素が飽和し、周囲のG画素、B画素に電荷が漏れ出す。このようなブルーミング発生領域において特に問題となるのは、撮像素子の構造に起因して、飽和したR画素の水平方向に隣接するGr画素と垂直方向に隣接するGb画素とに漏れる電荷が等しくなくなる場合である。この場合には、図31に示すように、G信号は水平、垂直ともにナイキスト周波数のパターンをもつことになる。ここで、図31は、X画素に対するブルーミング発生領域での周辺G画素に不均一に電荷が漏れた状態を示す図である。また、この図31におけるXはR画素、X^はB画素、GXはGr画素、GX^はGb画素にそれぞれ対応し、GXとGX^のハッチングの濃さの違いがブルーミングに伴う階調レベルの違いを示している。   Here, the blooming generation area is a state where the amount of charge generated in each pixel exceeds the storable charge amount when a light stronger than the allowable amount is incident on each pixel of the image sensor, and the saturation amount. This is a region where the above charges leak to the surrounding pixels. For example, when light having a strong red wavelength is incident, the R pixel is saturated, and charge leaks to the surrounding G and B pixels. Particularly problematic in such a blooming occurrence region, due to the structure of the image sensor, the charges leaking to the Gr pixel adjacent to the horizontal direction and the Gb pixel adjacent to the vertical direction of the saturated R pixel are not equal. Is the case. In this case, as shown in FIG. 31, the G signal has a pattern of Nyquist frequency both horizontally and vertically. Here, FIG. 31 is a diagram illustrating a state in which electric charge leaks unevenly to the peripheral G pixels in the blooming generation region for the X pixels. In FIG. 31, X corresponds to the R pixel, X ^ corresponds to the B pixel, GX corresponds to the Gr pixel, GX ^ corresponds to the Gb pixel, and the difference in hatching density between GX and GX ^ indicates the gradation level associated with blooming. Shows the difference.

このような場合に、実施形態1の技術を用いて3種類の色差値を算出すると、これら3種類の色差値は水平方向と垂直方向との電荷漏れ量の差の影響を受けることになる。具体例として、垂直方向に漏れる電荷量が水平方向に漏れる電荷量よりも多い場合には、3種類の色差値の大小関係は、
(X−Gv)<(XL−Ga)<(X−Gh)
などとなる。この場合における3つの色差周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)×w(k,l)の大小関係は、該類似度を算出するエリア内の撮像素子のランダムノイズや、漏れる電荷量の不確定な違いにより決まることになり、一意に確定しない状態となる。ここでSa(k,l)に対するG変動量重み係数w(k,l)は、上記GXとGX^との差が大きい領域ではG変動量が大きい値となり、重み係数値は1となるために、Sa(k,l)のプライオリティを上げることができない。
In such a case, when the three types of color difference values are calculated using the technique of the first embodiment, the three types of color difference values are affected by the difference in the amount of charge leakage between the horizontal direction and the vertical direction. As a specific example, when the amount of charge leaking in the vertical direction is larger than the amount of charge leaking in the horizontal direction, the magnitude relationship between the three color difference values is:
(X-Gv) <(XL-Ga) <(X-Gh)
And so on. In this case, the three color difference peripheral similarities Sv (k, l), Sh (k, l), and Sa (k, l) × w (k, l) are related in the area where the similarity is calculated. It is determined by random noise of the image sensor and an uncertain difference in the amount of charge leaked, and is not uniquely determined. Here, the G variation amount weight coefficient w (k, l) for Sa (k, l) has a large G variation amount in a region where the difference between GX and GX ^ is large, and the weight coefficient value is 1. In addition, the priority of Sa (k, l) cannot be increased.

このように3つの色差周辺類似度が一意に確定しない領域において、かつ色差値が大きく異なると、同時化されたRGB画像には色が不規則な斑状に変化する模様(主観的に汚い模様)が現れることになる。   In such a region where the three color difference peripheral similarity is not uniquely determined, and the color difference value is greatly different, a pattern in which the color is changed irregularly in a synchronized RGB image (subjectively dirty pattern) Will appear.

また、X画素に蓄積される電荷が飽和しない場合であっても、XがGに対して大きな値を取るような、XとGとの間の相関が低い条件において、かつ斜め方向にエッジが存在する場合には、以下のような状態が発生することがある。   Further, even when the charge accumulated in the X pixel is not saturated, the edge is inclined in the diagonal direction under the condition that the correlation between X and G is low such that X takes a large value with respect to G. If present, the following conditions may occur:

すなわち、実施形態1においても説明したように、斜めエッジでは色差周辺類似度Sa(k,l)×w(k,l)の類似度が一番高くなり、この場合の色差(XL−Ga)とXとを用いて、欠落G画素位置における補間値Giを次のように算出することになる。
Gi=X−(XL−Ga)=Ga+(X−XL)=Ga+ΔX
ここに、ΔXは、Xの高周波成分に対応する。
That is, as described in the first embodiment, the color difference peripheral similarity Sa (k, l) × w (k, l) is the highest at the diagonal edge, and the color difference (XL−Ga) in this case is the highest. And X are used to calculate the interpolation value Gi at the missing G pixel position as follows.
Gi = X- (XL-Ga) = Ga + (X-XL) = Ga + .DELTA.X
Here, ΔX corresponds to the high frequency component of X.

上記Gi算出式は、XとGとの相関が高い場合には欠落G画素位置でのG信号の未知の高周波成分予測値ΔGがΔXと等しい、つまりΔG=ΔXであると仮定することができるために、斜め方向のエッジの鈍りが抑制されて再現性が向上する。しかし、XとGとの相関が低い場合には、上記仮定が成り立たずΔG≠ΔXとなるために、特にXがGよりも十分に大きい領域では本来補正されるべきG信号の未知の高周波成分予測値ΔGに対してΔXが必要以上に大きくなる可能性が高くなり、この場合には斜め方向のエッジでジャギーが現れる結果となる。   The above Gi calculation formula can be assumed that when the correlation between X and G is high, the unknown high-frequency component predicted value ΔG of the G signal at the missing G pixel position is equal to ΔX, that is, ΔG = ΔX. For this reason, blunting of the edge in the oblique direction is suppressed, and reproducibility is improved. However, when the correlation between X and G is low, the above assumption does not hold and ΔG ≠ ΔX, and therefore, in the region where X is sufficiently larger than G, the unknown high-frequency component of the G signal that should be corrected originally There is a high possibility that ΔX becomes larger than necessary with respect to the predicted value ΔG, and in this case, jaggy appears as an oblique edge.

この実施形態3は、上述した実施形態1のG補間色差算出部102に対して、このような点をさらに改善するものとなっている。   In the third embodiment, such a point is further improved with respect to the G interpolation color difference calculation unit 102 of the first embodiment described above.

この実施形態3のG補間色差算出部102は、図30に示すように、上述した実施形態1の図2に示したG補間色差算出部102に対して、G変動量算出部216をG変動量算出部3001に変更し、飽和領域判定部3002、高色差判定部3003、4画素平均G算出部3004、G補間選択部3005を追加し、メモリ217を省略したものとなっている。   As shown in FIG. 30, the G interpolation color difference calculation unit 102 of the third embodiment replaces the G fluctuation amount calculation unit 216 with the G fluctuation amount calculation unit 216 in comparison with the G interpolation color difference calculation unit 102 shown in FIG. In place of the amount calculation unit 3001, a saturation region determination unit 3002, a high color difference determination unit 3003, a 4-pixel average G calculation unit 3004, and a G interpolation selection unit 3005 are added, and the memory 217 is omitted.

メモリ221は、飽和領域判定部3002へも接続されている。メモリ222と飽和領域判定部3002は、G変動量算出部3001へ接続されている。G変動量算出部3001は、乗算部218へ接続されている。メモリ212は、高色差判定部3003を介してG補間選択部3005へ接続されている。判定部219は高色差判定部3003へも接続されている。メモリ222は、4画素平均G算出部3004を介してG補間選択部3005へ接続されている。減算部223はG補間選択部3005へ接続されている。そして、メモリ222またはG補間選択部3005から、G信号がRGB算出部104へ出力されるようになっている。   The memory 221 is also connected to the saturation region determination unit 3002. The memory 222 and the saturation region determination unit 3002 are connected to the G fluctuation amount calculation unit 3001. The G fluctuation amount calculation unit 3001 is connected to the multiplication unit 218. The memory 212 is connected to the G interpolation selection unit 3005 via the high color difference determination unit 3003. The determination unit 219 is also connected to the high color difference determination unit 3003. The memory 222 is connected to the G interpolation selection unit 3005 via the 4-pixel average G calculation unit 3004. The subtraction unit 223 is connected to the G interpolation selection unit 3005. The G signal is output from the memory 222 or the G interpolation selection unit 3005 to the RGB calculation unit 104.

次に、本実施形態における作用の、上述した実施形態1との差異について説明する。   Next, the difference between the operation of the present embodiment and the first embodiment will be described.

飽和状態判定手段たる飽和領域判定部3002は、メモリ221に格納されている図31に示すようなX(RまたはB)を入力として、以下の飽和領域判定を行う。   The saturation region determination unit 3002 serving as a saturation state determination unit performs the following saturation region determination using X (R or B) as shown in FIG. 31 stored in the memory 221 as an input.

この飽和領域の判定条件の一例としては、図31に示すような5×5画素の領域に対して、撮像素子の飽和レベル値にホワイトバランス係数を考慮した閾値THsatXとTHsatX^とに基づき、
Min{X(k,l),X(k−2,l),X(k,l−2)
,X(k+2,l),X(k,l+2)}≧THsatX
または
Min{X^(k−1,l−1),X^(k+1,l−1)
,X^(k+1,l+1),X^(k−1,l+1)}≧THsatX^
を満たす場合に、X(k,l)は飽和領域内にある状態(飽和状態にある)と判定することが挙げられる。
As an example of the determination condition of the saturated region, for a 5 × 5 pixel region as shown in FIG. 31, based on threshold values THsatX and THsatX ^ in which the white balance coefficient is considered in the saturation level value of the image sensor,
Min {X (k, l), X (k-2, l), X (k, l-2)
, X (k + 2, l), X (k, l + 2)} ≧ THsatX
Or Min {X ^ (k-1, l-1), X ^ (k + 1, l-1)
, X ^ (k + 1, l + 1), X ^ (k-1, l + 1)} ≧ THsatX ^
In the case of satisfying the above, it may be determined that X (k, l) is in a saturated region (saturated state).

ここで撮像素子の飽和レベル値は最大階調値である必要はなく、ブルーミング発生確率が十分に低い階調値に設定しても良い。また、閾値THsatXは、THsatX=飽和レベル値×ホワイトバランス係数Xであり、最大階調値でクリッピングされた値となる。   Here, the saturation level value of the image sensor does not need to be the maximum gradation value, and may be set to a gradation value with a sufficiently low blooming occurrence probability. The threshold THsatX is THsatX = saturation level value × white balance coefficient X, and is a value clipped with the maximum gradation value.

飽和領域判定部3002によるこの判定結果は、G変動量算出部3001へ出力される。   This determination result by the saturated region determination unit 3002 is output to the G fluctuation amount calculation unit 3001.

G変動量算出部3001は、最適色差選択手段でありG画素変動量算出手段であって、上述した実施形態1において説明したのと同様に、メモリ222から図25に示したような欠落G画素位置(k,l)の周辺に配置されたGs信号を読み込んで、G変動量(k,l)を算出し、図26に示したような重み係数w(k,l)をG変動量(k,l)に対応して、所定の計算式、またはルックアップテーブルを用いて導き出す。ただし、本実施形態のG変動量算出部3001は、さらに、X(k,l)が上記飽和領域判定結果に基づき飽和領域内にある状態であると判定された場合には、この重み係数w(k,l)を強制的に0(最小値)に変更する(すなわち、重み係数変更手段であって、固定化手段として機能する)ようになっている。このような処理を行うことにより、Sa(k,l)×w(k,l)=0となるために、飽和領域内に位置する画素X(k,l)の色差は、判定部219によって強制的に(XL−Ga)が選択されることになり、飽和領域における色差選択を一意に確定させることが可能となる。この結果、上述したような色斑の発生を抑制することができる。   The G variation amount calculation unit 3001 is an optimum color difference selection unit and a G pixel variation amount calculation unit, and is similar to that described in the first embodiment described above, and the missing G pixel as shown in FIG. The G fluctuation signal (k, l) is calculated by reading the Gs signal arranged around the position (k, l), and the weight coefficient w (k, l) as shown in FIG. Corresponding to k, l), a predetermined calculation formula or a lookup table is used. However, the G fluctuation amount calculation unit 3001 of the present embodiment further determines that the weight coefficient w when X (k, l) is determined to be in the saturation region based on the saturation region determination result. (K, l) is forcibly changed to 0 (minimum value) (that is, it is a weighting factor changing means and functions as a fixing means). By performing such processing, since Sa (k, l) × w (k, l) = 0, the color difference of the pixel X (k, l) located in the saturation region is determined by the determination unit 219. (XL-Ga) is forcibly selected, and the color difference selection in the saturation region can be uniquely determined. As a result, the occurrence of color spots as described above can be suppressed.

なお、上述においては、3つの色差候補から1つを選択する場合を例に挙げて説明したが、実施形態1においても説明したような第4の(XLθ−Ga)、またはそれ以上の色差候補を用意した場合にも、上述した技術を同様に適用することができる。そしてこの場合であっても、1つの色差(XL−Ga)が選択されるように重み係数を0とすれば良い。   In the above description, the case of selecting one of the three color difference candidates has been described as an example. However, the fourth (XLθ−Ga) or more color difference candidates as described in the first embodiment are also used. The above-described technique can also be applied in the same manner even when prepared. Even in this case, the weight coefficient may be set to 0 so that one color difference (XL-Ga) is selected.

また、上述においては、色差(XL−Ga)を強制的に選択する手段として、重み係数w(k,l)を0にする手段を説明したが、これに限るものではない。例えば、判定部219に飽和領域判定結果を入力して、複数色差候補の類似度の如何に関わらず強制的に色差(XL−Ga)を選択する(すなわち、判定部219を固定化手段として用いる)という構成を採用しても、同様の結果が得られることになる。   In the above description, as a means for forcibly selecting the color difference (XL−Ga), a means for setting the weighting coefficient w (k, l) to 0 has been described. However, the present invention is not limited to this. For example, the saturated region determination result is input to the determination unit 219, and the color difference (XL-Ga) is forcibly selected regardless of the similarity of the plurality of color difference candidates (that is, the determination unit 219 is used as a fixing unit). ), The same result can be obtained.

さらに、高色差判定手段たる高色差判定部3003は、メモリ212に格納されている色差(XL−Ga)を入力して、予め決定されている閾値THc(この閾値THcの一例としては、最大階調値の1/10程度の値)と比較する。そして、高色差判定部3003は、色差(XL−Ga)が閾値THcよりも大きく、つまり(XL−Ga)>THcとなって、さらに判定部219からの出力である選択信号が色差(XL−Ga)を選択する信号である場合に、G補間を変更するための変更要求信号(オン/オフ)を変更手段たるG補間選択部3005へ出力する。   Further, the high color difference determination unit 3003 serving as the high color difference determination unit inputs the color difference (XL−Ga) stored in the memory 212, and determines a predetermined threshold THc (an example of the threshold THc is the maximum floor). And a value of about 1/10 of the tone value). Then, the high color difference determination unit 3003 has a color difference (XL−Ga) larger than the threshold value THc, that is, (XL−Ga)> THc, and the selection signal output from the determination unit 219 has a color difference (XL− In the case of a signal for selecting Ga), a change request signal (ON / OFF) for changing the G interpolation is output to the G interpolation selection unit 3005 serving as a changing means.

一方、4画素平均G算出部3004は、メモリ222に格納されているG信号から画素X(k,l)の上下左右に隣接するG(k−1,l)、G(k,l−1)、G(k+1,l)、G(k,l+1)の平均値を欠落G画素位置(k,l)の補間Gaとして作成し、作成した補間GaをG補間選択部3005へ出力する。   On the other hand, the 4-pixel average G calculation unit 3004 generates G (k−1, l), G (k, l−1) adjacent to the pixel X (k, l) in the vertical and horizontal directions from the G signal stored in the memory 222. ), G (k + 1, l), and average value of G (k, l + 1) are created as the interpolation Ga of the missing G pixel position (k, l), and the created interpolation Ga is output to the G interpolation selection unit 3005.

G補間選択部3005は、減算部223からの出力である欠落G画素位置(k,l)のG信号補間値Giと、4画素平均G算出部3004からの出力である欠落G画素位置(k,l)のGaとを、高色差判定部3003からの入力である変更要求信号に基づき選択する。すなわち、G補間選択部3005は、変更要求がオンである場合には4画素平均G算出部3004により算出されたGaを選択し、変更要求がオフである場合には減算部223により算出されたG補間値を選択する。   The G interpolation selection unit 3005 outputs the G signal interpolation value Gi of the missing G pixel position (k, l) as an output from the subtraction unit 223 and the missing G pixel position (k as an output from the 4-pixel average G calculation unit 3004). , L) Ga is selected based on a change request signal that is an input from the high color difference determination unit 3003. That is, the G interpolation selection unit 3005 selects Ga calculated by the 4-pixel average G calculation unit 3004 when the change request is on, and calculates by the subtraction unit 223 when the change request is off. Select the G interpolation value.

これにより、G信号よりも大きなX信号をもつ領域であってかつ斜め方向のエッジ部ではG信号補間値Gi=Gaとなり、Xの高周波成分ΔXを加算しないために、ジャギーの発生を抑制することができる。   As a result, in a region having an X signal larger than the G signal and at an oblique edge portion, the G signal interpolation value Gi = Ga, and the high frequency component ΔX of X is not added, thereby suppressing the occurrence of jaggy. Can do.

そして、色差(XL−Ga)≦THcの場合には、X信号とG信号との相関が高いか、またはG信号に対してX信号が小さく、ΔXの影響を無視することができるものと見なして、斜めエッジ部において欠落G画素位置(k,l)の補間値Giを
Gi=X−(XL−Ga)=Ga+ΔX
とすることにより、X信号とG信号との相関が高い領域の斜めエッジの解像度を向上することができる。
When the color difference (XL−Ga) ≦ THc, the correlation between the X signal and the G signal is high, or the X signal is small relative to the G signal, and the influence of ΔX can be ignored. The interpolation value Gi of the missing G pixel position (k, l) at the oblique edge portion
Gi = X- (XL-Ga) = Ga + .DELTA.X
By doing so, it is possible to improve the resolution of the oblique edge in the region where the correlation between the X signal and the G signal is high.

なお、上記閾値判定において、色差(XL−Ga)の絶対値、または偶数乗(例えば、2乗、4乗等)と、上記閾値THcとを比較して、判定を行うようにしても良い。ここに、絶対値、または偶数乗を取ることにより、X信号がG信号に対して小さい場合にも判定することになるために、X信号とG信号との相関性の有無をより厳密に閾値判定することが可能となる。ただし、X信号がG信号に対して小さい場合にはΔXもG信号に対して小さいために、G信号に与える影響度は小さい。   In the threshold determination, the determination may be made by comparing the absolute value or even power (for example, square, fourth power, etc.) of the color difference (XL−Ga) with the threshold THc. Here, by taking the absolute value or even power, it is determined even when the X signal is smaller than the G signal. Therefore, the presence or absence of the correlation between the X signal and the G signal is more strictly determined as a threshold value. It becomes possible to judge. However, when the X signal is smaller than the G signal, ΔX is also smaller than the G signal, so the degree of influence on the G signal is small.

また、縦補間または横補間を用いて算出された色差(X−Gv)または(X−Gh)については、欠落G画素位置(i,j)のG信号補間値Giは、Gi=X−(X−Gv)=Gv、またはGi=X−(X−Gh)=Ghとなり、ΔXの項が存在しないために、これら2つの色差が選択された場合には上述したような問題が発生することはない。従って、色差(X−Gv)または(X−Gh)が選択された場合には、上記高色差判定と、補間値の変更とを行う必要はない。   For the color difference (X−Gv) or (X−Gh) calculated using vertical interpolation or horizontal interpolation, the G signal interpolation value Gi at the missing G pixel position (i, j) is Gi = X− ( X−Gv) = Gv, or Gi = X− (X−Gh) = Gh, and since there is no ΔX term, the above-described problem occurs when these two color differences are selected. There is no. Therefore, when the color difference (X-Gv) or (X-Gh) is selected, it is not necessary to perform the high color difference determination and change of the interpolation value.

さらに、上述では、3つの色差候補から1つを選択する場合を例に挙げて説明したが、実施形態1においても説明したような第4の(XLθ−Ga)、またはそれ以上の色差候補を用意した場合にも、上述した技術を同様に適用することができる。そして、この場合であっても、欠落G画素位置(i,j)のG信号補間値Giに、Gi=Ga+ΔX=Ga+(X−XLθ)に示すように第2項のΔXが存在する場合には、高色差であると判定された位置において補間値GiをGi=Gaとすることにより、縦横以外のエッジに対するジャギーの発生を抑圧することができる。   Further, in the above description, the case where one of three color difference candidates is selected has been described as an example. However, the fourth (XLθ−Ga) or more color difference candidates as described in the first embodiment are used. Even when prepared, the above-described technique can be similarly applied. Even in this case, when the second term ΔX exists in the G signal interpolation value Gi at the missing G pixel position (i, j) as shown by Gi = Ga + ΔX = Ga + (X−XLθ). Can suppress the occurrence of jaggies for edges other than vertical and horizontal by setting the interpolation value Gi to Gi = Ga at the position determined to have a high color difference.

次に、図32は、図30に示す構成のG補間色差算出部102により行われる処理を示すフローチャートである。   Next, FIG. 32 is a flowchart showing processing performed by the G interpolation color difference calculation unit 102 having the configuration shown in FIG.

このG補間色差算出部102には、撮像部101により撮像されてメモリに格納されている単板ベイヤ配列画像が、ラスタスキャン順に入力されるようになっている。そして、G補間色差算出部102は、上述したように、ラスタスキャン順に入力される単板ベイヤ配列画像の内の、Rs信号およびBs信号をメモリ201に、Gs信号をメモリ202に、所定データ分だけそれぞれ格納するようになっている。   The G-interpolation color difference calculation unit 102 is input with the single-plate Bayer array image captured by the imaging unit 101 and stored in the memory in the raster scan order. Then, as described above, the G interpolation color difference calculation unit 102 stores the Rs signal and the Bs signal in the memory 201 and the Gs signal in the memory 202 in the single-plate Bayer array image input in the raster scan order. Only to store each one.

このように、メモリ201,202に所定データ分が格納されている状態において、欠落G信号の補間候補値と色差候補値とをメモリに格納するライン数×ライン画素数=N画素数を所定の初期値(本実施形態ではライン数の初期値=5)にセット(ステップS3200)する。   As described above, in a state where the predetermined amount of data is stored in the memories 201 and 202, the interpolation candidate value and the color difference candidate value of the missing G signal are stored in the memory. The number of lines × the number of line pixels = the number of N pixels is predetermined. The initial value (in this embodiment, the initial value of the number of lines = 5) is set (step S3200).

次に、G信号欠落位置(i,j)に対して、図19に示すような上下に隣接するG信号の平均値Gv(i,j)を補間候補として算出し、G信号欠落位置(i,j)にあるX(i,j)(XはR信号またはB信号を示す)と該補間候補Gv(i,j)とに基づき色差(X−Gv)i,jを算出して、メモリ210に格納する(ステップS3201)。   Next, an average value Gv (i, j) of vertically adjacent G signals as shown in FIG. 19 is calculated as an interpolation candidate for the G signal missing position (i, j), and the G signal missing position (i , J) calculates a color difference (X−Gv) i, j based on X (i, j) (where X represents an R signal or B signal) and the interpolation candidate Gv (i, j), and the memory It stores in 210 (step S3201).

続いて、G信号欠落位置(i,j)に対して、図20に示すような左右に隣接するG信号の平均値Gh(i,j)を補間候補として算出し、G信号欠落位置(i,j)にあるX(i,j)(XはR信号またはB信号を示す)と該補間候補Gh(i,j)とに基づき色差(X−Gh)i,jを算出して、メモリ211に格納する(ステップS3202)。   Subsequently, for the G signal missing position (i, j), an average value Gh (i, j) of the G signals adjacent to the left and right as shown in FIG. 20 is calculated as an interpolation candidate, and the G signal missing position (i , J) calculates a color difference (X−Gh) i, j based on X (i, j) (where X represents an R signal or B signal) and the interpolation candidate Gh (i, j), and the memory It stores in 211 (step S3202).

さらに、G信号欠落位置(i,j)に対して、図21に示すような上下左右に隣接するG信号の平均値Ga(i,j)を補間候補として算出し、G信号欠落位置(i,j)にあるX(i,j)(XはR信号またはB信号を示す)とその周辺上下左右のX(i−2,j),X(i+2,j),X(i,j−2),X(i,j+2)とを用いて斜め45度方向の周波数特性を該平均値Ga(i,j)算出時の補間フィルタの特性に近似させる帯域制限処理(ローパスフィルタ)を実施し、算出したXL(i,j)と該補間候補Ga(i,j)とに基づき色差(XL−Ga)i,jを算出して、メモリ212に格納する(ステップS3203)。   Further, for the G signal missing position (i, j), an average value Ga (i, j) of G signals adjacent vertically and horizontally as shown in FIG. 21 is calculated as an interpolation candidate, and the G signal missing position (i , J) and X (i, j), X (i-2, j), X (i + 2, j), X (i, j−) 2) and X (i, j + 2) are used to perform a band limiting process (low-pass filter) that approximates the frequency characteristic in the oblique 45 degree direction to the characteristic of the interpolation filter when calculating the average value Ga (i, j). The color difference (XL−Ga) i, j is calculated based on the calculated XL (i, j) and the interpolation candidate Ga (i, j), and stored in the memory 212 (step S3203).

この時点で、N画素分の処理が終了したか否かを判定する(ステップS3204)。   At this point, it is determined whether or not the processing for N pixels has been completed (step S3204).

ここで、N画素分の処理がまだ終了していない場合には上述したステップS3201に戻って、(X−Gv)i,j、(X−Gh)i,j、(XL−Ga)i,jを算出してメモリに格納する処理を続けて行う。   If the processing for N pixels has not been completed yet, the process returns to step S3201, and (X-Gv) i, j, (X-Gh) i, j, (XL-Ga) i, Continue to calculate j and store it in memory.

一方、ステップS3204において、N画素分の処理が終了したと判定された場合には、Nを1にセットする(ステップS3205)。   On the other hand, if it is determined in step S3204 that the processing for N pixels has been completed, N is set to 1 (step S3205).

そして、G信号欠落位置(k,l)に対して周辺12画素のG信号に基づいてG変動量を算出し、さらに周辺5画素のX信号と周辺4画素のX^信号とに基づき飽和状態を算出して、該G変動量と該飽和状態とに対応する重み係数w(k,l)に変換する(ステップS3206)。   Then, the G fluctuation amount is calculated based on the G signal of the surrounding 12 pixels with respect to the G signal missing position (k, l), and is further saturated based on the X signal of the surrounding 5 pixels and the X ^ signal of the surrounding 4 pixels. Is calculated and converted into a weighting coefficient w (k, l) corresponding to the G fluctuation amount and the saturation state (step S3206).

そして、上述したステップS3201からステップS3204の処理ループを行ったことによりメモリに格納されているG信号欠落位置(k,l)の同一補間種(Xが同一色であってかつGの種類が同一のGvである)により算出された色差(X−Gv)k,lと、その近傍8方向の同種色差(X−Gv)k+n,l+m(ここに、n=−2,0,2、m=−2,0,2であってかつnとmとは同時には0とはならない。)と、に基づいて周辺類似度Sv1(k,l)を算出するとともに、色差(X−Gv)k,lの周辺異種色差、つまり色がXとは異なる色X^であってかつGの種類が同一のGvである色差(X^−Gv)k+n,l+m(ここに、n=−1,1、m=−1,1)に基づいて周辺類似度Sv2(k,l)を算出して、これら2つの周辺類似度Sv1(k,l)とSv2(k,l)とを加算して周辺類似度Sv(k,l)を算出する(ステップS3207)。   The same interpolation type (X is the same color and G type is the same for the G signal missing position (k, l) stored in the memory by performing the processing loop from step S3201 to step S3204 described above. Color difference (X−Gv) k, l calculated by the following Gv) and the same kind of color difference (X−Gv) k + n, l + m in the eight directions in the vicinity thereof (where n = −2, 0, 2 and m = −2, 0, 2 and n and m are not 0 at the same time.), The peripheral similarity Sv1 (k, l) is calculated, and the color difference (X− Gv) Different color difference around k, l, that is, color difference X (X ^ -Gv) k + n, l + m (here, color X ^ which is different from X and G type is the same) , N = -1,1, m = -1,1) to calculate the peripheral similarity Sv2 (k, l), and these two peripheral similarities Sv1 (k, l) and Sv2 k, l) and adding to the calculating the surrounding similarity Sv (k, l) (step S3207).

続いて、メモリに格納されているG信号欠落位置(k,l)の同一補間種(Xが同一色であってかつGの種類が同一のGhである)により算出された色差(X−Gh)k,lとその近傍8方向の同種色差(X−Gh)k+n,l+m(ここに、n=−2,0,2、m=−2,0,2であってかつnとmとは同時には0にならない。)と、に基づいて周辺類似度Sh1(k,l)を算出するとともに、色差(X−Gh)k,lの周辺異種色差、つまり色がXとは異なる色X^であってかつGの種類が同一のGhである色差(X^−Gh)k+n,l+m(ここに、n=−1,1、m=−1,1)に基づいて周辺類似度Sh2(k,l)を算出して、これら2つの周辺類似度Sh1(k,l)とSh2(k,l)とを加算して周辺類似度Sh(k,l)を算出する(ステップS3208)。   Subsequently, the color difference (X−Gh) calculated by the same interpolation type (X is the same color and G type is the same Gh) of the G signal missing position (k, l) stored in the memory. ) K, l and its adjacent eight-direction color difference (X−Gh) k + n, l + m (where n = −2, 0, 2, m = −2, 0, 2 and n And m are not equal to 0 at the same time) and the peripheral similarity Sh1 (k, l) is calculated based on the above, and the peripheral different color difference of the color difference (X−Gh) k, l, that is, the color is X Color difference (X ^ −Gh) k + n, l + m (where n = −1, 1, m = −1, 1) of different colors X ^ and G having the same Gh Based on this, the peripheral similarity Sh2 (k, l) is calculated, and these two peripheral similarities Sh1 (k, l) and Sh2 (k, l) are added to obtain the peripheral similarity Sh (k, l). Calculate (step S3208).

さらに、メモリに格納されているG信号欠落位置(k,l)の同一補間種(XLが同一色であってかつGの種類が同一のGaである)により算出された色差(XL−Ga)k,lとその近傍8方向の同種色差(XL−Ga)k+n,l+m(ここに、n=−2,0,2、m=−2,0,2であってかつnとmとは同時には0にならない。)と、に基づいて周辺類似度Sa1(k,l)を算出するとともに、色差(XL−Ga)k,lの周辺異種色差、つまり色がXLとは異なる色X^LであってかつGの種類が同一のGaである色差(X^L−Ga)k+n,l+m(ここに、n=−1,1、m=−1,1)に基づいて周辺類似度Sa2(k,l)を算出して、これら2つの周辺類似度Sa1(k,l)とSa2(k,l)とを加算して周辺類似度Sa(k,l)を算出し、さらに、ステップS3206によって算出したG変動量重み係数w(k,l)と乗算する(ステップS3209)。   Further, the color difference (XL−Ga) calculated by the same interpolation type (XL is the same color and G type is the same Ga) of the G signal missing position (k, l) stored in the memory. k, l and the same kind of color difference (XL−Ga) k + n, l + m in the eight directions nearby (where n = −2, 0, 2, m = −2, 0, 2 and n m is not 0 at the same time.) and the peripheral similarity Sa1 (k, l) is calculated based on the above, and the peripheral different color difference of the color difference (XL−Ga) k, l, that is, the color is different from XL. Color difference (X ^ L-Ga) k + n, l + m of color X ^ L and G of the same type Ga (where n = -1,1, m = -1,1) The peripheral similarity Sa2 (k, l) is calculated based on the above, and the two peripheral similarities Sa1 (k, l) and Sa2 (k, l) are added to obtain the peripheral similarity Sa (k, l). And further, step S32 G variation weighting factor w (k, l) calculated by 6 and multiplied (step S3209).

このようにして算出される各周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)×w(k,l)は、値が小さい程、類似性が高いことを示す量となっている。そして、続く処理において、類似性が最大(類似度の値としては最小)となる色差候補を1つ選択する処理を行う。   Each of the peripheral similarity Sv (k, l), Sh (k, l), and Sa (k, l) × w (k, l) calculated in this way has a higher similarity as the value is smaller. It is the quantity which shows. In the subsequent process, a process of selecting one color difference candidate having the maximum similarity (minimum similarity value) is performed.

すなわち、上述したようにして3つの周辺類似度Sv(k,l)、Sh(k,l)、Sa(k,l)×w(k,l)が算出されたところで、まず、周辺類似度Sv(k,l)と周辺類似度Sh(k,l)とを比較する(ステップS3210)。   That is, when the three peripheral similarity Sv (k, l), Sh (k, l), and Sa (k, l) × w (k, l) are calculated as described above, first, the peripheral similarity is calculated. Sv (k, l) is compared with the peripheral similarity Sh (k, l) (step S3210).

ここで、周辺類似度Sv(k,l)が周辺類似度Sh(k,l)よりも小さいと判定された場合には、さらに、周辺類似度Sv(k,l)と周辺類似度Sa(k,l)×w(k,l)とを比較する(ステップS3212)。   If it is determined that the peripheral similarity Sv (k, l) is smaller than the peripheral similarity Sh (k, l), the peripheral similarity Sv (k, l) and the peripheral similarity Sa ( k, l) × w (k, l) is compared (step S3212).

一方、ステップS3210において、周辺類似度Sv(k,l)が周辺類似度Sh(k,l)以上であると判定された場合には、さらに、周辺類似度Sh(k,l)と周辺類似度Sa(k,l)×w(k,l)とを比較する(ステップS3211)。   On the other hand, if it is determined in step S3210 that the peripheral similarity Sv (k, l) is equal to or higher than the peripheral similarity Sh (k, l), the peripheral similarity Sh (k, l) and the peripheral similarity are further increased. The degree Sa (k, l) × w (k, l) is compared (step S3211).

そして、上述したステップS3212において、周辺類似度Sv(k,l)が周辺類似度Sa(k,l)×w(k,l)よりも小さいと判定された場合には、G信号欠落位置(k,l)の色差を(X−Gv)k,lに決定して、メモリに格納する(ステップS3213)。   In step S3212 described above, if it is determined that the peripheral similarity Sv (k, l) is smaller than the peripheral similarity Sa (k, l) × w (k, l), the G signal missing position ( The color difference of k, l) is determined as (X−Gv) k, l and stored in the memory (step S3213).

また、上述したステップS3212において周辺類似度Sv(k,l)が周辺類似度Sa(k,l)×w(k,l)以上であると判定された場合、または、上述したステップS3211において周辺類似度Sh(k,l)が周辺類似度Sa(k,l)×w(k,l)以上であると判定された場合には、G信号欠落位置(k,l)の色差を(XL−Ga)k,lに決定して、メモリに格納する(ステップS3214)。   If it is determined in step S3212 that the peripheral similarity Sv (k, l) is equal to or higher than the peripheral similarity Sa (k, l) × w (k, l), or in the above-described step S3211 When it is determined that the similarity Sh (k, l) is equal to or higher than the peripheral similarity Sa (k, l) × w (k, l), the color difference of the G signal missing position (k, l) is expressed as (XL -Ga) k, l is determined and stored in the memory (step S3214).

さらに、上述したステップS3211において周辺類似度Sh(k,l)が周辺類似度Sa(k,l)×w(k,l)よりも小さいと判定された場合には、G信号欠落位置(k,l)の色差を(X−Gh)k,lに決定して、メモリに格納する(ステップS3215)。   Furthermore, when it is determined in step S3211 described above that the peripheral similarity Sh (k, l) is smaller than the peripheral similarity Sa (k, l) × w (k, l), the G signal missing position (k , L) is determined as (X−Gh) k, l and stored in the memory (step S3215).

こうして、ステップS3213、ステップS3214、またはステップS3215の何れかの処理を行った後に、上記決定された色差(k,l)をX(k,l)から減算することによりG(k,l)を算出して、算出したGをメモリに格納する(ステップS3216)。   Thus, after performing any of the processing of step S3213, step S3214, or step S3215, G (k, l) is obtained by subtracting the determined color difference (k, l) from X (k, l). The calculated G is stored in the memory (step S3216).

さらに、G信号欠落位置(k,l)の周辺4画素G(k−1,l)、G(k+1,l)、G(k,l−1)、G(k,l+1)の平均値Gaを算出する(ステップS3217)。   Further, the average value Ga of the four surrounding pixels G (k-1, l), G (k + 1, l), G (k, l-1), G (k, l + 1) around the G signal missing position (k, l). Is calculated (step S3217).

そして、G信号欠落位置(k,l)において決定された色差(k,l)が(XL−Ga)k,lであり、かつその値が閾値THcよりも大きいか否かを判定する(ステップS3218)。   Then, it is determined whether or not the color difference (k, l) determined at the G signal missing position (k, l) is (XL−Ga) k, l and the value is larger than the threshold value THc (step). S3218).

ここで、色差(k,l)が(XL−Ga)k,lであって、かつその値が閾値THcよりも大きいと判定された場合には、メモリに格納されているG(k,l)を周辺4画素平均値Gaに置き換える(ステップS3219)。   Here, if it is determined that the color difference (k, l) is (XL−Ga) k, l and the value is larger than the threshold value THc, G (k, l) stored in the memory. ) Is replaced with the peripheral 4-pixel average value Ga (step S3219).

ステップS3218において色差(k,l)が(XL−Ga)k,lでないか、もしくは色差(k,l)の値が閾値THc以下であると判定された場合、またはステップS3219の処理を行った場合には、その後、出力画像としての総画素数の処理を終了したか否かを判定する(ステップS3220)。   If it is determined in step S3218 that the color difference (k, l) is not (XL−Ga) k, l, or the value of the color difference (k, l) is less than or equal to the threshold value THc, or the process of step S3219 is performed. In that case, it is then determined whether or not the processing of the total number of pixels as the output image has been completed (step S3220).

ここで、総画素数の処理がまだ終了していないと判定された場合には、上述したステップS3201に戻って、メモリに格納されている不必要となった(X−Gv)、(X−Gh)、(XL−Ga)、Sv、Sh、Saを新しく算出される値で置き換えながら、上述したような処理を続けて行う。   If it is determined that the processing for the total number of pixels has not been completed yet, the process returns to step S3201 described above, and is no longer necessary (X-Gv), (X- Gh), (XL−Ga), Sv, Sh, and Sa are replaced with newly calculated values, and the above-described processing is continuously performed.

一方、ステップS3220において、総画素数の処理が終了したと判定された場合には、このG補間色差算出処理を終了する。   On the other hand, if it is determined in step S3220 that the process for the total number of pixels has been completed, the G interpolation color difference calculation process is terminated.

なお、この実施形態3の技術は、上述した実施形態2の技術と全く問題なく組み合わせることが可能であるのはいうまでもない。   Needless to say, the technique of the third embodiment can be combined with the technique of the second embodiment described above without any problem.

このような実施形態3によれば、上述した実施形態1とほぼ同様の効果を奏するとともに、実施形態1よりも広い撮像条件下における画質劣化を抑制して、高画質なカラー画像を復元することができる。   According to the third embodiment, the same effects as those of the first embodiment described above can be obtained, and deterioration of image quality under a wider imaging condition than that of the first embodiment can be suppressed to restore a high-quality color image. Can do.

また、上述した各実施形態においては、RGBベイヤ配列画像からサンプリング位置を同時化したカラー画像を生成する画像処理装置についてを主として説明したが、汎用の処理回路等に同様の処理を行う画像処理方法を適用するようにしても良いし、画像処理プログラムをコンピュータに実行させて同様の処理を行うようにすることも可能である。   In each of the above-described embodiments, the image processing apparatus that generates a color image in which sampling positions are synchronized from an RGB Bayer array image has been mainly described. However, an image processing method for performing similar processing on a general-purpose processing circuit or the like. Alternatively, the image processing program may be executed by a computer to perform the same processing.

なお、本発明は上述した実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化することができる。また、上記実施形態に開示されている複数の構成要素の適宜な組み合わせにより、種々の発明を形成することができる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除しても良い。さらに、異なる実施形態にわたる構成要素を適宜組み合わせても良い。このように、発明の主旨を逸脱しない範囲内において種々の変形や応用が可能であることは勿論である。   Note that the present invention is not limited to the above-described embodiment as it is, and can be embodied by modifying the constituent elements without departing from the scope of the invention in the implementation stage. Moreover, various inventions can be formed by appropriately combining a plurality of constituent elements disclosed in the embodiment. For example, you may delete some components from all the components shown by embodiment. Furthermore, the constituent elements over different embodiments may be appropriately combined. Thus, it goes without saying that various modifications and applications are possible without departing from the spirit of the invention.

本発明は、RGBベイヤ配列画像を処理する画像処理装置、画像処理プログラム、画像処理方法に好適に利用することができる。   The present invention can be suitably used for an image processing apparatus, an image processing program, and an image processing method for processing RGB Bayer array images.

本発明の実施形態1における画像処理装置の全体的な構成を示すブロック図。1 is a block diagram showing an overall configuration of an image processing apparatus according to Embodiment 1 of the present invention. 上記実施形態1のG補間色差算出部の構成を示すブロック図。FIG. 3 is a block diagram illustrating a configuration of a G interpolation color difference calculation unit according to the first embodiment. 上記実施形態1の色差補間処理部の構成を示すブロック図The block diagram which shows the structure of the color difference interpolation process part of the said Embodiment 1. FIG. 上記実施形態1のRGB算出部の構成を示すブロック図。FIG. 3 is a block diagram illustrating a configuration of an RGB calculation unit according to the first embodiment. 上記実施形態1において、撮像部の単板撮像素子により撮像された色信号のベイヤ配列を示す図。In the said Embodiment 1, the figure which shows the Bayer arrangement | sequence of the color signal imaged with the single plate image sensor of the imaging part. 上記実施形態1において、G補間色差算出部から出力されるG信号の2次元配列を示す図。In the said Embodiment 1, the figure which shows the two-dimensional arrangement | sequence of G signal output from the G interpolation color difference calculation part. 上記実施形態1において、G補間色差算出部から出力されるR−Gi,B−Gi信号(X−Gi信号の一例)の2次元配列を示す図。In the said Embodiment 1, the figure which shows the two-dimensional arrangement | sequence of the R-Gi and B-Gi signal (an example of an X-Gi signal) output from the G interpolation color difference calculation part. 本発明の実施形態2における画像処理装置の全体的な構成を示すブロック図。The block diagram which shows the whole structure of the image processing apparatus in Embodiment 2 of this invention. 上記実施形態2の補間処理部の構成を示すブロック図。The block diagram which shows the structure of the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるG信号の補間処理単位の一例を示す図。The figure which shows an example of the interpolation process unit of G signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるR−Gi信号の補間処理単位の一例を示す図。The figure which shows an example of the interpolation process unit of the R-Gi signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるB−Gi信号の補間処理単位の一例を示す図。The figure which shows an example of the interpolation process unit of the B-Gi signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるG信号に対する8×8タップの2次元補間フィルタ係数を示す図。The figure which shows the 2 * interpolation filter coefficient of 8x8 tap with respect to G signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部において用いられる補間フィルタの周波数特性を示す線図。The diagram which shows the frequency characteristic of the interpolation filter used in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるR−Gi信号またはB−Gi信号に対する第1の8×8タップの2次元補間フィルタ係数を示す図。The figure which shows the 2nd interpolation filter coefficient of the 1st 8x8 tap with respect to the R-Gi signal or B-Gi signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるR−Gi信号またはB−Gi信号に対する第2の8×8タップの2次元補間フィルタ係数を示す図。The figure which shows the 2nd 8 * 8 tap two-dimensional interpolation filter coefficient with respect to the R-Gi signal or B-Gi signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるR−Gi信号またはB−Gi信号に対する第3の8×8タップの2次元補間フィルタ係数を示す図。The figure which shows the 3rd 8x8 tap two-dimensional interpolation filter coefficient with respect to the R-Gi signal or B-Gi signal in the interpolation process part of the said Embodiment 2. FIG. 上記実施形態2の補間処理部におけるR−Gi信号またはB−Gi信号に対する第4の8×8タップの2次元補間フィルタ係数を示す図。The figure which shows the 4th 8 * 8 tap two-dimensional interpolation filter coefficient with respect to the R-Gi signal in the interpolation process part of the said Embodiment 2, or a B-Gi signal. 上記実施形態1において、欠落G信号位置の縦方向補間として用いる上下方向の隣接G信号のベイヤ配列上における位置を示す図。The figure which shows the position on the Bayer arrangement | sequence of the adjacent G signal of the up-down direction used as vertical direction interpolation of the missing G signal position in the said Embodiment 1. FIG. 上記実施形態1において、欠落G信号位置の横方向補間として用いる左右方向の隣接G信号のベイヤ配列上における位置を示す図。The figure which shows the position on the Bayer arrangement | sequence of the adjacent G signal of the left-right direction used as horizontal direction interpolation of the missing G signal position in the said Embodiment 1. FIG. 上記実施形態1において、欠落G信号位置の隣接4画素補間として用いる上下左右方向の隣接G信号のベイヤ配列上における位置を示す図。The figure which shows the position on the Bayer arrangement | sequence of the adjacent G signal of the up-down and left-right direction used as adjacent 4 pixel interpolation of the missing G signal position in the said Embodiment 1. FIG. 上記実施形態1において、欠落G信号位置において縦方向補間により算出した色差の内の周辺類似度算出に使用する色差信号のベイヤ配列上の位置を示す図。In the said Embodiment 1, the figure which shows the position on the Bayer arrangement | sequence of the color difference signal used for the periphery similarity calculation of the color differences calculated by the vertical direction interpolation in the missing G signal position. 上記実施形態1において、欠落G信号位置において横方向補間により算出した色差の内の周辺類似度算出に使用する色差信号のベイヤ配列上の位置を示す図。FIG. 4 is a diagram illustrating a position on a Bayer array of color difference signals used for calculating a peripheral similarity among color differences calculated by lateral interpolation at a missing G signal position in the first embodiment. 上記実施形態1において、欠落G信号位置において隣接4画素補間により算出した色差の内の周辺類似度算出に使用する色差信号のベイヤ配列上の位置を示す図。FIG. 4 is a diagram illustrating a position on a Bayer array of color difference signals used for calculating a peripheral similarity among color differences calculated by adjacent four-pixel interpolation at a missing G signal position in the first embodiment. 上記実施形態1において、G変動量算出部によって使用するG信号のベイヤ配列上の位置を示す図。The figure which shows the position on the Bayer arrangement | sequence of G signal used by the G fluctuation amount calculation part in the said Embodiment 1. FIG. 上記実施形態1において、G変動量算出部において算出するG変動量と、隣接4画素補間を用いて算出した周辺類似度に対する重み係数と、の関係を示す線図。In the said Embodiment 1, the diagram which shows the relationship between G variation | change_quantity calculated in a G variation | change_quantity calculation part, and the weighting coefficient with respect to the periphery similarity calculated using adjacent 4 pixel interpolation. 上記実施形態1において、ローパスフィルタを構成するために使用する色信号Xのベイヤ配列上の位置を示す図。The figure which shows the position on the Bayer arrangement | sequence of the color signal X used in order to comprise a low-pass filter in the said Embodiment 1. FIG. 上記実施形態1において、撮像画像および補間画素等の水平方向に対して斜め45度方向の周波数特性を示す図。The figure which shows the frequency characteristic of 45 degrees diagonal with respect to horizontal directions, such as a captured image and an interpolation pixel, in the said Embodiment 1. FIG. 上記実施形態1の図2に示す構成のG補間色差算出部により行われる処理を示すフローチャート。3 is a flowchart showing processing performed by a G interpolation color difference calculation unit having the configuration shown in FIG. 2 of the first embodiment. 本発明の実施形態3のG補間色差算出部の構成を示すブロック図。The block diagram which shows the structure of the G interpolation color difference calculation part of Embodiment 3 of this invention. 上記実施形態3において、X画素に対するブルーミング発生領域での周辺G画素に不均一に電荷が漏れた状態を示す図。In the said Embodiment 3, the figure which shows the state which the electric charge leaked unevenly to the periphery G pixel in the blooming generation | occurrence | production area | region with respect to X pixel. 上記実施形態3の図30に示す構成のG補間色差算出部により行われる処理を示すフローチャート。The flowchart which shows the process performed by the G interpolation color difference calculation part of the structure shown in FIG. 30 of the said Embodiment 3. FIG.

符号の説明Explanation of symbols

101…撮像部
102…G補間色差算出部
103…色差補間処理部(色差補間手段)
104…RGB算出部(RGB画素算出手段)
105…圧縮記録部
201,202…メモリ
203…縦補間G算出部(G画素補間候補算出手段、第1の補間算出手段)
204…横補間G算出部(G画素補間候補算出手段、第2の補間算出手段)
205…4画素平均G算出部(G画素補間候補算出手段、第3の補間算出手段)
206…ローパスフィルタ(帯域制限手段)
207,208,209…減算部(色差候補算出手段)
210,211,212…メモリ
213,214,215…周辺類似度算出部(最適色差選択手段、選択手段)
216…G変動量算出部(最適色差選択手段、G画素変動量算出手段)
217…メモリ
218…乗算部(最適色差選択手段、乗算手段)
219…判定部(最適色差選択手段、固定化手段)
220…色差選択部(最適色差選択手段、選択手段)
221,222…メモリ
223…減算部(減算手段)
301…色差選別部
302,303…メモリ
304,305…補間算出部
401…メモリ
402,403…加算部
404…カラーマトリックス処理部
405,406,407…γ補正部
801…補間処理部
901,902,903…メモリ
904,905…補間算出部(色差補間手段)
906…補間算出部(G補間手段)
907…補間係数算出部
908…制御部
909…メモリ
3001…G変動量算出部(最適色差選択手段、G画素変動量算出手段、固定化手段、重み係数変更手段)
3002…飽和領域判定部(飽和状態判定手段)
3003…高色差判定部(高色差判定手段)
3004…4画素平均G算出部
3005…G補間選択部(変更手段)
DESCRIPTION OF SYMBOLS 101 ... Imaging part 102 ... G interpolation color difference calculation part 103 ... Color difference interpolation process part (color difference interpolation means)
104... RGB calculation unit (RGB pixel calculation means)
105: Compression recording unit 201, 202 ... Memory 203 ... Vertical interpolation G calculation unit (G pixel interpolation candidate calculation means, first interpolation calculation means)
204 .. Horizontal interpolation G calculation unit (G pixel interpolation candidate calculation means, second interpolation calculation means)
205... 4 pixel average G calculation unit (G pixel interpolation candidate calculation means, third interpolation calculation means)
206: Low pass filter (band limiting means)
207, 208, 209 ... subtracting section (color difference candidate calculating means)
210, 211, 212 ... memory 213, 214, 215 ... peripheral similarity calculation unit (optimum color difference selection means, selection means)
216... G variation amount calculation unit (optimum color difference selection means, G pixel variation amount calculation means)
217 ... Memory 218 ... Multiplication unit (optimum color difference selection means, multiplication means)
219... Determination unit (optimum color difference selection means, fixing means)
220 ... Color difference selection section (optimum color difference selection means, selection means)
221, 222 ... Memory 223 ... Subtraction unit (subtraction means)
301 ... Color difference selection unit 302, 303 ... Memory 304, 305 ... Interpolation calculation unit 401 ... Memory 402, 403 ... Addition unit 404 ... Color matrix processing unit 405, 406, 407 ... γ correction unit 801 ... Interpolation processing unit 901, 902 903: Memory 904, 905: Interpolation calculation unit (color difference interpolation means)
906: Interpolation calculation unit (G interpolation means)
907: Interpolation coefficient calculation unit 908 ... Control unit 909 ... Memory 3001 ... G variation amount calculation unit (optimum color difference selection unit, G pixel variation amount calculation unit, fixing unit, weighting factor change unit)
3002 ... Saturation region determination unit (saturation state determination means)
3003 ... High color difference determination unit (high color difference determination means)
3004... 4-pixel average G calculation unit 3005... G interpolation selection unit (changing means)

Claims (15)

複数の色信号のうち少なくとも一つの色信号が欠落している画素を含む画像を処理して、複数の色信号のうち少なくとも第1の色信号が補間された画素を含む画像を生成する画像処理装置であって、
上記画像における位置を(x,y)(ここに、xは横方向の画素位置を示す整数、yは縦方向の画素位置を示す整数)として表し、上記第1の色信号を有する画素が欠落している位置(x0,y0)の上記第1の色信号とは異なる第2の色信号を有する画素をX(x0,y0)としたときに、このX(x0,y0)に対して、M種類(Mは2以上の整数)の補間態様で補間されたM種類の上記第1の色信号Gt(x0,y0)(ここに、t=1,…,M)を算出する画素補間候補算出手段と、
上記X(x0,y0)に対して周辺の同種色信号を用いて帯域制限したXL(x0,y0)を算出する帯域制限手段と、
上記画素補間候補算出手段により算出されたM種類の上記第1の色信号Gtに基づいて、色差候補X(x0,y0)−Gt(x0,y0)または色差候補XL(x0,y0)−Gt(x0,y0)でなるM種類の色差候補を算出する色差候補算出手段と、
上記色差候補X(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号Gt(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出された上記第1の色信号Gt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補X(x0,y0)−Gt(x0,y0)とに基づいて、
または、上記色差候補XL(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号Gt(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出されたGt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXLの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補XL(x0,y0)−Gt(x0,y0)とに基づいて、M種類の色差類似度を算出し、
この算出したM種類の色差類似度に基づいて、M種類の上記第1の色信号Gt(x0,y0)の内のp種類の上記第1の色信号Gp(x0,y0)(ここに、1≦p≦M)またはq種類の上記第1の色信号Gq(x0,y0)(ここに、1≦q≦M)に基づき算出された色差候補X(x0,y0)−Gp(x0,y0)または色差候補XL(x0,y0)−Gq(x0,y0)を色差として選択する最適色差選択手段と、
上記X(x0,y0)から上記最適色差選択手段により選択された色差X(x0,y0)−Gp(x0,y0)または色差XL(x0,y0)−Gq(x0,y0)を減算することにより、位置(x0,y0)に対する上記第1の色信号G(x0,y0)を算出する算出手段と、
を具備したことを特徴とする画像処理装置。
Image processing for processing an image including a pixel in which at least one color signal is missing among a plurality of color signals and generating an image including a pixel in which at least a first color signal is interpolated among the plurality of color signals A device,
The position in the image is represented as (x, y) (where x is an integer indicating the pixel position in the horizontal direction and y is an integer indicating the pixel position in the vertical direction), and the pixel having the first color signal is missing When a pixel having a second color signal different from the first color signal at the position (x0, y0) is X (x0, y0), for this X (x0, y0), Pixel interpolation candidates for calculating M types of first color signals Gt (x0, y0) (here, t = 1,..., M) interpolated in M types (M is an integer of 2 or more). A calculation means;
Band limiting means for calculating XL (x0, y0) band-limited to the above X (x0, y0) using peripheral similar color signals;
Based on the M types of first color signals Gt calculated by the pixel interpolation candidate calculation means, color difference candidates X (x0, y0) -Gt (x0, y0) or color difference candidates XL (x0, y0) -Gt Color difference candidate calculating means for calculating M types of color difference candidates of (x0, y0);
Peripheral position (x0 + n, y0 + m) of the same type t as the first color signal Gt (x0, y0) used in calculating the color difference candidate X (x0, y0) −Gt (x0, y0) (here In addition, based on the first color signal Gt (x0 + n, y0 + m) calculated for n and m, which are arbitrary integers that are not 0 at the same time, X calculated for the peripheral position (x0 + n, y0 + m) Based on the plurality of color difference candidates X (x0 + n, y0 + m) −Gt (x0 + n, y0 + m) and the color difference candidates X (x0, y0) −Gt (x0, y0),
Alternatively, the peripheral position (x0 + n, y0 + m) of the same type t as the first color signal Gt (x0, y0) used in calculating the color difference candidate XL (x0, y0) −Gt (x0, y0). Based on Gt (x0 + n, y0 + m) calculated in (here, n and m are arbitrary integers that are not 0 at the same time), a plurality of XL color differences calculated for the peripheral position (x0 + n, y0 + m) Based on the candidate XL (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) and the color difference candidate XL (x0, y0) -Gt (x0, y0), M types of color difference similarities are calculated,
Based on the calculated M kinds of color difference similarities, p kinds of the first color signals Gp (x0, y0) (here, out of M kinds of the first color signals Gt (x0, y0)) 1 ≦ p ≦ M) or q kinds of first color signals Gq (x0, y0) (here, 1 ≦ q ≦ M), color difference candidates X (x0, y0) −Gp (x0, y0) or optimum color difference selection means for selecting a color difference candidate XL (x0, y0) -Gq (x0, y0) as a color difference;
Subtracting the color difference X (x0, y0) -Gp (x0, y0) or the color difference XL (x0, y0) -Gq (x0, y0) selected by the optimum color difference selection means from the X (x0, y0). Calculating means for calculating the first color signal G (x0, y0) for the position (x0, y0),
An image processing apparatus comprising:
上記最適色差選択手段によっては色差が算出されない位置の色差を、該最適色差選択手段により算出された該位置の周辺の同一色の色差に基づいて補間する処理を行う色差補間手段と、
上記最適色差選択手段または上記色差補間手段により算出された色差と、この色差と同一位置の上記第1の色信号を有する画素と、に基づいて、複数の色信号を含む画素を算出する画素算出手段と、
をさらに具備したことを特徴とする請求項1に記載の画像処理装置。
A color difference interpolation unit that performs a process of interpolating a color difference at a position where a color difference is not calculated by the optimal color difference selection unit based on a color difference of the same color around the position calculated by the optimal color difference selection unit;
Pixel calculation for calculating a pixel including a plurality of color signals based on the color difference calculated by the optimum color difference selection unit or the color difference interpolation unit and the pixel having the first color signal at the same position as the color difference. Means,
The image processing apparatus according to claim 1, further comprising:
所定位置の周辺の同一色の色差に基づいて、該所定位置に対する補間色差を算出する色差補間手段と、
上記所定位置の周辺の上記第1の色信号を有する画素に基づいて、該所定位置に対して補間された上記第1の色信号を算出する補間手段と、
上記所定位置に算出された補間色差と上記補間された第1の色信号とに基づいて、該所定位置において、複数の色信号を含む画素を算出する画素算出手段と、
をさらに具備したことを特徴とする請求項1に記載の画像処理装置。
A color difference interpolation means for calculating an interpolated color difference for the predetermined position based on a color difference of the same color around the predetermined position;
Based on the pixels having the first color signal around the predetermined position, and interpolation means for calculating an interpolated the first color signal in pair to the predetermined position,
Based on the first color signals the interpolated color difference calculated in the predetermined position and the interpolation pixel calculation means for calculating fraud and mitigating risk pixel including a plurality of color signals in the predetermined position,
The image processing apparatus according to claim 1, further comprising:
上記最適色差選択手段は、上記色差類似度を、
上記色差候補X(x0,y0)−Gt(x0,y0)と、該色差候補X(x0,y0)−Gt(x0,y0)と同一色Xかつ同一種類tの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、に基づいた類似度と、
上記色差候補X(x0,y0)−Gt(x0,y0)とは異なる色X^かつ同一種類tの複数の色差候補X^(x0+n,y0+m)−Gt(x0+n,y0+m)に基づいた類似度と、
に基づき算出するものであることを特徴とする請求項1に記載の画像処理装置。
The optimum color difference selection means calculates the color difference similarity as follows:
The color difference candidate X (x0, y0) -Gt (x0, y0) and a plurality of color difference candidates X (x0 + n) of the same color X and the same type t as the color difference candidate X (x0, y0) -Gt (x0, y0) , Y0 + m) −Gt (x0 + n, y0 + m), and
Similarity based on a plurality of color difference candidates X ^ (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) of a color X ^ different from the color difference candidates X (x0, y0) -Gt (x0, y0) and of the same type t. When,
The image processing apparatus according to claim 1, wherein the image processing apparatus is calculated on the basis of the above.
上記最適色差選択手段は、上記色差類似度を、
上記色差候補XL(x0,y0)−Gt(x0,y0)と、該色差候補XL(x0,y0)−Gt(x0,y0)と同一色Xかつ同一種類tの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、に基づいた類似度と、
上記色差候補XL(x0,y0)−Gt(x0,y0)とは異なる色X^かつ同一種類tの複数の色差候補X^L(x0+n,y0+m)−Gt(x0+n,y0+m)に基づいた類似度と、
に基づき算出するものであることを特徴とする請求項1に記載の画像処理装置。
The optimum color difference selection means calculates the color difference similarity as follows:
The color difference candidate XL (x0, y0) -Gt (x0, y0) and a plurality of color difference candidates XL (x0 + n) of the same color X and the same type t as the color difference candidate XL (x0, y0) -Gt (x0, y0) , Y0 + m) −Gt (x0 + n, y0 + m), and
Similarity based on a plurality of color difference candidates X ^ L (x0 + n, y0 + m) -Gt (x0 + n, y0 + m) of a color X ^ different from the color difference candidates XL (x0, y0) -Gt (x0, y0) and of the same type t Degree,
The image processing apparatus according to claim 1, wherein the image processing apparatus is calculated on the basis of the above.
上記類似度は、同一色Xかつ同一種類tの色差候補同士の差分絶対値の和であり、
上記最適色差選択手段は、M種類の上記色差類似度の内の最小値を与える色差類似度の1つに対応する色差候補を1つ選択する選択手段を含み、該選択手段により選択された色差候補を色差とするものであることを特徴とする請求項4または請求項5に記載の画像処理装置。
The similarity is the sum of absolute differences between color difference candidates of the same color X and the same type t,
The optimum color difference selecting means includes a selecting means for selecting one color difference candidate corresponding to one of the color difference similarities giving the minimum value among the M kinds of color difference similarities, and the color difference selected by the selecting means 6. The image processing apparatus according to claim 4, wherein the candidate is a color difference.
上記最適色差選択手段によって選択された色差がXL(x0,y0)−Gt(x0,y0)である場合に、該色差を所定の閾値と比較することにより高色差であるか否かを判定する高色差判定手段と、
上記高色差判定手段により高色差であると判定された位置(x0,y0)に対するG(x0,y0)をGt(x0,y0)に変更する変更手段と、
をさらに具備したことを特徴とする請求項1に記載の画像処理装置。
When the color difference selected by the optimum color difference selection means is XL (x0, y0) −Gt (x0, y0), it is determined whether or not the color difference is a high color difference by comparing the color difference with a predetermined threshold value. High color difference determination means;
Changing means for changing G (x0, y0) to Gt (x0, y0) for the position (x0, y0) determined to be a high color difference by the high color difference determining means;
The image processing apparatus according to claim 1, further comprising:
位置(x0,y0)におけるX(x0,y0)と、該位置(x0,y0)の周辺の位置におけるX(x0+u,y0+v)(ここに、uとvとは同時に0とはならない任意の整数)とに基づいて、該位置(x0,y0)に対する飽和状態を判定する飽和状態判定手段と、
上記飽和状態判定手段により飽和状態にあると判定された場合には、上記最適色差選択手段によってM種類の色差候補から選択される色差を、上記飽和状態に基づいて予め決定された1種類の色差に固定化する固定化手段と、
をさらに具備したことを特徴とする請求項1に記載の画像処理装置。
X (x0, y0) at the position (x0, y0) and X (x0 + u, y0 + v) at positions around the position (x0, y0) (where u and v are not 0 at the same time) ) And a saturation state determination means for determining a saturation state for the position (x0, y0),
When it is determined that the saturation state is determined by the saturation state determination unit, the color difference selected from the M types of color difference candidates by the optimum color difference selection unit is determined as one type of color difference determined in advance based on the saturation state. Immobilization means for immobilizing to,
The image processing apparatus according to claim 1, further comprising:
上記第1の色信号はG成分、上記第2の色信号はB成分またはR成分であることを特徴とする請求項1から8のいずれかに記載の画像処理装置。9. The image processing apparatus according to claim 1, wherein the first color signal is a G component, and the second color signal is a B component or an R component. 上記画像はRGBベイヤ配列画像であることを特徴とする請求項1から9のいずれかに記載の画像処理装置。The image processing apparatus according to claim 1, wherein the image is an RGB Bayer array image. 上記画素補間候補算出手段は、The pixel interpolation candidate calculation means includes:
上記X画素の上下に隣接する2つのG画素の平均を上記M種類のG成分信号の内の1種類のG成分信号として算出する第1の補間算出手段と、  First interpolation calculating means for calculating an average of two G pixels adjacent above and below the X pixel as one kind of G component signals of the M kinds of G component signals;
該X画素の左右に隣接する2つのG画素の平均を上記M種類のG成分信号の内の1種類のG成分信号として算出する第2の補間算出手段と、  A second interpolation calculating means for calculating an average of two G pixels adjacent to the left and right of the X pixel as one kind of G component signals of the M kinds of G component signals;
該X画素の上下左右に隣接する4つのG画素の平均を上記M種類のG成分信号の内の1種類のG成分信号として算出する第3の補間算出手段と、  Third interpolation calculation means for calculating an average of four G pixels adjacent to the X pixel in the vertical and horizontal directions as one G component signal of the M types of G component signals;
を有して構成されたものであることを特徴とする請求項9に記載の画像処理装置。  The image processing apparatus according to claim 9, wherein the image processing apparatus is configured to include:
上記最適色差選択手段は、The optimum color difference selecting means is:
G成分信号を有する画素が欠落している位置を示すG画素欠落位置の周辺のG画素値の変動量を算出して、該変動量に基づいた重み係数を算出するG画素変動量算出手段と、  G pixel fluctuation amount calculating means for calculating a fluctuation amount of a G pixel value around a G pixel missing position indicating a position where a pixel having a G component signal is missing, and calculating a weighting coefficient based on the fluctuation amount; ,
上記第3の補間算出手段により算出されたG成分信号に基づいて算出された上記G画素欠落位置の色差候補の周辺色差候補との類似度に、上記重み係数を乗算する乗算手段と、  Multiplying means for multiplying the similarity between the color difference candidate at the G pixel missing position and the surrounding color difference candidate calculated based on the G component signal calculated by the third interpolation calculating means by the weight coefficient;
を有して構成されたものであることを特徴とする請求項11に記載の画像処理装置。  The image processing apparatus according to claim 11, wherein the image processing apparatus is configured to include:
位置(x0,y0)におけるX(x0,y0)と、該位置(x0,y0)の周辺の位置におけるX(x0+u,y0+v)(ここに、uとvとは同時に0とはならない任意の整数)とに基づいて、該位置(x0,y0)に対する飽和状態を判定する飽和状態判定手段と、X (x0, y0) at the position (x0, y0) and X (x0 + u, y0 + v) at positions around the position (x0, y0) (where u and v are not 0 at the same time) ) And a saturation state determination means for determining a saturation state for the position (x0, y0),
上記飽和状態判定手段により飽和状態にあると判定された場合には、上記G画素変動量算出手段により算出される重み係数を最小値に変更する重み係数変更手段と、  A weight coefficient changing means for changing the weight coefficient calculated by the G pixel fluctuation amount calculating means to a minimum value when it is determined that the saturation state is determined by the saturation state determining means;
をさらに具備したことを特徴とする請求項12に記載の画像処理装置。  The image processing apparatus according to claim 12, further comprising:
コンピュータに、複数の色信号の内の少なくとも一つの色信号が欠落している画素を含む画像を処理させて、複数の色信号の内の少なくとも第1の色信号が補間された画素を含む画像を生成させるための画像処理プログラムであって、コンピュータに、
上記画像における位置を(x,y)(ここに、xは横方向の画素位置を示す整数、yは縦方向の画素位置を示す整数)として表し、上記第1の色信号を有する画素が欠落している位置(x0,y0)の上記第1の色信号とは異なる第2の色信号を有する画素をX(x0,y0)としたときに、このX(x0,y0)に対して、M種類(Mは2以上の整数)の補間態様で補間されたM種類の上記第1の色信号t(x0,y0)(ここに、t=1,…,M)を算出する画素補間候補算出ステップと、
上記X(x0,y0)に対して周辺の同種色信号を用いて帯域制限したXL(x0,y0)を算出する帯域制限ステップと、
上記画素補間候補算出ステップにより算出されたM種類の上記第1の色信号tに基づいて、色差候補X(x0,y0)−Gt(x0,y0)または色差候補XL(x0,y0)−Gt(x0,y0)でなるM種類の色差候補を算出する色差候補算出ステップと、
上記色差候補X(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出された上記第1の色信号t(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補X(x0,y0)−Gt(x0,y0)とに基づいて、
または、上記色差候補XL(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出されたGt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXLの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補XL(x0,y0)−Gt(x0,y0)とに基づいて、M種類の色差類似度を算出し、
この算出したM種類の色差類似度に基づいて、M種類の上記第1の色信号t(x0,y0)の内の1つの種類pの上記第1の色信号p(x0,y0)(ここに、1≦p≦M)または1つの種類qの上記第1の色信号q(x0,y0)(ここに、1≦q≦M)に基づき算出された色差候補X(x0,y0)−Gp(x0,y0)または色差候補XL(x0,y0)−Gq(x0,y0)を色差として選択する最適色差選択ステップと、
上記X(x0,y0)から上記最適色差選択ステップにより選択された色差X(x0,y0)−Gp(x0,y0)または色差XL(x0,y0)−Gq(x0,y0)を減算することにより、位置(x0,y0)に対する上記第1の色信号G(x0,y0)を算出する算出ステップと、
を実行させるための画像処理プログラム。
An image including a pixel obtained by interpolating at least a first color signal of a plurality of color signals by causing a computer to process an image including a pixel in which at least one of the color signals is missing. An image processing program for generating
The position in the image is represented as (x, y) (where x is an integer indicating the pixel position in the horizontal direction and y is an integer indicating the pixel position in the vertical direction), and the pixel having the first color signal is missing When a pixel having a second color signal different from the first color signal at the position (x 0 , y 0 ) is X (x 0 , y 0 ), this X (x 0 , y 0 0 ), M types of the first color signals G t (x 0 , y 0 ) (where t = 1,...) Interpolated in M types (M is an integer of 2 or more). , M) for calculating pixel interpolation candidates;
A band limiting step of calculating the band-limited by the X L (x 0, y 0 ) by using the same type color signals near to said X (x 0, y 0) ,
Based on the M types of first color signals G t calculated in the pixel interpolation candidate calculation step, color difference candidates X (x 0 , y 0 ) −G t (x 0 , y 0 ) or color difference candidates X L A color difference candidate calculating step of calculating M types of color difference candidates of (x 0 , y 0 ) −G t (x 0 , y 0 );
Surroundings of the same type t as the first color signal G t (x 0 , y 0 ) used in calculating the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ) The first color signal G t (x 0 + n, y 0 + m) calculated at the position (x 0 + n, y 0 + m) (where n and m are arbitrary integers that are not 0 simultaneously) A plurality of X color difference candidates X (x 0 + n, y 0 + m) −G t (x 0 + n, y 0 + m) calculated for the peripheral position (x 0 + n, y 0 + m), Based on the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ),
Alternatively, the same type t as the first color signal G t (x 0 , y 0 ) used in calculating the color difference candidate X L (x 0 , y 0 ) −G t (x 0 , y 0 ). , Based on G t (x 0 + n, y 0 + m) calculated at the peripheral position (x 0 + n, y 0 + m) (where n and m are arbitrary integers that are not 0 simultaneously) near position (x 0 + n, y 0 + m) a plurality of color difference candidates X L of the calculated X L against (x 0 + n, y 0 + m) -G t (x 0 + n, y 0 + m) and, the Based on the color difference candidates X L (x 0 , y 0 ) −G t (x 0 , y 0 ), M types of color difference similarities are calculated,
Based on the calculated M kinds of color difference similarities, the first color signal G p (x 0 ) of one kind p among the M kinds of first color signals G t (x 0 , y 0 ). , Y 0 ) (where 1 ≦ p ≦ M) or one type q of the first color signal G q (x 0 , y 0 ) (where 1 ≦ q ≦ M) Optimal color difference selection for selecting a color difference candidate X (x 0 , y 0 ) −G p (x 0 , y 0 ) or a color difference candidate X L (x 0 , y 0 ) −G q (x 0 , y 0 ) as a color difference Steps,
Color difference X (x 0 , y 0 ) −G p (x 0 , y 0 ) or color difference X L (x 0 , y 0 ) − selected from the above X (x 0 , y 0 ) by the optimum color difference selection step A calculation step of calculating the first color signal G (x 0 , y 0 ) for the position (x 0 , y 0 ) by subtracting G q (x 0 , y 0 );
An image processing program for executing
複数の色信号の内の少なくとも一つの色信号が欠落している画素を含む画像を処理して、複数の色信号の内の少なくとも第1の色信号が補間された画素を含む画像を生成するための画像処理方法であって、
上記画像における位置を(x,y)(ここに、xは横方向の画素位置を示す整数、yは縦方向の画素位置を示す整数)として表し、上記第1の色信号を有する画素が欠落している位置(x0,y0)の上記第1の色信号とは異なる第2の色信号を有する画素をX(x0,y0)としたときに、このX(x0,y0)に対して、M種類(Mは2以上の整数)の補間態様で補間されたM種類の上記第1の色信号t(x0,y0)(ここに、t=1,…,M)を算出する画素補間候補算出ステップと、
上記X(x0,y0)に対して周辺の同種色信号を用いて帯域制限したXL(x0,y0)を算出する帯域制限ステップと、
上記画素補間候補算出ステップにより算出されたM種類の上記第1の色信号tに基づいて、色差候補X(x0,y0)−Gt(x0,y0)または色差候補XL(x0,y0)−Gt(x0,y0)でなるM種類の色差候補を算出する色差候補算出ステップと、
上記色差候補X(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出された上記第1の色信号t(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXの複数の色差候補X(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補X(x0,y0)−Gt(x0,y0)とに基づいて、
または、上記色差候補XL(x0,y0)−Gt(x0,y0)を算出する際に用いた上記第1の色信号t(x0,y0)と同一種類tの、周辺位置(x0+n,y0+m)(ここに、nとmとは同時に0とはならない任意の整数)において算出されたGt(x0+n,y0+m)に基づき、該周辺位置(x0+n,y0+m)に対して算出されたXLの複数の色差候補XL(x0+n,y0+m)−Gt(x0+n,y0+m)と、該色差候補XL(x0,y0)−Gt(x0,y0)とに基づいて、M種類の色差類似度を算出し、
この算出したM種類の色差類似度に基づいて、M種類の上記第1の色信号t(x0,y0)の内の1つの種類pの上記第1の色信号p(x0,y0)(ここに、1≦p≦M)または1つの種類qの上記第1の色信号q(x0,y0)(ここに、1≦q≦M)に基づき算出された色差候補X(x0,y0)−Gp(x0,y0)または色差候補XL(x0,y0)−Gq(x0,y0)を色差として選択する最適色差選択ステップと、
上記X(x0,y0)から上記最適色差選択ステップにより選択された色差X(x0,y0)−Gp(x0,y0)または色差XL(x0,y0)−Gq(x0,y0)を減算することにより、位置(x0,y0)に対する上記第1の色信号G(x0,y0)を算出する算出ステップと、
を有することを特徴とする画像処理方法。
An image including a pixel in which at least one color signal of the plurality of color signals is missing is processed to generate an image including a pixel in which at least the first color signal of the plurality of color signals is interpolated. An image processing method for
The position in the image is represented as (x, y) (where x is an integer indicating the pixel position in the horizontal direction and y is an integer indicating the pixel position in the vertical direction), and the pixel having the first color signal is missing When a pixel having a second color signal different from the first color signal at the position (x 0 , y 0 ) is X (x 0 , y 0 ), this X (x 0 , y 0 0 ), M types of the first color signals G t (x 0 , y 0 ) (where t = 1,...) Interpolated in M types (M is an integer of 2 or more). , M) for calculating pixel interpolation candidates;
A band limiting step of calculating the band-limited by the X L (x 0, y 0 ) by using the same type color signals near to said X (x 0, y 0) ,
Based on the M types of first color signals G t calculated in the pixel interpolation candidate calculation step, color difference candidates X (x 0 , y 0 ) −G t (x 0 , y 0 ) or color difference candidates X L A color difference candidate calculating step of calculating M types of color difference candidates of (x 0 , y 0 ) −G t (x 0 , y 0 );
Surroundings of the same type t as the first color signal G t (x 0 , y 0 ) used in calculating the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ) The first color signal G t (x 0 + n, y 0 + m) calculated at the position (x 0 + n, y 0 + m) (where n and m are arbitrary integers that are not 0 simultaneously) A plurality of X color difference candidates X (x 0 + n, y 0 + m) −G t (x 0 + n, y 0 + m) calculated for the peripheral position (x 0 + n, y 0 + m), Based on the color difference candidate X (x 0 , y 0 ) −G t (x 0 , y 0 ),
Alternatively, the same type t as the first color signal G t (x 0 , y 0 ) used in calculating the color difference candidate X L (x 0 , y 0 ) −G t (x 0 , y 0 ). , Based on G t (x 0 + n, y 0 + m) calculated at the peripheral position (x 0 + n, y 0 + m) (where n and m are arbitrary integers that are not 0 simultaneously) near position (x 0 + n, y 0 + m) a plurality of color difference candidates X L of the calculated X L against (x 0 + n, y 0 + m) -G t (x 0 + n, y 0 + m) and, the Based on the color difference candidates X L (x 0 , y 0 ) −G t (x 0 , y 0 ), M types of color difference similarities are calculated,
Based on the calculated M kinds of color difference similarities, the first color signal G p (x 0 ) of one kind p among the M kinds of first color signals G t (x 0 , y 0 ). , Y 0 ) (where 1 ≦ p ≦ M) or one type q of the first color signal G q (x 0 , y 0 ) (where 1 ≦ q ≦ M) Optimal color difference selection for selecting a color difference candidate X (x 0 , y 0 ) −G p (x 0 , y 0 ) or a color difference candidate X L (x 0 , y 0 ) −G q (x 0 , y 0 ) as a color difference Steps,
Color difference X (x 0 , y 0 ) −G p (x 0 , y 0 ) or color difference X L (x 0 , y 0 ) − selected from the above X (x 0 , y 0 ) by the optimum color difference selection step A calculation step of calculating the first color signal G (x 0 , y 0 ) for the position (x 0 , y 0 ) by subtracting G q (x 0 , y 0 );
An image processing method comprising:
JP2007209033A 2007-08-10 2007-08-10 Image processing apparatus, image processing program, and image processing method Active JP5032914B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2007209033A JP5032914B2 (en) 2007-08-10 2007-08-10 Image processing apparatus, image processing program, and image processing method
PCT/JP2008/063686 WO2009022541A1 (en) 2007-08-10 2008-07-30 Image processing device, image processing program, and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007209033A JP5032914B2 (en) 2007-08-10 2007-08-10 Image processing apparatus, image processing program, and image processing method

Publications (3)

Publication Number Publication Date
JP2009044594A JP2009044594A (en) 2009-02-26
JP2009044594A5 JP2009044594A5 (en) 2010-08-19
JP5032914B2 true JP5032914B2 (en) 2012-09-26

Family

ID=40350596

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007209033A Active JP5032914B2 (en) 2007-08-10 2007-08-10 Image processing apparatus, image processing program, and image processing method

Country Status (2)

Country Link
JP (1) JP5032914B2 (en)
WO (1) WO2009022541A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5269718B2 (en) 2009-08-18 2013-08-21 オリンパス株式会社 Image processing apparatus, image processing program, and image processing method
JP5452242B2 (en) * 2010-01-15 2014-03-26 オリンパス株式会社 Image processing apparatus, endoscope system, program, and operation method of image processing apparatus
CN103186897B (en) * 2011-12-29 2017-03-08 北京大学 Obtain the method and device of image diversity factor result
JP2015027038A (en) * 2013-07-29 2015-02-05 日本放送協会 Color information complementing device, and program for the same
JP6408884B2 (en) * 2014-11-28 2018-10-17 キヤノン株式会社 Image processing apparatus, image processing method, and program
JP6465669B2 (en) * 2015-01-26 2019-02-06 キヤノン株式会社 Image processing apparatus and image processing method
CN110599394A (en) * 2019-09-12 2019-12-20 北京字节跳动网络技术有限公司 Method and device for processing pictures in online presentation, storage medium and equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4038867B2 (en) * 1998-03-19 2008-01-30 株式会社ニコン Interpolation method
CN100544450C (en) * 2003-06-12 2009-09-23 株式会社尼康 Image processing method
JP2005072786A (en) * 2003-08-21 2005-03-17 Matsushita Electric Ind Co Ltd Color separation processing circuit, color separation processing method, program, and digital camera

Also Published As

Publication number Publication date
WO2009022541A1 (en) 2009-02-19
JP2009044594A (en) 2009-02-26

Similar Documents

Publication Publication Date Title
US8018501B2 (en) Image processing apparatus, computer-readable recording medium recording image processing program, and image processing method
JP5241823B2 (en) Image processing apparatus, image processing method, program, and storage medium for correcting chromatic aberration
JP4184802B2 (en) System and method for asymmetric demosaicing a raw data image using color discontinuity equalization
JP4653059B2 (en) Imaging system, image processing program
JP5032914B2 (en) Image processing apparatus, image processing program, and image processing method
JP5315158B2 (en) Image processing apparatus and image processing method
JP5677040B2 (en) Image processing apparatus and control method thereof
JP4683994B2 (en) Image processing apparatus, image processing method, electronic camera, scanner
JP5041886B2 (en) Image processing apparatus, image processing program, and image processing method
JP5128207B2 (en) Image processing apparatus, image processing method, and image processing program
US8259202B2 (en) Image processing device and image processing program for acquiring specific color component based on sensitivity difference between pixels of an imaging device
JP2009124552A (en) Noise reduction system, noise reduction program and imaging system
JP2010277267A (en) Image processing apparatus, imaging apparatus, and image processing method
JP6282123B2 (en) Image processing apparatus, image processing method, and program
JP2013055623A (en) Image processing apparatus, image processing method, information recording medium, and program
JP4912979B2 (en) Image processing apparatus, image processing method, and program
JP2009021756A (en) Noise rejection circuit, noise rejection method, imaging apparatus, and program
JP3730063B2 (en) Color component generation apparatus, color component generation method, and multicolor image pickup apparatus using the same
JP2009027537A (en) Image processor, image processing method, and image processing program
JP4708180B2 (en) Image processing device
JP4122082B2 (en) Signal processing apparatus and processing method thereof
JP4053362B2 (en) Interpolation processing method, interpolation processing program, recording medium recording the same, image processing apparatus, and image forming apparatus provided with the same
JP4385890B2 (en) Image processing method, frequency component compensation unit, image processing apparatus including the frequency component compensation unit, and image processing program
JP4478981B2 (en) Color noise reduction method and color imaging apparatus
JP2013055622A (en) Image processing apparatus, image processing method, information recording medium, and program

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100706

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100706

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120626

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120629

R151 Written notification of patent or utility model registration

Ref document number: 5032914

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

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

Free format text: PAYMENT UNTIL: 20150706

Year of fee payment: 3

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250