JP4133746B2 - Interpolated pixel value calculation method, apparatus, and program - Google Patents

Interpolated pixel value calculation method, apparatus, and program Download PDF

Info

Publication number
JP4133746B2
JP4133746B2 JP2003377371A JP2003377371A JP4133746B2 JP 4133746 B2 JP4133746 B2 JP 4133746B2 JP 2003377371 A JP2003377371 A JP 2003377371A JP 2003377371 A JP2003377371 A JP 2003377371A JP 4133746 B2 JP4133746 B2 JP 4133746B2
Authority
JP
Japan
Prior art keywords
pixel
edge
pixels
interpolation
edges
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.)
Expired - Fee Related
Application number
JP2003377371A
Other languages
Japanese (ja)
Other versions
JP2005141497A (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.)
Fujifilm Corp
Original Assignee
Fujifilm 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 Fujifilm Corp filed Critical Fujifilm Corp
Priority to JP2003377371A priority Critical patent/JP4133746B2/en
Priority to US10/979,279 priority patent/US7391920B2/en
Publication of JP2005141497A publication Critical patent/JP2005141497A/en
Application granted granted Critical
Publication of JP4133746B2 publication Critical patent/JP4133746B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

本発明は、デジタル画像を構成する画素間に補間画素を補間するための補間画素値算出方法および装置並びにそのためのプログラムに関するものである。
The present invention relates to an interpolation pixel value calculation method, apparatus and program therefor for interpolating an interpolation pixel between pixels constituting the digital image.

従来より、ネガフィルムやカラーリバーサルフィルムなどの写真フィルムに記録された写真画像をスキャナなどの読取装置で光電的に読み取って得たデジタル画像や、デジタルスチルカメラ(DSC)やカメラ付き携帯電話などのデジタル撮像装置により被写体を撮像することにより得られた画像データを、それを再生するモニタなどの再生装置のサイズに適合するように拡大縮小することが行われている。例えば、カメラ付き携帯電話により被写体を撮像して得て得られた画像データを電子メールとして送信する際に、送信先の携帯電話に備えられた液晶モニタのサイズに応じて画像データを拡大縮小するサービスが提供されている。   Conventionally, a digital image obtained by photoelectrically reading a photographic image recorded on a photographic film such as a negative film or a color reversal film with a reading device such as a scanner, a digital still camera (DSC), a mobile phone with a camera, etc. 2. Description of the Related Art Image data obtained by imaging a subject with a digital imaging device is enlarged or reduced so as to match the size of a reproduction device such as a monitor that reproduces the image data. For example, when image data obtained by imaging a subject with a camera-equipped mobile phone is transmitted as an e-mail, the image data is enlarged or reduced according to the size of the liquid crystal monitor provided in the destination mobile phone. Service is provided.

このような画像データの拡大縮小は、画像データにより表される画像を構成する画素の間に拡大縮小率に応じて新たな画素(以下補間画素という)を補間することにより行われる。このような補間方法としては、線形補間法、最近傍法、ガウシアンフィルタ、バイリニア法およびバイキュービック法などの種々の方法が知られている。これらの方法は、補間画素の近傍の画素を参照画素とし、参照画素の画素値による補間演算を行って補間画素の画素値を算出する。   Such enlargement / reduction of the image data is performed by interpolating new pixels (hereinafter referred to as interpolation pixels) between the pixels constituting the image represented by the image data in accordance with the enlargement / reduction ratio. As such an interpolation method, various methods such as a linear interpolation method, nearest neighbor method, Gaussian filter, bilinear method, and bicubic method are known. In these methods, a pixel in the vicinity of the interpolation pixel is used as a reference pixel, and an interpolation calculation is performed using the pixel value of the reference pixel to calculate the pixel value of the interpolation pixel.

しかしながら、単一の方法のみを用いて画像データを拡大縮小した場合、画像に含まれるエッジ部分にボケやシャギーが発生するという問題がある。このため、画像に含まれるエッジ成分を検出し、エッジ部分と非エッジ部分とで異なる処理による補間演算を行う方法が提案されている(特許文献1参照)。   However, when the image data is enlarged / reduced using only a single method, there is a problem that blur or shaggy occurs in an edge portion included in the image. For this reason, a method has been proposed in which an edge component included in an image is detected and an interpolation operation is performed by different processing between the edge portion and the non-edge portion (see Patent Document 1).

特許文献1に記載された方法などにおいて画像からエッジを検出するためには、ソーベルフィルタやラプラシアンフィルタが一般的に用いられる。このようなソーベルフィルタやラプラシアンフィルタは、最短3タップの奇数タップ数を有し、フィルタリングにより注目画素がエッジであるか否かを判定することによりエッジを検出することができる。   In order to detect an edge from an image in the method described in Patent Document 1, a Sobel filter or a Laplacian filter is generally used. Such a Sobel filter or Laplacian filter has an odd number of taps with a minimum of 3 taps, and can detect an edge by determining whether or not the pixel of interest is an edge by filtering.

一方、画像を拡大縮小する場合には、画素間に補間画素を補間するため、画像に含まれる画素ではなく、画素の間にエッジが判定するか否かを判定する必要がある。上述した奇数タップ数のフィルタを用いてエッジを検出する場合、画像中の注目画素そのものがエッジであるか否かを判定することができるのみであり、画素間にエッジが存在するか否かを判定することができない。   On the other hand, when an image is enlarged or reduced, an interpolation pixel is interpolated between pixels, so it is necessary to determine whether or not an edge is determined between pixels instead of pixels included in the image. When an edge is detected using the above-described filter having an odd number of taps, it is only possible to determine whether or not the pixel of interest in the image is an edge, and whether or not there is an edge between pixels. Cannot judge.

画素間にエッジがあるか否かを判定する最も簡単な方法としては、画像の隣接する2つの画素に対して例えば図5に示す差分フィルタによるフィルタリング処理を施してこの2つの画素の画素値の差分を得、この差分の絶対値が所定の閾値以上である場合に、この隣接する2つの画素間にエッジが存在すると判定する手法が考えられる。以下本発明の説明において、このようなエッジ検出方法を第1のエッジ検出方法という。   The simplest method for determining whether or not there is an edge between pixels is to perform filtering processing using, for example, a difference filter shown in FIG. A method of obtaining a difference and determining that an edge exists between two adjacent pixels when the absolute value of the difference is equal to or greater than a predetermined threshold value is conceivable. In the following description of the present invention, such an edge detection method is referred to as a first edge detection method.

また、隣接する2つの画素の画素値のみではなく、直列に隣接する4つの画素の画素値に基づいてこの4つの画素の中央に位置する2つの画素間にエッジが存在するか否かを判定する手法を用いることもできる。具体的には、例えば図4に示す直列に隣接する4つの画素G1、G2、G3、G4の中央に位置する2つの画素G2、G3の間にエッジが存在するか否かを判定するのに当たって、まず、画素G1〜G4について、互いに隣接する2つの画素からなる3つの画素ペア(G1,G2)、(G2、G3)、(G3,G4)に対して差分フィルタによるフィルタリング処理を施して各ペアの画素の差分を1次差分d1、d2、d3として算出する。続いて、3つの1次差分d1、d2、d3における隣接する2つの1次差分ペア(d1,d2)、(d2,d3)に対して、同様に差分フィルタによるフィルタリング処理を施して、各1次差分ペアの差分を2次差分d4、d5として算出する。画像中に直列に隣接する4つの画素に対して算出した1次差分と2次差分の正負は全18種類の組合せがあり、図6と図7、図8は、この18種類の組合せと、この4つの画素のプロファイル形状との関係を示している。そのうち、隣接する2つの画素G2、G3の間にエッジが存在することを示す組合せは、図6に示すエッジ1およびエッジ2の2通りである。エッジ1は、(d1,d2,d3,d4,d5)=(+,+,+,+,−)となる右上がりエッジおよび(d1,d2,d3,d4,d5)=(−,−,−,−,+)となる左上がりエッジの2種類があり、エッジ2は、(d1,d2,d3,d4,d5)=(+,+,+,+,+)となる下に凸の右上がりエッジ、(d1,d2,d3,d4,d5)=(+,+,+,−,−)となる上に凸の右上がりエッジ、(d1,d2,d3,d4,d5)=(−,−,−,+,+)となる下に凸の左上がりエッジ、(d1,d2,d3,d4,d5)=(−,−,−,−,−)となる上に凸の左上がりエッジの4種類がある。直列に隣接する4つの画素に対して1次差分d1、d2、d3および2次差分d4、d5を求め、これらの差分の正負の関係が、図6に示すエッジ1またはエッジ2の関係となる場合に、隣接する2つの画素G2、G3の間にエッジが存在すると判定すると共に、これらの差分の正負の関係が、図7および図8に示すような山、谷、その他の関係となる場合に、隣接する2つの画素G2、G3の間にエッジが存在しないと判定する。なお、以下本発明の説明において、このようなエッジ検出方法を第2のエッジ検出方法という。   Whether or not an edge exists between two pixels located at the center of the four pixels is determined based on the pixel values of the four pixels adjacent in series as well as the pixel values of the two adjacent pixels. It is also possible to use a technique to Specifically, for example, in determining whether an edge exists between two pixels G2 and G3 located at the center of four pixels G1, G2, G3, and G4 adjacent in series shown in FIG. First, with respect to the pixels G1 to G4, a filtering process using a difference filter is performed on three pixel pairs (G1, G2), (G2, G3), (G3, G4) including two adjacent pixels. Differences between the paired pixels are calculated as primary differences d1, d2, and d3. Subsequently, filtering processing by the difference filter is similarly performed on two adjacent primary difference pairs (d1, d2) and (d2, d3) in the three primary differences d1, d2, and d3, and each 1 The difference of the next difference pair is calculated as secondary differences d4 and d5. There are 18 types of combinations of the positive and negative of the primary difference and the secondary difference calculated for four pixels adjacent in series in the image. FIGS. 6, 7 and 8 show these 18 types of combinations, The relationship with the profile shape of these four pixels is shown. Among them, there are two combinations of the edge 1 and the edge 2 shown in FIG. 6 that indicate that an edge exists between two adjacent pixels G2 and G3. Edge 1 is a right rising edge such that (d1, d2, d3, d4, d5) = (+, +, +, +, −) and (d1, d2, d3, d4, d5) = (−, −, There are two types of rising edges that are-,-, +), and edge 2 has a downwardly convex shape where (d1, d2, d3, d4, d5) = (+, +, +, +, +) Upwardly rising edge where (d1, d2, d3, d4, d5) = (+, +, +, −, −), (d1, d2, d3, d4, d5) = ( Downward convex left rising edge that becomes −, −, −, +, +), and upward convex leftward that becomes (d1, d2, d3, d4, d5) = (−, −, −, −, −) There are four types of rising edges. The primary differences d1, d2, d3 and the secondary differences d4, d5 are obtained for four pixels adjacent in series, and the positive / negative relationship between these differences is the relationship of edge 1 or edge 2 shown in FIG. In the case where it is determined that an edge exists between two adjacent pixels G2 and G3, and the positive / negative relationship between these differences is a mountain, valley, or other relationship as shown in FIGS. In addition, it is determined that no edge exists between two adjacent pixels G2 and G3. In the following description of the present invention, such an edge detection method is referred to as a second edge detection method.

さらに、前述した第1と第2のエッジ検出方法の併合となるエッジ検出方法を用いて、より精度良く隣接する2つの画素間にエッジが存在するか否かの検出を行うこともできる。具体的には、第2の方法のように、直列に隣接する4つの画素G1〜G4に対して1次差分d1、d2、d3および2次差分d4、d5を求め、これらの差分の正負の関係が、図6に示すエッジ1またはエッジ2の関係となる場合に、隣接する2つの画素G2、G3の間にエッジが存在すると共に、これらの差分の正負の関係が、図7に示すような山、谷、その他の関係となる場合に、隣接する2つの画素G2、G3の間にエッジが存在しないとするようにして第1の判定を行う。第1の判定において、隣接する2つの画素G2、G3の間にエッジが存在すると判定された場合において、画素G2、G3の画素値の差分の絶対値が所定の閾値以上であるか否かをさらに判定し(第2の判定)、第2の判定が肯定された場合においてのみ、画素G2、G3の間に真のエッジが存在すると判定する。こうすることによって、画素G2、G3の画素値の差が非常にわずかでノイズと見なせるような場合に、そこがエッジであると誤判定してしまうことを防ぐことができる。なお、以下本発明の説明において、このようなエッジ検出方法を第3のエッジ検出方法という。   Furthermore, it is possible to detect whether or not an edge exists between two adjacent pixels with higher accuracy by using an edge detection method that is a combination of the first and second edge detection methods described above. Specifically, as in the second method, primary differences d1, d2, d3 and secondary differences d4, d5 are obtained for four pixels G1 to G4 adjacent in series, and the positive and negative of these differences are obtained. When the relationship is the relationship of edge 1 or edge 2 shown in FIG. 6, an edge exists between two adjacent pixels G2 and G3, and the positive / negative relationship of these differences is as shown in FIG. In the case of a relationship such as a mountain, a valley, or the like, the first determination is performed such that no edge exists between the two adjacent pixels G2 and G3. In the first determination, when it is determined that an edge exists between two adjacent pixels G2 and G3, whether or not the absolute value of the difference between the pixel values of the pixels G2 and G3 is equal to or greater than a predetermined threshold value. It is further determined (second determination), and it is determined that a true edge exists between the pixels G2 and G3 only when the second determination is affirmed. By doing so, when the difference between the pixel values of the pixels G2 and G3 is very small and can be regarded as noise, it is possible to prevent erroneous determination as an edge. In the following description of the present invention, such an edge detection method is referred to as a third edge detection method.

さらに、第1のエッジ検出方法の改良方法として、2つの隣接する画素間の差分の絶対値が所定の閾値(第1の閾値)以上である場合に、この2つの画素間にエッジが存在すると判定すると共に、2つの隣接する画素間の差分の絶対値がこの第1の閾値より小さいものの、第1の閾値よりも小さい閾値(第2の閾値)以上であり、かつこの2つの隣接する画素を中央とする直列に隣接する4つ以上の複数画素に含まれる互い隣接する2つの画素からなる各画素ペアの差分の絶対値のうちの最大値である場合に中央に隣接する2つの画素間にエッジが存在すると判定するようにしてエッジを検出することもできる。こうすることによって、急なエッジのみならず、比較的に緩やかなエッジも検出することができる。なお、以下本発明の説明において、このようなエッジ検出方法を第4のエッジ検出方法という。   Further, as an improvement method of the first edge detection method, when an absolute value of a difference between two adjacent pixels is equal to or greater than a predetermined threshold (first threshold), an edge exists between the two pixels. In addition, the absolute value of the difference between two adjacent pixels is smaller than the first threshold, but is greater than or equal to a threshold smaller than the first threshold (second threshold), and the two adjacent pixels Between the two pixels adjacent to the center when the absolute value of the absolute value of the difference of each pixel pair consisting of two adjacent pixels included in four or more pixels adjacent in series with the center as the center It is also possible to detect an edge by determining that there is an edge. By doing so, not only a sharp edge but also a relatively gentle edge can be detected. In the following description of the present invention, such an edge detection method is referred to as a fourth edge detection method.

これらの例に挙げたように、画像を構成する画素間にエッジが存在するか否かを判定して画像の画素間におけるエッジを検出する方法が様々考えられる。画像を拡大縮小するために画像を構成する画素間に補間画素を補間する際に、補間画素の近傍の画素間にエッジが存在するか否か、どの方向に延びるエッジかなどによって、異なる参照画素を選出したり、異なる補間演算方法で補間画素の画素値を求めるようにしたりなどするようにすれば、拡大縮小処理した画像の画質の低下を防ぐことができる。例えば、補間画素の近傍の画素間にエッジが検出されていない場合に、補間画素の近傍に位置する画素(例えば補間画素を囲む4×4の16画素)全部を参照画素とし、参照画素の画素値に対して補間演算を行うことによって補間画素の画素値を求める一方、補間画素の近傍の画素間にエッジが検出されていれば、この補間画素がエッジのいずれ側に存在することを判定すると共に、補間画素の近傍の画素のうち、エッジに対して、補間画素と同じ側に位置する画素のみを参照画素として補間画素の画素値を求めるようにして、拡大縮小された画像の画質低下を防ぐ方法が考えられる。勿論、参照画素のみならず、補間画素の近傍の画素間にエッジが検出されたか否かで異なる補間演算の方法を用いるようにしてもよい。   As described in these examples, various methods are conceivable for determining whether or not an edge exists between pixels constituting an image and detecting an edge between pixels of the image. When interpolating interpolated pixels between pixels constituting an image to scale the image, different reference pixels depend on whether or not an edge exists between pixels near the interpolated pixel and in which direction the edge extends Or selecting the pixel value of the interpolated pixel using a different interpolation calculation method can prevent the image quality of the enlarged / reduced image from being degraded. For example, when no edge is detected between pixels in the vicinity of the interpolation pixel, all pixels located in the vicinity of the interpolation pixel (for example, 4 × 4 16 pixels surrounding the interpolation pixel) are set as the reference pixels, and the pixels of the reference pixels While calculating the pixel value of the interpolated pixel by performing an interpolation operation on the value, if an edge is detected between the pixels in the vicinity of the interpolated pixel, it is determined that the interpolated pixel exists on either side of the edge In addition, among the pixels in the vicinity of the interpolation pixel, the pixel value of the interpolation pixel is obtained using only the pixel located on the same side as the interpolation pixel with respect to the edge as a reference pixel, thereby reducing the image quality of the enlarged / reduced image. Possible ways to prevent it. Of course, different interpolation calculation methods may be used depending on whether an edge is detected between pixels in the vicinity of the interpolation pixel as well as the reference pixel.

