JP2008129912A - Image processor, blur detection method, program and recording medium - Google Patents

Image processor, blur detection method, program and recording medium Download PDF

Info

Publication number
JP2008129912A
JP2008129912A JP2006315433A JP2006315433A JP2008129912A JP 2008129912 A JP2008129912 A JP 2008129912A JP 2006315433 A JP2006315433 A JP 2006315433A JP 2006315433 A JP2006315433 A JP 2006315433A JP 2008129912 A JP2008129912 A JP 2008129912A
Authority
JP
Japan
Prior art keywords
block
blur
image
pattern
processing apparatus
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006315433A
Other languages
Japanese (ja)
Inventor
Takashige Tanaka
敬重 田中
Ayahiro Nakajima
紋宏 中島
Masashi Aiiso
政司 相磯
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 JP2006315433A priority Critical patent/JP2008129912A/en
Publication of JP2008129912A publication Critical patent/JP2008129912A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processor which highly accurately detects blur of a bit map image with less load. <P>SOLUTION: A CPU 160 of a printer 100 divides image data of a target window into blocks of 8×8 pixels, calculates a coefficient group representing a change in a pixel value in each block and selects from an edge pattern table 181 a basic edge pattern approximating a change shape of the coefficient group. With respect to the basic edge pattern, when adjacent blocks are in the same inclination direction as that of a target block, the CPU 160 executes edge connection processing of cumulatively adding burr widths (widths of a gradient of a change in a pixel value) of the blocks with each other, calculates a blur width of the target block and determines block burr. The CPU 160 accumulates the determination results and performs window burr determination processing. If any focused window is included in a target image, the target image is determined to be a focused image. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、画素の集合体として構成されたビットマップ画像のぼやけを検出する技術に関する。   The present invention relates to a technique for detecting blur in a bitmap image configured as an aggregate of pixels.

近年、デジタルスチルカメラが普及し、デジタルデータの写真画像を撮影する機会が増えている。これらのデジタル写真画像には、被写体ブレや手ブレによるぼやけ画像も含まれており、ユーザが画像を印刷するのに先立ち、ぼやけが生じている画像を印刷の対象から排除することが必要である。近年普及している小型液晶ディスプレイを備えたプリンタでは、ユーザが印刷する画像を液晶ディスプレイで確認・選択してから印刷することが可能であるが、このような小型の液晶ディスプレイでは、画像の細部まで確認することはできず、正確なぼやけの判定は困難であった。一方、こうしたぼやけ画像を排除するためのぼやけ検出技術に関連し、下記特許文献1には、撮像した画像を8画素×8画素を単位とする複数のブロックに分割して、離散コサイン変換された各ブロックについて周波数分析を行い、ブロック毎に像のシャープさ(逆に言えば、ぼやけ度合い)を判別する技術が記載されている。   In recent years, digital still cameras have become widespread, and opportunities for taking photographic images of digital data are increasing. These digital photographic images include blurred images due to subject blur and camera shake, and before the user prints the image, it is necessary to exclude the blurred image from the print target. . In a printer equipped with a small liquid crystal display that has been widely used in recent years, it is possible to print after confirming and selecting an image to be printed by the user on the liquid crystal display. Thus, it was difficult to accurately determine blur. On the other hand, in relation to blur detection technology for eliminating such blurry images, Patent Document 1 below discloses that a captured image is divided into a plurality of blocks each having 8 pixels × 8 pixels and subjected to discrete cosine transform. A technique is described in which frequency analysis is performed for each block, and the sharpness of the image (in other words, the degree of blurring) is determined for each block.

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

