JP2009022017A - Image processing apparatus and blur-detecting method - Google Patents

Image processing apparatus and blur-detecting method Download PDF

Info

Publication number
JP2009022017A
JP2009022017A JP2008201711A JP2008201711A JP2009022017A JP 2009022017 A JP2009022017 A JP 2009022017A JP 2008201711 A JP2008201711 A JP 2008201711A JP 2008201711 A JP2008201711 A JP 2008201711A JP 2009022017 A JP2009022017 A JP 2009022017A
Authority
JP
Japan
Prior art keywords
block
blur
pattern
image
width
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.)
Withdrawn
Application number
JP2008201711A
Other languages
Japanese (ja)
Other versions
JP2009022017A5 (en
Inventor
Takashige Tanaka
敬重 田中
Ayahiro Nakajima
紋宏 中島
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.)
Seiko Epson Corp
Original Assignee
Seiko Epson 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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2008201711A priority Critical patent/JP2009022017A/en
Publication of JP2009022017A publication Critical patent/JP2009022017A/en
Publication of JP2009022017A5 publication Critical patent/JP2009022017A5/ja
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To accurately detect blurs in an image even in a high-resolution image, while reducing memory capacity to be used. <P>SOLUTION: A printer 100 acquires a horizontal DCT coefficient group and a vertical DCT coefficient group for each block from JPEG data, selects an edge pattern approximate to a luminance change represented with these coefficient groups from a predetermined table and records a pattern number thereof in a RAM 170. The printer 100 decides whether the luminance changes in blocks horizontally and vertically adjacent to each other continue, based on pattern numbers of blocks recorded in the RAM 170 and links edge patterns, when the luminance changes continue, to accumulate the width of the blur that exists over the blocks. Based on such a cumulative value, the presence or the absence of blurs of an image is determined. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、画像のぼやけを検出する技術に関する。   The present invention relates to a technique for detecting blur of an image.

近年、デジタルスチルカメラが普及し、これに使用されるメモリカードの容量も増大している。そのため、一般のユーザが、画像を大量に撮影する機会が増えている。デジタルスチルカメラは、フィルム代が不要であり、気軽に撮影を行えることから、被写体ブレや手ブレ等を意識することなく撮影が行われることが多い。従って、撮影された画像をプリンタによって印刷しようとすると、被写体ブレや手ブレに起因して画像にぼやけが生じている画像が比較的多く、正常な画像を選別する作業が事前に必要であった。   In recent years, digital still cameras have become widespread, and the capacity of memory cards used for them has increased. Therefore, the opportunity for a general user to take a large number of images is increasing. Since a digital still camera does not require a film fee and can easily shoot, it is often performed without being aware of subject blurring or camera shake. Therefore, when a photographed image is to be printed by a printer, there are relatively many images in which the image is blurred due to subject blurring or camera shake, and it is necessary in advance to select a normal image. .

大量の画像の中から正常な画像を選別する作業は、非常に煩雑な作業である。そこで、このような問題に対処するために、ユーザが画像を印刷するのに先立ち、自動的にぼやけが生じている画像を印刷の対象から排除する技術が望まれている。こうしたぼやけの検出技術に関連し、下記特許文献1には、撮像した画像を8画素×8画素を単位とする複数のブロックに分割して、離散コサイン変換された各ブロックについて周波数分析を行い、ブロック毎に像のシャープさ(逆に言えば、ぼやけ度合い)を判別する技術が記載されている。   The operation of selecting a normal image from a large number of images is a very complicated operation. Therefore, in order to cope with such a problem, there is a demand for a technique for automatically removing a blurred image from a printing target before the user prints the image. In relation to such blur detection technology, Patent Document 1 below divides a captured image into a plurality of blocks each having 8 pixels × 8 pixels, performs frequency analysis on each block subjected to discrete cosine transform, A technique for determining the sharpness of an image (in other words, the degree of blurring) is described for each block.

特開平4−170872号公報Japanese Patent Laid-Open No. 4-170872 特開平10−271516号公報JP-A-10-271516 特開2002−51178号公報JP 2002-51178 A

しかし、近年のデジタルスチルカメラで撮影される画像の解像度は、数百万ないし1000万画素もの高解像度であるため、特許文献1に記載のように8画素×8画素だけで構成されるブロック内だけでぼやけやシャープさを判別することは困難であった。具体的に言えば、L版の印刷用紙(約横130mm×縦90mm)に600万画素(約横3000画素×縦2000画素)の画像を印刷した場合には、横8画素は、約0.35mmの幅に相当し、このような狭い幅の中だけで画像がシャープであるかぼやけているかを客観的に判別することは困難である。つまり、近年撮影される高解像度な画像において、特許文献1に記載の技術を直接適用することは困難になってきている。   However, since the resolution of an image photographed by a recent digital still camera is a high resolution of several million to 10 million pixels, as described in Patent Document 1, it is within a block composed of only 8 pixels × 8 pixels. It was difficult to determine blur and sharpness only. Specifically, when an image of 6 million pixels (about 3000 pixels wide × 2000 pixels high) is printed on an L-size printing paper (about 130 mm wide × 90 mm long), 8 pixels wide is about 0.00 mm. It corresponds to a width of 35 mm, and it is difficult to objectively determine whether an image is sharp or blurred only within such a narrow width. That is, it has become difficult to directly apply the technique described in Patent Document 1 to high-resolution images taken in recent years.

また、特許文献1に記載の技術によって数百万画素あるいはそれ以上の高解像度な画像のぼやけを分析しようとすると、演算量が膨大となり、それに伴いメモリの使用量も多くなる。このような問題は、特に、プリンタやデジタルカメラ、フォトビューワー等といった、CPUパワーやメモリ容量に制限のある小型機器でぼやけの検出を行う場合に看過できない問題となる。   Further, when trying to analyze blur of an image having a high resolution of several million pixels or more by the technique described in Patent Document 1, the amount of calculation becomes enormous, and the amount of memory used increases accordingly. Such a problem is a problem that cannot be overlooked particularly in the case of detecting blur in a small device with limited CPU power or memory capacity, such as a printer, a digital camera, or a photo viewer.

上述した種々の問題を考慮し、本発明が解決しようとする課題は、使用するメモリ容量を削減しつつ、高解像度な画像においても画像のぼやけを精度良く検出することにある。   In view of the various problems described above, the problem to be solved by the present invention is to detect blurring of an image with high accuracy even in a high-resolution image while reducing the memory capacity to be used.

上記課題を踏まえ、本発明の画像処理装置を次のように構成した。すなわち、
複数の画素からなるブロックの集合として構成された画像のぼやけを検出する画像処理装置であって、
前記ブロックを単位として行われた空間領域から周波数領域への変換により得られた係数が、該ブロック毎に記録されて構成された画像データを入力する画像データ入力部と、
前記ブロック内の画素値の変化の代表的な勾配形状を前記係数によって表した複数種類の基本エッジパターンと、該各基本エッジパターンにそれぞれ一意に割り振られたパターン番号とが対応付けて記憶されたエッジパターン記憶部と、
前記入力した画像データの各ブロックから、所定方向の周波数成分を表す係数群を抽出する係数抽出部と、
前記抽出した係数群が表す勾配形状に近似する基本エッジパターンを前記エッジパターン記憶部から選出するパターン照合部と、
前記選出された基本エッジパターンに対応する前記パターン番号を前記ブロックに関連づけて記憶するパターン番号記憶部と、
前記パターン番号記憶部に記憶されたパターン番号を参照し、前記画像内における前記ブロックの連なりに沿って前記基本エッジパターンの勾配の方向が一致する範囲をぼやけ幅として検出するぼやけ幅検出部と、
前記検出されたぼやけ幅に基づいて、前記画像データが表す画像のぼやけを判定するぼやけ判定部と
を備えることを要旨とする。
Based on the above problems, the image processing apparatus of the present invention is configured as follows. That is,
An image processing apparatus for detecting blur of an image configured as a set of blocks composed of a plurality of pixels,
An image data input unit for inputting image data in which coefficients obtained by conversion from a spatial domain to a frequency domain performed in units of the blocks are recorded for each block; and
A plurality of types of basic edge patterns in which representative gradient shapes of pixel value changes in the block are represented by the coefficients, and pattern numbers uniquely assigned to the basic edge patterns are stored in association with each other. An edge pattern storage unit;
A coefficient extraction unit that extracts a coefficient group representing a frequency component in a predetermined direction from each block of the input image data;
A pattern matching unit that selects a basic edge pattern that approximates a gradient shape represented by the extracted coefficient group from the edge pattern storage unit;
A pattern number storage unit that stores the pattern number corresponding to the selected basic edge pattern in association with the block;
A blur width detecting unit that refers to a pattern number stored in the pattern number storage unit and detects a range in which the gradient directions of the basic edge pattern coincide with each other in a series of blocks in the image as a blur width;
And a blur determination unit that determines blur of an image represented by the image data based on the detected blur width.

本発明の画像処理装置では、画像データを構成するブロック毎に所定方向の周波数成分を表す係数群を抽出して、この係数群が表す画素値の勾配の形状に近似した基本エッジパターンをエッジパターン記憶部から選出し、そのパターン番号をパターン番号記憶部に記憶する。そして、このパターン番号に基づき、ブロックの連なりに沿って基本エッジパターンのつながり状態を判定し、基本エッジパターンの勾配の方向が一致する範囲をぼやけ幅として検出する。従って、ぼやけの幅が1つのブロックのサイズを超える場合においても、精度良く画像がぼやけているか否かを判断することができる。   In the image processing apparatus of the present invention, a coefficient group representing a frequency component in a predetermined direction is extracted for each block constituting image data, and a basic edge pattern approximated to the shape of the gradient of the pixel value represented by the coefficient group is defined as an edge pattern. The pattern number is selected from the storage unit and stored in the pattern number storage unit. Then, based on the pattern number, the connection state of the basic edge patterns is determined along a series of blocks, and a range in which the gradient directions of the basic edge patterns match is detected as a blur width. Therefore, even when the blur width exceeds the size of one block, it can be determined whether or not the image is blurry with high accuracy.

また、上述のように、本発明では、隣接ブロック間の基本エッジパターンの勾配の方向が一致するかを判定するかにあたり、画像データに記録された係数を用いるのではなく、その係数が表す勾配形状に近似した基本エッジパターンのパターン番号を用いる。従って、処理時間が大幅に短縮され、使用するメモリ容量を格段に削減することができる。例えば、あるブロックに関連づけられたパターン番号が、右下がり勾配を表す基本エッジパターンの番号であり、その隣接ブロックに関連づけられたパターン番号も、右下がりの勾配を表す基本エッジパターンの番号であれば、これらのブロック間では、勾配の方向が一致すると判断することができる。なお、「勾配の方向が一致」とは、その勾配の角度までが一致することを求めるものではない。例えば、傾きの符号が一致すれば、勾配の方向が一致するといえる。   Further, as described above, in the present invention, in determining whether the gradient directions of the basic edge patterns between adjacent blocks coincide with each other, instead of using the coefficient recorded in the image data, the gradient represented by that coefficient is used. The pattern number of the basic edge pattern that approximates the shape is used. Therefore, the processing time is greatly shortened, and the memory capacity to be used can be significantly reduced. For example, if the pattern number associated with a block is the number of a basic edge pattern representing a downward slope, and the pattern number associated with the adjacent block is also the number of a basic edge pattern representing a downward slope Therefore, it can be determined that the gradient directions coincide between these blocks. Note that “the direction of the gradient is the same” does not mean that the gradient angle is the same. For example, if the signs of the slopes match, it can be said that the directions of the slopes match.

なお、本願では、ブロック毎に空間領域から周波数領域への変換により得られた係数が記録された画像データを入力するものとしたが、このような画像データとしては、例えば、JPEG形式の画像データがある。   In the present application, image data in which coefficients obtained by conversion from the spatial domain to the frequency domain are recorded for each block is input. As such image data, for example, image data in JPEG format is used. There is.

上記構成の画像処理装置において、
前記エッジパターン記憶部には、更に、前記パターン番号に対応付けて、前記各基本エッジパターンが表す勾配の幅が記憶されており、
前記ぼやけ幅検出部は、前記基本エッジパターンの勾配の方向が一致する範囲に存在する各ブロックのパターン番号に対応付けられた前記勾配の幅を前記エッジパターン記憶部から読み出し、該勾配の幅を加算して、前記ぼやけ幅を算出するものとしてもよい。
In the image processing apparatus having the above configuration,
The edge pattern storage unit further stores a gradient width represented by each basic edge pattern in association with the pattern number,
The blur width detection unit reads the gradient width associated with the pattern number of each block existing in a range where the gradient directions of the basic edge pattern coincide with each other from the edge pattern storage unit, and calculates the gradient width. The blur width may be calculated by addition.

このような構成であれば、各基本エッジパターンが表す勾配の幅が、エッジパターン記憶部に予め記憶されているため、ぼやけ幅の算出を高速に行うことが可能になる。   With such a configuration, since the gradient width represented by each basic edge pattern is stored in advance in the edge pattern storage unit, the blur width can be calculated at high speed.

上記構成の画像処理装置において、
前記ぼやけ幅検出部は、前記ブロックの連なりに沿って、注目するブロックを、前記画像データ内に移動させていき、該注目ブロックと該注目ブロックの移動先の隣接ブロックとにそれぞれ関連づけられた前記パターン番号を参照して、該注目ブロックと該隣接ブロックの基本エッジパターンの勾配の方向が一致するか否かを判定し、該勾配の方向が一致する場合に、該注目ブロックのパターン番号に対応付けられた前記勾配の幅を累積加算していくことで、前記ぼやけ幅を算出するものとしてもよい。
In the image processing apparatus having the above configuration,
The blur width detection unit moves a block of interest in the image data along the series of blocks, and is associated with the block of interest and an adjacent block to which the block of interest is moved, respectively. Referring to the pattern number, it is determined whether or not the direction of the gradient of the basic edge pattern of the block of interest and the adjacent block matches, and if the direction of the gradient matches, it corresponds to the pattern number of the block of interest The blur width may be calculated by accumulatively adding the attached gradient widths.

このような構成であれば、画像内に注目ブロックを順次移動させていき、勾配の幅を累積加算しながらぼやけ幅を算出するので、ぼやけ幅の算出に要するメモリの使用量を節減することができる。   With such a configuration, the block of interest is sequentially moved in the image, and the blur width is calculated while accumulating the gradient width, so that the memory usage required for calculating the blur width can be reduced. it can.

上記構成の画像処理装置において、
前記画像データには、前記ブロックが水平方向および垂直方向に連なっており、
前記係数抽出部は、前記係数群として、水平方向の周波数成分を表す第1の係数群と、垂直方向の周波数成分を表す第2の係数群とを抽出し、
前記パターン照合部は、前記第1の係数群と前記第2の係数群とについて、それぞれ、前記基本エッジパターンを選出し、
前記パターン番号記憶部は、前記選出された2つの基本エッジパターンに対応する前記パターン番号をそれぞれ前記ブロックに関連付けて記憶し、
前記ぼやけ幅検出部は、水平方向および垂直方向についてそれぞれ前記ぼやけ幅を算出し、
前記ぼやけ判定部は、前記水平方向と垂直方向とについてそれぞれ算出された前記ぼやけ幅のうち、大きい方のぼやけ幅に基づき、前記画像データが表す画像のぼやけを判定するものとしてもよい。
In the image processing apparatus having the above configuration,
In the image data, the blocks are arranged in a horizontal direction and a vertical direction,
The coefficient extraction unit extracts, as the coefficient group, a first coefficient group representing a horizontal frequency component and a second coefficient group representing a vertical frequency component,
The pattern matching unit selects the basic edge pattern for each of the first coefficient group and the second coefficient group,
The pattern number storage unit stores the pattern numbers corresponding to the selected two basic edge patterns in association with the blocks, respectively.
The blur width detection unit calculates the blur width in the horizontal direction and the vertical direction,
The blur determination unit may determine blur of an image represented by the image data based on a larger blur width among the blur widths calculated for the horizontal direction and the vertical direction, respectively.

このような構成によれば、1つのブロックについて、水平方向のぼやけ幅と垂直方向のぼやけ幅とを算出することができるので、これらのうち、大きい方のぼやけ幅を用いれば、より精度良く画像のぼやけを判定することが可能になる。   According to such a configuration, the horizontal blur width and the vertical blur width can be calculated for one block. Therefore, if the larger blur width is used, it is possible to calculate the image with higher accuracy. It becomes possible to determine the blur of the image.

上記構成の画像処理装置において、
前記ぼやけ幅検出部は、前記水平方向について累積加算した勾配の幅を、ブロック1つ分保持する横累積バッファに保存し、前記垂直方向について累積加算した勾配の幅を、ブロック1行分保持する縦累積バッファに保存し、前記注目ブロックを移動させた場合に、これらのバッファを参照することで移動前のブロックに累積された水平および垂直方向の勾配の幅を取得するものとしてもよい。
In the image processing apparatus having the above configuration,
The blur width detecting unit stores the gradient width cumulatively added in the horizontal direction in a horizontal cumulative buffer that holds one block, and holds the gradient width cumulatively added in the vertical direction for one block. When the block of interest is moved and stored in the vertical accumulation buffer, the horizontal and vertical gradient widths accumulated in the block before the movement may be acquired by referring to these buffers.

このような構成によれば、1ブロック分の累積値を保持する横累積バッファと、ブロック1行分の累積値を保持する縦累積バッファという必要最小限のバッファを用意することで、水平方向と垂直方向についてそれぞれ勾配の幅の累積することができる。この結果、メモリの使用量を節減することができる。   According to such a configuration, by preparing the minimum necessary buffers such as a horizontal accumulation buffer that holds an accumulation value for one block and a vertical accumulation buffer that holds an accumulation value for one row of blocks, The gradient width can be accumulated for each vertical direction. As a result, memory usage can be reduced.

上記構成の画像処理装置において、
前記パターン番号記憶部は、前記注目ブロックが含まれる第1の行と該注目ブロックの下側に隣接するブロックが含まれる第2の行とについて前記パターン番号を記憶可能な記憶領域を有し、前記注目ブロックが該注目ブロックの属する行の右端に移動した場合に、前記第2の行以降に記憶されたパターン番号を、それぞれ前の行に繰り上げて記憶することで、次に選出されたブロックのパターン番号を、該パターン番号記憶部の空領域に記憶していくものとしてもよい。
In the image processing apparatus having the above configuration,
The pattern number storage unit has a storage area capable of storing the pattern number for a first row including the target block and a second row including a block adjacent to the lower side of the target block, When the block of interest moves to the right end of the row to which the block of interest belongs, the pattern number stored in the second and subsequent rows is moved up to the previous row and stored, so that the next selected block The pattern number may be stored in an empty area of the pattern number storage unit.

このような構成によれば、画像全体のパターン番号ではなく、注目ブロックに隣接するブロックが含まれる行についてのみパターン番号を記憶すればよいため、使用するメモリ容量を大幅に削減することが可能になる。   According to such a configuration, it is only necessary to store the pattern number only for the row including the block adjacent to the target block, not the pattern number of the entire image, so that the memory capacity to be used can be greatly reduced. Become.

上記構成の画像処理装置において、
前記画像データには、前記ブロックがn(nは1以上の整数)行毎に記録されており、
前記パターン番号記憶部は、前記ブロック(n+1)行分のパターン番号が記憶可能な記憶領域を用意するものとしてもよい。
In the image processing apparatus having the above configuration,
In the image data, the block is recorded every n (n is an integer of 1 or more) rows,
The pattern number storage unit may prepare a storage area capable of storing pattern numbers for the block (n + 1) rows.