ところで、写真フィルムに記録された画像を光電的に読み取って得たデジタル画像や、デジタル撮像装置により被写体を撮像して得たデジタル画像において、アナログ画像信号をデジタル化するために行われるサンプリング処理により、被写体におけるエッジを含む部分(以下エッジ部という)を表す画素が、該エッジの両側の部分の信号値の中間値を示す画素(以下このような画素を中間値画素という)となる。例えば、図33(a)に示す被写体のデジタル画像のX方向において、図33(b)に示すような画素構成になるが、これらの画素のうち、図33(a)に示す被写体におけるエッジLを含む部分を表す画素Gbは、エッジLの左側の部分の信号値と、エッジLの右側の信号値との中間の信号値を示すこととなる。   By the way, in a digital image obtained by photoelectrically reading an image recorded on a photographic film or a digital image obtained by imaging a subject with a digital imaging device, a sampling process is performed to digitize an analog image signal. A pixel representing a portion including an edge (hereinafter referred to as an edge portion) in the subject is a pixel indicating an intermediate value of signal values of portions on both sides of the edge (hereinafter, such a pixel is referred to as an intermediate value pixel). For example, in the X direction of the digital image of the subject shown in FIG. 33A, the pixel configuration is as shown in FIG. 33B. Of these pixels, the edge L of the subject shown in FIG. The pixel Gb representing the portion including the pixel value indicates an intermediate signal value between the signal value on the left side of the edge L and the signal value on the right side of the edge L.

そのため、例えば前述したように、補間画素の近傍の画素間にエッジが存在するか否かを検出し、存在していれば、補間画素の近傍に位置する画素のうち、検出されたエッジに対して、補間画素と同じ側に位置する画素のみを参照画素とし、参照画素の画素値による補間演算を行って補間画素の画素値を求める場合、参照画素のうち、中間値画素が入っていれば、補間画素の画素値が中間値画素の画素値に影響されるため、拡大縮小された画像にボケが残り、最悪の場合、原画像よりも広がってしまうというという問題がある。   Therefore, for example, as described above, it is detected whether or not there is an edge between pixels in the vicinity of the interpolation pixel. If there is, the detected edge among the pixels located in the vicinity of the interpolation pixel is detected. Thus, when only the pixel located on the same side as the interpolation pixel is used as the reference pixel and the pixel value of the interpolation pixel is obtained by performing the interpolation calculation using the pixel value of the reference pixel, if the intermediate value pixel is included among the reference pixels Since the pixel value of the interpolated pixel is affected by the pixel value of the intermediate value pixel, there is a problem in that blurring remains in the enlarged / reduced image, and in the worst case, the image becomes wider than the original image.

そこで、拡大縮小された画像の画質を高めるために、補間画素の画素値を求める際に、中間値画素を使用せず、中間値画素ではない参照画素のみを用いて補間画素の画素値を求めることが考えられる。   Therefore, in order to improve the image quality of the enlarged / reduced image, when obtaining the pixel value of the interpolation pixel, the intermediate value pixel is not used, and only the reference pixel that is not the intermediate value pixel is used to obtain the pixel value of the interpolation pixel. It is possible.

または、中間値画素を参照画素として使用するが、中間値画素である参照画素に対して、中間値ではない参照画素よりも小さい重みを付けて補間演算を行うようにしても、拡大縮小された画像における、中間値画素に起因するボケの残留、広がりなどを軽減することができる。
特開2002−319020号公報
Alternatively, the intermediate value pixel is used as the reference pixel, but the reference pixel that is the intermediate value pixel is enlarged / reduced even when the interpolation calculation is performed with a weight smaller than the reference pixel that is not the intermediate value. It is possible to reduce the residual, spread, etc. of the blur due to the intermediate value pixels in the image.
JP 2002-312020 A

しかしながら、例えば、被写体が、図33(a)に示す例の被写体が図中x方向と直交する方向(y方向とする)に連続して広がったものである場合(図35(a)参照)、図35(b)に示すように、画素Ga1と画素Gb1との間、画素Gb1と画素Gb2との間にy方向に延びるエッジAとエッジBが夫々検出される。この場合、例えば、画素Gb3、Gb1の間の画素Gb2と、画素Gc3、Gc1の間の画素Gc2との間の画素Gb2寄りの位置に補間画素G(図35(c)参照)を補間するに際し、参照画素として、エッジに対して補間画素Gと同じ側に位置する画素を用いると、参照画素に成り得る画素はエッジA、エッジBに挟まれた画素Gb1、Gb2、Gb3の3つしかない。ところで、この3つの画素とも中間値画素であるため、この3つの画素を参照画素から除去すると、参照画素が無くなり、補間画素Gの画素値を求めることができない。また、中間値画素を参照画素として使用するが、中間値画素である参照画素に対して、中間値ではない参照画素よりも小さい重みを付けて補間演算を行う方法を適用すると、参照画素が全部中間値画素であるので、これらの参照画素の画素値から画素値が求められた補間画素Gはやはり中間値画素であり、拡大縮小された画像中に中間値画素に起因するボケを軽減することができない。   However, for example, when the subject in the example shown in FIG. 33A continuously extends in the direction orthogonal to the x direction (referred to as the y direction) in the drawing (see FIG. 35A). As shown in FIG. 35B, an edge A and an edge B extending in the y direction are detected between the pixel Ga1 and the pixel Gb1, and between the pixel Gb1 and the pixel Gb2, respectively. In this case, for example, when the interpolation pixel G (see FIG. 35C) is interpolated at a position near the pixel Gb2 between the pixel Gb2 between the pixels Gb3 and Gb1 and the pixel Gc2 between the pixels Gc3 and Gc1. When a pixel located on the same side as the interpolation pixel G with respect to the edge is used as the reference pixel, there are only three pixels Gb1, Gb2, and Gb3 sandwiched between the edge A and the edge B that can be the reference pixel. . By the way, since these three pixels are intermediate value pixels, if these three pixels are removed from the reference pixel, the reference pixel disappears and the pixel value of the interpolation pixel G cannot be obtained. In addition, when an intermediate value pixel is used as a reference pixel, a method of performing an interpolation operation with a weight smaller than a reference pixel that is not an intermediate value is applied to a reference pixel that is an intermediate value pixel. Since the pixel is an intermediate value pixel, the interpolation pixel G whose pixel value is obtained from the pixel values of these reference pixels is also an intermediate value pixel, and reduces blurring caused by the intermediate value pixel in the enlarged / reduced image. I can't.

本発明は、上記事情に鑑みてなされたものであり、デジタル画像の画素間に検出されたエッジを調整し、その調整結果を利用して補間画素の画素値を算出することにより、デジタル画像を拡大縮小して得た画像中のボケを軽減することを可能とする補間画素値算出方法および装置並びにプログラムを提供することを目的とするものである。
The present invention has been made in view of the above circumstances, and adjust the detected edge between pixels of the digital image, by calculating the pixel value of the interpolation pixel by using the result of the adjustment, the digital image It is an object of the present invention to provide an interpolation pixel value calculation method, apparatus, and program that can reduce blur in an image obtained by enlarging or reducing.

本発明の補間画素値算出方法は、
被写体を撮像して得たデジタル画像を拡大縮小するための補間画素の画素値を、該補間画素の近傍に位置する近傍画素の画素値に基づいて算出する補間画素値算出方法であって、
所定のエッジ検出処理により前記近傍画素の画素間に位置するエッジを検出し、
前記エッジ検出処理により前記エッジが検出された場合は、該エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出すると共に、
前記エッジ検出処理により、前記デジタル画像上の直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいても前記エッジが検出された場合、該2つのエッジを併合して前記3つの画素のうちの中央画素付近位置する1つの併合エッジとし、該併合エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出することを特徴とするものである。
The interpolation pixel value calculation method of the present invention includes:
An interpolation pixel value calculation method for calculating a pixel value of an interpolation pixel for enlarging or reducing a digital image obtained by imaging a subject based on a pixel value of a neighboring pixel located in the vicinity of the interpolation pixel,
Detect an edge located between the neighboring pixels by a predetermined edge detection process ,
When the edge is detected by the edge detection process, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the edge,
By the edge detection processing, when the edge at any between two adjacent pixels of the three pixels adjacent in series on said digital image is detected, the merges the two edges 3 one of the single merged edges located near the center pixel among the pixels, and calculates the pixel value of the interpolation pixel based on the pixel values of the neighboring pixels on the side where the interpolation pixel is located among the opposite sides of said combination if edge It is characterized by this.

本発明の補間画素値算出方法は、前記2つのエッジの前記3つの画素の画素値を比較し、前記3つの画素の画素値が、該3つの画素の並ぶ方向に沿って単調増加または単調減少する場合においてのみ前記2つのエッジに対して前記併合を行うことが好ましい。
The interpolation pixel value calculation method of the present invention compares the pixel values of the three pixels at the two edges, and the pixel values of the three pixels increase or decrease monotonously along the direction in which the three pixels are arranged. It is preferable to perform the merging on the two edges only in the case of doing so.

本発明の補間画素値算出方法は、前記2つのエッジの延びる方向が同じである場合においてのみ該2つのエッジに対して前記併合を行うことがより好ましい。
More preferably , the interpolation pixel value calculation method of the present invention performs the merging on the two edges only when the extending directions of the two edges are the same.

ここで、「デジタル画像」とは、被写体を撮像して得た画像のデジタルデータにより表されるものを意味し、デジタルカメラにより取得したものに限らず、ネガフィルムやカラーリバーサルフィルムなどの写真フィルムに記録された写真画像や、プリントした写真画像などをスキャナなどの読取装置で光電的に読み取って得たものも含むものである。なお、以下の説明において、デジタル写真画像を略して単に画像という。   Here, “digital image” means an image represented by digital data of an image obtained by capturing an image of a subject, and is not limited to one acquired by a digital camera, but a photographic film such as a negative film or a color reversal film. Also included are those obtained by photoelectrically reading a photographic image recorded on the printer, a printed photographic image, or the like with a reading device such as a scanner. In the following description, a digital photographic image is simply referred to as an image.

また、「中央画素付近位置する」とは、前記3つの画素の互いに隣接する2つの画素からなる画素ペアの夫々の中央点間の位置に位置することを意味し、中央画素の位置に位置することを含むものである。例えば、前記3つの画素をG1、G2、G3とした場合、中央画素G2付近の位置とは、画素G1、G2間の中央点と、画素G2、G3間の中央点との間の位置となる。
Further, the "center located near the pixel" means to position the position between the center point of the respective pixel pair consisting of mutually adjacent two pixels of the three pixels, positioned in the position of the center pixel it is intended to include that. For example, when the three pixels are G1, G2, and G3, the position near the central pixel G2 is a position between the central point between the pixels G1 and G2 and the central point between the pixels G2 and G3. .

本発明の補間画素値算出装置は、
被写体を撮像して得たデジタル画像を拡大縮小するための補間画素の画素値を、該補間画素の近傍に位置する近傍画素の画素値に基づいて算出する補間画素値算出手段を有する補間画素値算出装置であって、
所定のエッジ検出処理により前記近傍画素の画素間に位置するエッジを検出するエッジ検出手段と、
エッジ検出手段により、前記デジタル画像上の直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいても前記エッジが検出された場合、該2つのエッジを併合して前記3つの画素のうちの中央画素付近位置する1つの併合エッジとするエッジ併合手段とを有し
前記補間画素値算出手段が、
前記エッジ検出手段により前記エッジが検出された場合は、該エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出すると共に、
前記エッジ併合手段により前記2つのエッジが併合された場合は、前記併合エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出するものであることを特徴とするものである。
Interpolation pixel value calculating device of the present invention,
An interpolation pixel value having an interpolation pixel value calculation means for calculating a pixel value of an interpolation pixel for enlarging / reducing a digital image obtained by imaging a subject based on a pixel value of a neighboring pixel located in the vicinity of the interpolation pixel A calculation device,
Edge detecting means for detecting an edge located between pixels of the neighboring pixels by a predetermined edge detection process ;
When the edge is detected in any of two adjacent pixels of the three pixels adjacent in series on the digital image by the edge detection means, the two edges are merged to and a edge merging means for a single merged edges located near the center pixel among the pixels,
The interpolation pixel value calculation means is
When the edge is detected by the edge detection means, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the edge;
When the two edges are merged by the edge merging means, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the merged edge It is characterized by being.

また、前記エッジ併合手段は、前記2つのエッジの前記3つの画素の画素値を比較し、前記3つの画素の画素値が、該3つの画素の並ぶ方向に沿って単調増加または単調減少する場合においてのみ前記2つのエッジに対して前記併合を行うものであることが好ましい。   Further, the edge merging means compares the pixel values of the three pixels of the two edges, and the pixel values of the three pixels monotonously increase or decrease monotonously along the direction in which the three pixels are arranged. It is preferable that the merging is performed only on the two edges.

また、前記エッジ検出手段は、前記エッジの延びる方向も検出するものであり、前記エッジ併合手段は、前記2つのエッジの延びる方向が同じである場合においてのみ該2つのエッジに対して前記併合を行うものであることがより好ましい。   The edge detection means also detects the extending direction of the edge, and the edge merging means performs the merging with respect to the two edges only when the extending directions of the two edges are the same. More preferably.

なお、本発明の補間画素値算出方法を、コンピュータに実行させるためのプログラムとして提供してもよい。
In addition, you may provide the interpolation pixel value calculation method of this invention as a program for making a computer perform.

本発明によれば、画像中の直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいてもエッジが検出された場合、該2つのエッジが、前記3つの画素のうちの中央画素付近の位置において併合される。   According to the present invention, when an edge is detected between any two adjacent pixels of three pixels adjacent in series in the image, the two edges are the center of the three pixels. Merged at a position near the pixel.

画像上の直列に隣接する3つの画素のうちの中央に位置する画素と、他の2つの画素のいずれとの間にもエッジが検出された場合(説明上の便宜のため、以下、直列に隣接する3つの画素の互いに相隣する2つの画素間のいずれにおいてもエッジが検出された場合のこの2つのエッジを隣接エッジという)、中央に位置する画素を中間値画素であると判定することができる。例えば図33(a)に示す例の被写体の画像に対して、画素間にエッジが存在するか否かを検出する方法として、例えば前述した第2のエッジ検出方法、すなわち直列に隣接する4つの画素に対して1次差分および2次差分を求め、求められた1次差分と2次差分の正負の関係に基づいて、この4つの画素の中央に位置する2つの隣接する画素間にエッジがあるか否かを判定するようにしてエッジを検出する方法を適用すると、図33(b)に示すように、画素GaとGbとの間、画素GbとGcとの間に夫々エッジA、エッジBが検出される。そして、隣接エッジとなるエッジAとエッジBの間の画素Gbが、図33(a)に示す境界線L(被写体におけるエッジ)の両側の信号値の中間値を示す中間値画素として見なすことができる。   When an edge is detected between the pixel located at the center of three pixels adjacent in series on the image and any of the other two pixels (for convenience of explanation, in the following, When two edges are detected between two adjacent pixels of three adjacent pixels, these two edges are referred to as adjacent edges), and the pixel located in the center is determined to be an intermediate value pixel Can do. For example, as a method for detecting whether or not there is an edge between pixels in the image of the subject in the example shown in FIG. 33A, for example, the second edge detection method described above, that is, four adjacent in series A primary difference and a secondary difference are obtained for a pixel, and an edge is found between two adjacent pixels located at the center of the four pixels based on the positive / negative relationship between the obtained primary difference and the secondary difference. When the edge detection method is applied so as to determine whether or not there is, as shown in FIG. 33 (b), an edge A and an edge between pixels Ga and Gb and between pixels Gb and Gc, respectively. B is detected. Then, the pixel Gb between the edge A and the edge B, which are adjacent edges, can be regarded as an intermediate value pixel indicating an intermediate value of signal values on both sides of the boundary line L (edge in the subject) shown in FIG. it can.