しかし、ビットマップのように離散的な周波数成分の係数をデータとして有しない形式の画像では、当該画像をJPEGなどの離散的な周波数成分の係数をデータとして有する形式に変換した後に、特許文献1に記載の技術によって数百万画素あるいはそれ以上の高解像度な画像のぼやけを分析しようとすると、演算量が膨大となり、それに伴いメモリの使用量も多くなる。このような問題は、特に、プリンタやデジタルカメラ、フォトビューワー等といった、CPUパワーやメモリ容量に制限のある小型機器でぼやけの検出を行う場合に看過できない問題となる。   However, in an image in a format that does not have discrete frequency component coefficients as data, such as a bitmap, the image is converted to a format that has discrete frequency component coefficients such as JPEG as data, and then disclosed in Patent Document 1. If an attempt is made to analyze the blur of a high-resolution image of millions of pixels or more by the technique described in (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.

また、近年のデジタルスチルカメラで撮影される画像の解像度は、数百万ないし1000万画素もの高解像度であるため、特許文献1に記載のように8画素×8画素だけで構成されるブロック内だけでぼやけやシャープさを判別することは困難であった。具体的に言えば、L版の印刷用紙(約横130mm×縦90mm)に600万画素(約横3000画素×縦2000画素)の画像を印刷した場合には、横8画素は、約0.35mmの幅に相当し、このような狭い幅の中だけで画像がシャープであるかぼやけているかを客観的に判別することは困難である。つまり、近年撮影される高解像度な画像において、特許文献1に記載の技術を直接適用することは困難になってきている。   In addition, 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.

上述した種々の問題を考慮し、本発明が解決しようとする課題は、離散的な周波数成分の係数をデータとして有しないビットマップ画像を対象として、少ない負荷で画像のぼやけを精度良く検出することである。   In consideration of the various problems described above, the problem to be solved by the present invention is to accurately detect image blur with a small load on a bitmap image that does not have discrete frequency component coefficients as data. It is.

上記課題を解決する本発明の画像処理装置は、
画素の集合体として構成されたビットマップ画像のぼやけを検出する画像処理装置であって、
前記画像を構成する画素毎に、画像データを入力する画像データ入力部と、
前記画像の少なくとも一部を、所定の数の画素からなるブロックを単位として複数に分割し、該ブロック毎に該ブロックに属する画素の前記入力した画像データに基づいて、該画像データの前記ブロック内での所定方向の変化を表す複数の係数からなる係数群を算出するブロックパターン算出部と、
前記ブロック内の画素の画像データの前記ブロック内における少なくとも一方向の代表的な変化を前記係数群によって表した複数種類のパターンを、基本パターンとして分類して記憶するパターン記憶部と、
前記算出された係数群の変化のパターンを、前記記憶された複数の基本パターンと照合し、近似する基本パターンを選出するパターン照合部と、
前記ブロックについて選出された前記各基本パターンの前記画像内における配置に基づいて、前記画像データが表す画像のぼやけを判定するぼやけ判定部と
を備えたことを要旨とする。
An image processing apparatus of the present invention that solves the above problems is as follows.
An image processing device for detecting blur of a bitmap image configured as a collection of pixels,
An image data input unit for inputting image data for each pixel constituting the image;
At least a part of the image is divided into a plurality of blocks each having a predetermined number of pixels, and the block of the image data is determined based on the input image data of pixels belonging to the block for each block. A block pattern calculation unit for calculating a coefficient group composed of a plurality of coefficients representing a change in a predetermined direction at
A pattern storage unit that classifies and stores a plurality of types of patterns in which representative changes in at least one direction in the block of image data of pixels in the block are represented by the coefficient group as basic patterns;
A pattern matching unit that matches the calculated pattern of change of the coefficient group with the plurality of stored basic patterns and selects a basic pattern to be approximated;
The present invention includes a blur determination unit that determines blur of an image represented by the image data based on the arrangement of the basic patterns selected for the block in the image.

かかる構成の画像処理装置は、画像を複数のブロックに分割し、所定方向の画像データの変化を表す係数群を算出して、この係数群の変化のパターンと近似した基本パターンをパターン記憶部から選出し、選出された基本パターンの画像内における配置に基づいて、画像のぼやけを判定する。従って、基本パターンを利用して、効率的にぼやけの判定を行うことができる。   The image processing apparatus having such a configuration divides an image into a plurality of blocks, calculates a coefficient group representing a change in image data in a predetermined direction, and obtains a basic pattern approximated to the pattern of the coefficient group change from the pattern storage unit. Based on the selected basic pattern and the arrangement of the selected basic pattern in the image, blurring of the image is determined. Therefore, it is possible to efficiently determine blur using the basic pattern.

なお、ビットマップ画像とは、色情報を持った画素の集合体として構成される画像データであり、例えば、PNG形式のデータ、BMP形式のデータ、JPEG形式のデータをビットマップ展開したデータなど、種々の画像データである。   The bitmap image is image data configured as an aggregate of pixels having color information. For example, PNG format data, BMP format data, JPEG format data, etc. Various image data.

また、かかる構成の画像処理装置において、ぼやけ判定部は、基本パターンが選出されたブロックの、選出された基本パターンの係数群の各係数の変化が形成する第1の勾配と、該ブロックに隣接するブロックで選出された基本パターンの係数群の各係数の変化が形成する第2の勾配との連続性を検定する連続性検定手段と、連続性検出手段の検定結果により、各勾配が連続しない時には、基本パターンが選出されたブロックの勾配の幅を、ブロックのぼやけ度を表すぼやけ幅として検出し、各勾配が連続する時には、ブロックに分割された画像内における各ブロックの所定方向の連なりに沿って、各勾配が連続する範囲をぼやけ幅として検出するぼやけ幅検出手段と、該検出されたぼやけ幅の長さに基づいて、画像データが表す画像のぼやけを判定するぼやけ判定手段とを備えたものとしてもよい。   In the image processing apparatus having the above configuration, the blur determination unit is adjacent to the first gradient formed by the change of each coefficient of the coefficient group of the selected basic pattern of the block from which the basic pattern is selected, and the block. The continuity test means for testing the continuity with the second gradient formed by the change in each coefficient of the coefficient group of the basic pattern selected by the block to be used and the continuity detection means, the respective gradients are not continuous Sometimes, the gradient width of the block from which the basic pattern is selected is detected as the blur width representing the blur level of the block, and when each gradient continues, it is a series of blocks in a predetermined direction in the image divided into blocks. Along the blur width detecting means for detecting a range in which each gradient continues as a blur width, and the blur of the image represented by the image data based on the length of the detected blur width. It may be that a blur determination means for determining.

このような構成によれば、ブロックの連なりに沿って、選出した基本パターンの係数群の各係数の変化が形成する勾配の連続性を検出し、勾配が連続する場合には、複数ブロックに跨って勾配が連続する範囲をぼやけ幅として検出する。従って、ぼやけの幅が1つのブロックのサイズを超える場合においても、精度良く画像がぼやけているか否かを判断することができる。   According to such a configuration, the continuity of the gradient formed by the change of each coefficient of the coefficient group of the selected basic pattern is detected along the series of blocks. Thus, the range where the gradient continues is detected as the 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.

また、かかる構成の画像処理装置において、パターン記憶部は、基本パターンと、該各基本パターンにそれぞれ一意に割り振られたパターン番号とを対応付けて記憶する手段を備え、パターン照合部は、算出された係数群の変化形状に近似する基本パターンとして、パターン番号をパターン記憶部から選出する手段を備え、連続性検定手段は、選出されたパターン番号を参照して、第1の勾配と第2の勾配との連続性を検定する手段を備えたものとしてもよい。   In the image processing apparatus having such a configuration, the pattern storage unit includes means for storing the basic pattern in association with the pattern number uniquely assigned to each basic pattern, and the pattern matching unit is calculated. As a basic pattern that approximates the changed shape of the coefficient group, a pattern number is selected from the pattern storage unit, and the continuity test means refers to the selected pattern number and refers to the first gradient and the second Means for testing continuity with the gradient may be provided.

このような構成によれば、基本パターンの各勾配の連続性を検定するにあたり、パターン番号を用いるので、基本パターンから直接的に検定する場合と比べ、パターン照合処理を高速化するとともに、使用するメモリ容量を削減することができる。   According to such a configuration, since the pattern number is used to test the continuity of each gradient of the basic pattern, the pattern matching process is accelerated and used as compared with the case of directly testing from the basic pattern. Memory capacity can be reduced.

また、かかる構成の画像処理装置において、パターン記憶部は、更に、パターン番号に対応付けて、各基本パターンの勾配の幅を記憶する手段を備え、ぼやけ幅検出手段は、各勾配が連続しない時には、パターン番号が選出されたブロックの、パターン番号に対応付けられた勾配の幅をパターン記憶部から読み出して、ぼやけ幅を検出し、各勾配が連続する時には、ブロックに分割された画像内における各ブロックの所定方向の連なりに沿って、パターン番号に対応付けられた勾配の幅をパターン記憶部から読み出し、該勾配の幅の累積値として、ぼやけ幅を検出する手段を備えたものとしてもよい。   Further, in the image processing apparatus having such a configuration, the pattern storage unit further includes means for storing the gradient width of each basic pattern in association with the pattern number, and the blur width detection means is configured so that each gradient is not continuous. When the gradient number associated with the pattern number is read from the pattern storage unit, the blur width is detected, and when each gradient continues, each block in the image divided into blocks is read. It is also possible to provide means for reading the width of the gradient associated with the pattern number from the pattern storage unit along the series of blocks in a predetermined direction, and detecting the blur width as an accumulated value of the gradient width.

このような構成によれば、各基本パターンの係数群の各係数の変化が形成する勾配の幅が、パターン記憶部に予め記憶されているため、ぼやけ幅の算出を高速化することができる。   According to such a configuration, since the width of the gradient formed by the change of each coefficient of the coefficient group of each basic pattern is stored in advance in the pattern storage unit, the calculation of the blur width can be speeded up.

また、かかる構成の画像処理装置において、ぼやけ判定手段は、検出されたぼやけ幅の長さに基づいて、ブロック毎にぼやけの状況を判定するブロックぼやけ判定手段と、該判定の結果を集計して、画像全体のぼやけ判定を行う画像ぼやけ判定手段とを備えたものとしてもよい。このような構成によれば、画像全体としてのぼやけの印象を判定することができる。   Further, in the image processing apparatus having such a configuration, the blur determination unit totalizes the block blur determination unit that determines the blur situation for each block based on the length of the detected blur width, and the result of the determination. The image blur determining means for determining the blur of the entire image may be provided. According to such a configuration, it is possible to determine the blur impression of the entire image.

あるいは、かかる構成の画像処理装置において、ぼやけ判定手段は、検出されたぼやけ幅の長さに基づいて、ブロック毎にぼやけの状況を判定するブロックぼやけ判定手段と、画像データ内の、所定数のブロックで構成されるウィンドウ領域に含まれる全ブロックについて、ブロックぼやけ判定部に判定されたぼやけの状況を集計し、該集計結果に基づき、該ウィンドウ領域内がぼやけているか否かを判断するウィンドウぼやけ判定手段と、画像データ中において、ウィンドウ領域を移動させていった結果、少なくとも1カ所、ぼやけていないと判断されたウィンドウ領域が存在する場合に、画像データが表す画像全体がぼやけていないと判断する画像ぼやけ判定手段とを備えたものとしてもよい。   Alternatively, in the image processing apparatus configured as described above, the blur determination unit includes a block blur determination unit that determines a blur situation for each block based on the length of the detected blur width, and a predetermined number of image data. The window blur is determined for each block included in the window area composed of blocks by summing up the blur conditions determined by the block blur determination unit and determining whether or not the window area is blurred based on the total result. When at least one window area that is determined not to be blurred exists as a result of moving the window area in the image data with the determination means, it is determined that the entire image represented by the image data is not blurred. It is good also as what is provided with the image blurring determination means to perform.

このような構成によれば、所定数のブロックによって構成されるウィンドウ領域毎にぼやけの有無を判断することができるので、より人の感性に近い精度で画像にぼやけが生じているかを判断することが可能になる。また、ぼやけていないウィンドウ領域が1箇所でも検出されると、残りのウィンドウ領域についてのぼやけ判定処理を省略できるため、処理を高速化できる。なお、所定のウィンドウ領域としては、例えば、画像データがL版の印刷用紙に印刷されると想定すると、1cm×1cmや2cm×2cmの領域とすることができる。このようなサイズのウィンドウ領域内が画像中のいずれかの箇所でぼやけていないと判断されれば、その領域に焦点が合っているものと判断することができるためである。   According to such a configuration, since it is possible to determine the presence or absence of blur for each window area constituted by a predetermined number of blocks, it is possible to determine whether or not the image is blurred with an accuracy closer to human sensitivity. Is possible. Further, if even one non-blurred window area is detected, the blur determination process for the remaining window areas can be omitted, so that the processing can be speeded up. 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.

また、かかる構成の画像処理装置において、所定方向は、水平方向および垂直方向であり、ブロックパターン算出部は、係数群として、画像データのブロック内での水平方向の変化を表す第1の係数群と、画像データのブロック内での垂直方向の変化を表す第2の係数群とを算出する手段を備え、パターン照合部は、第1の係数群と第2の係数群とについて、それぞれ、近似する基本パターンを選出する手段を備え、ぼやけ検出手段は、水平方向および垂直方向についてそれぞれ、ぼやけ幅を検出する水平/垂直ぼやけ幅検出手段を備え、ぼやけ判定手段は、水平方向と垂直方向とについてそれぞれ算出されたぼやけ幅のうち、大きい方のぼやけ幅の長さに基づき、画像データが表す画像のぼやけを判定する水平/垂直ぼやけ判定手段を備えたものとしてもよい。   In the image processing apparatus having such a configuration, the predetermined directions are the horizontal direction and the vertical direction, and the block pattern calculation unit is a first coefficient group representing a change in the horizontal direction in the block of image data as a coefficient group. And a second coefficient group that represents a change in the vertical direction within the block of image data, and the pattern matching unit approximates the first coefficient group and the second coefficient group, respectively. Means for selecting a basic pattern to be performed, the blur detection means includes horizontal / vertical blur width detection means for detecting the blur width in the horizontal direction and the vertical direction, respectively, and the blur determination means is in the horizontal direction and the vertical direction. Horizontal / vertical blur determination means for determining blur of an image represented by image data based on the longer blur width of the calculated blur widths. It may be a thing.

このような構成によれば、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.

また、かかる構成の画像処理装置において、パターン照合部は、算出された係数群が所定の分散の範囲内となるような条件を満たす時には、基本パターンの選出を行わないものとしてもよい。   In the image processing apparatus having such a configuration, the pattern matching unit may not select a basic pattern when a condition that the calculated coefficient group is within a predetermined dispersion range is satisfied.

このような構成によれば、算出した係数群によりブロック内の画素値の変化が小さいと判断される場合には、基本パターンの選出を省略できるため、処理を高速化できる。   According to such a configuration, when it is determined that the change in the pixel value in the block is small due to the calculated coefficient group, the selection of the basic pattern can be omitted, so that the processing can be speeded up.

また、かかる構成の画像処理装置において、パターン照合部は、複数種類の基本パターンの中から、算出された係数群との平均誤差が最小となる基本パターンをパターン記憶部から選出するものとしてもよい。   In the image processing apparatus having such a configuration, the pattern matching unit may select, from the pattern storage unit, a basic pattern that minimizes the average error with the calculated coefficient group from a plurality of types of basic patterns. .

このような構成によれば、パターン照合部は、複数種類の基本パターンの中から最も近似する基本パターンを選出できるため、高い精度でぼやけを検出し、ぼやけ判定を行うことができる。   According to such a configuration, since the pattern matching unit can select the most basic pattern from a plurality of types of basic patterns, it can detect blur and perform blur determination with high accuracy.

あるいは、かかる構成の画像処理装置において、パターン照合部は、複数種類の基本エッジパターンと算出された係数群との平均誤差を該複数種類の基本パターンの並びの順に計算する誤差計算処理を実行し、該計算された誤差が所定の閾値以下となった場合には、誤差計算処理を打ち切ると共に、該誤差が所定の閾値以下となった基本パターンをパターン記憶部から選出するものとしてもよい。   Alternatively, in the image processing apparatus having such a configuration, the pattern matching unit executes an error calculation process that calculates an average error between the plurality of types of basic edge patterns and the calculated coefficient group in the order of the arrangement of the plurality of types of basic patterns. When the calculated error is equal to or smaller than a predetermined threshold, the error calculation process may be stopped and a basic pattern having the error equal to or smaller than the predetermined threshold may be selected from the pattern storage unit.

このような構成によれば、パターン照合部は、複数種類の基本パターンの中から所定の誤差の範囲内にある基本パターンを検出した場合、誤差計算処理を打ち切るので、パターン照合処理を高速化できる。   According to such a configuration, the pattern matching unit aborts the error calculation process when detecting a basic pattern within a predetermined error range from a plurality of types of basic patterns, so that the pattern matching process can be speeded up. .

また、かかる構成の画像処理装置において、ブロックは、水平方向と垂直方向にそれぞれ8画素で構成されるものとしてもよい。   In the image processing apparatus having such a configuration, the block may be configured with 8 pixels in each of the horizontal direction and the vertical direction.

このような構成によれば、ブロックパターン算出に要する処理時間と、エッジパターン照合に要する処理時間のバランスを適正に保って、ぼやけ判定処理を高速化できる。   According to such a configuration, it is possible to speed up the blur determination process while maintaining an appropriate balance between the processing time required for block pattern calculation and the processing time required for edge pattern matching.

また、かかる構成の画像処理装置において、画像データは、RGB色空間の各階調値であり、係数群は、RGB色空間の各階調値から算出される画素ごとの輝度値または明度に基づいて算出されるものとしてもよい。   In the image processing apparatus having such a configuration, the image data is each gradation value in the RGB color space, and the coefficient group is calculated based on the luminance value or brightness for each pixel calculated from each gradation value in the RGB color space. It is good also as what is done.

このような構成によれば、輝度値または明度の変化に基づくエッジを用いて、ぼやけ判定が行えるため、精度の高いぼやけ判定を行うことができる。   According to such a configuration, blur determination can be performed using an edge based on a change in luminance value or brightness, so that blur determination with high accuracy can be performed.

また、かかる構成の画像処理装置において、更に、ぼやけ判定部によってぼやけていないと判定された画像をユーザに提示する提示部を備えるものとしてもよい。   In addition, the image processing apparatus having such a configuration may further include a presentation unit that presents to the user an image determined to be unblurred by the blur determination unit.

このような構成であれば、ユーザは、撮影に成功した画像のみを確認することができる。ユーザに提示する方法としては、例えば、表示装置に画像を表示させるものとすることができる。その他、ぼやけていないと判定された画像の一覧を印刷してユーザに提示するものとしてもよい。   With such a configuration, the user can confirm only images that have been successfully photographed. 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.

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

このような構成であれば、ユーザは、手ブレや被写体ブレによって画像にぼやけの生じている画像を意識することなく、撮影に成功した画像の中から所望の画像を容易に印刷することができる。   With such a configuration, the user can easily print a desired image from images that have been successfully shot without being conscious 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.ぼやけ判定処理:
C−1.ぼやけ判定処理の流れ:
C−2.ブロックパターン算出:
C−3.エッジパターン照合処理:
C−4.エッジ連結処理:
C−5.ブロックぼやけ判定処理:
C−6.ウィンドウぼやけ判定処理:
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. Printing process:
C. Blur judgment processing:
C-1. Flow of blur determination processing:
C-2. Block pattern calculation:
C-3. Edge pattern matching process:
C-4. Edge connection processing:
C-5. Block blur judgment processing:
C-6. Window blur determination processing:

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 an 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の各種機能を利用する際のUI(ユーザインタフェース)の表示に利用される。   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 UI (user interface) when using various functions of the printer 100.

プリンタ100は、メモリカードMCやデジタルカメラ等から入力した複数の画像データの中から、ぼやけている画像(以下「ぼやけ画像」という)を排除して、ピントが1カ所でも合っている画像(以下、「合焦画像」という)のみを抽出し、液晶ディスプレイ145に表示する機能を有している。ユーザは、こうして液晶ディスプレイ145に表示された画像の中から、所望の画像を選択することで、印刷に適した画像のみを印刷することが可能となる。   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.

図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が記憶されている。   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 used in various processes described later.

CPU160はROM180に記憶された制御プログラムをRAM170に展開して実行することで図示する各機能部(161〜166)として動作する。これらの機能部の機能については、後に詳述する。RAM170には、制御プログラムを実行するためのワークエリアのほか、図示するパターン番号バッファ171や、縦累積バッファ172、横累積バッファ173と呼ばれる記憶領域がそれぞれ確保されている。   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 functions of these functional units will be described in detail later. In addition to the work area for executing the control program, the RAM 170 has storage areas called a pattern number buffer 171, a vertical accumulation buffer 172, and a horizontal accumulation buffer 173 shown in the figure.

B.印刷処理:
図3は、プリンタ100のCPU160が実行する印刷処理のフローチャートである。この印刷処理は、メモリカードMC等から画像データを入力して印刷を行うための処理である。
B. Printing process:
FIG. 3 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から、画素毎のRGB色空間データから構成されているビットマップ画像データを入力する(ステップS10)。なお、ここでは、メモリカードMCからビットマップ画像データを入力するものとするが、USBインタフェース130を介して接続されたデジタルカメラやコンピュータ等から入力するものとしてもよい。   When this printing process is executed according to a predetermined operation of the user using the operation panel 140, first, the CPU 160 uses the image data input unit 161 to read from the memory card MC inserted into the memory card slot 120. Bitmap image data composed of RGB color space data for each pixel is input (step S10). Here, the bitmap image 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.

次に、CPU160は、ステップS10によって入力したビットマップ画像データについて、ぼやけ判定処理を行う(ステップS20)。このぼやけ判定処理の詳細については「C.ぼやけ判定処理」で後述する。   Next, the CPU 160 performs a blur determination process on the bitmap image data input in step S10 (step S20). Details of the blur determination process will be described later in “C. Blur determination process”.

1つのビットマップ画像データについてぼやけ判定処理を終了すると、CPU160は、メモリカードMC内のすべてのビットマップ画像データを入力してぼやけ判定処理を行ったか否かを判断する(ステップS30)。かかる処理によって、全てのビットマップ画像データのぼやけ判定処理を行っていないと判断した場合には(ステップS30:No)、処理をステップS10に戻し、次のビットマップ画像データを入力する。   When the blur determination process is completed for one bitmap image data, the CPU 160 determines whether or not the blur determination process has been performed by inputting all the bitmap image data in the memory card MC (step S30). If it is determined that the blur determination process for all bitmap image data has not been performed by this process (step S30: No), the process returns to step S10, and the next bitmap image data is input.

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

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

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

かかる構成の印刷処理装置は、画像のぼやけの判定を行い、合焦画像と判定された画像のみを表示して、印刷指示を受け付けるので、ユーザが視覚的にぼやけの判定を行うことが困難な小型の液晶ディスプレイを搭載した印刷装置であっても、ユーザは、撮影に成功した画像のみを確認しながら、所望の画像を容易に印刷することができる。   The print processing apparatus configured as described above determines whether the image is blurred, displays only the image determined to be a focused image, and accepts a print instruction. Therefore, it is difficult for the user to visually determine the blur. Even in a printing apparatus equipped with a small liquid crystal display, a user can easily print a desired image while confirming only an image that has been successfully photographed.

C.ぼやけ判定処理:
C−1.ぼやけ判定処理の流れ:
図4は、図3に示した印刷処理のステップS20で実行されるぼやけ判定処理のフローチャートである。この処理が開始されると、まず、CPU160は、ぼやけ判定を行うべきウィンドウ(以下、「注目ウィンドウ」という)をその連なりに沿って移動する(ステップS100)。最初の移動先は、ビットマップ画像データの最も左上に存在するウィンドウである。注目ウィンドウは、ステップS100の処理が実行される度に、右方向へウィンドウの幅分だけ移動し、画像の右端まで到達すると、左端に戻ると共にウィンドウの高さ分だけ下に移動し、再度、右方向へ移動する。なお、本実施例において、上述のウィンドウとは、L版の印刷用紙において、最小の合焦エリアと想定される約1cm×約1cmのサイズの領域を表しており、このウィンドウ領域を単位としたぼやけ判定結果に基づき、最終的に画像全体のぼやけ判定を行うものである。
C. Blur judgment processing:
C-1. Flow of blur determination processing:
FIG. 4 is a flowchart of the blur determination process executed in step S20 of the printing process shown in FIG. When this process is started, first, the CPU 160 moves windows to be subjected to blurring determination (hereinafter referred to as “target window”) along the series (step S100). The first destination is the window that exists at the upper left of the bitmap image data. The attention window moves to the right by the width of the window each time the process of step S100 is executed, and when it reaches the right edge of the image, it returns to the left edge and moves downward by the height of the window. Move to the right. In the present embodiment, the above-described window represents an area of a size of about 1 cm × about 1 cm, which is assumed to be the minimum focusing area, on the L-size printing paper, and this window area is used as a unit. Based on the blur determination result, the blur determination of the entire image is finally performed.

注目ウィンドウを移動すると、CPU160は、ブロックパターン算出部162を用いて、現在の注目ウィンドウのブロックパターンを算出する(ステップS110)。このブロックパターンの算出とは、ビットマップ画像データを所定の画素数で構成されるブロックを単位として分割して、このブロックごとに、画素値の変化を表す係数群を算出する処理である(詳細な処理内容については、「C−2.ブロックパターン算出」で後述)。   When the attention window is moved, the CPU 160 calculates the block pattern of the current attention window by using the block pattern calculation unit 162 (step S110). The calculation of the block pattern is a process of dividing the bitmap image data into blocks each having a predetermined number of pixels and calculating a coefficient group representing a change in pixel value for each block (details). The details of the processing will be described later in “C-2. Block pattern calculation”).