このような構成によれば、画像データにブロックが記録されている単位行数に応じて必要最低限のパターン番号を記憶することができるので、メモリ容量を節減することができる。なお、画像データがJPEG規格に基づくデータであれば、ブロックは、1行または2行単位で記録されているため、パターン番号記憶部は、2行または3行分のパターン番号を記憶可能な記憶領域を用意するものとすることができる。どちらの行数単位でブロックが記録されているかは、JPEGデータのヘッダ情報を解析することで判別することができる。   According to such a configuration, the minimum necessary pattern number can be stored according to the number of unit rows in which blocks are recorded in the image data, so that the memory capacity can be saved. If the image data is based on the JPEG standard, the block is recorded in units of one or two lines, so the pattern number storage unit can store pattern numbers for two or three lines. An area can be prepared. It can be determined by analyzing the header information of the JPEG data that the number of rows is recorded as a block.

上述した種々の構成の画像処理装置において、
前記ぼやけ判定部は、
前記ぼやけ幅と所定の閾値とに基づき、前記ブロック毎にぼやけの有無を判定するブロックぼやけ判定部と、
前記画像データ内の所定のウィンドウ領域に含まれる全ブロックについて、前記ブロックぼやけ判定手段によるぼやけの有無を集計し、該集計結果と所定の閾値とに基づき、該ウィンドウ領域内がぼやけているか否かを判断するウィンドウぼやけ判定部と、
前記画像データ中において、前記ウィンドウ領域を移動させていった結果、少なくとも1カ所、ぼやけていないと判断された前記ウィンドウ領域が存在する場合に、前記画像データが表す画像全体がぼやけていないと判断する画像ぼやけ判定部とを備えるものとしてもよい。
In the image processing apparatus having various configurations described above,
The blur determination unit
A block blur determination unit that determines the presence or absence of blur for each block based on the blur width and a predetermined threshold;
For all blocks included in the predetermined window area in the image data, the presence / absence of blur by the block blur determination means is totaled, and whether or not the window area is blurred based on the total result and a predetermined threshold value A window blur determination unit for determining
As a result of moving the window area in the image data, if there is at least one window area that is determined not to be blurred, it is determined that the entire image represented by the image data is not blurred. It is good also as what has an image blur judgment part to perform.

このような構成によれば、複数のブロックによって構成されるウィンドウ領域毎にぼやけの有無を判断することができるので、より人の感性に近い精度で画像にぼやけが生じているかを判断することが可能になる。所定のウィンドウ領域としては、例えば、画像データがL版の印刷用紙に印刷されると想定すると、1cm×1cmや2cm×2cmの領域とすることができる。このようなサイズのウィンドウ領域内が画像中のいずれかの箇所でぼやけていないと判断されれば、その領域に焦点が合っているものと判断することができるためである。   According to such a configuration, it is possible to determine the presence or absence of blur for each window area composed of a plurality of blocks, so it is possible to determine whether or not the image is blurred with an accuracy closer to human sensitivity. It becomes possible. The predetermined window area may be, for example, an area of 1 cm × 1 cm or 2 cm × 2 cm assuming that image data is printed on an L-size printing paper. This is because if it is determined that the window area of such a size is not blurred in any part of the image, it can be determined that the area is in focus.

上記構成の画像処理装置において、
前記ウィンドウ領域は、更に、それぞれが前記ブロックのサイズよりも大きい複数のサブウィンドウによって区画されており、
前記ブロックぼやけ判定部は、前記ブロック毎のぼやけの有無を、該ブロックが含まれる前記サブウィンドウ毎に集計し、
前記ウィンドウぼやけ判定部は、前記サブウィンドウについて集計された集計値を、更に、前記ウィンドウ領域に含まれる全サブウィンドウについて集計することで、該ウィンドウ領域に含まれる全ブロックについての前記ぼやけの有無の集計を行うものとしてもよい。
In the image processing apparatus having the above configuration,
The window area is further partitioned by a plurality of sub-windows, each of which is larger than the size of the block,
The block blur determination unit totalizes the presence / absence of blur for each block for each sub-window including the block,
The window blur determination unit further counts the total value of the sub-windows, and further totals all the sub-windows included in the window area, thereby calculating the presence / absence of the blur for all blocks included in the window area. It may be done.

このような構成によれば、ブロックからサブウィンドウ、サブウィンドウからウィンドウ領域へと段階的にぼやけの有無を集計すればよいため、効率的にぼやけの有無を集計することができる。   According to such a configuration, the presence / absence of blurring may be tabulated in a stepwise manner from the block to the subwindow and from the subwindow to the window area, so that the presence / absence of blurring can be efficiently tabulated.

上記構成の画像処理装置において、
前記画像ぼやけ判定部は、前記画像データ中において、前記ウィンドウ領域を、前記サブウィンドウ単位の移動距離で移動させるものとしてもよい。
In the image processing apparatus having the above configuration,
The image blur determination unit may move the window area within the image data by a movement distance in units of sub-windows.

このような構成であれば、ウィンドウ領域がサブウィンドウ単位の移動距離で移動するので、容易にウィンドウ領域内のぼやけの有無を集計することができる。また、ウィンドウ領域単位で移動させるよりも、精度良く、ぼやけの発生しているウィンドウ領域を検出することができる。   With such a configuration, since the window area moves by the movement distance in units of sub-windows, it is possible to easily add up the presence or absence of blur in the window area. In addition, it is possible to detect a blurred window area with higher accuracy than when moving in window area units.

上記構成の画像処理装置において、
更に、前記ブロックぼやけ判定部によって集計された前記サブウィンドウ毎のぼやけの有無の集計値を記憶する集計値記憶部を備え、
前記集計値記憶部は、前記ウィンドウ領域内に含まれるサブウィンドウの行数分だけ前記集計値を記憶する記憶領域を有し、前記ウィンドウ領域が前記画像データ中において下側に移動された場合には、前記集計値記憶部の各行に記憶された集計値を、それぞれ前記移動された行数分だけ前の行に繰り上げて記憶し、該繰り上げ処理に伴って生じた該集計値記憶部の空領域に前記移動後のウィンドウ領域内に含まれることになった前記サブウィンドウ毎の前記集計値を記憶するものとしてもよい。
In the image processing apparatus having the above configuration,
Furthermore, a total value storage unit that stores a total value of the presence or absence of blur for each of the sub-windows totaled by the block blur determination unit,
The total value storage unit has a storage area for storing the total value as many as the number of rows of subwindows included in the window area, and when the window area is moved downward in the image data The total value stored in each row of the total value storage unit is stored in the previous row by the number of the moved lines, and the empty region of the total value storage unit generated by the advance processing The total value for each of the sub-windows that are included in the moved window area may be stored.

このような構成によれば、ウィンドウ領域内のぼやけの有無の集計に必要なだけのメモリ容量を集計値記憶部として用意すればよいため、使用するメモリ容量を節減することができる。   According to such a configuration, it is only necessary to prepare as the total value storage unit a memory capacity necessary for totalizing the presence / absence of blur in the window area, so that the memory capacity to be used can be reduced.

上記構成の画像処理装置において、
更に、前記ぼやけ判定部によってぼやけていないと判定された画像をユーザに提示する提示部を備えるものとしてもよい。
In the image processing apparatus having the above configuration,
Furthermore, it is good also as a thing provided with the presentation part which shows a user the image determined not to be blurred by the blur determination part.

このような構成によれば、ユーザは、撮影に成功した画像のみを確認することができる。ユーザに提示する方法としては、例えば、表示装置に画像を表示させるものとすることができる。その他、ぼやけていないと判定された画像の一覧を印刷してユーザに提示するものとしてもよい。   According to such a configuration, the user can confirm only images that have been successfully captured. As a method of presenting to a user, for example, an image can be displayed on a display device. In addition, a list of images determined not to be blurred may be printed and presented to the user.

上記構成の画像処理装置において、
更に、前記提示された画像の中からユーザによって選択された画像を印刷する印刷部を備えるものとしてもよい。
In the image processing apparatus having the above configuration,
Furthermore, a printing unit that prints an image selected by the user from the presented images may be provided.

このような構成によれば、ユーザは、手ブレや被写体ブレによって画像にぼやけの生じている画像を意識することなく、撮影に成功した画像の中から所望の画像を容易に印刷することができる。   According to such a configuration, the user can easily print a desired image from images that have been successfully shot without being aware of an image that is blurred due to camera shake or subject blur. .

なお、本発明は、上述した画像処理装置としての構成のほか、コンピュータが画像のぼやけを検出するぼやけ検出方法や、画像のぼやけを検出するためのコンピュータプログラムとしても構成することができる。かかるコンピュータプログラムは、コンピュータが読取可能な記録媒体に記録されていてもよい。記録媒体としては、例えば、フレキシブルディスクやCD−ROM、DVD−ROM、光磁気ディスク、メモリカード、ハードディスク等の種々の媒体を利用することができる。   In addition to the configuration as the image processing apparatus described above, the present invention can also be configured as a blur detection method in which a computer detects blur of an image and a computer program for detecting blur in an image. Such a computer program may be recorded on a computer-readable recording medium. As the recording medium, for example, various media such as a flexible disk, a CD-ROM, a DVD-ROM, a magneto-optical disk, a memory card, and a hard disk can be used.

以下、上述した本発明の作用・効果を一層明らかにするため、本発明の実施の形態を実施例に基づき次の順序で説明する。
A.プリンタのハードウェア構成:
B.プリンタの機能構成:
C.印刷処理:
D.ぼやけ判定処理:
E.エッジパターン照合処理:
F.エッジ連結処理:
G.ブロックぼやけ判定処理:
H.ウィンドウぼやけ判定処理:
I.効果:
Hereinafter, in order to further clarify the operations and effects of the present invention described above, embodiments of the present invention will be described based on examples in the following order.
A. Printer hardware configuration:
B. Printer functional configuration:
C. Printing process:
D. Blur judgment processing:
E. Edge pattern matching process:
F. Edge connection processing:
G. Block blur judgment processing:
H. Window blur determination processing:
I. effect:

A.プリンタのハードウェア構成:
図1は、本願の画像処理装置の実施例としてのプリンタ100の外観を示す説明図である。プリンタ100は、いわゆる複合機タイプのプリンタであり、光学的に画像を読み込むスキャナ110や、画像データの記録されたメモリカードMCを挿入するためのメモリカードスロット120、デジタルカメラ等の機器を接続するUSBインタフェース130等を備えている。プリンタ100は、スキャナ110によって取り込んだ画像や、メモリカードMCから読み取った画像、USBインタフェース130を介してデジタルカメラから読み取った画像を印刷用紙Pに印刷することができる。また、プリンタケーブルやUSBケーブルによって接続された図示していないパーソナルコンピュータから入力した画像の印刷も行うことができる。
A. Printer hardware configuration:
FIG. 1 is an explanatory diagram showing the appearance of a printer 100 as an embodiment of the image processing apparatus of the present application. The printer 100 is a so-called multi-function printer, and is connected to devices such as a scanner 110 for optically reading an image, a memory card slot 120 for inserting a memory card MC on which image data is recorded, and a digital camera. A USB interface 130 and the like are provided. The printer 100 can print an image captured by the scanner 110, an image read from the memory card MC, and an image read from the digital camera via the USB interface 130 on the printing paper P. It is also possible to print an image input from a personal computer (not shown) connected by a printer cable or USB cable.

プリンタ100は、印刷に関する種々の操作を行うための操作パネル140を備えている。操作パネル140の中央部には、液晶ディスプレイ145が備えられている。この液晶ディスプレイ145は、メモリカードMCやデジタルカメラなどから読み取った画像の表示や、プリンタ100の各種機能を利用する際のGUI(グラフィカルユーザインタフェース)の表示に利用される。   The printer 100 includes an operation panel 140 for performing various operations related to printing. A liquid crystal display 145 is provided at the center of the operation panel 140. The liquid crystal display 145 is used to display an image read from a memory card MC, a digital camera, or the like, or to display a GUI (graphical user interface) when using various functions of the printer 100.

プリンタ100は、メモリカードMCやデジタルカメラ等から入力した複数の画像データの中から、ぼやけている画像(以下「ぼやけ画像」という)を排除して、ピントが1カ所でも合っている画像(以下、「合焦画像」という)のみを抽出し、液晶ディスプレイ145に表示する機能を有している。ユーザは、こうして液晶ディスプレイ145に表示された画像の中から、所望の画像を選択することで、印刷に適した画像のみを印刷することが可能となる。以下では、このぼやけ画像を排除する機能を実現するためのプリンタ100の構成および処理について詳細に説明する。   The printer 100 eliminates a blurred image (hereinafter referred to as “blurred image”) from a plurality of image data input from a memory card MC, a digital camera, or the like, and an image that is in focus at one location (hereinafter referred to as “blurred image”). , “Focused image”), and a function for displaying on the liquid crystal display 145. The user can print only an image suitable for printing by selecting a desired image from the images displayed on the liquid crystal display 145 in this way. Hereinafter, the configuration and processing of the printer 100 for realizing the function of eliminating the blurred image will be described in detail.

図2は、プリンタ100の内部構成を示す説明図である。図示するように、プリンタ100は、印刷用紙Pに印刷を行う機構として、インクカートリッジ212を搭載したキャリッジ210や、キャリッジ210を主走査方向に駆動するキャリッジモータ220、印刷用紙Pを副走査方向に搬送する紙送りモータ230等を備えている。   FIG. 2 is an explanatory diagram showing the internal configuration of the printer 100. As shown in the figure, the printer 100 has a carriage 210 on which an ink cartridge 212 is mounted, a carriage motor 220 that drives the carriage 210 in the main scanning direction, and a printing paper P in the sub-scanning direction as a mechanism for printing on the printing paper P. A paper feed motor 230 and the like are provided.

キャリッジ210は、シアン、マゼンタ、イエロ、ブラック、ライトシアン、ライトマゼンタの色を現す各インクに対応して、計6種類のインクヘッド211を備えている。キャリッジ210には、これらのインクが収容されたインクカートリッジ212が装着されており、インクカートリッジ212からインクヘッド211に供給されたインクは、図示しないピエゾ素子を駆動することで印刷用紙Pに吐出される。   The carriage 210 includes a total of six types of ink heads 211 corresponding to the inks representing cyan, magenta, yellow, black, light cyan, and light magenta. An ink cartridge 212 containing these inks is mounted on the carriage 210, and the ink supplied from the ink cartridge 212 to the ink head 211 is ejected onto the printing paper P by driving a piezo element (not shown). The

キャリッジ210は、プラテン270の軸方向と並行に設置された摺動軸280に移動自在に保持されている。キャリッジモータ220は、制御ユニット150からの指令に応じて駆動ベルト260を回転させることで、プラテン270の軸方向と平行に、すなわち、主走査方向にキャリッジ210を往復運動させる。紙送りモータ230は、プラテン270を回転させることで、プラテン270の軸方向と垂直に印刷用紙Pを搬送する。つまり、紙送りモータ230は、キャリッジ210を相対的に副走査方向に移動させることができる。   The carriage 210 is movably held by a sliding shaft 280 installed in parallel with the axial direction of the platen 270. The carriage motor 220 rotates the drive belt 260 in response to a command from the control unit 150 to reciprocate the carriage 210 in parallel with the axial direction of the platen 270, that is, in the main scanning direction. The paper feed motor 230 rotates the platen 270 to convey the printing paper P perpendicular to the axial direction of the platen 270. That is, the paper feed motor 230 can relatively move the carriage 210 in the sub-scanning direction.

プリンタ100は、上述したインクヘッド211やキャリッジモータ220、紙送りモータ230の動作を制御するための制御ユニット150を備えている。制御ユニット150には、図1に示したスキャナ110やメモリカードスロット120、USBインタフェース130、操作パネル140、液晶ディスプレイ145が接続されている。   The printer 100 includes a control unit 150 for controlling operations of the ink head 211, the carriage motor 220, and the paper feed motor 230 described above. The control unit 150 is connected to the scanner 110, the memory card slot 120, the USB interface 130, the operation panel 140, and the liquid crystal display 145 shown in FIG.

制御ユニット150は、CPU160とRAM170とROM180とによって構成されている。ROM180には、プリンタ100の動作を制御するための制御プログラムが記憶されており、更に、後述する種々の処理で使用されるエッジパターンテーブル181や正規化輝度差テーブル182が記憶されている。   The control unit 150 includes a CPU 160, a RAM 170, and a ROM 180. The ROM 180 stores a control program for controlling the operation of the printer 100, and further stores an edge pattern table 181 and a normalized luminance difference table 182 that are used in various processes described later.

CPU160はROM180に記憶された制御プログラムをRAM170に展開して実行することで図示する各機能部(161〜166)として動作する。RAM170には、制御プログラムを実行するためのワークエリアのほか、図示するパターン番号バッファ171や合焦ブロック数バッファ172(本願の集計値記憶部に対応する)、縦累積バッファ173、横累積バッファ174、と呼ばれる記憶領域がそれぞれ確保されている。   The CPU 160 operates as each functional unit (161 to 166) shown in the figure by expanding and executing the control program stored in the ROM 180 in the RAM 170. The RAM 170 includes a work area for executing the control program, a pattern number buffer 171 and a focused block number buffer 172 (corresponding to the total value storage unit of the present application), a vertical accumulation buffer 173, and a horizontal accumulation buffer 174 shown in the figure. A storage area called "," is secured.

B.プリンタの機能構成:
制御ユニット150は、CPU160によって実現される機能部として、画像データ入力部161、係数抽出部162、パターン照合部163、エッジ連結部164、ブロックぼやけ判定部165、ウィンドウぼやけ判定部166を備えている。以下、これらの機能部の働きについて簡単に説明する(詳細な働きについては後述する各種処理内容を参照)。
B. Printer functional configuration:
The control unit 150 includes an image data input unit 161, a coefficient extraction unit 162, a pattern matching unit 163, an edge connection unit 164, a block blur determination unit 165, and a window blur determination unit 166 as functional units realized by the CPU 160. . Hereinafter, the function of these functional units will be briefly described (for details of the function, refer to various processing contents described later).

画像データ入力部161は、メモリカードスロット120やUSBインタフェース130を介して、メモリカードMCやデジタルカメラからJPEG形式の画像データ(以下、「JPEGデータ」という)を入力する機能部である。JPEGデータには、8画素×8画素のMCU(Minimum Coded Unit)と呼ばれるブロックが水平方向および垂直方向に(つまり、行毎に)連なって配置されている。この各ブロック内の画像データは、(1)RGB色空間からYCbCr色空間への画素値の色変換、(2)空間領域から周波数領域へのDCT(Discrete Cosine Transform)変換、(3)データの情報量を削減する量子化、(4)エントロピー符号化の一種であるハフマン符号化、が順次行われることでデータ量が圧縮されている。   The image data input unit 161 is a functional unit that inputs JPEG format image data (hereinafter referred to as “JPEG data”) from the memory card MC or the digital camera via the memory card slot 120 or the USB interface 130. In JPEG data, blocks called MCU (Minimum Coded Unit) of 8 pixels × 8 pixels are arranged in a row in the horizontal direction and the vertical direction (that is, for each row). The image data in each block includes (1) color conversion of pixel values from the RGB color space to the YCbCr color space, (2) DCT (Discrete Cosine Transform) conversion from the spatial domain to the frequency domain, (3) The amount of data is compressed by sequentially performing quantization for reducing the amount of information and (4) Huffman coding, which is a kind of entropy coding.

図3および図4は、JPEGデータ内に各ブロックのデータが記録されている順序を示す説明図である。図3は、各ブロックが1行ごとに記録されている様子を表し、図4には、各ブロックが2行ごとに記録されている様子を表す。2行ごとにブロックが格納される場合には、図4に示すように、各ブロックが、画像の最も左上から、右、左下、右、右上、の順に、アルファベットの「Z」を連続して記述するかの如く記録されている。JPEGデータのヘッダ情報には、これらのうち、いずれかの順序でブロックが記録されているかを示す情報が記録されている。なお、JPEGデータの中には、他の記録順によって各ブロックのデータが記録されているものもあるが、本実施例では、上述した2種類の記録順によってデータが記録されているJPEGデータのみを取り扱うものとする。また、本実施例では、各ブロックの連なりの方向は、あくまで水平方向および垂直方向であるものとし、この連なりの方向とブロックの記録順とは異なるものとする。   3 and 4 are explanatory diagrams showing the order in which the data of each block is recorded in the JPEG data. FIG. 3 shows a state in which each block is recorded for each row, and FIG. 4 shows a state in which each block is recorded for every two rows. When blocks are stored every two rows, as shown in FIG. 4, each block has an alphabet “Z” sequentially from the upper left of the image in the order of right, lower left, right, upper right. It is recorded as if it were written. In the header information of JPEG data, information indicating whether the blocks are recorded in any order is recorded. In addition, some JPEG data has data of each block recorded in another recording order. However, in this embodiment, only JPEG data in which data is recorded by the two types of recording orders described above. Shall be handled. In this embodiment, the continuous direction of the blocks is assumed to be the horizontal direction and the vertical direction, and the continuous direction and the recording order of the blocks are different.