本発明は、前述隣接エッジにより挟まれる画素を中間値画素として見なすことができる点に着目し、隣接エッジを併合する。こうすることによって、まず、画像を拡大縮小するに際し、エッジに対して補間画素と同じ側に位置する画素のうちの、中間値画素ではない画素を参照画素とし、参照画素の画素値による補間演算を行って補間画素の画素値を求める場合において、隣接エッジ間に位置する補間画素の画素値を求めるための参照画素がなく、補間画素の画素値を求めることができない問題を解決することができる。   The present invention pays attention to the point that the pixels sandwiched between the adjacent edges can be regarded as intermediate value pixels, and merges adjacent edges. By doing so, first, when enlarging or reducing the image, a pixel that is not an intermediate value pixel among pixels located on the same side as the interpolation pixel with respect to the edge is set as a reference pixel, and an interpolation calculation is performed based on the pixel value of the reference pixel. When the pixel value of the interpolation pixel is obtained by performing the above, there is no reference pixel for obtaining the pixel value of the interpolation pixel located between adjacent edges, and the problem that the pixel value of the interpolation pixel cannot be obtained can be solved. .

また、例えば、隣接エッジが対応する3つの画素の中央画素、すなわち中間値画素として判定することができる画素の位置に該隣接エッジを併合すると、中間値画素の位置がエッジ位置と重なるため、参照画素が中間値画素である否かの判定を行わなくても、中間値画素が参照画素として使用されないため、簡単に拡大縮小された画像におけるボケの残留、広がりなどを防ぐことができる。   Further, for example, when the adjacent edge is merged with the position of the center pixel of the three pixels corresponding to the adjacent edge, that is, the pixel that can be determined as the intermediate value pixel, the position of the intermediate value pixel overlaps the edge position. Even if it is not determined whether or not the pixel is an intermediate value pixel, the intermediate value pixel is not used as a reference pixel, so that it is possible to prevent the blurring from remaining or spreading in an easily enlarged / reduced image.

また、隣接エッジが併合される位置が前述中央画素の位置と同じではない場合においても、隣接エッジ間に位置する補間画素に対して、この中央画素以外にも他の参照画素を得ることができるので、中央画素を参照画素として使用しないようにしたり、他の参照画素より小さい重みを中央画素に付けたりするなどして参照画像の画素値による補間演算を行うことによって、画質の良い、拡大縮小された画像を得ることができる。   In addition, even when the position where adjacent edges are merged is not the same as the position of the central pixel, other reference pixels can be obtained in addition to the central pixel for the interpolated pixels positioned between adjacent edges. Therefore, it is possible to perform enlargement / reduction with good image quality by performing interpolation calculation based on the pixel value of the reference image so that the central pixel is not used as a reference pixel or a weight smaller than other reference pixels is given to the central pixel. Images can be obtained.

一方、例えば、図34(a)に示すような、1本の細い線が存在する被写体の画像のX方向において、図34(b)に示すような画素構成になる。この場合、前述した第1のエッジ検出方法、すなわち、隣接する2つの画素間の画素値の差分を求め、この差分の絶対値が、所定の閾値以上であるときに、この2つの画素間にエッジが存在すると判定するようにしてエッジを検出する前述した第1のエッジ検出方法を適用すると、画素G’aと画素G’bとの間、画素G’bと画素G’cとの間にも夫々エッジA’とエッジB’が検出される。隣接エッジにより挟まれた画素を中間値画素とするようにすると、中央に位置する画素G’bが中間値画素とされるが、この場合において、候補画素G’bが細い線を示す画素であって、中間値画素ではない。前述した第4のエッジ検出方法を用いた場合にも、このような誤判定が起きる可能性がある。一方、エッジを検出する方法として前述した第2または第3のエッジ検出方法を適用すると、画素G’aとG’bの間、画素G’bとG’cとの間にエッジが検出されないため、隣接エッジにより挟まれた画素を中間素として判定するようにしても、画素G’bが中間値画素として誤判定されることがない。すなわち、隣接エッジにより挟まれた画素を中間値画素とすると、画像上の画素間にエッジが存在するか否かを検出する方法によっては、中間値画素ではない画素を中間値画素とされる恐れがある。そのため、図34に示す例の場合、隣接エッジA’、B’を併合すると、画像を拡大縮小する際に、この2つの隣接エッジにより挟まれた画素G’bが、参照画素として使用されない、または重みを小さくして使用される可能性があるため、拡大縮小された画像において、被写体に本当に存在する線(図34(a)中の線L’)が消えたり、薄くなったりするなどの問題が生じる。   On the other hand, for example, as shown in FIG. 34A, the pixel configuration is as shown in FIG. 34B in the X direction of the image of the subject where one thin line exists. In this case, the first edge detection method described above, that is, a difference between pixel values between two adjacent pixels is obtained, and when the absolute value of the difference is equal to or greater than a predetermined threshold value, the difference between the two pixels is determined. When the first edge detection method described above that detects an edge by determining that an edge is present is applied, between the pixel G′a and the pixel G′b and between the pixel G′b and the pixel G′c. In addition, edge A ′ and edge B ′ are detected, respectively. If a pixel sandwiched between adjacent edges is set as an intermediate value pixel, the pixel G′b located at the center is set as an intermediate value pixel. In this case, the candidate pixel G′b is a pixel indicating a thin line. It is not an intermediate value pixel. Even when the above-described fourth edge detection method is used, such an erroneous determination may occur. On the other hand, when the second or third edge detection method described above is applied as an edge detection method, no edge is detected between the pixels G′a and G′b and between the pixels G′b and G′c. Therefore, even if a pixel sandwiched between adjacent edges is determined as an intermediate element, the pixel G′b is not erroneously determined as an intermediate value pixel. That is, if a pixel sandwiched between adjacent edges is an intermediate value pixel, a pixel that is not an intermediate value pixel may be determined to be an intermediate value pixel depending on a method for detecting whether an edge exists between pixels on the image. There is. Therefore, in the example shown in FIG. 34, when the adjacent edges A ′ and B ′ are merged, the pixel G′b sandwiched between the two adjacent edges is not used as a reference pixel when the image is enlarged or reduced. Or, since there is a possibility of being used with a reduced weight, the line that actually exists in the subject (the line L ′ in FIG. 34A) disappears or becomes thin in the scaled image. Problems arise.

これに対し、本発明において、隣接エッジであれば併合するのではなく、隣接エッジの対応する3つの画素値を比較し、この3つの画素の画素値が画素の並ぶ方向に沿って単調増加または単調減少するときにおいてのみ、すなわち隣接エッジが挟む画素が真の中間値画素である場合においてのみ、隣接エッジを併合するようにすると、上記の問題を防ぐことができ、拡大縮小された画像において、ボケが軽減されると共に、被写体にある線が消えることを防ぐことができる。   On the other hand, in the present invention, if the adjacent edges are not merged, the corresponding three pixel values of the adjacent edges are compared, and the pixel values of the three pixels increase monotonously along the direction in which the pixels are arranged or Only when monotonously decreasing, that is, only when the pixel sandwiched between adjacent edges is a true intermediate value pixel, the above problem can be prevented by merging the adjacent edges. Blur can be reduced and the lines on the subject can be prevented from disappearing.

また、異なる方向に延びる隣接エッジにより挟まれた画素の中間値画素である確信度が、同じ方向に延びる隣接エッジにより挟まれる画素の中間値画素である確信度より低いことに着目し、本発明において、同じ方向に延びる隣接エッジのみを併合するようにすれば、中間値画素ではない画素が補間画素の参照画素から除去されたりするなどの問題をより確実に防ぐことができる。   Further, the present invention focuses on the fact that the certainty factor that is an intermediate value pixel of pixels sandwiched by adjacent edges extending in different directions is lower than the certainty factor that is an intermediate value pixel of pixels sandwiched by adjacent edges extending in the same direction. If only the adjacent edges extending in the same direction are merged, it is possible to more reliably prevent problems such as removal of pixels that are not intermediate value pixels from the reference pixels of the interpolation pixels.

なお、本発明のプログラムは、本発明の補間画素値算出方法をコンピュータに実行させることができる。
The program of the present invention can cause a computer to execute the interpolation pixel value calculation method of the present invention.

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

図1は、本発明の第1の実施形態による画像拡大縮小装置の構成を示すブロック図である。図示のように、本実施形態による画像拡大縮小装置は、画像データS0および画像データS0の拡大縮小率Kの入力を受け付ける入力部1と、エッジ検出部10と、エッジ併合部20と、補間画素の画素値を算出する補間演算部30と、入力部1、エッジ検出部10、エッジ併合部20および補間演算部30の動作を制御する制御部50とを備える。   FIG. 1 is a block diagram showing a configuration of an image enlargement / reduction apparatus according to the first embodiment of the present invention. As illustrated, the image enlargement / reduction apparatus according to the present embodiment includes an input unit 1 that receives input of image data S0 and an enlargement / reduction rate K of the image data S0, an edge detection unit 10, an edge merging unit 20, and an interpolation pixel. An interpolation calculation unit 30 for calculating the pixel value of the input unit 1, an edge detection unit 10, an edge merging unit 20, and a control unit 50 for controlling the operation of the interpolation calculation unit 30.

ここで、画像データS0により表される画像は、図2に示すように2次元状に画素が並んで構成されてなるものであり、以下の説明においては、図2に示すようにx方向およびy方向を定めるものとする。なお、以下の説明において、画像データと、画像データにより表される画像とについて特に区別せず、参照符号も同じもの(ここではS0)を付与する。   Here, the image represented by the image data S0 is configured by two-dimensionally arranging pixels as shown in FIG. 2, and in the following description, as shown in FIG. The y direction shall be determined. In the following description, image data and an image represented by the image data are not particularly distinguished, and the same reference numerals (here, S0) are given.

図3は、本実施形態の画像拡大縮小装置におけるエッジ検出部10の構成を示すブロック図である。図示のように、エッジ検出部10は、フィルタリング部12と、隣接する2つの画素間にエッジが存在するか否かを判定する判定部14とを備えてなる。   FIG. 3 is a block diagram showing the configuration of the edge detection unit 10 in the image enlargement / reduction apparatus of this embodiment. As shown in the figure, the edge detection unit 10 includes a filtering unit 12 and a determination unit 14 that determines whether an edge exists between two adjacent pixels.

フィルタリング部12は、以下のようにしてフィルタリング処理を行う。フィルタリング部12は、図4に示すように、画像S0のx方向およびy方向の夫々について一列毎に、隣接する2つの画素G2、G3およびこの2つの画素G2、G3の夫々に隣接する2つの画素からなる直列に隣接する2つの画素G1〜G4について、互いに隣接する2つの画素からなる3つの画素ペア(G1,G2)、(G2,G3)、(G3,G4)に対して差分フィルタによるフィルタリング処理を施して、画素ペア(G1,G2)、(G2,G3)、(G3,G4)の画素値の差分を1次差分d1、d2、d3として算出する。   The filtering unit 12 performs a filtering process as follows. As shown in FIG. 4, the filtering unit 12 includes two adjacent pixels G2 and G3 and two adjacent pixels G2 and G3 for each column in the x direction and the y direction of the image S0. With respect to two pixels G1 to G4 adjacent in series consisting of pixels, a difference filter is used for three pixel pairs (G1, G2), (G2, G3), (G3, G4) consisting of two adjacent pixels. A filtering process is performed to calculate the differences between the pixel values of the pixel pairs (G1, G2), (G2, G3), (G3, G4) as primary differences d1, d2, d3.

図5は、差分フィルタの例を示す図である。図5に示すように、本実施形態において使用される差分フィルタは、フィルタ値が(−1,1)の2タップのフィルタである。なお、差分フィルタは、これに限られるものではなく、画素ペアの2つの画素値の重み付け差分を求めるフィルタ値を有するフィルタや、2タップ以上の偶数タップ数を有するものを用いてもよい。   FIG. 5 is a diagram illustrating an example of the difference filter. As shown in FIG. 5, the differential filter used in the present embodiment is a 2-tap filter having a filter value of (−1, 1). Note that the difference filter is not limited to this, and a filter having a filter value for obtaining a weighted difference between two pixel values of a pixel pair, or a filter having an even number of taps of 2 taps or more may be used.

続いて、フィルタリング部12は、3つの1次差分d1、d2、d3における隣接する2つの1次差分ペア(d1,d2)および(d3,d4)に対して同様に図5に示す差分フィルタによるフィルタリング処理を施して、1次差分ペア(d1,d2)および(d3,d4)の差分を2次差分d4、d5として算出する。   Subsequently, the filtering unit 12 similarly applies the difference filter shown in FIG. 5 to two adjacent primary difference pairs (d1, d2) and (d3, d4) in the three primary differences d1, d2, and d3. A filtering process is performed to calculate the differences between the primary difference pairs (d1, d2) and (d3, d4) as secondary differences d4, d5.

さらに、フィルタリング部12は、直列に隣接する4つの画素G1〜G4の中央の2つの画素からなる画素ペア(G2,G3)に対してフィルタリング処理を施して、画素ペア(G2,G3)の画素値の差分d0(=d2)を算出する。なお、上記1次差分d2をそのまま差分d0として用いてもよい。   Further, the filtering unit 12 performs a filtering process on the pixel pair (G2, G3) including the center two pixels of the four pixels G1 to G4 adjacent in series, and the pixels of the pixel pair (G2, G3) A value difference d0 (= d2) is calculated. The primary difference d2 may be used as the difference d0 as it is.

判定部14は、第1の判定として、1次差分d1、d2、d3および2次差分d4、d5の正負の関係に基づいて、隣接する2つの画素G2、G3の間にエッジが存在するか否かを判定する。   As a first determination, the determination unit 14 determines whether an edge exists between two adjacent pixels G2 and G3 based on the positive / negative relationship between the primary differences d1, d2, and d3 and the secondary differences d4 and d5. Determine whether or not.

図6から図8は、直列に隣接する4つの画素の1次差分d1、d2、d3および2次差分d4、d5の正負と、直列に隣接する4つの画素のプロファイル形状との関係を示す表である。直列に隣接する4つの画素の1次差分d1、d2、d3および2次差分d4、d5の正負は全18種類の組合せがある。隣接する2つの画素G2、G3の間にエッジが存在する組合せは、図6に示すエッジ1およびエッジ2の2通りである。エッジ1は、(d1,d2,d3,d4,d5)=(+,+,+,+,−)となる右上がりエッジおよび(d1,d2,d3,d4,d5)=(−,−,−,−,+)となる左上がりエッジの2種類があり、エッジ2は、(d1,d2,d3,d4,d5)=(+,+,+,+,+)となる下に凸の右上がりエッジ、(d1,d2,d3,d4,d5)=(+,+,+,−,−)となる上に凸の右上がりエッジ、(d1,d2,d3,d4,d5)=(−,−,−,+,+)となる下に凸の左上がりエッジ、(d1,d2,d3,d4,d5)=(−,−,−,−,−)となる上に凸の左上がりエッジの4種類がある。   6 to 8 are tables showing the relationship between the positive / negative of the primary differences d1, d2, d3 and the secondary differences d4, d5 of four pixels adjacent in series and the profile shape of the four pixels adjacent in series. It is. There are a total of 18 kinds of combinations of positive and negative of the primary differences d1, d2, d3 and the secondary differences d4, d5 of four pixels adjacent in series. There are two combinations of edge 1 and edge 2 shown in FIG. 6 in which an edge exists between two adjacent pixels G2 and G3. Edge 1 is a right rising edge such that (d1, d2, d3, d4, d5) = (+, +, +, +, −) and (d1, d2, d3, d4, d5) = (−, −, There are two types of rising edges that are-,-, +), and edge 2 has a downwardly convex shape where (d1, d2, d3, d4, d5) = (+, +, +, +, +) Upwardly rising edge where (d1, d2, d3, d4, d5) = (+, +, +, −, −), (d1, d2, d3, d4, d5) = ( Downward convex left rising edge that becomes −, −, −, +, +), and upward convex leftward that becomes (d1, d2, d3, d4, d5) = (−, −, −, −, −) There are four types of rising edges.

判定部14は、図6から図8に示す表を記憶しており、直列に隣接する4つの画素の1次差分d1、d2、d3および2次差分d4、d5の正負の関係が、図6に示すエッジ1またはエッジ2の関係となる場合に、隣接する2つの画素G2、G3の間にエッジが存在すると判定すると共に、これらの差分の正負の関係が、図7および図8に示すような山、谷、その他の関係となる場合に、隣接する2つの画素G2、G3の間にエッジが存在しないと判定する。   The determination unit 14 stores the tables shown in FIGS. 6 to 8, and the positive / negative relationship between the primary differences d1, d2, d3 and the secondary differences d4, d5 of four pixels adjacent in series is shown in FIG. 7 and 8, it is determined that an edge exists between two adjacent pixels G <b> 2 and G <b> 3, and the positive / negative relationship between these differences is as shown in FIGS. 7 and 8. When there is a relationship such as a mountain, a valley, or the like, it is determined that no edge exists between two adjacent pixels G2 and G3.