本実施例において、上述のブロックは、図5(a)に示すように、水平方向と垂直方向がそれぞれ8画素からなる計64画素で構成されるものとした。L版の印刷用紙(約13cm×縦約9cm)に、600万画素(横約3000画素×縦約2000画素)の画像を印刷すると、8画素×8画素の1ブロックのサイズは、約0.35mm×約0.35mmになる。そのため、約1cm×約1cmのウィンドウ領域内には、図5(b)に示すように、28×28個のブロックが存在することになる。なお、本実施例では、上述のように、L版の印刷用紙に600万画素の画像を印刷することを想定して、ウィンドウのサイズを約1cm×約1cmとしているが、印刷対象の用紙サイズ、画像の画素数、CPUの処理速度等に応じて、ウィンドウサイズが適宜変更されることは言うまでもない。例えば、A4版で印刷する場合や、300万画素の画像を印刷する場合、CPUの処理速度を向上できる場合などは、ウィンドウサイズを大きく、例えば、約2cm×約2cmとしてもよい。   In this embodiment, as shown in FIG. 5A, the above-described block is composed of a total of 64 pixels each consisting of 8 pixels in the horizontal direction and the vertical direction. When an image of 6 million pixels (approximately 3000 pixels wide × approximately 2000 pixels long) is printed on L-size printing paper (approximately 13 cm × approximately 9 cm long), the size of one block of 8 pixels × 8 pixels is approximately 0.2 mm. 35 mm × about 0.35 mm. Therefore, 28 × 28 blocks exist in the window area of about 1 cm × about 1 cm, as shown in FIG. 5B. In this embodiment, as described above, assuming that an image of 6 million pixels is printed on the L-size printing paper, the size of the window is about 1 cm × about 1 cm. Needless to say, the window size is appropriately changed according to the number of pixels of the image, the processing speed of the CPU, and the like. For example, when printing in A4 size, when printing an image of 3 million pixels, or when the processing speed of the CPU can be improved, the window size may be increased, for example, about 2 cm × about 2 cm.

ブロックパターンを算出すると、CPU160は、パターン照合部163を用いて、エッジパターン照合処理を実行する(ステップS120)。この処理は、ブロック内の画素値の代表的な変化形状を係数群によって表した複数種類の基本エッジパターンを分類して記憶したエッジパターンテーブル181から、上記ステップS110において算出された係数群の変化形状に近似する基本エッジパターンをエッジパターンテーブル181から選出し、その基本エッジパターンに割り振られたパターン番号をRAM170に確保したパターン番号バッファ171に保存するための処理である(詳細な処理内容については「C−3.エッジパターン照合処理」で後述)。   When the block pattern is calculated, the CPU 160 uses the pattern matching unit 163 to execute an edge pattern matching process (step S120). This processing is performed by changing the coefficient group calculated in step S110 from the edge pattern table 181 in which a plurality of types of basic edge patterns representing representative change shapes of pixel values in the block are represented by coefficient groups. This is a process for selecting a basic edge pattern that approximates the shape from the edge pattern table 181 and storing the pattern number assigned to the basic edge pattern in the pattern number buffer 171 secured in the RAM 170 (for details of processing details) It will be described later in “C-3. Edge pattern matching process”.

エッジパターン照合処理が行われると、CPU160は、エッジ連結部164を用いて、パターン番号バッファ171等を参照して、エッジ連結処理を実行する(ステップS130)。このエッジ連結処理では、上記ステップS120で選出された基本エッジパターンについて、注目ブロックと隣接するブロックが同じ傾き方向であれば、これらのブロック同士のぼやけ幅(画素値の変化の勾配の幅)を累積加算し、注目ブロックのぼやけ幅が算出される(詳細な処理内容については、「C−4.エッジ連結処理」で後述)。   When the edge pattern matching process is performed, the CPU 160 refers to the pattern number buffer 171 and the like using the edge linking unit 164 and executes the edge linking process (step S130). In this edge linking process, if the basic edge pattern selected in step S120 above has the same inclination direction as the target block, the blur width (the gradient width of the change in pixel value) between these blocks is calculated. Cumulative addition is performed to calculate the blur width of the block of interest (detailed processing content will be described later in “C-4. Edge connection processing”).

エッジ連結処理が行われると、CPU160は、ブロックぼやけ判定部165を用いて、ブロックぼやけ判定処理を実行する(ステップS140)。この処理は、エッジ連結処理によって算出されたぼやけ幅に基づき、注目ブロックがぼやけているか否かを判定するための処理である。本実施例においては、かかる処理の実行結果として、注目ブロックが、「ぼやけブロック」、「合焦ブロック」、「平坦ブロック」のいずれかの判定結果として取得される。なお、本実施例における「平坦」とは、ブロック内の色の変化が少ない状態をいい、平坦ブロックは、ぼやけの判定を行いにくいため、ぼやけブロックと合焦ブロック以外にこのような区分を設けている(詳細な処理内容については「C−5.ブロックぼやけ判定処理」で後述)。   When the edge connection process is performed, the CPU 160 uses the block blur determination unit 165 to execute the block blur determination process (step S140). 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. In the present embodiment, the block of interest is acquired as a determination result of any one of “blurred block”, “focused block”, and “flat block” as the execution result of such processing. In this embodiment, “flat” means a state in which the color change in the block is small. Since a flat block is difficult to determine blur, such a division is provided in addition to the blur block and the focused block. (Detailed processing contents will be described later in “C-5. Block blur determination processing”).

ブロックぼやけ判定処理の判定がなされると、CPU160は、ウィンドウぼやけ判定部166を用いて、その注目ウィンドウ領域全体について、ウィンドウぼやけ判定処理を行う(ステップ150)。この処理は、上記ステップS140でなされたブロックごとのぼやけ判定結果を集計して、ウィンドウ領域としてのぼやけ判定を行うものである(詳細な処理内容については「C−6.ウィンドウぼやけ判定処理」で後述)。   When the block blur determination process is determined, the CPU 160 uses the window blur determination unit 166 to perform the window blur determination process for the entire window area of interest (step 150). In this process, the blur determination results for each block made in step S140 are aggregated to perform blur determination as a window area (for detailed processing contents, refer to “C-6. Window blur determination process”). Later).

上記ステップS150においてウィンドウぼやけ判定処理が終了すると、CPU160は、この判定処理の判定結果に基づき、現在のウィンドウ領域が合焦ウィンドウであるか否かを判断する(ステップS160)。その結果、当該ウィンドウが合焦ウィンドウであれば(ステップS160:Yes)、現在入力しているビットマップ画像が合焦していると判定し(ステップS170)、上述した一連のぼやけ判定処理を終了する。つまり、画像内のいずれかのウィンドウ領域が合焦ウィンドウであると判定された時点で、図3のステップS10で入力したビットマップ画像が合焦画像であると判断することになる。こうすることで、画像内のいずれかのウィンドウ領域が合焦ウィンドウであれば、画像内のすべてのウィンドウ領域についてぼやけの有無を判定する必要がないため、ぼやけ判定処理に要する時間を高速化することができる。   When the window blur determination process ends in step S150, 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 S160). As a result, if the window is an in-focus window (step S160: Yes), it is determined that the currently input bitmap image is in focus (step S170), and the above-described series of blur determination processing ends. To do. That is, when it is determined that any window area in the image is a focused window, it is determined that the bitmap image input in step S10 in FIG. 3 is a focused image. In this way, if any window area in the image is an in-focus window, it is not necessary to determine the presence or absence of blur for all window areas in the image, so the time required for the blur determination process is increased. be able to.

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

かかる構成の画像処理装置は、ブロックごとのぼやけ幅を連結処理して、複数のブロック間に及ぶぼやけ幅を算出することができるので、ぼやけの幅が1つのブロックのサイズを超える場合においても、精度良く画像がぼやけているか否かを判断することができる。また、複数のブロックによって構成されるウィンドウ領域毎にぼやけの有無を判断することができるので、より人の感性に近い精度で画像にぼやけが生じているかを判断することが可能になる。このようなサイズのウィンドウ領域内が画像中のいずれかの箇所でぼやけていないと判断されれば、その領域に焦点が合っているものと判断することができるためである。   Since the image processing apparatus having such a configuration can calculate the blur width between a plurality of blocks by concatenating the blur width for each block, even when the blur width exceeds the size of one block, It can be determined whether or not the image is blurred with high accuracy. In addition, since it is possible to determine the presence or absence of blur for each window area constituted by a plurality of blocks, it is possible to determine whether or not the image is blurred with an accuracy closer to human sensitivity. 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.

なお、本実施例では、注目ウィンドウは、ステップS100の処理が実行される度に、最初の移動先である最も左上に存在するウィンドウから右方向へウィンドウの幅分だけ移動し、画像の右端まで到達すると、左端に戻ると共にウィンドウの高さ分だけ下に移動し、再度、右方向へ移動する設定としたが、これに限られるものではなく、種々の方法が設定可能である。例えば、最初の移動先を画像の真ん中に位置するウィンドウとし、そこから同心円的に外周に移動していく設定としたり、最初の移動先を最も右下に存在するウィンドウとし、そこから左方向に移動し、画像の左端まで到達すると、右端に戻ると共に再度右方向へ移動する設定としたりできる。また、対象画像の種類、例えば、風景写真画像と肖像写真画像に応じて、別々の設定とすることも可能である。例えば、対象画像が肖像写真画像の場合には、上述の最初の移動先を画像の真ん中に位置するウィンドウとする設定とすれば、人物が存在する領域、すなわち、合焦しているウィンドウを含む領域は、画像の中央部付近にあることが多いため、合焦ウィンドウをより早く検出でき、ぼやけ判定処理を高速化できる。   In the present embodiment, each time the process of step S100 is executed, the window of interest moves to the right edge of the image from the window at the top left, which is the first destination, to the right by the width of the window. When it reaches, the setting returns to the left end, moves downward by the height of the window, and moves to the right again. However, the present invention is not limited to this, and various methods can be set. For example, the first destination is a window located in the middle of the image, and the setting is to move to the outer periphery concentrically from there, or the first destination is the window that exists at the bottom right, and from there to the left When it moves and reaches the left end of the image, it can be set to return to the right end and move to the right again. Also, different settings can be made according to the type of target image, for example, a landscape photo image and a portrait photo image. For example, when the target image is a portrait photo image, if the first destination described above is set as the window located in the middle of the image, the region including the person, that is, the focused window is included. Since the region is often near the center of the image, the focusing window can be detected earlier, and the blur determination process can be speeded up.

また、本実施例では、注目ウィンドウは、順次移動していき、最終的には、画像全体に注目ウィンドウが及ぶものとしたが、これに限られるものではなく、画像の限られた領域のみを移動するものとしてもよい。例えば、肖像写真画像の場合は、上述の通り、合焦しているウィンドウを含む領域は、画像中央部付近にあることが多いため、画像の中央部のみを注目ウィンドウが移動するものとすれば、ぼやけ判定の精度を保ちつつ、処理を高速化できる。   In this embodiment, the target window moves sequentially, and finally the target window covers the entire image. However, the present invention is not limited to this, and only a limited area of the image is displayed. It may be moved. For example, in the case of a portrait photo image, as described above, since the region including the focused window is often near the center of the image, if the target window moves only in the center of the image, The processing speed can be increased while maintaining the accuracy of blur determination.

また、本実施例では、注目ウィンドウの移動は、ウィンドウの幅または高さ分ずつ移動することとしたが、これに限られるものではなく、移動幅を大きく、例えば、ウィンドウの幅または高さの1.5倍の幅ずつ移動するものとしてもよい。こうすれば、ウィンドウぼやけ判定処理を行うウィンドウ数が少なくなり、ぼやけ判定処理を高速化できる。また、逆に、移動幅を小さく、例えば、数画素分ずつ移動するものとしたり、ウィンドウの幅または高さの半分ずつ移動するものとしたりしてもよい。こうすれば、本実施例のウィンドウを跨ぐような合焦領域が存在する場合についても正確にぼやけ判定を行うことができ、ぼやけ判定処理の精度を向上させることができる。   In this embodiment, the window of interest is moved by the width or height of the window. However, the movement is not limited to this, and the movement width is increased, for example, the window width or height. It may be moved by a width of 1.5 times. In this way, the number of windows for performing the window blur determination process is reduced, and the blur determination process can be speeded up. Conversely, the movement width may be small, for example, it may be moved by several pixels, or it may be moved by half the width or height of the window. In this way, it is possible to accurately perform blur determination even when there is an in-focus area that spans the window of the present embodiment, and the accuracy of blur determination processing can be improved.

また、本実施例では、ぼやけ判定処理は、ブロックごとのぼやけ判定結果を集計して、ウィンドウ単位で行うものとしたが、ウィンドウをさらに小さなサブウィンドウに分割して、まず、サブウィンドウ単位でブロックごとのぼやけ判定結果を集計して、さらにその結果を集計して、ウィンドウ単位のぼやけ判定を行うこととしてもよい。こうすれば、ぼやけ判定処理に利用されるバッファをコンパクト化することができる。   Further, in this embodiment, the blur determination process is performed for each window by summing up the blur determination results for each block. However, the window is divided into smaller sub-windows. The blur determination results may be aggregated, and the results may be further aggregated to perform blur determination for each window. In this way, the buffer used for the blur determination process can be made compact.

あるいは、ぼやけ判定処理は、ブロックごとのぼやけ判定結果を集計して、画像単位で行うものとしてもよい。こうすれば、画像全体としてのぼやけの印象を判定することができる。   Alternatively, the blur determination process may be performed on an image basis by summing up the blur determination results for each block. In this way, it is possible to determine the blur impression of the entire image.

C−2.ブロックパターン算出
図6は、図4に示したぼやけ判定処理のステップS110で実行されるブロックパターン算出のフローチャートである。CPU160は、ブロックパターン算出部162を用いて、次の手順により、ブロックパターンの算出処理を実行する。
C-2. Block Pattern Calculation FIG. 6 is a flowchart of block pattern calculation executed in step S110 of the blur determination process shown in FIG. The CPU 160 uses the block pattern calculation unit 162 to execute block pattern calculation processing according to the following procedure.

この処理が開始されると、CPU160は、ビットマップ画像データを、図5(a)で示したように、水平方向と垂直方向がそれぞれ8画素からなる計64画素で構成されるブロックに分割する(ステップS200)。   When this processing is started, the CPU 160 divides the bitmap image data into blocks each composed of a total of 64 pixels each having 8 pixels in the horizontal direction and the vertical direction, as shown in FIG. (Step S200).