係数抽出部162は、上述したJPEGデータを、ブロック毎に、逆ハフマン符号化、逆量子化を行い、DCT係数を取得する。係数抽出部162は、さらに、こうして取得した8×8個のDCT係数の中から、水平方向の交流周波数成分を表す第1の係数群と、垂直方向の交流周波数成分を表す第2の係数群とを抽出する。   The coefficient extraction unit 162 performs inverse Huffman coding and inverse quantization on the above-described JPEG data for each block, and acquires DCT coefficients. The coefficient extraction unit 162 further includes a first coefficient group representing a horizontal AC frequency component and a second coefficient group representing a vertical AC frequency component from the 8 × 8 DCT coefficients thus obtained. And extract.

図5は、係数抽出部162によって抽出されるDCT係数を示す説明図である。図示するように、各ブロックからは、逆量子化が行われた段階で、F00からF77までの計64個のDCT係数が得られる。これらのうち、最も左上に存在する係数F00は、直流成分と呼ばれ、他の係数は、交流成分と呼ばれる。このうち、係数抽出部162は、水平方向のみの交流成分である係数F01〜F07を第1の係数群として抽出し、垂直方向のみの交流成分である係数F10〜F70を第2の係数群として抽出する。   FIG. 5 is an explanatory diagram showing DCT coefficients extracted by the coefficient extraction unit 162. As shown in the figure, a total of 64 DCT coefficients from F00 to F77 are obtained from each block when the inverse quantization is performed. Among these, the coefficient F00 present at the upper left is called a DC component, and the other coefficients are called AC components. Among these, the coefficient extraction unit 162 extracts the coefficients F01 to F07, which are AC components only in the horizontal direction, as the first coefficient group, and the coefficients F10 to F70, which are AC components only in the vertical direction, as the second coefficient group. Extract.

パターン照合部163は、ROM180に記憶されたエッジパターンテーブル181と、係数抽出部162によって抽出された第1の係数群および第2の係数群とを照合して、第1の係数群および第2の係数群が表す輝度変化に近似する形状の基本エッジパターンをエッジパターンテーブル181から選出する機能部である。本実施例において、「エッジパターン」とは、ブロック内の輝度変化の勾配の形状を表すパターンのことをいう。エッジパターンテーブル181の詳細な構成は後述するが、このエッジパターンテーブル181には、64種類の基本エッジパターンについて、その勾配形状を表すDCT係数群の値と、パターン番号とが対応付けて記録されている。図5の下部には、第1の係数群が表す水平方向の輝度変化に近似した基本エッジパターンと、第2の係数群が表す垂直方向の輝度変化に近似した基本エッジパターンとを選出した例を示している。パターン照合部163は、こうして基本エッジパターンを選出すると、選出した基本エッジパターンのパターン番号をRAM170内のパターン番号バッファ171にブロック毎に記録する。   The pattern collating unit 163 collates the edge pattern table 181 stored in the ROM 180 with the first coefficient group and the second coefficient group extracted by the coefficient extracting unit 162, and thereby compares the first coefficient group and the second coefficient group. This is a functional unit that selects a basic edge pattern having a shape approximate to the luminance change represented by the coefficient group from the edge pattern table 181. In this embodiment, the “edge pattern” refers to a pattern that represents the shape of the gradient of luminance change in a block. The detailed configuration of the edge pattern table 181 will be described later. In this edge pattern table 181, DCT coefficient group values representing the gradient shapes and pattern numbers of 64 types of basic edge patterns are recorded in association with each other. ing. In the lower part of FIG. 5, an example of selecting a basic edge pattern approximated to the horizontal luminance change represented by the first coefficient group and a basic edge pattern approximated to the vertical luminance change represented by the second coefficient group. Is shown. When the basic edge pattern is selected in this way, the pattern matching unit 163 records the pattern number of the selected basic edge pattern in the pattern number buffer 171 in the RAM 170 for each block.

エッジ連結部164は、複数のブロックに跨ってぼやけた輪郭部分が存在する場合に、そのぼやけた部分の幅(以下、「ぼやけ幅」という)を連結していく処理を行う機能部である。このエッジ連結部164は、本願の「ぼやけ幅検出部」に対応する。   The edge connecting unit 164 is a functional unit that performs processing for connecting the width of the blurred portion (hereinafter referred to as “blurred width”) when a blurred outline portion exists across a plurality of blocks. The edge connecting portion 164 corresponds to the “blurring width detecting portion” of the present application.

図6は、注目ブロックとこれに隣接したブロックとのぼやけ幅を連結する概念を示す説明図である。本実施例では、図の上部に示すように、注目ブロックについて選出された基本エッジパターンと、右側および下側に隣接したブロックについて選出された基本エッジパターンの形状に基づき、これらのブロックの輝度変化の勾配が同一の方向に連続しているかを判断する。そして、連続する場合には、上側および左側に隣接したブロックのぼやけ幅や輝度差を逐次累積していき、連続しない場合には、注目ブロックが輝度変化の端部であると判断して、そのぼやけ幅や輝度差を確定していく処理を行う。つまり、本実施例では、画像のぼやけ幅が1つのブロックのサイズ(8×8画素)を超える場合には、そのぼやけ幅を累積加算していき、ぼやけの終端となるブロックに達した際に、その累積加算値(以下、「累積ぼやけ幅CW」という)に基づき、そのブロックが合焦しているのかぼやけているかを判断するのである。図の下部に示すように、注目ブロックについてぼやけ幅が累積加算されると、その値が、右側および下側のブロックのぼやけ幅の算出時に参照されることになる。なお、エッジ連結部164は、ぼやけ幅だけではなく、ブロック内の輝度差についても累積加算していき、この値によってぼやけの有無の判定精度を向上させる機能を有する。   FIG. 6 is an explanatory diagram showing a concept of connecting blur widths of a block of interest and a block adjacent thereto. In this embodiment, as shown in the upper part of the figure, based on the shape of the basic edge pattern selected for the target block and the basic edge pattern selected for the right and lower adjacent blocks, the luminance change of these blocks It is determined whether or not the gradients of are continuous in the same direction. If it is continuous, the blur width and luminance difference of the adjacent blocks on the upper and left sides are sequentially accumulated, and if not continuous, it is determined that the target block is the end of the luminance change, Processing to determine the blur width and brightness difference is performed. That is, in this embodiment, when the blur width of the image exceeds the size of one block (8 × 8 pixels), the blur width is cumulatively added, and when the block reaches the end of blur. Based on the cumulative addition value (hereinafter, referred to as “cumulative blur width CW”), it is determined whether the block is in focus or blurry. As shown in the lower part of the figure, when the blur width is cumulatively added for the block of interest, the value is referred to when calculating the blur width of the right and lower blocks. Note that the edge linking unit 164 has a function of accumulating not only the blur width but also the luminance difference in the block, and improving the determination accuracy of the presence / absence of blur based on this value.

ブロックぼやけ判定部165は、ブロック毎に、そのブロックがぼやけているか否かを判定する機能部である。具体的には、エッジ連結部164によって確定した水平方向と垂直方向の累積ぼやけ幅CWのうち、値が大きい方の累積ぼやけ幅CWを採用し、このぼやけ幅が所定の閾値を超えた場合に、そのブロックはぼやけていると判定する。   The block blur determination unit 165 is a functional unit that determines, for each block, whether the block is blurry. Specifically, when the cumulative blur width CW having a larger value among the horizontal and vertical cumulative blur widths CW determined by the edge linking unit 164 is adopted and this blur width exceeds a predetermined threshold value, The block is determined to be blurred.

ウィンドウぼやけ判定部166は、複数のブロックによって構成されるウィンドウ領域について、そのウィンドウ領域内がぼやけているか否かを判断する機能部である。以下の説明では、合焦しているウィンドウ領域を「合焦ウィンドウ」といい、ぼやけているウィンドウ領域を「ぼやけウィンドウ」というものとする。   The window blur determination unit 166 is a functional unit that determines whether or not the window area of the window area configured by a plurality of blocks is blurred. In the following description, a focused window area is referred to as a “focused window”, and a blurred window area is referred to as a “blurred window”.

図7は、ウィンドウ領域の概念を示す説明図である。本実施例においてウィンドウ領域とは、L版の印刷用紙において、最小の合焦エリアと想定される1cm×1cmのサイズの領域を表しているものとする。ウィンドウぼやけ判定部166は、このウィンドウ領域がL版の印刷用紙内のいずれかの場所において1カ所でも合焦していれば、その画像は合焦画像であると判断する。L版の印刷用紙は、約13cm×縦約9cmのサイズである。この用紙に、600万画素(横約3000画素×縦約2000画素)の画像を印刷すると、8画素×8画素の1ブロックのサイズは、約0.35mm×0.35mmになる。そのため、ひとつのウィンドウ領域内には、約28×28個のブロックが存在することになる。   FIG. 7 is an explanatory diagram showing the concept of the window area. In this embodiment, the window area represents an area having a size of 1 cm × 1 cm, which is assumed to be the minimum focusing area on the L-size printing paper. The window blur determination unit 166 determines that the image is a focused image if the window region is in focus at any one position in the L-size printing paper. The L-size printing paper has a size of about 13 cm × length of about 9 cm. When an image of 6 million pixels (approximately 3000 pixels wide × approximately 2000 pixels long) is printed on this sheet, the size of one block of 8 pixels × 8 pixels is about 0.35 mm × 0.35 mm. Therefore, there are about 28 × 28 blocks in one window area.

図7の下部に示すように、ウィンドウ領域は、4×4のサブウィンドウ領域と呼ぶ領域に区画されている。ウィンドウぼやけ判定部166は、このサブウィンドウ領域単位でウィンドウ領域の位置を移動させていくことで、画像内のどのウィンドウ領域が合焦しているかを判断する。上述した例では、1つのウィンドウ領域内には、ブロックが28個×28個存在するので、このサブウィンドウ領域内には、ブロックが7個×7個存在することになる。   As shown in the lower part of FIG. 7, the window area is divided into areas called 4 × 4 sub-window areas. The window blur determination unit 166 determines which window region in the image is in focus by moving the position of the window region in units of the sub-window region. In the example described above, there are 28 × 28 blocks in one window area, and therefore there are 7 × 7 blocks in this sub-window area.

なお、本実施例では、上述のように、L版の印刷用紙に600万画素の画像を印刷することを想定して、ブロックの数やウィンドウのサイズを規定しているが、印刷対象の用紙サイズや画像の解像度に応じて、これらのパラメータの値は、適宜変更されることは言うまでもない。   In this embodiment, as described above, the number of blocks and the window size are defined on the assumption that an image of 6 million pixels is printed on an L-size printing paper. It goes without saying that the values of these parameters are appropriately changed according to the size and the resolution of the image.

C.印刷処理:
図8は、プリンタ100のCPU160が実行する印刷処理のフローチャートである。この印刷処理は、メモリカードMC等から画像データを入力して印刷を行うための処理である。
C. Printing process:
FIG. 8 is a flowchart of print processing executed by the CPU 160 of the printer 100. This printing process is a process for printing by inputting image data from the memory card MC or the like.

操作パネル140を用いたユーザの所定の操作に応じてこの印刷処理が実行されると、まず、CPU160は、画像データ入力部161を用いて、メモリカードスロット120に挿入されたメモリカードMCからJPEGデータを入力する(ステップS10)。なお、ここでは、メモリカードMCからJPEGデータを入力するものとするが、USBインタフェース130を介して接続されたデジタルカメラやコンピュータ等から入力するものとしてもよい。   When this printing process is executed in accordance with a predetermined operation by the user using the operation panel 140, first, the CPU 160 uses the image data input unit 161 to perform JPEG from the memory card MC inserted in the memory card slot 120. Data is input (step S10). Here, JPEG data is input from the memory card MC, but may be input from a digital camera or a computer connected via the USB interface 130.

JPEGデータを入力すると、CPU160は、入力したJPEGデータのヘッダ情報を解析し、以降の処理に必要なバッファ領域をRAM170に確保する(ステップS20)。具体的には、CPU160は、JPEGデータ内にブロックが図3のように1行単位で記録されている場合には、ブロック2行分の基本エッジパターンのパターン番号が記録可能なパターン番号バッファ171をRAM170に確保する。また、ブロックが図4のように2行単位で記録されている場合には、ブロック3行分のパターン番号が記録可能なパターン番号バッファ171を確保する。つまり、CPU160は、JPEGデータ内にn(nは1以上の整数)行毎にブロックが記録されていれば、(n+1)行分のブロックのパターン番号が記録可能なパターン番号バッファ171を確保するのである。更に、CPU160は、パターン番号バッファ171に加え、垂直方向のぼやけ幅の累積値をブロック1行分記録する縦累積バッファ173と、水平方向のぼやけ幅の累積値をブロック1つ分記録する横累積バッファ174と、サブウィンドウ4行分の合焦ブロック数を記録する合焦ブロック数バッファ172とをRAM170内に確保する。これらのバッファの役割や使用法については以下において適宜説明する。   When the JPEG data is input, the CPU 160 analyzes the header information of the input JPEG data and secures a buffer area necessary for the subsequent processing in the RAM 170 (step S20). Specifically, when the block is recorded in the unit of one line as shown in FIG. 3 in the JPEG data, the CPU 160 records the pattern number buffer 171 that can record the pattern number of the basic edge pattern for two lines of the block. Is secured in the RAM 170. When the block is recorded in units of two lines as shown in FIG. 4, a pattern number buffer 171 capable of recording pattern numbers for three lines of blocks is secured. That is, if a block is recorded every n (n is an integer of 1 or more) rows in the JPEG data, the CPU 160 secures a pattern number buffer 171 that can record a pattern number of blocks of (n + 1) rows. It is. Further, the CPU 160, in addition to the pattern number buffer 171, a vertical accumulation buffer 173 that records the cumulative value of blur width in the vertical direction for one block, and a horizontal accumulation that records the cumulative value of blur width in the horizontal direction for one block. A buffer 174 and an in-focus block number buffer 172 for recording the in-focus block number for four rows of the sub-window are secured in the RAM 170. The role and usage of these buffers will be described as appropriate below.

次に、CPU160は、ステップS10によって入力したJPEGデータについて、ステップS20で確保した各種バッファを用いつつぼやけ判定処理を行う(ステップS30)。このぼやけ判定処理の詳細については後述する。   Next, the CPU 160 performs a blur determination process on the JPEG data input in step S10 while using the various buffers secured in step S20 (step S30). Details of the blur determination process will be described later.

1つのJPEGデータについてぼやけ判定処理を終了すると、CPU160は、メモリカードMC内のすべてのJPEGデータを入力し、これらについてぼやけ判定処理が終了したかを判断する(ステップS40)。かかる処理によって、全てのJPEGデータを入力していないと判断した場合には(ステップS40:No)、処理をステップS10に戻し、次のJPEGデータを入力する。   When the blur determination process is completed for one piece of JPEG data, the CPU 160 inputs all the JPEG data in the memory card MC and determines whether the blur determination process is completed for these (step S40). If it is determined that all the JPEG data has not been input through this process (step S40: No), the process returns to step S10, and the next JPEG data is input.

上記ステップS40によって、全てのJPEGデータについてぼやけ判定処理が終了したと判断した場合には(ステップS40:Yes)、CPU160は、ステップS30によってぼやけていないと判定された画像、すなわち、合焦画像を、液晶ディスプレイ145に一覧表示する(ステップS50)。   If it is determined in step S40 that the blur determination process has been completed for all the JPEG data (step S40: Yes), the CPU 160 determines the image determined not to be blurred in step S30, that is, the focused image. Then, a list is displayed on the liquid crystal display 145 (step S50).

合焦画像の一覧を液晶ディスプレイ145に表示すると、CPU160は、操作パネル140を介して、ユーザから、印刷の対象となる画像の選択を受け付ける(ステップS60)。そして、選択された画像を、インクヘッド211や紙送りモータ230、キャリッジモータ220等を制御して印刷する(ステップS70)。   When the list of focused images is displayed on the liquid crystal display 145, the CPU 160 accepts selection of an image to be printed from the user via the operation panel 140 (step S60). Then, the selected image is printed by controlling the ink head 211, the paper feed motor 230, the carriage motor 220, and the like (step S70).

以上で説明した印刷処理では、メモリカードMC内の全てのJPEGデータを入力するものとしたが、メモリカードMC内に複数のフォルダが生成されている場合には、ユーザによって指定されたフォルダついてのみJPEGデータを入力するものとしてもよい。   In the printing process described above, all the JPEG data in the memory card MC is input. However, when a plurality of folders are generated in the memory card MC, only the folder designated by the user. JPEG data may be input.

D.ぼやけ判定処理:
図9は、図8に示した印刷処理のステップS30で実行されるぼやけ判定処理のフローチャートである。この処理が開始されると、まず、CPU160は、ぼやけ判定を行うべきブロック(以下、「注目ブロック」という)をその連なりに沿って移動する(ステップS100)。最初の移動先は、JPEGデータの最も左上に存在するブロックである。注目ブロックは、ステップS100の処理が実行される度に、右方向へ移動し、右端まで到達すると、次の行の左端に移動する。この注目ブロックの移動順序は、図3や図4に示したブロックの格納順とは独立した順序である。
D. Blur judgment processing:
FIG. 9 is a flowchart of the blur determination process executed in step S30 of the printing process shown in FIG. When this process is started, first, the CPU 160 moves blocks to be subjected to blurring determination (hereinafter referred to as “target block”) along the series (step S100). The first destination is the block that exists at the top left of the JPEG data. The block of interest moves to the right every time the process of step S100 is executed, and when it reaches the right end, it moves to the left end of the next row. The movement order of the block of interest is an order independent of the block storage order shown in FIGS.

次に、CPU160は、現在の注目ブロックの右側および下側に隣接するブロックを既に読み込んだかを判定する(ステップS110)。図6に示したように、隣接したブロックのデータに基づき中央のブロック(注目ブロック)のぼやけ幅と輝度差とを求めるためである。図3または図4のブロックの格納順に従ってブロックを読み込めば、右側と下側のブロックの読み込みが完了していれば、上側と左側に隣接したブロックについての読み込みも完了していると言える。   Next, the CPU 160 determines whether the blocks adjacent to the right side and the lower side of the current block of interest have already been read (step S110). This is because, as shown in FIG. 6, the blur width and luminance difference of the central block (target block) are obtained based on the data of adjacent blocks. If the blocks are read in accordance with the storage order of the blocks in FIG. 3 or FIG. 4, if the reading of the right and lower blocks is completed, it can be said that the reading of the blocks adjacent to the upper and left sides is also completed.

注目ブロックの右側および下側に隣接するブロックの読み込みが完了していなければ(ステップS110:No)、CPU160は、JPEGデータから、図3または図4に示した順序に従ってブロックデータを一つ読み込む(ステップS120)。JPEGデータのヘッダ情報には、どの並び順でブロックが格納されているかを示す情報が記録されているため、CPU160は、かかる情報を解析することで、ブロックの読み込み順を判別することができる。   If the reading of the blocks adjacent to the right side and the lower side of the target block has not been completed (step S110: No), the CPU 160 reads one block data from the JPEG data according to the order shown in FIG. 3 or FIG. Step S120). Since the header information of JPEG data records information indicating in which order the blocks are stored, the CPU 160 can determine the reading order of the blocks by analyzing the information.