さらに判定部14は、第2の判定として、前述の第1の判定によりエッジが存在すると判定された場合に、画素G2、G3の画素値の差分d0の絶対値が所定の閾値Th1以上であるか否かを判定し、第2の判定が肯定されると、そこに真のエッジが存在すると判定する。一方、第2の判定が否定されると、そこに真のエッジが存在しないと判定する。このように第2の判定を行うのは、第1の判定においてエッジが存在すると判定されても、例えば図9に示すように、画素G2、G3の画素値の差が非常にわずかでノイズと見なせるような場合に、そこはエッジであるとして補間演算部30が後述するようにエッジ部分に適した補間演算を行い、かえってノイズが強調されてしまうことを防止するためである。このように各隣接する2つの画素間に対して判定がなされると、エッジ検出部10は、判定結果をエッジ併合部20に出力する。   Furthermore, when the determination unit 14 determines that an edge is present in the first determination as the second determination, the absolute value of the difference d0 between the pixel values of the pixels G2 and G3 is equal to or greater than a predetermined threshold Th1. If the second determination is affirmed, it is determined that there is a true edge. On the other hand, if the second determination is negative, it is determined that there is no true edge. In this way, the second determination is performed even if it is determined that there is an edge in the first determination, for example, as shown in FIG. 9, the difference between the pixel values of the pixels G2 and G3 is very slight and noise. In such a case, the interpolation calculation unit 30 performs an interpolation calculation suitable for the edge portion as will be described later, and prevents noise from being emphasized. When the determination is made between two adjacent pixels in this way, the edge detection unit 10 outputs the determination result to the edge merging unit 20.

エッジ併合部20は、エッジ検出部10により検出された各エッジのうち、隣接エッジ、すなわち、直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいてもエッジが検出された場合の1対のエッジがあるか否かを検出する共に、検出した隣接エッジを、該隣接エッジの間の画素の位置において併合する。例えば、図4に示す画素列において、画素G1、G2の間、および画素G2、G3の間のいずれにおいてもエッジが検出された場合、この2つのエッジを画素G2の位置において併合し、画素G1と画素G3の間においては、画素G2の位置にのみエッジが存在し、画素G2とG3の間、および画素G2とG3の間においては、エッジが存在しないこととなる。   When the edge merging unit 20 detects an edge in each of the edges detected by the edge detection unit 10, an adjacent edge, that is, an edge between two adjacent pixels of three pixels adjacent in series. And detecting a pair of edges, and merging the detected adjacent edges at the pixel positions between the adjacent edges. For example, in the pixel row shown in FIG. 4, when edges are detected between the pixels G1 and G2 and between the pixels G2 and G3, the two edges are merged at the position of the pixel G2, and the pixel G1 Between the pixel G2 and the pixel G3, an edge exists only at the position of the pixel G2, and no edge exists between the pixels G2 and G3 and between the pixels G2 and G3.

図10は、補間演算部30の構成を示すブロック図である。図示のように、補間演算部30は、境界設定部32、判定部34および演算部36を備え、画像S0における画素の間に位置する補間画素Pの画素値を算出するものである。以下、補間演算部30の詳細について説明する。   FIG. 10 is a block diagram illustrating a configuration of the interpolation calculation unit 30. As illustrated, the interpolation calculation unit 30 includes a boundary setting unit 32, a determination unit 34, and a calculation unit 36, and calculates the pixel value of the interpolation pixel P located between the pixels in the image S0. Details of the interpolation calculation unit 30 will be described below.

補間演算部30は、補間画素Pが間に位置する2つの隣接する画素の間およびこの2つの隣接する画素の位置に、エッジが存在しない場合、バイキュービック法を用いて補間画素Pの画素値を算出する。   When there is no edge between two adjacent pixels between which the interpolation pixel P is located and the position of the two adjacent pixels, the interpolation calculation unit 30 uses the bicubic method to calculate the pixel value of the interpolation pixel P. Is calculated.

ここで、バイキュービック法は3次補間の1手法であり、補間画素Pの近傍の16画素を用いて補間画素Pの画素値を求める方法である。以下、バイキュービック法について説明する。   Here, the bicubic method is one method of cubic interpolation, and is a method of obtaining the pixel value of the interpolation pixel P using 16 pixels in the vicinity of the interpolation pixel P. Hereinafter, the bicubic method will be described.

図11は、バイキュービック法を説明するための図である。図示のように点Pを補間画素Pの位置とした場合、図11中黒丸で示される画素は第1次近傍、白丸で示される画素は第2次近傍と称される。第1次近傍および第2次近傍の夫々について、下記の式(1)に示すようにx方向およびy方向に夫々に独立に距離dx、dy(式(1)においては単にdと示す)に対して重みWx、Wyを求め、最終的にその画素に対する重みW=WxWyを得る。

Figure 0004133746
FIG. 11 is a diagram for explaining the bicubic method. As shown in the figure, when the point P is set as the position of the interpolation pixel P, the pixel indicated by the black circle in FIG. 11 is referred to as the primary neighborhood, and the pixel indicated by the white circle is referred to as the secondary neighborhood. For each of the primary neighborhood and the secondary neighborhood, as shown in the following formula (1), the distances dx and dy (indicated by simply d in the formula (1)) are independently obtained in the x direction and the y direction, respectively. On the other hand, weights Wx and Wy are obtained, and finally a weight W = WxWy for the pixel is obtained.
Figure 0004133746

例えば、図11における(−1,−1)の画素(第2次近傍)に対して、重みWx、Wy、Wを求めると、

Figure 0004133746
For example, when the weights Wx, Wy, and W are obtained for the pixel (second order neighborhood) of (−1, −1) in FIG.
Figure 0004133746

となる。 It becomes.

そして、W(i,j)を画素(i,j)の重み、f(i,j)を画素(i,j)の画素値とすると、補間画素Pの画素値f’(P)は、

Figure 0004133746
When W (i, j) is the weight of the pixel (i, j) and f (i, j) is the pixel value of the pixel (i, j), the pixel value f ′ (P) of the interpolation pixel P is
Figure 0004133746

により算出することができる。 Can be calculated.

なお、本実施形態においては、バイキュービック法をx方向またはy方向の1次元方向にのみ適用して、補間画素Pの画素値を算出するものとする。   In the present embodiment, the pixel value of the interpolation pixel P is calculated by applying the bicubic method only in the one-dimensional direction of the x direction or the y direction.

一方、エッジであると判定された部分については、補間演算部30は以下のようにして補間画素Pの画素値を求める。まず、このエッジが画素間に位置するものである場合について説明する。図12は、画素間にエッジがあると判定された部分についての画素値のプロファイルを示す図である。なお、図12において、水平方向が画素が並ぶ方向であり、垂直方向が画素値の大きさを示す方向である。2つの隣接する画素G2、G3の間にエッジが存在すると判定された場合、その2つの画素にさらに夫々隣接する2つの画素G1、G4を加えた直列に隣接する4つの画素G1〜G4の画素値のプロファイルは、図12(a)または図12(b)に示すものとなる。   On the other hand, for the portion determined to be an edge, the interpolation calculation unit 30 obtains the pixel value of the interpolation pixel P as follows. First, a case where this edge is located between pixels will be described. FIG. 12 is a diagram illustrating a profile of pixel values for a portion determined to have an edge between pixels. In FIG. 12, the horizontal direction is a direction in which pixels are arranged, and the vertical direction is a direction indicating the magnitude of the pixel value. When it is determined that an edge exists between two adjacent pixels G2 and G3, the pixels of four pixels G1 to G4 adjacent in series obtained by adding two adjacent pixels G1 and G4 to the two pixels, respectively. The value profile is as shown in FIG. 12 (a) or FIG. 12 (b).

プロファイルが図12(a)に示すステップエッジ形状をなす場合、境界設定部32は、画素が並ぶ方向において画素G2、G3間の距離を2等分する中線M(一点鎖線)を境界線として設定する。そして、判定部34は補間画素Pが境界線Mの右側に存在するか左側に存在するかを判定し、境界線Mの右側に補間画素(P1とする)が存在する場合には、演算部36は画素G3、G4を結ぶ直線の延長線上の値を補間画素P1の画素値として算出する。また、境界線Mの左側に補間画素(P2とする)が存在する場合には、演算部36は、画素G1、G2を結ぶ直線の延長線上の値を補間画素P2の画素値として算出する。   When the profile has the step edge shape shown in FIG. 12A, the boundary setting unit 32 uses the middle line M (dashed line) that bisects the distance between the pixels G2 and G3 in the direction in which the pixels are arranged as a boundary line. Set. Then, the determination unit 34 determines whether the interpolation pixel P exists on the right side or the left side of the boundary line M, and when the interpolation pixel (referred to as P1) exists on the right side of the boundary line M, the calculation unit 36 calculates the value on the extension of the straight line connecting the pixels G3 and G4 as the pixel value of the interpolation pixel P1. When the interpolation pixel (P2) is present on the left side of the boundary line M, the calculation unit 36 calculates the value on the extension line of the straight line connecting the pixels G1 and G2 as the pixel value of the interpolation pixel P2.

プロファイルが図12(b)に示すエッジ形状をなす場合、境界設定部32は画素G1、G2を結ぶ直線の延長線と、画素G3、G4を結ぶ直線の延長線との交点Cを境界点として設定する。そして、判定部34は補間画素Pが境界点Cの右側に存在するか左側に存在するかを判定し、境界点Cの右側に補間画素P1が存在する場合には、演算部36は画素G3、G4を結ぶ直線の延長線上の値を補間画素P1の画素値として算出する。また、境界点Cの左側に補間画素P2が存在する場合には、演算部36は、画素G1、G2を結ぶ直線の延長線上の値を補間画素P2の画素値として算出する。   When the profile has the edge shape shown in FIG. 12B, the boundary setting unit 32 uses the intersection C between the extension line of the straight line connecting the pixels G1 and G2 and the extension line of the straight line connecting the pixels G3 and G4 as a boundary point. Set. Then, the determination unit 34 determines whether the interpolation pixel P exists on the right side or the left side of the boundary point C. When the interpolation pixel P1 exists on the right side of the boundary point C, the calculation unit 36 calculates the pixel G3. , G4 is calculated as the pixel value of the interpolation pixel P1. When the interpolation pixel P2 exists on the left side of the boundary point C, the calculation unit 36 calculates a value on an extension line of a straight line connecting the pixels G1 and G2 as the pixel value of the interpolation pixel P2.

なお、ここでは2つの画素の画素値のみを用いて補間画素Pの画素値を算出しているが、3以上の画素値を用いてもよい。この場合、画素を直線で結ぶことが困難な場合がある。そのため、スプライン曲線などの任意の関数により規定される曲線により画素を結び、その曲線の延長線上の値を補間画素Pの画素値とすればよい。   Here, the pixel value of the interpolation pixel P is calculated using only the pixel values of two pixels, but three or more pixel values may be used. In this case, it may be difficult to connect the pixels with a straight line. Therefore, the pixels may be connected by a curve defined by an arbitrary function such as a spline curve, and the value on the extension line of the curve may be set as the pixel value of the interpolation pixel P.

次いで、エッジが画素の位置に存在する場合、すなわち、該エッジがエッジ併合部20により隣接エッジを、この2つの隣接エッジにより挟まれる画素の位置において併合されたものである場合において、補間演算部30による補間画素の画素値の算出について説明する。   Next, when the edge exists at the pixel position, that is, when the edge is obtained by merging the adjacent edge by the edge merging unit 20 at the pixel position sandwiched between the two adjacent edges, the interpolation calculation unit The calculation of the pixel value of the interpolation pixel by 30 will be described.

まず、この場合において隣接エッジを夫々挟む画素となる3つの画素および、この3つの画素のうち、隣接エッジの外側に位置する2つの画素の夫々と隣接する画素となる2つの画素の画素値のプロファイルについて説明する。図13(a)は、1対の隣接エッジのが、夫々図6に示すエッジ1における(d1,d2,d3,d4,d5)=(+,+,+,+,−)の種類に属するエッジと、図6に示すエッジ2における(d1,d2,d3,d4,d5)=(+,+,+,−,−)の種類に属するエッジである場合の上述したプロファイルの例を示す図である。図13(a)に示す例の場合には、エッジ検出部10において、隣接する画素G2、G3の間、隣接する画素G3、G4の間に夫々エッジが検出されているが、エッジ併合部20において、この2つのエッジが画素G3の位置において併合されている。   First, in this case, the pixel values of the three pixels that are pixels that sandwich the adjacent edge and the two pixels that are adjacent to each of the two pixels that are located outside the adjacent edge among the three pixels. The profile will be described. In FIG. 13A, a pair of adjacent edges belong to the type (d1, d2, d3, d4, d5) = (+, +, +, +, −) at edge 1 shown in FIG. The figure which shows the example of the profile mentioned above when it is an edge and the edge which belongs to the kind of (d1, d2, d3, d4, d5) = (+, +, +,-,-) in the edge 2 shown in FIG. It is. In the case of the example illustrated in FIG. 13A, the edge detection unit 10 detects edges between the adjacent pixels G2 and G3 and between the adjacent pixels G3 and G4. The two edges are merged at the position of the pixel G3.

補間演算部30は、まず、境界設定部32により、図13(b)に示すように、エッジ位置、すなわち画素G3を通る垂直線(図示一点鎖線)Mを境界線として設定する。そして、判定部34は補間画素が境界線Mの右側に存在するか左側に存在するかを判定し、境界線Mの右側に補間画素(P1)が存在する場合には、演算部36は画素G4、G5を結ぶ直線の延長線上の値を補間画素の画素値として算出する。また、境界線Mの左側に補間画素(P2)が存在する場合には、演算部36は、画素G1、G2を結ぶ直線の延長線上の値を補間画素の画素値として算出する。   First, as shown in FIG. 13B, the interpolation calculation unit 30 sets the edge position, that is, a vertical line (dotted line in the drawing) M passing through the pixel G3 as the boundary line by the boundary setting unit 32. Then, the determination unit 34 determines whether the interpolation pixel exists on the right side or the left side of the boundary line M, and when the interpolation pixel (P1) exists on the right side of the boundary line M, the calculation unit 36 determines whether the pixel is a pixel. The value on the extended line of the straight line connecting G4 and G5 is calculated as the pixel value of the interpolation pixel. When the interpolation pixel (P2) exists on the left side of the boundary line M, the calculation unit 36 calculates the value on the extension line of the straight line connecting the pixels G1 and G2 as the pixel value of the interpolation pixel.

なお、ここでも、2つの画素の画素値のみを用いて補間画素の画素値を算出しているが、3以上の画素値を用いてもよい。この場合、画素を直線で結ぶことが困難な場合がある。そのため、スプライン曲線などの任意の関数により規定される曲線により画素を結び、その曲線の延長線上の値を補間画素の画素値とすればよい。   Here, the pixel value of the interpolation pixel is calculated using only the pixel values of the two pixels, but three or more pixel values may be used. In this case, it may be difficult to connect the pixels with a straight line. Therefore, the pixels may be connected by a curve defined by an arbitrary function such as a spline curve, and the value on the extension line of the curve may be the pixel value of the interpolation pixel.

さらに、この場合において、境界線Mの右側に補間画素(P1)が存在する場合には、画素G4の画素値を補間画素の画素値とし、境界線Mの左側に補間画素(P2)が存在する場合には、画素G2の画素値を補間画素の画素値とするようにしてもよい。   Further, in this case, when the interpolation pixel (P1) exists on the right side of the boundary line M, the pixel value of the pixel G4 is set as the pixel value of the interpolation pixel, and the interpolation pixel (P2) exists on the left side of the boundary line M. In this case, the pixel value of the pixel G2 may be the pixel value of the interpolation pixel.

以下の説明において、エッジが存在しない部位に位置する補間画素の画素値を求める演算(バイキュービック法による演算)を第1の補間演算、画素間にエッジが存在する部位に位置する補間画素の画素値を求める演算を第2の補間演算、画素位置にエッジが存在する部位に位置する補間画素の画素値を求める演算を第3の補間演算という。   In the following explanation, the calculation (calculation by bicubic method) for obtaining the pixel value of an interpolation pixel located at a part where no edge exists is the first interpolation calculation, and the pixel of the interpolation pixel located at a part where the edge exists between the pixels The calculation for obtaining a value is referred to as a second interpolation calculation, and the calculation for obtaining a pixel value of an interpolation pixel located at a portion where an edge exists at the pixel position is referred to as a third interpolation calculation.

次いで、本実施形態において行われる処理について説明する。図14は、本実施形態において行われる処理を示すフローチャートである。なお、本実施形態において、補間画素Pは、画像S0の画素の間に存在するものとする。まず、入力部1が、拡大縮小する画像データS0および画像データの拡大縮小率Kの入力を受け付ける(S1)。そして、画素を補間する方向をまずx方向に設定する(S2)。次いで、拡大縮小率Kに応じた最初の補間画素P(例えば拡大縮小された画像S1上の左上に位置する画素)について、エッジ検出部10のフィルタリング部12がその補間画素Pが間に位置する直列に隣接する4つの画素G1〜G4からなる画素列Φを図18に示すように設定する(S3)。設定された画素列Φの各々の画素の画素値を用いて、画素G2、G3の間にエッジがあるか否かが検出される(S10)。ここで、ステップS10において行われるエッジ検出処理Aの詳細について後述する。ステップS10において、画素G2とG3の間にエッジがないと判定されると(S20:No)、補間演算部30は、第1の補間演算B1、すなわち前述したバイキュービック法による補間演算を行って、補間画素Pの画素値を算出する(S30)。   Next, processing performed in the present embodiment will be described. FIG. 14 is a flowchart showing processing performed in the present embodiment. In the present embodiment, it is assumed that the interpolation pixel P exists between the pixels of the image S0. First, the input unit 1 receives input of image data S0 to be enlarged / reduced and an enlargement / reduction ratio K of the image data (S1). The direction for interpolating the pixels is first set in the x direction (S2). Next, for the first interpolation pixel P corresponding to the enlargement / reduction ratio K (for example, the pixel located in the upper left on the enlarged image S1), the filtering unit 12 of the edge detection unit 10 has the interpolation pixel P positioned between them. A pixel column Φ composed of four pixels G1 to G4 adjacent in series is set as shown in FIG. 18 (S3). It is detected whether there is an edge between the pixels G2 and G3 using the pixel value of each pixel of the set pixel row Φ (S10). Here, the details of the edge detection process A performed in step S10 will be described later. If it is determined in step S10 that there is no edge between the pixels G2 and G3 (S20: No), the interpolation calculation unit 30 performs the first interpolation calculation B1, that is, the interpolation calculation by the bicubic method described above. The pixel value of the interpolation pixel P is calculated (S30).