次に、CPU160は、ステップS200で分割したブロックごとに、ピットマップ画像データの各画素のRGB成分を輝度値に変換する(ステップS210)。上述の変換は、具体的には、次式(1)を用いて、RGB色空間の各階調値R,G,BからYCbCr色空間のY成分(輝度値)を算出する。
Y=0.299R+0.587G+0.114B・・・(1)
Next, the CPU 160 converts the RGB component of each pixel of the pit map image data into a luminance value for each block divided in step S200 (step S210). Specifically, in the above-described conversion, the Y component (luminance value) of the YCbCr color space is calculated from the gradation values R, G, and B of the RGB color space using the following equation (1).
Y = 0.299R + 0.587G + 0.114B (1)

次に、CPU160は、ステップS210で変換した輝度値を用いて、ブロック内の水平方向、垂直方向の輝度値の変化を表す水平方向輝度パターン及び垂直方向輝度パターンを算出し(ステップS220)、さらに、これらを正規化して、水平方向正規化輝度パターン及び垂直方向正規化輝度パターンを算出し(ステップS230)、図4に示したぼやけ判定処理に戻る。   Next, the CPU 160 calculates a horizontal luminance pattern and a vertical luminance pattern representing changes in the horizontal and vertical luminance values in the block using the luminance value converted in step S210 (step S220), and further These are normalized to calculate a horizontal direction normalized luminance pattern and a vertical direction normalized luminance pattern (step S230), and the process returns to the blur determination process shown in FIG.

ステップS220,S230については、図7を用いて詳述する。図7は、ブロック内の各画素の輝度値から当該ブロック内の水平方向または垂直方向の輝度変化を表す正規化輝度パターンの算出方法を示す説明図である。図中に示すF11〜F88は、ステップS210で変換された、ブロック内の各画素の輝度値を表している。   Steps S220 and S230 will be described in detail with reference to FIG. FIG. 7 is an explanatory diagram illustrating a method of calculating a normalized luminance pattern that represents a luminance change in the horizontal direction or the vertical direction in the block from the luminance value of each pixel in the block. F11 to F88 shown in the figure represent the luminance value of each pixel in the block converted in step S210.

ステップS220では、上述の通り、ステップS210で変換された輝度値を用いて、ブロック内の水平方向の輝度変化を表す水平方向輝度パターンと、ブロック内の垂直方向の輝度変化を垂直方向輝度パターンとを算出する。本実施例においては、ステップS200で分割されたブロックは、水平方向、垂直方向共に8画素で構成されるため、上述の輝度パターンは、水平方向、垂直方向共に8要素係数で構成される係数群となる。ブロック内の水平方向の輝度変化を表す水平方向輝度パターンFLm(mは1〜8の整数)は、ブロック内の水平方向のm列目に属する垂直方向の8画素の輝度値の平均値として算出される。例えば、図示するように、ブロック内の水平方向の1列目の画素の輝度パターンFL1は、この1列目に属する8画素の輝度値F11〜F81の平均値となる。同様に、ブロック内の垂直方向の輝度変化を表す垂直方向輝度パターンFVn(nは1〜8の整数)は、垂直方向のn行目に属する水平方向の8画素の輝度値の平均値として算出される。例えば、図示するように、垂直方向の2行目の画素の輝度パターンFV2は、この2行目に属する8画素の輝度値F21〜F28の平均値となる。すなわち、FLm、FVn(m,nは1〜8の整数)は、次式(2),(3)により算出される。   In step S220, as described above, using the luminance value converted in step S210, a horizontal luminance pattern representing a horizontal luminance change in the block, and a vertical luminance change in the block as a vertical luminance pattern. Is calculated. In this embodiment, since the block divided in step S200 is composed of 8 pixels in both the horizontal direction and the vertical direction, the above luminance pattern is a coefficient group composed of 8 element coefficients in both the horizontal direction and the vertical direction. It becomes. A horizontal luminance pattern FLm (m is an integer of 1 to 8) representing a horizontal luminance change in the block is calculated as an average value of luminance values of eight pixels in the vertical direction belonging to the m-th column in the horizontal direction in the block. Is done. For example, as shown in the drawing, the luminance pattern FL1 of the pixels in the first column in the horizontal direction in the block is an average value of the luminance values F11 to F81 of the eight pixels belonging to the first column. Similarly, a vertical luminance pattern FVn (n is an integer of 1 to 8) representing a luminance change in the vertical direction in the block is calculated as an average value of luminance values of eight pixels in the horizontal direction belonging to the nth row in the vertical direction. Is done. For example, as illustrated, the luminance pattern FV2 of the pixels in the second row in the vertical direction is an average value of the luminance values F21 to F28 of the eight pixels belonging to the second row. That is, FLm and FVn (m and n are integers of 1 to 8) are calculated by the following equations (2) and (3).

Figure 2008129912
Figure 2008129912
Figure 2008129912
Figure 2008129912

なお、本実施例では、水平方向輝度パターンFLm及び垂直方向輝度パターンFVnは、上式(2),(3)により算出するものとしたが、これに限られるものではない。例えば、ブロック内の水平方向の輝度変化を表す水平方向輝度パターンFLmは、水平方向のm列目に属する垂直方向の8画素の輝度値の和として与えるなど、対応する方向の画素の輝度値を相対的に表すことが可能な算出方法であればよい。   In the present embodiment, the horizontal luminance pattern FLm and the vertical luminance pattern FVn are calculated by the above formulas (2) and (3). However, the present invention is not limited to this. For example, a horizontal luminance pattern FLm representing a horizontal luminance change in a block is given as a sum of luminance values of eight pixels in the vertical direction belonging to the m-th column in the horizontal direction. Any calculation method that can be expressed relatively may be used.

次に、ステップS230では、図7に図示するように、ステップS220で算出した8要素係数で構成される係数群である、水平方向輝度パターンFL1〜FL8、垂直方向輝度パターンFV1〜FV8をそれぞれ正規化する。これにより、同数の係数群である、水平方向正規化輝度パターン(本願の第1の係数群としての実施例)RL1〜RL8、垂直方向正規化輝度パターン(本願の第2の係数群としての実施例)RV1〜RV8を算出する。本実施例においては、上述の正規化は、次式(4),(5)の正規化関数によって、行うものとした。   Next, in step S230, as shown in FIG. 7, the horizontal luminance patterns FL1 to FL8 and the vertical luminance patterns FV1 to FV8, which are coefficient groups composed of the eight element coefficients calculated in step S220, are respectively normalized. Turn into. Thus, the same number of coefficient groups, horizontal normalized luminance patterns (examples as the first coefficient group of the present application) RL1 to RL8, vertical normalized luminance patterns (implementation as the second coefficient group of the present application) Example) RV1 to RV8 are calculated. In the present embodiment, the above normalization is performed by the normalization functions of the following expressions (4) and (5).

Figure 2008129912
Figure 2008129912
Figure 2008129912
Figure 2008129912

このように正規化を行うことにより、各要素係数の値は異なるが、相対的な変化量は同じであるようなステップS220の複数の輝度パターンを、同一のパターンとして扱うことができるようになるため、後述する基本エッジパターンとのマッチングを効率化することができる。   By performing normalization in this way, it becomes possible to treat a plurality of luminance patterns in step S220 that have different values of the respective element coefficients but have the same relative change amount as the same pattern. Therefore, it is possible to improve the matching with the basic edge pattern described later.

なお、本実施例においては、数式(4),(5)に示した正規化関数を用いたが、これに限られるものではない。例えば、正規化輝度パターンの各要素係数の和が0となるような別の正規化関数や、各要素係数について絶対値を計算し、それらの絶対値の大きさの比に応じて、正規化後の各要素係数の合計が1となるような正規化関数を用いてもよい。   In the present embodiment, the normalization functions shown in Equations (4) and (5) are used, but the present invention is not limited to this. For example, another normalization function in which the sum of the element coefficients of the normalized luminance pattern is 0, or the absolute value of each element coefficient is calculated, and the normalization is performed according to the ratio of the magnitudes of the absolute values. You may use the normalization function that the sum of each subsequent element coefficient becomes 1.

また、本実施例では、図4におけるステップS110のブロックパターン算出に要する処理時間と、ステップS120のエッジパターン照合及びステップS130のエッジ連結処理に要する処理時間のバランスを適正に保って、ぼやけ判定処理の高速化を図るために、図6のステップS200において、水平方向と垂直方向がそれぞれ8画素からなる計64画素で構成されるブロックに分割したが、これに限られるものではない。CPU160の性能や画像の画素数、印刷用紙のサイズ等に応じて、さらに小さいブロック、例えば水平方向と垂直方向がそれぞれ4画素からなる計16画素のブロックとしたり、さらに大きなブロック、例えば、水平方向と垂直方向がそれぞれ16画素からなる計256画素のブロックとしたりしてもよい。この場合、分割されたブロックの構成画素数に応じて、図7に示した各係数群の要素数も変わることとなる。   Further, in this embodiment, the blur determination process is performed by appropriately maintaining the balance between the processing time required for block pattern calculation in step S110 in FIG. 4 and the processing time required for edge pattern matching in step S120 and edge connection processing in step S130. In step S200 of FIG. 6, the block is divided into blocks each consisting of a total of 64 pixels each consisting of 8 pixels in the horizontal direction and the vertical direction. However, the present invention is not limited to this. Depending on the performance of the CPU 160, the number of pixels of the image, the size of the printing paper, etc., a smaller block, for example, a block of 16 pixels in total consisting of 4 pixels each in the horizontal and vertical directions, or a larger block, for example, the horizontal direction The vertical direction may be a block of 256 pixels each consisting of 16 pixels. In this case, the number of elements of each coefficient group shown in FIG. 7 also changes according to the number of constituent pixels of the divided block.

また、本実施例では、図6のステップS210において、RGB色空間の各階調値からYCbCrのY成分(輝度値)を算出して、この値を用いて、ステップS220で輝度パターンを算出したが、これに限られるものではない。例えば、RGB色空間のうち最も人間の眼の分光感度が高いG成分の階調値を用いたり、HSV色空間のV成分(明度)を用いたりしてもよい。なお、HSV色空間のV成分は、RGB色空間の各階調値の最大値として与えられる。   In this embodiment, the Y component (luminance value) of YCbCr is calculated from each gradation value in the RGB color space in step S210 in FIG. 6, and the luminance pattern is calculated in step S220 using this value. However, it is not limited to this. For example, a G component gradation value having the highest spectral sensitivity of the human eye in the RGB color space may be used, or a V component (brightness) in the HSV color space may be used. The V component in the HSV color space is given as the maximum value of each gradation value in the RGB color space.

C−3.エッジパターン照合処理:
図8は、図4に示したぼやけ判定処理のステップS120で実行されるエッジパターン照合処理のフローチャートである。CPU160は、パターン照合部163を用いて、次の手順により、エッジパターン照合処理を実行する。
C-3. Edge pattern matching process:
FIG. 8 is a flowchart of the edge pattern matching process executed in step S120 of the blur determination process shown in FIG. The CPU 160 uses the pattern matching unit 163 to execute the edge pattern matching process according to the following procedure.

この処理が実行されると、まず、CPU160は、注目ブロックについて、ぼやけ判定処理のステップS110で算出した係数群である、水平方向正規化輝度パターンRL1〜RL8と垂直方向正規化輝度パターンRV1〜RV8とを取得する(ステップS300)。当該エッジパターン照合処理では、水平方向正規化輝度パターンRL1〜RL8と垂直方向正規化輝度パターンRV1〜RV8とについてそれぞれ同様の処理が実行されるため、以下では、これらを代表して、水平方向正規化輝度パターンRL1〜RL8に対する処理を説明する。   When this process is executed, first, the CPU 160 for the block of interest is a group of coefficients calculated in step S110 of the blur determination process, which are the horizontal direction normalized luminance patterns RL1 to RL8 and the vertical direction normalized luminance patterns RV1 to RV8. Are acquired (step S300). In the edge pattern matching process, the same processing is executed for each of the horizontal direction normalized luminance patterns RL1 to RL8 and the vertical direction normalized luminance patterns RV1 to RV8. Processing for the activated luminance patterns RL1 to RL8 will be described.

CPU160は、上記ステップS300によって、水平方向正規化輝度パターンRL1〜RL8を取得すると、この係数群の最大値と最小値の差De1を求め、これが所定の閾値Th1以上であるか否かを判断する(ステップS310)。水平方向正規化輝度パターンの最大値と最小値の差De1は、次式(6)によって求めることができる。
De1=MAX(RLm)−MIN(RLm)(mは1〜8の整数)・・・(6)
When the CPU 160 acquires the horizontal normalized luminance patterns RL1 to RL8 in step S300, the CPU 160 obtains a difference De1 between the maximum value and the minimum value of this coefficient group, and determines whether or not this is equal to or greater than a predetermined threshold value Th1. (Step S310). The difference De1 between the maximum value and the minimum value of the horizontal direction normalized luminance pattern can be obtained by the following equation (6).
De1 = MAX (RLm) −MIN (RLm) (m is an integer of 1 to 8) (6)

上記ステップS310において、係数群の最大値と最小値の差De1が所定の閾値Th1以上であると判断されれば(ステップS310:Yes)、そのブロックの水平方向には、なんらかの輝度変化があると判断できる。そこで、CPU160は、ROM180に記憶されたエッジパターンテーブル181を参照して(ステップS350)、水平方向正規化輝度パターンRL1〜RL8との平均誤差Eが所定の閾値Th2以下となる基本エッジパターンがあるか否かを判断する(ステップS360)。   If it is determined in step S310 that the difference De1 between the maximum value and the minimum value of the coefficient group is greater than or equal to a predetermined threshold value Th1 (step S310: Yes), there is some luminance change in the horizontal direction of the block. I can judge. Therefore, the CPU 160 refers to the edge pattern table 181 stored in the ROM 180 (step S350), and there is a basic edge pattern in which the average error E with the horizontal direction normalized luminance patterns RL1 to RL8 is equal to or less than a predetermined threshold Th2. It is determined whether or not (step S360).

なお、本実施例では、輝度変化の存在を判断するために、上式(5)による水平方向正規化輝度パターンRL1〜RL8の最大値と最小値の差De1を用いたが、これに限られるものではない。例えば、水平方向正規化輝度パターンRL1〜RL8の分散値など、ブロック内の輝度変化の大きさを判断できる他の指標値を用いてもよい。   In the present embodiment, the difference De1 between the maximum value and the minimum value of the horizontal direction normalized luminance patterns RL1 to RL8 according to the above equation (5) is used to determine the presence of the luminance change. It is not a thing. For example, other index values that can determine the magnitude of the luminance change in the block, such as variance values of the horizontal normalized luminance patterns RL1 to RL8, may be used.