ブロックを一つ読み込むと、CPU160は、そのブロックデータに対して、逆ハフマン符号化、逆量子化を行った上で、係数抽出部162によって8×8個の係数群の中から、水平方向の第1の係数群と、垂直方向の第2の係数群とを抽出する(ステップS130)。具体的には、図5に示した「F01」から「F07」までのDCT係数を第1の係数群として抽出し、「F10」から「F70」までのDCT係数を第2の係数群として抽出する。   When one block is read, the CPU 160 performs inverse Huffman coding and inverse quantization on the block data, and then uses the coefficient extraction unit 162 to select a horizontal direction from the 8 × 8 coefficient group. The first coefficient group and the second coefficient group in the vertical direction are extracted (step S130). Specifically, the DCT coefficients from “F01” to “F07” shown in FIG. 5 are extracted as the first coefficient group, and the DCT coefficients from “F10” to “F70” are extracted as the second coefficient group. To do.

次に、CPU160は、パターン照合部163を用いて、エッジパターン照合処理を実行する(ステップS140)。この処理は、上記ステップS130によって抽出された第1の係数群と第2の係数群とが表す水平方向および垂直方向の勾配形状に近似する基本エッジパターンを、エッジパターンテーブル181から選出するための処理である(詳細な処理内容については後述)。かかる処理によって近似する基本エッジパターンが選出されれば、その基本エッジパターンに割り振られたパターン番号が、RAM170に確保したパターン番号バッファ171に保存される。   Next, the CPU 160 executes edge pattern matching processing using the pattern matching unit 163 (step S140). In this process, a basic edge pattern that approximates the horizontal and vertical gradient shapes represented by the first coefficient group and the second coefficient group extracted in step S130 is selected from the edge pattern table 181. It is a process (detailed processing content will be described later). If an approximate basic edge pattern is selected by such processing, the pattern number assigned to the basic edge pattern is stored in the pattern number buffer 171 secured in the RAM 170.

図10は、JPEGデータに1行単位でブロックが記録されている場合に確保されたパターン番号バッファ171の一例を示す説明図である。この図には、パターン番号バッファ171に加えて、縦累積バッファ173と横累積バッファ174の一例も併せて示している。図示するように、JPEGデータに1行単位でブロックが格納されている場合には、パターン番号バッファ171は、水平方向および垂直方向についてのパターン番号をブロック2行分記憶することができる。図中には、水平方向のパターン番号(A2,A4,B1,C6,・・・)が、注目ブロックの下側に隣接するブロックまで記録されている例を示している。なお、図示は省略しているが、ステップS140で実行されるエッジパターン照合処理では、ブロック内の輝度差DYも算出されるため、かかる輝度差DYも、パターン番号と共にパターン番号バッファ171に記録される。   FIG. 10 is an explanatory diagram showing an example of the pattern number buffer 171 secured when a block is recorded in JPEG data in units of one line. In this figure, in addition to the pattern number buffer 171, examples of the vertical accumulation buffer 173 and the horizontal accumulation buffer 174 are also shown. As shown in the figure, when blocks are stored in JPEG data in units of one line, the pattern number buffer 171 can store the pattern numbers in the horizontal direction and the vertical direction for two blocks. In the figure, an example is shown in which horizontal pattern numbers (A2, A4, B1, C6,...) Are recorded up to a block adjacent to the lower side of the target block. Although not shown in the figure, in the edge pattern matching process executed in step S140, the luminance difference DY in the block is also calculated, so the luminance difference DY is also recorded in the pattern number buffer 171 together with the pattern number. The

JPEGデータに1行単位でブロックが格納されている場合には、上記ステップS100における処理では、図10に示したパターン番号バッファ171内を注目ブロックが左から右方向に移動するものとする。つまり、注目ブロックは、パターン番号バッファ171内の1行目を順次左から右に移動していく。そして、右端まで移動が完了すれば、再び、1行目の左端に移動する。このとき、パターン番号バッファ171の2行目に記録されていたパターン番号が、1行繰り上がって記録され、2行目については、パターン番号はクリアされる。そして、この2行目に順次、次のエッジパターン照合処理によって取得されたパターン番号が記録されていく。このように、注目ブロックが右端に移動した場合にパターン番号バッファ171の行を繰り上げて次のパターン番号を記録していけば、注目ブロックは相対的に画像の下側に移動することになる。   When blocks are stored in JPEG data in units of one line, it is assumed that the block of interest moves from the left to the right in the pattern number buffer 171 shown in FIG. In other words, the target block sequentially moves from the left to the right in the first row in the pattern number buffer 171. When the movement to the right end is completed, the movement is again made to the left end of the first row. At this time, the pattern number recorded in the second line of the pattern number buffer 171 is moved up by one line and recorded, and the pattern number is cleared for the second line. Then, the pattern numbers acquired by the next edge pattern matching process are sequentially recorded on the second line. In this way, when the block of interest moves to the right end, if the next pattern number is recorded by moving up the row of the pattern number buffer 171, the block of interest moves relatively to the lower side of the image.

JPEGデータに対して1行単位でブロックが格納されている場合において、注目ブロックの右側と下側に隣接するブロックが既に読み込まれているか否かを判断するには、図10を見れば明らかなように、最低、ブロック2行分のパターン番号が記録されていれば足りる。従って、本実施例では、JPEGデータに対して1行単位でブロックが格納されている場合には、ブロック2行分のパターン番号が記録可能なパターン番号バッファ171を用意するのである。こうすることにより、JPEGデータに含まれる全てのブロック分のパターン番号を記憶する必要が無くなり、必要なメモリ容量を削減することができる。   When blocks are stored in units of one row for JPEG data, it is obvious from FIG. 10 to determine whether adjacent blocks on the right side and lower side of the target block have already been read. Thus, it is sufficient that at least the pattern numbers for two rows of blocks are recorded. Therefore, in this embodiment, when a block is stored in units of one line for JPEG data, a pattern number buffer 171 capable of recording pattern numbers for two lines of blocks is prepared. By doing so, it is not necessary to store the pattern numbers for all the blocks included in the JPEG data, and the necessary memory capacity can be reduced.

図11は、JPEGデータに2行単位でブロックが記録されている場合に確保されたパターン番号バッファ171の一例を示す説明図である。図示するように、この場合には、パターン番号バッファ171には、ブロック3行分のパターン番号の記憶領域が用意される。   FIG. 11 is an explanatory diagram showing an example of the pattern number buffer 171 secured when blocks are recorded in JPEG data in units of two lines. As shown in the figure, in this case, the pattern number buffer 171 is provided with a storage area for pattern numbers corresponding to three rows of blocks.

JPEGデータに2行単位でブロックが格納されている場合において、注目ブロックが画像中の1行目に位置する場合には、上記ステップS100では、図11(a)に示すように、注目ブロックはパターン番号バッファ171内の1行目を右方向に移動する。そして、右端まで移動が完了すれば、再び、1行目の左端に移動する。このとき、パターン番号バッファの2行目に記録されていたパターン番号が、1行繰り上がって記録され、2行目については、パターン番号はクリアされる。そして、図11(b)に示すように、2行目と3行目とを用いて、エッジパターン照合処理によって取得されたパターン番号が図4に示した並び順に従って2行毎に記録されていく。   When blocks are stored in JPEG data in units of two lines, if the block of interest is located on the first row in the image, in step S100, as shown in FIG. The first line in the pattern number buffer 171 is moved to the right. When the movement to the right end is completed, the movement is again made to the left end of the first row. At this time, the pattern number recorded in the second line of the pattern number buffer is moved up by one line and recorded, and the pattern number is cleared for the second line. Then, as shown in FIG. 11B, using the second and third lines, the pattern numbers acquired by the edge pattern matching process are recorded every two lines according to the arrangement order shown in FIG. Go.

JPEGデータに対して2行単位でブロックが格納されている場合において、注目ブロックの右側と下側に隣接するブロックが既に読み込まれているか否かを判断するには、図11(b)を見れば明らかなように、最低、ブロック3行分のパターン番号が必要である。図11(b)には、パターン番号バッファ171内の1行目の注目ブロック(図中のパターン番号:C2)について右側および下側のブロックが記録されている例を示しているが、図4に示した格納順に従えば、現在の行の2行先のブロックが読み込まれないと、注目ブロックの下側のブロック(図中のパターン番号:A7)が読み込まれないからである。従って、本実施例では、JPEGデータに対して2行単位でブロックが格納されている場合には、ブロック3行分のパターン番号が記憶可能なパターン番号バッファ171を用意するのである。   To determine whether or not adjacent blocks on the right and bottom sides of the target block have already been read when JPEG data is stored in units of two rows, see FIG. 11B. As is clear, at least a pattern number for three rows of blocks is required. FIG. 11B shows an example in which the right and lower blocks of the target block (pattern number: C2 in the figure) in the first row in the pattern number buffer 171 are recorded. This is because the lower block (pattern number: A7 in the figure) is not read unless the second block ahead of the current row is read according to the storage order shown in FIG. Therefore, in this embodiment, when a block is stored in units of two rows for JPEG data, a pattern number buffer 171 capable of storing pattern numbers for three rows of blocks is prepared.

なお、図10および図11には、ブロック1行分の垂直方向の累積ぼやけ幅CWや累積輝度差ADYを保存するための縦累積バッファ173と、ブロック1つ分の水平方向の累積ぼやけ幅CWや累積輝度差ADYを保存するための横累積バッファ174とを示しているが、これらのバッファの利用方法については後述する。   FIGS. 10 and 11 show a vertical cumulative buffer 173 for storing the vertical cumulative blur width CW and cumulative luminance difference ADY for one block, and a horizontal cumulative blur width CW for one block. The horizontal cumulative buffer 174 for storing the cumulative luminance difference ADY is shown. A method of using these buffers will be described later.

ここで説明を図9に戻す。上記ステップS140のエッジパターン照合処理によって、ステップS120で読み込んだブロックのパターン番号をパターン番号バッファ171に保存すると、CPU160は、再度、上記ステップS110の処理を実行することで、現在の注目ブロックの右側および下側に隣接するブロックを読み込んだか否かを判断する。かかる処理によっても、なお、これらのブロックが読み込まれていないと判断されれば、右側および下側に隣接するブロックが読み込まれるまで、上記ステップS120からステップS140までの処理が繰り返され、パターン番号バッファ171にパターン番号が保存されていくことになる。   Here, the description returns to FIG. When the pattern number of the block read in step S120 is stored in the pattern number buffer 171 by the edge pattern matching process in step S140, the CPU 160 executes the process in step S110 again, so that the right side of the current block of interest And it is determined whether or not a block adjacent to the lower side has been read. Even if it is determined that these blocks have not been read by such processing, the processing from step S120 to step S140 is repeated until the adjacent blocks on the right side and the lower side are read, and the pattern number buffer The pattern number is stored in 171.

上記ステップS110において、注目ブロックの右側および下側に隣接するブロックが読み込まれた判断されれば(ステップS110:Yes)、CPU160は、パターン番号バッファ171と縦累積バッファ173と横累積バッファ174とを参照してエッジ連結部164によって、エッジ連結処理を実行する(ステップS150)。このエッジ連結処理の詳細は後述するが、このエッジ連結処理では、隣接ブロック同士のぼやけ幅が累積加算され、注目ブロックのぼやけ幅が算出されることになる。   If it is determined in step S110 that adjacent blocks on the right side and the lower side of the target block have been read (step S110: Yes), the CPU 160 uses the pattern number buffer 171, the vertical accumulation buffer 173, and the horizontal accumulation buffer 174. With reference to the edge connecting unit 164, an edge connecting process is executed (step S150). Although details of the edge linking process will be described later, in this edge linking process, the blur widths of adjacent blocks are cumulatively added, and the blur width of the target block is calculated.

エッジ連結処理によって注目ブロックのぼやけ幅が算出されると、次に、CPU160は、ブロックぼやけ判定部165を用いて、ブロックぼやけ判定処理を実行する(ステップS160)。この処理は、エッジ連結処理によって算出されたぼやけ幅に基づき、注目ブロックがぼやけているか否かを判定するための処理である。この処理の詳細についても後述するが、かかる処理の実行結果としては、注目ブロックが「ぼやけブロック」であるか「合焦ブロック」であるかが判定結果として取得される。   When the blur width of the block of interest is calculated by the edge linking process, the CPU 160 then executes the block blur determination process using the block blur determination unit 165 (step S160). This process is a process for determining whether or not the block of interest is blurred based on the blur width calculated by the edge connection process. Although details of this process will be described later, as the execution result of this process, whether the target block is a “blurred block” or a “focus block” is acquired as a determination result.

ブロックぼやけ判定処理によって、注目ブロックが「ぼやけブロック」であるか「合焦ブロック」であるかが判定されると、CPU160は、現在の注目ブロックが、どのサブウィンドウ(図7参照)内に位置しているかを求め、そのサブウィンドウ毎に合焦ブロックの数を累積加算する(ステップS170)。図7では、1つのサブウィンドウ内に、ブロックが7個×7個の計49個存在している例を示しているため、この場合、かかる処理による累積加算値は最高で「49」となる。合焦ブロックの累積加算値は、RAM170に確保した合焦ブロック数バッファ172に記録する。   When the block blur determination process determines whether the target block is a “blurred block” or “focused block”, the CPU 160 determines in which sub-window (see FIG. 7) the current target block is located. And the cumulative number of in-focus blocks is added for each sub-window (step S170). FIG. 7 shows an example in which a total of 49 blocks of 7 × 7 are present in one sub-window. In this case, the cumulative added value by such processing is “49” at the maximum. The cumulative added value of the focused block is recorded in the focused block number buffer 172 secured in the RAM 170.

図12は、合焦ブロック数バッファ172の一例を示す説明図である。本実施例では、最終的にサブウィンドウ4×4個分に相当するウィンドウ領域についてぼやけているか否かを判断するため、合焦ブロック数バッファ172には図示するように、サブウィンドウ4行分の記憶領域を用意する。上記ステップS170では、現在の注目ブロックが属するサブウィンドウに対応する記憶領域に合焦ブロックの数が累積加算される。かかる累積値は、合焦ブロック数バッファ172の、4行目から図中に示した「a」「b」「c」・・・の順に記録される。現在の注目ブロックが属するサブウィンドウが、合焦ブロック数バッファ172の右端に移動した場合には、かかる合焦ブロック数バッファ172の4行目の値は、3行目に繰り上がり、同様に他の行も1行ずつ繰り上がる。そして、4行目のバッファ領域はクリアされ、かかる領域に次の合焦ブロック数が記録されていく。   FIG. 12 is an explanatory diagram showing an example of the focused block number buffer 172. In this embodiment, in order to finally determine whether or not the window area corresponding to 4 × 4 sub-windows is blurred, the in-focus block number buffer 172 has a storage area for four rows of sub-windows as shown in the figure. Prepare. In step S170, the number of focused blocks is cumulatively added to the storage area corresponding to the subwindow to which the current block of interest belongs. The accumulated values are recorded in the order of “a”, “b”, “c”,... Shown in the figure from the fourth line of the focused block number buffer 172. When the subwindow to which the current block of interest belongs moves to the right end of the focused block number buffer 172, the value in the fourth row of the focused block number buffer 172 is moved up to the third row, Lines are also moved up line by line. Then, the buffer area in the fourth row is cleared, and the next focused block number is recorded in this area.

説明を図9に戻す。ステップS170によってサブウィンドウ毎に合焦ブロック数を累積加算した後、CPU160は、いずれか1つのサブウィンドウについて合焦ブロック数の集計が完了したか否かを判断する(ステップS180)。そして、1サブウィンドウ分の集計が完了していないと判断されれば(ステップS180:No)、CPU160は、ステップS100に処理を戻し、注目ブロックを移動して、引き続き、次のブロックについて、「ぼやけブロック」であるか「合焦ブロック」であるかを判断していく。一方、1サブウィンドウ分の集計が完了したと判断されれば、CPU160は、そのサブウィンドウが属するウィンドウ領域全体について、ウィンドウぼやけ判定部166を用いてウィンドウぼやけ判定処理を行う(ステップ190)。このウィンドウぼやけ判定処理では、図12に示した合焦ブロック数バッファ172において、ウィンドウ領域を順次横方向に移動していき、そのウィンドウ領域内の合焦ブロック数に総計に基づき、そのウィンドウ領域がぼやけているか否かを判定する。かかる処理の詳細については後述する。   Returning to FIG. After accumulating and adding the number of in-focus blocks for each sub-window in step S170, CPU 160 determines whether or not the total number of in-focus blocks has been completed for any one sub-window (step S180). If it is determined that the aggregation for one sub-window has not been completed (step S180: No), the CPU 160 returns the process to step S100, moves the block of interest, and continues to “blurred” for the next block. It is determined whether it is a “block” or a “focus block”. On the other hand, if it is determined that the aggregation for one sub-window has been completed, the CPU 160 performs window blur determination processing using the window blur determination unit 166 for the entire window region to which the sub-window belongs (step 190). In this window blur determination process, the window area is sequentially moved in the horizontal direction in the focused block number buffer 172 shown in FIG. 12, and the window area is determined based on the total number of focused blocks in the window area. Judge whether it is blurry or not. Details of this processing will be described later.

上記ステップS190においてウィンドウぼやけ判定処理が終了すると、CPU160は、この判定処理の判定結果に基づき、現在のウィンドウ領域が合焦ウィンドウであるか否かを判定する(ステップS200)。この判定の結果、そのウィンドウが合焦ウィンドウであれば(ステップS200:Yes)、現在入力しているJPEGデータによって表される画像が合焦していると判定し(ステップS210)、上述した一連のぼやけ判定処理を終了する。つまり、画像内のいずれかのウィンドウ領域が合焦ウィンドウであると判定された時点で、図8のステップS10で入力したJPEGデータが合焦画像であると判断することになる。こうすることで、画像内のいずれかのウィンドウ領域が合焦ウィンドウであれば、画像内のすべての領域についてぼやけの有無を判定する必要がないため、処理時間を短縮することができる。   When the window blur determination process ends in step S190, the CPU 160 determines whether or not the current window area is a focused window based on the determination result of the determination process (step S200). If the result of this determination is that the window is an in-focus window (step S200: Yes), it is determined that the image represented by the currently input JPEG data is in focus (step S210), and the series described above. The blur determination process is terminated. That is, when it is determined that any window area in the image is a focused window, it is determined that the JPEG data input in step S10 in FIG. 8 is a focused image. In this way, if any window region in the image is a focused window, it is not necessary to determine the presence or absence of blurring for all the regions in the image, so that the processing time can be shortened.

これに対して、上記ステップS200においてウィンドウぼやけ判定処理を行ったウィンドウ領域が、ぼやけウィンドウであると判定された場合には(ステップS200:No)、CPU160は、続いて、現在の注目ブロックが、画像の右下隅の最終ブロックであるかを判断する(ステップS220)。この結果、現在の注目ブロックが、最終ブロックであると判断されれば(ステップS220:Yes)、どのウィンドウ領域も合焦ウィンドウではなかったと判断できるため、現在入力しているJPEGデータによって表される画像はぼやけ画像であると判定して(ステップS230)、上述した一連のぼやけ判定処理を終了する。一方、現在の注目ブロックが最終ブロックでなければ(ステップS220:No)、CPU160は、上記ステップS100へ処理を戻し、次の位置のブロックについて、上述した種々の処理を繰り返し実行する。   On the other hand, when it is determined that the window area subjected to the window blur determination process in step S200 is a blur window (step S200: No), the CPU 160 subsequently determines that the current block of interest is It is determined whether it is the last block in the lower right corner of the image (step S220). As a result, if it is determined that the current block of interest is the final block (step S220: Yes), it can be determined that no window area is a focused window, and therefore it is represented by the currently input JPEG data. It is determined that the image is a blurred image (step S230), and the above-described series of blur determination processing ends. On the other hand, if the current block of interest is not the final block (step S220: No), the CPU 160 returns the process to step S100, and repeatedly executes the various processes described above for the block at the next position.