一方、ステップS10において、画素G2とG3の間にエッジがあると判定されると(S20:Yes)、エッジ検出部10のフィルタリング部12は、画素列Φを左右夫々1つ画素分ずらして得た図18に示す画素列Φ1(G0〜G3)および画素列Φ2(G2〜G5)を設定する(S40)。設定された2つの画素列Φ1、Φ2に対して、エッジ検出部10によるエッジ検出処理Aが行われ、画素G1とG2の間、画素G3とG4の間にエッジがあるか否かが検出される(S42)。そして、画素G2とG3との間にエッジがあり、画素G1とG2の間および画素G3とG4の間に夫々エッジが存在するか否かの検出結果がエッジ併合部20に出力される。エッジ併合部20は、画素G1とG2の間、および画素G3とG4の間のいずれにおいてもエッジが検出されていない場合(S44:No)、エッジ検出部10の検出結果をそのまま補間演算部30に出力する(S46)。また、エッジ併合部20は、画素G1とG2の間、および画素G3とG4の間のうちの片方においてのみエッジが検出された場合(S44:Yes、S60:No)、G2とG3の間のエッジと、G1とG2の間または画素G3とG4の間に検出されたエッジとを、この2つのエッジにより挟まれた画素(図18の例の場合、G2またはG3)の位置において併合し、併合したエッジが位置する画素を表す情報を補間演算部30に出力する(S67)。また、エッジ併合部20は、画素G1とG2の間、および画素G3とG4の間のいずれにおいてもエッジが検出された場合(S44:Yes、S60:Yes)、エッジ部10のエッジ検出結果をそのまま補間演算部30に出力する(S65)。   On the other hand, if it is determined in step S10 that there is an edge between the pixels G2 and G3 (S20: Yes), the filtering unit 12 of the edge detection unit 10 obtains the pixel row Φ by shifting the pixel row Φ by one pixel each on the left and right. The pixel column Φ1 (G0 to G3) and the pixel column Φ2 (G2 to G5) shown in FIG. 18 are set (S40). Edge detection processing A by the edge detection unit 10 is performed on the set two pixel rows Φ1 and Φ2, and it is detected whether or not there is an edge between the pixels G1 and G2 and between the pixels G3 and G4. (S42). A detection result indicating whether or not there is an edge between the pixels G2 and G3 and an edge exists between the pixels G1 and G2 and between the pixels G3 and G4 is output to the edge merging unit 20. When no edge is detected in any of the pixels G1 and G2 and between the pixels G3 and G4 (S44: No), the edge merging unit 20 directly uses the detection result of the edge detection unit 10 as an interpolation calculation unit 30. (S46). Further, when the edge merging unit 20 detects an edge only between one of the pixels G1 and G2 and between the pixels G3 and G4 (S44: Yes, S60: No), the edge merging unit 20 is between G2 and G3. The edge and the edge detected between G1 and G2 or between the pixels G3 and G4 are merged at the position of the pixel sandwiched between the two edges (G2 or G3 in the example of FIG. 18), Information representing the pixel where the merged edge is located is output to the interpolation calculation unit 30 (S67). The edge merging unit 20 determines the edge detection result of the edge unit 10 when an edge is detected between the pixels G1 and G2 and between the pixels G3 and G4 (S44: Yes, S60: Yes). The data is output to the interpolation calculation unit 30 as it is (S65).

補間演算部30は、ステップS46、ステップS67、ステップS65においてエッジ併合部20から出力されてきた情報に応じて、補間演算を行って画素Pの画素値を算出する。具体的には、エッジが画素G2とG3の間に存在する場合(S20:Yes、S44:No)、補間演算部30は、第2の補間演算B2(その詳細について後述する)を行って補間画素Pの画素値を算出する(S50)。また、エッジが画素G2とG3のいずれか一方に位置する場合(S22:Yes、S44:Yes、S60:No、S67)、補間演算部30は、第3の補間演算B3(その詳細について後述する)を行って補間画素Pの画素値を算出する(S70)。また、画素G1、G2、G3、G4の互いに隣接する2つの画素間のいずれにおいてエッジが存在する場合(S22:Yes、S44:Yes、S60:Yes、S65)、補間演算部30は、第1の補間演算B1、すなわちバイキュービック法による補間演算を行って補間画素Pの画素値を算出する(S30)。ここで、画素G1、G2、G3、G4の互いに隣接する2つの画素間のいずれにおいてエッジが存在する場合、すなわち隣接するエッジが3つ続いた場合、夫々のエッジが被写体におけるエッジによるものではなく、グラデーションによるものである可能性が高いため、画素G2とG3の間にエッジが存在しないと判定することができるからである。   The interpolation calculation unit 30 calculates the pixel value of the pixel P by performing an interpolation calculation according to the information output from the edge merging unit 20 in step S46, step S67, and step S65. Specifically, when an edge exists between the pixels G2 and G3 (S20: Yes, S44: No), the interpolation calculation unit 30 performs the second interpolation calculation B2 (details will be described later) to perform interpolation. The pixel value of the pixel P is calculated (S50). When the edge is located in either one of the pixels G2 and G3 (S22: Yes, S44: Yes, S60: No, S67), the interpolation calculation unit 30 performs the third interpolation calculation B3 (details will be described later). ) To calculate the pixel value of the interpolation pixel P (S70). In addition, when an edge exists in any of two adjacent pixels G1, G2, G3, and G4 (S22: Yes, S44: Yes, S60: Yes, S65), the interpolation calculation unit 30 performs the first operation. The pixel value of the interpolated pixel P is calculated by performing the interpolation calculation B1 of the above, that is, the interpolation calculation by the bicubic method (S30). Here, if there is an edge between any two adjacent pixels G1, G2, G3, G4, that is, if three adjacent edges continue, each edge is not due to an edge in the subject. This is because there is a high possibility of gradation, and it can be determined that no edge exists between the pixels G2 and G3.

図15は、エッジ検出部10によるエッジ検出処理Aを示すフローチャートである。図示のように、設定された画素列(図18に示す画素列Φまたは画素列Φ1または画素列Φ2)に対して、エッジ検出部10のフィルタリング部12は、画素列に含まれる4つの画素に対して1次差分d1、d2、d3および2次差分d4、d5を算出する(S11)。また、フィルタリング部12は、画素列の中央に位置する2つの画素に対してもフィルタリング処理を施して差分d0(=d2)を算出する(S12)。そして、判定部14は、1次差分d1、d2、d3および2次差分d4、d5の正負の組合せに基づいて、中央に位置する2つの画素間にエッジが存在するか否かを判定する(第1の判定、S13)。ステップS13における第1の判定が肯定されると(S13:Yes)、判定部14は、差分d0の絶対値が所定の閾値Th1以上であるか否かを判定する(S14、第2の判定)。ステップS14における第2の判定が肯定されると(S14:Yes)、判定部14は、中央の2つの画素の間にエッジが存在すると判定する(S15)。一方、ステップS13における第1の判定が否定されると(S13:No)、およびステップS14における第2の判定が否定されると(S14:No)、判定部14は、中央の2つの画素間にエッジがないと判定する(S16)。   FIG. 15 is a flowchart showing edge detection processing A by the edge detection unit 10. As shown in the figure, the filtering unit 12 of the edge detection unit 10 applies the four pixels included in the pixel column to the set pixel column (the pixel column Φ or the pixel column Φ1 or the pixel column Φ2 shown in FIG. 18). On the other hand, primary differences d1, d2, d3 and secondary differences d4, d5 are calculated (S11). In addition, the filtering unit 12 performs a filtering process on the two pixels located in the center of the pixel row to calculate a difference d0 (= d2) (S12). Then, the determination unit 14 determines whether or not an edge exists between two pixels located at the center based on the positive / negative combination of the primary differences d1, d2, d3 and the secondary differences d4, d5 ( First determination, S13). If the first determination in step S13 is affirmed (S13: Yes), the determination unit 14 determines whether or not the absolute value of the difference d0 is equal to or greater than a predetermined threshold Th1 (S14, second determination). . If the second determination in step S14 is affirmed (S14: Yes), the determination unit 14 determines that an edge exists between the two central pixels (S15). On the other hand, if the first determination in step S13 is negative (S13: No) and the second determination in step S14 is negative (S14: No), the determination unit 14 determines whether the center two pixels Is determined to have no edge (S16).

図16は、第2の補間演算B2の処理を示すフローチャートである。図示のように、補間演算部30の境界設定部32は、補間画素Pが間に存在する2つの隣接する画素間に境界線または境界点を境界として設定する(S52)。判定部34は、補間画素Pが境界のいずれかの側にあるかを判定し(S54)、演算部36は、境界に対して、補間画素Pが存在する側と同じ側の画素のみを用いて補間演算を行って補間画素Pの画素値を得る(S56)。   FIG. 16 is a flowchart showing the processing of the second interpolation calculation B2. As illustrated, the boundary setting unit 32 of the interpolation calculation unit 30 sets a boundary line or boundary point as a boundary between two adjacent pixels with the interpolation pixel P existing therebetween (S52). The determination unit 34 determines whether the interpolation pixel P is on either side of the boundary (S54), and the calculation unit 36 uses only pixels on the same side as the side where the interpolation pixel P exists with respect to the boundary. Then, the interpolation calculation is performed to obtain the pixel value of the interpolation pixel P (S56).

図17は、第3の補間演算B3の処理を示すフローチャートである。図示のように、補間演算部30の境界設定部32は、エッジが位置する画素を通る垂直な線を境界として設定する(S72)。判定部34は、補間画素Pが境界のいずれかの側にあるかを判定し(S74)、演算部36は、境界に対して、補間画素Pが存在する側と同じ側の画素のみを用いて補間演算を行って補間画素Pの画素値を得る(S76)。   FIG. 17 is a flowchart showing the process of the third interpolation calculation B3. As illustrated, the boundary setting unit 32 of the interpolation calculation unit 30 sets a vertical line passing through the pixel where the edge is located as a boundary (S72). The determination unit 34 determines whether the interpolation pixel P is on either side of the boundary (S74), and the calculation unit 36 uses only pixels on the same side as the side where the interpolation pixel P exists with respect to the boundary. Then, the interpolation calculation is performed to obtain the pixel value of the interpolation pixel P (S76).

図14に戻り、制御部50は、設定された補間方向について全ての補間画素Pについて画素値を算出したか否かを判定し(S84)、ステップS84が否定されると、画素値を算出する補間画素Pを次の補間画素Pに設定し(S86)、ステップS3からの処理に戻る。   Returning to FIG. 14, the control unit 50 determines whether or not pixel values have been calculated for all the interpolation pixels P in the set interpolation direction (S <b> 84), and when step S <b> 84 is negative, calculates a pixel value. The interpolation pixel P is set to the next interpolation pixel P (S86), and the process returns to step S3.

一方、ステップS84が肯定されると、制御部50は、全ての補間画素の画素値の算出が終了した補間方向がx方向であるかy方向であるかを判定する(S90)。全ての補間画素の画素値の算出が終了した補間方向がx方向である場合(S90:No)、補間方向をy方向に設定し(S92)、ステップS3からの処理に戻る。一方、全ての補間画素の画素値の算出が終了した補間方向がY方向である場合(S90:Yes)、補間画素Pからなる拡大縮小された画像データS1を出力し(S94)、処理を終了する。   On the other hand, when step S84 is affirmed, the control unit 50 determines whether the interpolation direction in which the calculation of the pixel values of all the interpolation pixels is completed is the x direction or the y direction (S90). When the interpolation direction for which the calculation of the pixel values of all the interpolation pixels has been completed is the x direction (S90: No), the interpolation direction is set to the y direction (S92), and the process returns to step S3. On the other hand, when the interpolation direction in which the calculation of the pixel values of all the interpolation pixels has been completed is the Y direction (S90: Yes), the enlarged / reduced image data S1 composed of the interpolation pixels P is output (S94), and the processing ends. To do.

図19は本発明の第2の実施形態による画像拡大縮小装置の構成を示すブロック図である。図示のように、本実施形態による画像拡大縮小装置は、画像データS0および画像データS0の拡大縮小率Kの入力を受け付ける入力部101、画像中の画素間のエッジを検出するエッジ検出部110、エッジ併合部120、補間画素の画素値を算出する補間演算部130、並びに入力部101、エッジ検出部110、エッジ併合部120、および補間演算部130の動作を制御する制御部150を備える。以下各構成の詳細について説明する。   FIG. 19 is a block diagram showing a configuration of an image enlargement / reduction apparatus according to the second embodiment of the present invention. As illustrated, the image enlargement / reduction apparatus according to the present embodiment includes an input unit 101 that receives input of image data S0 and an enlargement / reduction rate K of the image data S0, an edge detection unit 110 that detects an edge between pixels in the image, The edge merging unit 120, the interpolation calculation unit 130 that calculates the pixel value of the interpolation pixel, and the control unit 150 that controls operations of the input unit 101, the edge detection unit 110, the edge merging unit 120, and the interpolation calculation unit 130 are provided. Details of each component will be described below.

図20に示すように、エッジ検出部110は、フィルタリング部112と、判定部114と、エッジパターン分類部116とを備えてなる。フィルタリング部112は、まず画像S0上に補間画素Pの近傍に位置する4×4の16画素(図21に示す16画素P(i,j)(i,j=−1〜2)。以下補間画素Pの16画素という)に対して、互いに隣接する2つの画素からなる各画素ペアに対して図5に示す差分フィルタによるフィルタリング処理を施して夫々の画素ペアの差分(以下隣接画素ペアの差分をdという)を算出する。なお、ここで互いに隣接する2つの画素とは、P(−1,0)とP(0,0)の2つの画素、またはP(−1,−1)とP(−1,0)の2つの画素のような、画素配列方向のx方向またはy方向において隣接する2つの画素に限らず、P(−1,−1)とP(0,0)の2つの画素や、P(0,1)とP(1,0)のような、2×2画素の対角線方向において隣接する2つの画素も含むものである。   As illustrated in FIG. 20, the edge detection unit 110 includes a filtering unit 112, a determination unit 114, and an edge pattern classification unit 116. The filtering unit 112 first has 4 × 4 16 pixels (16 pixels P (i, j) (i, j = −1 to 2 shown in FIG. 21)) located in the vicinity of the interpolation pixel P on the image S0. The pixel pair consisting of two adjacent pixels is subjected to a filtering process using the difference filter shown in FIG. 5 to each pixel pair (hereinafter referred to as the difference between adjacent pixel pairs). Is referred to as d). Here, the two pixels adjacent to each other are two pixels of P (-1, 0) and P (0, 0), or P (-1, -1) and P (-1, 0). Not only two pixels adjacent to each other in the x direction or y direction of the pixel arrangement direction, such as two pixels, but two pixels of P (-1, -1) and P (0, 0), and P (0 , 1) and P (1, 0) also include two pixels adjacent in the diagonal direction of 2 × 2 pixels.

判定部114は、各画素ペアの差分dの絶対値が所定の閾値Th以上であるか否かの判定を行い、この判定が肯定されると、該差分が対応する画素ペアの2つの画素の間にエッジが存在すると判定し、判定結果をエッジパターン分類部116に出力する。   The determination unit 114 determines whether or not the absolute value of the difference d of each pixel pair is greater than or equal to a predetermined threshold Th, and when this determination is affirmative, the determination unit 114 determines whether the two pixels of the pixel pair corresponding to the difference correspond to each other. It is determined that there is an edge between them, and the determination result is output to the edge pattern classification unit 116.