ここで、エッジパターンテーブル181について説明する。図9は、エッジパターンテーブル181の一例を示す説明図である。このエッジパターンテーブル181には、「A1」から「A16」までのパターン番号(図の1列目)に対して16種類の基本エッジパターン(図の2列目)が対応付けて記録されている。基本エッジパターンの横軸はブロック内の係数の位置を表しており、縦軸は係数値を表している。つまり、基本エッジパターンは、水平方向正規化輝度パターンと同様に、8つの係数値からなるデータである。   Here, the edge pattern table 181 will be described. FIG. 9 is an explanatory diagram illustrating an example of the edge pattern table 181. In the edge pattern table 181, 16 basic edge patterns (second 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 position of the coefficient in the block, and the vertical axis represents the coefficient value. That is, the basic edge pattern is data composed of eight coefficient values, like the horizontal normalized luminance pattern.

これらの基本エッジパターンは、1ブロック内で傾きの符号が変化しない輝度変化の典型的な形状を、予め16種類に分類したものである。本実施例では、このように、基本エッジパターンを16種類に分類するものとするが、より多くのパターンに分類するものとしてもよい。   These basic edge patterns are obtained by classifying typical shapes of luminance changes in which the sign of inclination 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とに挟まれる勾配部分の幅を表している。   Also, the edge pattern table 181 records three types of parameters associated with the basic edge pattern: left edge width LW, center edge width MW, and 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.

なお、図9には省略したが、このエッジパターンテーブル181には、「A1」から「A16」までの基本エッジパターンが定義されたパターンテーブルAに加え、図10(a)に示すように、これらパターンテーブルAに属する基本エッジパターンを左右反転させたエッジパターンがパターン番号B1〜B16に定義されたパターンテーブルB、上下反転させたエッジパターンがパターン番号C1〜C16に定義されたパターンテーブルC、上下および左右に反転させたエッジパターンがパターン番号D1〜D16に定義されたパターンテーブルDが定義されている。つまり、全体で、64種類の基本エッジパターンがこのエッジパターンテーブル181に定義されている。   Although not shown in FIG. 9, in addition to the pattern table A in which basic edge patterns from “A1” to “A16” are defined in the edge pattern table 181, as shown in FIG. The pattern table B in which the edge patterns obtained by horizontally inverting the basic edge patterns belonging to these pattern tables A are defined as pattern numbers B1 to B16, and the pattern table C in which the vertically inverted edge patterns are defined as pattern numbers C1 to C16. A pattern table D is defined in which edge patterns inverted up and down and left and right 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.

ここで説明を図8に戻す。ステップS360において、水平方向正規化輝度パターンRL1〜RL8との平均誤差Eが所定の閾値Th2以下となる基本エッジパターンがあると判断されれば(ステップS360:Yes)、CPU160は、最も平均誤差Eが小さくなる基本エッジパターンに対応付けられたパターン番号を取得し、パターン番号バッファ171に保存する(ステップS370)。一方、所定の閾値Th2以下となる基本エッジパターンがないと判断されれば(ステップS360:No)、近似する基本エッジパターンが検索されなかったとして、パターン番号「不明」を取得し、パターン番号バッファ171に保存する(ステップS380)。   Here, the description returns to FIG. If it is determined in step S360 that there is a basic edge pattern in which the average error E with the horizontal normalized luminance patterns RL1 to RL8 is equal to or less than the predetermined threshold Th2 (step S360: Yes), the CPU 160 determines the average error E most. The pattern number associated with the basic edge pattern that decreases is acquired and stored in the pattern number buffer 171 (step S370). On the other hand, if it is determined that there is no basic edge pattern that is less than or equal to the predetermined threshold Th2 (step S360: No), the pattern number “unknown” is acquired and the pattern number buffer is obtained, assuming that the approximate basic edge pattern has not been searched It is stored in 171 (step S380).

なお、本実施例では、水平方向正規化輝度パターンRL1〜RL8と、基本エッジパターンPm(mは1〜8までの整数)との平均誤差Eは、次式(7)を用いて算出するものとしたが、他の方法により誤差を算出してもよい。   In this embodiment, the average error E between the horizontal normalized luminance patterns RL1 to RL8 and the basic edge pattern Pm (m is an integer from 1 to 8) is calculated using the following equation (7). However, the error may be calculated by other methods.

Figure 2008129912
Figure 2008129912

また、前記ステップS310において、係数群の最大値と最小値の差De1が所定の閾値Th1未満であると判断されれば(ステップS310:No)、そのブロック内の水平方向には、大きな輝度変化はないと判断できる。そこで、CPU160は、前ブロックが平坦ブロックであり、かつ、注目ブロックと前ブロックとの輝度差De2が所定の閾値Th3以上であるか否かを判断する(ステップS320)。この結果、前ブロックが平坦ブロックであり、かつ、注目ブロックと前ブロックとの輝度差De2が所定の閾値Th3以上であれば(ステップS320:Yes)、前ブロックと注目ブロックとの間に幅の短い輝度変化があると判断できることから、そこには幅1のエッジが存在するものとみなして、パターン番号「幅1」を取得し、パターン番号バッファ171に保存する(ステップS340)。   If it is determined in step S310 that the difference De1 between the maximum value and the minimum value of the coefficient group is less than the predetermined threshold value Th1 (step S310: No), a large luminance change occurs in the horizontal direction in the block. It can be judged that there is no. Therefore, the CPU 160 determines whether or not the previous block is a flat block and the luminance difference De2 between the target block and the previous block is greater than or equal to a predetermined threshold Th3 (step S320). As a result, if the previous block is a flat block and the luminance difference De2 between the target block and the previous block is greater than or equal to a predetermined threshold Th3 (step S320: Yes), a width between the previous block and the target block is increased. Since it can be determined that there is a short luminance change, it is assumed that there is an edge of width 1, and the pattern number “width 1” is acquired and stored in the pattern number buffer 171 (step S340).

なお、本実施例においては、前ブロックと注目ブロックとの輝度差De2は、次式(8)により算出するものとしたが、これに限られるものではなく、前ブロックと注目ブロックの輝度差を反映できる方法であればよい。   In this embodiment, the luminance difference De2 between the previous block and the target block is calculated by the following equation (8). However, the present invention is not limited to this, and the luminance difference between the previous block and the target block is calculated as follows. Any method can be used.

Figure 2008129912
Figure 2008129912

一方、前ブロックが平坦ブロックであり、かつ、注目ブロックと前ブロックとの輝度差De2が所定の閾値Th3以上でなければ、注目ブロック内に大きな輝度変化はなく、また、前ブロックとの間にも大きな輝度変化はないことから、この注目ブロックは平坦であると判断して、パターン番号「平坦」を取得し、パターン番号バッファ171に保存する(ステップS330)。以上の処理によって、注目ブロックのパターン番号が決定すると、上述した一連のエッジパターン照合処理は終了し、図4に示したぼやけ判定処理に戻る。   On the other hand, if the previous block is a flat block and the luminance difference De2 between the target block and the previous block is not greater than or equal to the predetermined threshold Th3, there is no significant luminance change in the target block, and there is no gap between the previous block and the previous block. Therefore, it is determined that the target block is flat, the pattern number “flat” is acquired, and stored in the pattern number buffer 171 (step S330). When the pattern number of the block of interest is determined by the above processing, the above-described series of edge pattern matching processing ends, and the process returns to the blur determination processing shown in FIG.

かかる構成のエッジパターン照合処理は、ブロック内の画素値の変化が小さいと判断される場合には、ステップS350ないしステップS370の基本エッジパターンの選出を省略できるため、エッジパターン照合処理を高速化することができる。   The edge pattern matching process having such a configuration speeds up the edge pattern matching process because the selection of the basic edge pattern in steps S350 to S370 can be omitted when it is determined that the change in the pixel value in the block is small. be able to.

なお、本実施例においては、ステップS360において、水平方向正規化輝度パターンRL1〜RL8との平均誤差Eが所定の閾値Th2以下となる基本エッジパターンがあると判断されれば(ステップS360:Yes)、CPU160は、最も誤差が小さくなる基本エッジパターンに対応付けられたパターン番号を取得するものとしたが、このような態様に限られるものではない。例えば、エッジパターンテーブル181の各基本エッジパターンの並びの順に誤差を計算していき、所定の閾値Th2以下となる基本エッジパターンがあると判断されれば、その時点で、誤差計算処理を打ち切り、誤差が所定の閾値Th2以下となる基本エッジパターンに対応付けられたパターン番号を取得するものとしてもよい。このような態様とすれば、エッジパターン照合処理を高速化することができる。また、この場合、エッジパターンテーブル181の各基本エッジパターンの並びの順は、経験的に見いだされた存在しやすい形状の順に配列すれば、より効果的である。   In this embodiment, if it is determined in step S360 that there is a basic edge pattern in which the average error E with the horizontal direction normalized luminance patterns RL1 to RL8 is equal to or less than the predetermined threshold Th2 (step S360: Yes). The CPU 160 acquires the pattern number associated with the basic edge pattern with the smallest error, but the present invention is not limited to such a mode. For example, errors are calculated in the order of the arrangement of the basic edge patterns in the edge pattern table 181. If it is determined that there is a basic edge pattern that is equal to or less than a predetermined threshold Th2, the error calculation process is terminated at that point, It is also possible to acquire a pattern number associated with a basic edge pattern whose error is equal to or less than a predetermined threshold Th2. With such an aspect, the speed of the edge pattern matching process can be increased. In this case, it is more effective if the basic edge patterns in the edge pattern table 181 are arranged in the order of the shapes that are found empirically.

また、ステップS360で、水平方向正規化輝度パターンRL1〜RL8との平均誤差Eが所定の閾値Th2以下となる基本エッジパターンがあるか否かを判断する場合において、CPU160は、水平方向正規化輝度パターンRL1〜RL8と、エッジパターンテーブル181に記憶された各々の基本エッジパターンとの誤差を計算する前に、まず、次式(9),(10)により求められるS1,S2を計算して、水平方向正規化輝度パターンRL1〜RL8が、上述のパターンテーブルA〜Dのいずれのパターンに該当するかを判断し、該当するパターンテーブルに含まれる16種類の基本エッジパターンについて、誤差計算を行うこととしてもよい。   In step S360, when determining whether or not there is a basic edge pattern in which the average error E with the horizontal normalized luminance patterns RL1 to RL8 is equal to or less than the predetermined threshold Th2, the CPU 160 determines the horizontal normalized luminance. Before calculating errors between the patterns RL1 to RL8 and each basic edge pattern stored in the edge pattern table 181, first, S1 and S2 obtained by the following equations (9) and (10) are calculated. It is determined which of the above-described pattern tables A to D corresponds to the horizontal normalized luminance patterns RL1 to RL8, and error calculation is performed on 16 types of basic edge patterns included in the corresponding pattern table. It is good.

S1=RL1+RL2+RL3+RL4−RL5−RL6−RL7−RL8・・・(9)
S2=RL1+RL2−RL3−RL4+RL5+RL6−RL7−RL8・・(10)
S1 = RL1 + RL2 + RL3 + RL4-RL5-RL6-RL7-RL8 (9)
S2 = RL1 + RL2-RL3-RL4 + RL5 + RL6-RL7-RL8 (10)

上式(9),(10)を用いれば、図10(b)に示すように、水平方向正規化輝度パターンRL1〜RL8から求められるS1,S2がともにプラスの値となる場合には、水平方向正規化輝度パターンRL1〜RL8は、パターンテーブルAのパターンに該当すると判断できる。同様に、S1,S2がともにマイナスの値となる場合にはパターンテーブルB、S1がマイナスでS2がプラスの値となる場合にはパターンテーブルC、S1がプラスでS2がマイナスの値となる場合にはパターンテーブルDのパターンに該当すると判断できる。   If the above equations (9) and (10) are used, as shown in FIG. 10 (b), when S1 and S2 obtained from the horizontal direction normalized luminance patterns RL1 to RL8 are both positive values, It can be determined that the direction normalized luminance patterns RL1 to RL8 correspond to the patterns in the pattern table A. Similarly, when both S1 and S2 are negative values, pattern table B, when S1 is negative and S2 is positive, pattern tables C and S1 are positive and S2 is negative. Can be determined to correspond to the pattern of the pattern table D.

こうすれば、パターンテーブルA〜Dに含まれる64種類の基本エッジパターンについて、水平方向正規化輝度パターンRL1〜RL8との誤差計算を行う必要があるところを、パターンテーブルA〜Dのうちいずれかひとつのパターンテーブルに含まれる16種類の基本エッジパターンについて誤差計算を行えばよいことにでき、エッジパターン照合処理を高速化できる。   In this way, any one of the pattern tables A to D may be used to calculate an error with respect to the horizontal normalized luminance patterns RL1 to RL8 for the 64 basic edge patterns included in the pattern tables A to D. Error calculation can be performed for 16 types of basic edge patterns included in one pattern table, and the speed of the edge pattern matching process can be increased.

C−4.エッジ連結処理:
図11は、図4に示したぼやけ判定処理のステップS130で実行されるエッジ連結処理のフローチャートである。この処理は、上下左右に隣接したブロックに基づき、中央のブロック(注目ブロック)のぼやけ幅を決定するための処理である。かかる処理は、水平方向と垂直方向とについて行われるが、説明を簡単にするため、特記しない限り、水平方向に対して行われる処理の説明をする。CPU160は、エッジ連結部164を用いて、次の手順により、エッジ連結処理を実行する。
C-4. Edge connection processing:
FIG. 11 is a flowchart of the edge connection process executed in step S130 of the blur determination process shown in FIG. This process is a process for determining the blur width of the central block (the target block) based on the blocks adjacent in the vertical and horizontal directions. 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. The CPU 160 uses the edge connection unit 164 to execute edge connection processing according to the following procedure.

この処理が開始されると、まず、CPU160は、エッジ連結処理を行うべき注目ブロックをその連なりに沿って移動する(ステップS500)。最初の移動先は、注目ウィンドウの最も左上に存在するブロックである。注目ブロックは、ステップS500の処理が実行される度に、右方向へ移動し、注目ウィンドウの右端まで到達すると、左端に戻ると共にブロックの高さ分だけ下に移動し、再度、右方向へ移動する。   When this process is started, first, the CPU 160 moves the target block to be subjected to the edge connection process along the series (step S500). The first destination is the block that exists at the top left of the window of interest. Each time the processing of step S500 is executed, the block of interest moves to the right, and when it reaches the right edge of the window of interest, it moves back to the left and moves down by the height of the block, and again moves to the right. To do.

注目ブロックを移動すると、CPU160は、現在の注目ブロックのパターン番号をパターン番号バッファ171から取得する(ステップS510)。   When the target block is moved, the CPU 160 obtains the current pattern number of the target block from the pattern number buffer 171 (step S510).

次に、CPU160は、ステップS510で取得したパターン番号が、「幅1」であるかを判断する(ステップS520)。その結果、パターン番号が「幅1」であれば(ステップS520:Yes)、上記ステップS120のエッジパターン照合処理において、注目ブロックと、注目ブロックの前ブロックとの間に、幅1のエッジが存在するとみなされているため(図8のステップS340参照)、注目ブロックのぼやけ幅を「1」と確定する(ステップS530)。こうして確定したぼやけ幅を、以下では、「確定ぼやけ幅DW」というものとする。   Next, the CPU 160 determines whether or not the pattern number acquired in step S510 is “width 1” (step S520). As a result, if the pattern number is “width 1” (step S520: Yes), an edge having a width 1 exists between the block of interest and the block before the block of interest in the edge pattern matching process in step S120. Since this is considered (see step S340 in FIG. 8), the blur width of the block of interest is determined as “1” (step S530). Hereinafter, the determined blur width is referred to as a “determined blur width DW”.

上記ステップS520において、パターン番号が「幅1」ではないと判断されれば(ステップS520:No)、次に、CPU160は、パターン番号が「不明」または「平坦」であるかを判断する(ステップS540)。この判断の結果、パターン番号が「不明」または「平坦」であれば(ステップS540:Yes)、上記ステップS120のエッジパターン照合処理において、注目ブロックの水平方向の輝度変化が基本エッジパターンのいずれにも近似しないか、平坦であると判定されていることになる(図8のステップS330,S380参照)。本実施例では、基本エッジパターンのいずれにも近似しない場合も「平坦」として扱い、注目ブロックの確定ぼやけ幅DWを「0」と確定する(ステップS550)。   If it is determined in step S520 that the pattern number is not “width 1” (step S520: No), then the CPU 160 determines whether the pattern number is “unknown” or “flat” (step S520). S540). If the pattern number is “unknown” or “flat” as a result of this determination (step S540: Yes), in the edge pattern matching process in step S120, the horizontal luminance change of the block of interest is any of the basic edge patterns. Is not approximated or determined to be flat (see steps S330 and S380 in FIG. 8). In the present embodiment, even if it does not approximate any of the basic edge patterns, it is treated as “flat”, and the determined blur width DW of the block of interest is determined as “0” (step S550).

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