E.エッジパターン照合処理:
図13は、図9に示したぼやけ判定処理のステップS140で実行されるエッジパターン照合処理の詳細なフローチャートである。この処理は、各ブロックの水平方向および垂直方向の勾配形状に近似する基本エッジパターンをエッジパターンテーブル181から選出するとともに、ブロック内の輝度差を算出するための処理である。
E. Edge pattern matching process:
FIG. 13 is a detailed flowchart of the edge pattern matching process executed in step S140 of the blur determination process shown in FIG. This process is a process for selecting a basic edge pattern that approximates the horizontal and vertical gradient shapes of each block from the edge pattern table 181 and calculating a luminance difference within the block.

この処理が実行されると、まず、CPU160は、ぼやけ判定処理のステップS130で抽出した第1の係数群と第2の係数群と(図5参照)を取得する(ステップS300)。当該エッジパターン照合処理では、第1の係数群と第2の係数群とについてそれぞれ同様の処理が実行されるため、以下では、これらを代表して、水平方向のDCT係数を表す第1の係数群に対する処理を説明する。   When this process is executed, first, the CPU 160 acquires the first coefficient group and the second coefficient group (see FIG. 5) extracted in step S130 of the blur determination process (step S300). In the edge pattern matching processing, the same processing is executed for each of the first coefficient group and the second coefficient group. Accordingly, in the following, the first coefficient representing the DCT coefficient in the horizontal direction will be representatively represented. Processing for the group will be described.

CPU160は、上記ステップS300によって、第1の係数群を取得すると、この第1の係数群を構成する各係数F01〜F07の絶対値の和を求め、これが所定の平坦閾値(例えば、80)を超えるか否かを判定する(ステップS310)。第1の係数群の絶対値の和Sは、下記式(1)によって求めることができる。   When the CPU 160 acquires the first coefficient group in step S300, the CPU 160 obtains a sum of absolute values of the coefficients F01 to F07 constituting the first coefficient group, and this obtains a predetermined flat threshold (for example, 80). It is determined whether or not it exceeds (step S310). The sum S of absolute values of the first coefficient group can be obtained by the following equation (1).

S=Σ|F0i| (i=1〜7) ・・・(1) S = Σ | F0i | (i = 1-7) (1)

上記ステップS310において、第1の係数群の絶対値の和Sが所定の平坦閾値以下であると判断されれば(ステップS310:No)、そのブロックの水平方向の輝度変化は、平坦であると見なすことができる。従って、かかるブロックのエッジパターンのパターン番号を、平坦なエッジパターンであることを表す「0」と決定する(ステップS320)。   If it is determined in step S310 that the sum S of absolute values of the first coefficient group is equal to or less than a predetermined flat threshold value (step S310: No), the luminance change in the horizontal direction of the block is flat. Can be considered. Accordingly, the pattern number of the edge pattern of the block is determined as “0” indicating that it is a flat edge pattern (step S320).

上記ステップS310において、第1の係数群の絶対値の和Sが所定の平坦閾値を超えると判断されれば(ステップS310:Yes)、そのブロックの水平方向には、なんらかの輝度変化があると判断できる。そこで、まず、CPU160は、第1の係数群の各係数値F01〜F07について下記式(2)に基づき正規化を行う(ステップS330)。下記式(2)によれば、正規化後の各係数値Fr01〜Fr07は、第1の係数群の絶対値の和Sで、それぞれの係数値F01〜F07を除算した値となる。   If it is determined in step S310 that the sum S of absolute values of the first coefficient group exceeds a predetermined flat threshold (step S310: Yes), it is determined that there is some luminance change in the horizontal direction of the block. it can. Therefore, first, the CPU 160 normalizes the coefficient values F01 to F07 of the first coefficient group based on the following equation (2) (step S330). According to the following equation (2), the normalized coefficient values Fr01 to Fr07 are values obtained by dividing the coefficient values F01 to F07 by the sum S of absolute values of the first coefficient group.

Fr0j=F0j/S (j=1〜7) ・・・(2) Fr0j = F0j / S (j = 1-7) (2)

次に、CPU160は、ROM180に記憶されたエッジパターンテーブル181を参照して(ステップS340)、正規化後の各係数値Fr01〜Fr07によって表される勾配形状がいずれかの基本エッジパターンに近似するかを判断する(ステップS350)。   Next, the CPU 160 refers to the edge pattern table 181 stored in the ROM 180 (step S340), and the gradient shape represented by the normalized coefficient values Fr01 to Fr07 approximates any one of the basic edge patterns. Is determined (step S350).

図14は、エッジパターンテーブル181の一例を示す説明図である。このエッジパターンテーブル181には、「A1」から「A16」までのパターン番号(図の1列目)に対して16種類の基本エッジパターン(図の3列目)が対応付けて記録されている。基本エッジパターンの横軸は、ブロック内の係数の位置(F01〜F07)を表しており、縦軸は、正規化後の係数値Frを表している。つまり、基本エッジパターンは、7つの係数値からなるデータである。   FIG. 14 is an explanatory diagram showing an example of the edge pattern table 181. In the edge pattern table 181, 16 basic edge patterns (third column in the figure) are recorded in association with pattern numbers (first column in the figure) from “A1” to “A16”. . The horizontal axis of the basic edge pattern represents the coefficient positions (F01 to F07) in the block, and the vertical axis represents the normalized coefficient value Fr. That is, the basic edge pattern is data composed of seven coefficient values.

各基本エッジパターンは、図の2列目に示した輝度パターンに基づき生成されている。すなわち、図の2列目に示した輝度パターンをDCT変換して正規化したものが図の3列目に示す基本エッジパターンとなる。なお、図中の輝度パターンは、実際には、エッジパターンテーブル181には記録されておらず、理解の便のために記載している。各輝度パターンは、1ブロック内で傾きの符号が変化しない輝度変化の典型的な形状を、予め16種類に分類したものである。本実施例では、このように、基本エッジパターンを16種類に分類するものとするが、より多くのパターンに分類するものとしてもよい。   Each basic edge pattern is generated based on the luminance pattern shown in the second column of the figure. That is, the basic edge pattern shown in the third column of the figure is obtained by DCT transforming and normalizing the luminance pattern shown in the second column of the figure. Note that the luminance pattern in the figure is not actually recorded in the edge pattern table 181 but is described for convenience of understanding. Each luminance pattern is obtained by classifying typical shapes of luminance changes in which the inclination sign does not change within one block into 16 types in advance. In this embodiment, the basic edge patterns are classified into 16 types as described above, but may be classified into more patterns.

エッジパターンテーブル181には、更に、基本エッジパターンに対応付けて左側エッジ幅LWと、中央エッジ幅MWと、右側エッジ幅RWという3種類のパラメータが記録されている。左側エッジ幅LWは、輝度パターンの左側に存在する平坦部の幅を表しており、右側エッジ幅RWは、輝度パターンの右側に存在する平坦部の幅を表している。また、中央エッジ幅MWは、左側エッジ幅LWと右側エッジ幅RWとに挟まれる勾配部分の幅を表している。   The edge pattern table 181 further records three types of parameters associated with the basic edge pattern: a left edge width LW, a central edge width MW, and a right edge width RW. The left edge width LW represents the width of the flat portion present on the left side of the luminance pattern, and the right edge width RW represents the width of the flat portion present on the right side of the luminance pattern. Further, the center edge width MW represents the width of the gradient portion sandwiched between the left edge width LW and the right edge width RW.

なお、図示を省略しているが、このエッジパターンテーブル181には、「A1」から「A16」までの基本エッジパターンに加え、これらの基本エッジパターンを左右反転させたエッジパターンがパターン番号B1〜B16に定義されており、上下反転させたエッジパターンがパターン番号C1〜C16に定義されている。また、「A1」から「A16」までの基本エッジパターンを上下および左右に反転させたエッジパターンがパターン番号D1〜D16に定義されている。つまり、全体で、64種類の基本エッジパターンがこのエッジパターンテーブル181に定義されている。   Although not shown, the edge pattern table 181 includes, in addition to the basic edge patterns “A1” to “A16”, edge patterns obtained by horizontally inverting these basic edge patterns having pattern numbers B1 to B1. The edge pattern defined in B16 and inverted up and down is defined in pattern numbers C1 to C16. Further, edge numbers obtained by inverting the basic edge patterns “A1” to “A16” vertically and horizontally are defined as pattern numbers D1 to D16. That is, 64 types of basic edge patterns are defined in the edge pattern table 181 as a whole.

図13のステップS350では、ステップS330で正規化を行った各係数値Fr01〜Fr07と、基本エッジパターンを構成する各係数値Fb01〜Fb07との差の絶対値の合計SDを下記式(3)に従って算出し、この合計値SDが最小となる基本エッジパターンをエッジパターンテーブル181の中から選択する。そして、選択された基本エッジパターンについての合計値SDが、所定の閾値よりも小さければ、形状が近似する基本エッジパターンが検索されたと判断して(ステップS350:Yes)、その基本エッジパターンに対応付けられたパターン番号を取得する(ステップS360)。一方、上述した演算によって得られた値SDが、所定の閾値よりも大きい場合には、近似する基本エッジパターンが検索されなかったとして、パターン番号を「不明」とする(ステップS370)。   In step S350 in FIG. 13, the sum SD of the absolute values of the differences between the coefficient values Fr01 to Fr07 normalized in step S330 and the coefficient values Fb01 to Fb07 constituting the basic edge pattern is expressed by the following equation (3). The basic edge pattern having the minimum total value SD is selected from the edge pattern table 181. If the total value SD for the selected basic edge pattern is smaller than a predetermined threshold value, it is determined that a basic edge pattern whose shape approximates has been searched (step S350: Yes), and corresponds to the basic edge pattern. The attached pattern number is acquired (step S360). On the other hand, if the value SD obtained by the above-described calculation is larger than the predetermined threshold value, the pattern number is set to “unknown” because no approximate basic edge pattern has been searched (step S370).

SD=Σ|Fr0k−Fb0k| (k=1〜7) ・・・(3) SD = Σ | Fr0k−Fb0k | (k = 1 to 7) (3)

以上の処理によって、現在のブロックのパターン番号が決定すると、次にCPU160は、ROM180に記録された正規化輝度差テーブル182を参照して(ステップS380)、現在のブロック内の輝度差DYを算出する(ステップS390)。   When the pattern number of the current block is determined by the above processing, the CPU 160 next refers to the normalized luminance difference table 182 recorded in the ROM 180 (step S380), and calculates the luminance difference DY in the current block. (Step S390).

図15は、正規化輝度差テーブル182の一例を示す説明図である。この正規化輝度差テーブル182には、各パターン番号に対応付けて、正規化輝度差値NYが記録されている。この正規化輝度差値NYは、基本エッジパターンが表す輝度パターンの形状に応じて予め計算された輝度差である。上記ステップS390では、この正規化輝度差テーブル182から、上記ステップS360で取得したパターン番号に対応付けられた正規化輝度差値NYを取得する。そして、下記式(4)に従い、取得された正規化輝度差値NYに対して、上記式(1)で算出した各係数の絶対値の和Sを乗じることで、ブロック内の輝度差DYを求める。このように、予め計算された正規化輝度差値NYを用いれば、ブロック内の係数値を逆DCT変換して輝度値を求めることなく、簡便かつ高速にブロック内の輝度差を算出することができる。   FIG. 15 is an explanatory diagram illustrating an example of the normalized luminance difference table 182. In the normalized luminance difference table 182, a normalized luminance difference value NY is recorded in association with each pattern number. The normalized luminance difference value NY is a luminance difference calculated in advance according to the shape of the luminance pattern represented by the basic edge pattern. In step S390, the normalized luminance difference value NY associated with the pattern number acquired in step S360 is acquired from the normalized luminance difference table 182. Then, the luminance difference DY in the block is obtained by multiplying the acquired normalized luminance difference value NY by the sum S of absolute values of the respective coefficients calculated in the above equation (1) according to the following equation (4). Ask. As described above, if the normalized luminance difference value NY calculated in advance is used, the luminance difference in the block can be calculated easily and quickly without obtaining the luminance value by performing inverse DCT conversion on the coefficient value in the block. it can.

DY=S・NY ・・・(4) DY = S · NY (4)

以上の処理によって、現在のブロックのパターン番号と輝度差DYとが決定すると、CPU160は、これらのパラメータを、現在のブロックに対応するパターン番号バッファ171(図10または図11参照)に保存する(ステップS400)。これにより、上述した一連のエッジパターン照合処理は終了し、ぼやけ判定処理のステップS110に処理が戻されることになる。   When the pattern number of the current block and the luminance difference DY are determined by the above processing, the CPU 160 stores these parameters in the pattern number buffer 171 (see FIG. 10 or FIG. 11) corresponding to the current block (see FIG. 10 or FIG. 11). Step S400). As a result, the above-described series of edge pattern matching processing ends, and the processing is returned to step S110 of the blur determination processing.

F.エッジ連結処理:
図16は、図9に示したぼやけ判定処理のステップS150で実行されるエッジ連結処理の詳細なフローチャートである。この処理は、図6に示したように、上下左右に隣接したブロックに基づき、中央のブロック(注目ブロック)のぼやけ幅と輝度差とを決定するための処理である。かかる処理は、水平方向と垂直方向とについて行われるが、説明を簡単にするため、特記しない限り、水平方向に対して行われる処理の説明をする。
F. Edge connection processing:
FIG. 16 is a detailed flowchart of the edge connection process executed in step S150 of the blur determination process shown in FIG. As shown in FIG. 6, this process is a process for determining the blur width and the luminance difference of the central block (target block) based on blocks that are adjacent vertically and horizontally. Such processing is performed in the horizontal direction and the vertical direction, but in order to simplify the description, the processing performed in the horizontal direction will be described unless otherwise specified.

この処理が実行されると、まず、CPU160は、現在の注目ブロックのパターン番号と輝度差DYとをパターン番号バッファ171(図10または図11参照)から取得する(ステップS500)。これらのパラメータは、上記エッジパターン照合処理によってパターン番号バッファ171に記録されたパラメータである。   When this process is executed, the CPU 160 first obtains the pattern number of the current block of interest and the luminance difference DY from the pattern number buffer 171 (see FIG. 10 or FIG. 11) (step S500). These parameters are parameters recorded in the pattern number buffer 171 by the edge pattern matching process.

次に、CPU160は、ステップS500で取得したパターン番号が、「不明」であるかを判断する(ステップS520)。その結果、パターン番号が「不明」であれば(ステップS510:Yes)、上述したエッジパターン照合処理において、現在の注目ブロックの輝度変化が、基本エッジパターンのいずれにも近似しないと判定されていることになるため(図13のステップS350,S370参照)、注目ブロックのぼやけ幅を「不明」と確定する(ステップS520)。こうして確定したぼやけ幅を、以下では、「確定ぼやけ幅DW」というものとする。   Next, CPU 160 determines whether or not the pattern number acquired in step S500 is “unknown” (step S520). As a result, if the pattern number is “unknown” (step S510: Yes), it is determined in the above-described edge pattern matching process that the luminance change of the current block of interest does not approximate any of the basic edge patterns. Therefore (see steps S350 and S370 in FIG. 13), the blur width of the block of interest is determined as “unknown” (step S520). Hereinafter, the determined blur width is referred to as a “determined blur width DW”.

上記ステップS510において、パターン番号が「不明」ではないと判断されれば(ステップS510:No)、次に、CPU160は、パターン番号が「0」であるかを判断する(ステップS530)。この判断の結果、パターン番号が「0」であれば(ステップS530:Yes)、上述したエッジパターン照合処理において、現在の注目ブロックの水平方向の輝度変化が平坦であると判定されていることになるため(図13のステップS310,S320参照)、注目ブロックの確定ぼやけ幅DWを「0」に決定する(ステップS550)。   If it is determined in step S510 that the pattern number is not “unknown” (step S510: No), then the CPU 160 determines whether the pattern number is “0” (step S530). If the pattern number is “0” as a result of this determination (step S530: Yes), it is determined that the luminance change in the horizontal direction of the current block of interest is flat in the edge pattern matching process described above. Therefore (see steps S310 and S320 in FIG. 13), the determined blur width DW of the block of interest is determined to be “0” (step S550).

上記ステップS530において、パターン番号が「0」ではないと判断されれば(ステップS530:No)、CPU160は、注目ブロックの右側(垂直方向のエッジ連結処理の場合には下側)に隣接するブロック(以下、「隣接ブロックという」)のパターン番号をパターン番号バッファ171(図10または図11参照)から取得する(ステップS510)。そして、注目ブロックのパターン番号と、隣接ブロックのパターン番号とを対比して、これらのブロックの基本エッジパターンの傾き方向が一致するかを判断する(ステップS560)。   If it is determined in step S530 that the pattern number is not “0” (step S530: No), the CPU 160 blocks adjacent blocks on the right side of the target block (lower side in the case of vertical edge connection processing). The pattern number (hereinafter referred to as “adjacent block”) is acquired from the pattern number buffer 171 (see FIG. 10 or FIG. 11) (step S510). Then, by comparing the pattern number of the target block with the pattern number of the adjacent block, it is determined whether the inclination directions of the basic edge patterns of these blocks match (step S560).

図17は、注目ブロックと隣接ブロックとで基本エッジパターンの傾き方向が一致する例を示す説明図である。図示した例では、両ブロックの傾きは、共に右下がりであるため、両者の傾き方向は一致しているといえる。注目ブロックと隣接ブロックの傾き方向が一致する組み合わせとしては、以下のようなパターン番号の組み合わせがある。つまり、CPU160は、注目ブロックのパターン番号と隣接ブロックのパターン番号の組み合わせが、以下に示す(1)から(8)のいずれかの組み合わせに含まれれば、これらの傾き方向が一致すると判断することができる。   FIG. 17 is an explanatory diagram illustrating an example in which the inclination directions of the basic edge patterns match between the target block and the adjacent block. In the example shown in the figure, since the slopes of both blocks are downwardly inclined to the right, it can be said that the slope directions of both blocks coincide. As combinations in which the inclination directions of the target block and the adjacent blocks match, there are the following pattern number combinations. That is, if the combination of the pattern number of the target block and the pattern number of the adjacent block is included in any one of the combinations (1) to (8) shown below, the CPU 160 determines that these inclination directions match. Can do.

注目ブロックNo. 隣接ブロックNo.
(1)A1〜A16 A1〜A16
(2)A1〜A16 D1〜D16
(3)B1〜B16 B1〜B16
(4)B1〜B16 C1〜C16
(5)C1〜C16 C1〜C16
(6)C1〜C16 B1〜B16
(7)D1〜D16 D1〜D16
(8)D1〜D16 A1〜A16
Attention block No. Adjacent block No.
(1) A1-A16 A1-A16
(2) A1-A16 D1-D16
(3) B1-B16 B1-B16
(4) B1-B16 C1-C16
(5) C1-C16 C1-C16
(6) C1-C16 B1-B16
(7) D1 to D16 D1 to D16
(8) D1 to D16 A1 to A16

図18は、注目ブロックと隣接ブロックとで基本エッジパターンの傾き方向が一致しない例を示す説明図である。図示した例では、注目ブロックの傾きが右下がりであるのに対して、隣接ブロックの傾きが右上がりであることから、両者の傾きは一致していないと言える。両ブロックの傾き方向が一致しないパターン番号の組み合わせは、上述した(1)から(8)以外の組み合わせである。   FIG. 18 is an explanatory diagram illustrating an example in which the inclination directions of the basic edge pattern do not match between the target block and the adjacent block. In the illustrated example, the inclination of the block of interest is lower right, whereas the inclination of the adjacent block is upper right, it can be said that the inclinations of both do not match. Combinations of pattern numbers in which the inclination directions of both blocks do not match are combinations other than (1) to (8) described above.