エッジパターン分類部116は、判定部114から出力されてきた判定結果に基づいて、各2×2の4つの画素から構成されるブロック内のエッジパターンを分類する。ここで、まず、画素P(0,0)、P(1,0)、P(1,1)、P(0,1)の4つの画素から構成されるブロックについて説明する。図22に示すように、エッジパターン分類部116は、エッジが存在する画素間の中点を結ぶ直線に応じてエッジパターンを分類する。図23から図25は、エッジが存在する位置に応じたエッジパターンを示す図である。図23から図25に示すように、エッジが存在する位置に応じてエッジパターンはパターン0〜パターン8の9種類のパターンに分類される。   Based on the determination result output from the determination unit 114, the edge pattern classification unit 116 classifies the edge patterns in the block composed of four 2 × 2 pixels. Here, a block composed of four pixels P (0, 0), P (1, 0), P (1, 1), and P (0, 1) will be described first. As shown in FIG. 22, the edge pattern classification unit 116 classifies the edge pattern according to a straight line connecting the midpoints between pixels in which edges exist. 23 to 25 are diagrams showing edge patterns according to positions where edges exist. As shown in FIGS. 23 to 25, the edge patterns are classified into nine types of patterns 0 to 8 according to the position where the edge exists.

なお、間e1,e2,e3,e4にエッジが存在する場合、および間e1,e2,e3,e4,e5,e6にエッジが存在する場合は、エッジパターンはパターン7であるのかパターン8であるのかが分からない。このため、エッジパターン分類部116は、間e1,e2,e3,e4にエッジが存在する場合、および間e1,e2,e3,e4,e5,e6にエッジが存在する場合には、さらに画素P(0,0)と画素P(1,1)の画素値の差分の絶対値(|d11|とする)および画素(0,1)と画素(1,0)の画素値の差分の絶対値(|d12|とする)を算出し、|d11|<|d12|の場合にはエッジパターンをパターン7に分類し、|d11|≧|d12|の場合にはエッジパターンをパターン8に分類する。   When edges exist between the spaces e1, e2, e3, e4, and when edges exist between the spaces e1, e2, e3, e4, e5, e6, the edge pattern is the pattern 7 or the pattern 8 I do n’t know. For this reason, the edge pattern classification unit 116 further increases the pixel P when there are edges in the intervals e1, e2, e3, e4 and when there are edges in the intervals e1, e2, e3, e4, e5, e6. The absolute value of the difference between the pixel values of (0, 0) and the pixel P (1, 1) (referred to as | d11 |) and the absolute value of the difference between the pixel values of the pixel (0, 1) and the pixel (1, 0) (If | d11 | <| d12 |), the edge pattern is classified into the pattern 7, and if | d11 | ≧ | d12 |, the edge pattern is classified into the pattern 8. .

エッジパターン分類部116は、このようなエッジパターンを分類する処理を各2×2画素のブロックに対して行い、その分類処理の結果をエッジ併合部120に出力する。   The edge pattern classification unit 116 performs processing for classifying such edge patterns on each 2 × 2 pixel block, and outputs the result of the classification processing to the edge merging unit 120.

図26と図27は、エッジパターン分類部116により得られた4×4の16画素内のエッジパターンの例を示すものである。図26の例では、補間画素Pに隣接する4つの画素内のエッジパターンがパターン4、4つの画素P(−1,−1)、P(0,−1)、P(0,0)、P(−1,0)内のエッジパターンがパターン0、4つの画素P(0,−1)、P(1,−1)、P(1,0)、P(0,0)内のエッジパターンがパターン5、4つの画素P(1,−1)、P(2,−1)、P(2,0)、P(1,0)内のエッジパターンがパターン0、4つの画素P(−1,0)、P(0,0)、P(0,1)、P(−1,1)内のエッジパターンがパターン2、4つの画素P(1,0)、P(2,0)、P(2,1)、P(1,1)内のエッジパターンがパターン0、4つの画素P(−1,1)、P(0,1)、P(0,2)、P(−1,2)内のエッジパターンがパターン4、4つの画素P(0,1)、P(1,1)、P(1,2)、P(0,2)内のエッジパターンがパターン0、および4つの画素P(1,1)、P(2,1)、P(2,2)、P(1,2)内のエッジパターンがパターン0である。なお、図26に示すように補間画素Pの16画素内の領域はエッジ(図中点線)により2つの領域A1,A2に分割される。ここで、領域A2を斜線で示す。   FIGS. 26 and 27 show examples of edge patterns in 4 × 4 16 pixels obtained by the edge pattern classification unit 116. In the example of FIG. 26, the edge pattern in the four pixels adjacent to the interpolation pixel P is pattern 4, four pixels P (-1, -1), P (0, -1), P (0, 0), Edge pattern in P (-1, 0) is pattern 0, edge in four pixels P (0, -1), P (1, -1), P (1,0), P (0, 0) The pattern is pattern 5, the four pixels P (1, -1), P (2, -1), P (2,0), and the edge pattern in P (1,0) are pattern 0, four pixels P ( -1,0), P (0,0), P (0,1), and P (-1,1) have an edge pattern of pattern 2, four pixels P (1,0), P (2,0 ), P (2,1), P (1,1) has an edge pattern of pattern 0, four pixels P (-1,1), P (0,1), P (0,2), P ( -1, 2) The edge pattern in Turn 4, an edge pattern in four pixels P (0,1), P (1,1), P (1,2), P (0,2) is pattern 0, and four pixels P (1,1 ), P (2,1), P (2,2), and the edge pattern in P (1,2) is pattern 0. In addition, as shown in FIG. 26, the area | region in 16 pixels of the interpolation pixel P is divided | segmented into two area | region A1, A2 by the edge (dotted line in a figure). Here, the region A2 is indicated by oblique lines.

また、図27の例では、補間画素Pの16画素内において、エッジパターンが連続した2本のエッジ(図中点線により示されるエッジI1、エッジI2)を示すものとなっている。   In the example of FIG. 27, two edges (edges I1 and I2 indicated by a dotted line in the figure) in which edge patterns are continuous in 16 pixels of the interpolation pixel P are shown.

エッジ併合部120は、エッジパターン分類部116から出力されてきた結果に基づいて、まず、直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいてもエッジが存在するとき、この3つの画素の画素値を比較し、3つの画素が並ぶ方向において画素値が単調増加または単調減少し、かつこの2つのエッジが同じ方向に延びるエッジである場合において、2つのエッジを中央画素の位置において併合する。図28は、エッジ併合部120により、隣接するエッジを併合する処理を説明するための図である。なお、図28において、各隣接エッジが対応する3つの画素の画素値は、画素が並ぶ方向に沿って単調増加または単調減少する関係を満たしたものとする。図28(a)に示すように、画素G1aとG2aの間、画素G2aとG3aの間にエッジが検出されおり、かつ夫々のエッジが延びる方向が同様であるため、エッジが画素G2aの位置において併合される。また、画素G4aとG5aの間のエッジ、画素G4aとG5aの間のエッジも同じ方向に延びるものであるため、図28(a)の右部に示すように、2本のエッジI1a、I2b(図中点線)が、画素G2aとG5aとを接続してなる線(図中太線)と重なる1本のエッジJaに併合される。同様に、図28(b)に示すように、エッジI1b、I2bが1本のエッジJbに併合される。また、図28(c)に示すように、対角点の画素を接点にして隣接する2つの画素ブロックにおいて、接点となる対角点の画素G2cと、画素G2cと隣接する各画素(G1c、G3c、G4c、G5c)との間にもエッジが存在し、かつ各エッジが同じ方向に延びるため、G5c、G2c間のエッジと、画素G2c、G3c間のエッジとが画素G2cの位置において併合され、画素G1c、G2c間のエッジと、画素G2c、G4c間のエッジとが画素G2cの位置において併合されるため、図28(c)において左部にある2本のエッジI1c、I2cが同図右部に示すように、1つのエッジ点Jc(画素G2cの位置)になる。また、図28(d)に示すように、画素G1d、G2d間のエッジと、画素G2d、G3d間のエッジとが画素G2cの位置に、画素G3d、G4d間のエッジと画素G4d、G5d間のエッジとが画素G4dの位置に夫々併合されることによって、同じ方向に延びる2本のエッジI1d、I2dの、画素G2d、G3d、G4d、G6d画素ブロック内の部分が、図28(d)右部に示すようにブロックの対角点に位置する画素G2dとG4dを接続してなる1本のエッジJdとなる。   Based on the result output from the edge pattern classifying unit 116, the edge merging unit 120 first detects this when there is an edge between any two adjacent pixels of three pixels adjacent in series. The pixel values of the three pixels are compared, and when the pixel value monotonously increases or decreases monotonously in the direction in which the three pixels are arranged and the two edges are edges extending in the same direction, the two edges are Merge in position. FIG. 28 is a diagram for explaining a process of merging adjacent edges by the edge merging unit 120. In FIG. 28, it is assumed that the pixel values of three pixels corresponding to each adjacent edge satisfy the relationship of monotonically increasing or monotonously decreasing along the direction in which the pixels are arranged. As shown in FIG. 28 (a), edges are detected between the pixels G1a and G2a, between the pixels G2a and G3a, and the directions in which the respective edges extend are the same. Merged. Further, since the edge between the pixels G4a and G5a and the edge between the pixels G4a and G5a also extend in the same direction, as shown in the right part of FIG. 28A, two edges I1a and I2b ( A dotted line in the figure is merged with one edge Ja that overlaps a line (thick line in the figure) connecting pixels G2a and G5a. Similarly, as shown in FIG. 28B, the edges I1b and I2b are merged into one edge Jb. Further, as shown in FIG. 28C, in two adjacent pixel blocks with the diagonal pixel serving as a contact, the diagonal pixel G2c serving as the contact and each pixel (G1c, G3c, G4c, G5c) also have edges, and each edge extends in the same direction, so the edge between G5c and G2c and the edge between pixels G2c and G3c are merged at the position of pixel G2c Since the edge between the pixels G1c and G2c and the edge between the pixels G2c and G4c are merged at the position of the pixel G2c, the two edges I1c and I2c on the left in FIG. As shown in the figure, it becomes one edge point Jc (position of the pixel G2c). As shown in FIG. 28 (d), the edge between the pixels G1d and G2d and the edge between the pixels G2d and G3d are at the position of the pixel G2c, and the edge between the pixels G3d and G4d and between the pixels G4d and G5d By merging the edges with the position of the pixel G4d, the two edges I1d and I2d extending in the same direction in the pixel G2d, G3d, G4d, and G6d pixel blocks are shown in the right part of FIG. As shown in FIG. 4, one edge Jd is formed by connecting pixels G2d and G4d located at diagonal points of the block.

エッジ併合部120は、図28に示す併合処理を、該当する隣接エッジに対して行い、その結果を補間演算部130に出力する。図27に示すエッジパターンの例において、2本のエッジI1、I2は、エッジ併合部120によって、図中太線により示される1本のエッジIに併合されることとなる。ない、エッジIによって、図27に示すように補間画素Pの16画素内の領域はエッジI(図中太線)により2つの領域に分割され、ここでは、エッジIの両側の領域も夫々領域A1,A2とし、領域A2を斜線で示す。   The edge merging unit 120 performs the merging process shown in FIG. 28 on the corresponding adjacent edge, and outputs the result to the interpolation calculation unit 130. In the example of the edge pattern shown in FIG. 27, two edges I1 and I2 are merged into one edge I indicated by a thick line in the figure by the edge merging unit 120. 27, the area within 16 pixels of the interpolation pixel P is divided into two areas by the edge I (thick line in the figure) as shown in FIG. 27. Here, the areas on both sides of the edge I are also areas A1. , A2 and the area A2 is indicated by hatching.

なお、図26に示すエッジパターンの例の場合においては、併合する対象となるエッジがなく、エッジ併合部120は、エッジパターン分類部116からの出力結果をそのまま補間演算部130に出力する。図27の例の場合においては、補間画素Pの16画素内のエッジを併合して得た結果を補間演算部130に出力する。   In the case of the edge pattern example shown in FIG. 26, there is no edge to be merged, and the edge merging unit 120 outputs the output result from the edge pattern classification unit 116 to the interpolation calculation unit 130 as it is. In the case of the example of FIG. 27, the result obtained by merging the edges in 16 pixels of the interpolation pixel P is output to the interpolation calculation unit 130.

補間演算部130は、エッジ併合部120から出力されてきた、補間画素Pの16画素内のエッジを示す結果に基づいて、補間画素Pの画素値を算出する。具体的には、補間画素Pを囲む16画素内にエッジが存在しない場合、バイキュービック法を用いて補間画素Pの画素値を算出する。バイキュービック法による補間演算は、図1に示す実施形態の補間演算部30により行われる第1の補間演算と同様であるので、ここでその詳細な説明について省略する。なお、以下の本実施形態の説明においても、補間画素Pの16画素内にエッジが存在しない場合、バイキュービック法を用いて補間画素Pの画素値を算出する演算を本実施形態における第1の補間演算という。   The interpolation calculation unit 130 calculates the pixel value of the interpolation pixel P based on the result indicating the edges in 16 pixels of the interpolation pixel P output from the edge merging unit 120. Specifically, when there is no edge in 16 pixels surrounding the interpolation pixel P, the pixel value of the interpolation pixel P is calculated using the bicubic method. Interpolation calculation by the bicubic method is the same as the first interpolation calculation performed by the interpolation calculation unit 30 of the embodiment shown in FIG. 1, and thus detailed description thereof is omitted here. In the following description of the present embodiment, when there is no edge in 16 pixels of the interpolation pixel P, the calculation for calculating the pixel value of the interpolation pixel P using the bicubic method is performed in the first embodiment. This is called interpolation calculation.

一方、補間画素Pの16画素内にエッジが存在する場合には、補間演算部130は、第2の補間演算により補間画素Pの画素値を算出する。ここで、図26の例を参照して補間演算部の第2の補間演算について具体的に説明する。また、説明しやすいように、図26における画素P(−1,−1)、P(−1,0)、P(−1,1)、P(0,0)、P(0,−1)を夫々P14、P11、P13、P12、P15の符号に置き換えて説明するる。図26に示すように、補間画素Pを囲む16画素内の領域はエッジにより2つの領域A1,A2に分割される。領域A2は斜線により示される。補間演算部130は、まず、16画素内のエッジパターンに基づいて、補間画素Pがエッジを挟んでいずれの側に存在するかによって、補間演算に使用する画素を決定する。例えば、図26に示すように補間画素Pが領域A1側に存在する場合には、領域A1側の画素P11,P12,P13,P14,P15が補間演算に使用される画素として決定される。逆に補間画素が領域A2側に存在する場合には、領域A2側の画素を補間演算に使用する画素として決定する。   On the other hand, when an edge exists in 16 pixels of the interpolation pixel P, the interpolation calculation unit 130 calculates the pixel value of the interpolation pixel P by the second interpolation calculation. Here, the second interpolation calculation of the interpolation calculation unit will be specifically described with reference to the example of FIG. For ease of explanation, the pixels P (-1, -1), P (-1, 0), P (-1, 1), P (0, 0), P (0, -1) in FIG. ) Will be described with reference to P14, P11, P13, P12, and P15, respectively. As shown in FIG. 26, the area within 16 pixels surrounding the interpolation pixel P is divided into two areas A1 and A2 by edges. Region A2 is indicated by hatching. The interpolation calculation unit 130 first determines a pixel to be used for the interpolation calculation depending on which side the interpolation pixel P is located across the edge based on the edge pattern in the 16 pixels. For example, as shown in FIG. 26, when the interpolation pixel P exists on the region A1 side, the pixels P11, P12, P13, P14, and P15 on the region A1 side are determined as pixels used for the interpolation calculation. Conversely, when an interpolation pixel exists on the region A2 side, the pixel on the region A2 side is determined as a pixel used for the interpolation calculation.

次に補間演算部130は、決定された画素のうち、補間画素Pに近い位置の画素ほど重みを大きくするようにして補間画素Pの画素値を求める補間演算を行う。具体的には、画素P12の重みW12を最も大きくするように、各画素P11〜P15に対する重みW11〜W15を設定し、各画素P11〜P15の画素値Pt11〜Pt15に対して下記の式(6)に示す演算を施すことにより、補間画素Pの画素値(ここではPtとする)を算出する。

Figure 0004133746
Next, the interpolation calculation unit 130 performs an interpolation calculation to obtain a pixel value of the interpolation pixel P by increasing the weight of the determined pixel closer to the interpolation pixel P. Specifically, the weights W11 to W15 for the pixels P11 to P15 are set so as to maximize the weight W12 of the pixel P12, and the following formula (6) is set for the pixel values Pt11 to Pt15 of the pixels P11 to P15. The pixel value of the interpolation pixel P (here, Pt) is calculated by performing the calculation shown in FIG.
Figure 0004133746