図12は、注目ブロックと隣接ブロックとで基本エッジパターンの傾き方向が一致する例を示す説明図である。図示した例では、両ブロックの傾きは、共に右下がりであるため、両者の傾き方向は一致しているといえる。注目ブロックと隣接ブロックの傾き方向が一致する組み合わせとしては、以下のようなパターン番号の組み合わせがある。つまり、CPU160は、注目ブロックのパターン番号と隣接ブロックのパターン番号の組み合わせが、以下に示す(1)から(8)のいずれかの組み合わせに含まれれば、これらの傾き方向が一致すると判断することができる。   FIG. 12 is an explanatory diagram illustrating an example in which the inclination directions of the basic edge patterns are the same between the block of interest and the adjacent block. In the example shown in the drawing, the slopes of both blocks are downwardly inclined to the right. 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

図13は、注目ブロックと隣接ブロックとで基本エッジパターンの傾き方向が一致しない例を示す説明図である。図示した例では、注目ブロックの傾きが右下がりであるのに対して、隣接ブロックの傾きが右上がりであることから、両者の傾きは一致していないと言える。両ブロックの傾き方向が一致しないパターン番号の組み合わせは、上述した(1)から(8)以外の組み合わせである。   FIG. 13 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.

上記ステップS570において、傾き方向が一致すると判断された場合には(ステップS570:Yes)、CPU160は、続いて、注目ブロックの右側エッジ幅RWと、隣接ブロックの左側エッジ幅LWの加算値が、所定の連結誤差閾値Th4以内であるかを判断する(ステップS580)。なお、この判断に先立ち、CPU160は、隣接ブロックのパターン番号から、エッジパターンテーブル181を参照して、その左側エッジ幅LWを取得するものとする。   If it is determined in step S570 that the inclination directions match (step S570: Yes), the CPU 160 subsequently determines 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 It is determined whether it is within a predetermined connection error threshold Th4 (step S580). 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.

図14は、注目ブロックの右側エッジ幅RWと隣接ブロックの左側エッジ幅LWの加算値と連結誤差閾値Th4との比較の様子を示す説明図である。図示するように、注目ブロックの基本エッジパターンの右側に存在する平坦部(右側エッジ幅RW)と、隣接ブロックの基本エッジパターンの左側に存在する平坦部(左側エッジ幅LW)との和が大きく、連結誤差閾値Th4を超えるような場合には、注目ブロックと隣接ブロックとでは勾配が連続せず、別々のぼやけ部分を形成していると判断することができる。そのため、上記ステップS580では、「No」と判定される。これに対して、上述した和が小さく、連結誤差閾値Th4以下となる場合には、注目ブロックのエッジパターンと隣接ブロックのエッジパターンとは連続した勾配であると考えることができるため、上記ステップS580では、「Yes」と判定される。   FIG. 14 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 Th4. 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 Th4 is exceeded, it can be determined that the gradient is not continuous between the block of interest and the adjacent block, and separate blurred portions are formed. Therefore, in step S580 described above, “No” is determined. On the other hand, when the above-mentioned sum is small and becomes equal to or less than the connection error threshold Th4, 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. Then, it is determined as “Yes”.

上記ステップS580において、注目ブロックの右側エッジ幅RWと、隣接ブロックの左側エッジ幅LWの加算値が、所定の連結誤差閾値Th4以内であると判定されれば(ステップS580:Yes)、CPU160は、これまで左側(垂直方向のエッジ連結処理にあっては、上側)のブロックに累積されている累積ぼやけ幅CWを横累積バッファ173(垂直方向のエッジ連結処理にあっては、縦累積バッファ172)から読み込む。そして、この累積ぼやけ幅CWに注目ブロックの左側エッジ幅LWと中央エッジ幅MWとを加算する処理を行う(ステップS590)。こうして新たな累積ぼやけ幅CWを求めると、CPU160は、新たな値を横累積バッファ173(垂直方向のエッジ連結処理にあっては縦累積バッファ172)に上書きして更新する。こうすることで、隣接ブロック同士でエッジパターンの傾きが一方向に連続していく場合には、各ブロックのぼやけ幅を順次累積していくことができる。なお、本実施例においては、上記ステップS590では、CPU160は、注目ブロックの確定ぼやけ幅DWを便宜的に「0」と確定する。つまり、ぼやけ幅を累積する場合には、その累積途中のブロックについては、一律に平坦なブロックであるとみなすのである。   If it is determined in step S580 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 Th4 (step S580: Yes), the CPU 160 The accumulated blur width CW accumulated in the left side block so far (upper in the case of vertical edge connection processing) is stored in the horizontal accumulation buffer 173 (in the vertical edge connection processing, in the vertical accumulation buffer 172). Read from. Then, a process of adding the left edge width LW and the central edge width MW of the block of interest to the accumulated blur width CW is performed (step S590). When the new cumulative blur width CW is obtained in this way, the CPU 160 updates the new value by overwriting the horizontal cumulative buffer 173 (vertical cumulative buffer 172 in the case of vertical edge connection processing). In this way, when the gradient of the edge pattern between adjacent blocks continues in one direction, the blur width of each block can be accumulated sequentially. In this embodiment, in step S590, the 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.

図15は、上記ステップS590における累積ぼやけ幅CWの算出概念を示す説明図である。図示するように、上記ステップS590では、これまでの累積ぼやけ幅CWに対して、注目ブロックの左側エッジ幅LWと中央エッジ幅MWとを加算した値を、新たな累積ぼやけ幅CWとする。なお、かかる演算に先立ち、CPU160は、エッジパターンテーブル181を参照して、注目ブロックのパターン番号に対応する左側エッジ幅LWと中央エッジ幅MWとを取得するものとする。   FIG. 15 is an explanatory diagram showing the concept of calculating the cumulative blur width CW in step S590. As shown in the drawing, in step S590, 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.

上記ステップS570において、注目ブロックの傾き方向と隣接ブロックの傾き方向とが一致しないと判断された場合(ステップS570:No)、もしくは、上記ステップS580において、注目ブロックの右側エッジ幅RWと隣接ブロックの左側エッジ幅LWとの和が連結誤差閾値Th4を超えると判断された場合(ステップS580:No)には、CPU160は、横累積バッファ173(垂直方向のエッジ連結処理にあっては、縦累積バッファ172)から読み込んだ累積ぼやけ幅CWが「0」であるかを判断する(ステップS600)。この判断によって累積ぼやけ幅CWが「0」であると判断されれば(ステップS600:Yes)、注目ブロックはぼやけの生じる開始点であり、更に、上記ステップS570,S580における判定結果によれば、右側(垂直方向のエッジ連結処理にあっては、下側)の隣接ブロックともエッジパターンが連続しないことになるため、注目ブロックは、単独のエッジパターンを有すると判断することができる。従って、CPU160は、注目ブロックの中央エッジ幅MWを確定ぼやけ幅DWとして確定する(ステップS610)。なお、CPU160は、かかる処理に先立ち、エッジパターンテーブル181を参照して、注目ブロックのパターン番号に対応する中央エッジ幅MWを取得するものとする。   When it is determined in step S570 that the inclination direction of the target block does not match the inclination direction of the adjacent block (step S570: No), or in step S580, 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 Th4 (step S580: No), the CPU 160 determines the horizontal accumulation buffer 173 (in the vertical edge connection process, the vertical accumulation buffer). It is determined whether the accumulated blur width CW read from 172) is “0” (step S600). If it is determined by this determination that the cumulative blur width CW is “0” (step S600: Yes), the block of interest is the starting point at which blurring occurs, and further, according to the determination results in steps S570 and S580, Since the edge pattern is not continuous with the adjacent block on the right side (the lower side in the vertical edge connection process), it can be determined that the target block has a single edge pattern. Accordingly, the CPU 160 determines the center edge width MW of the block of interest as the determined blur width DW (step S610). Prior to this process, the CPU 160 refers to the edge pattern table 181 and acquires the center edge width MW corresponding to the pattern number of the block of interest.

上記ステップS600において、累積ぼやけ幅CWが「0」ではないと判断されれば、注目ブロックは、右側(垂直方向のエッジ連結処理にあっては、下側)の隣接ブロックとは連続しないが、左側(垂直方向のエッジ連結処理にあっては、上側)の隣接ブロックとは連続することになる。つまり、注目ブロックは、ぼやけ部分の終端に該当することになる。そのため、CPU160は、横累積バッファ173(垂直方向のエッジ連結処理にあっては、縦累積バッファ172)から読み込んだ累積ぼやけ幅CWに注目ブロックの左側エッジ幅LWと中央エッジ幅MWとを加算し、この値を確定ぼやけ幅DWとして確定する(ステップS620)。なお、CPU160は、かかる処理に先立ち、エッジパターンテーブル181を参照して、注目ブロックのパターン番号に対応する左側エッジ幅LWと中央エッジ幅MWとを取得するものとする。   If it is determined in step S600 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 central edge width MW of the block of interest to the accumulated blur width CW read from the horizontal accumulation buffer 173 (vertical accumulation buffer 172 in the case of vertical edge linking processing). This value is determined as the determined blur width DW (step S620). 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.

続いて、CPU160は、現在の注目ブロックが、注目ウィンドウ領域の最終ブロックであるかを判断する(ステップS630)。この結果、現在の注目ブロックが、最終ブロックであると判断されれば(ステップS630:Yes)、上述した一連のエッジ連結処理を終了し、図4に示したぼやけ判定処理に戻る。一方、現在の注目ブロックが最終ブロックでなければ(ステップS630:No)、CPU160は、上記ステップS500へ処理を戻し、次の位置のブロックについて、上述した種々の処理を繰り返し実行する。   Subsequently, the CPU 160 determines whether the current block of interest is the final block of the window of interest (step S630). As a result, if it is determined that the current block of interest is the final block (step S630: Yes), the above-described series of edge connection processing ends, and the process returns to the blur determination processing shown in FIG. On the other hand, if the current block of interest is not the final block (step S630: No), the CPU 160 returns the process to step S500, and repeatedly executes the various processes described above for the block at the next position.

かかる構成のエッジ連結処理は、基本エッジパターンに対応付けられたパターン番号と、基本エッジパターンに対応付けられたエッジ幅(LW、MW、RW)を用いて、エッジの連結を行うので、エッジパターン照合処理を高速化することができる。   In the edge linking process having such a configuration, the edge number is linked using the pattern number associated with the basic edge pattern and the edge width (LW, MW, RW) associated with the basic edge pattern. The verification process can be speeded up.

C−5.ブロックぼやけ判定処理:
図16は、図4に示したぼやけ判定処理のステップS140で実行されるブロックぼやけ判定処理のフローチャートである。この処理は、上述したエッジ連結処理に引き続いて実行される処理であり、注目ブロックが合焦しているか否かを判定する処理である。CPU160は、ブロックぼやけ判定部165を用いて、次の手順により、ブロックぼやけ判定処理を実行する。
C-5. Block blur judgment processing:
FIG. 16 is a flowchart of the block blur determination process executed in step S140 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. The CPU 160 uses the block blur determination unit 165 to execute block blur determination processing according to the following procedure.

この処理が開始されると、まず、CPU160は、ブロックぼやけ判定処理を行うべき注目ブロックをその連なりに沿って移動する(ステップS700)。最初の移動先は、注目ウィンドウの最も左上に存在するブロックである。注目ブロックは、ステップS700の処理が実行される度に、右方向へ移動し、注目ウィンドウの右端まで到達すると、左端に戻ると共にブロックの高さ分だけ下に移動し、再度、右方向へ移動する。   When this process is started, first, the CPU 160 moves a block of interest to be subjected to the block blur determination process along the series (step S700). The first destination is the block that exists at the top left of the window of interest. Each time the process of step S700 is executed, the block of interest moves to the right, and when it reaches the right edge of the window of interest, it moves back to the left and moves downward by the height of the block, and again moves to the right. To do.

次に、CPU160は、上記ステップS130のエッジ連結処理で確定された注目ブロックの水平および垂直方向の確定ぼやけ幅DWを取得し(ステップS710)、2つの確定ぼやけ幅DWのうち、大きい方の値を有する確定ぼやけ幅DWを、最大確定ぼやけ幅MDWとして決定する(ステップS720)。   Next, the CPU 160 acquires the determined blur width DW in the horizontal and vertical directions of the block of interest determined by the edge connection process in step S130 (step S710), and the larger value of the two determined blur widths DW. Is determined as the maximum defined blur width MDW (step S720).