上記ステップS560において、傾き方向が一致すると判断された場合には(ステップS560:Yes)、CPU160は、続いて、注目ブロックの右側エッジ幅RWと、隣接ブロックの左側エッジ幅LWの加算値が、所定の連結誤差閾値以内であるかを判定する(ステップS570)。なお、この判定に先立ち、CPU160は、隣接ブロックのパターン番号から、エッジパターンテーブル181を参照して、その左側エッジ幅LWを取得するものとする。   If it is determined in step S560 that the inclination directions are the same (step S560: Yes), the CPU 160 continues to add the right edge width RW of the target block and the left edge width LW of the adjacent block. It is determined whether it is within a predetermined connection error threshold (step S570). Prior to this determination, the CPU 160 obtains the left edge width LW with reference to the edge pattern table 181 from the pattern number of the adjacent block.

図19は、注目ブロックの右側エッジ幅RWと隣接ブロックの左側エッジ幅LWの加算値と連結誤差閾値との比較の様子を示す説明図である。図示するように、注目ブロックの基本エッジパターンの右側に存在する平坦部(右側エッジ幅RW)と、隣接ブロックの基本エッジパターンの左側に存在する平坦部(左側エッジ幅LW)との和が大きく、連結誤差閾値を超えるような場合には、注目ブロックと隣接ブロックとでは勾配が連続せず、別々のぼやけ部分を形成していると判断することができる。そのため、上記ステップS570では、「No」と判定される。これに対して、上述した和が小さく、連結誤差閾値以下となる場合には、注目ブロックのエッジパターンと隣接ブロックのエッジパターンとは連続した勾配であると考えることができるため、上記ステップS570では、「Yes」と判定される。   FIG. 19 is an explanatory diagram showing a state of comparison between the added value of the right edge width RW of the target block and the left edge width LW of the adjacent block and the connection error threshold. As shown in the drawing, the sum of the flat portion (right edge width RW) present on the right side of the basic edge pattern of the target block and the flat portion (left edge width LW) present on the left side of the basic edge pattern of the adjacent block is large. When the connection error threshold is exceeded, it can be determined that the gradient is not continuous between the target block and the adjacent block, and separate blurred portions are formed. Therefore, it is determined as “No” in step S570. On the other hand, when the above-described sum is small and is equal to or less than the connection error threshold, it can be considered that the edge pattern of the block of interest and the edge pattern of the adjacent block have a continuous gradient. , “Yes”.

上記ステップS570において、注目ブロックの右側エッジ幅RWと、隣接ブロックの左側エッジ幅LWの加算値が、所定の連結誤差閾値以内であると判定されれば(ステップS570:Yes)、CPU160は、これまで左側(垂直方向のエッジ連結処理にあっては、上側)のブロックに累積されている累積ぼやけ幅CWと累積輝度差ADYとを横累積バッファ174(垂直方向のエッジ連結処理にあっては、縦累積バッファ173)(図10,11参照)から読み込む。そして、この累積ぼやけ幅CWに注目ブロックの左側エッジ幅LWと中央エッジ幅MWとを加算するとともに、累積輝度差ADYに注目ブロックの輝度差DYを加算する処理を行う(ステップS580)。こうして新たな累積ぼやけ幅CWと累積輝度差ADYとを求めると、CPU160は、新たな値を横累積バッファ174(垂直方向のエッジ連結処理にあっては縦累積バッファ173)に上書きして更新する(図10,11参照)。こうすることで、隣接ブロック同士でエッジパターンの傾きが一方向に連続していく場合には、各ブロックのぼやけ幅と輝度差とを順次累積していくことができる。なお、上記ステップS580では、CPU160は、注目ブロックの確定ぼやけ幅DWを便宜的に「0」と決定する。つまり、ぼやけ幅を累積する場合には、その累積途中のブロックについては、一律に平坦なブロックであるとみなすのである。   If it is determined in step S570 that the added value of the right edge width RW of the target block and the left edge width LW of the adjacent block is within a predetermined connection error threshold (step S570: Yes), the CPU 160 The accumulated blur width CW and the accumulated luminance difference ADY accumulated in the block on the left side (upper in the case of vertical edge connection processing) are converted into the horizontal accumulation buffer 174 (in the vertical edge connection processing, Read from the vertical accumulation buffer 173) (see FIGS. 10 and 11). Then, the left edge width LW and the central edge width MW of the block of interest are added to the accumulated blur width CW, and the luminance difference DY of the block of interest is added to the accumulated luminance difference ADY (step S580). When the new cumulative blur width CW and the cumulative luminance difference ADY are obtained in this way, the CPU 160 overwrites and updates the new value in the horizontal cumulative buffer 174 (vertical cumulative buffer 173 in the case of vertical edge connection processing). (See FIGS. 10 and 11). In this way, when the inclination of the edge pattern between adjacent blocks continues in one direction, the blur width and luminance difference of each block can be accumulated sequentially. In step S580, CPU 160 determines the determined blur width DW of the block of interest as “0” for convenience. That is, when the blur width is accumulated, the block in the middle of accumulation is regarded as a flat block.

図20は、上記ステップS580における累積ぼやけ幅CWの算出概念を示す説明図である。図示するように、上記ステップS580では、これまでの累積ぼやけ幅CWに対して、注目ブロックの左側エッジ幅LWと中央エッジ幅MWとを加算した値を、新たな累積ぼやけ幅CWとする。なお、かかる演算に先立ち、CPU160は、エッジパターンテーブル181を参照して、注目ブロックのパターン番号に対応する左側エッジ幅LWと中央エッジ幅MWとを取得するものとする。   FIG. 20 is an explanatory diagram showing the concept of calculating the cumulative blur width CW in step S580. As shown in the drawing, in step S580, a value obtained by adding the left edge width LW and the central edge width MW of the block of interest to the cumulative blur width CW so far is set as a new cumulative blur width CW. Prior to this calculation, the CPU 160 refers to the edge pattern table 181 to obtain the left edge width LW and the central edge width MW corresponding to the pattern number of the block of interest.

上記ステップS560において、注目ブロックの傾き方向と隣接ブロックの傾き方向とが一致しないと判断された場合(ステップS560:No)、もしくは、上記ステップS570において、注目ブロックの右側エッジ幅RWと隣接ブロックの左側エッジ幅LWとの和が連結誤差閾値を超えると判断された場合(ステップS570:No)には、CPU160は、続いて、累積輝度差ADYを用いて注目ブロックが平坦であるか否かを判断する処理を行う。すなわち、まず、横累積バッファ174(垂直方向のエッジ連結処理にあっては、縦累積バッファ173)から累積輝度差ADYを読み込んで、この累積輝度差ADYと注目ブロックの輝度差DYとの和を求める(ステップS590)。そして、この和が、所定の累積輝度差閾値(例えば、「32」)未満となるかを判断する(ステップS600)。この判断によって、累積輝度差ADYが所定の累積輝度差閾値未満であると判断されれば(ステップS600:Yes)、これまで輝度差DYを累積したにもかかわらず、その累積値が十分ではなく、注目ブロックの輝度変化は平坦であると判断して、その確定ぼやけ幅DWを「0」とする(ステップS610)。かかる処理によれば、エッジパターンに基づく判断だけではなく、輝度差によっても、ブロックが平坦であるか否かを判断することができるため、より精度良く、画像内のぼやけの有無を判断することが可能になる。   When it is determined in step S560 that the inclination direction of the target block does not match the inclination direction of the adjacent block (step S560: No), or in step S570, the right edge width RW of the target block and the adjacent block When it is determined that the sum with the left edge width LW exceeds the connection error threshold (step S570: No), the CPU 160 subsequently determines whether or not the target block is flat using the accumulated luminance difference ADY. The process to judge is performed. That is, first, the accumulated luminance difference ADY is read from the horizontal accumulation buffer 174 (or the vertical accumulation buffer 173 in the case of vertical edge connection processing), and the sum of the accumulated luminance difference ADY and the luminance difference DY of the target block is calculated. Obtained (step S590). Then, it is determined whether this sum is less than a predetermined cumulative luminance difference threshold (for example, “32”) (step S600). If it is determined by this determination that the accumulated luminance difference ADY is less than the predetermined accumulated luminance difference threshold (step S600: Yes), the accumulated value is not sufficient even though the luminance difference DY has been accumulated so far. Then, it is determined that the luminance change of the block of interest is flat, and the determined blur width DW is set to “0” (step S610). According to such processing, it is possible to determine whether or not the block is flat not only based on the determination based on the edge pattern but also based on the luminance difference. Is possible.