なお、補間画素Pの画素値を算出する際に、決定されたすべての画素を用いなくてもよく、算出方法としてもこれに限定されるものではない。例えば、ここで、図1に示す実施形態における補間演算部30による第2の補間演算(図12(a)参照)を2次元に適用することにより、補間画素Pの画素値を求めるようにしてもよい。具体的には、図29に示すように、画素位置をx座標およびy座標、画素値をz座標とする3次元空間において、領域A1側における画素P11,P12,P13(図28参照)の画素値Pt11,Pt12,Pt13を通る平面A10を設定する。なお、平面A10において辺A12,A13はエッジの位置に対応する。そして、平面A10上における補間画素Pのx座標およびy座標に対応するz座標の値を、補間画素Pの画素値として求めるようにすればよい。   Note that when calculating the pixel value of the interpolation pixel P, it is not necessary to use all the determined pixels, and the calculation method is not limited to this. For example, the pixel value of the interpolation pixel P is obtained by applying the second interpolation calculation (see FIG. 12A) by the interpolation calculation unit 30 in the embodiment shown in FIG. Also good. Specifically, as shown in FIG. 29, the pixels P11, P12, and P13 (see FIG. 28) on the region A1 side in the three-dimensional space in which the pixel position is the x coordinate and the y coordinate and the pixel value is the z coordinate. A plane A10 passing through the values Pt11, Pt12, Pt13 is set. In the plane A10, the sides A12 and A13 correspond to the positions of the edges. Then, the value of the z coordinate corresponding to the x coordinate and the y coordinate of the interpolation pixel P on the plane A10 may be obtained as the pixel value of the interpolation pixel P.

図27に示す例の場合においても同様に、図中領域A1に位置する補間画素Pに対して、同じ領域A1に位置する画素P(−1,−1)、P(0,−1)、P(1、−1)、P(2,−1)、P(−1,0)、P(−1,1)、P(−1,2)、P(0,0)が補間画素Pの画素値を求める補間演算に使用される画素として決定され、それらの画素値による補間演算が行われ、補間画素Pの画素値が得られる。   Similarly, in the case of the example shown in FIG. 27, the pixels P (−1, −1), P (0, −1), P (0, −1), P (1, -1), P (2, -1), P (-1, 0), P (-1, 1), P (-1, 2), P (0, 0) are interpolated pixels P The pixel value is determined as the pixel used for the interpolation calculation for obtaining the pixel value, and the interpolation calculation based on these pixel values is performed to obtain the pixel value of the interpolation pixel P.

ここでの説明から分かるように、エッジ併合部120による併合処理が施さなければ、2本のエッジI1、I2の間に挟まれた補間画素Pの画素値を求める際に、使用可能な画素が同じくエッジI1、I2の間に挟まれた画素P(2,0)、P(1,0)、P(0,1)、P(0,2)しかなく、これらの画素が中間値画素であるため、補間演算に使用する画素から除去すると、補間画素Pの画素値を求めることができない。エッジ併合部120のよる併合処理によって、中間値画素P(2,0)、P(1,0)、P(0,1)、P(0,2)を使うことを避けることができると共に、補間画素Pの画素値を求めることができる。   As can be seen from the description here, when the merging process by the edge merging unit 120 is not performed, when the pixel value of the interpolated pixel P sandwiched between the two edges I1 and I2 is obtained, Similarly, there are only pixels P (2,0), P (1,0), P (0,1), and P (0,2) sandwiched between the edges I1 and I2, and these pixels are intermediate value pixels. Therefore, if it is removed from the pixels used for the interpolation calculation, the pixel value of the interpolation pixel P cannot be obtained. The merging process by the edge merging unit 120 can avoid using the intermediate value pixels P (2,0), P (1,0), P (0,1), P (0,2), and The pixel value of the interpolation pixel P can be obtained.

また、エッジ併合部120は、直列に隣接する3つの画素の隣接する2つの画素の画素間のいずれにおいてもエッジが存在するとき、この3つの画素の画素値を比較し、3つの画素が並ぶ方向において画素値が単調増加または単調減少し、かつこの2つのエッジが同じ方向に延びるエッジである場合においてのみ、併合を行うものである。例えば、図27に示す例において、各々の3つの画素の画素値が画素の並ぶ方向に沿って単調増加または単調減少する関係にない場合、エッジ併合部120は、併合処理を行わずにエッジI1、I2のまま補間演算部130に出力する。補間演算部130は、2本のエッジの間に位置する補間画素Pの画素値を、同じくエッジI1、I2の間に挟まれた画素P(2,0)、P(1,0)、P(0,1)、P(0,2)の画素値による補間演算を行って得ることができる。この場合、画素P(2,0)、P(1,0)、P(0,1)、P(0,2)が中間値画素ではなく、被写体中の細い線を示す画素となる可能性が高いので、これらの画素の画素値を用いて補間画素Pの画素値を求めることによって、拡大縮小された画像に、被写体にあった細い線が消えてしまう問題を防ぐことができる。   The edge merging unit 120 compares the pixel values of the three pixels when there is an edge between any two adjacent pixels of the three pixels adjacent in series, and the three pixels are arranged. Merging is performed only when the pixel value monotonously increases or decreases monotonously in the direction and the two edges are edges extending in the same direction. For example, in the example shown in FIG. 27, when the pixel values of each of the three pixels are not in a monotonically increasing or monotonic decreasing relationship along the pixel arrangement direction, the edge merging unit 120 performs the edge I1 without performing the merging process. , I2 is output to the interpolation calculation unit 130. The interpolation calculation unit 130 converts the pixel value of the interpolation pixel P located between the two edges into pixels P (2,0), P (1,0), P, which are also sandwiched between the edges I1 and I2. It can be obtained by performing an interpolation operation with pixel values of (0, 1) and P (0, 2). In this case, there is a possibility that the pixels P (2, 0), P (1, 0), P (0, 1), and P (0, 2) are not intermediate value pixels but pixels indicating a thin line in the subject. Therefore, by obtaining the pixel value of the interpolation pixel P using the pixel values of these pixels, it is possible to prevent the problem that the thin line that matches the subject disappears in the enlarged / reduced image.

以下の説明において、補間画素Pの16画素内にエッジが存在する場合、補間演算部130により行われる補間演算を本実施形態における第2の補間演算とする。   In the following description, when an edge exists in 16 pixels of the interpolation pixel P, the interpolation calculation performed by the interpolation calculation unit 130 is set as the second interpolation calculation in the present embodiment.

図30は、本実施形態の画像拡大縮小装置において行われる処理を示すフローチャートである。なお、本実施形態においては、補間画素Pは、画像S0の画素の間に存在するものとする。まず、入力部101は画像データS0および画像データS0の拡大縮小率Kの入力を受け付ける(S101)。そして、フィルタリング部112は、拡大縮小率Kに応じた最初の補間画素P(例えば拡大縮小された画像データS1により表される画像上の左上に位置する画素)の近傍に位置する4×4の16画素(補間画素Pの16画素)について、隣接する2つの画素からなる画素ペアに対して差分フィルタによるフィルタリング処理を施して夫々の画素ペアの差分を算出する(S110)。   FIG. 30 is a flowchart showing processing performed in the image enlargement / reduction apparatus of this embodiment. In the present embodiment, it is assumed that the interpolation pixel P exists between the pixels of the image S0. First, the input unit 101 receives input of the image data S0 and the enlargement / reduction ratio K of the image data S0 (S101). Then, the filtering unit 112 is a 4 × 4 pixel located in the vicinity of the first interpolation pixel P (for example, the pixel located at the upper left on the image represented by the enlarged / reduced image data S1) according to the enlargement / reduction ratio K. With respect to 16 pixels (16 pixels of the interpolation pixel P), a filtering process using a difference filter is performed on a pixel pair including two adjacent pixels to calculate a difference between the respective pixel pairs (S110).

次いで、判定部114は、各画素ペアの差分の絶対値が所定の閾値Th以上でるか否かに基づいて、各画素ペアの2つの画素の間にエッジが存在するか否かの判定を行う(S115)。具体的には、画素ペアの差分の絶対値が閾値Th以上であれば、この画素ペアの2つの画素の間にエッジが存在すると判定する一方、画素ペアの差分の絶対値が閾値Thより小さければ、この画素ペアの2つの画素の間にエッジが存在しないと判定する。   Next, the determination unit 114 determines whether or not an edge exists between two pixels of each pixel pair based on whether or not the absolute value of the difference between each pixel pair is equal to or greater than a predetermined threshold Th. (S115). Specifically, if the absolute value of the pixel pair difference is equal to or greater than the threshold Th, it is determined that an edge exists between the two pixels of the pixel pair, while the absolute value of the pixel pair difference is smaller than the threshold Th. For example, it is determined that no edge exists between the two pixels of the pixel pair.

エッジパターン分類部116は、判定部114からの判定結果に基づいて、各2×2画素内におけるエッジのパターンを分類して、その結果をエッジ併合部120に出力する(S135)。エッジ併合部120は、補間画素Pの16画素内のエッジに対して併合処理(エッジ併合処理Cとし、その詳細については後述する)を行って、その結果を補間演算部130に出力する(S140)。補間演算部130は、エッジ併合部120から出力されてきた結果に基づいて、この16画素内にエッジがない場合(S165:No)には、第1の補間演算D1、すなわちバイキュービック補間法による補間演算を行って補間画素Pの画素値を求める(S168)。一方、補間画素Pの16画素内にエッジがある場合(S165:Yes)には、第2の補間演算D2を行って補間画素Pの画素値を求める(S170)。   The edge pattern classification unit 116 classifies the edge pattern in each 2 × 2 pixel based on the determination result from the determination unit 114, and outputs the result to the edge merging unit 120 (S135). The edge merging unit 120 performs a merging process (edge merging process C, the details of which will be described later) on the edges within 16 pixels of the interpolation pixel P, and outputs the result to the interpolation calculation unit 130 (S140). ). Based on the result output from the edge merging unit 120, the interpolation calculation unit 130 uses the first interpolation calculation D1, that is, the bicubic interpolation method when there is no edge in these 16 pixels (S165: No). Interpolation calculation is performed to determine the pixel value of the interpolation pixel P (S168). On the other hand, when there are edges in 16 pixels of the interpolation pixel P (S165: Yes), the second interpolation calculation D2 is performed to obtain the pixel value of the interpolation pixel P (S170).

制御部150は、画像S0に対して全ての補間画素Pについて画素値を算出したか否かを判定し(S175)、ステップS175が否定されると、画素値を算出する補間画素Pを次の補間画素Pに設定し(S180)、ステップS110からの処理に戻る。一方、ステップS180が肯定されると、制御部150は、補間画素Pからなる拡大縮小された画像データS1を出力し(S190)、処理を終了する。   The control unit 150 determines whether or not pixel values have been calculated for all the interpolation pixels P with respect to the image S0 (S175), and when step S175 is negative, the interpolation pixel P for calculating the pixel value is determined as the next interpolation pixel P. The interpolation pixel P is set (S180), and the process returns to step S110. On the other hand, when step S180 is affirmed, the control unit 150 outputs the enlarged / reduced image data S1 including the interpolation pixel P (S190), and ends the process.