最大確定ぼやけ幅MDWを決定すると、CPU160は、この最大確定ぼやけ幅MDWが「0」であるか否かを判断する(ステップS730)。その結果、最大確定ぼやけ幅MDWが「0」であれば(ステップS730:Yes)、水平方向、垂直方向共に大きな輝度変化がない(本実施例では、基本エッジパターンが不明なものや、ぼやけの途中に存在するブロックを含む)ということであり、CPU160は、注目ブロックは「平坦ブロック」であると判定する(ステップS740)。   When the maximum determined blur width MDW is determined, the CPU 160 determines whether or not the maximum determined blur width MDW is “0” (step S730). As a result, if the maximum definite blur width MDW is “0” (step S730: Yes), there is no large luminance change in both the horizontal and vertical directions (in this embodiment, the basic edge pattern is unknown, CPU 160 determines that the block of interest is a “flat block” (step S740).

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

以上の処理により、現在の注目ブロックが、「合焦ブロック」か「ぼやけブロック」か「平坦ブロック」かの判定が終了すると、続いて、CPU160は、現在の注目ブロックが、注目ウィンドウ領域の最終ブロックであるかを判断する(ステップS780)。この結果、現在の注目ブロックが、最終ブロックであると判断されれば(ステップS780:Yes)、上述した一連のブロックぼやけ判定処理を終了し、図4に示したぼやけ判定処理に戻る。一方、現在の注目ブロックが最終ブロックでなければ(ステップS780:No)、CPU160は、上記ステップS700へ処理を戻し、次の位置のブロックについて、上述した種々の処理を繰り返し実行する。   When the determination of whether the current block of interest is the “focus block”, the “blurred block”, or the “flat block” is completed by the above processing, the CPU 160 then determines that the current block of interest is the last of the window region of interest. It is determined whether it is a block (step S780). As a result, if it is determined that the current block of interest is the final block (step S780: Yes), the series of block blur determination processes described above is terminated, and the process returns to the blur determination process illustrated in FIG. On the other hand, if the current block of interest is not the final block (step S780: No), the CPU 160 returns the process to step S700, and repeatedly executes the various processes described above for the block at the next position.

以上で説明したブロックぼやけ判定処理によれば、水平方向の確定ぼやけ幅DWと垂直方向の確定ぼやけ幅DWとのうち、その値が大きい方の確定ぼやけ幅DWを最大確定ぼやけ幅MDWとして決定し、この最大確定ぼやけ幅MDWが所定のぼやけ幅閾値Th5以上であれば、注目ブロックがぼやけていると判断する。よって、一方向で判断する場合と比べて、精度良くぼやけ判定を行うことができる。   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 determined as the maximum determined blur width MDW. If the maximum defined blur width MDW is equal to or greater than the predetermined blur width threshold Th5, it is determined that the block of interest is blurred. Therefore, the blur determination can be performed with higher accuracy than in the case where the determination is made in one direction.

C−6.ウィンドウぼやけ判定処理:
図17は、図4に示したぼやけ判定処理のステップS150で実行されるウィンドウぼやけ判定処理のフローチャートである。上述したブロックぼやけ判定処理がブロック毎にぼやけの有無を判定する処理であるのに対して、このウィンドウぼやけ判定処理は、ブロックぼやけ判定処理の結果に基づき、図5(b)に示したウィンドウ領域毎にぼやけの有無を判定する処理である。CPU160は、ウィンドウぼやけ判定部166を用いて、次の手順により、ウィンドウぼやけ判定処理を実行する。
C-6. Window blur determination processing:
FIG. 17 is a flowchart of the window blur determination process executed in step S150 of the blur determination process shown in FIG. While the above-described block blur determination process is a process for determining the presence or absence of blur for each block, this window blur determination process is based on the result of the block blur determination process and the window region shown in FIG. This is processing for determining the presence or absence of blur for each time. The CPU 160 uses the window blur determination unit 166 to execute window blur determination processing according to the following procedure.

この処理が実行されると、CPU160は、上記ステップ140のブロックぼやけ判定処理の判定結果を用いて、注目ウィンドウ内の全てのブロックについて、合焦ブロック数とぼやけブロック数を集計する(ステップS800)。   When this process is executed, the CPU 160 uses the determination result of the block blur determination process in step 140 to count the number of in-focus blocks and the number of blur blocks for all the blocks in the window of interest (step S800). .

上記ステップS800によって、ブロック数を集計すると、CPU160は、次式(11)で示すように、合焦ブロック数Nfを、合焦ブロック数Nfとぼやけブロック数Nnの和で除して得られる合焦ブロック率Rfを計算し、この合焦ブロック率Rfが所定の合焦閾値Th6以上であるかを判断する(ステップS810)。   When the number of blocks is totaled in step S800, the CPU 160 obtains a result obtained by dividing the number of focused blocks Nf by the sum of the number of focused blocks Nf and the number of blurred blocks Nn, as shown in the following equation (11). The focal block rate Rf is calculated, and it is determined whether the focused block rate Rf is equal to or greater than a predetermined focusing threshold Th6 (step S810).

Rf=Nf/(Nf+Nn)・・・(11) Rf = Nf / (Nf + Nn) (11)

かかる判定の結果、合焦ブロックの総数が合焦閾値Th6以上であれば(ステップS810:Yes)、現在の注目ウィンドウを「合焦ウィンドウ」と判定し(ステップS830)、合焦密度閾値に満たなければ(ステップS810:No)、「ぼやけウィンドウ」と判定して、図4に示したぼやけ判定処理に戻る(ステップS820)。   If the result of this determination is that the total number of in-focus blocks is equal to or greater than the in-focus threshold Th6 (step S810: Yes), the current window of interest is determined as the “in-focus window” (step S830), and the in-focus density threshold is satisfied. If not (No at Step S810), it is determined as a “blurred window” and the process returns to the blur determination process shown in FIG. 4 (Step S820).

なお、本実施例では、ウィンドウぼやけ判定に上式(10)で得られる合焦ブロック率Rfを用いたが、これに限られるものではない。例えば、合焦ブロック数が所定の閾値以上であるか否かで、ウィンドウぼやけ判定を行うなど、他の方法を用いてもよい。また、平坦ブロック数を加味した方法、例えば、平坦ブロック数が注目ウィンドウの総ブロック数に対して、所定の割合以上を占める場合は、合焦ブロック率Rfの値にかかわらず「ぼやけウィンドウ」として扱うなどの方法を用いてもよい。   In this embodiment, the focused block rate Rf obtained by the above equation (10) is used for the window blur determination, but the present invention is not limited to this. For example, another method may be used, such as determining window blur depending on whether the number of focused blocks is equal to or greater than a predetermined threshold. In addition, a method that takes into account the number of flat blocks, for example, when the number of flat blocks occupies a predetermined ratio or more with respect to the total number of blocks in the window of interest, a “blurred window” is used regardless of the value of the focused block rate Rf A method such as handling may be used.

以上、本発明の幾つかの実施例、変形例について説明したが、本発明はこうした実施例に限られるものではなく、本発明の要旨を脱しない範囲において、種々なる態様で実施できることは勿論である。例えば、本発明の画像処理装置は、実施例に示したプリンタに限らず、デジタルスチルカメラ、カメラ付携帯電話、写真画像を拡大確認するためのフォトビューアなどに搭載することができる。もとより、コンピュータに搭載して、コンピュータのモニタで写真画像を取捨選択する場合にも採用可能である。また、ぼやけ検出方法、ぼやけ検出プログラム、またはプログラムを記録したコンピュータで読み取り可能な記録媒体等の形態でも実現することができる。   As mentioned above, although several Example and modification of this invention were described, this invention is not limited to such Example, Of course, in the range which does not deviate from the summary of this invention, it can implement in a various aspect. is there. For example, the image processing apparatus according to the present invention is not limited to the printer shown in the embodiments, but can be mounted on a digital still camera, a mobile phone with a camera, a photo viewer for enlarging a photographic image, or the like. Of course, the present invention can also be employed when the photographic image is selected on a computer monitor by being mounted on a computer. The present invention can also be realized in the form of a blur detection method, a blur detection program, or a computer-readable recording medium that records the program.

画像処理装置の実施例としてのプリンタ100の外観を示す説明図である。1 is an explanatory diagram illustrating an appearance of a printer 100 as an example of an image processing apparatus. FIG. プリンタ100の内部構成を示す説明図である。2 is an explanatory diagram illustrating an internal configuration of a printer 100. FIG. プリンタ100のCPU160が実行する印刷処理のフローチャートである。3 is a flowchart of print processing executed by a CPU 160 of the printer 100. 印刷処理で実行されるぼやけ判定処理のフローチャートである。6 is a flowchart of blur determination processing executed in printing processing. ブロックとウィンドウの概念を示す説明図である。It is explanatory drawing which shows the concept of a block and a window. ぼやけ判定処理で実行されるブロックパターン算出のフローチャートである。It is a flowchart of the block pattern calculation performed by the blurring determination process. ブロック内の各画素の輝度値から当該ブロック内の水平方向または垂直方向の輝度変化を表す正規化輝度パターンの算出方法を示す説明図である。It is explanatory drawing which shows the calculation method of the normalization brightness | luminance pattern showing the brightness | luminance change of the horizontal direction or the vertical direction in the said block from the luminance value of each pixel in a block. ぼやけ判定処理で実行されるエッジパターン照合処理のフローチャートである。It is a flowchart of the edge pattern collation process performed by a blurring determination process. エッジパターンテーブル181の一例を示す説明図である。5 is an explanatory diagram illustrating an example of an edge pattern table 181. FIG. エッジパターンテーブル181のパターンテーブルを示す説明図である。It is explanatory drawing which shows the pattern table of the edge pattern table. ぼやけ判定処理で実行されるエッジ連結処理のフローチャートである。It is a flowchart of the edge connection process performed by a blurring determination 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の加算値と連結誤差閾値Th4との比較の様子を示す説明図である。It is explanatory drawing which shows the mode of comparison with the addition value of the right edge width | variety RW of an attention block, and the left edge width | variety LW of an adjacent block, and connection error threshold value Th4. 累積ぼやけ幅CWの算出概念を示す説明図である。It is explanatory drawing which shows the calculation concept of the accumulation blur width CW. ぼやけ判定処理で実行されるブロックぼやけ判定処理のフローチャートである。It is a flowchart of the block blur determination process performed by the blur determination process. ぼやけ判定処理で実行されるウィンドウぼやけ判定処理のフローチャートである。It is a flowchart of the window blur determination process performed by the blur determination process.

符号の説明Explanation of symbols

100…プリンタ
110…スキャナ
120…メモリカードスロット
130…USBインタフェース
140…操作パネル
145…液晶ディスプレイ
150…制御ユニット
160…CPU
161…画像データ入力部
162…ブロックパターン算出部
163…パターン照合部
164…エッジ連結部
165…ブロックぼやけ判定部
166…ウィンドウぼやけ判定部
170…RAM
171…パターン番号バッファ
172…縦累積バッファ
173…横累積バッファ
180…ROM
181…エッジパターンテーブル
210…キャリッジ
211…インクヘッド
212…インクカートリッジ
220…キャリッジモータ
230…モータ
260…駆動ベルト
270…プラテン
280…摺動軸
P…印刷用紙
MC…メモリカード
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 ... Block pattern calculation unit 163 ... Pattern collation unit 164 ... Edge connection unit 165 ... Block blur determination unit 166 ... Window blur determination unit 170 ... RAM
171 ... Pattern number buffer 172 ... Vertical accumulation buffer 173 ... Horizontal accumulation buffer 180 ... ROM
181 ... Edge pattern table 210 ... Carriage 211 ... Ink head 212 ... Ink cartridge 220 ... Carriage motor 230 ... Motor 260 ... Drive belt 270 ... Platen 280 ... Slide axis P ... Printing paper MC ... Memory card

Claims (17)

画素の集合体として構成されたビットマップ画像のぼやけを検出する画像処理装置であって、
前記画像を構成する画素毎に、画像データを入力する画像データ入力部と、
前記画像の少なくとも一部を、所定の数の画素からなるブロックを単位として複数に分割し、該ブロック毎に該ブロックに属する画素の前記入力した画像データに基づいて、該画像データの前記ブロック内での所定方向の変化を表す複数の係数からなる係数群を算出するブロックパターン算出部と、
前記ブロック内の画素の画像データの前記ブロック内における少なくとも一方向の代表的な変化を前記係数群によって表した複数種類のパターンを、基本パターンとして分類して記憶するパターン記憶部と、
前記算出された係数群の変化のパターンを、前記記憶された複数の基本パターンと照合し、近似する基本パターンを選出するパターン照合部と、
前記ブロックについて選出された前記各基本パターンの前記画像内における配置に基づいて、前記画像データが表す画像のぼやけを判定するぼやけ判定部と
を備えた画像処理装置。
An image processing device for detecting blur of a bitmap image configured as a collection of pixels,
An image data input unit for inputting image data for each pixel constituting the image;
At least a part of the image is divided into a plurality of blocks each having a predetermined number of pixels, and the block of the image data is determined based on the input image data of pixels belonging to the block for each block. A block pattern calculation unit for calculating a coefficient group composed of a plurality of coefficients representing a change in a predetermined direction at
A pattern storage unit that classifies and stores a plurality of types of patterns in which representative changes in at least one direction in the block of image data of pixels in the block are represented by the coefficient group as basic patterns;
A pattern matching unit that matches the calculated pattern of change of the coefficient group with the plurality of stored basic patterns and selects a basic pattern to be approximated;
An image processing apparatus comprising: a blur determination unit that determines blur of an image represented by the image data based on an arrangement in the image of each basic pattern selected for the block.
請求項1記載の画像処理装置であって、
前記ぼやけ判定部は、
前記基本パターンが選出されたブロックの、前記選出された基本パターンの係数群の各係数の変化が形成する第1の勾配と、該ブロックに隣接するブロックで選出された基本パターンの係数群の各係数の変化が形成する第2の勾配との連続性を検定する連続性検定手段と、
前記連続性検出手段の検定結果により、前記各勾配が連続しない時には、前記基本パターンが選出されたブロックの前記勾配の幅を、前記ブロックのぼやけ度を表すぼやけ幅として検出し、前記各勾配が連続する時には、前記ブロックに分割された画像内における前記各ブロックの前記所定方向の連なりに沿って、前記各勾配が連続する範囲を前記ぼやけ幅として検出するぼやけ幅検出手段と、
該検出されたぼやけ幅の長さに基づいて、前記画像データが表す画像のぼやけを判定するぼやけ判定手段と
を備えた画像処理装置。
The image processing apparatus according to claim 1,
The blur determination unit
A first gradient formed by a change in each coefficient of the coefficient group of the selected basic pattern of the block from which the basic pattern has been selected, and each coefficient group of the basic pattern selected by a block adjacent to the block Continuity testing means for testing continuity with the second slope formed by the coefficient change;
According to the test result of the continuity detecting means, when the gradients are not continuous, the gradient width of the block from which the basic pattern is selected is detected as a blur width indicating the blur level of the block, and the gradients are detected. A blur width detecting means for detecting, as the blur width, a range in which the gradients continue along the series of the blocks in the predetermined direction in the image divided into the blocks,
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.
請求項2記載の画像処理装置であって、
前記パターン記憶部は、前記基本パターンと、該各基本パターンにそれぞれ一意に割り振られたパターン番号とを対応付けて記憶する手段を備え、
前記パターン照合部は、前記算出された係数群の変化形状に近似する基本パターンとして、前記パターン番号を前記パターン記憶部から選出する手段を備え、
前記連続性検定手段は、前記選出されたパターン番号を参照して、前記第1の勾配と前記第2の勾配との連続性を検定する手段を備えた
画像処理装置。
The image processing apparatus according to claim 2,
The pattern storage unit includes means for storing the basic pattern in association with the pattern number uniquely assigned to each basic pattern,
The pattern matching unit includes means for selecting the pattern number from the pattern storage unit as a basic pattern that approximates the calculated change shape of the coefficient group,
The continuity test means is an image processing apparatus comprising means for testing the continuity between the first gradient and the second gradient with reference to the selected pattern number.
請求項3記載の画像処理装置であって、
前記パターン記憶部は、更に、前記パターン番号に対応付けて、前記各基本パターンの前記勾配の幅を記憶する手段を備え、
前記ぼやけ幅検出手段は、前記各勾配が連続しない時には、前記パターン番号が選出されたブロックの、前記パターン番号に対応付けられた前記勾配の幅を前記パターン記憶部から読み出して、前記ぼやけ幅を検出し、前記各勾配が連続する時には、前記ブロックに分割された画像内における前記各ブロックの前記所定方向の連なりに沿って、前記パターン番号に対応付けられた前記勾配の幅を前記パターン記憶部から読み出し、該勾配の幅の累積値として、前記ぼやけ幅を検出する手段を備えた
画像処理装置。
The image processing apparatus according to claim 3,
The pattern storage unit further includes means for storing the gradient width of each basic pattern in association with the pattern number,
The blur width detecting unit reads out the width of the gradient associated with the pattern number of the block from which the pattern number is selected from the pattern storage unit when the gradients are not continuous, and calculates the blur width. When the gradients are detected, the width of the gradient associated with the pattern number along the sequence in the predetermined direction of the blocks in the image divided into the blocks is detected by the pattern storage unit. An image processing apparatus comprising means for detecting the blur width as an accumulated value of the gradient width.
請求項2ないし請求項4のいずれか記載の画像処理装置であって、
前記ぼやけ判定手段は、
前記検出されたぼやけ幅の長さに基づいて、前記ブロック毎にぼやけの状況を判定するブロックぼやけ判定手段と、
該判定の結果を集計して、画像全体のぼやけ判定を行う画像ぼやけ判定手段と
を備えた画像処理装置。
An image processing apparatus according to any one of claims 2 to 4,
The blur determination means includes
Block blur determination means for determining a blur situation for each block based on the length of the detected blur width;
An image processing apparatus comprising: an image blur determination unit that aggregates the determination results and performs blur determination on the entire image.
請求項2ないし請求項4のいずれか記載の画像処理装置であって、
前記ぼやけ判定手段は、
前記検出されたぼやけ幅の長さに基づいて、前記ブロック毎にぼやけの状況を判定するブロックぼやけ判定手段と、
前記画像データ内の、所定数の前記ブロックで構成されるウィンドウ領域に含まれる全ブロックについて、前記ブロックぼやけ判定部に判定されたぼやけの状況を集計し、該集計結果に基づき、該ウィンドウ領域内がぼやけているか否かを判断するウィンドウぼやけ判定手段と、
前記画像データ中において、前記ウィンドウ領域を移動させていった結果、少なくとも1カ所、ぼやけていないと判断された前記ウィンドウ領域が存在する場合に、前記画像データが表す画像全体がぼやけていないと判断する画像ぼやけ判定手段と
を備えた画像処理装置。
An image processing apparatus according to any one of claims 2 to 4,
The blur determination means includes
Block blur determination means for determining a blur situation for each block based on the length of the detected blur width;
The blur conditions determined by the block blur determination unit are totaled for all blocks included in the window area composed of the predetermined number of blocks in the image data, and the window area is based on the total result. Window blur determining means for determining whether or not the image is blurred,
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:
請求項2ないし請求項6記載の画像処理装置であって、
前記所定方向は、水平方向および垂直方向であり、
前記ブロックパターン算出部は、前記係数群として、前記画像データの前記ブロック内での水平方向の変化を表す第1の係数群と、前記画像データの前記ブロック内での垂直方向の変化を表す第2の係数群とを算出する手段を備え、
前記パターン照合部は、前記第1の係数群と前記第2の係数群とについて、それぞれ、前記近似する基本パターンを選出する手段を備え、
前記ぼやけ検出手段は、水平方向および垂直方向についてそれぞれ、前記ぼやけ幅を検出する水平/垂直ぼやけ幅検出手段を備え、
前記ぼやけ判定手段は、前記水平方向と垂直方向とについてそれぞれ算出された前記ぼやけ幅のうち、大きい方のぼやけ幅の長さに基づき、前記画像データが表す画像のぼやけを判定する水平/垂直ぼやけ判定手段を備えた
画像処理装置。
The image processing apparatus according to claim 2, wherein:
The predetermined directions are a horizontal direction and a vertical direction,
The block pattern calculation unit includes, as the coefficient group, a first coefficient group representing a horizontal change in the block of the image data, and a first coefficient representing a vertical change in the block of the image data. Means for calculating a coefficient group of 2;
The pattern matching unit includes means for selecting the approximate basic pattern for each of the first coefficient group and the second coefficient group,
The blur detection means includes horizontal / vertical blur width detection means for detecting the blur width in the horizontal direction and the vertical direction, respectively.
The blur determination unit determines a blur of an image represented by the image data based on a larger blur width of the blur widths calculated in the horizontal direction and the vertical direction, respectively. An image processing apparatus including a determination unit.
請求項1ないし請求項7のいずれか記載の画像処理装置であって、
前記パターン照合部は、前記算出された係数群が所定の分散の範囲内となるような条件を満たす時には、前記基本パターンの選出を行わない
画像処理装置。
An image processing apparatus according to any one of claims 1 to 7,
The image processing apparatus, wherein the pattern matching unit does not select the basic pattern when satisfying a condition such that the calculated coefficient group falls within a predetermined dispersion range.
請求項1ないし請求項8のいずれか記載の画像処理装置であって、
前記パターン照合部は、前記複数種類の基本パターンの中から、前記算出された係数群との平均誤差が最小となる基本パターンを前記パターン記憶部から選出する
画像処理装置。
An image processing apparatus according to any one of claims 1 to 8,
The image processing apparatus, wherein the pattern matching unit selects, from the pattern storage unit, a basic pattern that minimizes an average error with the calculated coefficient group from the plurality of types of basic patterns.
請求項1ないし請求項8のいずれか記載の画像処理装置であって、
前記パターン照合部は、前記複数種類の基本エッジパターンと前記算出された係数群との平均誤差を該複数種類の基本パターンの並びの順に計算する誤差計算処理を実行し、該計算された誤差が所定の閾値以下となった場合には、前記誤差計算処理を打ち切ると共に、該誤差が所定の閾値以下となった基本パターンを前記パターン記憶部から選出する
画像処理装置。
An image processing apparatus according to any one of claims 1 to 8,
The pattern matching unit executes error calculation processing for calculating an average error between the plurality of types of basic edge patterns and the calculated coefficient group in the order of the arrangement of the plurality of types of basic patterns, and the calculated error is calculated. An image processing apparatus that terminates the error calculation process and selects a basic pattern having the error equal to or less than a predetermined threshold from the pattern storage unit when the error is equal to or less than a predetermined threshold.
請求項1ないし請求項10のいずれか記載の画像処理装置であって、
前記ブロックは、水平方向と垂直方向にそれぞれ8画素で構成される
画像処理装置。
An image processing apparatus according to any one of claims 1 to 10,
The block is an image processing apparatus configured with 8 pixels in each of a horizontal direction and a vertical direction.
請求項1ないし請求項11のいずれか記載の画像処理装置であって、
前記画像データは、RGB色空間の各階調値であり、
前記係数群は、前記RGB色空間の各階調値から算出される画素ごとの輝度値または明度に基づいて算出される
画像処理装置。
An image processing apparatus according to any one of claims 1 to 11,
The image data is each gradation value in the RGB color space,
The image processing apparatus, wherein the coefficient group is calculated based on a luminance value or brightness for each pixel calculated from each gradation value in the RGB color space.
請求項1ないし請求項12のいずれか記載の画像処理装置であって、
更に、前記ぼやけ判定部によってぼやけていないと判定された画像をユーザに提示する提示部を備える
画像処理装置。
An image processing apparatus according to any one of claims 1 to 12,
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.
請求項13に記載の画像処理装置であって、
更に、前記提示された画像の中からユーザによって選択された画像を印刷する印刷部を備える
画像処理装置。
The image processing apparatus according to claim 13,
An image processing apparatus further comprising a printing unit that prints an image selected by the user from the presented images.
画素の集合体として構成されたビットマップ画像のぼやけを検出するぼやけ検出方法であって、
前記画像を構成する画素毎に、画像データを入力し、
前記画像の少なくとも一部を、所定の数の画素からなるブロックを単位として複数に分割し、該ブロック毎に該ブロックに属する画素の前記入力した画像データに基づいて、該画像データの前記ブロック内での所定方向の変化を表す複数の係数からなる係数群を算出し、
前記ブロック内の画素の画像データの前記ブロック内における少なくとも一方向の代表的な変化を前記係数群によって表した複数種類のパターンを、基本パターンとして分類して記憶されたパターン記憶部と、前記算出された係数群の変化のパターンとを照合して、近似する基本パターンを選出し、
前記ブロックについて選出された前記各基本パターンの前記画像内における配置に基づいて、前記画像データが表す画像のぼやけを判定する
ぼやけ検出方法。
A blur detection method for detecting blur in a bitmap image configured as a collection of pixels,
Input image data for each pixel constituting the image,
At least a part of the image is divided into a plurality of blocks each having a predetermined number of pixels, and the block of the image data is determined based on the input image data of pixels belonging to the block for each block. A coefficient group consisting of a plurality of coefficients representing a change in a predetermined direction at
A pattern storage unit that stores a plurality of types of patterns in which representative changes in at least one direction in the block of image data of pixels in the block are represented by the coefficient group and stored as basic patterns; and the calculation The basic pattern to be approximated is selected by comparing with the change pattern of the coefficient group
A blur detection method for determining blur of an image represented by the image data based on an arrangement of the basic patterns selected for the block in the image.
画素の集合体として構成されたビットマップ画像のぼやけを検出するためのコンピュータプログラムであって、
前記画像を構成する画素毎に、画像データを入力する機能と、
前記画像の少なくとも一部を、所定の数の画素からなるブロックを単位として複数に分割し、該ブロック毎に該ブロックに属する画素の前記入力した画像データに基づいて、該画像データの前記ブロック内での所定方向の変化を表す複数の係数からなる係数群を算出する機能と、
前記ブロック内の画素の画像データの前記ブロック内における少なくとも一方向の代表的な変化を前記係数群によって表した複数種類のパターンを、基本パターンとして分類して記憶されたパターン記憶部と、前記算出された係数群の変化のパターンとを照合して、近似する基本パターンを選出する機能と、
前記ブロックについて選出された前記各基本パターンの前記画像内における配置に基づいて、前記画像データが表す画像のぼやけを判定する機能と
をコンピュータに実現させるコンピュータプログラム。
A computer program for detecting blur in a bitmap image configured as a collection of pixels,
A function of inputting image data for each pixel constituting the image;
At least a part of the image is divided into a plurality of blocks each having a predetermined number of pixels, and the block of the image data is determined based on the input image data of pixels belonging to the block for each block. A function of calculating a coefficient group composed of a plurality of coefficients representing a change in a predetermined direction at
A pattern storage unit that stores a plurality of types of patterns in which representative changes in at least one direction in the block of image data of pixels in the block are represented by the coefficient group and stored as basic patterns; and the calculation A function for selecting a basic pattern to be approximated by comparing with a pattern of changes in the coefficient group,
A computer program that causes a computer to realize a function of determining blur of an image represented by the image data based on an arrangement of each basic pattern selected for the block in the image.
請求項16に記載のコンピュータプログラムを記録したコンピュータ読み取り可能な記録媒体。   The computer-readable recording medium which recorded the computer program of Claim 16.
JP2006315433A 2006-11-22 2006-11-22 Image processor, blur detection method, program and recording medium Pending JP2008129912A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006315433A JP2008129912A (en) 2006-11-22 2006-11-22 Image processor, blur detection method, program and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006315433A JP2008129912A (en) 2006-11-22 2006-11-22 Image processor, blur detection method, program and recording medium

Publications (1)

Publication Number Publication Date
JP2008129912A true JP2008129912A (en) 2008-06-05

Family

ID=39555651

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006315433A Pending JP2008129912A (en) 2006-11-22 2006-11-22 Image processor, blur detection method, program and recording medium

Country Status (1)

Country Link
JP (1) JP2008129912A (en)

Similar Documents

Publication Publication Date Title
JP4193881B2 (en) Image processing apparatus and blur detection method
CN102801897B (en) Image processing apparatus and image processing method
JP4182990B2 (en) Printing device, method for determining whether image is blurred, and computer program
US20080137982A1 (en) Blurring determination device, blurring determination method and printing apparatus
US8908990B2 (en) Image processing apparatus, image processing method, and computer readable medium for correcting a luminance value of a pixel for reducing image fog
JP4539318B2 (en) Image information evaluation method, image information evaluation program, and image information evaluation apparatus
US8184902B2 (en) Image combining apparatus and control method for the same
JP4492555B2 (en) Printing device
JP4844053B2 (en) Image selection apparatus and image selection method
US7924468B2 (en) Camera shake determination device, printing apparatus and camera shake determination method
JP4251217B2 (en) Printing apparatus, image data file processing apparatus, image data file selection method, and computer program
JP4513764B2 (en) Image determination apparatus and image determination method
JP2008129912A (en) Image processor, blur detection method, program and recording medium
JP2005260597A (en) Digital camera and program
JP2008165734A (en) Blurring determination device, blurring determination method and printing apparatus
JP2010173323A (en) Printer
JP2008140331A (en) Image processor, blur detecting method, program, and recording medium
JP2009230556A (en) Object detection device, object detection method, object detection program, and printer
JP2007041836A (en) Image selection apparatus and method
JP2007045022A (en) Printing device and method for printing
JP2009022017A (en) Image processing apparatus and blur-detecting method
US8781166B2 (en) Image processing apparatus and image processing program
JP4910971B2 (en) Camera shake determination device and camera shake determination method
JP2008123346A (en) Blur determination device, blur determination method, and printer
JP2011103128A (en) Image selection device and image selection method