上記ステップS600において、累積輝度差ADYが累積輝度差閾値を超えると判断されれば(ステップS600:No)、注目ブロックは平坦なエッジパターンではないと判断できる。そこで、CPU160は、続いて、横累積バッファ174(垂直方向のエッジ連結処理にあっては、縦累積バッファ173)から読み込んだ累積ぼやけ幅CWが「0」であるかを判断する(ステップS620)。この判断によって累積ぼやけ幅CWが「0」であると判断されれば(ステップS620:Yes)、注目ブロックはぼやけの生じる開始点であり、更に、上記ステップS560,S570における判定結果によれば、右側((垂直方向のエッジ連結処理にあっては、下側)の隣接ブロックともエッジパターンが連続しないことになるため、注目ブロックは、単独のエッジパターンを有すると判断することができる。従って、CPU160は、注目ブロックの中央エッジ幅MWを確定ぼやけ幅DWとして決定する(ステップS630)。なお、CPU160は、かかる処理に先立ち、エッジパターンテーブル181を参照して、注目ブロックのパターン番号に対応する中央エッジ幅MWを取得するものとする。   If it is determined in step S600 that the accumulated luminance difference ADY exceeds the accumulated luminance difference threshold (step S600: No), it can be determined that the block of interest is not a flat edge pattern. Therefore, the CPU 160 subsequently determines whether or not the accumulated blur width CW read from the horizontal accumulation buffer 174 (vertical accumulation buffer 173 in the case of vertical edge connection processing) is “0” (step S620). . If it is determined by this determination that the cumulative blur width CW is “0” (step S620: Yes), the block of interest is a starting point at which blurring occurs, and further, according to the determination results in steps S560 and S570, Since the edge pattern is not continuous with the adjacent block on the right side (the lower side in the case of edge connection processing in the vertical direction), the target block can be determined to have a single edge pattern. The CPU 160 determines the central edge width MW of the block of interest as the definite blur width DW (step S630) Note that the CPU 160 refers to the edge pattern table 181 prior to such processing and corresponds to the pattern number of the block of interest. Assume that the center edge width MW is acquired.

上記ステップS620において、累積ぼやけ幅CWが「0」ではないと判断されれば、注目ブロックは、右側(垂直方向のエッジ連結処理にあっては、下側)の隣接ブロックとは連続しないが、左側(垂直方向のエッジ連結処理にあっては、上側)の隣接ブロックとは連続することになる。つまり、注目ブロックは、ぼやけ部分の終端に該当することになる。そのため、CPU160は、横累積バッファ174(垂直方向のエッジ連結処理にあっては、縦累積バッファ173)から読み込んだ累積ぼやけ幅CWに注目ブロックの左側エッジ幅LWと中央エッジ幅MWとを加算し、この値を確定ぼやけ幅DWとして決定する(ステップS640)。なお、CPU160は、かかる処理に先立ち、エッジパターンテーブル181を参照して、注目ブロックのパターン番号に対応する左側エッジ幅LWと中央エッジ幅MWとを取得するものとする。   If it is determined in step S620 that the accumulated blur width CW is not “0”, the target block is not continuous with the adjacent block on the right side (lower side in the edge connection processing in the vertical direction). The adjacent block on the left side (upper side in the case of edge connection processing in the vertical direction) is continuous. That is, the target block corresponds to the end of the blurred portion. Therefore, the CPU 160 adds the left edge width LW and the center edge width MW of the block of interest to the accumulated blur width CW read from the horizontal accumulation buffer 174 (vertical accumulation buffer 173 in the case of vertical edge linking processing). This value is determined as the definite blur width DW (step S640). Prior to this processing, the CPU 160 refers to the edge pattern table 181 and acquires the left edge width LW and the central edge width MW corresponding to the pattern number of the block of interest.

上記ステップS640によって確定ぼやけ幅DWを決定した場合には、ぼやけ幅が終端したことになるため、続いてCPU160は、累積ぼやけ幅CWおよび累積輝度差ADYを「0」とし(リセットし)、これらの値を横累積バッファ174(垂直方向のエッジ連結処理にあっては、縦累積バッファ173)に記録する(ステップS650)。こうすることで、次の注目ブロックの位置から、ぼやけ幅の累積が開始されていくことになる。また、上記ステップS520,S540,S610,S630によって確定ぼやけ幅DWが決定した場合についても、上記ステップS650によって、累積ぼやけ幅CWと累積輝度差ADYとを「0」とする。これらの場合には、注目ブロックは平坦であるか単独のエッジを形成していることになるため、ぼやけ幅や輝度差を累積する必要がないためである。   When the determined blur width DW is determined in the above step S640, since the blur width is terminated, the CPU 160 subsequently sets (resets) the cumulative blur width CW and the cumulative luminance difference ADY to “0”. Is recorded in the horizontal accumulation buffer 174 (vertical accumulation buffer 173 in the case of vertical edge connection processing) (step S650). By doing so, the accumulation of the blur width is started from the position of the next block of interest. Even when the determined blur width DW is determined in steps S520, S540, S610, and S630, the cumulative blur width CW and the cumulative luminance difference ADY are set to “0” in step S650. In these cases, the block of interest is flat or forms a single edge, so there is no need to accumulate blur width and luminance difference.

これに対して、上記ステップS570によって、注目ブロックと隣接ブロックとが連続すると判断された場合には、累積ぼやけ幅CWと累積輝度差ADYとはリセットせずステップS580で算出した累積値を横累積バッファ174(垂直方向のエッジ連結処理にあっては、縦累積バッファ173)に記録する。こうすることで、次の注目ブロックに対して、ぼやけ幅や輝度差を累積することが可能になる。   On the other hand, if it is determined in step S570 that the target block and the adjacent block are continuous, the cumulative blur width CW and the cumulative luminance difference ADY are not reset, and the cumulative value calculated in step S580 is laterally cumulative. The data is recorded in the buffer 174 (vertical accumulation buffer 173 in the case of vertical edge connection processing). This makes it possible to accumulate the blur width and the luminance difference for the next block of interest.

以上で一連のエッジ連結処理は終了する。このエッジ連結処理によれば、後述するブロックぼやけ判定処理で用いられる水平および垂直方向の確定ぼやけ幅DWが決定されるとともに、次回のエッジ連結処理で用いられる累積ぼやけ幅CWと累積輝度差ADYとが横累積バッファ174および縦累積バッファ173に対して記録されることになる。かかるエッジ連結処理が終了すると、CPU160は、図9に示したぼやけ判定処理に処理を戻し、引き続き、ブロックぼやけ判定処理(ステップS160)を実行する。   This completes the series of edge connection processing. According to this edge connection process, the horizontal and vertical definite blur widths DW used in the block blur determination process described later are determined, and the cumulative blur width CW and the cumulative luminance difference ADY used in the next edge connection process are determined. Are recorded in the horizontal accumulation buffer 174 and the vertical accumulation buffer 173. When the edge connection process is completed, the CPU 160 returns the process to the blur determination process shown in FIG. 9, and subsequently executes the block blur determination process (step S160).

G.ブロックぼやけ判定処理:
図21は、図9に示したぼやけ判定処理のステップS160で実行されるブロックぼやけ判定処理の詳細なフローチャートである。この処理は、上述したエッジ連結処理に引き続いて実行される処理であり、注目ブロックが合焦しているか否かを判定する処理である。
G. Block blur judgment processing:
FIG. 21 is a detailed flowchart of the block blur determination process executed in step S160 of the blur determination process shown in FIG. This process is a process executed subsequent to the above-described edge connection process, and is a process for determining whether or not the block of interest is in focus.

この処理が実行されると、CPU160は、まず、上記エッジ連結処理で決定された注目ブロックの水平および垂直方向の確定ぼやけ幅DWを取得する(ステップS700)。   When this process is executed, the CPU 160 first acquires the determined blur width DW in the horizontal and vertical directions of the block of interest determined in the edge connection process (step S700).

2つの確定ぼやけ幅DWを取得すると、CPU160は、これらのうち、どちらかの確定ぼやけ幅DWが「不明」であるか否かを判定する(ステップS710)。かかる判定によって、どちらかの確定ぼやけ幅DWが「不明」であると判定されれば(ステップS710:Yes)、注目ブロックのエッジパターンが基本エッジパターンのいずれにも近似しないことになるので、そのブロックは、「ぼやけブロック」であると一律に判断する(ステップS720)。   When the two determined blur widths DW are acquired, the CPU 160 determines whether one of these determined blur widths DW is “unknown” (step S710). If it is determined by this determination that one of the determined blur widths DW is “unknown” (step S710: Yes), the edge pattern of the block of interest does not approximate any of the basic edge patterns. The block is uniformly determined to be a “blurred block” (step S720).

一方、上記ステップS710において、どちらの確定ぼやけ幅DWも「不明」ではないと判断されれば(ステップS710:No)、CPU160は、2つの確定ぼやけ幅DWのうち、大きい方の値を有する確定ぼやけ幅DWを、最大確定ぼやけ幅MDWとして特定する(ステップS730)。   On the other hand, if it is determined in step S710 that neither of the determined blur widths DW is “unknown” (step S710: No), the CPU 160 determines the larger one of the two determined blur widths DW. The blur width DW is specified as the maximum determined blur width MDW (step S730).

最大確定ぼやけ幅MDWを特定すると、CPU160は、この最大確定ぼやけ幅MDWが「0」よりも大きく、かつ、所定のぼやけ幅閾値(例えば、「16」)よりも小さいか否かを判定する(ステップS740)。かかる判定の結果、最大確定ぼやけ幅MDWがこの条件を満たせば、注目ブロックは「合焦ブロック」であると判定する(ステップS750)。これに対して、最大確定ぼやけ幅MDWが「0」であるか、もしくは所定のぼやけ幅閾値以上であれば、注目ブロックは「ぼやけブロック」であると判定する(ステップS720)。   When the maximum determined blur width MDW is specified, the CPU 160 determines whether or not the maximum determined blur width MDW is larger than “0” and smaller than a predetermined blur width threshold (for example, “16”) ( Step S740). If the maximum definite blur width MDW satisfies this condition as a result of the determination, the target block is determined to be a “focus block” (step S750). On the other hand, if the maximum defined blur width MDW is “0” or is equal to or greater than a predetermined blur width threshold, it is determined that the block of interest is a “blurred block” (step S720).

以上の処理により、現在の注目ブロックが、「合焦ブロック」か「ぼやけブロック」かの判定が終了すると、その判定結果が、図9に示したぼやけ判定処理のステップS170において、サブウィンドウ(図7参照)毎に集計される。こうして集計された合焦ブロック数は、RAM170の合焦ブロック数バッファ172に記憶されることになる。   When the determination of whether the current block of interest is “in-focus block” or “blurred block” is completed by the above processing, the determination result is a sub-window (FIG. 7) in step S170 of the blur determination process shown in FIG. (Refer to each). The number of in-focus blocks thus counted is stored in the in-focus block number buffer 172 of the RAM 170.

以上で説明したブロックぼやけ判定処理によれば、水平方向の確定ぼやけ幅DWと垂直方向の確定ぼやけ幅DWとのうち、その値が大きい方の確定ぼやけ幅DWを最大確定ぼやけ幅MDWとして特定し、この最大確定ぼやけ幅MDWが所定のぼやけ幅閾値に対して大きければ、注目ブロックがぼやけていると判断することができる。   According to the block blur determination process described above, the determined blur width DW having the larger value of the horizontal determined blur width DW and the vertical determined blur width DW is specified as the maximum determined blur width MDW. If the maximum determined blur width MDW is larger than the predetermined blur width threshold, it can be determined that the block of interest is blurred.

H.ウィンドウぼやけ判定処理:
図22は、図9に示したぼやけ判定処理のステップS190で実行されるウィンドウぼやけ判定処理の詳細なフローチャートである。上述したブロックぼやけ判定処理がブロック毎にぼやけの有無を判定する処理であるのに対して、このウィンドウぼやけ判定処理は、図7に示したウィンドウ領域毎にぼやけの有無を判定する処理である。この処理は、1つのサブウィンドウに属する全てのブロックのブロックぼやけ判定処理が完了した際に実行される。
H. Window blur determination processing:
FIG. 22 is a detailed flowchart of the window blur determination process executed in step S190 of the blur determination process shown in FIG. The above-described block blur determination process is a process for determining the presence / absence of blur for each block, whereas this window blur determination process is a process for determining the presence / absence of blur for each window area shown in FIG. This process is executed when the block blur determination process for all the blocks belonging to one subwindow is completed.

この処理が実行されると、CPU160は、まず、図12に示した合焦ブロック数バッファ172を参照する(ステップS800)。そして、現在注目しているウィンドウ領域(以下、「注目ウィンドウ」という)内の全てのサブウィンドウについて、合焦ブロック数の累積値を取得し(ステップS810)、これらを合算することで、ウィンドウ領域内のすべての合焦ブロックの数を集計する(ステップS820)。   When this process is executed, the CPU 160 first refers to the focused block number buffer 172 shown in FIG. 12 (step S800). Then, the cumulative value of the number of in-focus blocks is acquired for all sub-windows in the window area currently focused on (hereinafter referred to as “target window”) (step S810), and these are added together to obtain the window area. The number of all the in-focus blocks is tabulated (step S820).

図23は、ウィンドウ領域の移動方法と合焦ブロック数の集計方法を示す説明図である。図23(a)には、注目ウィンドウの初期位置を示すとともに、図12に示した合焦ブロック数の記録順に従って、画像の左上隅のサブウィンドウの合焦ブロックの数の累積値が「3」と記録されたことを示している。この場合、上記ステップS820では、図の1列目に示した合焦ブロック数(0,0,0,3)を全て加算することになる。1つのウィンドウ領域に4×4個のサブウィンドウが含まれ、1つのサブウィンドウに7×7個のブロックが含まれる場合には、ウィンドウ領域内の全てのブロックが合焦しているとすれば、1ウィンドウ領域についての合焦ブロックの総数は、784(=7×7×16)となる。   FIG. 23 is an explanatory diagram showing a window area moving method and a method of counting the number of focused blocks. FIG. 23A shows the initial position of the window of interest, and the cumulative value of the number of focused blocks in the sub-window at the upper left corner of the image is “3” in accordance with the recording order of the number of focused blocks shown in FIG. Is recorded. In this case, in step S820, all the in-focus block numbers (0, 0, 0, 3) shown in the first column of the figure are added. If 4 × 4 subwindows are included in one window area and 7 × 7 blocks are included in one subwindow, if all the blocks in the window area are in focus, then 1 The total number of focused blocks for the window area is 784 (= 7 × 7 × 16).

説明を図23に戻す。上記ステップS820によって、合焦ブロックの数を集計すると、CPU160は、その合焦ブロックの総数が所定の合焦密度閾値(例えば、400)以上であるかを判定する(ステップS830)。かかる判定の結果、合焦ブロックの総数が合焦密度閾値以上であれば(ステップS830:Yes)、現在の注目ウィンドウを「合焦ウィンドウ」と判定し(ステップS840)、合焦密度閾値に満たなければ(ステップS830:No)、「ぼやけウィンドウ」と判定する(ステップS850)。   Returning to FIG. When the number of in-focus blocks is counted in step S820, the CPU 160 determines whether the total number of in-focus blocks is equal to or greater than a predetermined focus density threshold (for example, 400) (step S830). If the result of this determination is that the total number of in-focus blocks is equal to or greater than the focus density threshold (step S830: Yes), the current window of interest is determined to be the “focus window” (step S840), and the focus density threshold is met. If not (Step S830: No), it is determined as a “blurred window” (Step S850).

上記ステップS840によって「合焦ウィンドウ」と判定した場合には、CPU160は、当該ウィンドウぼやけ判定処理を終了する。すると、処理は、図9のぼやけ判定処理のステップS210にすすみ、画像全体が合焦画像であると判定される。これに対して、ステップS850によって、ぼやけウィンドウと判定した場合には、注目ウィンドウを合焦ブロック数バッファ172中において、1列分、右へ移動させる(ステップS860)。図22(b)には、図22(a)からウィンドウを1列分移動させた例を示している。以降、かかる処理によって、注目ウィンドウは、図22(c),(d)に示すように、徐々に右側に移動する。こうすることにより、図9のぼやけ判定処理のステップS180において集計された合焦ウィンドウの数が、ウィンドウ領域の右下隅に記録されることになる。   If it is determined in step S840 that the window is “focused”, the CPU 160 ends the window blur determination process. Then, the process proceeds to step S210 of the blur determination process of FIG. 9, and it is determined that the entire image is a focused image. On the other hand, if it is determined in step S850 that the window is a blurred window, the window of interest is moved to the right by one column in the focused block number buffer 172 (step S860). FIG. 22B shows an example in which the window is moved by one column from FIG. Thereafter, with this process, the window of interest gradually moves to the right as shown in FIGS. By doing so, the number of in-focus windows counted in step S180 of the blur determination process in FIG. 9 is recorded in the lower right corner of the window area.

ステップS860によって注目ウィンドウを移動させると、CPU160は、図22(e)に示すように、そのウィンドウ領域が右端まで移動したかを判断する(ステップS870)。かかる処理によって、右端まで始動していないと判断されれば(ステップS870:No)、CPU160は、当該ウィンドウぼやけ判定処理を終了し、処理を図9に示したぼやけ判定処理のステップS200に戻す。   When the window of interest is moved in step S860, the CPU 160 determines whether the window area has moved to the right end as shown in FIG. 22E (step S870). If it is determined by this processing that the engine has not been started to the right end (step S870: No), CPU 160 ends the window blur determination process and returns the process to step S200 of the blur determination process shown in FIG.

これに対して、注目ウィンドウが右端まで移動したと判断されれば(ステップS870:Yes)、合焦ブロック数バッファ172の行を繰り上げる処理を行う(ステップS880)。この繰り上げ処理は、合焦ブロック数バッファの4行目のデータを3行目に、3行目を2行目に、2行目を1行目に繰り上げる処理である。この時、1行目については、その行を4行目に繰り下げると同時に、この行のデータをすべて初期化する。図22(e)には、この繰り上げ処理の様子を示している。図3や図4に示したように、JPEGデータからのブロックの読み込みは、基本的に画像の左上から開始するのに対して、かかる処理では、図示するように、合焦ブロック数バッファ172を、最下段の行から順にデータを埋めていくのである。なお、この繰り上げ処理では、RAM170内に記憶されたデータを行毎に移動させるものとしてもよいが、各行を参照するアドレスポインタを順次入れ替えるものとしてもよい。このようにポインタを用いるものとすれば、RAM内でデータを移動させる必要がないので、処理時間を短縮することができる。   On the other hand, if it is determined that the window of interest has moved to the right end (step S870: Yes), a process of moving up the row of the focused block number buffer 172 is performed (step S880). This carry-up process is a process for raising the data in the fourth row of the focused block number buffer to the third row, the third row to the second row, and the second row to the first row. At this time, for the first row, the row is moved down to the fourth row, and at the same time, all data in this row are initialized. FIG. 22 (e) shows the state of the carry processing. As shown in FIGS. 3 and 4, reading of blocks from JPEG data basically starts from the upper left of the image, whereas in this process, as shown in FIG. The data is filled in order from the bottom row. In this carry-up process, the data stored in the RAM 170 may be moved for each row, but the address pointers that refer to each row may be sequentially replaced. If the pointer is used in this way, it is not necessary to move data in the RAM, so that the processing time can be shortened.

上記ステップS880において、合焦ブロック数バッファ172の行を繰り上げた後には、CPU160は、図22(f)に示すように、注目ウィンドウを合焦ブロック数バッファ172の左端に移動させる(ステップS890)。そうすると、合焦ブロック数バッファ172の最終行の1列目から次の合焦ブロック数が記録されていくことになる。注目ウィンドウが「ぼやけウィンドウ」と判断された場合には、上述したステップS860からステップS890までの処理を実行することで、注目ウィンドウを相対的に画像内の左上から右下にかけて1サブウィンドウ単位で移動させることができる。   After moving up the row of the focused block number buffer 172 in step S880, the CPU 160 moves the window of interest to the left end of the focused block number buffer 172 as shown in FIG. 22 (f) (step S890). . Then, the next focused block number is recorded from the first column of the last row of the focused block number buffer 172. If it is determined that the target window is a “blurred window”, the process from step S860 to step S890 described above is executed, so that the target window is moved in units of one subwindow from the upper left to the lower right in the image. Can be made.

I.効果:
以上で説明した本実施例のプリンタ100によれば、JPEGデータをRGBやYCbCr等によって表される空間領域まで伸張することなく、周波数領域であるDCT係数まで伸張した段階で、ぼやけの有無を判定することができる。従って、ぼやけの判定処理を高速に行うことができる。また、本実施例では、8画素×8画素のDCT係数のうち、図5に示した第1の係数群および第2の係数群を構成する計14個のDCT係数のみによってぼやけの有無を判定することができるので、演算量を低減することができる。
I. effect:
According to the printer 100 of the present embodiment described above, the presence or absence of blur is determined when the JPEG data is expanded to the DCT coefficient that is the frequency domain without being expanded to the spatial domain represented by RGB, YCbCr, or the like. can do. Therefore, the blur determination process can be performed at high speed. Further, in this embodiment, the presence / absence of blur is determined only by a total of 14 DCT coefficients constituting the first coefficient group and the second coefficient group shown in FIG. 5 among the DCT coefficients of 8 pixels × 8 pixels. Therefore, the amount of calculation can be reduced.

また、本実施例では、第1の係数群や第2の係数群をそのままRAM170に保存するのではなく、これらの係数群によって表される輝度変化に近似した基本エッジパターンをエッジパターンテーブル181から検索し、そのパターン番号を図10や図11に示したパターン番号バッファ171に保存する。そのため、メモリ容量を大幅に低減することができる。また、パターン番号を保存する領域についても、図10や図11に示したように、ぼやけの有無を判断しようとする注目ブロックの右側および下側に隣接するブロックが記録可能な領域のみを用意するものとしたので、使用するメモリ容量を格段に低減することができる。   Further, in this embodiment, the first coefficient group and the second coefficient group are not stored in the RAM 170 as they are, but the basic edge pattern approximated to the luminance change represented by these coefficient groups is obtained from the edge pattern table 181. The search is performed and the pattern number is stored in the pattern number buffer 171 shown in FIGS. Therefore, the memory capacity can be greatly reduced. Also, as for the area for storing the pattern number, as shown in FIG. 10 and FIG. 11, only the area where the blocks adjacent to the right side and the lower side of the target block for which the presence or absence of blur is to be recorded can be recorded is prepared. As a result, the memory capacity to be used can be significantly reduced.

また、本実施例では、最終的に複数のブロックを含む所定のウィンドウ領域に基づき、画像全体のぼやけの有無を判定するが、この時に利用する合焦ブロック数バッファ172もウィンドウ領域に含まれるサブウィンドウの行数分だけ用意するものとした。そのため、使用するメモリ容量を低減することができる。   In this embodiment, the presence or absence of blurring of the entire image is determined based on a predetermined window area that finally includes a plurality of blocks. The focused block number buffer 172 used at this time also includes a sub-window included in the window area. It is assumed that only the number of rows is prepared. Therefore, the memory capacity to be used can be reduced.

また、本実施例では、上述したエッジ連結処理によって、隣接したブロックのぼやけ幅を順次連結していくことができるので、画像中のぼやけ部分の幅が8×8の単位ブロックのサイズを超える場合についても、精度良く画像がぼやけているか否かを判定することができる。   Further, in this embodiment, the blur widths of adjacent blocks can be sequentially connected by the edge connection process described above, and therefore, the width of the blurred portion in the image exceeds the size of the 8 × 8 unit block. Also, it is possible to determine whether or not the image is blurred with high accuracy.

以上、本発明の実施例について説明したが、本発明はこのような実施例に限定されず、その趣旨を逸脱しない範囲で種々の構成を採ることができることはいうまでもない。   As mentioned above, although the Example of this invention was described, it cannot be overemphasized that this invention is not limited to such an Example, and can take a various structure in the range which does not deviate from the meaning.

例えば、上記実施例では、プリンタ100がぼやけの判定を行うものとしたが、上述した各種処理を実行するためのプログラムをコンピュータにインストールすることで、コンピュータがぼやけの判定を行うものとしてもよい。   For example, in the above embodiment, the printer 100 performs the blur determination. However, the computer may perform the blur determination by installing a program for executing the above-described various processes in the computer.

また、上記実施例では、1つのブロックのサイズが8×8の場合を示したが、ブロックのサイズはこれに限られない。また、ウィンドウ領域の大きさや、1つのウィンドウ領域に含まれるサブウィンドウの数も適宜設定可能である。   Moreover, although the case where the size of one block is 8 × 8 has been described in the above embodiment, the block size is not limited to this. Further, the size of the window area and the number of subwindows included in one window area can be set as appropriate.

また、上記実施例では、注目ブロックを順次移動させていくことで、画像データから読み込むブロックの数を最低限に抑えるものとしたが、画像データに含まれる全てのブロックについてエッジパターン照合処理を行ってパターン番号を記憶し、こうして記憶した画像全体のパターン番号を用いて、エッジ連結処理やブロックぼやけ判定処理等を行うものとしてもよい。こうすることによっても、画像全体の係数値を保持する必要がないため、メモリの使用量を削減することができる。   In the above embodiment, the number of blocks read from the image data is minimized by sequentially moving the block of interest. However, the edge pattern matching process is performed on all the blocks included in the image data. Then, the pattern number may be stored, and the edge connection process or the block blur determination process may be performed using the pattern number of the entire image thus stored. This also reduces the amount of memory used because it is not necessary to hold the coefficient values of the entire image.

実施例としてのプリンタ100の外観を示す説明図である。1 is an explanatory diagram illustrating an appearance of a printer 100 as an embodiment. FIG. プリンタ100の内部構成を示す説明図である。2 is an explanatory diagram illustrating an internal configuration of a printer 100. FIG. JPEGデータ内に各ブロックが1行ごとに記録されている様子を示す説明図である。It is explanatory drawing which shows a mode that each block is recorded for every line in JPEG data. JPEGデータ内に各ブロックが2行ごとに記録されている様子を示す説明図である。It is explanatory drawing which shows a mode that each block is recorded for every 2 lines in JPEG data. 係数抽出部162によって抽出されるDCT係数を示す説明図である。It is explanatory drawing which shows the DCT coefficient extracted by the coefficient extraction part 162. FIG. 注目ブロックとこれに隣接したブロックとのぼやけ幅を連結する概念を示す説明図である。It is explanatory drawing which shows the concept which connects the blur width of an attention block and the block adjacent to this. ウィンドウ領域の概念を示す説明図である。It is explanatory drawing which shows the concept of a window area | region. 印刷処理のフローチャートである。It is a flowchart of a printing process. ぼやけ判定処理のフローチャートである。It is a flowchart of a blurring determination process. JPEGデータに1行単位でブロックが記録されている場合に確保されたパターン番号バッファ171の一例を示す説明図である。It is explanatory drawing which shows an example of the pattern number buffer 171 ensured when the block is recorded by JPEG data per line. JPEGデータに2行単位でブロックが記録されている場合に確保されたパターン番号バッファ171の一例を示す説明図である。It is explanatory drawing which shows an example of the pattern number buffer 171 ensured when the block is recorded by JPEG data per 2 lines. 合焦ブロック数バッファ172の一例を示す説明図である。5 is an explanatory diagram illustrating an example of a focused block number buffer 172. FIG. エッジパターン照合処理の詳細なフローチャートである。It is a detailed flowchart of an edge pattern collation process. エッジパターンテーブル181の一例を示す説明図である。5 is an explanatory diagram illustrating an example of an edge pattern table 181. FIG. 正規化輝度差テーブル182の一例を示す説明図である。It is explanatory drawing which shows an example of the normalization brightness | luminance difference table. エッジ連結処理の詳細なフローチャートである。It is a detailed flowchart of an edge connection process. 注目ブロックと隣接ブロックとで基本エッジパターンの傾き方向が一致する例を示す説明図である。It is explanatory drawing which shows the example in which the inclination direction of a basic edge pattern corresponds with an attention block and an adjacent block. 注目ブロックと隣接ブロックとで基本エッジパターンの傾き方向が一致しない例を示す説明図である。It is explanatory drawing which shows the example from which the inclination direction of a basic edge pattern does not correspond with an attention block and an adjacent block. 注目ブロックの右側エッジ幅RWと隣接ブロックの左側エッジ幅LWの加算値と連結誤差閾値との比較の様子を示す説明図である。It is explanatory drawing which shows the mode of a comparison with the addition value of the right edge width RW of an attention block, and the left edge width LW of an adjacent block, and a connection error threshold value. 累積ぼやけ幅CWの算出概念を示す説明図である。It is explanatory drawing which shows the calculation concept of the accumulation blur width CW. ブロックぼやけ判定処理の詳細なフローチャートである。It is a detailed flowchart of a block blur determination process. ウィンドウぼやけ判定処理の詳細なフローチャートである。It is a detailed flowchart of a window blurring determination process. ウィンドウ領域の移動方法と合焦ブロック数の集計方法を示す説明図である。It is explanatory drawing which shows the movement method of a window area | region, and the total method of the number of focused blocks.

符号の説明Explanation of symbols

100…プリンタ
110…スキャナ
120…メモリカードスロット
130…USBインタフェース
140…操作パネル
145…液晶ディスプレイ
150…制御ユニット
160…CPU
161…画像データ入力部
162…係数抽出部
163…パターン照合部
164…エッジ連結部
165…ブロックぼやけ判定部
166…ウィンドウぼやけ判定部
170…RAM
171…パターン番号バッファ
172…合焦ブロック数バッファ
173…縦累積バッファ
174…横累積バッファ
180…ROM
181…エッジパターンテーブル
182…正規化輝度差テーブル
210…キャリッジ
211…インクヘッド
212…インクカートリッジ
220…キャリッジモータ
230…紙送りモータ
260…駆動ベルト
270…プラテン
280…摺動軸
DESCRIPTION OF SYMBOLS 100 ... Printer 110 ... Scanner 120 ... Memory card slot 130 ... USB interface 140 ... Operation panel 145 ... Liquid crystal display 150 ... Control unit 160 ... CPU
161 ... Image data input unit 162 ... Coefficient extraction unit 163 ... Pattern matching unit 164 ... Edge connection unit 165 ... Block blur determination unit 166 ... Window blur determination unit 170 ... RAM
171 ... Pattern number buffer 172 ... Focus block number buffer 173 ... Vertical accumulation buffer 174 ... Horizontal accumulation buffer 180 ... ROM
181 ... Edge pattern table 182 ... Normalized luminance difference table 210 ... Carriage 211 ... Ink head 212 ... Ink cartridge 220 ... Carriage motor 230 ... Paper feed motor 260 ... Drive belt 270 ... Platen 280 ... Sliding shaft

Claims (17)

複数の画素からなるブロックの集合として構成された画像のぼやけを検出する画像処理装置であって、
前記ブロックを単位として行われた空間領域から周波数領域への変換により得られた係数が、該ブロック毎に記録されて構成された画像データを入力する画像データ入力部と、
前記ブロック内の画素値の変化の代表的な勾配形状を前記係数によって表した複数種類の基本エッジパターンと、該各基本エッジパターンにそれぞれ一意に割り振られたパターン番号とが対応付けて記憶されたエッジパターン記憶部と、
前記入力した画像データの各ブロックから、所定方向の周波数成分を表す係数群を抽出する係数抽出部と、
前記抽出した係数群が表す勾配形状に近似する基本エッジパターンを前記エッジパターン記憶部から選出するパターン照合部と、
前記選出された基本エッジパターンに対応する前記パターン番号を前記ブロックに関連づけて記憶するパターン番号記憶部と、
前記パターン番号記憶部に記憶されたパターン番号を参照し、前記画像内における前記ブロックの連なりに沿って前記基本エッジパターンの勾配の方向が一致する範囲をぼやけ幅として検出するぼやけ幅検出部と、
前記検出されたぼやけ幅に基づいて、前記画像データが表す画像のぼやけを判定するぼやけ判定部と
を備える画像処理装置。
An image processing apparatus for detecting blur of an image configured as a set of blocks composed of a plurality of pixels,
An image data input unit for inputting image data in which coefficients obtained by conversion from a spatial domain to a frequency domain performed in units of the blocks are recorded for each block; and
A plurality of types of basic edge patterns in which representative gradient shapes of pixel value changes in the block are represented by the coefficients, and pattern numbers uniquely assigned to the basic edge patterns are stored in association with each other. An edge pattern storage unit;
A coefficient extraction unit that extracts a coefficient group representing a frequency component in a predetermined direction from each block of the input image data;
A pattern matching unit that selects a basic edge pattern that approximates a gradient shape represented by the extracted coefficient group from the edge pattern storage unit;
A pattern number storage unit that stores the pattern number corresponding to the selected basic edge pattern in association with the block;
A blur width detecting unit that refers to a pattern number stored in the pattern number storage unit and detects a range in which the gradient directions of the basic edge pattern coincide with each other in a series of blocks in the image as a blur width;
An image processing apparatus comprising: a blur determination unit that determines blur of an image represented by the image data based on the detected blur width.
請求項1に記載の画像処理装置であって、
前記エッジパターン記憶部には、更に、前記パターン番号に対応付けて、前記各基本エッジパターンが表す勾配の幅が記憶されており、
前記ぼやけ幅検出部は、前記基本エッジパターンの勾配の方向が一致する範囲に存在する各ブロックのパターン番号に対応付けられた前記勾配の幅を前記エッジパターン記憶部から読み出し、該勾配の幅を加算して、前記ぼやけ幅を算出する
画像処理装置。
The image processing apparatus according to claim 1,
The edge pattern storage unit further stores a gradient width represented by each basic edge pattern in association with the pattern number,
The blur width detection unit reads the gradient width associated with the pattern number of each block existing in a range where the gradient directions of the basic edge pattern coincide with each other from the edge pattern storage unit, and calculates the gradient width. An image processing apparatus that calculates the blur width by adding.
請求項2に記載の画像処理装置であって、
前記ぼやけ幅検出部は、前記ブロックの連なりに沿って、注目するブロックを、前記画像データ内に移動させていき、該注目ブロックと該注目ブロックの移動先の隣接ブロックとにそれぞれ関連づけられた前記パターン番号を参照して、該注目ブロックと該隣接ブロックの基本エッジパターンの勾配の方向が一致するか否かを判定し、該勾配の方向が一致する場合に、該注目ブロックのパターン番号に対応付けられた前記勾配の幅を累積加算していくことで、前記ぼやけ幅を算出する
画像処理装置。
The image processing apparatus according to claim 2,
The blur width detection unit moves a block of interest in the image data along the series of blocks, and is associated with the block of interest and an adjacent block to which the block of interest is moved, respectively. Referring to the pattern number, it is determined whether or not the direction of the gradient of the basic edge pattern of the block of interest and the adjacent block matches, and if the direction of the gradient matches, it corresponds to the pattern number of the block of interest An image processing apparatus that calculates the blur width by accumulatively adding the attached gradient widths.
請求項3に記載の画像処理装置であって、
前記画像データには、前記ブロックが水平方向および垂直方向に連なっており、
前記係数抽出部は、前記係数群として、水平方向の周波数成分を表す第1の係数群と、垂直方向の周波数成分を表す第2の係数群とを抽出し、
前記パターン照合部は、前記第1の係数群と前記第2の係数群とについて、それぞれ、前記基本エッジパターンを選出し、
前記パターン番号記憶部は、前記選出された2つの基本エッジパターンに対応する前記パターン番号をそれぞれ前記ブロックに関連付けて記憶し、
前記ぼやけ幅検出部は、水平方向および垂直方向についてそれぞれ前記ぼやけ幅を算出し、
前記ぼやけ判定部は、前記水平方向と垂直方向とについてそれぞれ算出された前記ぼやけ幅のうち、大きい方のぼやけ幅に基づき、前記画像データが表す画像のぼやけを判定する
画像処理装置。
The image processing apparatus according to claim 3,
In the image data, the blocks are arranged in a horizontal direction and a vertical direction,
The coefficient extraction unit extracts, as the coefficient group, a first coefficient group representing a horizontal frequency component and a second coefficient group representing a vertical frequency component,
The pattern matching unit selects the basic edge pattern for each of the first coefficient group and the second coefficient group,
The pattern number storage unit stores the pattern numbers corresponding to the selected two basic edge patterns in association with the blocks, respectively.
The blur width detection unit calculates the blur width in the horizontal direction and the vertical direction,
The blur determination unit determines blur of an image represented by the image data based on a larger blur width among the blur widths calculated in the horizontal direction and the vertical direction, respectively.
請求項4に記載の画像処理装置であって、
前記ぼやけ幅検出部は、前記水平方向について累積加算した勾配の幅を、ブロック1つ分保持する横累積バッファに保存し、前記垂直方向について累積加算した勾配の幅を、ブロック1行分保持する縦累積バッファに保存し、前記注目ブロックを移動させた場合に、これらのバッファを参照することで移動前のブロックに累積された水平および垂直方向の勾配の幅を取得する
画像処理装置。
The image processing apparatus according to claim 4,
The blur width detecting unit stores the gradient width cumulatively added in the horizontal direction in a horizontal cumulative buffer that holds one block, and holds the gradient width cumulatively added in the vertical direction for one block. An image processing apparatus that stores in a vertical accumulation buffer and acquires the horizontal and vertical gradient widths accumulated in a block before movement by referring to these buffers when the block of interest is moved.
請求項4または請求項5に記載の画像処理装置であって、
前記パターン番号記憶部は、前記注目ブロックが含まれる第1の行と該注目ブロックの下側に隣接するブロックが含まれる第2の行とについて前記パターン番号を記憶可能な記憶領域を有し、前記注目ブロックが該注目ブロックの属する行の右端に移動した場合に、前記第2の行以降に記憶されたパターン番号を、それぞれ前の行に繰り上げて記憶することで、次に選出されたブロックのパターン番号を、該パターン番号記憶部の空領域に記憶していく
画像処理装置。
The image processing apparatus according to claim 4 or 5, wherein
The pattern number storage unit has a storage area capable of storing the pattern number for a first row including the target block and a second row including a block adjacent to the lower side of the target block, When the block of interest moves to the right end of the row to which the block of interest belongs, the pattern number stored in the second and subsequent rows is moved up to the previous row and stored, so that the next selected block The image number is stored in the empty area of the pattern number storage unit.
請求項6に記載の画像処理装置であって、
前記画像データには、前記ブロックがn(nは1以上の整数)行毎に記録されており、
前記パターン番号記憶部は、前記ブロック(n+1)行分のパターン番号が記憶可能な記憶領域を用意する
画像処理装置。
The image processing apparatus according to claim 6,
In the image data, the block is recorded every n (n is an integer of 1 or more) rows,
The pattern processing unit prepares a storage area capable of storing pattern numbers for the block (n + 1) rows.
請求項1ないし請求項7のいずれかに記載の画像処理装置であって、
前記ぼやけ判定部は、
前記ぼやけ幅と所定の閾値とに基づき、前記ブロック毎にぼやけの有無を判定するブロックぼやけ判定部と、
前記画像データ内の所定のウィンドウ領域に含まれる全ブロックについて、前記ブロックぼやけ判定手段によるぼやけの有無を集計し、該集計結果と所定の閾値とに基づき、該ウィンドウ領域内がぼやけているか否かを判断するウィンドウぼやけ判定部と、
前記画像データ中において、前記ウィンドウ領域を移動させていった結果、少なくとも1カ所、ぼやけていないと判断された前記ウィンドウ領域が存在する場合に、前記画像データが表す画像全体がぼやけていないと判断する画像ぼやけ判定部と
を備える画像処理装置。
An image processing apparatus according to any one of claims 1 to 7,
The blur determination unit
A block blur determination unit that determines the presence or absence of blur for each block based on the blur width and a predetermined threshold;
For all blocks included in the predetermined window area in the image data, the presence / absence of blur by the block blur determination means is totaled, and whether or not the window area is blurred based on the total result and a predetermined threshold value A window blur determination unit for determining
As a result of moving the window area in the image data, if there is at least one window area that is determined not to be blurred, it is determined that the entire image represented by the image data is not blurred. An image processing apparatus comprising: an image blur determination unit.
請求項8に記載の画像処理装置であって、
前記ウィンドウ領域は、更に、それぞれが前記ブロックのサイズよりも大きい複数のサブウィンドウによって区画されており、
前記ブロックぼやけ判定部は、前記ブロック毎のぼやけの有無を、該ブロックが含まれる前記サブウィンドウ毎に集計し、
前記ウィンドウぼやけ判定部は、前記サブウィンドウについて集計された集計値を、更に、前記ウィンドウ領域に含まれる全サブウィンドウについて集計することで、該ウィンドウ領域に含まれる全ブロックについての前記ぼやけの有無の集計を行う
画像処理装置。
The image processing apparatus according to claim 8,
The window area is further partitioned by a plurality of sub-windows, each of which is larger than the size of the block,
The block blur determination unit totalizes the presence / absence of blur for each block for each sub-window including the block,
The window blur determination unit further counts the total value of the sub-windows, and further totals all the sub-windows included in the window area, thereby calculating the presence / absence of the blur for all blocks included in the window area. Perform image processing device.
請求項9に記載の画像処理装置であって、
前記画像ぼやけ判定部は、前記画像データ中において、前記ウィンドウ領域を、前記サブウィンドウ単位の移動距離で移動させる
画像処理装置。
The image processing apparatus according to claim 9,
The image blur determination unit is an image processing apparatus that moves the window area in the image data by a movement distance in units of sub-windows.
請求項10に記載の画像処理装置であって、
更に、前記ブロックぼやけ判定部によって集計された前記サブウィンドウ毎のぼやけの有無の集計値を記憶する集計値記憶部を備え、
前記集計値記憶部は、前記ウィンドウ領域内に含まれるサブウィンドウの行数分だけ前記集計値を記憶する記憶領域を有し、前記ウィンドウ領域が前記画像データ中において下側に移動された場合には、前記集計値記憶部の各行に記憶された集計値を、それぞれ前記移動された行数分だけ前の行に繰り上げて記憶し、該繰り上げ処理に伴って生じた該集計値記憶部の空領域に前記移動後のウィンドウ領域内に含まれることになった前記サブウィンドウ毎の前記集計値を記憶する
画像処理装置。
The image processing apparatus according to claim 10,
Furthermore, a total value storage unit that stores a total value of the presence or absence of blur for each of the sub-windows totaled by the block blur determination unit,
The total value storage unit has a storage area for storing the total value as many as the number of rows of subwindows included in the window area, and when the window area is moved downward in the image data The total value stored in each row of the total value storage unit is stored in the previous row by the number of the moved lines, and the empty region of the total value storage unit generated by the advance processing An image processing apparatus for storing the total value for each of the sub-windows that are included in the window area after the movement.
請求項1ないし請求項11のいずれかに記載の画像処理装置であって、
更に、前記ぼやけ判定部によってぼやけていないと判定された画像をユーザに提示する提示部を備える
画像処理装置。
An image processing apparatus according to any one of claims 1 to 11,
Furthermore, an image processing apparatus provided with the presentation part which shows a user the image determined not to be blurred by the blur determination part.
請求項12に記載の画像処理装置であって、
更に、前記提示された画像の中からユーザによって選択された画像を印刷する印刷部を備える
画像処理装置
The image processing apparatus according to claim 12,
An image processing apparatus further comprising a printing unit that prints an image selected by the user from the presented images.
請求項1ないし請求項13のいずれかに記載の画像処理装置であって、
前記画像データは、JPEG形式の画像データである
画像処理装置。
An image processing apparatus according to any one of claims 1 to 13,
The image processing apparatus is an image processing device that is image data in JPEG format.
コンピュータが複数の画素からなるブロックの集合として構成された画像のぼやけを検出するぼやけ検出方法であって、
前記ブロックを単位として行われた空間領域から周波数領域への変換により得られた係数が、該ブロック毎に記録されて構成された画像データを入力し、
前記入力した画像データの各ブロックから、所定方向の周波数成分を表す係数群を抽出し、
前記ブロック内の画素値の変化の代表的な勾配形状を前記係数によって表した複数種類の基本エッジパターンと、該各基本エッジパターンにそれぞれ一意に割り振られたパターン番号とが対応付けて記憶されたエッジパターン記憶部を参照して、前記抽出した係数群が表す勾配形状に近似する基本エッジパターンを選出し、
前記選出された基本エッジパターンに対応する前記パターン番号を前記ブロックに関連づけて所定のパターン番号記憶部に記憶し、
前記パターン番号記憶部に記憶されたパターン番号を参照し、前記画像内における前記ブロックの連なりに沿って前記基本エッジパターンの勾配の方向が一致する範囲をぼやけ幅として検出し、
前記検出されたぼやけ幅に基づいて、前記画像データが表す画像のぼやけを判定する
ぼやけ検出方法。
A blur detection method in which a computer detects blur of an image configured as a set of blocks made up of a plurality of pixels,
Coefficients obtained by conversion from the spatial domain to the frequency domain performed in units of the blocks are input image data recorded and configured for each block,
Extracting a coefficient group representing a frequency component in a predetermined direction from each block of the input image data,
A plurality of types of basic edge patterns in which representative gradient shapes of pixel value changes in the block are represented by the coefficients, and pattern numbers uniquely assigned to the basic edge patterns are stored in association with each other. With reference to the edge pattern storage unit, a basic edge pattern that approximates the gradient shape represented by the extracted coefficient group is selected,
Storing the pattern number corresponding to the selected basic edge pattern in a predetermined pattern number storage unit in association with the block;
With reference to the pattern number stored in the pattern number storage unit, a range in which the direction of the gradient of the basic edge pattern matches along the series of blocks in the image is detected as a blur width,
A blur detection method for determining blur of an image represented by the image data based on the detected blur width.
コンピュータが複数の画素からなるブロックの集合として構成された画像のぼやけを検出するためのコンピュータプログラムであって、
前記ブロックを単位として行われた空間領域から周波数領域への変換により得られた係数が、該ブロック毎に記録されて構成された画像データを入力する機能と、
前記入力した画像データの各ブロックから、所定方向の周波数成分を表す係数群を抽出する機能と、
前記ブロック内の画素値の変化の代表的な勾配形状を前記係数によって表した複数種類の基本エッジパターンと、該各基本エッジパターンにそれぞれ一意に割り振られたパターン番号とが対応付けて記憶されたエッジパターン記憶部を参照して、前記抽出した係数群が表す勾配形状に近似する基本エッジパターンを選出する機能と、
前記選出された基本エッジパターンに対応する前記パターン番号を前記ブロックに関連づけて所定のパターン番号記憶部に記憶する機能と、
前記パターン番号記憶部に記憶されたパターン番号を参照し、前記画像内における前記ブロックの連なりに沿って前記基本エッジパターンの勾配の方向が一致する範囲をぼやけ幅として検出する機能と、
前記検出されたぼやけ幅に基づいて、前記画像データが表す画像のぼやけを判定する機能と
をコンピュータに実現させるコンピュータプログラム。
A computer program for detecting blurring of an image configured as a set of blocks composed of a plurality of pixels,
A function of inputting image data in which a coefficient obtained by conversion from a spatial domain to a frequency domain performed in units of the block is recorded for each block;
A function of extracting a coefficient group representing a frequency component in a predetermined direction from each block of the input image data;
A plurality of types of basic edge patterns in which representative gradient shapes of pixel value changes in the block are represented by the coefficients, and pattern numbers uniquely assigned to the basic edge patterns are stored in association with each other. A function of selecting a basic edge pattern that approximates a gradient shape represented by the extracted coefficient group with reference to an edge pattern storage unit;
A function of storing the pattern number corresponding to the selected basic edge pattern in the predetermined pattern number storage unit in association with the block;
A function of referring to a pattern number stored in the pattern number storage unit and detecting as a blur width a range in which the direction of the gradient of the basic edge pattern coincides along the series of blocks in the image;
A computer program that causes a computer to realize a function of determining blur of an image represented by the image data based on the detected blur width.
請求項16に記載のコンピュータプログラムを記録したコンピュータ読み取り可能な記録媒体。   The computer-readable recording medium which recorded the computer program of Claim 16.
JP2008201711A 2008-08-05 2008-08-05 Image processing apparatus and blur-detecting method Withdrawn JP2009022017A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008201711A JP2009022017A (en) 2008-08-05 2008-08-05 Image processing apparatus and blur-detecting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008201711A JP2009022017A (en) 2008-08-05 2008-08-05 Image processing apparatus and blur-detecting method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2006184300A Division JP4193881B2 (en) 2006-07-04 2006-07-04 Image processing apparatus and blur detection method

Publications (2)

Publication Number Publication Date
JP2009022017A true JP2009022017A (en) 2009-01-29
JP2009022017A5 JP2009022017A5 (en) 2009-08-06

Family

ID=40361179

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008201711A Withdrawn JP2009022017A (en) 2008-08-05 2008-08-05 Image processing apparatus and blur-detecting method

Country Status (1)

Country Link
JP (1) JP2009022017A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03214868A (en) * 1990-01-19 1991-09-20 Ricoh Co Ltd Automatic focusing device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03214868A (en) * 1990-01-19 1991-09-20 Ricoh Co Ltd Automatic focusing device

Similar Documents

Publication Publication Date Title
JP4193881B2 (en) Image processing apparatus and blur detection method
JP4771804B2 (en) Layout analysis program, layout analysis apparatus, layout analysis method
US20080137982A1 (en) Blurring determination device, blurring determination method and printing apparatus
CN102801897B (en) Image processing apparatus and image processing method
US7869630B2 (en) Apparatus and method for processing image
JP4182990B2 (en) Printing device, method for determining whether image is blurred, and computer program
EP2701118B1 (en) Device and method for data processing of a tenprint card and a storage medium
US20170004376A1 (en) Image processing apparatus and image processing method
US20090285457A1 (en) Detection of Organ Area Corresponding to Facial Organ Image in Image
US8306335B2 (en) Method of analyzing digital document images
US7924468B2 (en) Camera shake determination device, printing apparatus and camera shake determination method
US8229214B2 (en) Image processing apparatus and image processing method
JP4251217B2 (en) Printing apparatus, image data file processing apparatus, image data file selection method, and computer program
US20090290799A1 (en) Detection of Organ Area Corresponding to Facial Organ Image in Image
JP2009022017A (en) Image processing apparatus and blur-detecting method
JP2008165734A (en) Blurring determination device, blurring determination method and printing apparatus
JP2008140331A (en) Image processor, blur detecting method, program, and recording medium
JP4910971B2 (en) Camera shake determination device and camera shake determination method
US9305250B2 (en) Image processing apparatus and image processing method including location information identification
JP2008123346A (en) Blur determination device, blur determination method, and printer
JP5517028B2 (en) Image processing device
JP4742642B2 (en) Image processing apparatus, printing apparatus, image processing method, and image processing program
JP2008129912A (en) Image processor, blur detection method, program and recording medium
JP2008028886A (en) Image processing apparatus, and blur detecting method
JP2009237657A (en) Image determination device, method, and program

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090623

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090623

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120417

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20120426