図31は、ステップS140において行われるエッジ併合部120により行われるエッジ併合処理Cの詳細を示すフローチャートである。図示のように、エッジ併合部120は、補間画素Pを囲む4×4の16画素内に、直列に隣接する3つの画素からなり、互いに隣接する2つの画素間のいずれにおいてもエッジが存在する画素組の有無を確認し、このような画素組があれば(S141:Yes)、画素組内の2つのエッジ(隣接エッジ)が、同じ方向に延びるものであり、かつ画素組内の3つの画素の画素値が画素の並ぶ方向に沿って単調増加または単調減少する場合(S142:Yes、S143、S144:Yes)において、この2つのエッジを対応する画素組の中央画素の位置において併合する(S145)一方、他の場合(S142:NoまたはS142:Yes、S143、S144:No)においては、この2つのエッジを併合しない(S146)。   FIG. 31 is a flowchart showing details of the edge merging process C performed by the edge merging unit 120 performed in step S140. As shown in the figure, the edge merging unit 120 includes three pixels adjacent in series within the 4 × 4 16 pixels surrounding the interpolation pixel P, and an edge exists between any two adjacent pixels. If there is such a pixel set (S141: Yes), two edges (adjacent edges) in the pixel set extend in the same direction, and there are three in the pixel set. When the pixel value of the pixel monotonously increases or decreases monotonously along the pixel arrangement direction (S142: Yes, S143, S144: Yes), the two edges are merged at the position of the center pixel of the corresponding pixel set ( On the other hand, in the other cases (S142: No or S142: Yes, S143, S144: No), these two edges are not merged (S146).

エッジ併合部120は、補間画素Pの16画素内の全ての隣接エッジに対してステップS142〜S145までの処理を行って(S147:Yes、S142〜S145、S147:No)得た補間画素Pの16画素内のエッジを示す情報を補間演算部130に出力して(S150)、処理を終了する。   The edge merging unit 120 performs the processing from step S142 to S145 on all the adjacent edges in the 16 pixels of the interpolation pixel P (S147: Yes, S142 to S145, S147: No), and the interpolation pixel P obtained. Information indicating edges within 16 pixels is output to the interpolation calculation unit 130 (S150), and the process is terminated.

一方、ステップS141において、補間画素Pの16画素内に隣接エッジがないと判別された場合(S141:No)、エッジ併合部120は、エッジパターン分類部116から出力されてきたエッジパターンをそのまま補間演算部116に出力して(S150)、処理を終了する。   On the other hand, when it is determined in step S141 that there are no adjacent edges in 16 interpolation pixels P (S141: No), the edge merging unit 120 directly interpolates the edge pattern output from the edge pattern classification unit 116. It outputs to the calculating part 116 (S150), and complete | finishes a process.

図32は、補間画素Pの16画素内にエッジがある場合に、補間演算部130により行われる第2の補間演算D2の詳細を示すフローチャートである。図示のように、補間演算部130は、16画素の領域内において、補間画素Pがエッジを挟んでいずれの側に存在するかを判定する(S171)。そして、エッジに対して補間画素Pと同じ側に位置する画素を補間演算に使用する参照画素として選出する(S172)。次に補間演算部130は、参照画素の画素値による補間演算を行って補間画素Pの画素値を求める(S173)。   FIG. 32 is a flowchart showing details of the second interpolation calculation D2 performed by the interpolation calculation unit 130 when there are edges in 16 pixels of the interpolation pixel P. As shown in the figure, the interpolation calculation unit 130 determines on which side the interpolation pixel P is present across the edge in the 16-pixel region (S171). Then, a pixel located on the same side as the interpolation pixel P with respect to the edge is selected as a reference pixel used for the interpolation calculation (S172). Next, the interpolation calculation unit 130 performs an interpolation calculation based on the pixel value of the reference pixel to obtain the pixel value of the interpolation pixel P (S173).

以上、本発明の望ましい実施形態について説明したが、本発明の補間画素値算出方法および装置並びにそのためのプログラムは、上述した実施形態に限られることがなく、本発明の主旨を逸脱しない限り、上述した各実施形態の構成を組み合わせたり、増減、変化を加えたりすることができる。 Having described preferred embodiments of the present invention, a program of the interpolated pixel value calculation method Oyo BiSo location and therefore the present invention is not be limited to the embodiments described above, without departing from the gist of the present invention As long as the configurations of the above-described embodiments can be combined, increase / decrease, and change can be added.

例えば、上述した実施形態において、直列に隣接する3つの画素の互いに隣接する2つの画素間において夫々検出されたエッジ(隣接エッジ)を、この3つの画素の中央画素の位置において併合するようにしているが、このような3つの画素の中央画素の位置に限らず、中央画素付近のいかなる位置でもよい。なお、この場合、エッジを併合する位置を、中央画素付近の範囲において任意に決めてもいが、例えば、中央画素付近の範囲内であって、中央画素との画素値の差分が小さい画素よりも、中央画素との画素値の差分が大きい方の画素に近い位置にするようにしてもよい。   For example, in the above-described embodiment, the edges (adjacent edges) detected between two adjacent pixels of three pixels adjacent in series are merged at the position of the center pixel of the three pixels. However, the position is not limited to the position of the center pixel of the three pixels, and may be any position near the center pixel. In this case, the position where the edges are merged may be arbitrarily determined in the range near the center pixel. For example, the position where the edge is merged is smaller than a pixel within the range near the center pixel and having a smaller pixel value difference from the center pixel. Alternatively, a position closer to the pixel having the larger pixel value difference from the central pixel may be used.

例えば、画素間にエッジが存在するか否かを検出する方法は、上述した実施形態に用いられた方法に限られるものではなく、従来技術の説明において例挙した方法などを用いてもよい。   For example, the method for detecting whether or not there is an edge between pixels is not limited to the method used in the above-described embodiment, and the method exemplified in the description of the prior art may be used.

また、補間演算の方法も、上述した実施形態に用いられたバイキュービック補間演算、補間画素との距離に応じた重付加算に限られるものではなく、ガウシアンフィルタなどの他の補間演算方法を用いてもよい。   Further, the interpolation calculation method is not limited to the bicubic interpolation calculation used in the above-described embodiment and the weighted addition according to the distance from the interpolation pixel, and other interpolation calculation methods such as a Gaussian filter are used. May be.

本発明の第1の実施形態による画像拡大縮小装置の構成を示すブロック図1 is a block diagram showing a configuration of an image enlargement / reduction apparatus according to a first embodiment of the present invention. 画像データにより表される画像の画素配列を示す図The figure which shows the pixel arrangement | sequence of the image represented by image data 図1に示す画像拡大縮小装置のエッジ検出部10の構成を示すブロック図The block diagram which shows the structure of the edge detection part 10 of the image expansion / contraction apparatus shown in FIG. 隣接画素間にエッジが存在するか否かを検出する方法の1例を説明するための図The figure for demonstrating an example of the method of detecting whether an edge exists between adjacent pixels. 差分フィルタの例を示す図The figure which shows the example of difference filter 1次差分d1,d2,d3および2次差分d4,d5の正負と、直列に隣接する4つの画素のプロファイル形状との関係を示す表(その1)Table showing the relationship between the positive and negative of primary differences d1, d2, d3 and secondary differences d4, d5 and the profile shapes of four pixels adjacent in series (part 1) 1次差分d1,d2,d3および2次差分d4,d5の正負と、直列に隣接する4つの画素のプロファイル形状との関係を示す表(その2)Table showing the relationship between the positive and negative of primary differences d1, d2, d3 and secondary differences d4, d5 and the profile shapes of four pixels adjacent in series (part 2) 1次差分d1,d2,d3および2次差分d4,d5の正負と、直列に隣接する4つの画素のプロファイル形状との関係を示す表(その3)Table showing the relationship between the positive and negative of primary differences d1, d2, d3 and secondary differences d4, d5 and the profile shapes of four pixels adjacent in series (part 3) 隣接する2つの画素の画素値の差が非常にわずかであるのにエッジと判定されるプロファイル形状の例を示す図The figure which shows the example of the profile shape determined as an edge, although the difference of the pixel value of two adjacent pixels is very slight 図1に示す画像拡大縮小装置の補間演算部30の構成を示すブロック図The block diagram which shows the structure of the interpolation calculating part 30 of the image expansion / contraction apparatus shown in FIG. バイキュービック法を説明するための図Illustration for explaining the bicubic method エッジであると判定された部分についての補間画素の画素値の算出を説明するための図(第2の補間演算B2)The figure for demonstrating calculation of the pixel value of the interpolation pixel about the part determined to be an edge (2nd interpolation calculation B2) エッジであると判定された部分についての補間画素の画素値の算出を説明するための図(第3の補間演算B3)The figure for demonstrating calculation of the pixel value of the interpolation pixel about the part determined to be an edge (3rd interpolation calculation B3) 本実施形態において行われる処理を示すフローチャートA flowchart showing processing performed in the present embodiment エッジ検出処理AのフローチャートFlow chart of edge detection processing A 第2の補間演算B2のフローチャートFlow chart of second interpolation calculation B2 第3の補間演算B3のフローチャートFlow chart of third interpolation calculation B3 隣接エッジを検出するために設定する画素列を示す図The figure which shows the pixel row | line set in order to detect an adjacent edge 本発明の第2の実施形態による画像拡大縮小装置の構成を示すブロック図The block diagram which shows the structure of the image expansion / contraction apparatus by the 2nd Embodiment of this invention. 図19に示す画像拡大縮小装置のエッジ検出部110の構成を示すブロック図The block diagram which shows the structure of the edge detection part 110 of the image expansion / contraction apparatus shown in FIG. フィルタリング部112において行われる処理を説明するための図The figure for demonstrating the process performed in the filtering part 112 エッジパターン分類部116の動作を説明するための図The figure for demonstrating operation | movement of the edge pattern classification | category part 116. エッジが存在する位置に応じたエッジパターンを示す図(その1)The figure which shows the edge pattern according to the position where an edge exists (the 1) エッジが存在する位置に応じたエッジパターンを示す図(その2)The figure which shows the edge pattern according to the position where an edge exists (the 2) エッジが存在する位置に応じたエッジパターンを示す図(その3)The figure which shows the edge pattern according to the position where an edge exists (the 3) エッジパターン分類部116による分類の結果の一例を示す図(その1)The figure which shows an example of the result of the classification | category by the edge pattern classification | category part 116 (the 1) エッジパターン分類部116による分類の結果の一例を示す図(その2)The figure which shows an example of the result of the classification | category by the edge pattern classification | category part 116 (the 2) エッジ併合部120において行われる処理を示す図The figure which shows the process performed in the edge merging part 120 補間画素Pを囲む16画素内にエッジが存在する場合に行われる補間演算(第2の補間演算D2)を説明するための図The figure for demonstrating the interpolation calculation (2nd interpolation calculation D2) performed when an edge exists in 16 pixels surrounding the interpolation pixel P 本実施形態において行われる処理を示すフローチャートA flowchart showing processing performed in the present embodiment エッジ併合部120によるエッジ併合処理CのフローチャートFlowchart of edge merging process C by edge merging unit 120 第2の補間演算D2のフローチャートFlow chart of second interpolation calculation D2 被写体におけるエッジとデジタル画像において検出されたエッジとの関係の例を示す図The figure which shows the example of the relationship between the edge in a to-be-photographed object, and the edge detected in the digital image 被写体における細線とデジタル画像において検出されたエッジとの関係の例を示す図The figure which shows the example of the relationship between the thin line in a to-be-photographed object, and the edge detected in the digital image 被写体におけるエッジとデジタル画像において検出されたエッジとの関係の例を示す図The figure which shows the example of the relationship between the edge in a to-be-photographed object, and the edge detected in the digital image

符号の説明Explanation of symbols

1 入力部
10 エッジ検出部
12 フィルタリング部
14 判定部
16 エッジパターン分類部
20 エッジ併合部
30 補間演算部
32 判定部
34 参照画像選出部
36 演算部
50 制御部
101 入力部
110 エッジ検出部
112 フィルタリング部
114 判定部
116 エッジパターン分類部
120 エッジ併合部
130 補間演算部
150 制御部
K 拡大縮小率
S0 画像データ
S1 拡大縮小された画像データ
DESCRIPTION OF SYMBOLS 1 Input part 10 Edge detection part 12 Filtering part 14 Judgment part 16 Edge pattern classification | category part 20 Edge merge part 30 Interpolation operation part 32 Determination part 34 Reference image selection part 36 Operation part 50 Control part 101 Input part 110 Edge detection part 112 Filtering part 114 Judgment Unit 116 Edge Pattern Classification Unit 120 Edge Merging Unit 130 Interpolation Operation Unit 150 Control Unit K Scale Ratio S0 Image Data S1 Scaled Image Data

Claims (9)

被写体を撮像して得たデジタル画像を拡大縮小するための補間画素の画素値を、該補間画素の近傍に位置する近傍画素の画素値に基づいて算出する補間画素値算出方法であって、
所定のエッジ検出処理により前記近傍画素の画素間に位置するエッジを検出し、
前記エッジ検出処理により前記エッジが検出された場合は、該エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出すると共に、
前記エッジ検出処理により、前記デジタル画像上の直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいても前記エッジが検出された場合、該2つのエッジを併合して前記3つの画素のうちの中央画素付近位置する1つの併合エッジとし、該併合エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出することを特徴とする補間画素値算出方法。
An interpolation pixel value calculation method for calculating a pixel value of an interpolation pixel for enlarging or reducing a digital image obtained by imaging a subject based on a pixel value of a neighboring pixel located in the vicinity of the interpolation pixel,
Detect an edge located between the neighboring pixels by a predetermined edge detection process ,
When the edge is detected by the edge detection process, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the edge,
By the edge detection processing, when the edge at any between two adjacent pixels of the three pixels adjacent in series on said digital image is detected, the merges the two edges 3 one of the single merged edges located near the center pixel among the pixels, and calculates the pixel value of the interpolation pixel based on the pixel values of the neighboring pixels on the side where the interpolation pixel is located among the opposite sides of said combination if edge An interpolation pixel value calculation method characterized by the above.
前記2つのエッジの前記3つの画素の画素値を比較し、
前記3つの画素の画素値が、該3つの画素の並ぶ方向に沿って単調増加または単調減少する場合においてのみ前記2つのエッジに対して前記併合を行うことを特徴とする請求項1記載の補間画素値算出方法。
Comparing pixel values of the three pixels of the two edges;
2. The interpolation according to claim 1, wherein the merging is performed on the two edges only when pixel values of the three pixels monotonously increase or monotonously decrease along a direction in which the three pixels are arranged. pixel value calculation method.
前記2つのエッジの延びる方向が同じである場合においてのみ該2つのエッジに対して前記併合を行うことを特徴とする請求項1または2記載の補間画素値算出方法。 3. The interpolation pixel value calculation method according to claim 1, wherein the merging is performed on the two edges only when the extending directions of the two edges are the same. 被写体を撮像して得たデジタル画像を拡大縮小するための補間画素の画素値を、該補間画素の近傍に位置する近傍画素の画素値に基づいて算出する補間画素値算出手段を有する補間画素値算出装置であって、
所定のエッジ検出処理により前記近傍画素の画素間に位置するエッジを検出するエッジ検出手段と、
エッジ検出手段により、前記デジタル画像上の直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいても前記エッジが検出された場合、該2つのエッジを併合して前記3つの画素のうちの中央画素付近位置する1つの併合エッジとするエッジ併合手段とを有し
前記補間画素値算出手段が、
前記エッジ検出手段により前記エッジが検出された場合は、該エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出すると共に、
前記エッジ併合手段により前記2つのエッジが併合された場合は、前記併合エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出するものであることを特徴とする補間画素値算出装置。
An interpolation pixel value having an interpolation pixel value calculation means for calculating a pixel value of an interpolation pixel for enlarging / reducing a digital image obtained by imaging a subject based on a pixel value of a neighboring pixel located in the vicinity of the interpolation pixel A calculation device,
Edge detection means for detecting an edge located between pixels of the neighboring pixels by a predetermined edge detection process ;
When the edge is detected in any of two adjacent pixels of the three pixels adjacent in series on the digital image by the edge detection means, the two edges are merged to and a edge merging means for a single merged edges located near the center pixel among the pixels,
The interpolation pixel value calculation means is
When the edge is detected by the edge detection means, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the edge;
When the two edges are merged by the edge merging means, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the merged edge An interpolated pixel value calculating apparatus characterized in that:
前記エッジ併合手段が、前記2つのエッジの前記3つの画素の画素値を比較し、前記3つの画素の画素値が、該3つの画素の並ぶ方向に沿って単調増加または単調減少する場合においてのみ前記2つのエッジに対して前記併合を行うものであることを特徴とする請求項4記載の補間画素値算出装置。 The edge merging means compares the pixel values of the three pixels of the two edges, and only when the pixel values of the three pixels monotonously increase or decrease monotonously along the direction in which the three pixels are arranged. The interpolated pixel value calculation apparatus according to claim 4, wherein the merging is performed on the two edges. 前記エッジ検出手段が、前記エッジの延びる方向も検出するものであり、
前記エッジ併合手段が、前記2つのエッジの延びる方向が同じである場合においてのみ該2つのエッジに対して前記併合を行うものであることを特徴とする請求項4または5記載の補間画素値算出装置。
The edge detection means also detects the extending direction of the edge;
6. The interpolated pixel value calculation according to claim 4, wherein the edge merging unit performs the merging on the two edges only when the extending directions of the two edges are the same. apparatus.
被写体を撮像して得たデジタル画像を拡大縮小するための補間画素の画素値を、該補間画素の近傍に位置する近傍画素の画素値に基づいて算出する補間画素値算出処理をコンピュータに実行させるプログラムであって、
所定のエッジ検出処理により前記近傍画素の画素間に位置するエッジを検出するエッジ検出処理と、
エッジ検出処理により、前記デジタル画像上の直列に隣接する3つの画素の互いに隣接する2つの画素の間のいずれにおいても前記エッジが検出された場合、該2つのエッジを併合して前記3つの画素のうちの中央画素付近位置する1つの併合エッジとするエッジ併合処理と、
前記エッジ検出処理により前記エッジが検出された場合は、該エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出すると共に、
前記エッジ併合処理により前記2つのエッジが併合された場合は、前記併合エッジの両側のうち前記補間画素が位置する側の前記近傍画素の画素値に基づいて前記補間画素の画素値を算出する補間画素値算出処理とをコンピュータに実行させることを特徴とするプログラム。
Causes a computer to execute an interpolation pixel value calculation process for calculating a pixel value of an interpolation pixel for enlarging / reducing a digital image obtained by imaging a subject based on a pixel value of a neighboring pixel located in the vicinity of the interpolation pixel A program,
An edge detection process for detecting an edge located between the neighboring pixels by a predetermined edge detection process;
If the edge is detected in any of two adjacent pixels of the three pixels adjacent in series on the digital image by the edge detection process , the two edges are merged to edge merging to one merged edges located near the center pixel among the pixels,
When the edge is detected by the edge detection process, the pixel value of the interpolation pixel is calculated based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the edge,
Interpolation for calculating the pixel value of the interpolation pixel based on the pixel value of the neighboring pixel on the side where the interpolation pixel is located on both sides of the merged edge when the two edges are merged by the edge merge processing A program that causes a computer to execute pixel value calculation processing .
前記エッジ併合処理が、前記2つのエッジの前記3つの画素の画素値を比較し、前記3つの画素の画素値が、該3つの画素の並ぶ方向に沿って単調増加または単調減少する場合においてのみ前記2つのエッジに対して前記併合を行うものであることを特徴とする請求項7記載のプログラム。 The edge merging process compares the pixel values of the three pixels of the two edges, and only when the pixel values of the three pixels monotonically increase or decrease monotonously along the direction in which the three pixels are arranged. according to claim 7, wherein a program, characterized in that it performs the merge to the two edges. 前記エッジ併合処理が、前記2つのエッジの延びる方向が同じである場合においてのみ該2つのエッジに対して前記併合を行うものであることを特徴とする請求項7または8記載のプログラム。 9. The program according to claim 7 or 8, wherein the edge merging process performs the merging on the two edges only when the extending directions of the two edges are the same.
JP2003377371A 2003-11-04 2003-11-06 Interpolated pixel value calculation method, apparatus, and program Expired - Fee Related JP4133746B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2003377371A JP4133746B2 (en) 2003-11-06 2003-11-06 Interpolated pixel value calculation method, apparatus, and program
US10/979,279 US7391920B2 (en) 2003-11-04 2004-11-03 Image processing method, apparatus, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003377371A JP4133746B2 (en) 2003-11-06 2003-11-06 Interpolated pixel value calculation method, apparatus, and program

Publications (2)

Publication Number Publication Date
JP2005141497A JP2005141497A (en) 2005-06-02
JP4133746B2 true JP4133746B2 (en) 2008-08-13

Family

ID=34688119

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003377371A Expired - Fee Related JP4133746B2 (en) 2003-11-04 2003-11-06 Interpolated pixel value calculation method, apparatus, and program

Country Status (1)

Country Link
JP (1) JP4133746B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100067818A1 (en) * 2008-09-15 2010-03-18 Sony Corporation, A Japanese Corporation System and method for high quality image and video upscaling
KR20210151450A (en) * 2020-06-05 2021-12-14 에스케이하이닉스 주식회사 Smart binning circuit, image sensing device and operation method thereof

Also Published As

Publication number Publication date
JP2005141497A (en) 2005-06-02

Similar Documents

Publication Publication Date Title
US7391920B2 (en) Image processing method, apparatus, and program
JP4706635B2 (en) Image processing apparatus having color misregistration correction function, image processing program, and electronic camera
US7430065B2 (en) Method and system for correcting distortions in image data scanned from bound originals
US7764839B2 (en) Edge detecting apparatus and method, and image size enlarging and reducing apparatus and method
US10679326B2 (en) Image data processing apparatus and image data processing method that determine confidence data indicating a level of confidence in a pixel value in high resolution image data
JP4388110B2 (en) Image processing apparatus, method, and program
JP2005332383A (en) Image processing method, device and program
JP4113232B2 (en) Image processing apparatus and image processing method
JP4133746B2 (en) Interpolated pixel value calculation method, apparatus, and program
US7492969B2 (en) Method for magnifying image by interpolation based on edge and corner
JP4716255B2 (en) Image processing apparatus, image processing method, and program thereof
JP4629123B2 (en) Edge detection method, apparatus, and program
JP4414195B2 (en) Image interpolation method, apparatus and program
JP4133742B2 (en) Interpolated pixel value calculation method, apparatus, and program
JP2005141498A (en) Method, device, and program for edge detection
JP7440821B2 (en) Image processing device, method, and computer program
US20050036711A1 (en) Image interpolation apparatus and method, and edge detecting apparatus and method
JP4156469B2 (en) Edge detection apparatus and method, profile determination apparatus and method, and program
JP4120872B2 (en) Image enlarging / reducing apparatus, method, and program
JP4628406B2 (en) Image processing apparatus, method, and program
JP2005063197A (en) Image interpolation device and method, and program
US10275854B2 (en) Signal processing device, signal processing method, solid-state image sensor, imaging device, and electronic device
JP6815274B2 (en) Image reader and image reading method
JP2005092493A (en) Edge detecting apparatus and method, and program
JP2005094320A (en) Device, method and program for interpolating image

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060502

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20061206

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080124

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080212

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080414

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

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

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

Free format text: PAYMENT UNTIL: 20110606

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4133746

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20110606

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20120606

Year of fee payment: 4

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

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

Free format text: PAYMENT UNTIL: 20120606

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130606

Year of fee payment: 5

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

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

LAPS Cancellation because of no payment of annual fees