JP2004310726A - Image inspection method, image inspection apparatus, and program - Google Patents

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

Info

Publication number
JP2004310726A
JP2004310726A JP2003283125A JP2003283125A JP2004310726A JP 2004310726 A JP2004310726 A JP 2004310726A JP 2003283125 A JP2003283125 A JP 2003283125A JP 2003283125 A JP2003283125 A JP 2003283125A JP 2004310726 A JP2004310726 A JP 2004310726A
Authority
JP
Japan
Prior art keywords
edge
document
image
unit
vertex
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2003283125A
Other languages
Japanese (ja)
Inventor
Tetsukazu Satonaga
哲一 里永
Kiichi Yamada
紀一 山田
Koki Uetoko
弘毅 上床
Eigo Nakagawa
英悟 中川
Kaoru Yasukawa
薫 安川
Koji Adachi
康二 足立
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co Ltd
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 Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP2003283125A priority Critical patent/JP2004310726A/en
Publication of JP2004310726A publication Critical patent/JP2004310726A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To enhance the inspection accuracy even when an original protrudes from an imaging range in an image inspection apparatus which inspects goodness/badness of a pick-up image by comparing the pick-up image with a reference image. <P>SOLUTION: An edge valid part linear expression calculation part 126 performs edge valid part linear expression calculation processing about each of vertical and horizontal sides. An original vertex setting processing part 132 specifies vertex coordinates of the original in the pick-up image by referring to the calculated linear expression. A protruding location judgment processing part 134 judges whether or not the vertex coordinates protrude from the imaging range. A boundary part specification processing part 136 specifies a boundary part with the imaging range about an original vertex whose vertex coordinates are judged to protrude from the imaging range. A non-inspection region setting part 138 demarcates a non-inspection region based on coordinate information indicating the boundary part and coordinate information of the protruding original vertex. An image inspection processing part 200 performs an inspection by excluding the non-inspection area demarcated by the non-inspection region setting part 138 from an inspection object. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は、紙などの媒体に記載された文字や図形あるいは画像などの情報を読み取り、この読み取った撮像画像と基準画像とを比較することにより画像検査をする方法および装置、並びに、電子計算機(コンピュータ)を利用して画像検査を行なうためのプログラムに関する。   The present invention provides a method and apparatus for reading information such as characters, figures, and images written on a medium such as paper, and comparing the read captured image with a reference image to perform image inspection, and an electronic computer ( A program for performing image inspection using a computer.

原稿の画像を読み取る画像読取装置、いわゆるスキャナ装置が種々の分野で利用されている。たとえば単体で使用されることもあれば、複写装置などに組み込まれて使用されることもある。あるいは、読み取った画像と検査用の基準画像とを比較して画像欠陥などを検査をする画像検査装置に利用されることもある。   2. Description of the Related Art An image reading apparatus for reading an image of a document, a so-called scanner apparatus, is used in various fields. For example, it may be used alone, or may be incorporated in a copying apparatus or the like. Alternatively, it may be used in an image inspection apparatus that inspects an image defect or the like by comparing a read image with a reference image for inspection.

画像検査においては、検査対象物である印刷物を撮像カメラなどにより画像メモリに取り込んだ撮像画像と、予め設定されている基準画像とを比較することで、画像欠陥を検出する方法を採っている。なお、画像欠陥の検出方法は、撮像画像と基準画像とで画素ごとの減算を行なうほか、分割した基準画像をテンプレートとして正規化相互相関を計算し、相関係数が基準値を下回った部分に画像欠陥が生じているとして検出する方法がある。   In the image inspection, a method of detecting an image defect by comparing a captured image obtained by taking a printed material to be inspected into an image memory by an imaging camera or the like with a preset reference image is adopted. In addition, the image defect detection method performs a subtraction for each pixel between the captured image and the reference image, calculates a normalized cross-correlation using the divided reference image as a template, and calculates a portion where the correlation coefficient falls below the reference value. There is a method of detecting that an image defect has occurred.

たとえば、特許文献1には、複写装置に画像検査の仕組みを取り入れたものとして、原画像と複写画像との画像差分により画質の調整を自動的に行なう手法が開示されている。この手法においては、画質調整用の標準原稿データを記憶しておき、画質調整時に標準原稿データを出力し、その出力用紙を画像読取装置によって電子化し、2つの画像データにおいて規定の比較点の濃度の差分をとる。この差分値によって、複写装置の各部のパラメータを調整して画質を維持しようとしている。   For example, Patent Literature 1 discloses a method of automatically adjusting image quality based on an image difference between an original image and a copied image, assuming that a copying apparatus incorporates an image inspection mechanism. In this method, standard document data for image quality adjustment is stored, the standard document data is output at the time of image quality adjustment, the output paper is digitized by an image reading device, and the density of a specified comparison point in two image data is determined. Take the difference of The image quality is maintained by adjusting the parameters of each unit of the copying apparatus based on the difference value.

特開平08−190630号公報JP 08-190630 A

一方、画像読取装置としては、たとえば原稿載置台としてのプラテンガラスの上に原稿を置き、その下をラインセンサが走査して読み取るフラットベッド型イメージスキャナ、使用者がイメージセンサを手で走査して原稿を読み取るハンディ型イメージスキャナ、あるいは、原稿と撮像デバイス(センサ)との間にある程度の距離を置いて、原稿を間接的に読み取る間接型イメージスキャナ(非接触型イメージスキャナともいわれる)などがある。間接型イメージスキャナは、読み取る対象物に大きさや平面度の制約が少ないという利点を有する。   On the other hand, as an image reading apparatus, for example, a flatbed image scanner in which a document is placed on a platen glass serving as a document placing table and a line sensor scans below the document, and a user scans the image sensor by hand. There is a handy image scanner that reads a document, or an indirect image scanner (also referred to as a non-contact type image scanner) that indirectly reads a document with a certain distance between the document and an imaging device (sensor). . The indirect image scanner has the advantage that the size and flatness of the object to be read are less restricted.

間接型イメージスキャナの一例としては、たとえば特許文献1には、斜め上方からエリアセンサなどの撮像デバイスで印刷画像を読み取って正面から見た画像に変換する方式のものが提案されている。斜め上方から撮影する方式では、画像が略台形状に歪む(画像の幾何学歪みという)問題や、原稿の手前と奥とで焦点がズレて画像の暈け度合いに場所による差、つまり暈け特性の場所依存性が生じ、画質が低下する問題がある。   As an example of the indirect image scanner, for example, Patent Document 1 proposes a method in which a print image is read from an obliquely upper side by an imaging device such as an area sensor and converted into an image viewed from the front. In the method of photographing obliquely from above, there is a problem that the image is distorted into a substantially trapezoidal shape (referred to as geometric distortion of the image), or a difference in the degree of blur of the image due to a shift in focus between the front and the back of the document, that is, blur. There is a problem that the characteristics depend on the place and the image quality is deteriorated.

このため、特許文献2に記載の発明では、撮像画像における幾何学的形状の場所依存性(幾何学歪み)や暈け特性の場所依存性を補正するために、補正を施す注目画素から撮影カメラまでの距離を測定し、この測定結果に基づいて所定の計算をし、距離値に応じて幾何学歪みや暈けを補正するための補正係数を制御することで、高画質な撮像画像を得るようにしている。   For this reason, in the invention described in Patent Literature 2, in order to correct the location dependency (geometric distortion) of the geometric shape and the location dependency of the blur characteristic in the captured image, the photographing camera is changed from the target pixel to be corrected. To obtain a high-quality captured image by performing a predetermined calculation based on the measurement result and controlling a correction coefficient for correcting geometric distortion and blur according to the distance value. Like that.

特開2000−22869号公報JP-A-2000-22869

また、特許文献3には、出力物のラスタ展開前の原画像データを取得し、画像読取装置の特性に応じて画像処理を施して基準画像データとし、出力物との比較により画像を検査する手法が提案されている。また、画像読取装置における位置の偏位を見込んだ比較を行なうことも提案されている。この手法では、ラスタ展開前の画像データを得て画像処理を行なうので、基準データとして正確なデータが得られる。   In Japanese Patent Application Laid-Open No. H11-163, original image data before raster development of an output product is obtained, image processing is performed in accordance with the characteristics of the image reading apparatus to obtain reference image data, and an image is inspected by comparison with the output product. An approach has been proposed. It has also been proposed to make a comparison in consideration of a positional deviation in an image reading apparatus. In this method, since image processing is performed by obtaining image data before raster development, accurate data can be obtained as reference data.

特開2000−123176号公報JP 2000-123176 A

しかしながら、欠陥がない出力原稿が撮像範囲からはみ出して読み取られた場合において、撮像画像と基準画像とを比較すると、はみ出した部分の影響により欠陥検出の精度が低下してしまう。たとえば、はみ出した部分を含むテンプレートでは、相関係数が基準値を下回ってしまうので、はみ出した部分を欠陥として誤検出してしまう。   However, when an output document having no defect is read out of the imaging range and read, when compared with the captured image and the reference image, the accuracy of defect detection is reduced due to the effect of the protruding portion. For example, in a template including a protruding portion, the correlation coefficient is lower than the reference value, and thus the protruding portion is erroneously detected as a defect.

本発明は、上記事情に鑑みてなされたものであり、出力原稿が撮像範囲からはみ出して読み取られた場合においても、精度よく撮像画像を検査することのできる画像検査方法を提供することを目的とする。また本発明は、本発明の画像検査方法を実施する画像検査装置、おとび画像検査装置を電子計算機を用いてソフトウェア的に実現するために好適なプログラムを提供することを目的とする。   The present invention has been made in view of the above circumstances, and it is an object of the present invention to provide an image inspection method capable of accurately inspecting a captured image even when an output document is read out of an imaging range. I do. Another object of the present invention is to provide an image inspection apparatus that implements the image inspection method of the present invention, and a program suitable for realizing the image inspection apparatus as software using an electronic computer.

すなわち、本発明に係る画像検査方法は、原稿を光学的に読み取って得た撮像画像と検査用の基準画像とを比較することにより前記撮像画像を検査する画像検査方法であって、撮像画像における原稿の辺縁を示す線分を求め、この求めた線分と撮像範囲を示す境界線との位置関係を特定し、この特定した位置関係に基づいて、撮像範囲からはみ出している原稿部分を非検査領域に設定し、この非検査領域を検査対象から除外しつつ、基準画像と撮像画像における原稿部分の画像とを比較することで原稿部分の画像を検査することとした。   That is, the image inspection method according to the present invention is an image inspection method for inspecting the captured image by comparing a captured image obtained by optically reading a document with a reference image for inspection, and A line segment indicating the edge of the document is obtained, a positional relationship between the obtained line segment and a boundary line indicating the imaging range is specified, and the document portion protruding from the imaging range is determined based on the specified positional relationship. The inspection area is set, and the non-inspection area is excluded from the inspection target, and the image of the original is inspected by comparing the reference image with the image of the original in the captured image.

たとえば、原稿の形状が4角形などの角形状を呈していれば、角形状の原稿の辺縁を示す直線式を求め、求めた直線式と撮像範囲を示す境界線との交点座標を特定することで、原稿辺縁と撮像範囲を示す境界線との位置関係を特定する。   For example, if the document has a rectangular shape such as a quadrangle, a straight-line formula indicating the edge of the square-shaped document is determined, and the coordinates of the intersection of the determined straight-line formula and the boundary line indicating the imaging range are specified. Thus, the positional relationship between the document margin and the boundary line indicating the imaging range is specified.

本発明に係る画像検査装置は、原稿を光学的に読み取って得た撮像画像と検査用の基準画像とを比較することにより前記撮像画像を検査する画像検査装置であって、原稿を撮影して撮像画像を取得する撮像部と、撮像部により取得された撮像画像における原稿の辺縁を示す線分を求める線分算出部と、線分算出部により求められた線分と撮像範囲を示す境界線との位置関係を特定する位置関係特定処理部と、位置関係特定処理部により特定された位置関係に基づいて撮像範囲からはみ出している原稿部分を非検査領域に設定する非検査領域設定部と、非検査領域設定部により設定された非検査領域を検査対象から除外しつつ、基準画像と撮像画像における原稿部分の画像とを比較する画像比較部と、画像比較部による比較結果に基づいて原稿部分の画像を検査する画像検査部とを備えるものとした。   An image inspection apparatus according to the present invention is an image inspection apparatus that inspects the captured image by comparing a captured image obtained by optically reading a document with a reference image for inspection. An imaging unit that acquires a captured image; a line segment calculation unit that determines a line segment indicating an edge of a document in the captured image acquired by the imaging unit; and a line that is determined by the line segment calculation unit and a boundary that indicates an imaging range. A positional relationship identification processing unit that identifies the positional relationship with the line, and a non-inspection area setting unit that sets a document portion that protrudes from the imaging range based on the positional relationship identified by the positional relationship identification processing unit as a non-inspection area. An image comparison unit that compares the reference image and the image of the original part in the captured image while excluding the non-inspection area set by the non-inspection area setting unit from the inspection target; and a document based on the comparison result by the image comparison unit. The partial image was assumed and an image inspecting unit configured to inspect.

また従属項に記載された発明は、本発明に係る画像検査装置の、さらなる有利な具体例を規定する。また、本発明に係るプログラムは、本発明に係る画像検査方法や装置を、電子計算機(コンピュータ)を用いてソフトウェアで実現するために好適なものである。なお、プログラムは、コンピュータ読取り可能な記憶媒体に格納されて提供されてもよいし、有線あるいは無線による通信手段を介して配信されてもよい。   The invention set forth in the dependent claims defines further advantageous specific examples of the image inspection apparatus according to the present invention. Further, the program according to the present invention is suitable for implementing the image inspection method and apparatus according to the present invention by software using an electronic computer (computer). The program may be provided by being stored in a computer-readable storage medium, or may be distributed via a wired or wireless communication unit.

たとえば、4角形などの角形状を呈している原稿を取り扱う場合であれば、線分算出部を撮像部により取得された撮像画像における原稿の辺縁を示す直線式を求める直線式算出部とし、位置関係特定処理部を、直線式算出部により求められた直線式と撮像範囲を示す境界線との交点座標を特定する境界部分特定処理部とし、非検査領域設定部を境界部分特定処理部により特定された交点座標に基づいて撮像範囲からはみ出している原稿部分を非検査領域に設定するものとすればよい。   For example, when handling a document exhibiting a square shape such as a quadrangle, the line segment calculation unit is a straight-line expression calculation unit that obtains a straight-line expression indicating the edge of the document in the captured image obtained by the imaging unit, The positional relationship identification processing unit is a boundary part identification processing unit that identifies the coordinates of the intersection between the straight line formula obtained by the linear expression calculation unit and the boundary line indicating the imaging range, and the non-inspection area setting unit is a boundary part identification processing unit. What is necessary is just to set the document part which protrudes from the imaging range based on the specified intersection coordinates as a non-inspection area.

本発明の構成に依れば、撮像画像における原稿の辺縁を示す線分を求め、この線分と撮像範囲を示す境界線との位置関係(たとえば交点座標)を特定することで、撮像範囲からはみ出している原稿部分を非検査領域に設定するようにした。そして、非検査領域を検査対象から除外しつつ、基準画像と撮像画像における原稿部分の画像とを比較することで原稿部分の画像を検査するようにした。   According to the configuration of the present invention, a line segment indicating an edge of a document in a captured image is obtained, and a positional relationship (for example, intersection coordinates) between the line segment and a boundary line indicating an image capturing range is specified, thereby obtaining an image capturing range. The protruding portion of the original is set as a non-inspection area. Then, the image of the document portion is inspected by comparing the reference image with the image of the document portion in the captured image while excluding the non-inspection area from the inspection target.

これにより、出力原稿が撮像範囲からはみ出して読み取られた場合であっても、そのはみ出し部分を検査対象外とすることにより、欠陥の誤検出をせずに出力原稿の検査を行なうことが可能になり、検査精度が向上する。   This makes it possible to inspect the output document without erroneous detection of a defect even if the output document is read out of the imaging range by excluding the protruding portion from the inspection target. And the inspection accuracy is improved.

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

図1は、本発明に係る画像処理装置の一実施形態を備えた画像検査装置を示す概略図である。ここで、図1(A)は、カメラヘッドの設置状態を示す図、図1(B)は、プリントエンジンの一例を示す図である。   FIG. 1 is a schematic diagram showing an image inspection apparatus provided with an embodiment of the image processing apparatus according to the present invention. Here, FIG. 1A is a diagram illustrating an installation state of a camera head, and FIG. 1B is a diagram illustrating an example of a print engine.

図1(A)に示すように、画像検査装置5は、画像読取装置の一例である画像読取部100、画像読取部100で読み取った画像に欠陥があるか否かを検査する画像検査処理部200、画像読取部100で読み取った画像や画像検査処理部200で検査用に使用する基準画像あるいはデータ処理中の中途データを格納するデータ格納部300、および画像読取部100で読み取られた画像を所定の記録媒体に出力するプリンタ部500を備えている。   As shown in FIG. 1A, an image inspection device 5 includes an image reading unit 100, which is an example of an image reading device, and an image inspection processing unit that inspects an image read by the image reading unit 100 for a defect. 200, a data storage unit 300 that stores an image read by the image reading unit 100, a reference image used for inspection by the image inspection processing unit 200, or intermediate data during data processing, and an image read by the image reading unit 100. A printer unit 500 for outputting to a predetermined recording medium is provided.

プリンタ部500は、排出口582および排紙トレイ584を有し、筐体内にはプリントエンジンが配されている。原稿設置台としての機能を有する排紙トレイ584は、原稿(印刷済みの用紙)Pと下地(ここでは排紙トレイの色)の判別ができるような色が付いている。   The printer section 500 has a discharge port 582 and a paper discharge tray 584, and a print engine is arranged in a housing. The paper discharge tray 584 having a function as a document mounting table is colored so that the document (printed paper) P and the background (here, the color of the paper discharge tray) can be distinguished.

画像読取部100は、原稿Pの画像を読み取る撮像部の一例であるカメラヘッド102を有している。カメラヘッド102は、撮影レンズ104、CCD撮像素子106、および読取信号処理部108を有している。このカメラヘッド102は、図示しない支持部材により、排紙トレイ584上に排出されたPに対する撮影レンズ104の向きが調整可能に支持されかつ排出口582の上部に排紙トレイ584の全体を撮影範囲にできるように設置されており、画像を斜め上から撮影して撮像画像を取得する。   The image reading unit 100 has a camera head 102 that is an example of an imaging unit that reads an image of a document P. The camera head 102 includes a photographing lens 104, a CCD image sensor 106, and a read signal processing unit 108. The camera head 102 is supported by a support member (not shown) such that the direction of the photographing lens 104 with respect to P discharged onto the paper discharge tray 584 is adjustable. The camera is installed so as to be able to capture images from diagonally above to obtain captured images.

プリンタ部500は、画像読取部100の各種機能とともに動作可能であって、画像検査装置5をデジタル印刷システムとして稼働させるためのラスタ出力スキャン(ROS;Raster Output Scanner)ベースのプリントエンジン570を備える。   The printer section 500 is operable with various functions of the image reading section 100, and includes a raster output scan (ROS) -based print engine 570 for operating the image inspection apparatus 5 as a digital printing system.

プリントエンジン570は、電子写真プロセスを利用して画像を所定の記録媒体に記録するものである。このプリントエンジン570は、クライアント端末から入力された印刷データに基づいて可視画像を所定の記録媒体上に形成する印刷装置(プリンタ)として機能するようになっている。   The print engine 570 records an image on a predetermined recording medium using an electrophotographic process. The print engine 570 functions as a printing device (printer) that forms a visible image on a predetermined recording medium based on print data input from a client terminal.

すなわち、図1(B)に示すように、プリントエンジン570は、画像読取部100との間のインターフェース(IOTコントローラ)の機能を有するとともに、画像読取部100から出力された画像データD10に対してプリント出力用の所定の処理をするプリント出力処理部572と、光ビームを発するレーザ光源574と、プリント出力処理部572から出力されたデータに従ってレーザ光源574を制御すなわち変調するレーザ駆動部576と、レーザ光源574から発せられた光ビームを感光性部材579に向けて反射させるポリゴンミラー(回転多面鏡)578とを有する。   That is, as shown in FIG. 1B, the print engine 570 has the function of an interface (IOT controller) with the image reading unit 100, and also prints image data D 10 output from the image reading unit 100. A print output processing unit 572 that performs a predetermined process for print output, a laser light source 574 that emits a light beam, a laser drive unit 576 that controls or modulates the laser light source 574 according to data output from the print output processing unit 572, A polygon mirror (rotating polygon mirror) 578 for reflecting the light beam emitted from the laser light source 574 toward the photosensitive member 579.

プリント出力処理部572は、画像データD10に対して、周知技術に従って、複数、好ましくは最低3つの分解色を表すデータを生成しレンダリング(ラスタデータに展開)する。たとえばデータD10が表すYCrCb表色系から最低3つ(好ましくは4つ)、たとえばCMY表色系あるいはCMYK表色系へのマッピングをし、プリント出力用に色分解されたラスタデータを生成する。   The print output processing unit 572 generates and renders (decompresses into raster data) the image data D10 according to a known technique, generating data representing a plurality, preferably at least three, of separated colors. For example, mapping is performed to at least three (preferably four) from the YCrCb color system represented by the data D10, for example, to the CMY color system or the CMYK color system, and color-separated raster data for print output is generated.

またプリント出力処理部572は、このようなラスタデータ化の処理に際して、カラー画像のCMY成分を減色するアンダーカラー除去(UCR)、あるいは減色されたCMY成分を部分的にK成分と交換するグレー成分交換(GCR)をする。さらにプリント出力処理部572は、出力データ(CMYKなど)に応答して作成される出力画像のトナー像を調整するために、色分解の直線化または同様の処理をすることもある。   The print output processing unit 572 performs under color removal (UCR) for reducing the CMY components of the color image in such rasterization processing, or a gray component for partially replacing the reduced CMY components with the K component. Exchange (GCR). Further, the print output processing unit 572 may perform linearization of color separation or similar processing in order to adjust a toner image of an output image created in response to output data (such as CMYK).

この構成により、プリントエンジン570は、レーザ光源574が発生する光ビームをポリゴンミラー578上の複数の面で反射させて感光性部材579を露光し、スキャン走査によって感光性部材579上に潜像を形成する。潜像が形成されると、当該技術分野で公知の多数の方法のうち任意の方法に従って像を現像し、画像読取部100にて読み取られたカラー画像を可視像として出力する。なお、カラー画像を可視像として出力する際には、画像を表すデータは最低3つ(好ましくは4つ)の色分解データ(たとえばC,M,Y,Kなど)を含み、各色は別個の画像面として、または輝度−クロミナンス形式で処理される。   With this configuration, the print engine 570 reflects the light beam generated by the laser light source 574 on a plurality of surfaces on the polygon mirror 578 to expose the photosensitive member 579, and forms a latent image on the photosensitive member 579 by scan scanning. Form. When the latent image is formed, the image is developed according to any of a number of methods known in the art, and the color image read by image reading unit 100 is output as a visible image. When a color image is output as a visible image, data representing the image includes at least three (preferably four) color separation data (for example, C, M, Y, K, etc.), and each color is separated. Or in luminance-chrominance format.

<<第1実施形態>>
図2は、図1に示した画像検査装置5の、第1実施形態の詳細例を示すブロック図である。第1実施形態の画像検査装置5は、略矩形状の原稿の頂点が撮像範囲からはみ出した撮影画像に対して透視変換処理(幾何変換処理)を施すとともに、透視変換処理された矩形状の撮像画像に基づいて、原稿部分の撮像範囲からはみ出している領域(以下非検査領域ともいう)を特定するための位置情報(以下非検査領域情報ともいう)を求め、透視変換処理された撮像画像と基準画像とを比較して画像検査を行なう際に、先に求めた非検査領域情報を参照して、原稿の非検査領域を検査対象から除外して画像検査を行なう点に特徴を有する。以下、具体的に説明する。
<< 1st Embodiment >>
FIG. 2 is a block diagram showing a detailed example of the first embodiment of the image inspection device 5 shown in FIG. The image inspection apparatus 5 according to the first embodiment performs a perspective transformation process (geometric transformation process) on a captured image in which the vertices of a substantially rectangular original are out of the imaging range, and also performs a rectangular transformation of the perspective transformation process. Based on the image, position information (hereinafter, also referred to as non-inspection area information) for specifying an area (hereinafter, also referred to as non-inspection area) for protruding from the imaging range of the document portion is obtained. When performing an image inspection by comparing with a reference image, the image inspection is performed by referring to the previously obtained non-inspection area information and excluding the non-inspection area of the document from the inspection target. This will be specifically described below.

第1実施形態の画像検査装置5は、画像を撮影して撮像画像を取得する画像読取部100と画像検査処理部200とデータ格納部300と、画像検査装置5の各部を制御する制御部320と、処理中のデータなどを一時的に格納するRAM(Random Access Memory)322とを備える。   The image inspection device 5 according to the first embodiment includes an image reading unit 100 that captures an image and obtains a captured image, an image inspection processing unit 200, a data storage unit 300, and a control unit 320 that controls each unit of the image inspection device 5. And a RAM (Random Access Memory) 322 for temporarily storing data being processed.

データ格納部300は、カメラヘッド102が取得した撮像画像、撮像画像処理部110により処理された処理済画像、あるいは画像検査における処理に用いられる各種の途中演算結果などを保持する。   The data storage unit 300 stores a captured image acquired by the camera head 102, a processed image processed by the captured image processing unit 110, various intermediate calculation results used for processing in image inspection, and the like.

画像読取部100は、カメラヘッド102によって取得された撮像画像に対して所定の処理を施す撮像画像処理部110を備えている。撮像画像処理部110は、カメラヘッド102にて読み取られた撮像画像の照度むら(光学系の光量分布特性)やセンサ画素特性ばらつきを補正するシェーディング補正部112と、シェーディング補正部112によりシェーディング補正された撮像画像に対し主に撮影レンズ104に起因する歪曲(湾曲)収差を補正する光学歪補正部114と、光学歪補正部114により補正された撮像画像を矩形状に変換(透視変換)する透視変換部(幾何変換部)116とを備える。   The image reading unit 100 includes a captured image processing unit 110 that performs a predetermined process on a captured image acquired by the camera head 102. The captured image processing unit 110 corrects shading by the shading correction unit 112 and the shading correction unit 112 that corrects uneven illuminance (light amount distribution characteristics of the optical system) and variation in sensor pixel characteristics of the captured image read by the camera head 102. An optical distortion correction unit 114 that corrects distortion (curvature) aberration mainly caused by the photographing lens 104 in the captured image, and a perspective that transforms the captured image corrected by the optical distortion correction unit 114 into a rectangular shape (perspective transformation). A conversion unit (geometric conversion unit) 116.

シェーディング補正部112が行なうシェーディング補正は、撮影領域の照度むらやCCD撮像素子106の各画素の特性ばらつきなどを補正する処理である。たとえば、カメラヘッド102は、予め白紙を撮影して白基準DW(i,j)としてデータ格納部300に保存しておく。i,jは画素位置を表す。次にシェーディング補正部112は、撮影画像D(i,j)に対し式(1)に基づき補正する。   The shading correction performed by the shading correction unit 112 is a process for correcting unevenness in illuminance of a photographing area, variation in characteristics of each pixel of the CCD image sensor 106, and the like. For example, the camera head 102 photographs a blank sheet in advance and stores it in the data storage unit 300 as a white reference DW (i, j). i and j represent pixel positions. Next, the shading correction unit 112 corrects the captured image D (i, j) based on Expression (1).

Figure 2004310726
Figure 2004310726

ここで、“n”は、補正後のビット分解能で、8ビット分解能ならn=8となり、“0〜255”階調の値をとる。ここでは、全画素について白基準データを保持する方法を述べたが、たとえば簡易的には、撮影された画像全体のピーク値を白基準DWとする方法や、ラインごとのピーク値DW(j)を白基準とする方法などが適用可能である。   Here, “n” is the bit resolution after correction. If the resolution is 8 bits, n = 8, and the value of the gradation is “0 to 255”. Here, the method of holding the white reference data for all pixels has been described. For example, in a simplified manner, the peak value of the entire captured image is set as the white reference DW, or the peak value DW (j) of each line is used. May be applied as a white reference.

光学歪補正部114は、撮影レンズ104に起因する収差を以下のようにして補正する。たとえば撮影レンズ104への入射角θでの収差をd、撮影レンズ104からCCD撮像素子106の結像面までの距離をc、結像面における結像位置の光軸からの距離をrとすると、収差dは次式(2)で表される。そこで、光学歪補正部114は、この特性に基づいて歪曲収差を補正する。なお収差dは、一般にrの3乗に比例するのでレンズ特性に基づいて比例定数を求めて歪曲収差を補正することもできる。   The optical distortion correction unit 114 corrects the aberration caused by the photographing lens 104 as follows. For example, assuming that the aberration at the incident angle θ to the photographing lens 104 is d, the distance from the photographing lens 104 to the image plane of the CCD image sensor 106 is c, and the distance from the optical axis of the image forming position on the image plane is r. , And aberration d are expressed by the following equation (2). Therefore, the optical distortion correction unit 114 corrects distortion based on this characteristic. Since the aberration d is generally proportional to the cube of r, the distortion can be corrected by obtaining a proportional constant based on the lens characteristics.

Figure 2004310726
Figure 2004310726

本実施形態では、カメラヘッド102は、原稿Pを斜め上方から撮影するので、矩形である原稿Pは撮影された画像データ上では撮像画像エリアに対して台形状に変形している。透視変換部116は、元の矩形状と一致するように撮像画像を変換する。   In the present embodiment, since the camera head 102 captures the document P from obliquely above, the rectangular document P has a trapezoidal shape with respect to the captured image area on the captured image data. The perspective conversion unit 116 converts the captured image so as to match the original rectangular shape.

また撮像画像処理部110は、撮像画像における原稿Pの領域を特定するとともに、原稿部分の撮像範囲からはみ出している領域(以下非検査領域ともいう)を特定する非検査領域特定処理部120を備える。非検査領域特定処理部120は、原稿部分の撮像範囲からはみ出している非検査領域を特定し、この非検査領域を示す情報(以下非検査領域情報という)をデータ格納部300に格納する。   In addition, the captured image processing unit 110 includes a non-inspection area specifying processing unit 120 that specifies an area of the document P in the captured image and also specifies an area (hereinafter, also referred to as a non-inspection area) that protrudes from the imaging range of the document part. . The non-inspection area identification processing unit 120 identifies a non-inspection area that is outside the imaging range of the document portion, and stores information indicating the non-inspection area (hereinafter, referred to as non-inspection area information) in the data storage unit 300.

非検査領域特定処理部120は、カメラヘッド102によって画像を撮像する都度、毎回撮像画像から原稿領域を抽出する。そして、撮影の都度抽出された原稿領域情報を参照して、撮像範囲からはみ出している非検査領域を特定する。   Each time the camera head 102 captures an image, the non-inspection area identification processing unit 120 extracts a document area from the captured image. Then, by referring to the document area information extracted each time the photographing is performed, the non-inspection area protruding from the imaging range is specified.

原稿Pが排紙トレイ584に排出される場所や向きはある程度一定していると考え検査対象範囲を固定することも考えられるが、実際には、排紙トレイ584上の上下左右の位置がズレたり、傾いて排紙されたりする。その量が大きい場合には、原稿部分が撮像範囲からはみ出して読み取られる。この場合、そのはみ出し部分を欠陥として誤検出してしまう可能性がある。したがって、本実施形態のように、実際の原稿Pの部分や非検査領域を撮影の都度特定して、この特定した非検査領域を画像検査処理の対象から除外することで、精度のよい欠陥検出ができるようになる。   It is considered that the place and direction in which the document P is discharged to the paper discharge tray 584 is fixed to some extent, and it is possible to fix the inspection target range. Or it is ejected at an angle. When the amount is large, the original portion is read out of the imaging range. In this case, the protruding portion may be erroneously detected as a defect. Therefore, as in the present embodiment, the actual portion of the document P and the non-inspection area are specified each time shooting is performed, and the specified non-inspection area is excluded from the target of the image inspection processing. Will be able to

なお、カメラヘッド102により読み取られた撮像画像と検査用の基準画像との誤差をより小さくするための誤差補正を施す仕組みとして、たとえば本願出願人が特願2001−334163号にて提案したような補正係数算出部および画像補正処理部を設けてもよい。なお、補正係数算出部や画像補正処理部の詳細は、特願2001−334163号を参照するとよい。   As a mechanism for performing error correction for reducing an error between a captured image read by the camera head 102 and a reference image for inspection, for example, as proposed by the present applicant in Japanese Patent Application No. 2001-334163. A correction coefficient calculation unit and an image correction processing unit may be provided. For details of the correction coefficient calculation unit and the image correction processing unit, refer to Japanese Patent Application No. 2001-334163.

たとえば、画像補正処理部は、カメラヘッド102により取得された撮像画像に対して、画像処理で一般的に用いられるエッジ強調フィルタなどを適用して強調処理(シャープネス処理)を施したり、撮像画像が有するノイズ成分を低減させるノイズ低減部の一例であって、平滑化フィルタなどを適用してモアレを除去したり、中間調データを平滑化することで撮像画像が有するノイズ成分を低減させるノイズ除去処理(平滑化処理)を施す。   For example, the image correction processing unit performs an enhancement process (sharpness process) on a captured image acquired by the camera head 102 by applying an edge enhancement filter or the like generally used in image processing, This is an example of a noise reduction unit that reduces a noise component included in the captured image by applying a smoothing filter or the like to remove moire or smoothing halftone data to reduce a noise component included in a captured image. (Smoothing process).

補正係数算出部は、カメラヘッドにより取得された撮像画像のチルトスキャンに起因した暈け特性の場所依存性を補正するための暈け特性補正係数を算出する。たとえば、台形の原稿領域から強調処理やノイズ除去処理のライン単位の補正係数を算出し、この算出した補正係数を画像補正処理部にセットする。   The correction coefficient calculation unit calculates a blur characteristic correction coefficient for correcting the location dependency of the blur characteristic due to the tilt scan of the captured image acquired by the camera head. For example, a correction coefficient for each line of the emphasis processing or the noise removal processing is calculated from the trapezoidal document area, and the calculated correction coefficient is set in the image correction processing unit.

画像補正処理部は、強調処理や平滑化処理を施す際には、それぞれのフィルタのパラメータを補正係数算出部により算出された補正係数で調整する。またこの際には、さらに好ましくは、ライン単位でシャープネスとノイズ除去の度合いを両方ともに変化させる、つまり、強調処理とノイズ除去処理をライン単位で同時に施すのが好ましい。   The image correction processing unit adjusts the parameters of each filter with the correction coefficient calculated by the correction coefficient calculation unit when performing the enhancement processing and the smoothing processing. In this case, it is more preferable that both the sharpness and the degree of noise removal are changed in line units, that is, it is preferable that the enhancement process and the noise removal process are simultaneously performed in line units.

画像検査処理部200は、本願出願人が特願2001−334163号にて提案した構成と同様に、データ格納部300に格納してある画像検査の基準となる基準画像(元画像データ)をカメラヘッド102にて取得された撮像画像と同じように解像度変換しかつ暈かし処理(平滑化処理)をすることで両画像を比較する際の誤差を少なくする基準画像処理部210と、基準画像処理部210から出力された基準画像に基づいて撮像画像の良否を検査する画像検査部230とを備える。   The image inspection processing unit 200 converts the reference image (original image data) stored in the data storage unit 300, which is a reference for image inspection, into a camera similarly to the configuration proposed by the present applicant in Japanese Patent Application No. 2001-334163. A reference image processing unit 210 that converts the resolution in the same manner as the captured image acquired by the head 102 and performs a blurring process (smoothing process) to reduce errors when comparing the two images; An image inspection unit 230 that inspects the quality of the captured image based on the reference image output from the processing unit 210 is provided.

基準画像処理部210は、データ格納部300から読み出した基準画像に対して線形補間法などを用いて解像度変換処理を施す解像度変換部214と、解像度変換処理が施された基準画像に対して高周波成分を低減させる暈かし処理を施す暈かし処理部216と、暈かし処理が施された基準画像から撮像範囲をはみ出した部分に対応する領域を検査対象領域から除外する非検査領域削除処理部218とを有する。   The reference image processing unit 210 performs a resolution conversion process on the reference image read from the data storage unit 300 using a linear interpolation method or the like, and a high-frequency conversion process on the reference image subjected to the resolution conversion process. A shading processing unit 216 for performing shading processing for reducing components, and a non-inspection area deletion for excluding, from the inspection target area, an area corresponding to a part that is outside the imaging range from the reference image subjected to the shading processing. A processing unit 218.

暈かし処理部216は、解像度変換部214により解像度変換が施された基準画像に対して、撮像画像の暈け具合と同じになるように、ガウス関数の分散σに基づいて(つまりガウスフィルタを用いて)検査用の基準画像の鮮鋭度を調整する(一般的には低下させる)。要するに、撮像画像データのカメラヘッド102の光学系に起因する暈けを反映させる。この際には、撮像直後の原稿領域の台形形状を参照してガウスフィルタ処理の補正係数を算出し、これを元に基準画像に暈かし処理(ガウスフィルタ処理)を施す。なお、分散σを適用したガウスフィルタ処理は、たとえば、特開平5−225388号などに示されているように、公知の技術であるので、その詳細な説明を割愛する。   The blurring processing unit 216 performs a gaussian variance σ on the reference image subjected to the resolution conversion by the resolution conversion unit 214 so as to have the same blurring degree of the captured image (that is, the Gaussian filter). (Using) to adjust (generally reduce) the sharpness of the reference image for inspection. In short, the blur caused by the optical system of the camera head 102 in the captured image data is reflected. At this time, the correction coefficient of the Gaussian filter processing is calculated with reference to the trapezoidal shape of the document area immediately after the imaging, and the reference image is blurred (Gaussian filter processing) based on this. Note that the Gaussian filter processing to which the variance σ is applied is a known technique, as shown in, for example, Japanese Patent Application Laid-Open No. 5-225388, and therefore a detailed description thereof is omitted.

図3は、撮像画像と基準画像との関係を示す図であって、カメラヘッド102により読み取られる画像の撮影状態を示す図(A)、撮像画像を示す図(B)、および撮像画像を矩形状に変換した場合の画像を示す図(C)である。   3A and 3B are diagrams showing the relationship between the captured image and the reference image, wherein FIG. 3A is a diagram illustrating a shooting state of an image read by the camera head 102, FIG. 3B is a diagram illustrating the captured image, and FIG. FIG. 7C is a diagram illustrating an image when converted into a shape.

本実施形態では、カメラヘッド102は、矩形状の原稿を任意のチルト角で撮影するので、カメラヘッド102により撮影された撮像画像における原稿部分は、図3(B)に示すように、台形画像に変形されて取得される。この台形画像を表す画像データは、一旦データ格納部300に蓄えられる。   In the present embodiment, since the camera head 102 captures a rectangular document at an arbitrary tilt angle, the document portion of the captured image captured by the camera head 102 has a trapezoidal image as shown in FIG. It is transformed and acquired. The image data representing the trapezoidal image is temporarily stored in the data storage unit 300.

また、カメラヘッド102にて、図3(A)に示すように、原稿Pの手前の縁(図中太線)に焦点があった状態で、チルトスキャンにより原稿Pを撮影する。この場合、撮影画像データのうち台形の原稿領域(図3(B)参照)では、原稿Pの下底(下辺)に焦点が合っているため、上底(上辺)に向かって焦点がしだいにズレていることになる。つまり画素位置に応じて画像の暈け量が異なる。   Also, as shown in FIG. 3A, the document P is photographed by tilt scan with the camera head 102 focused on the front edge (the thick line in the figure) of the document P. In this case, in the trapezoid original area (see FIG. 3B) of the captured image data, the lower bottom (lower side) of the original P is focused, so that the focus gradually moves toward the upper bottom (upper side). It will be off. That is, the blur amount of the image differs depending on the pixel position.

この影響を補正するため、透視変換部116は、台形状に撮像された画像の形状を、元の矩形状に合致させる。このためには、たとえば、図3(B)に示すような撮像画像の台形形状を、図3(C)に示すような矩形状に戻す際に使用される変換式を適用する方法がある。   In order to correct this effect, the perspective transformation unit 116 matches the shape of the trapezoidal image with the original rectangular shape. For this purpose, for example, there is a method of applying a conversion formula used when returning a trapezoidal shape of a captured image as shown in FIG. 3B to a rectangular shape as shown in FIG. 3C.

たとえば、撮像画像の台形形状を矩形状に戻す透視変換処理として、原稿Pからカメラまでの距離、カメラ高さh、パン角度、チルト角度に基づいて変換する方法が知られている。これは同次座標表現を用いた行列演算を解いて変換式を導出したものであり、変換式は以下の式(3),(4)で示される。   For example, as a perspective conversion process for returning a trapezoidal shape of a captured image to a rectangular shape, a method of performing conversion based on a distance from a document P to a camera, a camera height h, a pan angle, and a tilt angle is known. This is obtained by solving a matrix operation using a homogeneous coordinate expression to derive a conversion formula. The conversion formula is represented by the following formulas (3) and (4).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

ここで、u,vは変換後の座標、x,yはソース画像の座標、hは原稿面からのカメラ高さ、α(=tan-1(d/h))はカメラのチルト角、βはカメラのパン角である。予め測定したカメラ高さh,チルト角α,パン角βから透視変換の式に撮影画像の各画素を代入することで、台形の原稿領域を矩形に戻す、すなわち透視変換処理することができる。 Here, u and v are the coordinates after conversion, x and y are the coordinates of the source image, h is the camera height from the document surface, α (= tan −1 (d / h)) is the tilt angle of the camera, β Is the pan angle of the camera. By substituting each pixel of the captured image into the perspective transformation formula from the camera height h, the tilt angle α, and the pan angle β measured in advance, the trapezoid document area can be returned to a rectangle, that is, perspective transformation processing can be performed.

図4は、第1実施形態の非検査領域特定処理部120の一構成例を示すブロック図である。図示するように、非検査領域特定処理部120は、撮像画像からエッジ部分を抽出するエッジ抽出部122と、エッジ抽出部122により抽出されたエッジ部分における有効成分を選択するエッジ有効部検出部124と、エッジ有効部検出部124により特定された有効なエッジ部分を参照して撮像画像における原稿部分を確定するための直線式を算出する線分算出部の一例であるエッジ有効部直線式算出部126とを備える。   FIG. 4 is a block diagram illustrating a configuration example of the non-inspection area specifying processing unit 120 according to the first embodiment. As shown in the drawing, the non-inspection area specifying processing unit 120 includes an edge extracting unit 122 that extracts an edge portion from a captured image, and an edge valid unit detecting unit 124 that selects an effective component in the edge portion extracted by the edge extracting unit 122. And an edge-effective-part linear-expression calculating unit that is an example of a line-segment calculating unit that calculates a linear expression for determining a document part in a captured image with reference to the valid edge part specified by the edge-effective-part detecting unit 124 126.

また、非検査領域特定処理部120は、エッジ有効部直線式算出部126により算出された直線式を参照して、原稿の撮像範囲からはみ出している領域(非検査領域に相当)を特定する非検査領域特定部130を備える。この非検査領域特定部130は、エッジ有効部直線式算出部126により算出された直線式を参照して撮像画像における原稿の頂点座標を特定する位置関係特定処理部の一例である原稿頂点設定処理部132と、原稿頂点設定処理部132により設定された頂点座標が撮像範囲からはみ出しているか否かを判定するはみ出し場所判定処理部134とを有する。   In addition, the non-inspection area specifying processing unit 120 refers to the straight line formula calculated by the edge effective part straight line calculation unit 126 to specify an area (corresponding to a non-inspection area) that is outside the imaging range of the document. An inspection area specifying unit 130 is provided. The non-inspection area specifying unit 130 is a document vertex setting process which is an example of a positional relationship specifying processing unit that specifies the vertex coordinates of the document in the captured image with reference to the linear equation calculated by the edge effective unit linear equation calculating unit 126. And a protruding place determination processing unit 134 that determines whether the vertex coordinates set by the document vertex setting processing unit 132 are out of the imaging range.

また、非検査領域特定部130は、はみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点についての撮像範囲との境界部分を特定する境界部分特定処理部136と、境界部分特定処理部136により特定された境界部分を示す座標情報とはみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点の座標情報とに基づいて非検査領域を設定する非検査領域設定部138とを有する。   Further, the non-inspection area specifying unit 130 includes a boundary part specifying processing unit 136 that specifies a boundary part of the document vertex whose vertex coordinates are determined to protrude from the imaging range by the protruding place determination processing unit 134 with the imaging range. The non-inspection area is determined based on the coordinate information indicating the boundary part specified by the boundary part specifying processing unit 136 and the coordinate information of the document vertex whose vertex coordinates are determined to protrude from the imaging range by the protruding place determination processing unit 134. And a non-inspection area setting unit 138 that sets

境界部分特定処理部136は、はみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点について、その原稿頂点を定義する、エッジ有効部直線式算出部126により算出された2つの直線式と撮像範囲を示す直線式とで形成される交点の座標を境界部分を特定する情報(以下境界座標という)として求める。非検査領域設定部138は、はみ出し部分の頂点座標と、この頂点座標に対応して求められた境界座標とにより囲まれた領域を非検査領域として設定する。   The boundary part specifying processing unit 136 is calculated by the edge valid part linear expression calculating unit 126 that defines the document vertex of the document vertex whose vertex coordinates are determined to be outside the imaging range by the protruding place determination processing unit 134. The coordinates of the intersection formed by the two straight-line equations and the straight-line equation indicating the imaging range are obtained as information (hereinafter, referred to as boundary coordinates) for specifying the boundary portion. The non-inspection area setting unit 138 sets, as a non-inspection area, an area surrounded by the vertex coordinates of the protruding portion and the boundary coordinates obtained corresponding to the vertex coordinates.

図5は、本実施形態で処理対象とする、原稿部分が撮像範囲からはみ出して撮像される場合の状態を説明する図である。各図において、原稿の上下左右の頂点座標(xαβ,yαβ)を次のように定義する。すなわち、原稿左上の頂点座標を(xtl,ytl)、原稿左下の頂点座標を(xbl,ybl)、原稿右上の頂点座標を(xtr,ytr)、原稿右下の頂点座標を(xbr,ybr)とする。   FIG. 5 is a diagram illustrating a state in which a document portion to be processed according to the present embodiment is imaged out of the imaging range. In each figure, the coordinates of the top, bottom, left and right vertices (xαβ, yαβ) of the document are defined as follows. That is, the coordinates of the upper left vertex of the document are (xtl, ytl), the coordinates of the lower left vertex of the document are (xbl, ybl), the coordinates of the upper right vertex of the document are (xtr, ytr), and the coordinates of the lower right vertex of the document are (xbr, ybr). And

x,yは、図3にも示したように、撮像画像の走査方向と対応している。符号“α”は、“t”のときは上側(top )を意味し、“b”のときは下側(bottom)を意味する。符号“β”は、“l”のときは左側(left)を意味し、“r”のときは右側(right )を意味する。この符号の意味は、後述する他の符号においても同様とする。また、図中において、“M→N”は、原稿の頂点Mが撮像範囲のN方向へはみ出していることを示す。   As shown in FIG. 3, x and y correspond to the scanning direction of the captured image. The symbol “α” means upper side (top) when “t” and lower side (bottom) when “b”. The symbol “β” means “left” when “l” and right side when “r”. The meaning of this code is the same for other codes described later. In the drawing, “M → N” indicates that the vertex M of the document protrudes in the N direction of the imaging range.

原稿の撮像範囲に対するズレ量や傾きによって、撮像範囲からはみ出す原稿部分の形状が変わる。また、撮像範囲から原稿の一部がはみ出している際には、原稿の4頂点の少なくとも1つが撮像範囲からはみ出す。ただし、3頂点が撮像範囲内であれば、4辺全てが、辺の少なくとも一部は撮像範囲内にある。本実施形態においては、このように、矩形状の原稿の4頂点のうちの1つが撮像範囲からはみ出し、残りの3頂点は撮像範囲内にあるはみ出し状態を処理対象とする。図示した例において、図5(A)および図5(B)は、原稿が撮像範囲に対して傾きを持たずに平行移動した状態でズレた場合を示す。図5(C)〜図5(J)は、傾きを持ってはみ出している状態を示す。   The shape of the portion of the document that protrudes from the imaging range changes depending on the amount of deviation and the inclination of the document with respect to the imaging range. Further, when a part of the document protrudes from the imaging range, at least one of the four vertices of the document protrudes from the imaging range. However, if three vertices are within the imaging range, all four sides are at least partially within the imaging range. In this embodiment, as described above, one of the four vertices of the rectangular document protrudes from the imaging range, and the remaining three vertices protrude from the imaging range. In the illustrated example, FIGS. 5A and 5B show a case where the original is displaced in a state where the original is moved in parallel with no inclination with respect to the imaging range. FIG. 5C to FIG. 5J show a state in which the image is protruded with an inclination.

図示した例は一例であり、傾き状況などによって、頂点αと撮像範囲の境界との関係が図示した状態以外を取り得るが、その場合でも、1頂点は撮像範囲外、残りの3頂点は撮像範囲内であるものは全て本実施形態の処理範囲とする。一方、2頂点以上が撮像範囲外となるはみ出し状態は、本実施形態の処理対象としない。はみ出し状態として取り得る全態様に対して本実施形態は対応しないが、はみ出し量がさほど多くなければ、概ね、1頂点は撮像範囲外で残りの3頂点は撮像範囲内となるので、実用上の問題とはならないと考える。   The illustrated example is an example, and the relationship between the vertex α and the boundary of the imaging range may take a state other than the illustrated state depending on the inclination state or the like. Even in this case, one vertex is out of the imaging range and the remaining three vertices are imaged. Everything within the range is the processing range of the present embodiment. On the other hand, a protruding state in which two or more vertices are out of the imaging range is not a processing target of the present embodiment. Although the present embodiment does not correspond to all possible modes of the protruding state, if the protruding amount is not so large, generally, one vertex is outside the imaging range and the remaining three vertices are within the imaging range. I don't think this is a problem.

非検査領域特定処理部120は、原稿が図5(A)〜図5(J)の何れの状態にあるのかに応じて、撮像範囲からはみ出す原稿部分を適切に特定し、そのはみ出し部分を非検査領域として設定する。   The non-inspection area specification processing unit 120 appropriately specifies the document portion that protrudes from the imaging range according to the state of the document illustrated in FIGS. 5A to 5J, and determines the protruding portion. Set as an inspection area.

図6は、上記第1実施形態の画像検査装置5における処理手順の概要を示すフローチャートである。第1実施形態の画像検査装置5においては、プリンタ部500が待機状態にあるとき、カメラヘッド102は制御部320の指示により、排紙トレイ584上を定期的に撮影し、その画像を出力する。   FIG. 6 is a flowchart illustrating an outline of a processing procedure in the image inspection apparatus 5 according to the first embodiment. In the image inspection apparatus 5 of the first embodiment, when the printer unit 500 is in a standby state, the camera head 102 periodically captures an image on the paper output tray 584 and outputs the image according to an instruction from the control unit 320. .

制御部320は、基準画像の一例であるデータ格納部300に格納してある排紙トレイ584の画像とカメラヘッド102により取得された撮像画像とを比較し、原稿が排紙トレイ584上にあるか否かを判断し、原稿が排紙トレイ584上にある場合には画像検査可能のフラグをオフにしてそのまま待機状態を続ける一方、排紙トレイ584上に原稿がない場合には画像検査可能のフラグをオンにして待機状態を続ける(S100)。   The control unit 320 compares the image of the paper output tray 584 stored in the data storage unit 300, which is an example of the reference image, with the captured image obtained by the camera head 102, and the document is on the paper output tray 584. It is determined whether or not the document is on the discharge tray 584, the image inspection possible flag is turned off, and the standby state is continued. On the other hand, if no document is on the discharge tray 584, the image inspection is possible. The flag is turned on and the standby state is continued (S100).

そして、制御部320は、待機状態においてプリントジョブを受け取ると(S102)、画像検査可能のフラグを判定する(S104)。そして、画像検査可能のフラグがオフの場合(S104−No)、制御部320は、プリントエンジン570に通常のプリント処理をさせ(S106)、待機状態へ戻る(S180)。一方、画像検査可能のフラグがオンの場合(S104−Yes)、制御部320は、プリントジョブのN枚目(最初は当然に1枚目)について、画像検査を以下のように実行する。   Then, when receiving a print job in the standby state (S102), the control unit 320 determines a flag indicating that image inspection is possible (S104). Then, when the image inspection possible flag is off (S104-No), the control unit 320 causes the print engine 570 to perform normal print processing (S106), and returns to the standby state (S180). On the other hand, when the image inspection possible flag is on (S104-Yes), the control unit 320 executes the image inspection on the Nth print job (first, naturally, the first print job) as follows.

すなわち、制御部320は、先ずN枚目(最初は当然に1枚目)のプリント処理をプリントエンジン570に開始させ(S108)、展開後の画像データを、プリントエンジン570のプリント出力処理部572へ送出するとともに、データ格納部300に格納する。そして、最後の画像データのレンダリング処理が終了すると、プリント出力処理部572からの1枚目処理完了の信号を待ち(S130)、完了信号がくると規定の時間後にカメラヘッド102へ撮影開始トリガ信号を送る(S132)。   That is, the control unit 320 first causes the print engine 570 to start print processing of the N-th sheet (first, naturally, the first sheet) (S108), and outputs the developed image data to the print output processing unit 572 of the print engine 570. And stores it in the data storage unit 300. When the rendering processing of the last image data is completed, a signal of completion of processing of the first sheet from the print output processing unit 572 is waited (S130). When a completion signal comes, a shooting start trigger signal is sent to the camera head 102 after a prescribed time. Is sent (S132).

カメラヘッド102は、トリガ信号に同期してシャッタを切る(撮影する)が、このとき排紙トレイ584上に原稿P(プリント出力紙)が出力された直後となっている。カメラヘッド102は、矩形状の原稿を撮影して得た台形状の撮像画像をデータ格納部300に格納する。   The camera head 102 releases the shutter (photographs) in synchronization with the trigger signal, but at this time immediately after the document P (print output paper) is output onto the paper discharge tray 584. The camera head 102 stores a trapezoidal captured image obtained by photographing a rectangular document in the data storage unit 300.

プリントジョブが複数枚(N枚)の場合、制御部320は、その複数枚(N枚)に対する処理が全て完了するまで後述する処理(S130〜S162)と並行して残りのプリント処理を進行させる(S110)。これらの処理は図では並列処理のように示しているが、時分割の逐次処理として実行することもできる。複数枚(N枚)が全て完了すると、制御部320は、待機状態へ戻る(S112)。このようにして、カメラヘッド102により撮像された全ての撮像画像は、デジタル信号に変換されてデータ格納部300へ格納される。   When the print job is a plurality of sheets (N sheets), the control unit 320 proceeds with the remaining print processing in parallel with the processing (S130 to S162) described later until the processing for all the plurality of sheets (N sheets) is completed. (S110). Although these processes are shown as parallel processes in the figure, they can be executed as time-division sequential processes. When the plurality of sheets (N sheets) are all completed, the control unit 320 returns to the standby state (S112). In this manner, all captured images captured by the camera head 102 are converted into digital signals and stored in the data storage unit 300.

撮像画像処理部110は、カメラヘッド102により撮影された撮像画像に対して前処理を施す。すなわち、シェーディング補正部112は、カメラヘッド102により撮影された撮像画像をデータ格納部300から読み出し、照度むらやセンサ画素特性バラ付きを補正するシェーディング補正を行なう(S134)。また、光学歪補正部114は、シェーディング補正が施された画像に対して、撮影レンズ104の歪曲収差などを補正する光学歪み補正を施し、処理済の画像をデータ格納部300に格納する(S136)。   The captured image processing unit 110 performs pre-processing on the captured image captured by the camera head 102. That is, the shading correction unit 112 reads the captured image captured by the camera head 102 from the data storage unit 300, and performs shading correction for correcting uneven illuminance and variation in sensor pixel characteristics (S134). Further, the optical distortion correction unit 114 performs optical distortion correction for correcting the distortion and the like of the photographing lens 104 on the image on which the shading correction has been performed, and stores the processed image in the data storage unit 300 (S136). ).

次に、制御部320は、撮像画像処理部110によりシェーディング補正や光学歪み補正が施された撮像画像に対して透視変換(透視変換)処理を行なうかどうかを決定する(S140)。撮像画像に対して透視変換処理を行なう場合(S140−Yes)、制御部320は、撮像画像処理部110側に設けられた透視変換部116に対して透視変換処理を指示する。この指示を受けた透視変換部116は、シェーディング補正された撮像画像に対して、上述した変換式(3),(4)に基づいて、台形の原稿領域を矩形に透視変換処理し、処理済の画像をデータ格納部300に格納する(S142)。   Next, the control unit 320 determines whether or not to perform perspective transformation (perspective transformation) on the captured image on which shading correction and optical distortion correction have been performed by the captured image processing unit 110 (S140). When performing the perspective transformation process on the captured image (S140-Yes), the control unit 320 instructs the perspective transformation unit 116 provided on the captured image processing unit 110 side to perform the perspective transformation process. The perspective transformation unit 116 that has received this instruction performs perspective transformation processing on the trapezoidal document area into a rectangle based on the above-described transformation equations (3) and (4) for the captured image that has been subjected to shading correction. Is stored in the data storage unit 300 (S142).

この後、制御部320は、非検査領域特定処理部120に対して、撮像範囲からはみ出している原稿部分を特定するよう非検査領域特定処理部120に指示する。この指示を受けた非検査領域特定処理部120は、後述する手順にしたがって、非検査領域特定処理を実行し、はみ出し部分の領域(非検査領域)を示す情報をデータ格納部300に格納する(S144)。   After that, the control unit 320 instructs the non-inspection area identification processing unit 120 to identify the document portion that is out of the imaging range. The non-inspection area identification processing unit 120 that has received the instruction executes the non-inspection area identification processing according to a procedure described later, and stores information indicating the area of the protruding portion (non-inspection area) in the data storage unit 300 ( S144).

次に、基準画像処理部210の解像度変換部214は、矩形状の基準画像のサイズと検査対象である撮像画像における矩形状の原稿部分の画像のサイズとが等しくなるように、基準画像の解像度を変換する(S152)。   Next, the resolution conversion unit 214 of the reference image processing unit 210 adjusts the resolution of the reference image so that the size of the rectangular reference image is equal to the size of the image of the rectangular document portion in the captured image to be inspected. Is converted (S152).

次に、暈かし処理部216は、解像度変換された基準画像に対して、撮像画像データにおけるカメラヘッド102の光学系に起因する暈けを反映させるために、非検査領域特定部130により抽出された頂点座標A,B,C,Dを参照して、ガウスフィルタ処理において使用する画像の台形形状に応じた補正係数の値を算出し、これを元に基準画像に暈かし処理(ガウスフィルタ処理)を施す(S154)。   Next, the blurring processing unit 216 extracts the non-inspection area specifying unit 130 to reflect the blurring caused by the optical system of the camera head 102 in the captured image data in the resolution-converted reference image. With reference to the obtained vertex coordinates A, B, C, and D, the value of the correction coefficient corresponding to the trapezoidal shape of the image used in the Gaussian filter process is calculated, and based on this, the blurring process (Gaussian process) is performed on the reference image. Filter processing) (S154).

ここで、基準画像に暈かし処理を施すのは、基準画像は理想的な濃淡特性を持っているために、撮像画像の暈け特性と同等の暈かし処理を施すことで、撮影画像の暈け分布に対応して暈かし処理を施すことができ、次に説明する、差分処理の際の誤差を最小にできるためである。   Here, the blurring process is performed on the reference image because the reference image has an ideal density characteristic, and the blurring process equivalent to the blurring characteristic of the captured image is performed. This is because the blurring process can be performed in accordance with the blurring distribution, and an error in the difference processing described below can be minimized.

次に非検査領域削除処理部218は、非検査領域特定部130により特定された非検査領域情報をデータ格納部300から読み出し、暈かし処理部216により暈かし処理が施された基準画像における非検査領域部分のデータを無効化することで、基準画像に対して非検査領域を設定する(S156)。非検査領域設定部138は、処理済の基準画像をデータ格納部300に格納する。   Next, the non-inspection area deletion processing unit 218 reads out the non-inspection area information specified by the non-inspection area specifying unit 130 from the data storage unit 300, and performs the shading processing by the shading processing unit 216 on the reference image. The non-inspection area is set for the reference image by invalidating the data of the non-inspection area in (S156). The non-inspection area setting unit 138 stores the processed reference image in the data storage unit 300.

次に、位置合わせ処理部232は、基準画像処理部210の暈かし処理部216にて暈かし処理が施されかつ非検査領域部分が無効化された基準画像と画像読取部100にて前処理が施された撮像画像の位置合わせ処理を開始する(S158)。たとえば、位置合わせ処理部232は、基準画像をテンプレートとして撮像画像内を走査しながら、正規化相互相関係数を逐次計算し、最も相関係数の高い場所が位置の合った部分と見なす、いわゆるテンプレートマッチングで位置合わせを行なう。   Next, the alignment processing unit 232 performs processing on the image reading unit 100 with the reference image that has been subjected to the blurring processing by the blurring processing unit 216 of the reference image processing unit 210 and the non-inspection area portion has been invalidated. The registration process of the pre-processed captured image is started (S158). For example, the alignment processing unit 232 sequentially calculates the normalized cross-correlation coefficient while scanning the captured image using the reference image as a template, and regards a position having the highest correlation coefficient as a portion where the position is matched, so-called Positioning is performed by template matching.

次に、欠陥異常検出処理部234は、撮像画像処理部110にて前処理が施されデータ格納部300に格納された検査対象の撮像画像(台形形状のもの)と、基準画像処理部210にて透視変換処理や暈かし処理が施された基準画像(台形形状のもの)との差を求める(両者を比較する)差分処理を行なう(S160)。そして、欠陥異常検出処理部234は、差分処理により得られた差分結果に基づいて、撮像画像の欠陥や異常の有無を検出する(S162)。位置合わせ処理部232および欠陥異常検出処理部234は、以上の処理を基準画像の全面について行ない、完了後には再び待機状態へ戻る。   Next, the defect abnormality detection processing unit 234 transmits the inspection image (trapezoidal shape) that has been pre-processed by the captured image processing unit 110 and stored in the data storage unit 300 to the reference image processing unit 210. Then, a difference process is performed to obtain a difference from the reference image (with a trapezoidal shape) subjected to the perspective transformation process or the blurring process (compare the two) (S160). Then, the defect abnormality detection processing unit 234 detects the presence or absence of a defect or abnormality in the captured image based on the difference result obtained by the difference processing (S162). The alignment processing unit 232 and the defect abnormality detection processing unit 234 perform the above processing on the entire surface of the reference image, and after completion, return to the standby state again.

たとえば、欠陥異常検出処理部234は、位置が合った部分での正規化相互相関係数が判定指標値を下回る場合、その部分に画像欠陥が存在すると見なして欠陥異常検出処理を行なう。これにより、たとえば、プリント出力すなわち撮像画像に黒点などの欠陥パターンがあると、その欠陥を含む場所で正規化相互相関係数が明らかに低下するので、差分結果に黒点が残る。   For example, when the normalized cross-correlation coefficient at a position where the position is matched is lower than the determination index value, the defect abnormality detection processing unit 234 performs a defect abnormality detection process on the assumption that an image defect exists at that portion. Thus, for example, if there is a defect pattern such as a black spot in a print output, that is, a captured image, the normalized cross-correlation coefficient clearly decreases at a location including the defect, and a black spot remains in the difference result.

よって、たとえば、適当な濃度の閾値を設定して差分結果を2値化することで、黒点を特定することができ、画像欠陥の存在の有無を容易に判定することができる。なお、黒点などの局所的な画像欠陥の検出に限らず、撮像画像の全体的な濃度のむらや濃度シフトなどの画質不良の検出にも適用できる。   Therefore, for example, by setting an appropriate density threshold and binarizing the difference result, a black point can be specified, and the presence or absence of an image defect can be easily determined. The present invention is not limited to the detection of local image defects such as black spots, and can be applied to the detection of image quality defects such as overall density unevenness and density shift of a captured image.

欠陥異常検出処理部234が画像欠陥や画質不良を検出した場合には、画像検査装置5は、所定の表示デバイスあるいは音声信号発生器(たとえばスピーカ)などの図示しないユーザインタフェース上で警告を発したり、プリント管理ソフトウェアなどを利用して、通信網を通してプリントしようとしているクライアント端末(たとえばパソコン)へ警告を発したり、さらにはリモート保守システムなどを介して通信網を通してプリンタの保守業者へ通知する。   When the defect abnormality detection processing unit 234 detects an image defect or a poor image quality, the image inspection device 5 issues a warning on a user interface (not shown) such as a predetermined display device or an audio signal generator (for example, a speaker). Using a print management software or the like, a warning is issued to a client terminal (for example, a personal computer) trying to print through a communication network, and further a notification is sent to a printer maintenance company through a communication network via a remote maintenance system or the like.

図7は、第1実施形態で取り扱う画像の一例を示す図である。ここで、図7(A)は、撮像範囲内に原稿が適切におかれている状態を示す図、図7(B)は、図7(A)の状態でカメラヘッド102により撮像された結果を示す図、図7(C)は、図7(B)の画像に対して幾透視変換部116により透視変換した結果を示す図である。   FIG. 7 is a diagram illustrating an example of an image handled in the first embodiment. Here, FIG. 7A is a diagram showing a state where a document is properly placed within an imaging range, and FIG. 7B is a result of image pickup by the camera head 102 in the state of FIG. 7A. FIG. 7C is a diagram showing a result of perspective transformation performed on the image of FIG. 7B by the perspective transformation unit 116.

カメラヘッド102により撮像された透視変換処理前の画像データにおける原稿部分は、図7(B)のように台形状を呈する。この画像に対して透視変換部116にて透視変換を施すと、図7(C)のように、原稿分が矩形状に戻るが、撮像範囲の外郭は台形状を呈する。後段の信号処理においては、この台形状の撮像範囲のうちの原稿部分を含む所望範囲(図の太線部分)を矩形状に切り出して処理対象の撮像画像とする。   The original portion in the image data before the perspective transformation processing captured by the camera head 102 has a trapezoidal shape as shown in FIG. When the perspective transformation is performed on this image by the perspective transformation unit 116, the original document returns to a rectangular shape as shown in FIG. 7C, but the outline of the imaging range has a trapezoidal shape. In the subsequent signal processing, a desired range (the thick line portion in the figure) including the document portion in the trapezoidal imaging range is cut out into a rectangular shape to obtain a captured image to be processed.

なお、図7(C)に示すように、台形状の撮像範囲を画定する外郭辺の直線式を、それぞれ以下の式(5)〜(8)ように定義する。   Note that, as shown in FIG. 7C, the straight line formulas of the outline defining the trapezoidal imaging range are defined as the following expressions (5) to (8).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

図8は、第1実施形態で取り扱う画像の、他の一例を示す図である。ここで、図8(A)は、原稿が撮像範囲に対して回転することなく置かれかつ撮像範囲内から原稿の一部がはみ出して置かれている状態でカメラヘッド102により撮像された結果を示す図、図8(B)は、図8(A)の画像に対して透視変換部116により透視変換した結果を示す図である。   FIG. 8 is a diagram illustrating another example of an image handled in the first embodiment. Here, FIG. 8A shows a result of imaging by the camera head 102 in a state where the original is placed without rotating with respect to the imaging range and a part of the original protrudes from the imaging range. FIG. 8B is a diagram showing a result of perspective transformation performed on the image of FIG. 8A by the perspective transformation unit 116.

カメラヘッド102により撮像された透視変換処理前の画像データにおける原稿部分は、図8(A)のように台形状を呈する。この画像に対して透視変換部116にて透視変換を施すと、図8(B)のように、原稿分が矩形状に戻るが、撮像範囲からはみ出していた部分に対応する部分は無効な部分となって現れる。したがって、撮像範囲のうちの原稿部分を含む所望範囲(図の太線部分)を矩形状に切り出して処理対象の撮像画像とした場合にも、画像データ中には、この無効部分を含む。   The original portion in the image data before the perspective transformation processing captured by the camera head 102 has a trapezoidal shape as shown in FIG. When a perspective transformation is performed on this image by the perspective transformation unit 116, the original document returns to a rectangular shape as shown in FIG. 8B, but the portion corresponding to the portion that protrudes from the imaging range is an invalid portion. Appears as. Therefore, even when a desired range (the thick line portion in the figure) including the document portion in the imaging range is cut out into a rectangular shape to obtain a captured image to be processed, the invalid data is included in the image data.

図9は、エッジ抽出部122の処理を説明する図である。エッジ抽出部122は、透視変換部116により透視変換された撮像画像に対してエッジ抽出を施す。エッジ抽出は、たとえば、prewitt演算子で、上側、左側、下側、右側のそれぞれの方向からサーチして行なう。たとえば、以下の式(9)で示す上側、左側、下側、右側の各オペレータを適用する。これにより、図9(A)〜図9(D)で示すエッジ抽出画像が得られる。   FIG. 9 is a diagram for explaining the processing of the edge extraction unit 122. The edge extraction unit 122 performs edge extraction on the captured image that has been perspectively transformed by the perspective transformation unit 116. Edge extraction is performed by, for example, searching from the upper, left, lower, and right directions using a prewitt operator. For example, each operator on the upper side, left side, lower side, and right side expressed by the following equation (9) is applied. Thereby, the edge extraction images shown in FIGS. 9A to 9D are obtained.

Figure 2004310726
Figure 2004310726

次に、図9(A)〜図9(D)で示すエッジ抽出画像の各画素について和を取ることで、図9(E)に示す合成されたエッジ抽出画像が得られる。エッジ有効部検出部124が、図9(E)に示すエッジ抽出画像に基づいてエッジ有効部検出処理を施すことで、図9(F)に示すエッジ抽出画像が得られる。図9(F)にて、4つの直線部(図中の太線)で示された部分がエッジ有効部となる。なお、図9(F)では、はみ出し部分の階調値をゼロ(黒)で示している。   Next, a sum is obtained for each pixel of the edge extraction images shown in FIGS. 9A to 9D to obtain a combined edge extraction image shown in FIG. 9E. The edge-effective-portion detection unit 124 performs the edge-effective-portion detection process based on the edge-extracted image shown in FIG. 9E, thereby obtaining an edge-extracted image shown in FIG. 9F. In FIG. 9F, a portion indicated by four straight lines (thick lines in the drawing) is an edge effective portion. In FIG. 9 (F), the gradation value of the protruding portion is indicated by zero (black).

なお、prewitt演算子については、以下の式(10)で示す上側、左側、下側、右側の各オペレータでエッジ抽出し、図9(E)に示す合成されたエッジ抽出画像をさらに追加することによって、よりエッジが強調されたエッジ抽出画像を得ることができる。   Note that, for the prewitt operator, edges are extracted by the upper, left, lower, and right operators shown in the following equation (10), and the combined edge extracted image shown in FIG. 9E is further added. Thus, it is possible to obtain an edge extraction image in which edges are further emphasized.

Figure 2004310726
Figure 2004310726

図10は、第1実施形態の非検査領域特定処理部120の非検査領域特定処理の手順の概要を示すフローチャートである。この第1実施形態の非検査領域特定処理は、原稿の一部が撮像範囲からはみ出した撮影画像に対して幾何変換処理(透視変換処理)を行なった後、非検査領域を設定して検査するものである。   FIG. 10 is a flowchart illustrating an outline of a procedure of the non-inspection area specifying process of the non-inspection area specifying processing unit 120 according to the first embodiment. In the non-inspection area specifying process according to the first embodiment, after performing a geometric transformation process (perspective transformation process) on a captured image in which a part of a document is out of an imaging range, a non-inspection region is set and inspected. Things.

先ず、エッジ抽出部122は、透視変換部116により透視変換された撮像画像からエッジ成分を抽出する(S200)。具体的には、透視変換部116により透視変換された撮像画像に対して、上下左右の方向ごとにprewitt演算子を適用してエッジ抽出を施す。これにより、図9(A)〜(D)に示したようなエッジ抽出画像が得られる。   First, the edge extraction unit 122 extracts an edge component from the captured image that has been perspectively transformed by the perspective transformation unit 116 (S200). More specifically, the captured image subjected to the perspective transformation by the perspective transformation unit 116 is subjected to edge extraction by applying a prewitt operator for each of up, down, left, and right directions. As a result, an edge-extracted image as shown in FIGS. 9A to 9D is obtained.

次に、エッジ有効部検出部124は、上下左右の方向ごとに抽出されたエッジ情報を参照して、上下左右のそれぞれについて1つのエッジ有効部を検出する。具体的には、エッジ有効部検出部124は、先ず、上下左右のそれぞれについて、有効なエッジ部分(エッジ有効部)を特定する(S210)。1つのエッジ有効部が特定できたとき、それが原稿の辺縁を示す直線となる。特定したエッジ有効部が複数ある場合、エッジ有効部検出部124は、特定した複数のエッジ有効部の中から、より確からしいエッジ有効部を検出する(S300)。   Next, the edge valid part detecting unit 124 detects one edge valid part for each of the upper, lower, left, and right with reference to the edge information extracted for each of the up, down, left, and right directions. Specifically, the valid edge detection unit 124 first specifies valid edge portions (vertical valid portions) for each of the upper, lower, left, and right directions (S210). When one edge effective portion can be specified, it becomes a straight line indicating the edge of the document. If there are a plurality of specified edge valid parts, the edge valid part detection unit 124 detects a more probable edge valid part from the specified plurality of edge valid parts (S300).

次に、エッジ有効部直線式算出部126は、エッジ有効部検出部124により検出されたエッジ有効部に基づいて原稿の頂点座標を特定するために、先ずエッジ有効部直線式算出処理を、上辺、下辺、左辺、右辺のそれぞれについて行なう(S400)。   Next, in order to specify the vertex coordinates of the document based on the edge valid part detected by the edge valid part detection unit 124, the edge valid part linear equation calculation unit 126 first executes the edge effective part linear equation calculation processing. , The lower side, the left side, and the right side (S400).

次に、原稿頂点設定処理部132は、エッジ有効部直線式算出部126により算出された直線式を参照して撮像画像における原稿の頂点座標を特定する(S420)。はみ出し場所判定処理部134は、原稿頂点設定処理部132により設定された頂点座標が撮像範囲からはみ出しているか否かを判定する(S500)。   Next, the document vertex setting processing unit 132 specifies the vertex coordinates of the document in the captured image with reference to the linear equation calculated by the edge effective unit linear equation calculating unit 126 (S420). The protruding place determination processing unit 134 determines whether the vertex coordinates set by the document vertex setting processing unit 132 are out of the imaging range (S500).

次に、境界部分特定処理部136は、はみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点についての撮像範囲との境界部分を特定し、非検査領域設定部138は、その特定された境界部分を示す座標情報とはみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点の座標情報とに基づいて非検査領域を画定する(S600)。非検査領域設定部138は、この画定した非検査領域を示す情報をデータ格納部300に登録する。   Next, the boundary part specifying processing unit 136 specifies a boundary part of the document vertex whose vertex coordinates are determined to protrude from the imaging range by the protruding place determination processing unit 134 and the non-inspection area setting unit. 138 defines a non-inspection area based on the coordinate information indicating the specified boundary portion and the coordinate information of the document vertex whose vertex coordinates are determined to protrude from the imaging range by the protruding place determination processing unit 134 ( S600). The non-inspection area setting unit 138 registers information indicating the defined non-inspection area in the data storage unit 300.

図11は、第1例の非検査領域特定処理におけるエッジ抽出処理(図10のS200)を示すフローチャートである。   FIG. 11 is a flowchart showing the edge extraction processing (S200 in FIG. 10) in the non-inspection area specifying processing of the first example.

エッジ抽出部122は、左辺に着目して左側からサーチする左辺エッジ抽出処理(S210L)、右辺に着目して右側からサーチする右辺エッジ抽出処理(S210R)、上辺に着目して上側からサーチする上辺エッジ抽出処理(S210T)、下辺に着目して下側からサーチする下辺エッジ抽出処理(S210B)の順でエッジ抽出処理を行なう。   The edge extraction unit 122 focuses on the left side and searches from the left side from the left side (S210L), focuses on the right side and searches from the right side on the right side (S210R), focuses on the upper side and searches from the upper side on the upper side Edge extraction processing is performed in the order of edge extraction processing (S210T) and lower edge extraction processing (S210B) that searches from the lower side by focusing on the lower side.

図12は、第1例の非検査領域特定処理における左辺エッジ抽出処理(図11のS210L)の詳細例を示すフローチャートである。   FIG. 12 is a flowchart illustrating a detailed example of the left side edge extraction processing (S210L in FIG. 11) in the non-inspection area specifying processing of the first example.

エッジ抽出122は、先ず、オペレータ“i”を“0”に初期セットし(S210)、y座標がyl(i)のときのエッジ座標xl(i)を検出する(S222−Yes,S224)。これは、(x,y)を(0,yl(i)),(1,yl(i)),(2,yl(i)),(3,yl(i)),…とスキャンさせることによって最初に階調値が“255”、すなわち、最初に黒から白に変化する点をエッジ座標(xl(i),yl(i))として検出している。   First, the edge extraction 122 initially sets the operator “i” to “0” (S210), and detects edge coordinates xl (i) when the y coordinate is yl (i) (S222-Yes, S224). This means that (x, y) is scanned as (0, yl (i)), (1, yl (i)), (2, yl (i)), (3, yl (i)), ... First, the point where the gradation value is “255”, that is, the point where black changes to white first is detected as the edge coordinates (xl (i), yl (i)).

ここで、スキャンするyl(i)座標は数画素ごととする、すなわち、スキャン幅を数画素とする。抽出したエッジ座標は、(xl(0),yl(0)),(xl(1),yl(1)),(xl(2),yl(2)),(xl(3),yl(3)),…,(xl(i),yl(i)),…となる。   Here, the yl (i) coordinates to be scanned are set every several pixels, that is, the scan width is set to several pixels. The extracted edge coordinates are (xl (0), yl (0)), (xl (1), yl (1)), (xl (2), yl (2)), (xl (3), yl ( 3)),..., (Xl (i), yl (i)),.

次に、エッジ有効部検出部124は、抽出した全エッジ座標について、隣接したエッジ座標間(xl(i−1),yl(i−1))と(xl(i),yl(i))の傾きal(i−1)を、式(11)のようにして算出する(S226−Yes,S228)。   Next, the edge valid part detecting unit 124 determines, for all the extracted edge coordinates, between adjacent edge coordinates (xl (i-1), yl (i-1)) and (xl (i), yl (i)). Is calculated as in the equation (11) (S226-Yes, S228).

Figure 2004310726
Figure 2004310726

“i”をイクリメントしながら、傾きal(i−1)の算出処理を処理対象の撮像範囲分(図中の太線部分)だけ繰り返す(S230,S222)。設定値1は、この範囲を規定するために設定されるもので、スキャン方向(本例ではy方向)それぞれについての撮像範囲分の画素数をスキャン幅の画素数で除した値にするとよい。なお、“i=0”でステップ228をパスしているのは、エッジ座標が2点なければ傾きal(i−1)が求められないためである(S226−No)。   The calculation process of the inclination al (i-1) is repeated for the imaging range to be processed (the thick line portion in the figure) while incrementing "i" (S230, S222). The setting value 1 is set to define this range, and may be set to a value obtained by dividing the number of pixels in the imaging range in each of the scanning directions (the y direction in this example) by the number of pixels of the scanning width. The reason why the step 228 is passed when “i = 0” is that the inclination al (i−1) cannot be obtained unless there are two edge coordinates (S226-No).

次に、エッジ有効部検出部124は、オペレータ“i”を“0”に、オペレータ“leftedgecnt”を“0”に、それぞれ初期セットする(S240)。また、エッジ有効部開始フラグ sflagを“0”に初期セットする(S242)。そして、エッジ有効部検出部124は、算出した傾きal(1),al(2),al(3),…,al(i),…について、さらに、隣接した傾き間al(i+1)とal(i)の差sl(i)を式(12)のようにして算出する(S246)。   Next, the edge valid part detection unit 124 initially sets the operator "i" to "0" and the operator "leftedgecnt" to "0" (S240). Further, the edge valid part start flag sflag is initially set to “0” (S242). Then, the edge valid part detecting unit 124 further calculates, for the calculated gradients al (1), al (2), al (3),..., Al (i),. The difference sl (i) of (i) is calculated as in equation (12) (S246).

Figure 2004310726
Figure 2004310726

次に、エッジ有効部検出部124は、算出した差sl(i)が設定値2以下であるか否かを判定する(S250)。原稿辺縁に対応する部分で検知されるエッジ画素を使用した傾き差はほぼゼロと考えることができる。一方、はみ出し部分を走査した結果得られる傾き差は、原稿内部の文字部のエッジ画素を使用した傾き差となるので、比較的大きいと考えることができる。よって、ノイズの影響を除去する程度に設定値2の値を決めるとよい。   Next, the edge valid part detecting unit 124 determines whether or not the calculated difference sl (i) is equal to or smaller than the set value 2 (S250). The inclination difference using the edge pixels detected at the portion corresponding to the document margin can be considered to be almost zero. On the other hand, the inclination difference obtained as a result of scanning the protruding portion is an inclination difference using the edge pixels of the character portion inside the document, and can be considered to be relatively large. Therefore, it is preferable to determine the value of the set value 2 so as to remove the influence of noise.

sl(i)が設定値2以下の場合(S250−Yes)、エッジ有効部検出部124は、エッジ有効部開始フラグ sflagを“1”に設定する(S254)。そして、このときの(xl(i),yl(i))を左辺エッジ有効部開始点(xsl(leftedgecnt),ysl(leftedgecnt))とする(S256)。   When sl (i) is equal to or less than the set value 2 (S250-Yes), the edge-effective-portion detection unit 124 sets the edge-effective-portion start flag sflag to “1” (S254). Then, (xl (i), yl (i)) at this time is set as the left edge effective portion start point (xsl (leftedgecnt), ysl (leftedgecnt)) (S256).

このステップS256の後、オペレータ“i”を“1”インクリメントしてステップS244に戻る(S270)。その後もsl(i)の値が設定値2以下の場合、 sflagは“1”のままであるので、エッジ有効部と検出される。   After step S256, the operator "i" is incremented by "1" and the process returns to step S244 (S270). After that, if the value of sl (i) is equal to or less than the set value 2, the sflag remains "1", and is detected as an edge valid part.

一方、sl(i)が設定値2より大きくなった場合(S250−No)、エッジ有効部検出部124は、エッジ有効部開始フラグ sflagが“1”であるか否を判定し(S262)、エッジ有効部開始フラグ sflagが“1”の場合に限って、エッジ有効部を終了させるためにエッジ有効部開始フラグ sflagを“0”に設定する(S262−Yes,S264)。   On the other hand, when sl (i) is larger than the set value 2 (S250-No), the edge-effective-portion detection unit 124 determines whether the edge-effective-portion start flag sflag is “1” (S262). Only when the edge valid part start flag sflag is "1", the edge valid part start flag sflag is set to "0" to end the edge valid part (S262-Yes, S264).

また、エッジ有効部検出部124は、このときの(xl(i),yl(i))を左辺エッジ有効部終了点(xel(leftedgecnt),yel(leftedgecnt))とし(S266)、オペレータ“i”,“leftedgecnt”をそれぞれ“1”インクリメントしてステップS244に戻る(S272)。   Further, the edge valid part detecting unit 124 sets (xl (i), yl (i)) at this time as the left side edge valid part end point (xel (leftedgecnt), yel (leftedgecnt)) (S266), and the operator “i”. "And" leftedgecnt "are each incremented by" 1 ", and the process returns to step S244 (S272).

オペレータ“i”が“設定値1−1”を超えたときには(S244−No)、エッジ有効部検出部124は、左辺エッジ有効部開始点(xsl(leftedgecnt),ysl(leftedgecnt))と左辺エッジ有効部終了点(xel(leftedgecnt),yel(leftedgecnt))との間を有効エッジ部に設定する(S278)。   When the operator “i” exceeds the “set value 1-1” (S244-No), the edge valid part detection unit 124 sets the left edge valid part start point (xsl (leftedgecnt), ysl (leftedgecnt)) to the left edge. An effective edge portion is set between the effective portion end point (xel (leftedgecnt) and yel (leftedgecnt)) (S278).

このようにして、(xsl(0),ysl(0))と(xel(0),yel(0)),(xsl(1),ysl(1))と(xel(1),yel(1)),…,(xsl(leftedgecnt),ysl(leftedgecnt))と(xel(leftedgecnt),yel(leftedgecnt))を検出して、有効エッジ部と設定する。検出された有効エッジの数はleftedgecnt個である。   Thus, (xsl (0), ysl (0)) and (xel (0), yel (0)), (xsl (1), ysl (1)) and (xel (1), yel (1) )),..., (Xsl (leftedgecnt), ysl (leftedgecnt)) and (xel (leftedgecnt), yel (leftedgecnt)) are detected and set as an effective edge portion. The number of detected valid edges is leftedgecnt.

右辺エッジ有効部検出処理S210R、上辺エッジ有効部検出処理S210UT、下辺有効エッジ部検出処理検出処理S210Bも、スキャン方向をそれぞれの方向に応じて切り換えて、左辺エッジ有効部検出処理の処理手順に準じた処理とすればよい。これにより、右辺エッジ有効部は(xsr(0),ysr(0))と(xer(0),yer(0)),(xsr(1),ysr(1))と(xer(1),yer(1)),…,(xsr(rightedgecnt),ysr(rightedgecnt))と(xer(rightedgecnt ),yer(rightedgecnt))がrightedgecnt 個だけ検出される。   The right side edge valid part detection processing S210R, the upper side edge valid part detection processing S210UT, and the lower side valid edge part detection processing detection processing S210B also switch the scan direction according to each direction, and follow the processing procedure of the left side edge valid part detection processing. Process. As a result, the right side edge valid part becomes (xsr (0), ysr (0)) and (xer (0), yr (0)), (xsr (1), ysr (1)) and (xer (1), .., (xsr (rightedgecnt), ysr (rightedgecnt)) and (xer (rightedgecnt), yer (rightedgecnt)) are detected only rightedgecnt.

また、上辺エッジ有効部は(xst(0),yst(0))と(xet(0),yet(0)),(xst(1),yst(1))と(xet(1),yet(1)),…,(xst(topedgecnt),yst(topedgecnt))と(xet(topedgecnt),yet(topedgecnt))がtopedgecnt個だけ検出される。また、下辺エッジ有効部は(xsb(0),ysb(0))と(xeb(0),yeb(0)),(xsb(1),ysb(1))と(xeb(1),yeb(1)),…,(xsb(bottomedgecnt),ysb(bottomedgecnt))と(xeb(bottomedgecnt),yeb(bottomedgecnt))がbottomedgecnt個だけ検出される。   The upper edge valid part is (xst (0), yst (0)) and (xet (0), yet (0)), (xst (1), yst (1)) and (xet (1), yet (1)),..., (Xst (topedgecnt), ys (topedgecnt)) and (xet (topedgecnt), yett (topedgecnt)) are detected only by topedgecnt. The lower edge valid part is (xsb (0), ysb (0)) and (xeb (0), yeb (0)), (xsb (1), ysb (1)) and (xeb (1), yeb (1)),..., (Xsb (bottomedgecnt), ysb (bottomedgecnt)) and (xeb (bottomedgecnt), yeb (bottomedgecnt)) are detected only by bottomedgecnt.

図13は、上述した左辺エッジ抽出処理を、図8(B)の画像に適用した場合を説明する図である。   FIG. 13 is a diagram illustrating a case where the above-described left side edge extraction processing is applied to the image of FIG.

図示するように、原稿の左辺のはみ出し部分を左側からサーチとすると、場合によっては1つ目のエッジ有効部が検出されうる。また、左辺の撮像範囲内のところでは、左辺そのものを示すエッジ有効部(2つ目)が検出される。   As shown in the figure, if the left-hand protruding portion of the document is searched from the left side, the first edge effective portion may be detected in some cases. Further, within the imaging range on the left side, an edge effective portion (second) indicating the left side itself is detected.

図14は、エッジ有効部検出処理を説明するフローチャートである。図15は、このエッジ有効部検出処理にて使用する判定条件を示す図表である。   FIG. 14 is a flowchart illustrating the edge valid part detection processing. FIG. 15 is a table showing the determination conditions used in the edge effective portion detection processing.

エッジ有効部検出部124は、左辺エッジ有効部の仮検出(S310L),右辺エッジ有効部の仮検出(S310R),上辺エッジ有効部の仮検出(S310T),下辺エッジ有効部の仮検出(S310B)を行ない,その後、lefthamidashi,righthamidashi,tophamidashi,bottomhamidashiの値によりエッジ有効部検出をするかどうかの判定を行なう(S322)。条件は、図15に記載した通りであり、左辺と右辺、または上辺と下辺が同時にはみ出した場合はエラー処理として非検査設定処理を行なわずに終了する(S322−No,S334)。   The valid edge detecting unit 124 temporarily detects the valid left edge (S310L), temporarily detects the valid right edge (S310R), temporarily detects the valid upper edge (S310T), and temporarily detects the valid lower edge (S310B). ) Is performed, and then it is determined whether or not to detect an effective edge portion based on the values of lefthamidashi, righthamidashi, tophamidashi, and bottomhamidashi (S322). The conditions are as described in FIG. 15. If the left side and the right side or the upper side and the lower side run off simultaneously, the process ends without performing the non-inspection setting process as the error process (S322-No, S334).

条件を満たした場合(S322−Yes,S332)、エッジ有効部検出部124は、抽出したエッジ有効部の個数別に処理を、左辺→右辺→上辺→下辺の順に行なう(S332〜S364)。具体的には、左辺有効エッジ部検出(S310L)にて検出された左辺エッジ個数フラグleftfukusuが“0”の場合は、そのまま右辺のエッジ有効部数別の処理に向かう(S332L−No)。また、leftfukusuが“1”の場合は、左辺エッジ有効部検出処理(S334)を行なう(S332−Yes)。   When the condition is satisfied (S322-Yes, S332), the edge valid part detection unit 124 performs processing for each of the extracted number of edge valid parts in the order of left side → right side → upper side → lower side (S332 to S364). Specifically, when the left side edge number flag “leftfukusu” detected in the left side effective edge portion detection (S310L) is “0”, the process directly proceeds to the processing of the right side edge effective part number (S332L-No). If leftfukusu is “1”, a left edge valid part detection process (S334) is performed (S332-Yes).

同様に、右辺有効エッジ部検出(S310R)にて検出された右辺エッジ個数フラグrightfukusuが“0”の場合は、そのまま上辺のエッジ有効部数別の処理に向かう(S342−No)。また、rightfukusuが“1”の場合は、右辺エッジ有効部検出処理(S344)を行なう(S342−Yes)。同様に、上辺有効エッジ部検出(S310T)にて検出された上辺エッジ個数フラグtopfukusuが“0”の場合は、そのまま下辺のエッジ有効部数別の処理に向かう(S352−No)。また、topfukusuが“1”の場合は、上辺エッジ有効部検出処理(S354)を行なう(S352−Yes)。同様に、下辺有効エッジ部検出(S310B)にて検出された下辺エッジ個数フラグbottomfukusuが“0”の場合は、エッジ有効部検出処理を終了する(S362−No)。また、bottomfukusuが“1”の場合は、下辺エッジ有効部検出処理(S364)を行なう(S362−Yes)。   Similarly, when the right side edge number flag rightfukusu detected in the right side effective edge portion detection (S310R) is “0”, the process directly proceeds to the processing of the number of upper edge effective parts (S342-No). If rightfukusu is “1”, the right side edge valid part detection processing (S344) is performed (S342-Yes). Similarly, when the upper side edge number flag topfukusu detected in the upper side valid edge portion detection (S310T) is “0”, the process directly proceeds to the processing of the lower side effective edge number (S352-No). If topfukusu is “1”, upper edge valid part detection processing (S354) is performed (S352-Yes). Similarly, when the lower side edge number flag bottomfukusu detected in the lower side valid edge portion detection (S310B) is “0”, the edge valid portion detection processing ends (S362-No). If bottomfukusu is “1”, the lower edge valid part detection process (S364) is performed (S362-Yes).

図16は、第1例の非検査領域特定処理における左辺エッジ有効部仮検出処理(図11のS310L)の詳細例を示すフローチャートである。   FIG. 16 is a flowchart illustrating a detailed example of the left side edge valid part temporary detection processing (S310L in FIG. 11) in the first example non-inspection area specification processing.

leftedgecntが0個の場合、非検査処理を行なわずにエラー処理を行なって終了する(S3102−Yes)。次に、検出された左辺エッジ有効部数leftedgecntが1個の場合、仮の左辺エッジ有効部として設定する。このとき、(xsl(0),ysl(0))を(xedgesl,yedgesl)に、(xel(0),yel(0))を(xedgeel,yedgeel)に設定して(S3112−Yes)、(xedgesl,yedgesl)と(xedgeel,yedgeel)間の距離dleftを算出する(S3138)。deleftがv1とv2間の値であれば(S3152−Yes)、lefthamidashiを“0”に、leftfukusuを“0”に設定し(S3154)、v1とv2間の値でない場合(S3152−No)、lefthamidashiを“1”に、leftfukusuを“0”に設定する(S3156)。ここで、v1とv2の値は、出力される原稿を所定の位置で撮影したときの横の長さに誤差を加味した値を設定する。   If the number of leftedgecnt is 0, error processing is performed without performing the non-inspection processing, and the processing ends (S3102-Yes). Next, when the detected number of left edge valid parts leftedgecnt is one, it is set as a temporary left edge valid part. At this time, (xsl (0), ysl (0)) is set to (xedgesl, yedgesl) and (xel (0), yel (0)) is set to (xedgeel, yedgeel) (S3112-Yes), (S3112-Yes) The distance dleft between (xedgesl, yedgesl) and (xedgeel, yedgeel) is calculated (S3138). If the value of “delett” is between v1 and v2 (S3152-Yes), lefthamidashi is set to “0” and leftfukusu is set to “0” (S3154). If the value is not a value between v1 and v2 (S3152-No), Lefthamidashi is set to "1" and leftfukusu is set to "0" (S3156). Here, the values of v1 and v2 are set to values in which an error is added to the horizontal length when the output document is photographed at a predetermined position.

検出された左辺エッジ有効部数leftedgecntが0個でも1個でもない場合(2個以上の場合)、左辺エッジ有効部選択処理を行なう(S3112−Yes,S3114)。次に、leftedgecnt’が“0”の場合、非検査処理を行なわずにエラー処理を行なって終了する(S3122−Yes)。次に、leftedgecnt’が“1”の場合、(xsl’(0),ysl’(0))を(xedgesl,yedgesl)に、(xel’(0),yel’(0))を(xedgeel,yedgeel)に設定して(S3132−Yes)、(xedgesl,yedgesl)と(xedgeel,yedgeel)間の距離dleftを算出する(S3138)。deleftがv1とv2間の値であれば(S3152−Yes)、lefthamidashiを“0”に、leftfukusuを“0”に設定し(S3154)、v1とv2間の値でない場合(S3152−No)、lefthamidashiを“1”に、leftfukusuを“0”に設定する(S3156)。   If the detected number of left edge valid parts leftedgecnt is neither zero nor one (two or more), left edge valid part selection processing is performed (S3112-Yes, S3114). Next, when leftedgecnt 'is "0", error processing is performed without performing the non-inspection processing, and the processing ends (S3122-Yes). Next, when leftedgecnt ′ is “1”, (xsl ′ (0), ysl ′ (0)) is set to (xedgesl, yedgesl), and (xel ′ (0), yel ′ (0)) is set to (xedgeel, yedgeel) (S3132-Yes), and the distance dleft between (xedgesl, yedgesl) and (xedgeel, yedgeel) is calculated (S3138). If the value of “delett” is between v1 and v2 (S3152-Yes), lefthamidashi is set to “0” and leftfukusu is set to “0” (S3154). If the value is not a value between v1 and v2 (S3152-No), Lefthamidashi is set to "1" and leftfukusu is set to "0" (S3156).

leftedgecnt’が0個でも1個でもない場合、iを0に設定して、インクリメントしながら(xsl’(i),ysl’(i))を(xedgesl,yedgesl)に、(xel’(i),yel’(i))を(xedgeel,yedgeel)に設定し(S3144)、lefthamidashiを“1”に、leftfukusuを“1”に設定した後に左辺エッジ部仮検出処理を終了する。   If leftedgecnt 'is neither zero nor one, i is set to 0, and (xsl' (i), ysl '(i)) is changed to (xedgesl, yedgesl) and (xel' (i) while incrementing. , Yel '(i)) is set to (xedgeel, yedgeel) (S3144), lefthamidashi is set to “1”, leftfukusu is set to “1”, and then the left-side edge portion temporary detection processing is ended.

図17に、左辺エッジ有効部検出処理の詳細を説明するフローチャートを示す。最初に、iを0に、leftedgecnt’を0に設定する(S3200)。iをインクリメントしながら、leftedgecnt’より小さい場合は(S3202)、(xsl(i),ysl(i))と((xel(i),yel(i))間の傾きaleft−st−endを算出する(S3204)。aleft−st−endの絶対値が設定値aleft−preより大きい場合は(3212−Yes)、(xsl(i),ysl(i))を(xsl’(leftedgecnt),ysl’(leftedgecnt))に、(xel(i),yel(i))に設定しを(xel’(leftedgecnt),yel’(leftedgecnt))に設定する(3214)。左辺エッジ有効部選択処理により、左辺の傾きが設定値aleft−preより小さいもの、すなわち、用紙が極端に回転した場合を一つの辺として検出しないような処理を行なっていることになる。   FIG. 17 is a flowchart illustrating details of the left side edge valid part detection processing. First, i is set to 0 and leftedgecnt 'is set to 0 (S3200). While incrementing i, if it is smaller than leftedgecnt '(S3202), the slope aleft-st-end between (xsl (i), ysl (i)) and ((xel (i), yel (i)) is calculated. (S3204) If the absolute value of the left-st-end is larger than the set value left-pre (3212-Yes), (xsl (i), ysl (i)) is changed to (xsl '(leftedgecnt), ysl'). In (leftedgecnt)), set to (xel (i), yel (i)) and set to (xel '(leftedgecnt), yel' (leftedgecnt)) (3214). Is smaller than the set value aleft-pre, that is, processing is performed so that the case where the paper is extremely rotated is not detected as one side.

同様に、右辺のエッジ有効部の仮検出処理(S310R)、上辺のエッジ有効部の仮検出処理(S310T)、下辺のエッジ有効部の仮検出処理(S310B)を行なうことで、各辺に対するエッジ有効部処理を終了させる。   Similarly, the provisional detection processing of the right side edge valid part (S310R), the provisional detection processing of the upper side edge valid part (S310T), and the provisional detection processing of the lower side edge valid part (S310B) are performed, whereby the edge for each side is obtained. The valid part processing ends.

エッジ有効部検出部124は、先ず、右辺の有効エッジ部を暫定的に設定する。この暫定的な右辺の有効エッジ部としては、たとえば、ステップS210R(具体的には、S220〜S278の右辺対応の処理)にて右辺エッジ有効部数が1個検出され、かつ右辺のエッジ有効部が正しく求められるケースで説明する。この場合、右辺エッジ有効部開始点edgers(1)を与える座標(xsr,ysr)を(xsr(i),ysr(i))、右辺エッジ有効部終了点edgere(1)を与える座標(xer,yer)を(xer(i),yer(i))とする。このとき、右辺の全体が撮像範囲内であれば、2つの座標(xsr(i),ysr(i)),(xer(i),yer(i))の距離が原稿の右辺の長さにほぼ相当することとなる。   First, the valid edge detection unit 124 tentatively sets a valid edge on the right side. As the provisional right side effective edge portion, for example, one right side edge valid portion is detected in step S210R (specifically, the process corresponding to the right side in S220 to S278), and the right side edge valid portion is We will explain in the case where it is required correctly. In this case, the coordinates (xsr, ysr) giving the right side edge valid part start point edgers (1) are (xsr (i), ysr (i)), and the coordinates (xer, xer, giving the right side edge valid part end point edgere (1)). yer) is (xer (i), yer (i)). At this time, if the entire right side is within the imaging range, the distance between the two coordinates (xsr (i), ysr (i)) and (xer (i), yer (i)) is the length of the right side of the document. It will be almost equivalent.

図18は、左辺エッジ有効部検出処理の詳細を説明するフローチャートである。エッジ有効部検出部124は、左辺エッジ有効部の個数leftedgecountが“1”(左辺エッジ有効部は2個以上)であれば、正式なエッジ有効部を選択するための処理を行なう。右辺エッジのrightfukusuは0(右辺エッジ有効部は1個)であれば、右辺エッジ座標(xedgesr,yedgesr)と(xedgeer,yedgeer)間の傾きarを算出する(S3302−Yes,S3304)。   FIG. 18 is a flowchart illustrating details of the left side edge valid part detection processing. If the number of left edge valid portions leftedgecount is “1” (the number of left edge valid portions is two or more), the edge valid portion detecting section 124 performs processing for selecting a formal edge valid portion. If rightfukusu of the right side edge is 0 (the right side edge effective part is one), the inclination ar between the right side edge coordinates (xedgesr, yedgesr) and (xedgeer, yedgeer) is calculated (S3302-Yes, S3304).

Figure 2004310726
Figure 2004310726

右辺エッジのrightfukusuは0(右辺エッジ有効部は1個)でなければ、エラーとして非検査部設定処理を行なわずに処理を終了する(S3302−No,S3318)。   If rightfukusu of the right side edge is not 0 (the right side edge valid portion is one), the process ends without performing the non-inspection portion setting process as an error (S3302-No, S3318).

次に、右辺エッジ座標(xedgesr,yedgesr)と(xedgeer,yedgeer)間の傾きarを算出する(S3302−Yes,S3304)。その後、エッジ有効部検出部124は、右辺の有効エッジ部の直線式のy軸との切片brを式(14)のようにして算出する算出する(S3306)。   Next, the inclination ar between the right side edge coordinates (xedgesr, yedgesr) and (xedgeer, yedgeer) is calculated (S3302-Yes, S3304). After that, the edge valid part detecting unit 124 calculates the intercept br of the right side effective edge part with the y-axis of the linear equation as in Expression (14) (S3306).

Figure 2004310726
Figure 2004310726

次に、エッジ有効部検出部124は、右辺の長さdrと基準画像のサイズ比(原稿サイズの縦横比に相当)とに基づいて、上辺の長さdt(あるいは下辺の長さdb)を推算する(S3307,S3308)。具体的には先ず、右辺のエッジ有効部の距離drを式(15)のようにして算出し(S3307)、その後、drと基準画像の縦画素と横画素の比率により原稿の横長さを式(16)のようにして算出する(S3308)。   Next, the edge valid part detecting unit 124 calculates the length dt of the upper side (or the length db of the lower side) based on the length dr of the right side and the size ratio of the reference image (corresponding to the aspect ratio of the document size). It is estimated (S3307, S3308). Specifically, first, the distance dr of the right side edge effective portion is calculated as in equation (15) (S3307), and then the horizontal length of the document is calculated by dr and the ratio of the vertical pixels to the horizontal pixels of the reference image. It is calculated as in (16) (S3308).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

次に、ステップS3316で算出した距離の判定処理を行なうためのdlr1とdlr2をそれぞれ式(17)、式(18)のようにして算出する(S3309)。ここで設定するK1とK2は原稿とカメラの位置関係により決定する。   Next, dlr1 and dlr2 for performing the process of determining the distance calculated in step S3316 are calculated as in equations (17) and (18), respectively (S3309). K1 and K2 set here are determined based on the positional relationship between the original and the camera.

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

次に、エッジ有効部検出部124は、オペレータ“n”を“0”に初期セットする(S3310)。そして、オペレータ“n”がオペレータ“leftedgecnt”以下であるか否かを判定する(S3312)。最初は当然に“以下”であり(S3312−Yes)、エッジ有効部検出部124は、オペレータ“n”のときの左辺エッジ有効部の開始点(xedsl(n),yedsl(n))と終点(xedel(n),yedel(n))間の中点(xml(n),yml(n))を式(19)のようにして算出する(S3314)。また、左辺エッジ有効部が検出されずにオペレータ“n”がオペレータ“leftedgecnt”以上になった場合(S3312−No)、エラーとして非検査部設定処理を行なわずに処理を終了する(S3312−No,S3318)。次に、(xml(n),yml(n))と右辺の有効エッジ部間の距離dl−rを式(20)のようにして算出する(S3312−Yes,S3314〜S3316)。   Next, the edge valid part detecting unit 124 initially sets the operator “n” to “0” (S3310). Then, it is determined whether the operator “n” is equal to or less than the operator “leftedgecnt” (S3312). Initially, it is naturally “less than or equal to” (S3312-Yes), and the edge valid part detection unit 124 sets the start point (xedsl (n), yedsl (n)) and end point of the left edge valid part when the operator is “n”. The midpoint (xml (n), yml (n)) between (xedel (n), yedel (n)) is calculated as in equation (19) (S3314). When the operator “n” is equal to or more than the operator “leftedgecnt” without detecting the left edge valid portion (S3312-No), the process ends without performing the non-inspection portion setting process as an error (S3312-No). , S3318). Next, the distance dl-r between (xml (n), ymm (n)) and the effective edge portion on the right side is calculated as in Expression (20) (S3312-Yes, S3314 to S3316).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

次に、エッジ有効部検出部124は、式(20)で求めた両辺間の距離dl−rがS3309で求めたdlr1とdlr2間であるか否かを判定する(S3322)。両辺間の距離dl−rdlr1とdlr2間の場合には(S3322−Yes)、エッジ有効部検出部124は、そのときの(xedgesl(n), yedgesl(n))と(xedgeel(n),yedgeel(n))間を正式な左辺エッジ有効部(xedgesl,yedgesl)と(xedgeel,yedgeel)として処理を終了する(S3324)。   Next, the edge valid part detecting unit 124 determines whether or not the distance dl-r between both sides obtained by the equation (20) is between dlr1 and dlr2 obtained in S3309 (S3322). In the case where the distance between both sides is dl-rdlr1 and dlr2 (S3322-Yes), the edge valid part detecting unit 124 sets (xedgesl (n), yedgesl (n)) and (xedgeel (n), yedgeel) at that time. The process ends with (n)) as the formal left edge valid part (xedgesl, yedgesl) and (xedgeel, yedgeel) (S3324).

両辺間の距離dl−rがdlr1とdlr2間でない場合には(S3322−No)、エッジ有効部検出部124は、オペレータ“n”に“1”を加算し、S3012に戻る。   If the distance dl-r between both sides is not between dlr1 and dlr2 (S3322-No), the edge valid part detecting unit 124 adds "1" to the operator "n" and returns to S3012.

左辺の処理と同様に、右辺エッジ有効部開始点を与える座標を(xedgesr,yedgesr)、右辺エッジ有効部終了点を与える座標を(xedgeer,yedgeer)とする。上辺エッジ有効部開始点)を与える座標を(xedgest,yedgest)、上辺エッジ有効部終了点を与える座標を(xedgeet,yedgeet)とする。下辺エッジ有効部開始点を与える座標を(xedgesb,yedgesb)、下辺エッジ有効部終了点を与える座標を(xedgeeb,yedgeeb)とする。   Similarly to the processing on the left side, the coordinates giving the start point of the right side edge effective portion are (xedgesr, yedgesr), and the coordinates giving the end point of the right side edge effective portion are (xedgeer, yedgeer). The coordinates giving the upper edge valid part start point) are (xedgest, yedgest), and the coordinates giving the upper edge valid part end point are (xedgeet, yedgeet). The coordinates giving the starting point of the lower edge valid part are (xedgesb, yedgesb), and the coordinates giving the ending point of the lower edge valid part are (xedgeeb, yedgeeb).

これにより、図9(F)で示された部分をエッジ有効部として特定することができる。   Thus, the portion shown in FIG. 9F can be specified as an edge effective portion.

右辺エッジ有効部選択処理S344、上辺エッジ有効部選択処理S354、下辺有効エッジ部選択処理検出処理S364も、図16および図17のフローチャートの手順に準じればよい。   The right side edge valid part selection processing S344, the upper side edge valid part selection processing S354, and the lower side valid edge part selection processing detection processing S364 may be in accordance with the procedures in the flowcharts of FIGS.

図20は、第1実施形態のエッジ有効部直線式算出部126によるエッジ有効部直線式算出処理(図10のS400)の詳細例を示すフローチャートである。また、図21は原稿頂点設定処理部132による原稿頂点設定処理(図10のS420)の詳細例を示すフローチャートである。   FIG. 20 is a flowchart illustrating a detailed example of the edge-effective-portion straight-line calculating process (S400 in FIG. 10) by the edge-effective-portion straight-line calculating unit 126 according to the first embodiment. FIG. 21 is a flowchart showing a detailed example of the document vertex setting process (S420 in FIG. 10) by the document vertex setting processing unit 132.

エッジ有効部直線式算出部126は、先ず、上辺エッジ有効部検出処理(図11のS210T)にてエッジ有効部を検知できている場合、上辺エッジ有効部の( xedgest,yedgest)と( xedgeet,yedgeet)間の直線式ytを式(21T)により算出する(S402T)。同様に、下辺エッジ有効部検出処理(図11のS210B)にてエッジ有効部を検知できている場合、下辺エッジ有効部の( xedgesb,yedgesb)と( xedgeeb,yedgeeb)間の直線式ybを式(21B)により算出する(S402B)。   First, when the effective edge detection section (S210T in FIG. 11) detects the effective edge portion, the effective edge portion linear expression calculating section 126 first determines (xedgest, yedgest) and (xedgeet, yt) is calculated by equation (21T) (S402T). Similarly, when an effective edge portion has been detected in the lower edge effective portion detection process (S210B in FIG. 11), a linear expression yb between (xedgesb, yedgesb) and (xedgeeb, yedgeeb) of the lower edge effective portion is expressed by the following equation. It is calculated by (21B) (S402B).

また、左辺エッジ有効部検出処理(図11のS210L)にてエッジ有効部を検知できている場合、エッジ有効部直線式算出部126は、左辺エッジ有効部の( xedgesl,yedgesl)と( xedgeel,yedgeel)間の直線式ylを式(21L)により算出する(S402L)。さらに、右辺エッジ有効部検出処理(図11のS210R)にてエッジ有効部を検知できている場合、右辺エッジ有効部の( xedgesr,yedgesr)と( xedgeer,yedgeer)間の直線式yrを式(21R)により算出する(S402R)。   In addition, when the effective edge portion has been detected in the left edge effective portion detection process (S210L in FIG. 11), the edge effective portion linear expression calculating unit 126 determines (xedgesl, yedgesl) and (xedgeel, yedgeel) is calculated by the equation (21L) (S402L). Further, when an edge valid part has been detected in the right side edge valid part detection processing (S210R in FIG. 11), a straight line equation yr between (xedgesr, yedgesr) and (xedgeer, yedgeer) of the right side edge valid part is expressed by the equation ( 21R) (S402R).

Figure 2004310726
Figure 2004310726

次に、原稿頂点設定処理部132は、上辺の直線ytと左辺の直線ylとの交点座標を原稿右上の頂点(xtl,ytl )に設定する(S420)。次に、原稿頂点設定処理部132は、下辺の直線ybと左辺の直線ylとの交点座標を原稿右上の頂点(xbl,ybl )に設定する(S430)。次に、原稿頂点設定処理部132は、上辺の直線ytと左辺の直線yrとの交点座標を原稿右上の頂点(xtr,ytr )に設定する(S440)。次に、原稿頂点設定処理部132は、上辺の直線ybと左辺の直線yrとの交点座標を原稿右上の頂点(xbr,ybr )に設定して(S450)、エッジ有効部直線式算出処理を終了する。   Next, the document vertex setting processing unit 132 sets the coordinates of the intersection of the straight line yt on the upper side and the straight line yl on the left side as the upper right vertex (xtl, ytl) of the document (S420). Next, the document vertex setting processing unit 132 sets the coordinates of the intersection of the straight line yb on the lower side and the straight line yl on the left side to the upper right vertex (xbl, ybl) of the document (S430). Next, the document vertex setting processing unit 132 sets the coordinates of the intersection of the straight line yt on the upper side and the straight line yr on the left side as the upper right vertex (xtr, ytr) of the document (S440). Next, the document vertex setting processing unit 132 sets the coordinates of the intersection of the straight line yb on the upper side and the straight line yr on the left side to the vertex (xbr, ybr) on the upper right of the document (S450), and executes the edge effective part linear equation calculation process. finish.

図22は、第1実施形態のはみ出し場所判定処理部134によるはみ出し場所判定処理(図10のS500)の詳細例を示すフローチャートである。図*35は、このはみ出し場所判定処理における一事例を示す図である。   FIG. 22 is a flowchart illustrating a detailed example of the protruding place determination processing (S500 in FIG. 10) by the protruding place determination processing unit 134 according to the first embodiment. FIG. 35 shows an example of the protruding place determination processing.

はみ出し場所判定処理部134は、先ず、原稿左上の頂点(xtl ,ytl )が左側にはみ出しているかどうかを判定する(S502)。図7(C)より、透視変換後の左側境界の直線は、式(22)で表すことができる。したがって、左上頂点(xtl ,ytl )が左側境界の直線より左側に位置するかどうかは、式(23)に示すように、式(22)に(xtl ,ytl )を代入した値が“0”より大きいか小さいかで判定することができる。もし、(xtl ,ytl )が式(22)で示す境界線よりも左側に位置する場合は、式(23)の条件は成立する。   The protruding place determination processing unit 134 first determines whether the top left vertex (xtl, ytl) of the document protrudes to the left (S502). From FIG. 7C, the straight line on the left boundary after the perspective transformation can be expressed by Expression (22). Therefore, whether the upper left vertex (xtl, ytl) is located to the left of the straight line on the left boundary is determined by substituting (xtl, ytl) into equation (22) as shown in equation (23). It can be determined whether it is larger or smaller. If (xtl, ytl) is located on the left side of the boundary shown in Expression (22), the condition of Expression (23) is satisfied.

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

同様に、はみ出し場所判定処理部134は、原稿左上の頂点(xtl ,ytl )が上側にはみ出しているかどうかを判定する(S504,S510)。図7(C)より、透視変換後の上側境界の直線は、式(24)で表すことができる。したがって、左上頂点(xtl ,ytl )が上側境界の直線より上側に位置するかどうかは、式(25)に示すように、式(24)に(xtl ,ytl )を代入した値が“0”より大きいか小さいかで判定することができる。もし、(xtl ,ytl )が式(24)で示す境界線よりも上側に位置する場合は、式(25)の条件は成立する。   Similarly, the protruding place determination processing unit 134 determines whether the top left vertex (xtl, ytl) of the document protrudes upward (S504, S510). From FIG. 7C, the straight line of the upper boundary after the perspective transformation can be expressed by Expression (24). Therefore, whether the upper left vertex (xtl, ytl) is positioned above the straight line of the upper boundary is determined by substituting (xtl, ytl) into equation (24), as shown in equation (25). It can be determined whether it is larger or smaller. If (xtl, ytl) is located above the boundary indicated by the equation (24), the condition of the equation (25) is satisfied.

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

式(23)が成立して、かつ式(25)も成立する場合(S502−Yes,S504−Yes)、はみ出し場所判定処理部134は、左上頂点(xtl ,ytl )は図*35(A)に示すように式(22)で示す境界線の左側でかつ式(22)で示す境界線の上側に位置することとなる。この場合は、原稿の何れかの辺に対しても長さが判明しない、つまり撮像範囲内に辺の全体が収まるものは存在しないため、はみ出し場所判定処理部134は、エラー処理を行なう(S506)。   If the expression (23) is satisfied and the expression (25) is also satisfied (S502-Yes, S504-Yes), the protruding place determination processing unit 134 sets the upper left vertex (xtl, ytl) as shown in FIG. As shown in (2), it is located on the left side of the boundary shown by the equation (22) and above the boundary shown by the equation (22). In this case, since the length of any side of the document is not known, that is, there is no one that fits the entire side within the imaging range, the protruding place determination processing unit 134 performs an error process (S506). ).

また、式(23)が成立し式(25)が不成立の場合(S502−Yes,S504−No)、左上頂点(xtl ,ytl )は図*35(B)に示すように式(22)で示す境界線の左側でかつ式(24)で示す境界線の下側に位置することとなる。この場合、はみ出し場所判定処理部134は、原稿は左側にはみ出していると判定し、flagtlを“1”に設定する(S508)。   When equation (23) is satisfied and equation (25) is not satisfied (S502-Yes, S504-No), the upper left vertex (xtl, ytl) is calculated using equation (22) as shown in FIG. It is located on the left side of the boundary line shown and below the boundary line shown by the equation (24). In this case, the protruding place determination processing unit 134 determines that the document protrudes to the left side, and sets flagtl to “1” (S508).

式(23)が不成立の場合で式(25)が成立する場合(S502−No,S510−Yes)、左上頂点(xtl ,ytl )は図*35(C)に示すように式(22)で示す境界線の右側でかつ式(24)で示す境界線の上側に位置することとなる。この場合、はみ出し場所判定処理部134は、原稿は上側にはみ出していると判定し、flagtlを“2”に設定する(S512)。また、式(23)が不成立の場合で式(25)も不成立の場合(S502−No,S510−No)、左上頂点(xtl ,ytl )は式(22)で示す境界線の左側でかつ式(24)で示す境界線の下側に位置することとなる。この場合、はみ出し場所判定処理部134は、(xtl ,ytl )は撮像画像内にあるものと判定し、flagtlを“0”に設定する(S514)。   When Expression (23) is not satisfied and Expression (25) is satisfied (S502-No, S510-Yes), the upper left vertex (xtl, ytl) is calculated by Expression (22) as shown in FIG. It is located on the right side of the boundary line shown and above the boundary line shown by the equation (24). In this case, the protruding place determination processing unit 134 determines that the document protrudes upward, and sets flagtl to “2” (S512). In addition, when Expression (23) is not satisfied and Expression (25) is also not satisfied (S502-No, S510-No), the upper left vertex (xtl, ytl) is on the left side of the boundary indicated by Expression (22) and is not equal to Expression (22). It will be located below the boundary shown by (24). In this case, the protruding place determination processing unit 134 determines that (xtl, ytl) exists in the captured image, and sets flagtl to “0” (S514).

はみ出し場所判定処理部134は、原稿の他の頂点に対してもはみ出し場所判定処理を行なう。左下の頂点(xbl ,ybl )に対するはみ出し場所判定処理はS522〜S534、右上の頂点(xtr ,ytr )に対するはみ出し場所判定処理はS542〜S554、右下の頂点(xbr ,ybr )に対するはみ出し場所判定処理はS562〜S564となる。   The protruding place determination processing unit 134 performs protruding place determination processing on other vertices of the document. The protruding place judging processing for the lower left vertex (xbl, ybl) is performed in steps S522 to S534, the protruding place judging processing for the upper right vertex (xtr, ytr) is performed in steps S542 to S554, and the protruding place determining processing for the lower right vertex (xbr, ybr) is performed. Are S562 to S564.

図示するように、判定のために使用する境界式が異なるものの、基本的には、左上頂点についての処理と同様である。なお、透視変換後の右側境界の直線は式(26)で表すことができ、下側境界の直線は式(27)で表すことができる。   As shown in the figure, although the boundary formula used for the determination is different, it is basically the same as the process for the upper left vertex. Note that the straight line on the right boundary after the perspective transformation can be expressed by Expression (26), and the straight line on the lower boundary can be expressed by Expression (27).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

図8に示したように、原稿の左下が撮像範囲からはみ出している場合、その撮像画像の透視変換後の画像についてはみ出し場所判定処理を行なうことにより、図*35(D)に示すように、原稿左下の頂点(xbl ,ybl )が左側にはみ出していると判定される。   As shown in FIG. 8, when the lower left of the document protrudes from the imaging range, by performing a protruding place determination process on the image after the perspective transformation of the captured image, as shown in FIG. It is determined that the vertex (xbl, ybl) at the lower left of the document protrudes to the left.

図23は、非検査領域設定部138による非検査領域設定処理(図10のS600)の詳細例を示すフローチャートである。   FIG. 23 is a flowchart illustrating a detailed example of the non-inspection area setting process (S600 in FIG. 10) by the non-inspection area setting unit 138.

非検査領域設定部138は、先ず、左上の頂点(xtl ,ytl )のはみだし場所を示すフラグflagtlが“0”であるか否かを判定する(S602)。flagtlが“0”でない場合(S602−Yes)、非検査領域設定部138は、左上非検査部設定処理を行なう(S604)。この処理により、左上はみ出し部の境界座標として、(xtl1,ytl1),(xtl2,ytl2)が抽出される。   First, the non-inspection area setting unit 138 determines whether or not the flag flagtl indicating the protruding place of the upper left vertex (xtl, ytl) is “0” (S602). When the flagtl is not “0” (S602-Yes), the non-inspection area setting unit 138 performs an upper left non-inspection unit setting process (S604). By this processing, (xtl1, ytl1) and (xtl2, ytl2) are extracted as the boundary coordinates of the upper left protruding portion.

この後、非検査領域設定部138は、左下の頂点(xbl ,ybl )に対する処理に進む。非検査領域設定部138は、左下の頂点(xbl ,ybl )のはみだし場所を示すフラグflagblが“0”であるか否かを判定する(S606)。flagblが“0”でない場合(S606−Yes)、非検査領域設定部138は、左上はみ出し部の境界座標算出を行なう(S608)。この処理により、左下はみ出し部の境界座標として、(xbl1,ybl1),(xbl2,ybl2)が抽出される。   Thereafter, the non-inspection area setting unit 138 proceeds to the processing for the lower left vertex (xbl, ybl). The non-inspection area setting unit 138 determines whether the flag flagbl indicating the protruding place of the lower left vertex (xbl, ybl) is “0” (S606). If the flagbl is not “0” (S606-Yes), the non-inspection area setting unit 138 calculates the boundary coordinates of the upper left protruding part (S608). By this processing, (xbl1, ybl1), (xbl2, ybl2) are extracted as the boundary coordinates of the lower left protruding portion.

この後、非検査領域設定部138は、右上の頂点(xtr ,ytr )に対する処理に進む。非検査領域設定部138は、右上の頂点(xtr ,ytr )のはみだし場所を示すフラグflagtrが“0”であるか否かを判定する(S612)。flagtrが“0”でない場合(S612−Yes)、非検査領域設定部138は、右上はみ出し部の境界座標算出を行なう(S614)。この処理により、右上はみ出し部の境界座標として、(xtr1,ytr1),(xtr2,ytr2)が抽出される。   Thereafter, the non-inspection area setting unit 138 proceeds to the process for the upper right vertex (xtr, ytr). The non-inspection area setting unit 138 determines whether the flag flagtr indicating the protruding position of the upper right vertex (xtr, ytr) is “0” (S612). If the flagtr is not “0” (S612-Yes), the non-inspection area setting unit 138 calculates the boundary coordinates of the upper right protruding part (S614). By this processing, (xtr1, ytr1) and (xtr2, ytr2) are extracted as the boundary coordinates of the upper right protruding portion.

この後、非検査領域設定部138は、右下の頂点(xbr ,ybr )に対する処理に進む。非検査領域設定部138は、右下の頂点(xbr ,ybr )のはみだし場所を示すフラグflagbrが“0”であるか否かを判定する(S616)。flagbrが“0”でない場合(S616−Yes)、非検査領域設定部138は、右下はみ出し部の境界座標算出を行なう(S618)。この処理により、右下はみ出し部の境界座標として、(xbr1,ybr1),(xbr2,ybr2)が抽出される。この後非検査領域設定部138は、非検査部設定処理を開始する。   Thereafter, the non-inspection area setting unit 138 proceeds to the processing for the lower right vertex (xbr, ybr). The non-inspection area setting unit 138 determines whether the flag flagbr indicating the protruding place of the lower right vertex (xbr, ybr) is “0” (S616). If the flagbr is not “0” (S616-Yes), the non-inspection area setting unit 138 calculates the boundary coordinates of the lower right protruding part (S618). By this processing, (xbr1, ybr1) and (xbr2, ybr2) are extracted as the boundary coordinates of the lower right protruding portion. Thereafter, the non-inspection area setting unit 138 starts a non-inspection unit setting process.

図24と図25は、左下非検査部設定処理の具体例を示す。ここで、図24は左下非検査部設定処理(S608)のフローチャートである。また、図25(A)は境界座標位置を示す図であり、図25(B)は、図24に示した左下についての処理ステップに使用する式や交点座標を、左上、右上、右下に適用させる場合の対応関係を示す図表である。   24 and 25 show a specific example of the lower left non-inspection unit setting process. Here, FIG. 24 is a flowchart of the lower left non-inspection section setting process (S608). FIG. 25 (A) is a diagram showing the boundary coordinate position, and FIG. 25 (B) shows the equations and intersection coordinates used in the processing step for the lower left shown in FIG. 24 in the upper left, upper right and lower right corners. It is a chart which shows the correspondence at the time of applying.

非検査領域設定部138は、左下はみ出し部の境界座標算出を特定する。具体的には、左下の頂点(xbl ,ybl )のはみだし場所を示すフラグflagblが“1”であるか“2”であるかを判定する(S620)。flagblが“1”である場合(S620−Yes)、左下の頂点は撮像画像の左にはみ出しているため、ylとat1×x+bt1×y+ct1=0の交点(xbl1,xbl1)を算出する(S624)。その後、ybとat1×x+bt1×y+ct1=0の交点(xbl2,xbl2)を算出して(S626)、左下非検査部設定処理を終了する。また、flagblが“2”である場合(S620−No)、左下の頂点は撮像画像の下にはみ出しているため、ylとy+ct4=0の交点(xbl1,xbl1)を算出する(S624)。その後、ybとy+ct4=0の交点(xbl2,xbl2)を算出して(S626)、左下非検査部設定処理を終了する。   The non-inspection area setting unit 138 specifies the calculation of the boundary coordinates of the lower left protruding part. Specifically, it is determined whether the flag flagbl indicating the protruding place of the lower left vertex (xbl, ybl) is "1" or "2" (S620). If the flagbl is "1" (S620-Yes), the intersection (xbl1, xbl1) of yl and at1.times.x + bt1.times.y + ct1 = 0 is calculated because the lower left vertex protrudes to the left of the captured image (S624). . Thereafter, the intersection (xbl2, xbl2) of yb and at1 × x + bt1 × y + ct1 = 0 is calculated (S626), and the lower left non-inspection unit setting process ends. If flagbl is “2” (S620-No), the intersection (xbl1, xbl1) of yl and y + ct4 = 0 is calculated because the lower left vertex protrudes below the captured image (S624). Thereafter, the intersection (xbl2, xbl2) of yb and y + ct4 = 0 is calculated (S626), and the lower left non-inspection unit setting process ends.

左上はみ出し部の境界座標算出処理(S604)、右上はみ出し部の境界座標算出処理(S614)、右下はみ出し部の境界座標算出処理(S618)についても処理は同様である。ただし、図24に示した左下についての処理ステップに使用する式や交点座標を、図25(B)に示すように変更する。   The same applies to the process of calculating the boundary coordinates of the upper left protruding portion (S604), the process of calculating the boundary coordinates of the upper right protruding portion (S614), and the process of calculating the boundary coordinates of the lower right protruding portion (S618). However, the equations and the intersection coordinates used in the processing step for the lower left shown in FIG. 24 are changed as shown in FIG.

非検査領域設定部138は、以上のようにして、撮像画像に対するはみ出しに関わる前処理を終わらせると、はみ出し部分の領域(非検査領域)を示す情報をデータ格納部300に格納する(図6のS144)。   When the non-inspection area setting unit 138 completes the pre-processing related to the overflow of the captured image as described above, the non-inspection area setting unit 138 stores information indicating the area of the overhang portion (non-inspection area) in the data storage unit 300 (FIG. 6). S144).

次に、基準画像処理部210の解像度変換部214は、矩形状の基準画像のサイズと検査対象である撮像画像における矩形状の原稿部分の画像のサイズとが等しくなるように、基準画像の解像度を変換する(S152)。次に、暈かし処理部216は、解像度変換された基準画像に対して暈かし処理(ガウスフィルタ処理)を施す(S154)。   Next, the resolution conversion unit 214 of the reference image processing unit 210 adjusts the resolution of the reference image so that the size of the rectangular reference image is equal to the size of the image of the rectangular document portion in the captured image to be inspected. Is converted (S152). Next, the blurring processing unit 216 performs a blurring process (Gaussian filter process) on the resolution-converted reference image (S154).

次に非検査領域削除処理部218は、非検査領域特定部130により特定された非検査領域情報をデータ格納部300から読み出し、暈かし処理部216により暈かし処理が施された基準画像における非検査領域部分のデータを無効化することで、基準画像に対して非検査領域を設定する(S156)。非検査領域設定部138は、処理済の基準画像をデータ格納部300に格納する。   Next, the non-inspection area deletion processing unit 218 reads out the non-inspection area information specified by the non-inspection area specifying unit 130 from the data storage unit 300, and performs the shading processing by the shading processing unit 216 on the reference image. The non-inspection area is set for the reference image by invalidating the data of the non-inspection area in (S156). The non-inspection area setting unit 138 stores the processed reference image in the data storage unit 300.

次に、位置合わせ処理部232は、非検査領域部分が無効化された基準画像と画像読取部100にて前処理が施された撮像画像の位置合わせ処理をする(S158)。次に、欠陥異常検出処理部234は、2つの画像の差を求め(S160)、この差分処理により得られた差分結果に基づいて、撮像画像の欠陥や異常の有無を検出する(S162)。   Next, the alignment processing unit 232 performs alignment processing between the reference image in which the non-inspection area portion is invalidated and the captured image subjected to the preprocessing by the image reading unit 100 (S158). Next, the defect abnormality detection processing unit 234 calculates the difference between the two images (S160), and detects the presence or absence of a defect or an abnormality in the captured image based on the difference result obtained by the difference processing (S162).

画像検査処理部200の解像度変換部214は、基準画像を読み出して解像度変換を施し、とぼかし処理を施した基準データと、シェーディング補正処理と逆幾何変換(逆透視変換)処理と非検査部の設定処理を施した撮像画像間で位置合わせ処理後(S122)に比較を行ない、欠陥異常検出処理(S123)を行なう。   The resolution conversion unit 214 of the image inspection processing unit 200 reads out the reference image, performs resolution conversion, performs the blurring processing on the reference data, and performs shading correction processing, inverse geometric transformation (reverse perspective transformation) processing, and non-inspection unit processing. After the alignment processing (S122) between the captured images subjected to the setting processing, the comparison is performed, and the defect abnormality detection processing (S123) is performed.

以上説明したように、第1実施形態の画像検査装置5では、チルトスキャンにより撮像画像の原稿の一部が撮像範囲からはみ出した場合に対しても(図5〜図7参照)、はみ出し部の頂点を推算して非検査部を設定することにより、はみ出し部分を検査対象から除外して基準画像と比較することができる。この結果、原稿の排紙状態に関わらず、撮像画像と基準画像との比較・検査の際の精度が向上し、より検査精度の良好な画像欠陥や画質異常の検査ができるようになる。   As described above, in the image inspection apparatus 5 of the first embodiment, even when a part of the document of the captured image is out of the imaging range due to the tilt scan (see FIGS. By estimating the vertices and setting the non-inspection part, the protruding part can be excluded from the inspection target and compared with the reference image. As a result, the accuracy of comparison / inspection between the captured image and the reference image is improved, regardless of the state of discharge of the document, and inspection for image defects and abnormal image quality with higher inspection accuracy can be performed.

たとえば、図8に示したように、原稿の左下頂点が撮像範囲からはみ出した場合に対しても、はみ出し部の頂点を推算して非検査部を設定することにより、はみ出し部分を検査対象から除外して基準画像と比較することができる。   For example, as shown in FIG. 8, even when the lower left vertex of the document protrudes from the imaging range, the protruding vertex is estimated and the non-inspection part is set to exclude the protruding part from the inspection target. And can be compared with the reference image.

なお、図5や図7から分かるように、頂点座標を特定しても、結果として、エラー処理となることもある。エラー処理となるケースでも頂点座標を求めているのは、解像度変換部214における解像度変換の際に、原稿の領域サイズを知っておく必要があるからである。   As can be seen from FIGS. 5 and 7, even if the coordinates of the vertices are specified, error processing may be performed as a result. The reason why the vertex coordinates are obtained even in the case of error processing is that it is necessary to know the area size of the document when performing resolution conversion in the resolution conversion unit 214.

<<第2実施形態>>
図26は、図1に示した画像検査装置5の、第2実施形態の詳細例を示すブロック図である。この第2実施形態は、原稿の一部が撮像範囲からはみ出した撮影画像に対して透視変換処理を施すことなく、台形状の撮像画像に基づいて原稿部分の撮像範囲からはみ出している非検査領域を特定するための非検査領域情報を求め、台形状の撮像画像と基準画像とを比較して画像検査を行なう際に、先ず、撮像画像の台形状と同じになるように基準画像に対して逆透視変換処理を施し、この後、先に求めた非検査領域情報を参照して原稿の非検査領域を検査対象から除外して画像検査を行なう点に特徴を有する。以下、具体的に説明する。
<< 2nd Embodiment >>
FIG. 26 is a block diagram showing a detailed example of the second embodiment of the image inspection apparatus 5 shown in FIG. In the second embodiment, a non-inspection area that protrudes from an imaging range of a document portion based on a trapezoidal captured image without performing perspective conversion processing on a captured image in which a part of the document protrudes from the imaging range. When non-inspection area information for identifying the image is obtained and the image inspection is performed by comparing the trapezoidal captured image with the reference image, first, the reference image is made to be the same as the trapezoidal shape of the captured image. It is characterized in that a reverse perspective transformation process is performed, and thereafter, image inspection is performed by referring to the previously obtained non-inspection area information and excluding the non-inspection area of the document from the inspection target. This will be specifically described below.

撮影画像に対して透視変換処理を施さない構成とするため、画像読取部100から透視変換部116を取り除いている点が第1実施形態の構成と異なる。また、基準画像に対して、撮像画像の台形状と同形状となるように幾何変換処理(逆透視変換処理)を施す逆透視変換部212を備えている点が第1実施形態の構成と異なる。   The configuration of the first embodiment is different from that of the first embodiment in that the perspective conversion unit 116 is removed from the image reading unit 100 so that the perspective conversion process is not performed on the captured image. The configuration of the first embodiment is different from the configuration of the first embodiment in that a reverse perspective transformation unit 212 that performs a geometric transformation process (reverse perspective transformation process) on the reference image so as to have the same shape as the trapezoidal shape of the captured image is provided. .

逆透視変換部212は、たとえば、撮像画像の台形形状を矩形状に戻す透視変換処理に際して使用される上述した式(3),(4)の逆変換式(式の記載は割愛する)を求めて、基準画像の各画素を代入することで、矩形状の基準画像を、撮像画像の台形状に合致させる。   The inverse perspective transformation unit 212 obtains, for example, an inverse transformation expression (the expression is omitted) of the above-described expressions (3) and (4) used in the perspective transformation process of returning the trapezoidal shape of the captured image to a rectangular shape. Then, by substituting each pixel of the reference image, the rectangular reference image matches the trapezoid of the captured image.

図27は、上記第2実施形態の画像検査装置5における処理手順の概要を示すフローチャートである。基本的な処理手順は第1実施形態の画像検査装置5と同様であるが、撮影画像に対して透視変換処理を施さない点と、撮像画像の台形状と同じになるように基準画像に対して逆透視変換処理を施す点が異なる。同様の処理手順には同一のステップ番号を付して示す。   FIG. 27 is a flowchart illustrating an outline of a processing procedure in the image inspection apparatus 5 according to the second embodiment. The basic processing procedure is the same as that of the image inspection apparatus 5 of the first embodiment, except that the perspective transformation processing is not performed on the captured image, In that a reverse perspective transformation process is performed. Similar processing procedures are denoted by the same step numbers.

シェーディング補正部112は、カメラヘッド102により撮影された撮像画像に対してシェーディング補正を行ない(S134)、さらに光学歪み補正を施して、処理済の画像をデータ格納部300に格納する(S136)。   The shading correction unit 112 performs shading correction on the image captured by the camera head 102 (S134), further performs optical distortion correction, and stores the processed image in the data storage unit 300 (S136).

この後、非検査領域特定処理部120は、直ちに後述する手順にしたがって、台形状の撮像画像に基づいて非検査領域特定処理を実行し、はみ出し部分の領域(非検査領域)を示す情報をデータ格納部300に格納する(S144)。   Thereafter, the non-inspection area specification processing unit 120 immediately executes the non-inspection area specification processing based on the trapezoidal captured image according to a procedure described later, and outputs information indicating the protruding area (non-inspection area) to the data. It is stored in the storage unit 300 (S144).

次に、基準画像処理部210の逆透視変換部212は、矩形状の基準画像を、撮像画像の台形状に合致させるべく逆透視変換処理を施す(S150)。解像度変換部214は、基準画像(台形状)のサイズと検査対象である撮像画像の原稿部分の画像(台形状)のサイズとが等しくなるように、基準画像の解像度を変換する(S152)。次に、暈かし処理部216は、解像度変換された基準画像に対して暈かし処理を施す(S154)。   Next, the reverse perspective transformation unit 212 of the reference image processing unit 210 performs a reverse perspective transformation process on the rectangular reference image so as to match the trapezoidal shape of the captured image (S150). The resolution conversion unit 214 converts the resolution of the reference image (S152) such that the size of the reference image (trapezoid) is equal to the size of the image (trapezoid) of the original portion of the captured image to be inspected (S152). Next, the blurring processing unit 216 performs blurring processing on the resolution-converted reference image (S154).

以下第1実施形態と同様に、非検査領域削除処理部218は、非検査領域特定部130により特定された非検査領域情報をデータ格納部300から読み出し、暈かし処理部216により暈かし処理が施された基準画像における非検査領域部分のデータを無効化することで、基準画像に対して非検査領域を設定する(S156)。位置合わせ処理部232は、非検査領域部分が無効化された基準画像と画像読取部100にて前処理が施された撮像画像の位置合わせ処理をする(S158)。欠陥異常検出処理部234は、2つの画像の差を求め(S160)、この差分処理により得られた差分結果に基づいて、撮像画像の欠陥や異常の有無を検出する(S162)。   Hereinafter, similarly to the first embodiment, the non-inspection area deletion processing unit 218 reads out the non-inspection area information specified by the non-inspection area identification unit 130 from the data storage unit 300, and the unsharp processing unit 216 performs the shading. The non-inspection area is set for the reference image by invalidating the data of the non-inspection area part in the processed reference image (S156). The alignment processing unit 232 performs alignment processing between the reference image in which the non-inspection area portion is invalidated and the captured image subjected to the preprocessing by the image reading unit 100 (S158). The defect / abnormality detection processing unit 234 calculates the difference between the two images (S160), and detects the presence or absence of a defect or abnormality in the captured image based on the difference result obtained by the difference processing (S162).

図28は、第2実施形態で取り扱う画像の一例を示す図である。ここで、図28(A)は、撮像範囲内から原稿の一部がはみ出して置かれている状態でカメラヘッド102により撮像された結果を示す図であり、図8(A)に示したものと同じである。カメラヘッド102により撮像された透視変換処理前の画像データにおける原稿部分は、図28(A)のように台形状を呈する。   FIG. 28 is a diagram illustrating an example of an image handled in the second embodiment. Here, FIG. 28A is a diagram illustrating a result of an image captured by the camera head 102 in a state in which a part of the document protrudes from the imaging range and is placed, and is illustrated in FIG. Is the same as The document portion in the image data before the perspective transformation processing captured by the camera head 102 has a trapezoidal shape as shown in FIG.

図28(B)および図28(C)は、エッジ抽出部122の処理を説明する図である。エッジ抽出部122は、光学歪補正部114により光学補正が施された台形状の撮像画像に対してエッジ抽出処理を施す。エッジ抽出処理は、第1実施形態と同様に、prewitt演算子で、上側、左側、下側、右側のそれぞれの方向からサーチして行なう。上側、左側、下側、右側のそれぞれの方向からサーチして得たエッジ抽出画像の各画素について和を取ることで、図28(B)に示す合成されたエッジ抽出画像が得られる。   FIGS. 28B and 28C are diagrams illustrating the processing of the edge extraction unit 122. FIG. The edge extraction unit 122 performs an edge extraction process on the trapezoidal captured image optically corrected by the optical distortion correction unit 114. As in the first embodiment, the edge extraction process is performed by performing a search using the prewitt operator from the upper, left, lower, and right directions. By taking the sum of each pixel of the edge extraction image obtained by searching from the upper, left, lower, and right directions, a combined edge extraction image shown in FIG. 28B is obtained.

エッジ有効部検出部124にて、図28(B)に示すエッジ抽出画像に基づいてエッジ有効部検出処理を施すことで、図28(C)に示すエッジ抽出画像が得られる。図28(C)にて、4つの直線部(図中の太線)で示された部分がエッジ有効部となる。   The effective edge portion detection unit 124 performs the effective edge portion detection processing based on the edge extracted image shown in FIG. 28B, thereby obtaining the edge extracted image shown in FIG. 28C. In FIG. 28C, a portion indicated by four straight lines (thick lines in the drawing) is an edge effective portion.

次に、第2実施形態の非検査領域特定処理部120の非検査領域特定処理の処理手順について説明する。基本的な処理手順は第1実施形態と同様であるので、第1実施形態のフローチャートのステップ番号を参照しつつ、第2実施形態に関わる部分についてのみ説明することとする。   Next, a processing procedure of a non-inspection area specifying process of the non-inspection area specifying processing unit 120 according to the second embodiment will be described. Since the basic processing procedure is the same as that of the first embodiment, only the part relating to the second embodiment will be described with reference to the step numbers of the flowchart of the first embodiment.

先ず、図20および図21を参照しつつ、エッジ有効部直線式算出部126によるエッジ有効部直線式算出処理と原稿頂点設定処理部132による原稿頂点設定処理について説明する。   First, with reference to FIGS. 20 and 21, a description will be given of the edge-effective-portion straight-line calculation process by the edge-effective-portion straight-line calculation unit 126 and the document vertex setting process by the document vertex setting processing unit 132.

エッジ有効部直線式算出部126は、先ず、第1実施形態と同様に、エッジ有効部検出部124により検出されたエッジ有効部に基づいて原稿の頂点を算出するために、エッジ有効部直線式算出処理を行なう(S402)。すなわち、上辺エッジ有効部の直線yt、下辺エッジ有効部の直線式yb、左辺エッジ有効部の直線式yl、右辺エッジ有効部の直線式yrを算出する。   First, similarly to the first embodiment, the edge-effective-portion straight-line calculation unit 126 calculates the vertex of the document based on the edge-effective portion detected by the edge-effective-portion detection unit 124. A calculation process is performed (S402). That is, a straight line yt of the upper edge effective portion, a straight line formula yb of the lower edge effective portion, a straight line formula yl of the left edge effective portion, and a straight line expression yr of the right edge effective portion are calculated.

原稿頂点設定処理部132は、エッジ有効部直線式算出部126により求められた直線式を利用して、原稿左上の頂点(xtl ,ytl )、原稿左下の頂点(xbl ,ybl )、原稿左上の頂点(xtr ,ytr )、原稿左上の頂点(xbr ,ybr )を、それぞれ算出する(S420〜S450)。   The document vertex setting processing unit 132 uses the straight line formula calculated by the edge effective part straight line formula calculation unit 126 to set the vertex (xtl, ytl) at the upper left of the document, the vertex (xbl, ybl) at the lower left of the document, and the upper left corner of the document. The vertices (xtr, ytr) and the upper left vertex (xbr, ybr) of the document are calculated (S420 to S450).

図29は、第2実施形態のはみ出し場所判定処理部134によるはみ出し場所判定処理(第1実施形態の図22に対応する)の詳細例を示すフローチャートである。図30は、このはみ出し場所判定処理部134によるはみ出し場所判定処理における一事例を示す図である。   FIG. 29 is a flowchart illustrating a detailed example of the protruding place determination processing (corresponding to FIG. 22 of the first embodiment) by the protruding place determination processing unit 134 according to the second embodiment. FIG. 30 is a diagram illustrating an example of the protruding place determination processing performed by the protruding place determination processing unit 134.

なお、第2実施形態の処理としては、基本的には第1実施形態に準じた処理を行なうので、比較の容易化のため、後述する処理のステップ番号には“$”マークとともに第1実施形態と同一の番号を付して示す。   Since the processing of the second embodiment is basically the same as that of the first embodiment, the step numbers of the processing to be described later are marked with a "@" mark in the first embodiment for simplicity of comparison. The same numbers as in the embodiments are used.

はみ出し場所判定処理部134は、先ず、原稿左上の頂点(xtl ,ytl )が左側にはみ出しているかどうかを判定する(S$502)。図30(A)より、左側境界の直線は、式(28)で表すことができる。したがって、左上頂点(xtl ,ytl )が左側境界の直線より左側に位置するかどうかは、式(29)に示すように、式(28)に(xtl ,ytl )を代入した値が“0”より大きいか小さいかで判定することができる。もし、(xtl ,ytl )が式(28)で示す境界線よりも左側に位置する場合は、式(29)の条件は成立する。   The protruding place determination processing unit 134 first determines whether the upper left vertex (xtl, ytl) of the document protrudes to the left side (S # 502). From FIG. 30A, the straight line on the left boundary can be expressed by Expression (28). Therefore, whether the upper left vertex (xtl, ytl) is located on the left side of the straight line of the left boundary is determined by substituting (xtl, ytl) into the equation (28) as shown in the equation (29). It can be determined whether it is larger or smaller. If (xtl, ytl) is located on the left side of the boundary shown by Expression (28), the condition of Expression (29) is satisfied.

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

同様に、はみ出し場所判定処理部134は、原稿左上の頂点(xtl ,ytl )が上側にはみ出しているかどうかを判定する(S$504,S$510)。図30(A)より、上側境界の直線は、式(30)で表すことができる。したがって、左上頂点(xtl ,ytl )が上側境界の直線より上側に位置するかどうかは、式(31)に示すように、式(30)に(xtl ,ytl )を代入した値が“0”より大きいか小さいかで判定することができる。もし、(xtl ,ytl )が式(30)で示す境界線よりも上側に位置する場合は、式(31)の条件は成立する。   Similarly, the protruding place determination processing unit 134 determines whether the top left vertex (xtl, ytl) of the document protrudes upward (S # 504, S # 510). As shown in FIG. 30A, the straight line on the upper boundary can be expressed by equation (30). Therefore, whether the upper left vertex (xtl, ytl) is positioned above the straight line of the upper boundary is determined by substituting (xtl, ytl) into equation (30) as shown in equation (31). It can be determined whether it is larger or smaller. If (xtl, ytl) is located above the boundary shown in Expression (30), the condition of Expression (31) is satisfied.

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

式(29)が成立して、かつ式(31)も成立する場合(S$502−Yes,S$504−Yes)、はみ出し場所判定処理部134は、左上頂点(xtl ,ytl )は式(28)で示す境界線の左側でかつ式(30)で示す境界線の上側に位置することとなる。この場合は、原稿の何れかの辺に対しても長さが判明しない、つまり撮像範囲内に辺の全体が収まるものは存在しないため、はみ出し場所判定処理部134は、エラー処理を行なう(S$506)。   When Expression (29) is satisfied and Expression (31) is also satisfied (S (502-Yes, S $ 504-Yes), the protruding place determination processing unit 134 determines that the upper left vertex (xtl, ytl) is the expression ( 28) is located on the left side of the boundary line shown by the above expression and above the boundary line shown by the expression (30). In this case, the length of any one of the sides of the document is not known, that is, there is no one that fits the entire side within the imaging range, so the protruding place determination processing unit 134 performs error processing (S $ 506).

また、式(29)が成立し式(31)が不成立の場合(S$502−Yes,S$504−No)、左上頂点(xtl ,ytl )は式(28)で示す境界線の左側でかつ式(30)で示す境界線の下側に位置することとなる。この場合、はみ出し場所判定処理部134は、原稿は左側にはみ出していると判定し、flagtlを“1”に設定する(S$508)。   When equation (29) is satisfied and equation (31) is not satisfied (S $ 502-Yes, S $ 504-No), the upper left vertex (xtl, ytl) is located on the left side of the boundary shown in equation (28). And it will be located below the boundary line shown by Formula (30). In this case, the protruding place determination processing unit 134 determines that the document protrudes to the left side, and sets flagtl to “1” (S # 508).

式(29)が不成立の場合で式(31)が成立する場合(S$502−No,S$510−Yes)、左上頂点(xtl ,ytl )は式(28)で示す境界線の右側でかつ式(30)で示す境界線の上側に位置することとなる。この場合、はみ出し場所判定処理部134は、原稿は上側にはみ出していると判定し、flagulを“2”に設定する(S$512)。また、式(29)が不成立の場合で式(31)も不成立の場合(S$502−No,S$510−No)、式(28)で示す境界線の左側でかつ式(30)で示す境界線の下側に位置することとなる。この場合、はみ出し場所判定処理部134は、(xtl ,ytl )は撮像画像内にあるものと判定し、flagtlを“0”に設定する(S$514)。   When Expression (29) is not satisfied and Expression (31) is satisfied (S $ 502-No, S $ 510-Yes), the upper left vertex (xtl, ytl) is located on the right side of the boundary indicated by Expression (28). And it will be located above the boundary shown by the equation (30). In this case, the protruding place determination processing unit 134 determines that the document protrudes upward, and sets flagul to “2” (S # 512). Further, when Expression (29) is not satisfied and Expression (31) is also not satisfied (S $ 502-No, S $ 510-No), the left side of the boundary indicated by Expression (28) and the expression (30) are used. It will be located below the indicated boundary line. In this case, the protruding place determination processing unit 134 determines that (xtl, ytl) exists in the captured image, and sets flagtl to “0” (S # 514).

はみ出し場所判定処理部134は、原稿の他の頂点に対してもはみ出し場所判定処理を行なう。左下の頂点(xbl ,ybl )に対するはみ出し場所判定処理はS$522〜S$534、右上の頂点(xtr ,ytr )に対するはみ出し場所判定処理はS$542〜S$554、右下の頂点(xbr ,ybr )に対するはみ出し場所判定処理はS$562〜S$564となる。   The protruding place determination processing unit 134 performs protruding place determination processing on other vertices of the document. The protruding place judging processing for the lower left vertex (xbl, ybl) is S $ 522 to S $ 534, the protruding place judging processing for the upper right vertex (xtr, ytr) is S $ 542 to S $ 554, and the lower right vertex (xbr , Ybr), the out-of-place determination processing is S $ 562 to S $ 564.

図示するように、判定のために使用する境界式が異なるものの、基本的には、左上頂点についての処理と同様である。なお、右側境界の直線は式(32)で表すことができ、下側境界の直線は式(33)で表すことができる。   As shown in the figure, although the boundary formula used for the determination is different, it is basically the same as the process for the upper left vertex. Note that the straight line on the right boundary can be expressed by Expression (32), and the straight line on the lower boundary can be expressed by Expression (33).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

図30(A)に示したように、原稿の左下が撮像範囲からはみ出している場合、その撮像画像についてはみ出し場所判定処理を行なうことにより、原稿左下の頂点(xbl ,ybl )が左側にはみ出していると判定される。   As shown in FIG. 30A, when the lower left of the document is out of the imaging range, by performing the protruding place determination process on the captured image, the lower left vertex (xbl, ybl) of the document is protruded to the left. It is determined that there is.

図31は、第2実施形態の境界部分特定処理部136によるはみ出し部の境界座標算出処理(第1実施形態の図24に対応)の具体例を示すフローチャートである。ここで図31は、左下はみ出し部の境界座標算出処理のフローチャートを示す。図32は、図31に示した左下についての処理ステップに使用する式や交点座標を、左上、右上、右下に適用させる場合の対応関係を示す図表である。   FIG. 31 is a flowchart illustrating a specific example of the boundary coordinate calculation processing of the protruding part (corresponding to FIG. 24 of the first embodiment) by the boundary part specifying processing unit 136 of the second embodiment. Here, FIG. 31 shows a flowchart of the boundary coordinate calculation processing of the lower left protruding portion. FIG. 32 is a chart showing a correspondence relationship in a case where the equations and intersection coordinates used in the processing step for the lower left shown in FIG. 31 are applied to the upper left, upper right, and lower right.

なお、非検査領域設定部138によるはみ出し部の境界座標算出処理(図10のS600)の詳細例は、図23に示した第1実施形態のものと同じである。   A detailed example of the process of calculating the boundary coordinates of the protruding portion (S600 in FIG. 10) by the non-inspection area setting unit 138 is the same as that of the first embodiment shown in FIG.

左下はみ出し部の境界座標算出処理(S$608)を行なうに際して、はみ出し場所判定処理部134は、flagblが“1”の場合、はみ出し場所判定処理部134直線ylと左側の境界線x+cq1=0の交点(xbl1,ybl1)を算出する(S$622)。この後、はみ出し場所判定処理部134は、直線ybと左側の境界線y+cq1=0の交点(xbl2,ybl2)を算出し(S$624)、(xbl,ybl),(xbl1,ybl1),(xbl2,ybl2)間を非検査部として設定する(S$626)。また、flagblが“2”の場合、はみ出し場所判定処理部134は直線ylと下側の境界線x+cq4=0の交点(xbl1,ybl1)を算出する(S$632)。その後、直線ybと下側の境界線x+cq4=0の交点(xbl2,ybl2)を算出し(S$634)、(xbl,ybl),(xbl1,ybl1),(xbl2,ybl2)間を非検査部として設定する(S$636)。   When performing the boundary coordinate calculation processing of the lower left protruding portion (S $ 608), when the flagbl is “1”, the protruding location determination processing section 134 determines whether the protruding location determination processing section 134 has a straight line yl and a left boundary line x + cq1 = 0. The intersection (xbl1, ybl1) is calculated (S $ 622). Thereafter, the protruding place determination processing unit 134 calculates the intersection (xbl2, ybl2) of the straight line yb and the left boundary line y + cq1 = 0 (S $ 624), (xbl, ybl), (xbl1, ybl1), ( xbl2 and ybl2) are set as non-inspection units (S # 626). If flagbl is “2”, the protruding place determination processing unit 134 calculates an intersection (xbl1, ybl1) of the straight line yl and the lower boundary line x + cq4 = 0 (S $ 632). Thereafter, the intersection (xbl2, ybl2) of the straight line yb and the lower boundary line x + cq4 = 0 is calculated (S $ 634), and the area between (xbl, ybl), (xbl1, ybl1), and (xbl2, ybl2) is not inspected. It is set as a copy (S # 636).

左上はみ出し部の境界座標算出処理(S604)、右上はみ出し部の境界座標算出処理(S614)、右下はみ出し部の境界座標算出処理(S618)についても処理は同様である。ただし、図31に示した左下についての処理ステップに使用する式や交点座標を、図32に示すように代える。   The same applies to the process of calculating the boundary coordinates of the upper left protruding portion (S604), the process of calculating the boundary coordinates of the upper right protruding portion (S614), and the process of calculating the boundary coordinates of the lower right protruding portion (S618). However, the equations and intersection coordinates used in the processing step for the lower left shown in FIG. 31 are changed as shown in FIG.

以上説明したように、第2実施形態の画像検査装置5では、撮像画像を正面から見た画像に変換して(つまり矩形状の画像に戻して)元の画像である基準画像と比較するのではなく、撮像状態に起因する撮像画像の形状(一般的には台形状)に一致するように基準画像に対して逆透視変換処理を施して、何れも矩形状ではない(前例では台形状)の両画像を比較するようにした。基準画像に対する逆透視変換処理は、少ない画素点からより多くの画素点の画素値を求めるという補間処理を必要としないので、より精度よく画像欠陥の有無を検査できるようになる。   As described above, in the image inspection device 5 of the second embodiment, the captured image is converted into an image viewed from the front (that is, returned to a rectangular image) and compared with the reference image which is the original image. Rather, the reference image is subjected to reverse perspective transformation processing so as to match the shape of the captured image (generally trapezoidal shape) resulting from the imaging state, and none of the rectangular images is trapezoidal (in the previous example, trapezoidal). Are compared. The reverse perspective transformation processing for the reference image does not require interpolation processing of finding pixel values of more pixel points from fewer pixel points, so that the presence or absence of an image defect can be inspected more accurately.

また、この際、チルトスキャンにより撮像画像の原稿の一部がはみ出した場合に、撮像画像に対して幾何変換処理を行なわなくても、はみ出し部の頂点座標を推定して非検査部を設定することにより、基準画像との比較が可能となる。   Also, at this time, when a part of the original of the captured image protrudes due to the tilt scan, the vertex coordinates of the protruding part are estimated and the non-inspection part is set without performing the geometric transformation process on the captured image. This enables comparison with the reference image.

<<第3実施形態>>
図33は、図1に示した画像検査装置5の第3実施形態における原稿範囲特定処理の概要を説明する図である。第3実施形態の画像検査装置5の構成としては、概ね第1実施形態と同様のものを用いる。この第3実施形態の画像検査装置5は、第1実施形態と同様に、略矩形状の原稿の頂点が撮像範囲からはみ出した撮影画像に対して透視変換処理を施すとともに、透視変換処理された矩形状の撮像画像に基づいて、原稿部分の撮像範囲からはみ出している非検査領域を特定するための非検査領域情報を求め、透視変換処理された撮像画像と基準画像とを比較して画像検査を行なう際に、先に求めた非検査領域情報を参照して、原稿の非検査領域を検査対象から除外して画像検査を行なう。
<<< 3rd Embodiment >>>
FIG. 33 is a view for explaining the outline of the document range specifying process in the third embodiment of the image inspection apparatus 5 shown in FIG. As the configuration of the image inspection apparatus 5 according to the third embodiment, the same configuration as that of the first embodiment is used. As in the first embodiment, the image inspection apparatus 5 according to the third embodiment performs the perspective transformation process on the photographed image in which the vertices of the substantially rectangular original are out of the imaging range, and performs the perspective transformation process. Based on the rectangular captured image, non-inspection area information for identifying a non-inspection area protruding from the imaging range of the original portion is obtained, and the perspective-transformed captured image is compared with the reference image to perform image inspection. When performing the image inspection, the image inspection is performed by excluding the non-inspection area of the document from the inspection target with reference to the previously obtained non-inspection area information.

そして、この第3実施形態は、原稿の辺縁を示す直線式の求め方、並びに、撮像範囲からはみ出した原稿部分を非検査部として設定する手法が、第1および第2実施形態と異なる。具体的には、エッジ追跡や統計処理などの手法を用いて矩形状の原稿の辺縁をなす直線の式を求め、求めた直線の本数が4本、3本、2本以下の何れであるのかに応じて非検査領域設定処理を切り替える点に特徴を有する。これにより、第1実施形態の処理手順では対処し得ないはみ出し状態の撮像画像についても対応可能とする。   The third embodiment is different from the first and second embodiments in the method of obtaining a linear expression indicating the edge of a document and the method of setting a portion of the document outside the imaging range as a non-inspection unit. Specifically, an equation of a straight line forming the edge of the rectangular document is obtained by using a method such as edge tracking or statistical processing, and the number of obtained straight lines is any of four, three, two or less. It is characterized in that the non-inspection area setting processing is switched depending on whether the process is performed. Thereby, it is possible to cope with a captured image in a protruding state which cannot be dealt with by the processing procedure of the first embodiment.

たとえば、第3実施形態の画像検査装置5は、原稿辺縁の直線式の算出手法として、周知技術であるエッジ追跡の手法を利用し、エッジ画素が所定数以上ほぼ連続して略直線状に検出されたとき、その部分を原稿辺縁をなす直線部分であるとする。あるいは、統計手法を利用して、原稿辺縁をなす直線を求めてもよい。図33(A)に示すように、原稿が傾いている場合でも、原稿辺縁をなす直線を検出することは可能である。   For example, the image inspection apparatus 5 according to the third embodiment uses a well-known technique of edge tracking as a method of calculating a linear expression of a document edge, and a predetermined number of edge pixels are substantially continuously formed in a substantially linear shape. When it is detected, it is assumed that the portion is a straight line portion forming the edge of the document. Alternatively, a straight line forming the edge of the document may be obtained by using a statistical method. As shown in FIG. 33A, it is possible to detect a straight line that forms the periphery of the document even when the document is inclined.

この後、画像検査装置5は、図33(B)に示すように、先ず、原稿辺縁をなす4つの直線式が検出できたか否かによって処理を切り替える(S1)。4つの直線式が検出できる場合は(S1−Yes)、たとえ、一部の頂点が撮像範囲外であっても、全ての頂点座標を特定可能である。一方、エッジ追跡などでは4つの直線式が検出できない場合は(S1−No)、画素信号生成部5は次に、原稿辺縁をなす3つの直線式が検出できたか否かによって処理を切り替える(S2)。3つの直線式が検出できる場合には、1辺の全体が撮像範囲内であるかもしくは1頂点のみ撮像範囲内の場合があるが、何れの場合であっても必ず2頂点(図中に示す●印)を設定できるので、画素信号生成部5は先ずそれらを設定する(S1)。   Thereafter, as shown in FIG. 33B, the image inspection apparatus 5 first switches the process depending on whether or not four linear formulas forming the document margin have been detected (S1). If four straight-line equations can be detected (S1-Yes), all vertex coordinates can be specified even if some vertices are outside the imaging range. On the other hand, if four linear expressions cannot be detected by edge tracking or the like (S1-No), the pixel signal generation unit 5 switches the processing depending on whether three linear expressions forming the document margin have been detected (S1). S2). When three linear expressions can be detected, there is a case where the entirety of one side is within the imaging range or only one vertex is within the imaging range, but in any case, two vertices (shown in the drawing) Since the mark (●) can be set, the pixel signal generation unit 5 first sets them (S1).

次に、画素信号生成部5は、既に設定済みの2つの頂点座標間の距離を求め(S4)、この距離と基準画像の略角形状の各辺縁間の比(サイズ比)とから、既に設定済みの2つの頂点と対向する、未知の2頂点(図中に示す○印)の座標を推測(特定)する(S5)。そして、この求めた2頂点座標から撮像範囲外の辺を規定する残りの直線式を特定する(S6)。   Next, the pixel signal generation unit 5 calculates the distance between the two coordinates of the vertices that have already been set (S4), and calculates the distance and the ratio (size ratio) between the respective edges of the substantially rectangular shape of the reference image. The coordinates of two unknown vertices (marked with a circle in the figure) facing the two already set vertices are estimated (specified) (S5). Then, the remaining straight line formulas that define the sides outside the imaging range are specified from the obtained two vertex coordinates (S6).

このようにして、4つの直線式を特定できると(S1−YesやS6)、次に画素信号生成部5は、4つの直線式から交点座標を求める(S7)。そして、4つの交点座標から、4つの直線を原稿の各辺に対応付け、4つの交点座標が原稿のどの頂点かを特定する(S8)。これによって、撮像範囲に対してはみ出している原稿頂点の位置を特定することができる。   When the four linear equations can be specified in this way (S1-Yes or S6), the pixel signal generator 5 next calculates the intersection coordinates from the four linear equations (S7). Then, from the four intersection coordinates, four straight lines are associated with each side of the document, and which vertex of the document the four intersection coordinates are specified (S8). Thus, the position of the vertex of the document that protrudes from the imaging range can be specified.

一方、エッジ追跡などでは2以下の直線式しか検出できない場合は(S2−No)、撮像範囲内には1頂点以下しか存在しないことになる。この場合、4頂点を特定することは不可能ではないまでも非常に難しく、原稿領域を確定できないので、画素信号生成部5はエラーとして処理を中止する(S9)。   On the other hand, when only two or less straight lines can be detected by edge tracking or the like (S2-No), only one vertex or less exists in the imaging range. In this case, it is very difficult, if not impossible, to specify the four vertices, and the document area cannot be determined. Therefore, the pixel signal generation unit 5 stops the process as an error (S9).

図34は、第3実施形態における非検査領域特定処理の概要を説明する図である。ここでは、撮像範囲の左端側にはみ出している状態を一例として説明する。   FIG. 34 is a diagram illustrating an outline of a non-inspection area specifying process according to the third embodiment. Here, a state where the image is protruded to the left end side of the imaging range will be described as an example.

第3実施形態の処理において対応可能な原稿が撮像範囲からはみ出した状態では、原稿の辺縁をなす3本もしくは4本の直線が求められる。これを、撮像範囲の上下左右の端縁から見た場合、図34(A)に示すように、1つの端縁に対して1つの頂点がはみ出している場合、図34(B)に示すように、2つの端縁に対して1つの頂点がはみ出している場合、すなわち撮像範囲のコーナー側にはみ出している場合、および図34(C)に示すように、1つもしくは2つの端縁に対して隣接する2つの頂点がはみ出している場合、の3つの態様に大別できる。   In the state in which a document that can be handled is out of the imaging range in the processing of the third embodiment, three or four straight lines forming the edge of the document are obtained. When this is viewed from the upper, lower, left and right edges of the imaging range, as shown in FIG. 34A, when one vertex protrudes from one edge, as shown in FIG. 34B. When one vertex protrudes from two edges, that is, when it protrudes toward the corner of the imaging range, and as shown in FIG. 34C, one vertex protrudes from one or two edges. When two adjacent vertices protrude, they can be roughly classified into three modes.

ここで、図34(A)と図34(B)とは、何れも1つの頂点がはみ出している場合であり、非検査領域設定処理においては同一概念の状態と捉えることもできる。そして、このような場合には、撮像範囲からはみ出している原稿頂点から延びる2つの直線と、はみ出し対象の撮像範囲の端縁とがなす2つの交点座標を求め、この2つの交点座標とその原稿頂点とがなす3角形の領域S1を非検査領域に設定すればよい。   Here, FIGS. 34 (A) and 34 (B) each show a case where one vertex protrudes, and can be regarded as a state of the same concept in the non-inspection area setting process. In such a case, the coordinates of two intersections between two straight lines extending from the vertex of the original protruding from the imaging range and the edge of the imaging range to be protruded are obtained, and the coordinates of the two intersections and the original document are determined. The triangular area S1 formed by the vertices may be set as the non-inspection area.

ただし、図34(B)に示す状態では、対象となる撮像範囲の端縁が2つあるので、それぞれの端縁について2つの交点座標を求めることで、結果としては、2つの3角形の領域S1l(参照子“l”はleftを意味する),S1b(参照子“b”はbottomを意味する)を非検査領域として設定する。S1a,S1bとで重複部分が生じるが不都合はない。なお、S1lに関しては左の端縁から見たS1、S1bに関しては下の端縁から見たS1として捉えることもできる。   However, in the state shown in FIG. 34B, since there are two edges of the target imaging range, two intersection coordinates are obtained for each edge, and as a result, two triangular regions are obtained. S11 (reference element "l" means left) and S1b (reference element "b" means bottom) are set as non-inspection areas. Although an overlapping portion occurs between S1a and S1b, there is no inconvenience. Note that S11 can be regarded as S1 viewed from the left edge, and S1b can be regarded as S1 viewed from the lower edge.

つまり、撮像範囲のある端縁に対してはみ出している1つの3角形の領域S1を非検査領域とする処理を、上下左右の4つの端縁について実行することで、撮像範囲からはみ出している、全ての3角形の領域を確実に非検査領域として特定することができる。   In other words, the process of setting one triangular area S1 protruding from a certain edge of the imaging range as a non-inspection area is performed for the four upper, lower, left, and right edges, thereby protruding from the imaging range. All triangular areas can be reliably specified as non-inspection areas.

一方、図34(C)に示す状態では、対象とする撮像範囲の端縁からはみ出している、共通する原稿辺縁上の、2つの原稿頂点に関して、それぞれから延びる残りの、各1つの直線とはみ出し対象の撮像範囲の端縁とがなす交点座標をそれぞれ求め、この2つの交点座標と撮像範囲からはみ出している2つの原稿頂点とがなす4角形の領域S2を非検査領域に設定すればよい。   On the other hand, in the state shown in FIG. 34C, with respect to the two document vertices on the common document edge protruding from the edge of the target imaging range, the remaining one straight line extending from each of the two vertices is The coordinates of the intersection between the edge of the imaging range to be protruded and the edges of the two originals protruding from the imaging range may be set as the non-inspection area. .

なお、上述の処理では、着目する撮像範囲の端縁に対して1つ頂点がはみ出している場合には3角形の領域を、また2つ頂点がはみ出している場合には4角形の領域を、それぞれ非検査領域に設定する、というように、はみ出し状態に応じて処理内容を切り替えていたが、これらは纏めて取り扱うことも可能である。   In the above-described processing, when one vertex protrudes from the edge of the imaging range of interest, a triangular area is protruded, and when two vertices protrude, a quadrangular area is protruded. Although the processing contents are switched in accordance with the protruding state, such as setting each in a non-inspection area, these can be handled collectively.

たとえば、共通する原稿辺縁上の2つの原稿頂点のそれぞれから延びる、残りの各1つの直線と、はみ出し対象の撮像範囲の端縁とがなす交点座標をそれぞれ求め、この2つの交点座標と撮像範囲からはみ出している2つの原稿頂点とによって囲まれた領域を非検査領域に設定すればよい。この場合、図34(A)については領域S3、図34(B)については領域S3l,S3bも非検査領域に設定することになるが、この領域は原稿範囲外であるので、本実施形態の目的に対しては、実質的には意味のない領域になる。   For example, the coordinates of the intersection between each of the remaining one straight line extending from each of the two document vertices on the common document edge and the edge of the imaging range to be protruded are determined. The area surrounded by the two document vertices protruding from the range may be set as the non-inspection area. In this case, the area S3 in FIG. 34 (A) and the areas S31 and S3b in FIG. 34 (B) are also set as non-inspection areas. It becomes a practically meaningless area for the purpose.

図35は、上記の処理内容を実現するため処理手順の概要を説明する図である。ここで、図35(A)は、境界部分特定処理部136による境界座標特定処理の手順を示すフローチャートである。なお、この図35(A)では、原稿辺縁を参照符号“A”で代表的に記述し、その直線式yを参照符号“A”の小文字“a”を用いて“ya”として示す。また図35(B)および図35(C)は、この処理にて用いる、上下左右の各端縁に対するはみ出し領域を画定する直線式や原稿頂点および所定の直線と撮像範囲の端縁との交点座標の各対応関係を示す図である。図34の(A)〜(C)には、図35(B)および図35(C)に示す座標も示している。   FIG. 35 is a diagram for explaining an outline of a processing procedure for realizing the above processing contents. Here, FIG. 35A is a flowchart illustrating a procedure of the boundary coordinate specifying process by the boundary portion specifying processing unit 136. In FIG. 35A, the edge of the document is typically described by reference numeral "A", and the linear expression y is indicated by "ya" using the lowercase letter "a" of reference numeral "A". FIGS. 35 (B) and 35 (C) show a straight line formula for defining a protruding area for each of the upper, lower, left and right edges used in this processing, and an intersection between an original vertex and a predetermined straight line and an edge of the imaging range. It is a figure showing each correspondence of coordinates. 34A to 34C also show the coordinates shown in FIGS. 35B and 35C.

画像検査装置5の境界部分特定処理部136は、先ず原稿のA辺の直線式yaに関連した2つの境界式yα,yβと撮像範囲の端縁とがなす交点αa,βaの座標を特定する(S11)。ここで、2つの境界式yα,yβとは、直線式ya上の2つの原稿頂点から延びる直線式yaと直交する残りの直線式と等価である。たとえば、原稿の左辺L(Left)についての場合、上辺T(Top )の直線式ytと下辺B(bottom)の直線式ybである。   The boundary part specification processing unit 136 of the image inspection apparatus 5 first specifies the coordinates of the intersection points αa and βa between the two boundary expressions yα and yβ related to the linear expression ya on the side A of the document and the edge of the imaging range. (S11). Here, the two boundary expressions yα and yβ are equivalent to the remaining linear expressions orthogonal to the linear expression ya extending from the two document vertices on the linear expression ya. For example, in the case of the left side L (Left) of the document, a straight line formula yt of the upper side T (Top) and a straight line formula yb of the lower side B (bottom) are used.

次に境界部分特定処理部136は、求めた各交点座標が原稿の範囲外にあるか否かを判定する(S12)。交点座標が原稿の範囲外にある場合には、その交点αa,βaを含む境界式(すなわち直線式)上の原稿頂点Aα,Aβ(両方ではなく何れか一方)は撮像範囲内にあることになる。このような状態の交点を、以下、外分点と呼ぶ。これに対して、交点座標が原稿の範囲内にある場合には、その交点αa,βaを含む境界式(すなわち直線式)上の原稿頂点Aα,Aβ(両方の場合もある)は撮像範囲外にあることになる。このような状態の交点を、以下、内分点と呼ぶ。   Next, the boundary part specification processing unit 136 determines whether or not the obtained intersection coordinates are outside the range of the document (S12). When the intersection coordinates are outside the range of the document, the document vertices Aα and Aβ (either but not both) on the boundary formula (that is, the linear formula) including the intersections αa and βa are within the imaging range. Become. The intersection in such a state is hereinafter referred to as an external dividing point. On the other hand, when the coordinates of the intersection are within the range of the document, the document vertices Aα and Aβ on the boundary formula (that is, the linear formula) including the intersections αa and βa (both may be both) are outside the imaging range. It will be in. The intersection in such a state is hereinafter referred to as an internally dividing point.

境界部分特定処理部136は、交点座標αa,βaが原稿範囲外にある外分点の場合には(S12−Yes)、その外分点の交点座標と対応頂点座標とを交点座標Aaとして纏める(S13)。ここで、対応頂点座標は、外分点の交点座標を含む境界式(すなわち直線式)上の原稿頂点Aα,Aβの何れか一方である。また、交点座標Aaは、この原稿頂点を含む直線式yaと対応する撮像範囲の端縁とがなす交点の座標を意味する。   When the intersection coordinates αa and βa are outside divisions outside the document range (S12-Yes), the boundary portion specification processing unit 136 combines the intersection coordinates of the outside division and the corresponding vertex coordinates as the intersection coordinates Aa. (S13). Here, the corresponding vertex coordinates are either one of the document vertices Aα and Aβ on the boundary formula (that is, the linear formula) including the intersection coordinates of the external dividing points. The intersection coordinates Aa mean the coordinates of the intersection between the straight line ya including the vertex of the document and the corresponding edge of the imaging range.

この後、境界部分特定処理部136は、残りの交点座標と頂点座標(Aα,Aβの他方)と交点座標Aaとで画定される3角形を非検査部に設定する(S14)。このステップS12−Yes〜S14までの処理によって、図34(A)および図34(B)に示したS1,S1a,S1bを特定することができる。   Thereafter, the boundary part specifying processing unit 136 sets a triangle defined by the remaining intersection coordinates, the vertex coordinates (the other of Aα and Aβ), and the intersection coordinates Aa in the non-inspection unit (S14). By the processes of steps S12-Yes to S14, S1, S1a, and S1b shown in FIGS. 34A and 34B can be specified.

一方、交点座標αa,βaが原稿範囲内にある内分点の場合には(S12−No)、境界部分特定処理部136は、直線式ya上の2つの原稿頂点Aα,Aβと2つの交点座標αa,βaとで画定される4角形を非検査部に設定する(S15)。このステップS12−No,S15の処理によって、図34(C)に示したS2を特定することができる。   On the other hand, when the intersection coordinates αa and βa are internal dividing points within the document range (S12-No), the boundary part specifying processing unit 136 determines that the two document vertices Aα and Aβ on the straight line ya and the two intersections A quadrangle defined by the coordinates αa and βa is set in the non-inspection section (S15). By the processing of steps S12-No and S15, S2 shown in FIG. 34C can be specified.

なお、全てについてステップS15の処理を行なうことで、2つの交点座標αa,βaと撮像範囲からはみ出している2つの原稿頂点Aα,Aβとによって囲まれた領域を非検査領域に設定することもできる。このことは、図34での説明で述べたことと同じである。よって、ステップS12,13,14の処理を行なう必然性はない。   Note that by performing the processing of step S15 for all, the area surrounded by the two intersection coordinates αa and βa and the two document vertices Aα and Aβ protruding from the imaging range can be set as the non-inspection area. . This is the same as that described in the description of FIG. Therefore, it is not necessary to perform the processing of steps S12, S13, and S14.

図36および図37は、この第3実施形態の処理で対応可能な原稿のはみ出し状態を示す、撮像画像の一例である。また図38は、この第3実施形態の処理でも対応できない原稿のはみ出し状態を示す、撮像画像の一例である。第3実施形態の処理で対応可能な原稿のはみ出し状態としては、検出された直線が4本の場合と、3本の場合である。検出された直線が2本以下の場合にはエラーとして処理を止める。   FIG. 36 and FIG. 37 are examples of a captured image showing a protruding state of a document that can be handled by the processing of the third embodiment. FIG. 38 is an example of a captured image showing a protruding state of a document that cannot be handled by the processing of the third embodiment. The protruding state of the manuscript that can be handled by the processing of the third embodiment is a case where the number of detected straight lines is four and a case where the number is three. If the number of detected straight lines is two or less, the processing is stopped as an error.

たとえば、図36は、検出される直線が4本となる場合(4辺検出時)の原稿と撮像範囲の関係の一例を示すもので、原稿の隣接する2頂点が撮像範囲に対してコーナーを形成する撮像範囲の2方向にはみ出した状態にある。このような状態としては、透視変換後の撮像画像範囲の右上コーナーにて、その上端と右端ではみ出した状態(図36(A))、左上コーナーにて、その上端と左端ではみ出した状態(図36(B))、右下コーナーにて、その下端と右端ではみ出した状態(図36(C))、および、左下コーナーにて、その下端と左端ではみ出した状態(図36(D))、が代表的なものである。   For example, FIG. 36 shows an example of the relationship between a document and an imaging range when four straight lines are detected (when four sides are detected). Two adjacent vertices of the document form a corner with respect to the imaging range. It is in a state where it extends beyond the imaging range to be formed in two directions. Such a state includes a state in which the upper and lower edges of the captured image area after perspective transformation protrude from the upper end and the right end (FIG. 36A), and a state in which the upper and lower ends protrude at the upper left corner (FIG. 36A). (FIG. 36 (B)), a state where the lower end and the right end protrude at the lower right corner (FIG. 36 (C)), and a state where the lower end and the left end protrude at the lower left corner (FIG. 36 (D)). ), Are typical.

また図37は、検出される直線が3本となる場合(3辺検出時)の原稿と撮像範囲の関係の一例を示すもので、少なくとも原稿の隣接する2頂点が撮像範囲の端縁からはみ出した状態にある。このような状態としては、先ず、隣接する2つの原稿頂点が撮像範囲の1つの端縁からはみ出している状態である。この状態は、隣接する2つの原稿頂点が何れも撮像範囲の1つの端縁をなす直線よりも外側に位置している状態である。   FIG. 37 shows an example of the relationship between the document and the imaging range when three straight lines are detected (when three sides are detected). At least two adjacent vertices of the document protrude from the edge of the imaging range. It is in the state that it was. In such a state, first, two adjacent vertices of a document protrude from one edge of the imaging range. In this state, the vertices of two adjacent originals are both located outside the straight line that forms one edge of the imaging range.

たとえば、原稿の左上および左下の各頂点が透視変換後の撮像画像範囲の左側にはみ出した状態(図37(A))、原稿の左上および右上の各頂点が上側にはみ出した状態(図37(B))、原稿の右上および右下の各頂点が右側にはみ出した状態(図37(C))、および、原稿の左下および右下の各頂点が下側にはみ出した状態(図37(D))、が代表的なものである。   For example, the upper left and lower left vertices of the document protrude to the left side of the captured image range after the perspective transformation (FIG. 37A), and the upper left and upper right vertices of the document protrude upward (FIG. 37 ( B)), the upper right and lower right vertices of the document protrude to the right (FIG. 37 (C)), and the lower left and lower right vertices of the document protrude to the lower side (FIG. 37 (D) )) Are typical.

一方、検出される直線が3本となる場合(3辺検出時)の他の状態としては、隣接する2つの原稿頂点が撮像範囲の2つの端縁からはみ出している状態もある。この状態は、隣接する2つの原稿頂点が撮像範囲のあるコーナー側に位置し、その内の一方がそのコーナーの端縁をなす一方の直線よりも外側に位置し、かつ他方の頂点がこの一方の直線と交差する、端縁をなす他方の直線よりも外側に位置している状態である。   On the other hand, as another state where three straight lines are detected (when three sides are detected), there is a state in which two adjacent document vertices protrude from two edges of the imaging range. In this state, two adjacent document vertices are located on the corner side of the imaging range, one of them is located outside one straight line that forms the edge of the corner, and the other vertex is located on one side. Is located outside of the other straight line that forms an edge and intersects with the straight line.

たとえば、原稿の左側の2つの頂点が概ね透視変換後の撮像画像範囲の左上コーナー側にはみ出した状態(図37(E))、原稿の右側の2つの頂点が概ね右上コーナー側にはみ出した状態(図37(F))、原稿の右側の2つの頂点が概ね右下コーナー側にはみ出した状態(図37(G))、および、原稿の左側の2つの頂点が概ね左下コーナー側にはみ出した状態(図37(H))、が代表的なものである。   For example, a state in which the two vertices on the left side of the document protrude substantially toward the upper left corner of the captured image area after the perspective transformation (FIG. 37E), and a state in which the two vertices on the right side of the document protrude substantially toward the upper right corner side (FIG. 37 (F)), a state in which the two vertices on the right side of the document protrude substantially toward the lower right corner (FIG. 37 (G)), and a state in which the two vertices on the left side of the document protrude substantially toward the lower left corner. The state (FIG. 37H) is representative.

一方、図38の(A)〜(D)は、検出された直線が2本以下の場合の一例を示すもので、1つの頂点のみが撮像範囲内に存在している。このような場合、求められた直線式の交点に基づいて矩形状の原稿の頂点座標の全てを特定することはできないので、画像検査装置5はエラーとして処理を停止する。なお、このようなケースであっても、精度上の問題が残るものの、たとえば倍率関係などから全ての頂点座標を特定することは可能である。ただしそのためには、複雑な処理を要するので、本実施形態では採用せず、前述のようにエラーとする。   On the other hand, (A) to (D) of FIG. 38 show an example in which the number of detected straight lines is two or less, and only one vertex exists in the imaging range. In such a case, it is not possible to specify all of the vertex coordinates of the rectangular document based on the obtained straight-line intersection, so the image inspection apparatus 5 stops the processing as an error. Note that, even in such a case, although there is a problem in accuracy, it is possible to specify all the vertex coordinates from, for example, a magnification relationship. However, since this requires complicated processing, it is not adopted in this embodiment, and an error is generated as described above.

以下、この第3実施形態の処理を実現する装置構成や処理手順について、具体例を参照しつつ、詳しく説明する。   Hereinafter, an apparatus configuration and a processing procedure for realizing the processing of the third embodiment will be described in detail with reference to specific examples.

図39は、第3実施形態の非検査領域特定処理部120の一構成例を示すブロック図である。第3実施形態の非検査領域特定処理部120は、先ずエッジ有効部検出部124の構成が第1実施形態とは異なり、エッジ抽出部122により抽出されたエッジ部分に対してエッジ追跡を行なうことで基準のエッジ画素を見つけるエッジ追跡部124aと、基準のエッジ画素に連続するエッジ画素の数をカウントするエッジ画素カウント部124bとを有する。このエッジ有効部検出部124は、エッジ画素カウント部124bによってエッジ画素が所定数以上ほぼ連続して直線状にカウントされたとき、その部分をエッジ有効部として検出する。   FIG. 39 is a block diagram illustrating a configuration example of the non-inspection area specifying processing unit 120 according to the third embodiment. The non-inspection area identification processing unit 120 according to the third embodiment is different from the first embodiment in that the configuration of the edge valid part detection unit 124 is different from that of the first embodiment in that it performs edge tracing on the edge portion extracted by the edge extraction unit 122 And an edge pixel counting unit 124b that counts the number of edge pixels continuous with the reference edge pixel. When the edge pixel counting section 124b counts the edge pixels almost continuously in a straight line at a predetermined number or more, the edge effective portion detection section 124 detects that portion as an edge effective section.

また、この第3実施形態の非検査領域特定処理部120は、非検査領域特定部130の構成が第1実施形態と異なり、はみ出し頂点座標推定処理部135を備えている。はみ出し頂点座標推定処理部135は、撮像範囲内に存在する原稿辺縁をなす直線数が3本であって、そのままでは、撮像範囲外の原稿頂点が全部算出できない場合に、残りの頂点座標を推測する。   Further, the non-inspection area specifying processing unit 120 of the third embodiment is different from the first embodiment in the configuration of the non-inspection area specifying unit 130, and includes a protruding vertex coordinate estimation processing unit 135. The protruding vertex coordinate estimation processing unit 135 calculates the coordinates of the remaining vertices when the number of straight lines forming the document margin existing in the imaging range is three and all the vertices of the document outside the imaging range cannot be calculated. Infer.

また、非検査領域特定部130は、原稿頂点設定処理部132により求められる撮像範囲内の原稿頂点とはみ出し頂点座標推定処理部135により推測される原稿頂点とを参照して、頂点座標が撮像範囲からはみ出していると判定された原稿頂点についての撮像範囲との境界部分を境界部分特定処理部136にて特定するとともに、この境界座標と撮像範囲外の原稿頂点とを参照して、原稿の撮像範囲外を非検査領域に設定する。   The non-inspection area specifying unit 130 refers to the document vertices within the imaging range obtained by the document vertex setting processing unit 132 and the document vertices estimated by the protruding vertex coordinate estimation processing unit 135, and determines the vertex coordinates in the imaging range. A boundary portion between the document vertex determined to be out of the image and the imaging range is specified by the boundary portion specification processing unit 136, and the document coordinates are determined by referring to the boundary coordinates and the document vertex outside the imaging range. The outside of the range is set as the non-inspection area.

図40は、第3実施形態の非検査領域特定処理部120における処理手順の概要を示すフローチャートである。画像検査装置5は、基本的には、第1実施形態の図10に示した処理手順と概ね同じ手順を実行する。   FIG. 40 is a flowchart illustrating an outline of a processing procedure in the non-inspection area specifying processing unit 120 according to the third embodiment. The image inspection device 5 basically executes substantially the same procedure as the processing procedure shown in FIG. 10 of the first embodiment.

たとえば、先ず、エッジ抽出部122は、第1実施形態のステップS200と同様に、透視変換部116により透視変換された撮像画像からエッジ成分を抽出する(S4000)。これにより、図9(A)〜(D)に示したようなエッジ抽出画像が得られる。   For example, first, similarly to step S200 of the first embodiment, the edge extraction unit 122 extracts an edge component from the captured image perspective-transformed by the perspective transformation unit 116 (S4000). As a result, an edge-extracted image as shown in FIGS. 9A to 9D is obtained.

次に、エッジ有効部検出部124は、ステップS4000により上下左右の方向ごとに抽出されたエッジ情報を参照して、撮像範囲の上下左右のそれぞれの端からエッジ画素をサーチすることで1つのエッジ画素を特定する(この処理をエッジ有効部検出処理という)(S4002)。また、エッジ有効部直線式算出部126は、エッジ有効部検出部124により検出されたエッジ有効部に基づいて原稿の頂点座標を特定するために、矩形状の原稿範囲の辺縁をなす直線式を求める(この処理をエッジ有効部直線式算出処理という)(S4004)。   Next, the edge valid part detection unit 124 searches for edge pixels from each of the upper, lower, left, and right edges of the imaging range with reference to the edge information extracted for each of the up, down, left, and right directions in step S4000, thereby obtaining one edge. A pixel is specified (this process is referred to as an edge effective portion detection process) (S4002). In addition, the edge-effective-portion straight-line calculation unit 126 determines a vertex coordinate of the document based on the edge-effective portion detected by the edge-effective-portion detection unit 124. (This process is referred to as an edge effective part straight line formula calculation process) (S4004).

詳細は後述するが、このエッジ有効部特定処理と直線式算出処理は、第1実施形態と異なる。以下、エッジ有効部検出部124によるエッジ有効部検出処理と、エッジ有効部直線式算出部126によるエッジ有効部直線式算出処理とを纏めて、原稿範囲特定処理という。   Although details will be described later, the edge effective portion specifying process and the straight line expression calculating process are different from those of the first embodiment. Hereinafter, the edge effective part detection processing by the edge effective part detection unit 124 and the edge effective part linear expression calculation processing by the edge effective part linear expression calculation unit 126 are collectively referred to as a document range identification process.

次に、原稿頂点設定処理部132は、エッジ有効部直線式算出部126により算出された直線式を参照して撮像画像における原稿の頂点座標を特定する(S4006)。   Next, the document vertex setting processing unit 132 specifies the vertex coordinates of the document in the captured image with reference to the linear equation calculated by the edge effective unit linear equation calculating unit 126 (S4006).

はみ出し場所判定処理部134は、原稿頂点設定処理部132により設定された頂点座標が撮像範囲からはみ出しているか否かと、撮像範囲内に存在する原稿辺縁をなす直線数が何本であるのかを判定する(S4008)。   The protruding place determination processing unit 134 determines whether or not the vertex coordinates set by the document vertex setting processing unit 132 protrude from the imaging range, and how many straight lines forming the document edge existing in the imaging range. A determination is made (S4008).

はみ出し頂点座標推定処理部135は、撮像範囲内に存在する原稿辺縁をなす直線数が3本であって、そのままでははみ出した頂点が全部算出できない場合に、残りの頂点を推算する(S4010)。   The protruding vertex coordinate estimation processing unit 135 estimates the remaining vertices when the number of straight lines forming the document margin existing in the imaging range is three and all protruding vertices cannot be calculated as it is (S4010). .

次に、境界部分特定処理部136は、第1実施形態と同様に、はみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点についての撮像範囲との境界部分を特定する(S4012)。この際、境界部分特定処理部136は、エッジ有効部検出部124により検出された、原稿の有効なエッジ部分の両端の座標が、撮像画像のどの端縁に接するのかを判定し、その判定結果に基づいて、原稿がはみ出した方向を判断することで原稿辺縁と撮像範囲との交点座標を特定する。   Next, similarly to the first embodiment, the boundary part specifying processing unit 136 determines a boundary part between the document vertex and the image vertex whose vertex coordinates are determined to protrude from the image capturing range by the protruding place determination processing unit 134. It is specified (S4012). At this time, the boundary portion specification processing unit 136 determines which edge of the captured image is in contact with the coordinates of both ends of the valid edge portion of the document detected by the edge valid portion detection unit 124, and determines the determination result. Then, the coordinates of the intersection between the document margin and the imaging range are specified by determining the direction in which the document protrudes.

非検査領域設定部138は、その特定された境界部分を示す座標情報とはみ出し場所判定処理部134により頂点座標が撮像範囲からはみ出していると判定された原稿頂点の座標情報とに基づいて、原稿の撮像範囲からはみ出している非検査領域を画定する(S4014)。非検査領域設定部138は、この画定した非検査領域を示す情報をデータ格納部300に登録する。以下、境界部分特定処理部136による境界部分特定処理と非検査領域設定部138による非検査部設定処理とを纏めて、非検査領域特定処理ともいう。   The non-inspection area setting unit 138 outputs the document based on the coordinate information indicating the specified boundary portion and the coordinate information of the document vertex whose vertex coordinates are determined to be outside the imaging range by the protruding place determination processing unit 134. The non-inspection area protruding from the imaging range is defined (S4014). The non-inspection area setting unit 138 registers information indicating the defined non-inspection area in the data storage unit 300. Hereinafter, the boundary part specifying processing by the boundary part specifying processing unit 136 and the non-inspection part setting processing by the non-inspection area setting unit 138 are collectively referred to as non-inspection area specification processing.

図41は、第3実施形態におけるエッジ有効部検出部124がエッジ画素をサーチする際のサーチの始点とサーチ方向との関係、並びにエッジ有効部検出部124が検知した最初のエッジ画素を始点としてエッジ有効部直線式算出部126がエッジ追跡をする方向の関係を説明する図である。   FIG. 41 is a diagram illustrating a relationship between a search start point and a search direction when the edge valid part detection unit 124 in the third embodiment searches for an edge pixel, and the first edge pixel detected by the edge valid part detection unit 124 as a start point. FIG. 7 is a diagram illustrating a relationship between directions in which an edge valid part linear expression calculation unit 126 performs edge tracking.

第3実施形態では、エッジ有効部検出部124は、図41(A)に示すように、横方向の画素位置をi、縦方向の画素位置をjとして、透視変換後の撮像範囲の左端、上端、右端、下端のそれぞれから、エッジ画素をサーチする。ここで、原稿が撮像範囲に対して傾いているが、完全に撮像範囲に入っている場合を図41(A)に示す。第3実施形態では、透視変換後の撮像画像範囲(横方向最大サイズph、縦方向最大サイズpv)をスキャン範囲として処理を行なうものとする。   In the third embodiment, as shown in FIG. 41A, the edge effective portion detection unit 124 sets the horizontal pixel position as i and the vertical pixel position as j, and sets the left end of the imaging range after the perspective transformation as An edge pixel is searched from each of the upper end, the right end, and the lower end. Here, FIG. 41A shows a case where the original is inclined with respect to the imaging range, but is completely within the imaging range. In the third embodiment, it is assumed that processing is performed using a captured image range (the maximum horizontal size ph and the maximum vertical size pv) after perspective transformation as a scan range.

この場合において、エッジ有効部検出部124は、左端からサーチをする場合、サーチの始点は原点(0,0)として、エッジ画素が見つかるまで、先ず+i方向へ透視変換後の撮像画像範囲の横方向最大サイズphまでサーチする処理を、縦方向最大サイズpvまで繰り返す。こうすることで、図中に点aで示す原稿頂点のエッジ画素が見つかる。これを受けて、エッジ有効部直線式算出部126は、点aを基準として、左上90度の範囲および右上90度の範囲にエッジ追跡を行なうことで、それぞれ点aと繋がる直線をサーチする。左下から右上方向へサーチして最初のエッジ画素a(撮像範囲内にあれば原稿頂点となる)を見つけ、このエッジ画素aを始点とし、さらに上側(180度の範囲)にサーチすることで、原稿頂点を形成する2つの直線をなすエッジ画素を追跡する趣旨である。   In this case, when performing a search from the left end, the edge valid part detection unit 124 sets the starting point of the search as the origin (0, 0) and first sets the horizontal direction of the captured image range after perspective transformation in the + i direction until an edge pixel is found. The process of searching up to the maximum size ph in the direction is repeated up to the maximum size pv in the vertical direction. In this way, an edge pixel at the vertex of the document indicated by a point a in the figure is found. In response to this, the edge-effective-portion straight-line-type calculating unit 126 searches for a straight line connected to the point a by performing edge tracing in a range of the upper left 90 degrees and a range of the upper right 90 degrees with reference to the point a. By searching from the lower left to the upper right to find the first edge pixel a (the document vertex if it is within the imaging range), the edge pixel a is used as the starting point, and the search is further performed upward (in a range of 180 degrees). This is to pursue two straight edge pixels forming the vertex of the document.

同様に、左上から右下方向へサーチして最初のエッジ画素b(撮像範囲内にあれば原稿頂点となる)を見つけ、エッジ画素bを始点として、さらに右側(180度の範囲)にサーチすることで、原稿頂点を形成する2つの直線をなすエッジ画素を追跡する。このため、エッジ有効部検出部124は、サーチの始点を原点(0,pv)として上端からサーチを開始し、エッジ画素が見つかるまで、先ず−j方向へj=0までサーチする処理を、横方向最大サイズphまで繰り返す。こうすることで、図中に点bで示す原稿頂点のエッジ画素が見つかる。これを受けて、エッジ有効部直線式算出部126は、点bを基準として、左上90度の範囲および右上90度の範囲にエッジ追跡を行なうことで、それぞれ点bと繋がる直線をサーチする。   Similarly, a search is performed from the upper left to the lower right to find the first edge pixel b (or the top of the document if it is within the imaging range), and further to the right (a range of 180 degrees) starting from the edge pixel b. Thus, the edge pixels that form two straight lines that form the vertex of the document are tracked. For this reason, the edge valid part detection unit 124 starts the search from the upper end with the start point of the search as the origin (0, pv), and performs a process of searching until j = 0 in the −j direction until an edge pixel is found. Repeat up to the maximum size ph in the direction. By doing so, an edge pixel at the vertex of the original indicated by a point b in the figure is found. In response to this, the edge-effective-portion straight-line-type calculating unit 126 searches for a straight line connected to the point b by performing edge tracing in a range of 90 degrees in the upper left and a range of 90 degrees in the upper right based on the point b.

また、右上から左下方向へサーチして最初のエッジ画素c(撮像範囲内にあれば原稿頂点となる)を見つけ、エッジ画素cを始点として、さらに下側(180度の範囲)にサーチすることで、原稿頂点を形成する2つの直線をなすエッジ画素を追跡する。このため、エッジ有効部検出部124は、サーチの始点を原点(ph,pv)として右端からサーチを開始し、エッジ画素が見つかるまで、先ず−i方向へi=0までサーチする処理を、j=0まで繰り返す。こうすることで、図中に点c示す原稿頂点のエッジ画素が見つかる。これを受けて、エッジ有効部直線式算出部126は、点cを基準として、左上90度の範囲および右上90度の範囲にエッジ追跡を行なうことで、それぞれ点cと繋がる直線をサーチする。   In addition, a search is made from the upper right to the lower left to find the first edge pixel c (the document vertex is located within the imaging range), and the edge pixel c is used as a starting point to search further downward (in a range of 180 degrees). , The edge pixels forming two straight lines forming the vertex of the document are tracked. For this reason, the edge valid part detecting unit 124 starts the search from the right end with the starting point of the search as the origin (ph, pv), and searches for i = 0 in the −i direction until an edge pixel is found, j Repeat until = 0. By doing so, the edge pixel at the vertex of the original indicated by the point c in the figure is found. In response to this, the edge-effective-portion straight-line calculation unit 126 searches for a straight line connected to the point c by performing edge tracing in the range of the upper left 90 degrees and the upper right 90 degrees based on the point c.

また、右下から左上方向へサーチして最初のエッジ画素d(撮像範囲内にあれば原稿頂点となる)を見つけ、エッジ画素dを始点として、さらに左側(180度の範囲)にサーチすることで、原稿頂点を形成する2つの直線をなすエッジ画素を追跡する。このため、エッジ有効部検出部124は、サーチの始点を原点(ph,0)として右端からサーチを開始し、エッジ画素が見つかるまで、先ず+j方向へ透視変換後の撮像画像範囲の縦方向最大サイズpvまでサーチする処理を、i=0まで繰り返す。こうすることで、図中に点dで示す原稿頂点のエッジ画素が見つかる。これを受けて、エッジ有効部直線式算出部126は、点dを基準として、左上90度の範囲および左下90度の範囲にエッジ追跡を行なうことで、それぞれ点dと繋がる直線をサーチする。   Further, a search is performed from the lower right to the upper left to find the first edge pixel d (the document vertex is located within the imaging range), and further searching leftward (in a range of 180 degrees) with the edge pixel d as a starting point. , The edge pixels forming two straight lines forming the vertex of the document are tracked. For this reason, the edge valid part detecting unit 124 starts the search from the right end with the starting point of the search as the origin (ph, 0), and first, until the edge pixel is found, the maximum in the vertical direction of the captured image range after the perspective transformation in the + j direction. The process of searching up to the size pv is repeated until i = 0. By doing so, an edge pixel of the document vertex indicated by a point d in the figure is found. In response to this, the edge-effective-portion straight-line-type calculating unit 126 searches for a straight line connected to the point d by performing edge tracing in the range of the upper left 90 degrees and the lower left 90 degrees based on the point d.

以上の処理手順を纏めた図表が、図41の(B),(C)である。後述するエッジ有効部検出処理の各処理ステップでは、エッジサーチ方向と、見つけられた最初のエッジを始点とする直線を求める際、この図41の(B),(C)に示す各条件を適用して処理を行なう。なお、図41(C)に示すように、エッジ有効部検出部124が見つけたエッジ画素a,b,c,dの何れかを始点とする、エッジ有効部直線式算出部126によるエッジ追跡の際には、180度の範囲を45度の範囲に分けてサーチする。   Charts summarizing the above processing procedures are (B) and (C) in FIG. In each processing step of the edge effective portion detection processing described later, when finding a straight line starting from the edge search direction and the first edge found, the conditions shown in FIGS. 41B and 41C are applied. And perform the processing. As shown in FIG. 41C, the edge tracking by the edge valid part linear expression calculating unit 126 starting from any one of the edge pixels a, b, c, and d found by the edge valid part detecting unit 124 is performed. In this case, the search is performed by dividing the range of 180 degrees into the range of 45 degrees.

図42は、エッジ有効部検出部124のエッジ追跡部124aによるエッジ追跡の各方向とエッジ追跡フィルタとを説明する図である。第3実施形態では、図42(A)に示すように、横方向の画素位置をi、縦方向の画素位置をjとして、右上、左上、左下、右下のそれぞれ(各90度の範囲)について、45度ずつの2つに分けて、全体としては8つの方向についてのエッジ追跡を考える。ただし、エッジ有効部直線式算出部126が行なうエッジ追跡処理に際しては、図41に示したように、180度分のサーチであればよく、8つの方向のうちの順次隣接する4つの方向にエッジ追跡する。   FIG. 42 is a diagram illustrating each direction of edge tracing by the edge tracing unit 124a of the edge valid part detecting unit 124 and an edge tracing filter. In the third embodiment, as shown in FIG. 42A, the horizontal pixel position is i and the vertical pixel position is j, each of upper right, upper left, lower left, and lower right (each 90 degree range). Is divided into two at 45 degrees, and edge tracking in eight directions as a whole is considered. However, in the edge tracing process performed by the edge valid part linear expression calculating unit 126, as shown in FIG. 41, a search for 180 degrees may be performed, and the edge tracing may be sequentially performed in four directions among eight directions. Chase.

右上1、右上2、左上1、左上2、左下1、左下2、右下1、右下2の各方向に対応したエッジ追跡フィルタは、3×3画素のエッジ追跡フィルタを適用する。よって、たとえば右上1方向にエッジ追跡するエッジ直線検出処理については、図42(B)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i,j+1)と(i+1,j+1)にエッジがあるかどうかを判定する。また、右上2方向については、図42(C)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i+1,j)と(i+1,j+1)にエッジがあるかどうかを判定する。   The edge tracking filter corresponding to each of the directions of upper right 1, upper right 2, upper left 1, upper left 2, lower left 1, lower left 2, lower right 1, lower right 2 applies a 3 × 3 pixel edge tracking filter. Therefore, for example, in the edge straight line detection processing for edge tracing in the upper right direction, the edge tracing filter shown in FIG. 42B is applied, and (i, j + 1) and (i + 1) are applied to the target pixel (i, j). , J + 1) has an edge. In the upper right two directions, the edge tracking filter shown in FIG. 42C is applied to determine whether or not there is an edge at (i + 1, j) and (i + 1, j + 1) with respect to the target pixel (i, j). Is determined.

同様に、左上1方向については、図42(D)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i,j+1)と(i−1,j+1)にエッジがあるかどうかを判定する。また、左上2方向については、図42(E)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i−1,j)と(i−1,j+1)にエッジがあるかどうかを判定する。   Similarly, in the upper left direction, the edge tracking filter shown in FIG. 42 (D) is applied, and an edge is formed at (i, j + 1) and (i−1, j + 1) with respect to the target pixel (i, j). Determine if there is. In the upper left two directions, the edge tracking filter shown in FIG. 42 (E) is applied, and the edge (i−1, j) and the edge (i−1, j + 1) for the target pixel (i, j) are obtained. Determine if there is.

左下1方向については、図42(F)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i−1,j)と(i−1,j−1)にエッジがあるかどうかを判定する。また、左下2方向については、図42(G)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i,j−1)と(i−1,j−1)にエッジがあるかどうかを判定する。   In the lower left direction, an edge tracking filter shown in FIG. 42 (F) is applied, and an edge is added to (i−1, j) and (i−1, j−1) for the target pixel (i, j). Determine if there is. In the lower left two directions, the edge tracking filter shown in FIG. 42 (G) is applied, and (i, j−1) and (i−1, j−1) are applied to the target pixel (i, j). It is determined whether or not there is an edge.

右下1方向については、図42(H)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i,j−1)と(i+1,j−1)にエッジがあるかどうかを判定する。また、右下2方向については、図42(I)に示すエッジ追跡フィルタを適用して、注目画素(i,j)に対して(i+1,j)と(i+1,j−1)にエッジがあるかどうかを判定する。   In the lower right direction, the edge tracking filter shown in FIG. 42 (H) is applied, and the edge is located at (i, j−1) and (i + 1, j−1) with respect to the target pixel (i, j). Determine if there is. In the two lower right directions, an edge tracking filter shown in FIG. 42 (I) is applied, and edges (i + 1, j) and (i + 1, j-1) for the pixel of interest (i, j). Determine if there is.

このように、エッジ有効部直線式算出部126は、360度を8つの方向に分けて、各45度の範囲内に存在する直線をなすエッジ画素を追跡し、その結果に基づいて、その直線式を求める。   As described above, the edge-effective-portion straight-line calculation unit 126 divides 360 degrees into eight directions, tracks the edge pixels that form a straight line that exists within the range of 45 degrees, and, based on the result, determines the straight line. Find the formula.

図43は、第3実施形態におけるエッジ有効部検出処理とエッジ有効部直線式算出処理の手順の概要を示すフローチャートである。第3実施形態においては、先ず、エッジ有効部検出部124のエッジ追跡部124aは、左端からのエッジ有効部検出処理を行ない(S4101)、さらにこの結果に基づいて、右上方向および左上方向へエッジ追跡をして、エッジ画素カウント部124bによりエッジ画素が所定数以上ほぼ連続して直線状にカウントされたとき、その部分をエッジ有効部として検出する。エッジ有効部直線式算出部126は、このエッジ有効部についての直線式を算出する(S4102)。これらの処理を纏めて、左端からの原稿範囲特定処理という。   FIG. 43 is a flowchart illustrating an outline of a procedure of an edge effective portion detection process and an edge effective portion linear expression calculation process in the third embodiment. In the third embodiment, first, the edge tracking unit 124a of the edge valid part detecting unit 124 performs an edge valid part detecting process from the left end (S4101), and further, based on the result, moves the edge in the upper right direction and the upper left direction. When the tracking is performed and the edge pixels are counted in a straight line substantially continuously by a predetermined number or more by the edge pixel counting unit 124b, the portion is detected as an effective edge portion. The edge-effective-portion straight-line formula calculation unit 126 calculates a straight-line formula for this edge-effective portion (S4102). These processes are collectively referred to as a document range specifying process from the left end.

同様に、エッジ有効部検出部124は、上端からのエッジ有効部検出処理を行ない(S4103)、この結果に基づいて、さらに右上方向および右下方向へエッジ追跡をしてエッジ有効部を検出し、エッジ有効部直線式算出部126はこのエッジ有効部の直線式を算出する(S4104)。これらの処理を纏めて、上端からの原稿範囲特定処理という。   Similarly, the edge valid part detection unit 124 performs edge valid part detection processing from the upper end (S4103), and based on the result, further performs edge tracking in the upper right direction and the lower right direction to detect an edge valid part. The edge effective part straight line formula calculation unit 126 calculates the straight line equation of the edge effective part (S4104). These processes are collectively referred to as a document range specifying process from the upper end.

次に、エッジ有効部検出部124は、右端からのエッジ有効部検出処理を行ない(S4105)、この結果に基づいて、さらに右下方向および左下方向へエッジ追跡をしてエッジ有効部を検出し、エッジ有効部直線式算出部126はこのエッジ有効部の直線式を算出する(S4106)。これらの処理を纏めて、右端からの原稿範囲特定処理という。   Next, the edge valid part detecting unit 124 performs an edge valid part detecting process from the right end (S4105), and based on the result, further performs edge tracking in the lower right direction and the lower left direction to detect an edge valid part. The edge effective part straight line formula calculation unit 126 calculates the straight line formula of the edge effective part (S4106). These processes are collectively referred to as a document range specification process from the right end.

最後に、エッジ有効部検出部124は、下端からのエッジ有効部検出処理を行ない(S4107)、この結果に基づいて、左上方向および左下方向へエッジ追跡をしてエッジ有効部を検出し、エッジ有効部直線式算出部126はこのエッジ有効部の直線式を算出する(S4108)。これらの処理を纏めて、下端からの原稿範囲特定処理という。   Finally, the edge valid part detecting unit 124 performs an edge valid part detecting process from the lower end (S4107), and based on the result, performs edge tracking in the upper left direction and the lower left direction to detect an edge valid part, and The valid part straight line formula calculation unit 126 calculates the straight line formula of the edge valid part (S4108). These processes are collectively referred to as a document range specifying process from the lower end.

図44は、原稿範囲特定処理(エッジ有効部検出処理+エッジ直線式算出処理)の手順の詳細例を示すフローチャートである。先ずここでは、左端からの原稿範囲特定処理(S4101,S4102)の例で説明する。なお、前述のように、透視変換後の撮像画像範囲をカバーするように(0,0)〜(ph,pv)をスキャン範囲として処理を行なうものとする。   FIG. 44 is a flowchart illustrating a detailed example of the procedure of the document range specifying process (the edge effective portion detection process + the edge straight line calculation process). First, here, an example of the document range specifying process from the left end (S4101, S4102) will be described. As described above, the processing is performed with the scan range from (0, 0) to (ph, pv) so as to cover the captured image range after the perspective transformation.

エッジ追跡部124aは、先ず画素位置(i,j)をスキャン初期値(0,0)にセットし(S4201)、この後、jを撮像画像の縦画素分pvだけスキャンするまで、右方向に画素を後述のようにスキャンしていくことで、左端からサーチした場合における最初のエッジ画素を見つける(S4201)。jが撮像画像の縦画素分スキャンした場合は、左端からのエッジ有効部検出処理を終了させる(S4202−Yes)。   The edge tracking unit 124a first sets the pixel position (i, j) to the scan initial value (0, 0) (S4201), and thereafter, sets j in the right direction until scanning is performed for the vertical pixels pv of the captured image. By scanning the pixels as described later, the first edge pixel when searching from the left end is found (S4201). If j has been scanned by the number of vertical pixels of the captured image, the process of detecting an edge effective portion from the left end is terminated (S4202-Yes).

jを撮像画像の縦画素分スキャンしていない場合(S4202−No)、エッジ追跡部124aは、スキャン中の画素(i,j)がエッジ画素であるか否かを判定する(S4203)。画素(i,j)がエッジ画素でない場合には(S4203−No)は、横方向の画素位置iを“1”加算する(S4204)。   If j has not been scanned for vertical pixels of the captured image (S4202-No), the edge tracking unit 124a determines whether the pixel (i, j) being scanned is an edge pixel (S4203). If the pixel (i, j) is not an edge pixel (S4203-No), "1" is added to the pixel position i in the horizontal direction (S4204).

エッジ追跡部124aは、このときの横方向の画素位置iが撮像画像の横画素分スキャンしてない場合(S4205−No)は、ステップS4203に戻り、上記と同様の処理を繰り返す。一方、このときの横方向の画素位置iが撮像画像の横画素分スキャンすることになる場合(S4205−Yes)は、エッジ追跡部124aは、縦方向の画素位置jを“1”加算して(S4206)、横方向の画素位置iを初期値“0”に設定し、ステップS4203に戻り、上記と同様の処理を繰り返す(S4207)。   If the horizontal pixel position i at this time has not been scanned by the horizontal pixels of the captured image (S4205-No), the edge tracking unit 124a returns to step S4203 and repeats the same processing as described above. On the other hand, when the horizontal pixel position i at this time is to be scanned by the horizontal pixels of the captured image (S4205-Yes), the edge tracking unit 124a adds “1” to the vertical pixel position j. (S4206), the pixel position i in the horizontal direction is set to the initial value “0”, the process returns to step S4203, and the same processing as described above is repeated (S4207).

エッジ追跡部124aは、画素(i,j)がエッジと判定した場合(S4203−Yes)は、さらに、以下のように右上方向および左上方向へエッジ追跡をして原稿辺縁をなす有効エッジ部を特定し、エッジ有効部直線式算出部126はその有効エッジ部の直線検出処理を行なう。   If the pixel (i, j) is determined to be an edge (S4203-Yes), the edge tracing unit 124a further performs edge tracing in the upper right direction and the upper left direction as described below, and forms an effective edge portion forming a document margin as follows. Is specified, and the edge effective part straight line type calculation unit 126 performs a straight line detection process of the effective edge part.

具体的には、先ず、エッジ追跡部124aは、linecount を“0”に設定した後(S4208)、検知されているエッジ画素(i,j)を始点として、さらに上側にエッジ追跡を行なうことで、直線をなす有効エッジ画素を見つける。この際には、前述のように45度ずつに分けてサーチするため、先ず、右上1方向にエッジ追跡するエッジ直線検出処理(S4209)、右上2向にエッジ追跡するエッジ直線検出処理(S4210)、左上1方向にエッジ追跡するエッジ直線検出処理(S4211)、左上2方向にエッジ追跡するエッジ直線検出処理(S4212)の順番で行なう。   Specifically, first, after setting the linecount to “0” (S4208), the edge tracking unit 124a performs edge tracking further upward starting from the detected edge pixel (i, j). , Find a valid edge pixel forming a straight line. In this case, as described above, since the search is performed at 45 ° intervals, first, an edge straight line detection process for tracing edges in the upper right direction (S4209), and an edge straight line detection process for tracing edges in the upper right direction (S4210) The edge straight line detection processing for tracking the edge in the upper left direction (S4211) and the edge straight line detection processing for tracking the edge in the upper left direction (S4212) are performed in this order.

ステップS4212の処理が終了後、他のエッジ直線を検出するために、エッジ追跡部124aは、希望に応じて(S4213−YES)、所定の条件に従ってエッジ追跡再開画素位置を見つけ(詳しくは後述する)、このエッジ追跡再開画素位置を始点として、エッジ追跡開始座標調整処理を行なう(S4214)。なお、最初は必ずエッジ追跡開始座標調整処理を行なうようにしておき(S4213−YES)、エラーが起きたときにはエッジ追跡開始座標調整処理を行なわないようにして処理を再開させてもよい(S4213−NO。また、はみ出し具合を作業者が判断して、はみ出しのある撮像範囲の端縁側からのサーチ時のみエッジ追跡開始座標調整処理を行なわないようにして設定してもよい(S4213−NO)。   After the process of step S4212 is completed, the edge tracking unit 124a finds a pixel position for restarting edge tracking according to a predetermined condition as desired (S4213-YES) to detect another edge straight line (details will be described later). ), The edge tracking start coordinate adjustment processing is performed with the edge tracking restart pixel position as a starting point (S4214). Note that the edge tracking start coordinate adjustment processing may be performed first (S4213-YES), and the processing may be restarted without performing the edge tracking start coordinate adjustment processing when an error occurs (S4213-). In addition, the operator may determine the degree of protrusion, and may set so that the edge tracking start coordinate adjustment processing is not performed only when searching from the edge side of the protruding imaging range (S4213-NO).

以上のように、左端からのエッジ有効部検出処理(S4101)の概要について説明したが、他の上端、右端、下端からについては、図41(B)および図41(B)に示した図表に従って処理ステップの内容を変える。たとえば、上端からのエッジ有効部検出処理S4102の場合は、エッジ追跡部124aは、(i,j)=(0,pv)の点から右下方向に、図41(B)の図表に示されるステップS4201〜S4207の処理内容に従って、画素をスキャンしていく。   As described above, the outline of the edge effective portion detection processing from the left end (S4101) has been described. From the other upper end, right end, and lower end, according to the charts shown in FIGS. 41 (B) and 41 (B). Change the content of a processing step. For example, in the case of the edge valid part detection processing S4102 from the upper end, the edge tracking unit 124a is shown in the chart of FIG. 41B from the point (i, j) = (0, pv) to the lower right. Pixels are scanned according to the processing contents of steps S4201 to S4207.

また、エッジ有効部検出部124は、エッジ追跡部124aにより検知された最初のエッジ画素を始点として、図41(C)の図表に示されるステップS4209〜S4212の追跡方向に従って、右上1→右上2→右下1→右下2の順に各方向にエッジ追跡をして原稿辺縁をなす有効エッジ部を特定し、エッジ有効部直線式算出部126はその有効エッジ部の直線検出処理を行なう。右端および下端からについては説明を割愛する。   In addition, the edge valid part detection unit 124 starts from the first edge pixel detected by the edge tracking unit 124a as a starting point and follows the tracking direction of steps S4209 to S4212 shown in the table of FIG. Edges are traced in each direction in the order of → lower right 1 → lower right 2 to identify an effective edge portion forming the edge of the document, and the edge effective portion straight line type calculating section 126 performs straight line detection processing of the effective edge portion. The description from the right end and the lower end is omitted.

図45は、エッジ追跡部124aによる、所定方向にエッジ追跡するエッジ直線検出処理の概要を示すフローチャートである。ここでは、図44に示したステップS4209の右上1方向の例で説明する。   FIG. 45 is a flowchart illustrating an outline of an edge straight line detection process of performing edge tracking in a predetermined direction by the edge tracking unit 124a. Here, a description will be given of an example in the upper right direction of step S4209 shown in FIG.

エッジ追跡部124aは、先ず、図42(B)に示したエッジ追跡フィルタを適用して、右上1方向に、すなわち注目画素(i,j)に対して(i,j+1)と(i+1,j+1)の方向にエッジ追跡処理を行なう(S4500)。   First, the edge tracking unit 124a applies the edge tracking filter shown in FIG. 42 (B) to the upper right direction, that is, (i, j + 1) and (i + 1, j + 1) for the target pixel (i, j). ) Is performed (S4500).

エッジ画素カウント部124bはエッジ追跡部124aがエッジ追跡を行なったカウント数count を監視しており、このカウント数count が予め定めておいた閾値α以上の場合(S4530−Yes)、エッジ有効部直線式算出部126は、直線をなすエッジ画素を所定量α以上検知できたものとして、エッジ有効部直線式算出処理(詳細は後述する)を行ない(S4540)、その後、エッジ有効部検出部124は、エッジ有効部直線式重複判定処理(詳細は後述する)を行なう(S4560)。   The edge pixel counting unit 124b monitors the count number count for which the edge tracking unit 124a has performed the edge tracking, and when the count number count is equal to or larger than a predetermined threshold α (S4530-Yes), the edge valid unit straight line The expression calculating unit 126 performs an edge effective portion straight line expression calculating process (details will be described later) assuming that the edge pixels forming the straight line have been detected by the predetermined amount α or more (S4540). Then, an edge valid part straight line overlap determination process (details will be described later) is performed (S4560).

ここで、エッジ有効部はどの程度の長さの直線を認識させるかによって閾値αを設定する必要がある。また、どの程度のはみ出し具合に対応させるかによってもαを設定する必要があり、αはph、pvに対してほぼ等しい値でも小さい値でも適切ではない。αがpv、phとほとんど等しい値であれば、エッジ有効部は検出されにくくなり、ほとんどのはみ出しに対応できないこととなるため適切ではない。また、αがph、pvに対して非常に小さい値であれば、エッジ有効部を誤検出する恐れがあるためこれも適切ではない。ここでは適度なαの一例として、ph/5もしくはpv/5のどちらか小さい値にαを設定することとする。   Here, it is necessary to set the threshold value α depending on how long a straight line is to be recognized by the edge effective portion. Further, it is necessary to set α depending on the degree of protrusion, and it is not appropriate that α is almost equal to or smaller than ph and pv. If α is almost equal to pv and ph, the edge effective portion is hard to be detected, and it is impossible to cope with most protruding portions, which is not appropriate. Further, if α is a very small value with respect to ph and pv, there is a possibility that an edge effective portion is erroneously detected, so this is not appropriate. Here, as an example of an appropriate α, α is set to a smaller value of ph / 5 or pv / 5.

エッジ有効部直線式算出部126は、エッジ有効部直線式重複判定処理の後、直線式の本数zが4本未満の場合(S4580−No)、この方向についてのエッジ有効部直線式算出処理を終了する。また直線式の本数zが4本以上の場合(S4580−Yes)、ステップS4101,S4102,S4103,S4104の何れかについてのエッジ有効部検出処理を終了する。なお、矩形状の原稿を取り扱う場合であるから、ステップS4580にて直線式の本数zが5本以上となることは、事実上はあり得ない。よって、ステップS4580での判定条件は、z=4でも構わない。   If the number z of the linear formulas is less than four after the edge valid portion straight-line overlap determination process (S4580-No), the edge valid portion straight-line formula calculation unit 126 performs the edge valid portion straight-line formula calculation process in this direction. finish. If the number z of the linear formula is four or more (S4580-Yes), the edge valid part detection processing for any one of steps S4101, S4102, S4103, and S4104 is terminated. Since a rectangular original is handled, it is virtually impossible that the number z of the linear expression becomes 5 or more in step S4580. Therefore, the determination condition in step S4580 may be z = 4.

図46は、エッジ追跡部124aによる、所定方向へのエッジ追跡処理の詳細例を示すフローチャートである。ここでは、図45に示した右上1方向(S4500)の例で説明するが、他の7つの方向については、図42に示したように、使用するエッジ追跡フィルタ(つまり追跡方向)が異なるだけで、基本的な処理手順に相違はない。   FIG. 46 is a flowchart illustrating a detailed example of edge tracking processing in a predetermined direction by the edge tracking unit 124a. Here, an example of one upper right direction (S4500) shown in FIG. 45 will be described. However, as for the other seven directions, as shown in FIG. 42, only an edge tracking filter (that is, a tracking direction) to be used is different. Thus, there is no difference in the basic processing procedure.

エッジ有効部直線式算出部126は、先ず、エッジ検出数count を“0(ゼロ)”に初期セットする(S4510)。ここで、エッジ有効部直線式算出部126は、図44に示したステップS4203から処理を引き継ぐので、この処理を開始する時点では、エッジ有効部検出部124によって画素(i,j)でエッジ画素が検出されている。そこで、エッジ有効部直線式算出部126は、次に、エッジ画素として検出された画素(i,j)の横方向画素位置iをxs_tmpに、縦方向画素位置jをys_tmpに設定する(S4512)。   First, the edge-effective-portion straight-line calculation unit 126 initially sets the number of detected edges count to “0 (zero)” (S4510). Here, the edge-effective-portion straight-line calculation unit 126 takes over the processing from step S4203 shown in FIG. 44. Therefore, at the time of starting this processing, the edge-effective-part detection unit 124 uses the edge pixel as the pixel (i, j). Has been detected. Therefore, the edge-effective-part-linear-expression calculating unit 126 sets the horizontal pixel position i of the pixel (i, j) detected as an edge pixel to xs_tmp and the vertical pixel position j to ys_tmp (S4512). .

次に、エッジ有効部直線式算出部126は、画素(i,j)を注目画素として、これに対して1画素分真上の(i,j+1)がエッジ画素であるか否かを判定する(S4514)。エッジ有効部直線式算出部126は、(i,j+1)がエッジ画素の場合(S4514−Yes)、縦方向画素位置jに“1”を加算し(S4516)、またエッジ検出数count にも“1”を加算して(S4518)、ステップS4514に戻り、引き続き同様の処理を繰り返す。   Next, the edge-effective-part-linear-expression calculating unit 126 determines whether the pixel (i, j) is a target pixel, and (i, j + 1) immediately above the pixel (i, j + 1) is an edge pixel. (S4514). When (i, j + 1) is an edge pixel (S4514-Yes), the edge valid part linear equation calculation unit 126 adds “1” to the vertical pixel position j (S4516), and also adds “1” to the edge detection number count. 1 "is added (S4518), the process returns to step S4514, and the same process is repeated.

一方、(i,j+1)がエッジ画素でない場合(S4514−No)、エッジ有効部直線式算出部126は、画素(i,j)に対して1画素分右上の(i+1,j+1)がエッジ画素であるか否かを判定する(S4520)。エッジ有効部直線式算出部126は、(i+1,j+1)がエッジ画素の場合(S4520−Yes)、横方向画素位置iと縦方向画素位置jのそれぞれに“1”を加算し(S4522)、またエッジ検出数count にも“1”を加算して(S4518)、ステップS4514に戻り、引き続き同様の処理を繰り返す。エッジ有効部直線式算出部126は、エッジ画素が検出されなくなった時点で(S4520−No)、この処理を終了する。   On the other hand, if (i, j + 1) is not an edge pixel (S4514-No), the edge-effective-part linear-expression calculating unit 126 determines that (i + 1, j + 1), which is one pixel to the upper right of the pixel (i, j), is an edge pixel. Is determined (S4520). If (i + 1, j + 1) is an edge pixel (S4520-Yes), the edge-effective-part-linear-expression calculating unit 126 adds “1” to each of the horizontal pixel position i and the vertical pixel position j (S4522), Also, “1” is added to the number of detected edges count (S4518), and the process returns to step S4514 to repeat the same processing. The edge valid part straight line type calculation part 126 ends this processing when the edge pixel is no longer detected (S4520-No).

このようにして、注目画素の位置を次のエッジ画素に順に変更しつつ、上記処理を繰り返し、注目画素(i,j)に対して(i,j+1)と(i+1,j+1)の何れにもエッジ画素が検出されなくなるまで上記のエッジ追跡処理を繰り返す。こうすることで、エッジ有効部検出部124が最初に検知したエッジ画素を始点とする、真上(90度)と右上45度の範囲内で直線をなすエッジ画素が順次追跡される。   In this way, the above process is repeated while sequentially changing the position of the target pixel to the next edge pixel, and the position of the target pixel (i, j) is changed to any of (i, j + 1) and (i + 1, j + 1). The above-described edge tracking process is repeated until no edge pixel is detected. By doing so, edge pixels that form a straight line within a range of directly above (90 degrees) and 45 degrees to the upper right, starting from the edge pixel first detected by the edge valid part detection unit 124, are sequentially tracked.

図47は、エッジ有効部直線式算出部126によるエッジ有効部直線式算出処理(S4540)の詳細例を示すフローチャートである。また、図48および図49は、この第3実施形態のエッジ追跡による直線検出処理の具体例を説明する図である。ここで、図48は、透視変換後の撮像画像範囲の右上コーナーにて、その上端と右端ではみ出した状態にあり、原稿辺縁の直線式が4本見つかる撮像画像を処理対象とする場合(4辺検出時)の事例である。また、図49は、隣接する2つの原稿頂点が撮像範囲からはみ出した状態にあり、原稿辺縁の直線式が3本見つかる撮像画像を処理対象とする場合(3辺検出時)の事例である。   FIG. 47 is a flowchart illustrating a detailed example of the edge-effective-portion straight-line calculation process (S4540) by the edge-effective-portion straight-line calculation unit 126. FIGS. 48 and 49 are diagrams illustrating a specific example of the straight line detection processing by edge tracking according to the third embodiment. Here, FIG. 48 shows a case in which a captured image in which four linear expressions of the document margin are found at the upper right corner and the upper right corner of the captured image range after the perspective transformation and four linear expressions of the document margin are found ( (At the time of detection of four sides). FIG. 49 shows an example in which two adjacent vertices of the original are protruded from the imaging range, and a captured image in which three linear expressions on the original margin are found is to be processed (at the time of detection of three sides). .

エッジ有効部直線式算出部126は、エッジ追跡を行なったカウント数count が閾値α以上の場合にエッジ有効部直線式算出処理を開始する(S4530−Yes)。そして、ここでは、“z”は、これから求めようとする直線式の本数番号として処理する。ただし、この時点では未確定(後述するステップS4572で確定される)であり、暫定的に、それまでに求められている直線式の本数と同じにしておく。よって、最初は“z=0(ゼロ)”である。後述する図50の重複判定処理によって、それまでに算出した直線式と重複しなければ、新規な直線式として割り当てられる。   The edge effective part straight line type calculation unit 126 starts the edge effective part straight line type calculation processing when the count number count of the edge tracking is equal to or larger than the threshold α (S4530-Yes). Here, "z" is processed as the number of the straight line type to be obtained from now on. However, at this point, it is undetermined (determined in step S4572 to be described later), and is temporarily set to be the same as the number of linear expressions obtained so far. Therefore, initially, “z = 0 (zero)”. If it does not overlap with the straight line formula calculated by the overlap determination process of FIG. 50 described later, it is assigned as a new straight line formula.

エッジ有効部直線式算出部126は先ず、ステップS4512で設定したxs_tmpを、z本目の直線式に関わる横方向座標位置の始点xs(z)に、ys_tmpをz本目の直線式に関わる縦方向座標位置の始点ys(z)に、またステップS4500でエッジが検出されなくなったときの(i,j)における、横方向画素位置iをz本目の直線式に関わる横方向座標位置の終点xe(z)に、縦方向画素位置jをz本目の直線式に関わる縦方向座標位置の終点ye(z)に設定する(S4542)。   First, the edge-effective-portion linear-expression calculating unit 126 sets xs_tmp set in step S4512 to the starting point xs (z) of the horizontal coordinate position related to the z-th linear formula, and ys_tmp to the vertical coordinate related to the z-th linear formula. The horizontal pixel position i at the start point ys (z) of the position and (i, j) when no edge is detected in step S4500 is the end point xe (z) of the horizontal coordinate position related to the z-th linear equation. ), The vertical pixel position j is set as the end point ye (z) of the vertical coordinate position related to the z-th linear equation (S4542).

たとえば、図48に示すように、左端からの原稿範囲特定処理にて、右上1方向にエッジ追跡して1本目の直線式を求める場合であれば、a点の座標位置を始点(xs(1),ys(1))として、原稿辺縁と撮像範囲の右端との交点dの座標位置を終点(xe(1),ye(1))とする。また、この後に、左上2方向にエッジ追跡して2本目の直線式を求める場合であれば、1本目の始点と同様に、a点の座標位置を始点(xs(2),ys(2))として、b点の座標位置を終点(xe(2),ye(2))とする。   For example, as shown in FIG. 48, in the document range specification processing from the left end, if the edge is traced in the upper right direction to obtain the first straight line equation, the coordinate position of the point a is set to the start point (xs (1 ), Ys (1)), the coordinate position of the intersection d between the document margin and the right end of the imaging range is the end point (xe (1), ye (1)). After that, if the second straight line equation is obtained by performing edge tracing in the upper left two directions, the coordinate position of the point a is set to the start point (xs (2), ys (2), as in the case of the first start point. ), The coordinate position of point b is set as the end point (xe (2), ye (2)).

次に、エッジ有効部直線式算出部126は、(xs(z),ys(z))と(xe(z),ye(z))を通る直線の傾きa(z)と切片b(z)を式(34)に従って算出する(S4544)。また、エッジ有効部直線式算出部126は、直線式yを式(35)に従って算出する(S4546)。   Next, the edge-effective-portion straight-line-expression calculating unit 126 calculates the slope a (z) and intercept b (z) of a straight line passing through (xs (z), ys (z)) and (xe (z), ye (z)). ) Is calculated according to the equation (34) (S4544). Further, the edge effective part straight line formula calculating unit 126 calculates the straight line formula y according to the formula (35) (S4546).

Figure 2004310726
Figure 2004310726

Figure 2004310726
Figure 2004310726

図50は、エッジ有効部検出部124によるエッジ有効部直線式重複判定処理(S4560)の詳細例を示すフローチャートである。   FIG. 50 is a flowchart illustrating a detailed example of the edge-effective-portion linear-type overlap determination process (S4560) by the edge-effective-portion detecting unit 124.

エッジ有効部直線式算出部126にて始めて直線式が求められた場合、すなわち直線式の本数zが0本の場合(S4562−Yes)、エッジ有効部検出部124は、本数zとlinecount のそれぞれに“1”を加算して、このエッジ有効部直線式重複判定処理処理を終了する(S4572)。   When the straight line equation is obtained for the first time in the edge effective part straight line equation calculating unit 126, that is, when the number z of the straight line equations is 0 (S4562-Yes), the edge effective part detecting unit 124 sets the number z and the linecount to Is added, and the edge valid part straight line overlap determination processing is terminated (S4572).

一方、直線式の本数zが0本でない場合(S4562−No)、エッジ有効部検出部124は、ステップS4540で算出したz本目の直線式の傾きa(z)と切片b(z)が、今まで算出した直線式の傾きa(k)と切片b(k)と重複しているかどうかを判定する。このため、エッジ有効部検出部124は先ず、オペレータkを“1”に初期セットし(S4564)、a(z)とb(z)がそれぞれa(k)とb(k)にほぼ等しいかどうかを判定する(S4568)。何れもほぼ等しければ(S4568−Yes)、今回求めた直線式は、既に求めてある直線式と重複するものとして、このエッジ有効部直線式重複判定処理処理を終了する(S4572)。   On the other hand, when the number z of the linear formulas is not 0 (S4562-No), the edge valid part detecting unit 124 calculates the slope a (z) and the intercept b (z) of the z-th linear formula calculated in step S4540, It is determined whether or not the slope a (k) and the intercept b (k) of the linear equation calculated so far overlap each other. Therefore, the edge valid part detecting unit 124 first sets the operator k to "1" (S4564), and determines whether a (z) and b (z) are substantially equal to a (k) and b (k), respectively. It is determined whether it is (S4568). If both are almost equal (S4568-Yes), it is determined that the straight line formula obtained this time overlaps with the already obtained straight line formula, and the edge valid part straight line type overlap determination processing is terminated (S4572).

何れかが等しくなければ(S4568−No)、エッジ有効部検出部124は、オペレータkに“1”を加算し(S4570)、k≦zの間、ステップS4568の判定を繰り返す。そして、今回求めた直線式の傾きa(z),切片b(z)が既知の直線式の傾きa(k),切片b(k)とそれぞれ等しくなければ、有効な直線式であるものとして、本数zとlinecount に、それぞれ“1”を加算して(S4572)、エッジ有効部直線式重複判定処理S4560を終了する。   If any one of them is not equal (S4568-No), the edge valid part detection unit 124 adds "1" to the operator k (S4570), and repeats the determination in step S4568 while k ≦ z. If the slope a (z) and the intercept b (z) of the linear equation obtained this time are not equal to the slope a (k) and the intercept b (k) of the known linear equation, respectively, it is assumed that the linear equation is an effective linear equation. Then, "1" is added to each of the number z and the linecount (S4572), and the edge valid part straight line type overlap determination processing S4560 ends.

図51は、上述のエッジ有効部直線式重複判定処理の意義を説明する図である。なお、説明を簡略化するため、ここでは、エッジ追跡開始座標調整処理(S4214)については考慮しないこととする。   FIG. 51 is a diagram for explaining the significance of the above-described edge valid part straight line overlap determination processing. Note that, in order to simplify the description, the edge tracking start coordinate adjustment processing (S4214) is not considered here.

たとえば、左端からの原稿範囲特定処理においては、右上1方向→右上2方向→左上1方向→左上2方向の順に、エッジ有効部検出部124が検出した最初のエッジ画素を始点としてエッジ追跡することでエッジ直線式を算出する。この場合、図51(A)に示すように原稿が撮像範囲に対してはみ出していなければ、エッジ有効部直線式算出部126は、以下の順に直線式を求める。   For example, in the document range specifying process from the left end, edge tracking is performed starting from the first edge pixel detected by the edge valid part detecting unit 124 in the order of upper right one direction → upper right two directions → upper left one direction → upper left two directions. Is used to calculate the edge straight line formula. In this case, as shown in FIG. 51A, if the document does not protrude from the imaging range, the edge-effective-part linear-expression calculating unit 126 obtains a linear expression in the following order.

たとえば、エッジ有効部検出部124による左端からのエッジ画素検出によって点aのエッジ画素が先ず検出される(S4101)。エッジ有効部直線式算出部126は、この点aを始点として、右上1方向および右上2方向の順にエッジ追跡を行なう(S4209,4210)。図示した例では、原稿の下長辺が撮像範囲の下端に対して45度以下となるように原稿の左下が上方向に傾いているので、右上1方向へのエッジ追跡により直線式L1が求まるが、右上2方向へのエッジ追跡では直線式は求まらない。   For example, the edge pixel of the point a is first detected by the edge pixel detection from the left end by the edge valid part detection unit 124 (S4101). The edge effective part straight line formula calculation unit 126 performs edge tracking in the upper right direction and the upper right direction starting from the point a (S4209, 4210). In the illustrated example, the lower left side of the document is inclined upward so that the lower long side of the document is not more than 45 degrees with respect to the lower end of the imaging range. Therefore, the straight line formula L1 is obtained by edge tracking in the upper right direction. However, a straight-line equation cannot be obtained in edge tracking in the upper right two directions.

次に、エッジ有効部直線式算出部126は、点aを始点として、左上1方向および左上2方向の順にエッジ追跡を行なう(S4211,4212)。図示した傾きの例では、左上1方向へのエッジ追跡では直線式は求まらず、左上2方向へのエッジ追跡により直線式L2が求まる。ここで、最初に求めた直線式L1とその後に求めた直線式L2とは、傾きおよび切片が異なるので(S4568−No)、エッジ有効部直線式算出部126は、直線式L2を有効な直線式として本数zとlinecount にそれぞれ“1”を加算する(S4572)。よって、この時点では有効な直線がL1,L2の2本となる。   Next, the edge-effective-portion straight-line calculation unit 126 performs edge tracing in the upper left direction and the upper left direction starting from the point a (S4211, 4212). In the illustrated example of the inclination, a straight line formula is not obtained in the edge tracking in the upper left direction, and a straight line formula L2 is obtained in the edge tracking in the upper left direction. Here, since the slope and intercept are different between the straight line formula L1 obtained first and the straight line formula L2 obtained thereafter (S4568-No), the edge effective part straight line formula calculation unit 126 converts the straight line formula L2 into an effective straight line. As a formula, “1” is added to each of the number z and the linecount (S4572). Therefore, at this time, the effective straight lines are L1 and L2.

この後、エッジ有効部検出部124による上端からのエッジ画素検出によって点bのエッジ画素が検出される(S4103)。エッジ有効部直線式算出部126は、この点bを始点として、右上1方向および右上2方向の順にエッジ追跡を行なう(S4209,4210)。図示した傾きの例では、右上1方向へのエッジ追跡では直線式L3が求まり、右上2方向へのエッジ追跡では直線式が求まらない。ここで、今回求めた直線式L3は、既に求めた直線式L1とは傾きが同じであるが切片が異なり、また直線式L2とは傾きおよび切片が異なるので(S4568−No)、エッジ有効部直線式算出部126は、直線式L3を有効な直線式として本数zとlinecount にそれぞれ“1”を加算する(S4572)。よって、この時点では有効な直線がL1,L2,L3の3本となる。   After that, the edge pixel of the point b is detected by the edge pixel detection from the upper end by the edge valid part detection unit 124 (S4103). With the point b as the starting point, the edge effective part straight line formula calculation part 126 performs edge tracking in the upper right one direction and the upper right two directions in this order (S4209, 4210). In the illustrated example of the inclination, the straight line formula L3 is obtained in the edge tracking in the upper right direction, and the straight line formula is not obtained in the edge tracking in the upper right direction. Here, the straight line formula L3 obtained this time has the same slope as the already obtained straight line formula L1, but a different intercept, and also has a different slope and intercept from the straight line formula L2 (S4568-No). The straight line formula calculation unit 126 adds “1” to each of the number z and linecount using the straight line formula L3 as an effective straight line formula (S4572). Therefore, at this point, three effective straight lines are L1, L2, and L3.

次に、エッジ有効部直線式算出部126は、点bを始点として、右下1方向および右下2方向の順にエッジ追跡を行なう(S4211,4212)。図示した傾きの例では、右下1方向へのエッジ追跡では直線式は求まらず、右下2方向へのエッジ追跡により直線式L2aが求まる。ここで、今回求めた直線式L2aは、既に求めた直線式L2と傾きおよび切片が同じになるので、エッジ有効部直線式算出部126は、直線式L2aを無効な直線式とする(S4568−Yes)。   Next, the edge effective part straight line formula calculation part 126 performs edge tracing in the lower right one direction and the lower right two directions starting from the point b (S4211, 4212). In the illustrated example of the inclination, a straight line formula is not obtained in the edge tracking in the lower right direction, but a straight line formula L2a is obtained in the edge tracking in the lower right direction. Here, since the straight line formula L2a obtained this time has the same inclination and intercept as the already obtained straight line formula L2, the edge effective part straight line formula calculating unit 126 sets the straight line formula L2a as an invalid straight line formula (S4568- Yes).

以下、同様にして、エッジ有効部直線式算出部126は、右端からのエッジ画素検出(S4105)によって検出される点cのエッジ画素を始点として、右下2方向へのエッジ追跡によって直線式L4を求め(S4210)、また左下2方向へのエッジ追跡によって直線式L3aを求める(S4212)。そして、その内の直線式L3aは既に求めた直線式L3と傾きおよび切片が同じになり、直線式L4と、傾きおよび切片の両方が同じになる既知の直線式L1,L2,L3は存在しないので、エッジ有効部直線式算出部126は、直線式L4を有効な直線式、直線式L3aを無効な直線式とする(S4568)。よって、この時点では有効な直線がL1,L2,L3,L4の4本となる。   Hereinafter, similarly, the edge valid part straight line formula calculation unit 126 starts with the edge pixel of the point c detected by the edge pixel detection from the right end (S4105) as the starting point, and performs the straight line L4 (S4210), and a straight line formula L3a is obtained by edge tracing in the two lower left directions (S4212). The straight line formula L3a has the same slope and intercept as the already obtained straight line formula L3, and there is no known straight line formula L1, L2, and L3 having both the same slope and intercept as the straight line formula L4. Therefore, the edge-effective-portion straight-line calculation unit 126 sets the straight-line formula L4 as a valid straight-line formula and the straight-line formula L3a as an invalid straight-line formula (S4568). Therefore, at this time, the effective straight lines are L1, L2, L3, and L4.

最後に、エッジ有効部直線式算出部126は、下端からのエッジ画素検出(S4107)によって検出される点dのエッジ画素を始点として、左上2方向へのエッジ追跡によって直線式L4aを求め(S4210)、また左下2方向へのエッジ追跡によって直線式L1aを求める(S4212)。そして、その内の直線式L4aは既に求めた直線式L4と傾きおよび切片が同じになり、また直線式L1aは既に求めた直線式L1と傾きおよび切片が同じになるので、エッジ有効部直線式算出部126は、今回求めた直線式L4a,L1aの何れをも無効な直線式とする(S4568−Yes)。以上によって、原稿の辺縁をなす4本の直線式L1,L2,L3,L4を特定することができる。   Finally, the edge-effective-part linear-expression calculating unit 126 obtains a linear expression L4a by performing edge tracing in the upper left two directions starting from the edge pixel of the point d detected by edge pixel detection from the lower end (S4107) (S4210). ), And a straight line formula L1a is obtained by edge tracing in the two lower left directions (S4212). The linear equation L4a has the same inclination and intercept as the already obtained linear equation L4, and the linear equation L1a has the same inclination and intercept as the already obtained linear equation L1. The calculation unit 126 sets any of the straight line formulas L4a and L1a obtained this time as an invalid straight line formula (S4568-Yes). As described above, the four linear formulas L1, L2, L3, and L4 forming the edge of the document can be specified.

一方、図51(B)に示すように、原稿の一部が撮像範囲からはみ出している場合には、以下のようになる。たとえば、エッジ有効部検出部124による左端および上端からのエッジ画素検出では図51(A)に示したと同様の始点a,bが検出されるので、エッジ有効部直線式算出部126により、図51(A)についての上記説明と同様に3本の直線式L1,L2,L3が求められる。   On the other hand, as shown in FIG. 51B, when a part of the original is out of the imaging range, the following is performed. For example, in the edge pixel detection from the left end and the upper end by the edge effective portion detecting section 124, the same starting points a and b as shown in FIG. 51A are detected. Three linear equations L1, L2, L3 are obtained in the same manner as described above for (A).

これに対して、図51(B)に示すように、原稿の一部が撮像範囲の上端からはみ出しているので、エッジ有効部検出部124は、右端からのエッジ画素検出において、原稿の辺縁と撮像範囲の上端との交点cをエッジ画素として検出する(S4105)。エッジ有効部直線式算出部126は、この交点cを始点として、右下2方向へのエッジ追跡によって直線式L4を求める(S4210)。左下1方向へのエッジ追跡によって、はみ出し部分の境界をなす直線式L5を求めることが可能と考えられるが(S4211)、この部部にはエッジ画素が存在しないので、直線式L5は求められない。そして、直線式L4と、傾きおよび切片の両方が同じになる既知の直線式L1,L2,L3は存在しないので、エッジ有効部直線式算出部126は、直線式L4を有効な直線式とする(S4568−No)。よって、この時点では有効な直線がL1,L2,L3,L4の4本となる。   On the other hand, as shown in FIG. 51B, since a part of the document protrudes from the upper end of the imaging range, the edge valid part detection unit 124 detects the edge pixel from the right end by detecting the edge of the document. The intersection c between the image and the upper end of the imaging range is detected as an edge pixel (S4105). The edge valid part straight line formula calculation unit 126 obtains a straight line formula L4 by performing edge tracing in the two lower right directions with the intersection c as a starting point (S4210). It is considered that a straight line formula L5 that forms the boundary of the protruding portion can be obtained by edge tracing in the lower left direction (S4211). However, since no edge pixel exists in this portion, the straight line formula L5 cannot be obtained. . Since there is no known straight line formula L1, L2, L3 in which both the slope and the intercept are the same as the straight line formula L4, the edge effective part straight line formula calculating unit 126 sets the straight line formula L4 as an effective straight line formula. (S4568-No). Therefore, at this time, the effective straight lines are L1, L2, L3, and L4.

また、原稿の一部が撮像範囲の右端からはみ出しているので、エッジ有効部検出部124は、下端からのエッジ画素検出において、原稿の辺縁と撮像範囲の右端との交点dをエッジ画素として検出する(S4107)。エッジ有効部直線式算出部126は、この交点dを始点として、左下2方向へのエッジ追跡によって直線式L1aを求める(S4212)。左上1方向および左上2方向へのエッジ追跡では直線式を求めることはできない(S4209,S4210)。直線式L1aは既に求めた直線式L1と傾きおよび切片が同じになるので、エッジ有効部直線式算出部126は、今回求めた直線式L1aを無効な直線式とする(S4568−Yes)。以上によって、原稿の辺縁をなす4本の直線式L1,L2,L3,L4を特定することができる。なお、はみ出し範囲の境界を示す直線式L5、L6については、撮像範囲の端縁の直線式と同一のものとして特定することができる。   In addition, since a part of the document protrudes from the right end of the imaging range, the edge valid part detection unit 124 sets the intersection d between the edge of the document and the right end of the imaging range as an edge pixel in edge pixel detection from the lower end. It is detected (S4107). The edge valid part straight line formula calculation unit 126 obtains a straight line formula L1a by tracking the edge in the lower left two directions with the intersection d as a starting point (S4212). A straight line formula cannot be obtained by edge tracking in the upper left direction and the upper left direction (S4209, S4210). Since the straight line formula L1a has the same inclination and intercept as the already obtained straight line formula L1, the edge valid part straight line formula calculating unit 126 sets the straight line formula L1a obtained this time as an invalid straight line formula (S4568-Yes). As described above, the four linear formulas L1, L2, L3, and L4 forming the edge of the document can be specified. Note that the linear formulas L5 and L6 indicating the boundaries of the protruding range can be specified as being the same as the linear formulas at the edges of the imaging range.

このように、図50に示す処理手順によれば、先ずエッジ有効部検出部124により撮像範囲の四隅のそれぞれから内側に向かって原稿の辺縁をなすエッジ画素をサーチし、これによって見つけた1つのエッジ画素を始点として180度の範囲でさらに内側に向かってエッジ画素を所定距離だけ追跡することで、原稿の辺縁をなす直線式を特定するようにした。これにより、原稿の一部が撮像範囲からはみ出している状態であっても、原稿の辺縁をなす直線式を重複することなく、確実に特定することができる。   As described above, according to the processing procedure shown in FIG. 50, first, the edge effective portion detecting section 124 searches the inside of each of the four corners of the imaging range for the edge pixels forming the edge of the document, and finds 1 By tracing the edge pixels a predetermined distance further inward within a range of 180 degrees with one edge pixel as a starting point, a straight line formula forming the margin of the document is specified. Thus, even when a part of the document is out of the imaging range, the linear formulas forming the edges of the document can be reliably specified without overlapping.

また、先ず撮像範囲の隅(コーナー)から内側に向かってエッジ画素をサーチすることで見つけたエッジ画素を始点として180度の範囲でさらにエッジ追跡を行なうようにしているので、任意の点のエッジ画素を見つけてからエッジ追跡することで原稿辺縁をなす直線式を見つける場合、その360度の範囲でエッジ追跡しなければならないのに比べて、処理が短時間で済むようになる。   Further, first, the edge pixel is searched for from the corner (corner) of the imaging range toward the inside, and the edge pixel is further traced within a range of 180 degrees from the edge pixel found as a starting point. In the case of finding a straight line formula forming the margin of a document by finding a pixel and then tracing the edge, the processing can be completed in a shorter time than in the case where the edge tracing must be performed in the range of 360 degrees.

図52は、エッジ追跡開始座標調整処理(S4214)の詳細例を示すフローチャートである。図53は、上下左右の各端からの処理におけるこのエッジ追跡開始座標調整処理の各ステップの処理内容の対応を示す図表である。   FIG. 52 is a flowchart showing a detailed example of the edge tracking start coordinate adjustment processing (S4214). FIG. 53 is a chart showing the correspondence between the processing contents of each step of the edge tracking start coordinate adjustment processing in the processing from the top, bottom, left, and right ends.

また、図54は、この処理における各ステップに対応したはみ出し状態の一例を示す図である。図55および図56は、上述の原稿範囲特定処理によって特定される、原稿辺縁をなす直線式についての、具体例を示す図である。   FIG. 54 is a diagram showing an example of a protruding state corresponding to each step in this processing. FIG. 55 and FIG. 56 are diagrams showing specific examples of the straight line formula forming the margin of the document specified by the above-described document range specifying process.

なお、図52では、左端からの原稿範囲特定処理(S4101,S4102)におけるエッジ追跡開始座標調整処理(S4214)について説明するが、左端からに限らず、この処理は、上下左右の各端からの原稿範囲特定処理のそれぞれにおいてなされる。その場合には、図52で示す処理ステップの内容を、図53に示すように変えるとよい。   In FIG. 52, the edge tracking start coordinate adjustment processing (S4214) in the document range identification processing from the left end (S4101, S4102) will be described. However, the processing is not limited to the left end, and this processing is performed from the top, bottom, left, and right ends. This is performed in each of the document range specifying processes. In that case, the contents of the processing steps shown in FIG. 52 may be changed as shown in FIG.

エッジ有効部検出部124は先ず、linecount 数が“2”であるか否かを判定する(S4710)。そして、linecount 数が“2”の場合(S4710−Yes)、エッジ有効部検出部124は、見つけたa点のエッジ画素を始点とする2つの直線式について、先ず、横方向座標位置xe(1)とxe(2)の大小を比較する(S4712)。エッジ有効部検出部124は、xe(2)よりxe(1)が小さい(未満の)場合、縦方向座標位置ye(1)をjに、横方向座標位置iを“0”に設定する(S4712−Yes,S4714)。一方、xe(2)よりxe(1)が大きい(以上)場合(S4712−No)、エッジ有効部検出部124は、ye(2)をjに、横方向座標位置iを“0”に設定する(S4716)。また、linecount が“1”の場合(S4710−No,S4711−Yes)、ye(1)をjに、横方向座標位置iを“0”に設定し(S4718)、linecount が“0”の場合(S4710−No,S4711−No)、縦方向座標位置jを“j+1”に、横方向座標位置iを“0”に設定することで、最終的にはエッジ追跡開始座標調整処理を終了させる(S4719)。   The edge valid part detecting unit 124 first determines whether or not the linecount number is “2” (S4710). Then, when the number of linecounts is “2” (S4710-Yes), the edge valid part detecting unit 124 firstly determines the horizontal coordinate position xe (1) for the two linear expressions starting from the found edge pixel at point a. ) And xe (2) are compared (S4712). When xe (1) is smaller than (less than) xe (2), the edge valid part detector 124 sets the vertical coordinate position ye (1) to j and the horizontal coordinate position i to “0” ( S4712-Yes, S4714). On the other hand, when xe (1) is greater than (or greater than) xe (2) (S4712-No), the edge valid part detection unit 124 sets ye (2) to j and sets the horizontal coordinate position i to “0”. (S4716). If linecount is "1" (S4710-No, S4711-Yes), ye (1) is set to j, horizontal coordinate position i is set to "0" (S4718), and linecount is "0". (S4710-No, S4711-No), the vertical coordinate position j is set to "j + 1" and the horizontal coordinate position i is set to "0", so that the edge tracking start coordinate adjustment process is finally ended ( S4719).

このステップS4710,S4712の判定とその結果に基づくj点の設定の意義は、できるだけ左端のエッジ画素を再開場所とするためのものである。左端からのサーチ時以外についても、同様の趣旨で、それぞれ、できるだけ上端/右端/下端のエッジ画素を再開場所とするように、図53の図表に従って処理内容を切り替える。   The significance of the determinations in steps S4710 and S4712 and the setting of the point j based on the results is to make the edge pixel on the left end as a restart location as much as possible. Except at the time of the search from the left end, the processing contents are switched in accordance with the chart of FIG. 53 so that the upper end / right end / lower end edge pixels are set as resuming places as much as possible.

このエッジ追跡開始座標調整処理(S4214)を行なうことで、左端と上端からのサーチのみで3辺または4辺のエッジを検出できる可能性があり、その場合は右端と下端のサーチは必要なく、処理を行わなくてよいため処理時間が削減できるといった効果が得られる。   By performing the edge tracking start coordinate adjustment processing (S4214), there is a possibility that three or four edges can be detected only by searching from the left end and the upper end. In that case, the search of the right end and the lower end is unnecessary, There is an effect that the processing time can be reduced because the processing need not be performed.

たとえば、透視変換後の撮像画像範囲の右上コーナーにて、その上端と右端で、はみ出した状態にある撮像画像を処理対象とする場合、エッジ追跡開始座標調整処理(S4214)により、エッジ追跡を再開する座標(エッジ追跡再開画素位置)が図48に示すように(0,ye(1))に設定される。   For example, in a case where a captured image that is protruding from the upper right corner and the upper right corner of the captured image area after the perspective transformation is to be processed, the edge tracking is restarted by the edge tracking start coordinate adjustment processing (S4214). The coordinates (edge tracking restart pixel position) to be set are set to (0, ye (1)) as shown in FIG.

たとえば、先ず、原稿範囲特定処理(S4002,S4004)において、非検査領域特定処理部120は、左端からの原稿範囲特定処理(S4101,S4102)で、a点を始点として、右上1方向に1本目の直線式y=a(1)・x+b(1)、左上2方向に2本目の直線式y=a(2)・x+b(2)を検出する。   For example, first, in the document range specification processing (S4002, S4004), the non-inspection area specification processing unit 120 performs the first processing in the upper right direction starting from point a in the document range specification processing from the left end (S4101, S4102). , And a second linear expression y = a (2) .x + b (2) is detected in the upper left two directions.

この後、エッジ有効部検出部124は、(0,ye(1))からエッジ追跡を再開する。これにより、図54(A)に示すように、b点を始点として、右上1方向に3本目の直線式y=a(3)・x+b(3)を検出する。このときには、直線式は1本しか検出できないので、再開位置のj座標をye(1)に設定する(S4718)。この後、j=j+1,i=0に設定して(S4719)、再びサーチを再開することで、最終的にはステップS4202−Yesを経て、エッジ追跡開始座標調整処理を終了する(S4719)。これにて、左端からのサーチが完了する。   Thereafter, the edge valid part detecting unit 124 restarts edge tracking from (0, ye (1)). As a result, as shown in FIG. 54 (A), the third straight line equation y = a (3) · x + b (3) is detected in the upper right direction starting from point b. At this time, since only one linear expression can be detected, the j coordinate of the restart position is set to ye (1) (S4718). Thereafter, j = j + 1 and i = 0 are set (S4719), and the search is restarted again. Finally, through step S4202-Yes, the edge tracking start coordinate adjustment processing ends (S4719). This completes the search from the left end.

また、上端からの原稿範囲特定処理(S4101,S4102)で、先ずb点を始点として直線を検出する。このときには2本を検知し得るが、それらは既に検知済みのものであるので、linecount が“0”となるから(S4710−No,S4711−No)、エッジ追跡を再開する座標(エッジ追跡再開画素位置)のi側をi+1,j側を0に設定する(S4719)。   In the original range specification process from the upper end (S4101, S4102), first, a straight line is detected starting from point b. At this time, two lines can be detected, but since they have already been detected, the linecount becomes "0" (S4710-No, S4711-No), and the coordinates (edge tracking restart pixel The i side of the position) is set to i + 1, and the j side is set to 0 (S4719).

ここで、図示したはみ出し具合では、撮像画像が撮像範囲の上側にはみ出しているので、エッジ追跡開始座標調整処理を行なうと適正な処理がなされない可能性がある。このような場合には、はみ出し具合を作業者が判断して、はみ出しのある撮像範囲の端縁側からのサーチ時のみエッジ追跡開始座標調整処理をスルーさせるとよい(S4213−NO)。こうすることで、次に右端からのサーチに移り、最終的には、図54(B)に示すように、右下2方向にy=a(4)・x+b(4)を検出する。これにより、矩形状の原稿の4つの辺縁をなす4つの直線式全てを特定することができる。この4辺検出時の処理結果を図55に示す。なお、図55には、上記のようにして求められる原稿辺縁をなす直線式だけでなく、撮像範囲の端縁をなす直線式も示す。   Here, in the illustrated protruding state, the captured image protrudes above the imaging range, so that if the edge tracking start coordinate adjustment processing is performed, there is a possibility that an appropriate processing may not be performed. In such a case, the operator may judge the degree of protrusion, and the edge tracking start coordinate adjustment processing may be skipped only when searching from the edge side of the protruding imaging range (S4213-NO). By doing so, the search then proceeds from the right end, and finally, as shown in FIG. 54B, y = a (4) .x + b (4) is detected in the two lower right directions. As a result, it is possible to specify all four linear formulas forming the four edges of the rectangular document. FIG. 55 shows the processing result when the four sides are detected. FIG. 55 shows not only the straight line formula forming the edge of the original document obtained as described above, but also the straight line formula forming the edge of the imaging range.

なお、説明は割愛するが、図54(C)に示すように、原稿の全体が撮像範囲内に入っている場合には、エッジ追跡開始座標調整処理を行なうようにしていても、不都合無く処理を行なうことができる。   Although the description is omitted, as shown in FIG. 54 (C), when the entire original is within the imaging range, the edge tracking start coordinate adjustment processing may be performed without any inconvenience. Can be performed.

このような処理に依れば、ステップS4405での直線式の本数判定を行なうので、図48に示したケースでは、上下左右の全ての端縁からの処理を行なうことなく、上端からの原稿範囲特定処理までにて4つの直線式全てを特定することができる。その分だけ、処理時間を短縮することができる。   According to such processing, the number of straight lines is determined in step S4405. Therefore, in the case shown in FIG. All four linear expressions can be specified up to the specific processing. The processing time can be shortened accordingly.

また、透視変換後の撮像画像範囲の上端にて、隣接する2つの原稿頂点が撮像範囲からはみ出した状態にある撮像画像を処理対象とする場合、原稿範囲特定処理(S4002,S4004)において、左端からの原稿範囲特定処理(S4101,S4102)で、右上2方向にy=a(1)・x+b(1)、左上1方向にy=a(2)・x+b(2)を検出する。また、上端からのエッジ有効直線出処理S4102で、右下1方向にy=a(3)・x+b(3)を検出することで、矩形状の原稿の4つの辺縁をなす4つの直線式のうちの、3つの直線を特定することができる。この3辺検出時の処理結果を図56に示す。なお、図56にても、上記のようにして求められる原稿辺縁をなす直線式だけでなく、撮像範囲の端縁をなす直線式も示す。   In addition, when a captured image in which two adjacent vertices of the original are protruded from the imaging range at the upper end of the captured image range after the perspective transformation is to be processed, the leftmost end is determined in the original range specification processing (S4002, S4004). In the document range specification process (S4101, S4102), y = a (1) .x + b (1) is detected in two upper right directions, and y = a (2) .x + b (2) is detected in one upper left direction. Further, in the edge effective straight line output process S4102 from the upper end, by detecting y = a (3) · x + b (3) in the lower right direction, four linear formulas forming four edges of the rectangular original are detected. Among them, three straight lines can be specified. FIG. 56 shows the processing result when the three sides are detected. Note that FIG. 56 also shows not only the straight line formula that forms the edge of the document obtained as described above, but also the straight line formula that forms the edge of the imaging range.

ここで、この図49に示したケースでは、ステップS4405での直線式の本数判定を行なうけれども、3本の直線式しか求まらないので、上下左右の全ての端縁からの処理を行なう。なお、「上端から」、「右端から」、「下端から」の処理においてエッジ追跡開始座標調整処理(S4214)により設定されるエッジ追跡再開画素位置は、図示した通りである。ここでは、どのような過程を経てそれらが設定されるのかについては、説明を割愛する。   In this case, in the case shown in FIG. 49, although the number of linear formulas is determined in step S4405, only three linear formulas are obtained, so processing is performed from all of the upper, lower, left, and right edges. The edge tracing restart pixel position set by the edge tracing start coordinate adjustment process (S4214) in the processes from "from the upper edge", "from the right edge", and "from the lower edge" is as illustrated. Here, the description of the process through which they are set will be omitted.

図57は、原稿頂点設定処理部132による、原稿頂点設定処理の手順の概要を示すフローチャートである。この第3実施形態では、その概要を先にも説明したように、上記原稿範囲特定処理にて求められた原稿の辺縁を示す直線式の本数によって、処理内容を変える。このため、原稿頂点設定処理部132は先ず、エッジ有効部直線式算出部126によって求められた原稿辺縁をなす直線式の本数(直線数)zが“4”(z=4)であったか否かを判定する(S4801)。   FIG. 57 is a flowchart showing the outline of the procedure of the document vertex setting process by the document vertex setting processing unit 132. In the third embodiment, the processing content is changed according to the number of linear formulas indicating the edges of the document obtained in the document range specifying process as described above. For this reason, the document vertex setting processing unit 132 first determines whether or not the number (the number of straight lines) z of the linear formulas forming the document edge obtained by the edge valid part linear formula calculation unit 126 is “4” (z = 4). It is determined (S4801).

そして、直線数zが“4”の場合(S4801−Yes)、原稿頂点設定処理部132は、この4本の直線式を使うことで矩形状の原稿の4つの頂点座標を求めることができるので、4点頂点設定処理を行なう(S4802)。この4点頂点設定処理の対象となるはみ出し状態は、透視変換後の撮像画像範囲の右上コーナーにて、その上端と右端で、はみ出した状態にある撮像画像を処理対象とする場合がその一例である。   If the number z of straight lines is “4” (S4801-Yes), the document vertex setting processing unit 132 can obtain the coordinates of the four vertices of the rectangular document by using these four linear expressions. Then, a four-point vertex setting process is performed (S4802). The protruding state to be subjected to the four-point vertex setting process is, for example, a case in which a captured image that is protruding at the upper right corner and the upper right corner of the captured image area after perspective transformation is to be processed. is there.

一方、直線数zが“4”でない場合(S4801−No)、原稿頂点設定処理部132は次に直線数zが“3”(z=3)であったか否かを判定する(S4803)。そして、直線数zが“3”の場合(S4803−Yes)、原稿頂点設定処理部132は、この3本の直線式を使うことで矩形状の原稿の2つの頂点座標を求めることができるので、2点頂点設定処理を行なう(S4804)。この2点頂点設定処理の対象となるはみ出し状態は、隣接する2つの原稿頂点が撮像範囲からはみ出した状態にある撮像画像を処理対象とする場合がその一例である。   On the other hand, if the number of straight lines z is not “4” (S4801-No), the document vertex setting processing unit 132 determines whether or not the number of straight lines z is “3” (z = 3) (S4803). If the number of straight lines z is “3” (S4803-Yes), the document vertex setting processing unit 132 can obtain the coordinates of the two vertices of the rectangular document by using these three linear expressions. Then, a two-point vertex setting process is performed (S4804). The protruding state to be subjected to the two-point vertex setting process is, for example, a case where a picked-up image in which two adjacent document vertices are protruding from the imaging range is set as a processing target.

これに対して、直線数zが“2”以下の場合には(S4803−No)、それだけでは、1つの原稿頂点しか求められず、非検査領域を設定することも難しいので、画像検査処理自体を実行しないようにする(たとえば処理を直ちに停止する)ため、エラー処理をする(S4805)。   On the other hand, when the number z of straight lines is equal to or less than “2” (S4803-No), only one vertex of the document is obtained by itself, and it is difficult to set a non-inspection area. Is executed (for example, the processing is immediately stopped), error processing is performed (S4805).

図58は、原稿頂点設定処理部132による、4点頂点設定処理の手順の一例を示したフローチャートである。図59は、この処理における判定対象となる状態と、それに対応した頂点算出処理1〜3を説明する図である。図59の(A)〜(C)において、zは、エッジ有効部直線式算出部126による処理にて求められる直線式の番号を示す。   FIG. 58 is a flowchart illustrating an example of a procedure of a four-point vertex setting process by the document vertex setting processing unit 132. FIG. 59 is a diagram for explaining states to be determined in this processing and vertex calculation processings 1 to 3 corresponding thereto. In (A) to (C) of FIG. 59, z indicates the number of the straight line formula obtained by the processing by the edge effective part straight line formula calculation unit 126.

原稿頂点設定処理部132は、エッジ有効部直線式算出部126にて特定された直線式が示す原稿辺縁の位置関係を調べ、その結果に基づいて、4つの頂点座標をそれぞれ求めるための直交する2つの直線1,2が、それぞれ何番目の直線式であるのかを特定する。   The document vertex setting processing unit 132 checks the positional relationship between the document edges indicated by the straight line formula specified by the edge effective unit straight line formula calculation unit 126, and based on the result, orthogonal coordinates for obtaining four vertex coordinates, respectively. The order of the two straight lines 1 and 2 is specified.

このため、原稿頂点設定処理部132は先ず、1番目の直線式(z=1)と2番目の直線式(z=2)の傾きa(1),a(2)を比較する(S4901)。2つの直線式の傾きがほぼ等しく、その差|a(1)−a(2)|が閾値β未満の場合(S4901−Yes)、原稿頂点設定処理部132は、図59(A)に示すように、2つの直線は原稿の対向する辺縁をなす直線式であると判断し、この判断に基づく頂点算出処理1を行なう(S4902)。   Therefore, the document vertex setting processing unit 132 first compares the inclinations a (1) and a (2) of the first linear expression (z = 1) and the second linear expression (z = 2) (S4901). . When the inclinations of the two linear equations are substantially equal and the difference | a (1) −a (2) | is smaller than the threshold value β (S4901-Yes), the document vertex setting processing unit 132 shows in FIG. As described above, it is determined that the two straight lines are linear formulas forming opposite edges of the document, and the vertex calculation process 1 based on this determination is performed (S4902).

矩形状の原稿を取り扱う場合、閾値βは原理的には“0(ゼロ)”でいいが、実際には正確な矩形でないケースがあるし、原稿辺縁を示す直線式も正確に求められる訳ではないので、これらの点を考慮して閾値βを設定する。   When a rectangular document is handled, the threshold value β may be "0 (zero)" in principle, but there are cases where the threshold value β is not actually an accurate rectangle, and the linear expression indicating the document margin is also accurately obtained. Therefore, the threshold value β is set in consideration of these points.

2つの直線式の傾きの差|a(1)−a(2)|が閾値β未満でない場合(S4901−No)、原稿頂点設定処理部132は次に、1番目の直線式(z=1)と3番目の直線式(z=3)の傾きa(1),a(3)を比較する(S4903)。2つの直線式の傾きがほぼ等しく、その差|a(1)−a(3)|が閾値β未満の場合(S4903−Yes)、原稿頂点設定処理部132は、図59(B)に示すように、2つの直線は原稿の対向する辺縁をなす直線式であると判断し、この判断に基づく頂点算出処理2を行なう(S4904)。   If the difference | a (1) −a (2) | between the inclinations of the two linear expressions is not less than the threshold value β (S4901—No), the document vertex setting processing unit 132 then proceeds to the first linear expression (z = 1 ) Is compared with the gradients a (1) and a (3) of the third linear expression (z = 3) (S4903). When the inclinations of the two linear expressions are substantially equal and the difference | a (1) −a (3) | is less than the threshold value β (S4903-Yes), the document vertex setting processing unit 132 shows in FIG. As described above, it is determined that the two straight lines are linear formulas forming opposite edges of the document, and the vertex calculation process 2 based on this determination is performed (S4904).

2つの直線式の傾きの差|a(1)−a(3)|が閾値β未満でない場合、すなわち|a(1)−a(2)|および|a(1)−a(3)|の何れもが閾値β未満でない場合(S4903−No)、原稿頂点設定処理部132は、図59(C)に示すように、残りの4番目の直線式(z=4)と1番目の直線式(z=4)とが原稿の対向する辺縁をなす直線式であると判断し、この判断に基づく頂点算出処理3を行なう(S4905)。   If the difference | a (1) -a (3) | between the slopes of the two linear equations is not less than the threshold value β, ie, | a (1) -a (2) | and | a (1) -a (3) | Are not less than the threshold β (S4903-No), the document vertex setting processing unit 132, as shown in FIG. 59 (C), sets the remaining fourth straight line equation (z = 4) and the first straight line It is determined that the equation (z = 4) is a straight-line equation forming the opposite edge of the document, and vertex calculation processing 3 based on this determination is performed (S4905).

原稿頂点設定処理部132は、上記処理にて特定された直線式が示す原稿辺縁の位置関係に基づき、図59(D)に示すように、4つの頂点座標をそれぞれ求めるための直交する2つの直線1,2が、それぞれ何番目の直線式であるのかを特定し、その結果に基づいて、原稿頂点をなす交点座標を求める。   The document vertex setting processing unit 132, based on the positional relationship between the document edges indicated by the straight line equation specified in the above process, as shown in FIG. The order of each of the straight lines 1 and 2 is specified, and the intersection coordinates forming the vertex of the document are obtained based on the result.

たとえば、図59(A)に示す状態に対応した頂点算出処理1では、1番目(z=1)の直線式と2番目(z=2)の直線式とが平行であり、1番目(z=1)の直線式と3番目(z=3)もしくは4番目(z=4)の直線式との交点、並びに、2番目(z=2)の直線式と3番目(z=3)もしくは4番目(z=4)の直線式との交点、がそれぞれ原稿頂点をなすものと判断する。   For example, in the vertex calculation process 1 corresponding to the state shown in FIG. 59A, the first (z = 1) linear equation and the second (z = 2) linear equation are parallel, and the first (z = 2) = 1) and the intersection of the third (z = 3) or fourth (z = 4) linear equation, and the second (z = 2) linear equation and the third (z = 3) or It is determined that the intersection with the fourth (z = 4) linear equation forms the vertex of the document.

そして、原稿頂点設定処理部132は、頂点を算出するための直線1である1番目(z=1)の直線式y=a(1)・x+b(1)と頂点を算出するための直線2である3番目(z=1)の直線式y=a(3)・x+b(3)から交点(xc1,yc1)、同様に1番目(z=1)の直線式y=a(1)・x+b(1)と4番目(z=4)の直線式y=a(4)・x+b(4)から交点(xc2,yc2)、2番目(z=2)の直線式y=a(2)・x+b(2)と3番目(z=3)の直線式y=a(3)・x+b(3)から交点(xc3,yc3)、2番目(z=2)の直線式y=a(2)・x+b(2)と4番目(z=4)の直線式y=a(4)・x+b(4)から交点(xc4,yc4)、の計4点を頂点座標として算出する。これを整理して示したのが、図59(D)に示す図表である。   Then, the document vertex setting processing unit 132 calculates the first (z = 1) linear equation y = a (1) · x + b (1), which is the straight line 1 for calculating the vertex, and the straight line 2 for calculating the vertex. From the third (z = 1) linear equation y = a (3) · x + b (3), and similarly to the intersection (xc1, yc1), the first (z = 1) linear equation y = a (1) · From x + b (1) and the fourth (z = 4) linear expression y = a (4) · x + b (4), the intersection (xc2, yc2) and the second (z = 2) linear expression y = a (2) X + b (2) and the third (z = 3) linear equation y = a (3). From x + b (3), the intersection (xc3, yc3) and the second (z = 2) linear equation y = a (2) ) · X + b (2) and the intersection (xc4, yc4) from the fourth (z = 4) straight-line equation y = a (4) · x + b (4) are calculated as vertex coordinates. The table shown in FIG. 59 (D) summarizes this.

詳しい説明は割愛するが、図59(B)に示す状態に対応した頂点算出処理2と図59(C)に示す状態に対応した頂点算出処理3の場合にも、原稿頂点設定処理部132は、頂点算出処理1の場合と同様に、図59(D)に示す図表のようにして、4つの頂点座標を算出する。   Although detailed description is omitted, the original vertex setting processing unit 132 also performs vertex calculation processing 2 corresponding to the state illustrated in FIG. 59B and vertex calculation processing 3 corresponding to the state illustrated in FIG. As in the case of the vertex calculation process 1, the coordinates of the four vertices are calculated as shown in the table of FIG.

図60は、上述の4点頂点設定処理によって求められる、4つの原稿頂点の具体例を示す図である。4点頂点設定処理の対象となるのは、図36や図48などに示したように、原稿の4辺の全てが撮像範囲内に存在する撮像画像を処理対象とする場合(4辺検出時)がその一例である。図60に示す状態では、1番目(z=1)と3番目(z=3)の直線は原稿の対向する辺縁をなす直線式であるから、原稿頂点設定処理部132は頂点算出処理2(S4904)を行なう。   FIG. 60 is a diagram illustrating a specific example of four document vertices obtained by the above-described four-point vertex setting process. The target of the four-point vertex setting process is a case where a captured image in which all four sides of the document are within the imaging range is to be processed as shown in FIGS. ) Is an example. In the state shown in FIG. 60, the first (z = 1) and third (z = 3) straight lines are straight lines forming opposite edges of the document, and thus the document vertex setting processing unit 132 performs the vertex calculation process 2 (S4904) is performed.

これにより、原稿頂点設定処理部132は、図中に示すように、1番目と2番目の各直線式の交点(xc1,yc1)、1番目と4番目の各直線式の交点(xc2,yc2)、3番目と2番目の各直線式の交点(xc3,yc3)、3番目と4番目の各直線式の交点(xc4,yc4)を、それぞれ原稿頂点として算出することができる。これにより、矩形状の原稿の4つの頂点座標が特定される。   Thus, the document vertex setting processing unit 132, as shown in the figure, determines the intersection (xc1, yc1) of the first and second linear expressions, and the intersection (xc2, yc2) of the first and fourth linear expressions. The intersection (xc3, yc3) of the third and second linear formulas (xc4, yc4) of the third and fourth linear formulas can be calculated as document vertices. As a result, the coordinates of the four vertices of the rectangular document are specified.

図61は、3辺検出時における原稿頂点設定処理部132による、2点頂点設定処理の手順の一例を示したフローチャートである。図62は、この処理における判定対象となる状態と、それに対応した頂点算出処理1〜3を説明する図である。図62の(A)〜(C)において、zは、エッジ有効部直線式算出部126による処理にて求められる直線式の番号を示す。この2点頂点設定処理の手順は、求められている直線式の数が3本であるということに起因した相違点があるものの、基本的には、図58に示した4点頂点設定処理の処理手順と概ね同じである。   FIG. 61 is a flowchart illustrating an example of a procedure of a two-point vertex setting process by the document vertex setting processing unit 132 when three sides are detected. FIG. 62 is a diagram for explaining states to be determined in this processing and vertex calculation processings 1 to 3 corresponding thereto. 62 (A) to 62 (C), z indicates the number of the straight line formula obtained by the processing by the edge effective part straight line formula calculation unit 126. The procedure of the two-point vertex setting process is basically different from that of the four-point vertex setting process shown in FIG. The processing procedure is almost the same.

たとえば、原稿頂点設定処理部132は、エッジ有効部直線式算出部126にて特定された直線式が示す原稿辺縁の位置関係を調べ、その結果に基づいて、2つの頂点座標をそれぞれ求めるための直交する2つの直線1,2が、それぞれ何番目の直線式であるのかを特定する。   For example, the document vertex setting processing unit 132 checks the positional relationship between the document edges indicated by the straight line formula specified by the edge effective part straight line formula calculation unit 126, and obtains two vertex coordinates based on the result. Are specified as the order of the two straight lines 1 and 2 which are orthogonal to each other.

このため、原稿頂点設定処理部132は先ず、1番目の直線式(z=1)と2番目の直線式(z=2)の傾きa(1),a(2)を比較する(S5001)。2つの直線式の傾きがほぼ等しく、その差|a(1)−a(2)|が閾値β未満の場合(S5001−Yes)、原稿頂点設定処理部132は、図62(A)に示すように、2つの直線は原稿の対向する辺縁をなす直線式であると判断し、この判断に基づく頂点算出処理4を行なう(S5002)。   Therefore, the document vertex setting processing unit 132 first compares the inclinations a (1) and a (2) of the first linear equation (z = 1) and the second linear equation (z = 2) (S5001). . When the inclinations of the two linear expressions are substantially equal and the difference | a (1) −a (2) | is smaller than the threshold value β (S5001-Yes), the document vertex setting processing unit 132 shows in FIG. As described above, it is determined that the two straight lines are linear formulas forming opposite edges of the document, and the vertex calculation processing 4 based on this determination is performed (S5002).

2つの直線式の傾きの差|a(1)−a(2)|が閾値β未満でない場合(S5001−No)、原稿頂点設定処理部132は次に、1番目の直線式(z=1)と3番目の直線式(z=3)の傾きa(1),a(3)を比較する(S5003)。2つの直線式の傾きがほぼ等しく、その差|a(1)−a(3)|が閾値β未満の場合(S5003−Yes)、原稿頂点設定処理部132は、図62(B)に示すように、2つの直線は原稿の対向する辺縁をなす直線式であると判断し、この判断に基づく頂点算出処理5を行なう(S5004)。   If the difference | a (1) −a (2) | between the inclinations of the two linear expressions is not less than the threshold value β (S5001-No), the document vertex setting processing unit 132 then proceeds to the first linear expression (z = 1 ) And the slopes a (1) and a (3) of the third linear equation (z = 3) are compared (S5003). When the inclinations of the two linear expressions are substantially equal and the difference | a (1) −a (3) | is smaller than the threshold value β (S5003-Yes), the document vertex setting processing unit 132 shows in FIG. As described above, it is determined that the two straight lines are linear formulas forming opposite edges of the document, and the vertex calculation processing 5 based on this determination is performed (S5004).

2つの直線式の傾きの差|a(1)−a(3)|が閾値β未満でない場合、すなわち|a(1)−a(2)|および|a(1)−a(3)|の何れもが閾値β未満でない場合(S5003−No)、原稿頂点設定処理部132は、図62(C)に示すように、1番目の直線式(z=4)と対向する、原稿の辺縁をなす直線式は求められていないと判断し、この判断に基づく頂点算出処理6を行なう(S5005)。   If the difference | a (1) -a (3) | between the slopes of the two linear equations is not less than the threshold value β, ie, | a (1) -a (2) | and | a (1) -a (3) | Are not less than the threshold value β (S5003-No), the document vertex setting processing unit 132, as shown in FIG. 62C, sets the document side opposite to the first linear equation (z = 4). It is determined that the straight line formula forming the edge has not been obtained, and the vertex calculation processing 6 based on this determination is performed (S5005).

原稿頂点設定処理部132は、上記処理にて特定された直線式が示す原稿辺縁の位置関係に基づき、図62(D)に示すように、2つの頂点座標をそれぞれ求めるための直交する2つの直線1,2が、それぞれ何番目の直線式であるのかを特定し、その結果に基づいて、原稿頂点をなす交点座標を求める。たとえば、図62(A)に示す状態に対応した頂点算出処理4では、1番目(z=1)の直線式と2番目(z=2)の直線式とが平行であり、1番目(z=1)の直線式と3番目(z=3)もしくは4番目(z=4)の直線式との交点がそれぞれ原稿頂点をなすものと判断する。   The document vertex setting processing unit 132, based on the positional relationship between the document edges indicated by the straight line equation specified in the above processing, as shown in FIG. The order of each of the straight lines 1 and 2 is specified, and the intersection coordinates forming the vertex of the document are obtained based on the result. For example, in the vertex calculation processing 4 corresponding to the state shown in FIG. 62A, the first (z = 1) linear equation and the second (z = 2) linear equation are parallel, and the first (z = 2) = 1) and the intersection of the third (z = 3) or fourth (z = 4) linear equation forms the vertex of the document.

そして、原稿頂点設定処理部132は、頂点を算出するための直線1である1番目(z=1)の直線式y=a(1)・x+b(1)と頂点を算出するための直線2である3番目(z=1)の直線式y=a(3)・x+b(3)から交点(xc1,yc1)、同様に2番目(z=2)の直線式y=a(2)・x+b(2)と3番目(z=3)の直線式y=a(3)・x+b(3)から交点(xc2,yc2)、の計2点を頂点座標として算出する。これを整理して示したのが、図62(D)に示す図表である。   Then, the document vertex setting processing unit 132 calculates the first (z = 1) linear equation y = a (1) · x + b (1), which is the straight line 1 for calculating the vertex, and the straight line 2 for calculating the vertex. From the third (z = 1) linear equation y = a (3) · x + b (3), similarly to the intersection (xc1, yc1), and similarly the second (z = 2) linear equation y = a (2) · The intersection (xc2, yc2) is calculated as the vertex coordinates from x + b (2) and the third (z = 3) linear equation y = a (3) · x + b (3). FIG. 62 (D) illustrates this in a organized manner.

詳しい説明は割愛するが、図62(B)に示す状態に対応した頂点算出処理5と図62(C)に示す状態に対応した頂点算出処理6の場合にも、原稿頂点設定処理部132は、頂点算出処理4の場合と同様に、図62(D)に示す図表のようにして、2つの頂点座標を算出する。   Although detailed description is omitted, the original vertex setting processing unit 132 also performs the vertex calculation processing 5 corresponding to the state illustrated in FIG. 62B and the vertex calculation processing 6 corresponding to the state illustrated in FIG. Similarly to the case of the vertex calculation process 4, two vertex coordinates are calculated as shown in the table of FIG.

図63は、上述の2点頂点設定処理によって求められる、2つの原稿頂点の具体例を示す図である。2点頂点設定処理の対象となるのは、図37や図49などに示したように、原稿の4辺のうち3辺が撮像範囲内に存在する撮像画像を処理対象とする場合(3辺検出時)がその一例である。図63に示す状態では、1番目(z=1)と対向する原稿辺縁をなす直線式は見つかっていない状態であるから、原稿頂点設定処理部132は頂点算出処理2(S5005)を行なう。   FIG. 63 is a diagram illustrating a specific example of two document vertexes obtained by the above-described two-point vertex setting process. The target of the two-point vertex setting process is a case where a picked-up image in which three sides of the four sides of the document exist within the image pickup range as a target to be processed as shown in FIGS. This is one example. In the state shown in FIG. 63, since the straight line formula forming the document edge facing the first (z = 1) has not been found, the document vertex setting processing unit 132 performs vertex calculation processing 2 (S5005).

これにより、原稿頂点設定処理部132は、図中に示すように、1番目と3番目の各直線式の交点(xc1,yc1)と、1番目と3番目の各直線式の交点(xc2,yc2)を、それぞれ原稿頂点として算出することができる。   As a result, the document vertex setting processing unit 132, as shown in the figure, determines the intersection (xc1, yc1) of the first and third linear expressions and the intersection (xc2, xc2) of the first and third linear expressions. yc2) can be calculated as document vertices.

図64は、はみ出し場所判定処理部134によるはみ出し場所判定処理(S4008)と、はみ出し頂点座標推定処理部135によるはみ出し場所頂点推算処理(S4010)の手順の概要を示したフローチャートである。   FIG. 64 is a flowchart showing an outline of the procedure of the protruding place determination processing (S4008) by the protruding place determination processing unit 134 and the protruding place vertex estimation processing (S4010) by the protruding vertex coordinate estimation processing unit 135.

はみ出し場所判定処理部134は、直線数zが“4”、すなわちエッジ有効部直線式算出部126にて原稿辺縁をなす直線が4本見つかっている(z=4)のか否かを判定する(S5101)。直線数zが“4”の場合には(S5101−Yes)、このはみ出し場所判定処理とはみ出し場所頂点推算処理を直ちに終了する。   The protruding place determination processing unit 134 determines whether or not the number of straight lines z is “4”, that is, four straight lines forming the document margin have been found (z = 4) by the edge effective part straight line formula calculation unit 126. (S5101). If the number of straight lines z is "4" (S5101-Yes), the protruding location determination processing and the protruding location vertex estimation processing are immediately terminated.

一方、直線数zが“3”の場合には(S5101−No)、はみ出し場所判定処理部134は2点はみ出し方向判定処理を実行し(S5102)、次いではみ出し頂点座標推定処理部135は2点はみ出し場所頂点推算処理を実行する(S5103)。つまり、事実上は、これらの処理の対象となるのは、原稿辺縁をなす直線が3本しか見つからない場合であり、4本見つかった場合には、これらの処理が開始されると直ちにこの処理から抜け、境界部分特定処理や非検査部設定処理(纏めて非検査領域特定処理)に移行する。   On the other hand, when the number z of straight lines is “3” (S5101-No), the protruding place determination processing unit 134 performs a two-point protruding direction determination process (S5102), and then the protruding vertex coordinate estimation processing unit 135 performs two points. A protruding place vertex estimating process is executed (S5103). In other words, in practice, these processes are performed when only three straight lines forming the margins of the document are found. When four straight lines are found, the process is immediately started when these processes are started. The process exits from the process and proceeds to a boundary portion specifying process and a non-inspection unit setting process (collectively, non-inspection region specifying process).

図65は、はみ出し場所判定処理部134による2点はみ出し方向判定処理(S5102)の手順の詳細例を示したフローチャートである。   FIG. 65 is a flowchart illustrating a detailed example of the procedure of the two-point protruding direction determination process (S5102) by the protruding location determination processing unit 134.

はみ出し場所判定処理部134は先ず、オペレータm(mは“0”を含む正の整数)を“0(ゼロ)”に初期化設定する(S5201)。そして、オペレータh(hは正の整数)が直線数z未満の間(S5202−Yes)で、以下の処理を繰り返す。なお、この処理を実行するのは直線数zが“3”未満の場合であるから、事実上、h=1,2について処理を繰り返す。   The protruding place determination processing unit 134 first initializes an operator m (m is a positive integer including “0”) to “0 (zero)” (S5201). Then, the following processing is repeated while the operator h (h is a positive integer) is less than the number of straight lines z (S5202-Yes). Note that this processing is executed when the number of straight lines z is less than “3”, so that the processing is repeated for h = 1 and 2 in effect.

はみ出し場所判定処理部134は、先ず、at1・xs(z)+bt1・ys(z)+ct1=0を満たすか否か、すなわち原稿辺縁を示す直線式の始点(xs(z),ys(z))が撮像範囲の左端を示す直線式at1・x+bt1・y+ct1=0上にあるか否かを判定する(S5203)。   The protruding place determination processing unit 134 first determines whether or not at1 · xs (z) + bt1 · ys (z) + ct1 = 0, that is, the start point (xs (z), ys (z) of the linear expression indicating the document margin. )) Is on the linear equation at1.x + bt1.y + ct1 = 0 indicating the left end of the imaging range (S5203).

始点(xs(z),ys(z))がこの左端直線式上にある場合(S5203−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第1の処理(両者を纏めてはみ出し場所判定処理1と呼ぶ)を行なう(S5204)。この状態は、原稿の2頂点が、撮像画像の左側にはみ出している状態である。   If the start point (xs (z), ys (z)) is on the left end linear equation (S5203-Yes), the protruding place determination processing unit 134 specifies the protruding direction and specifies the vertex corresponding to the boundary coordinates. 1 (the two are collectively referred to as a protruding place determination process 1) (S5204). In this state, two vertices of the document protrude to the left side of the captured image.

始点(xs(z),ys(z))が左端直線式上にない場合(S5203−No)、はみ出し場所判定処理部134は次に、at1・xe(z)+bt1・ye(z)+ct1=0を満たすか否か、すなわち原稿辺縁を示す直線式の終点(xe(z),ye(z))が撮像範囲の左端を示す直線式at1・x+bt1・y+ct1=0上にあるか否かを判定する(S5205)。   When the start point (xs (z), ys (z)) is not on the left end linear equation (S5203-No), the protruding place determination processing unit 134 next performs at1 · xe (z) + bt1 · ye (z) + ct1 = 0, that is, whether the end point (xe (z), ye (z)) of the linear expression indicating the edge of the document is on the linear expression at1, x + bt1, y + ct1 = 0 indicating the left end of the imaging range. Is determined (S5205).

終点(xe(z),ye(z))がこの左端直線式at1・x+bt1・y+ct1=0上にあった場合(S5205−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第2の処理(両者を纏めてはみ出し場所判定処理2と呼ぶ)を行なう(S5206)。この状態も、原稿の2頂点が、撮像画像の左側にはみ出している状態である。   If the end point (xe (z), ye (z)) is on the left end linear expression at1.x + bt1.y + ct1 = 0 (S5205-Yes), the protruding place determination processing unit 134 specifies the protruding direction and specifies the boundary coordinates. And a second process for specifying the vertex corresponding to (the both are collectively referred to as a protruding place determination process 2) (S5206). This state is also a state in which the two vertices of the document protrude to the left side of the captured image.

以下同様にして、at2・xs(z)+bt2・ys(z)+ct2=0を満たす場合すなわち原稿辺縁を示す直線式の始点(xs(z),ys(z))が撮像範囲の右端を示す直線式at2・x+bt2・y+ct2=0上にあった場合(S5207−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第3の処理(両者を纏めてはみ出し場所判定処理3と呼ぶ)行なう(S5208)。この状態は、原稿の2頂点が、撮像画像の右側にはみ出している状態である。   Similarly, in the case where at2 · xs (z) + bt2 · ys (z) + ct2 = 0 is satisfied, that is, the starting point (xs (z), ys (z)) of the linear expression indicating the edge of the document is set at the right end of the imaging range. If the indicated straight line expression is at2.x + bt2.y + ct2 = 0 (S5207-Yes), the protruding place determination processing unit 134 specifies the protruding direction and specifies the vertex corresponding to the boundary coordinates (both are performed). The process is referred to as a protruding place determination process 3) (S5208). In this state, two vertices of the document protrude to the right side of the captured image.

さらに、at2・xe(z)+bt2・ye(z)+ct2=0を満たす場合すなわち原稿辺縁を示す直線式の終点(xe(z),ye(z))が右端直線式at2・x+bt2・y+ct2=0上にあった場合(S5209−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第4の処理(両者を纏めてはみ出し場所判定処理4と呼ぶ)行なう(S5210)。この状態も、原稿の2頂点が、撮像画像の右側にはみ出している状態である。   Further, when at2.xe (z) + bt2.ye (z) + ct2 = 0 is satisfied, that is, the end point (xe (z), ye (z)) of the linear expression indicating the edge of the original is the right end linear expression at2.x + bt2.y + ct2. If it is above 0 (S5209-Yes), the protruding place determination processing unit 134 specifies a protruding direction and specifies a vertex corresponding to the boundary coordinates (the protruding place determination processing 4 collectively includes both). Call) (S5210). This state is also a state in which two vertices of the document protrude to the right side of the captured image.

はみ出し場所判定処理1〜4の何れかを終了すると、もしくは上記条件を満たさない場合、はみ出し場所判定処理部134は、ys(z)+ct3=0を満たすか否か、すなわち原稿辺縁を示す直線式の始点(xs(z),ys(z))が撮像範囲の上端を示す直線式y+ct3=0上にあるか否かを判定する(S5211)。始点(xs(z),ys(z))が上端直線式上にある場合(S5211−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第5の処理(両者を纏めてはみ出し場所判定処理5と呼ぶ)を行なう(S5212)。 この状態は、原稿の2頂点が、撮像画像の上側にはみ出している状態である。   When any of the protruding place determination processes 1 to 4 is completed, or when the above condition is not satisfied, the protruding place determination processing unit 134 determines whether or not ys (z) + ct3 = 0 is satisfied, that is, a straight line indicating the document margin. It is determined whether or not the starting point (xs (z), ys (z)) of the equation is on the linear equation y + ct3 = 0 indicating the upper end of the imaging range (S5211). When the start point (xs (z), ys (z)) is on the upper-end straight line formula (S5211-Yes), the protruding place determination processing unit 134 specifies the protruding direction and specifies a vertex corresponding to the boundary coordinates. (The two are collectively referred to as a protruding place determination process 5) (S5212). In this state, the two vertices of the document protrude above the captured image.

以下同様にして、ye(z)+ct3=0を満たす場合すなわち原稿辺縁を示す直線式の終点(xe(z),ye(z))が撮像範囲の上端を示す直線式y+ct3=0上にあった場合(S5213−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第6の処理(両者を纏めてはみ出し場所判定処理6と呼ぶ)行なう(S5214)。この状態も、原稿の2頂点が、撮像画像の上側にはみ出している状態である。   Similarly, when ye (z) + ct3 = 0 is satisfied, that is, the end point (xe (z), ye (z)) of the linear expression indicating the edge of the document is placed on the linear expression y + ct3 = 0 indicating the upper end of the imaging range. If there is (S5213-Yes), the protruding place determination processing unit 134 performs a sixth process of specifying the protruding direction and specifying a vertex corresponding to the boundary coordinates (both are referred to as a protruding place determination process 6) ( S5214). This state is also a state in which two vertices of the document protrude above the captured image.

さらに、ys(z)+ct4=0を満たす場合すなわち原稿辺縁を示す直線式の始点(xs(z),ys(z))が撮像範囲の下端を示す直線式y+ct4=0上にあった場合(S5215−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第7の処理(両者を纏めてはみ出し場所判定処理7と呼ぶ)行なう(S5216)。この状態は、原稿の2頂点が、撮像画像の下側にはみ出している状態である。   Further, when ys (z) + ct4 = 0 is satisfied, that is, when the start point (xs (z), ys (z)) of the linear expression indicating the document margin is on the linear expression y + ct4 = 0 indicating the lower end of the imaging range. (S5215-Yes), the protruding place determination processing unit 134 performs a seventh process of specifying the protruding direction and specifying a vertex corresponding to the boundary coordinates (the two are collectively referred to as a protruding place determination process 7) (S5216). In this state, two vertices of the document protrude below the captured image.

最後に、ye(z)+ct4=0を満たす場合すなわち原稿辺縁を示す直線式の終点(xe(z),ye(z))が撮像範囲の下端を示す直線式y+ct4=0上にあった場合(S5217−Yes)、はみ出し場所判定処理部134は、はみ出し方向を特定し境界座標と対応する頂点を特定する第8の処理(両者を纏めてはみ出し場所判定処理8と呼ぶ)行なう(S5218)。この状態も、原稿の2頂点が、撮像画像の下側にはみ出している状態である。   Finally, when ye (z) + ct4 = 0 is satisfied, that is, the end point (xe (z), ye (z)) of the linear expression indicating the document margin is on the linear expression y + ct4 = 0 indicating the lower end of the imaging range. In this case (S5217-Yes), the protruding place determination processing unit 134 performs an eighth process of specifying the protruding direction and specifying a vertex corresponding to the boundary coordinates (the two are collectively referred to as a protruding place determination process 8) (S5218). . This state is also a state in which two vertices of the document protrude below the captured image.

図66は、はみ出し場所判定処理の手順の一例を示すフローチャートである。ここでは、はみ出し場所判定処理1の例で示している。図67は、この処理手順中の各ステップの処理内容について、はみ出し場所判定処理1〜8の対応を示した図表である。   FIG. 66 is a flowchart illustrating an example of the procedure of the protruding place determination process. Here, an example of the protruding place determination processing 1 is shown. FIG. 67 is a table showing the correspondence of the protruding place determination processing 1 to 8 with respect to the processing content of each step in this processing procedure.

はみ出し場所判定処理1では、原稿辺縁を示す直線式の始点(xs(z),ys(z))が撮像範囲の左端を示す直線式at1・x+bt1・y+ct1=0上にあるため、撮像画像の左側にはみ出している状態である。そこで、はみ出し場所判定処理部134は先ず、edgeleftに“1”を加算し(S5301)、そのときの始点(xs(z),ys(z))を(xb(m),yb(m))に設定する(S5302)。   In the protruding place determination processing 1, the start point (xs (z), ys (z)) of the linear expression indicating the document margin is on the linear expression at1, x + bt1, y + ct1 = 0 indicating the left end of the imaging range. Is in the state of protruding to the left side. Therefore, the protruding place determination processing unit 134 first adds “1” to edgeleft (S5301), and sets the starting point (xs (z), ys (z)) at that time to (xb (m), yb (m)). Is set to (S5302).

次に、はみ出し場所判定処理部134は、このときの始点(xs(z),ys(z))からエッジ有効部直線式算出処理S4540にて算出したy=a(z)・x+b(z)上で、yc1=a(z)・xc1+b(z)が成立するか否かを判定する(S5303)。成立する場合(S5303−Yes)、はみ出し場所判定処理部134は、頂点を推算する点と第1の直線y1を、(xc1,yc1)とこのときの直線yc1=a(z)・xc1+b(z)に設定する(S5304)。ここで、第1の直線y1は、(xc1,yc1)と(xc2,yc2)を通る原稿辺縁を示す撮像範囲内の直線に対して直交する、(xc1,yc1)を通る原稿辺縁を示す直線であって、撮像範囲の辺縁と交差する直線y=a(z)・x+b(z)である。   Next, the protruding place determination processing unit 134 calculates y = a (z) · x + b (z) calculated from the start point (xs (z), ys (z)) at this time in the edge effective part linear expression calculation processing S4540. Above, it is determined whether or not yc1 = a (z) · xc1 + b (z) holds (S5303). When the condition is satisfied (S5303-Yes), the protruding place determination processing unit 134 sets the point for estimating the vertex and the first straight line y1 to (xc1, yc1) and the straight line yc1 = a (z) · xc1 + b (z) at this time. ) (S5304). Here, the first straight line y1 is perpendicular to the straight line in the imaging range indicating the document edge passing through (xc1, yc1) and (xc2, yc2), and the document edge passing through (xc1, yc1). A straight line y = a (z) · x + b (z) that intersects the edge of the imaging range.

一方、yc1=a(z)・xc1+b(z)が成立しない場合(S5303−No)、はみ出し場所判定処理部134は、頂点を推算する点と直線y2を、(xc2,yc2)とこのときの直線yc1=a(z)・xc1+b(z)に設定する(S5305)。ここで、第2の直線y2は、(xc1,yc1)と(xc2,yc2)を通る原稿辺縁を示す撮像範囲内の直線に対して直交する、(xc2,yc2)を通る原稿辺縁を示す直線であって、撮像範囲の辺縁と交差する直線y=a(z)・x+b(z)である。   On the other hand, if yc1 = a (z) · xc1 + b (z) does not hold (S5303—No), the protruding place determination processing unit 134 sets the point for estimating the vertex and the straight line y2 to (xc2, yc2). The straight line yc1 = a (z) · xc1 + b (z) is set (S5305). Here, the second straight line y2 is perpendicular to the straight line in the imaging range indicating the document edge passing through (xc1, yc1) and (xc2, yc2), and the document edge passing through (xc2, yc2). A straight line y = a (z) · x + b (z) that intersects the edge of the imaging range.

次に、はみ出し場所判定処理部134は、オペレータmに“1”を加算して、はみ出し場所判定処理1(S5204)を終了する。   Next, the protruding place determination processing unit 134 adds “1” to the operator m, and ends the protruding place determination processing 1 (S5204).

同様に、はみ出し場所判定処理1でのステップS5301のedgeleft、ステップS5302のxb(m),yb(m)を、それぞれ図67に示すように対応付けることで、はみ出し場所判定処理2〜8についても同様に処理することができる。   Similarly, by associating the edgeleft of step S5301 and the xb (m) and yb (m) of step S5302 in the protruding place determination processing 1 as shown in FIG. 67, the same applies to the protruding place determination processings 2 to 8. Can be processed.

図68は、はみ出し頂点座標推定処理部135による2点はみ出し場所頂点推算処理(S5103)の手順の一例を示すフローチャートである。図69は、この処理手順において、はみ出し状態を推算する方向の対応を示した図表である。   FIG. 68 is a flowchart illustrating an example of the procedure of the two-point protruding location vertex estimation process (S5103) by the protruding vertex coordinate estimation processing unit 135. FIG. 69 is a table showing the correspondence of the direction in which the protruding state is estimated in this processing procedure.

はみ出し頂点座標推定処理部135は先ず、(xc1,yc1)と(xc2,yc2)間の距離dを算出する(S5401)。距離dが予め設定された原稿の縦画素と殆ど等しい場合(S5402−Yes)、はみ出し頂点座標推定処理部135は、dpを原稿の横画素に、またdを原稿の縦画素に設定し、式(36−1)に従ってdpの値(横画素数)を算出する(S5403)。一方、距離dが原稿の縦画素と等しくない場合(S5402−No)、はみ出し頂点座標推定処理部135は、dpを原稿の縦画素に、またdを原稿の横画素に設定し、式(36−2)に従ってdpの値(縦画素数)を算出する(S5404)。   The protruding vertex coordinate estimation processing unit 135 first calculates a distance d between (xc1, yc1) and (xc2, yc2) (S5401). If the distance d is almost equal to a preset vertical pixel of the document (S5402-Yes), the protruding vertex coordinate estimation processing unit 135 sets dp to a horizontal pixel of the document and d to a vertical pixel of the document, and calculates The value of dp (the number of horizontal pixels) is calculated according to (36-1) (S5403). On the other hand, if the distance d is not equal to the vertical pixel of the document (S5402-No), the protruding vertex coordinate estimation processing unit 135 sets dp to the vertical pixel of the document and d to the horizontal pixel of the document, and calculates the formula (36) The value of dp (the number of vertical pixels) is calculated according to -2) (S5404).

Figure 2004310726
Figure 2004310726

なお、上記の一連の処理においてこれらの式が適用できるのは、図33(B)の右側にケース1で示すように、1辺の全体が撮像範囲内である場合に限らない。同図のケース2で示すように、(xc1,yc1)と(xc2,yc2)のうちの一方の頂点のみが撮像範囲内の場合にも適用できる。   Note that these expressions can be applied in the above series of processing, not limited to the case where the entire one side is within the imaging range as shown in Case 1 on the right side of FIG. As shown in Case 2 of the drawing, the present invention can be applied to a case where only one vertex of (xc1, yc1) and (xc2, yc2) is within the imaging range.

次に、はみ出し頂点座標推定処理部135は、(xc1,yc1)と(xc2,yc2)間の直線がなす傾きaを算出する(S5405)。そして、はみ出し頂点座標推定処理部135は、傾きaが“0(ゼロ)”以上の場合には頂点推算方向設定処理(正)を行ない(S5406−Yes,S5407)、傾きaが0未満の場合には頂点推算方向設定処理(負)を行なう(S5406−No,S5408)。   Next, the protruding vertex coordinate estimation processing unit 135 calculates a slope a formed by a straight line between (xc1, yc1) and (xc2, yc2) (S5405). Then, the protruding vertex coordinate estimation processing unit 135 performs the vertex estimation direction setting processing (positive) when the inclination a is equal to or more than “0 (zero)” (S5406-Yes, S5407), and when the inclination a is less than 0. , A vertex estimation direction setting process (negative) is performed (S5406-No, S5408).

頂点推算方向設定処理(正)と頂点推算方向設定処理(負)において、既に算出した頂点(xc1,yc1)と(xc2,yc2)から、新たに頂点を推算する方向の設定について、たとえば、a≧0で、edgeleft=2の場合、推算する方向はx軸の−方向である。他の条件については図69に示す通りである。   In the vertex estimation direction setting process (positive) and the vertex estimation direction setting process (negative), setting of a new vertex estimation direction from the already calculated vertices (xc1, yc1) and (xc2, yc2), for example, a If ≧ 0 and edgeleft = 2, the direction to be estimated is the negative direction of the x-axis. The other conditions are as shown in FIG.

次に、はみ出し頂点座標推定処理部135は、(xc1,yc1)からステップS5407またはステップS5408で設定した方向に第1の直線y1上の距離dpの点(xc3,yc3)を頂点と設定する(S5409)。ここで、第1の直線y1は、図66のステップS5304と同様である。   Next, the protruding vertex coordinate estimation processing unit 135 sets a point (xc3, yc3) at a distance dp on the first straight line y1 in the direction set in step S5407 or step S5408 from (xc1, yc1) as a vertex ( S5409). Here, the first straight line y1 is similar to step S5304 in FIG.

次に、はみ出し頂点座標推定処理部135は、(xc2,yc2)からステップS5407またはステップS5408で設定した方向に第1の直線y2上の距離dpの点(xc4,yc4)を頂点と設定して(S5410)、2点はみ出し場所頂点推算処理S5103を終了する。ここで、第2の直線y2は、図66のステップS5305と同様である。   Next, the protruding vertex coordinate estimation processing unit 135 sets a point (xc4, yc4) at a distance dp on the first straight line y2 in the direction set in step S5407 or step S5408 from (xc2, yc2) as a vertex. (S5410) The two-point protruding place vertex estimation processing S5103 ends. Here, the second straight line y2 is similar to step S5305 in FIG.

図70は、はみ出し頂点座標推定処理部135による2点はみ出し場所頂点推算処理(S5103)による処理結果例を示す図である。ここでは、図37や図49などに示したと同様に、原稿の4辺のうち3辺が撮像範囲内に存在する撮像画像を処理対象とする場合(3辺検出時)を示している。上記の2点はみ出し場所頂点推算処理によって、(xc1,yc1)に対向する上端にはみ出した頂点(xc3,yc3)と、(xc2,yc2)に対向する上端にはみ出した頂点(xc4,yc4)が推算される。これによって、矩形状の原稿の4つの頂点座標が特定される。   FIG. 70 is a diagram illustrating a processing result example of the two-point protruding place vertex estimation processing (S5103) by the protruding vertex coordinate estimation processing unit 135. Here, as shown in FIGS. 37 and 49, a case is shown in which a captured image in which three sides of the four sides of the document are present within the imaging range is to be processed (when three sides are detected). By the above-mentioned two-point protruding place vertex estimation processing, a vertex (xc3, yc3) protruding to the upper end facing (xc1, yc1) and a vertex (xc4, yc4) protruding to the upper end facing (xc2, yc2) are obtained. Is estimated. Thus, the coordinates of the four vertices of the rectangular document are specified.

図71は、境界部分特定処理部136による境界部分特定処理(S4012)と非検査領域設定部138による非検査部設定処理(S4014)の概要を示すフローチャートである。   FIG. 71 is a flowchart showing an outline of the boundary part specifying processing (S4012) by the boundary part specifying processing unit 136 and the non-inspection part setting processing (S4014) by the non-inspection area setting unit 138.

境界部分特定処理部136は先ず、直線数zが“4”、すなわちエッジ有効部直線式算出部126にて原稿辺縁をなす直線が4本見つかっている(z=4)のか否かを判定する(S5501)。直線数zが“4”の場合には(S5501−Yes)、境界部分特定処理部136と非検査領域設定部138にて4辺検出による境界部分特定処理と非検査部設定処理(纏めて非検査領域特定処理)(S5502)を行なう。この4辺検出による非検査領域特定処理の対象となるはみ出し状態は、透視変換後の撮像画像範囲の右上コーナーにて、その上端と右端で、はみ出した状態にある撮像画像を処理対象とする場合がその一例である。   First, the boundary part specifying processing unit 136 determines whether or not the number of straight lines z is “4”, that is, four straight lines forming the document margin have been found (z = 4) by the edge effective part straight line formula calculating unit 126. (S5501). If the number of straight lines z is “4” (S5501-Yes), the boundary part specifying processing unit 136 and the non-inspection area setting unit 138 detect the boundary part by detecting four sides and the non-inspection part setting processing (non-inspection part collectively). Inspection area specifying processing) (S5502) is performed. The protruding state which is the target of the non-inspection area specifying process by the four side detection is a case where the image to be processed is a protruding state at the upper right end and the upper right corner of the upper right corner of the captured image range after the perspective transformation. Is an example.

一方、直線数zが“3”の場合には(S5501−No)、境界部分特定処理部136と非検査領域設定部138にて3辺検出による境界部分特定処理と非検査部設定処理(纏めて非検査領域特定処理)を実行する(S5504)。この4辺検出による非検査領域特定処理の対象となるはみ出し状態は、隣接する2つの原稿頂点が撮像範囲からはみ出した状態にある撮像画像を処理対象とする場合がその一例である。   On the other hand, when the number of straight lines z is “3” (S5501-No), the boundary part specifying processing unit 136 and the non-inspection area setting unit 138 detect the boundary part by three sides detection and the non-inspection part setting processing (summary). Then, a non-inspection area specifying process is executed (S5504). The protruding state to be subjected to the non-inspection area specifying process by the detection of the four sides is, for example, a case where a picked-up image in which two adjacent document vertices are protruding from the pick-up area is to be processed.

これに対して、直線数zが“2”以下の場合には(S5503−No)、1つの原稿頂点しか求められず、非検査領域を設定することも難しいので、画像検査処理自体を実行しないようにする(たとえば処理を直ちに停止する)ため、エラー処理をする(S5505)。   On the other hand, when the number z of straight lines is equal to or less than “2” (S5503-No), only one document vertex is obtained, and it is difficult to set a non-inspection area. Error processing is performed in order to make the processing (for example, immediately stop the processing) (S5505).

図72は、4辺検出による非検査領域特定処理(S5502)の概要を示すフローチャートである。境界部分特定処理部136と非検査領域設定部138は、第1の原稿頂点(xc1,yc1)に着目した非検査領域特定処理11を行ない(S5601)、次に、第2の原稿頂点(xc2,yc2)に着目した非検査領域特定処理12を行ない(S5602)、次に、第3の原稿頂点(xc3,yc3)に着目した非検査部領域処理13を行ない(S5603)、次に、第4の原稿頂点(xc4,yc4)に着目した非検査領域特定処理14を行ない(S5604)、4辺検出による非検査領域特定処理を終了する。   FIG. 72 is a flowchart showing an outline of the non-inspection area specifying process (S5502) by detecting four sides. The boundary part specification processing unit 136 and the non-inspection area setting unit 138 perform the non-inspection area specification processing 11 focusing on the first document vertex (xc1, yc1) (S5601), and then perform the second document vertex (xc2). , Yc2), a non-inspection area specifying process 12 is performed (S5602), and then a non-inspection area process 13 is performed, focusing on the third document vertex (xc3, yc3) (S5603). Then, the non-inspection area specifying processing 14 focusing on the vertex (xc4, yc4) of the original 4 is performed (S5604), and the non-inspection area specifying processing by detecting the four sides is completed.

図73は、非検査領域特定処理の手順の一例を示したフローチャートである。ここでは、第1の原稿頂点(xc1,yc1)に着目した非検査領域特定処理11(S5601)の例で示している。   FIG. 73 is a flowchart illustrating an example of the procedure of the non-inspection area specifying process. Here, an example of the non-inspection area specifying process 11 (S5601) focusing on the first document vertex (xc1, yc1) is shown.

境界部分特定処理部136と非検査領域設定部138は、はみ出し場所判定処理部134により撮像範囲からはみ出していると判定された原稿頂点に関して、撮像範囲との境界部分、すなわちこの原稿頂点から延びる直線と撮像範囲の辺縁との交点を特定する。このとき、境界部分特定処理部136は、原稿辺縁をなす有効エッジ部分に基づいてエッジ有効部直線式算出部126により算出された、延長線上に前記原稿頂点を含む直線の両端の座標が、撮像画像のどの端縁に接するのかを判定し、その判定結果に基づいて、原稿がはみ出した方向を判断することで原稿辺縁と撮像範囲との交点座標を特定する。   The boundary part specifying processing unit 136 and the non-inspection area setting unit 138 determine the boundary between the document vertex determined to be out of the imaging range by the protruding place determination processing unit 134 and the straight line extending from the document vertex. The point of intersection with the edge of the imaging range is specified. At this time, the boundary part specifying processing unit 136 calculates the coordinates of both ends of the straight line including the document vertex on the extension line, calculated by the edge valid part straight line type calculation unit 126 based on the valid edge part forming the document margin. It is determined which edge of the captured image is in contact with the image, and based on the determination result, the direction in which the document protrudes is determined, thereby specifying the intersection coordinates between the document edge and the imaging range.

たとえば、境界部分特定処理部136は、第1の原稿頂点(xc1,yc1)が撮像範囲からはみ出しているかどうかを判定して、(xc1,yc1)と撮像画像の境界座標間を非検査領域に設定する。このため、境界部分特定処理部136は先ず、at1・xc1+bt1・yc1+ct1<0を満たすか否か、すなわち第1の原稿頂点(xc1,yc1)が撮像範囲の左端からはみ出しているかどうかを判定する(S5701)。   For example, the boundary part specifying processing unit 136 determines whether the first document vertex (xc1, yc1) is out of the imaging range, and sets the space between (xc1, yc1) and the boundary coordinates of the captured image as the non-inspection area. Set. For this reason, first, the boundary part specifying processing unit 136 determines whether at1 · xc1 + bt1 · yc1 + ct1 <0 is satisfied, that is, whether the first document vertex (xc1, yc1) is protruding from the left end of the imaging range ( S5701).

そしてこの条件を満たす場合(S5701−Yes)、境界部分特定処理部136は、ステップS4802で(xc1,yc1)を算出した直線1と境界線at1・x+bt1・y+ct1=0の交点(xbc1,ybc1)、およびステップS4802で(xc1,yc1)を算出した直線2と境界線at1・x+bt1・y+ct1=0の交点(xbc2,ybc2)が、それぞれ境界座標であると特定する。   If this condition is satisfied (S5701-Yes), the boundary part specification processing unit 136 makes an intersection (xbc1, ybc1) between the straight line 1 for which (xc1, yc1) was calculated in step S4802 and the boundary line at1, x + bt1, y + ct1 = 0. , And the intersection (xbc2, ybc2) of the straight line 2 for which (xc1, yc1) is calculated in step S4802 and the boundary line at1, x + bt1, y + ct1 = 0 are specified as boundary coordinates.

非検査領域設定部138は、第1の原稿頂点(xc1,yc1)と、境界部分特定処理部136が特定した2つの境界座標(xbc1,ybc1)、(xbc2,ybc2)とで囲まれた3角形の領域を非検査領域に設定する(S5702)。   The non-inspection area setting unit 138 is a 3 surrounded by the first original vertex (xc1, yc1) and the two boundary coordinates (xbc1, ybc1) and (xbc2, ybc2) specified by the boundary part specification processing unit 136. The rectangular area is set as a non-inspection area (S5702).

ステップS5701の条件を満たさない場合(S5701−No)やステップS5702の後、境界部分特定処理部136は、yc1+ct3>0を満たすか否か、すなわち第1の原稿頂点(xc1,yc1)が撮像範囲の上端からはみ出しているかどうかを判定する(S5703)。そしてこの条件を満たす場合(S5703−Yes)、境界部分特定処理部136は、ステップS4802で(xc1,yc1)を算出した直線1と境界線yc1+ct3=0の交点(xbc3,ybc3)、およびステップS4802で(xc1,yc1)を算出した直線2と境界線yc1+ct3=0の交点(xbc4,ybc4)が、それぞれ境界座標であると特定する。   When the condition of step S5701 is not satisfied (S5701-No) or after step S5702, the boundary part specifying processing unit 136 determines whether or not yc1 + ct3> 0 is satisfied, that is, the first document vertex (xc1, yc1) is the imaging range. It is determined whether it protrudes from the upper end of (S5703). If this condition is satisfied (S5703-Yes), the boundary part specifying processing unit 136 determines the intersection (xbc3, ybc3) of the straight line 1 for which (xc1, yc1) was calculated in step S4802 and the boundary line yc1 + ct3 = 0, and step S4802. Then, the intersection (xbc4, ybc4) of the straight line 2 for which (xc1, yc1) is calculated and the boundary line yc1 + ct3 = 0 are specified as boundary coordinates.

非検査領域設定部138は、第1の原稿頂点(xc1,yc1)と、境界部分特定処理部136が特定した2つの境界座標(xbc3,ybc3)、(xbc4,ybc4)とで囲まれた3角形の領域を非検査領域に設定する(S5704)。   The non-inspection area setting unit 138 is a 3 surrounded by the first document vertex (xc1, yc1) and the two boundary coordinates (xbc3, ybc3) and (xbc4, ybc4) specified by the boundary part specification processing unit 136. The rectangular area is set as a non-inspection area (S5704).

ステップS5703の条件を満たさない場合(S5703−No)やステップS5704の後、境界部分特定処理部136は、at2・xc1+bt2・yc1+ct2>0を満たすか否か、すなわち第1の原稿頂点(xc1,yc1)が撮像範囲の右端からはみ出しているかどうかを判定する(S5705)。   When the condition of step S5703 is not satisfied (S5703-No) or after step S5704, the boundary part specifying processing unit 136 determines whether at2 · xc1 + bt2 · yc1 + ct2> 0 is satisfied, that is, the first document vertex (xc1, yc1). ) Protrude from the right end of the imaging range (S5705).

そしてこの条件を満たす場合(S5705−Yes)、境界部分特定処理部136は、ステップS4802で(xc1,yc1)を算出した直線1と境界線at2・x+bt2・y+ct2=0の交点(xbc5,ybc5)、およびステップS4802で(xc1,yc1)を算出した直線2と境界線at2・x+bt2・y+ct2=0の交点(xbc6,ybc6)が、それぞれ境界座標であると特定する。   If this condition is satisfied (S5705-Yes), the boundary part specifying processing unit 136 intersects (xbc5, ybc5) the straight line 1 for which (xc1, yc1) was calculated in step S4802 and the boundary line at2.x + bt2.y + ct2 = 0. , And the intersection (xbc6, ybc6) of the straight line 2 for which (xc1, yc1) was calculated in step S4802 and the boundary line at2.x + bt2.y + ct2 = 0 are specified as boundary coordinates.

非検査領域設定部138は、第1の原稿頂点(xc1,yc1)と、境界部分特定処理部136が特定した2つの境界座標(xbc5,ybc5)、(xbc6,ybc6)とで囲まれた3角形の領域を非検査領域に設定する(S5706)。   The non-inspection area setting unit 138 is a 3 surrounded by the first original vertex (xc1, yc1) and the two boundary coordinates (xbc5, ybc5) and (xbc6, ybc6) specified by the boundary part specification processing unit 136. The rectangular area is set as a non-inspection area (S5706).

最後に、ステップS5705の条件を満たさない場合(S5705−No)やステップS5706の後、境界部分特定処理部136は、yc1+ct4<0を満たすか否か、すなわち第1の原稿頂点(xc1,yc1)が撮像範囲の下端からはみ出しているかどうかを判定する(S5707)。そしてこの条件を満たす場合(S5707−Yes)、境界部分特定処理部136は、ステップS4802で(xc1,yc1)を算出した直線1と境界線yc1+ct4=0の交点(xbc7,ybc7)、およびステップS4802で(xc1,yc1)を算出した直線2と境界線yc1+ct4=0の交点(xbc8,ybc8)が、それぞれ境界座標であると特定する。   Finally, when the condition of step S5705 is not satisfied (S5705-No) or after step S5706, the boundary part specifying processing unit 136 determines whether or not yc1 + ct4 <0 is satisfied, that is, the first document vertex (xc1, yc1). Is determined to protrude from the lower end of the imaging range (S5707). If this condition is satisfied (S5707-Yes), the boundary part specifying processing unit 136 determines the intersection (xbc7, ybc7) of the straight line 1 for which (xc1, yc1) was calculated in step S4802 and the boundary line yc1 + ct4 = 0, and step S4802. Then, the intersection (xbc8, ybc8) of the straight line 2 calculated with (xc1, yc1) and the boundary line yc1 + ct4 = 0 is specified as the boundary coordinates.

非検査領域設定部138は、第1の原稿頂点(xc1,yc1)と、境界部分特定処理部136が特定した2つの境界座標(xbc7,ybc7)、(xbc8,ybc8)とで囲まれた3角形の領域を非検査領域に設定して(S5708)、非検査領域特定処理11を終了する。   The non-inspection area setting unit 138 is a 3 surrounded by the first document vertex (xc1, yc1) and the two boundary coordinates (xbc7, ybc7) and (xbc8, ybc8) specified by the boundary part specification processing unit 136. The rectangular area is set as the non-inspection area (S5708), and the non-inspection area identification processing 11 ends.

非検査領域特定処理12(S5602)の場合は、非検査領域特定処理11における(xc1,yc1)を(xc2,yc2)に変更して同様の処理を行なう。また、非検査領域特定処理13(S5603)の場合は、非検査領域特定処理11における(xc1,yc1)を(xc3,yc3)に変更して同様の処理を行なう。また、非検査領域特定処理14(S5604)の場合は、非検査領域特定処理11における(xc1,yc1)を(xc4,yc4)に変更して同様の処理を行なう。   In the case of the non-inspection area specifying processing 12 (S5602), the same processing is performed by changing (xc1, yc1) to (xc2, yc2) in the non-inspection area specifying processing 11. In the case of the non-inspection area specifying processing 13 (S5603), the same processing is performed by changing (xc1, yc1) to (xc3, yc3) in the non-inspection area specifying processing 11. In the case of the non-inspection area specifying processing 14 (S5604), the same processing is performed by changing (xc1, yc1) to (xc4, yc4) in the non-inspection area specifying processing 11.

図74は、境界部分特定処理部136と非検査領域設定部138による、4辺検出による非検査領域特定処理(S5502)による処理結果例を示す図である。ここでは、図36や図48などに示したと同様に、原稿の4辺の全てが撮像範囲内に存在する撮像画像を処理対象とする場合(4辺検出時)の処理結果を示している。   FIG. 74 is a diagram illustrating an example of a processing result of a non-inspection area specifying process (S5502) by detecting four sides by the boundary portion specifying processing unit 136 and the non-inspection area setting unit 138. Here, similarly to FIGS. 36 and 48, the processing results when a captured image in which all four sides of the document exist within the imaging range are to be processed (when four sides are detected).

上記の4辺検出による非検査領域特定処理によって、(xc4,yc4)、(xbc3,ybc3)、(xbc4,ybc4)の3点で囲まれた領域と、(xc2,yc2)、(xbc5,ybc5)、(xbc6,ybc6)の3点で囲まれた2つの領域が、それぞれ非検査領域に設定される。   By the non-inspection area specifying process by the above-described four side detection, an area surrounded by three points (xc4, yc4), (xbc3, ybc3), and (xbc4, ybc4), and (xc2, yc2), (xbc5, ybc5) ) And (xbc6, ybc6) are respectively set as non-inspection areas.

なお、上記説明では、矩形状の原稿を処理対象としていたが、原稿の4辺が撮像範囲内に存在する場合には、矩形に限らず、任意の角形に対しても適応できる。これに対して、3辺のみが撮像範囲内に存在する場合には、残りの1辺について、矩形を前提に推測する必要があるので、任意の角形に対して対応することは難しい。ただし、処理が煩雑になるものの、S5402の処理にて、dが何れの辺の長さに対応するのかを判定し、それに応じた残りの辺について推測処理を行なうように変形すれば、3辺検出の場合であっても、任意の角形に対しても適応できる。   In the above description, a rectangular original is to be processed. However, when four sides of the original are present in the imaging range, the present invention can be applied to not only a rectangular shape but also an arbitrary square shape. On the other hand, when only three sides are present in the imaging range, it is necessary to guess the remaining one side based on a rectangle, and it is difficult to deal with an arbitrary square. However, although the processing becomes complicated, if it is determined in the processing of S5402 that d corresponds to which length of the side and the estimation processing is performed on the remaining side corresponding thereto, three sides are obtained. Even in the case of detection, it can be applied to any square.

図75は、3辺検出による非検査領域特定処理(S5504)の概要を示すフローチャートである。   FIG. 75 is a flowchart showing an outline of the non-inspection area specifying process (S5504) by detecting three sides.

境界部分特定処理部136は、4辺検出による非検査領域特定処理(S5502)と同様に、はみ出し場所判定処理部134により撮像範囲からはみ出していると判定された原稿頂点に関して、原稿辺縁をなす有効エッジ部分に基づいてエッジ有効部直線式算出部126により算出された、延長線上に前記原稿頂点を含む直線の両端の座標が、撮像画像のどの端縁に接するのかを判定し、その判定結果に基づいて、原稿がはみ出した方向を判断することで原稿辺縁と撮像範囲との交点座標を特定する。   Similar to the non-inspection area specification processing by four side detection (S5502), the boundary part specification processing unit 136 forms a document edge with respect to the document vertex determined to be out of the imaging range by the protruding place determination processing unit 134. A determination is made as to which edge of the picked-up image the coordinates of both ends of the straight line including the original vertex on the extension line, calculated by the edge valid part straight line type calculation unit 126 based on the valid edge portion, are determined. Then, the coordinates of the intersection between the document margin and the imaging range are specified by determining the direction in which the document protrudes.

このため先ず、境界部分特定処理部136は、edgeleft,edgetop ,edgeright ,edgebottomがそれぞれ“2”であるか否か、すなわち隣接する2つの原稿頂点が何れも撮像範囲の1つの端縁をなす直線よりも外側に位置するか否かを順次判定する(S5801〜S5804)。つまり、図37の(A)〜(D)の何れかにある状態の判定である。   For this reason, first, the boundary part specifying processing unit 136 determines whether or not the edgeleft, edgetop, edgeright, and edgebottom are each “2”, that is, a straight line in which two adjacent document vertices all form one edge of the imaging range. It is sequentially determined whether or not it is located outside (S5801 to S5804). That is, it is the determination of the state in any of (A) to (D) of FIG.

そして、edgeleftが“2”の場合(S5801−Yes)、または、edgetop が“2”の場合(S5802−Yes)、または、edgeright が“2”の場合(S5803−Yes)、または、edgebottomが“2”の場合(S5804−Yes)は、境界部分特定処理部136は、ステップS5409で(xc3,yc3)を算出した第1の直線y1とはみ出し対象の撮像範囲の端縁を示す直線との交点(xb(1),yb(1))、およびステップS5410で(xc4,yc4)を算出した第2の直線y2とはみ出し対象の撮像範囲の端縁を示す直線との交点(xb(2),yb(2))が、それぞれ境界座標であると特定する。   When edgeleft is “2” (S5801-Yes), when edgetop is “2” (S5802-Yes), or when edgeright is “2” (S5803-Yes), or when edgebottom is “ In the case of “2” (S5804-Yes), the boundary part specifying processing unit 136 determines the intersection of the first straight line y1 for which (xc3, yc3) was calculated in step S5409 with the straight line indicating the edge of the imaging range to be protruded. (Xb (1), yb (1)), and the intersection (xb (2), yb (2), yb (2)) are specified as boundary coordinates.

そして、非検査領域設定部138は、撮像範囲からはみ出している2つの原稿頂点(xc3,yc3)、(xc4,yc4)と、境界部分特定処理部136が特定した2つの境界座標(xb(1),yb(1))、(xb(2),yb(2))の、計4点で囲まれた領域を非検査領域に設定し(S5805)、3辺検出による非検査領域特定処理を終了する。   Then, the non-inspection area setting unit 138 outputs the two document vertices (xc3, yc3) and (xc4, yc4) protruding from the imaging range and the two boundary coordinates (xb (1) specified by the boundary part specifying processing unit 136. ), Yb (1)) and (xb (2), yb (2)) are set as non-inspection areas (S5805), and non-inspection area specifying processing by three-side detection is performed. finish.

一方、edgeleft,edgetop ,edgeright ,edgebottomの何れもが“2”でない場合には、境界部分特定処理部136はそれぞれが“1”である組合せを順次判定し、非検査領域設定部138はその判定結果に応じた非検査領域設定処理をする。この判定は、隣接する2つの原稿頂点が撮像範囲のあるコーナー側に位置していて、その内の一方がそのコーナーの端縁をなす一方の直線よりも外側に位置し、かつ他方の頂点がこの一方の直線と交差する、端縁をなす他方の直線よりも外側に位置しているか否かの判定である。つまり、図37の(E)〜(H)の何れかにある状態の判定である。   On the other hand, if none of edgeleft, edgetop, edgeright, and edgebottom is “2”, the boundary part specification processing unit 136 sequentially determines combinations each of which is “1”, and the non-inspection area setting unit 138 determines the combination. A non-inspection area setting process according to the result is performed. In this determination, two adjacent vertices of the document are located on the corner side of the imaging range, one of them is located outside one straight line forming the edge of the corner, and the other vertex is located on the other side. This is a determination as to whether or not it is located outside the other straight line that forms an edge and intersects with this one straight line. That is, it is the determination of the state in any of (E) to (H) of FIG.

たとえば先ず、edgeleftとedgetopが“1”の場合(S5806−Yes)、境界部分特定処理部136は、2つの原稿頂点が図37(E)に示したように左上側にはみ出していると判断し、非検査領域設定部138との協働により、左上側コーナーについての非検査領域設定処理21を行なう(S5807)。   For example, first, when edgeleft and edgetop are “1” (S5806-Yes), the boundary part specifying processing unit 136 determines that the two document vertices protrude to the upper left as shown in FIG. In cooperation with the non-inspection area setting unit 138, the non-inspection area setting processing 21 for the upper left corner is performed (S5807).

edgetop とedgeright が“1”の場合(S5808−Yes)、境界部分特定処理部136は、2つの原稿頂点が図37(F)に示したように右上側にはみ出していると判断し、非検査領域設定部138との協働により、右上側コーナーについての非検査領域設定処理22を行なう(S5809)。   If edgetop and edgeright are “1” (S5808-Yes), the boundary part specification processing unit 136 determines that the two document vertices protrude to the upper right side as shown in FIG. The non-inspection area setting process 22 for the upper right corner is performed in cooperation with the area setting unit 138 (S5809).

edgeright とedgebottomが“1”の場合(S5810−Yes)、境界部分特定処理部136は、2つの原稿頂点が図37(G)に示したように右下側にはみ出していると判断し、非検査領域設定部138との協働により、右下側コーナーについての非検査領域設定処理23を行なう(S5811)。   When edgeright and edgebottom are “1” (S5810-Yes), the boundary part specifying processing unit 136 determines that the two document vertices protrude to the lower right side as shown in FIG. The non-inspection area setting process 23 is performed on the lower right corner in cooperation with the inspection area setting unit 138 (S5811).

edgebottomとedgeleftが“1”の場合(S5812−Yes)、境界部分特定処理部136は、2つの原稿頂点が図37(H)に示したように左下側にはみ出していると判断し、非検査領域設定部138との協働により、左下側コーナーについての非検査領域設定処理24を行ない(S5813)、3辺検出による非検査領域特定処理を終了する。   If edgebottom and edgeleft are “1” (S5812-Yes), the boundary part specifying processing unit 136 determines that the two document vertices protrude to the lower left as shown in FIG. In cooperation with the area setting unit 138, the non-inspection area setting processing 24 for the lower left corner is performed (S5813), and the non-inspection area specifying processing by detecting three sides is completed.

図76は、各コーナーについての3辺検出による非検査領域設定処理の手順の一例を示すフローチャートである。ここでは、左上側コーナーについての非検査領域設定処理21(S5807)の例で示している。   FIG. 76 is a flowchart illustrating an example of a procedure of a non-inspection area setting process by detecting three sides for each corner. Here, an example of the non-inspection area setting process 21 (S5807) for the upper left corner is shown.

図77は、この処理手順において、非検査領域を特定するための原稿頂点と2つの交点の対応を示した図表である。右上側、右下側、および左下側の各コーナーについての非検査領域設定処理22〜24については、この図77に示す対応に従って実行すればよい。   FIG. 77 is a table showing the correspondence between the document vertex and two intersections for specifying the non-inspection area in this processing procedure. The non-inspection area setting processes 22 to 24 for the upper right, lower right, and lower left corners may be executed according to the correspondence shown in FIG.

境界部分特定処理部136は先ず、撮像範囲からはみ出している2つの原稿頂点(xc3,yc3)と(xc4,yc4)間の、撮像範囲外の原稿辺縁をなす直線式y=a(4)・x+b(4)を算出する(S5901)。次いで境界部分特定処理部136は、ステップS5409で(xc3,yc3)を算出した第1の直線y1とはみ出し対象の撮像範囲の端縁を示す直線との交点(xb(1),yb(1))、およびステップS5901で算出した直線yとはみ出し対象の撮像範囲の端縁を示す直線との交点(xb(3),yb(3))が、それぞれ境界座標であると特定する(S5902)。   First, the boundary part specification processing unit 136 forms a straight line formula y = a (4) that forms a document margin outside the imaging range between the two document vertices (xc3, yc3) and (xc4, yc4) protruding from the imaging range. X + b (4) is calculated (S5901). Next, the boundary part specifying processing unit 136 determines the intersection (xb (1), yb (1)) between the first straight line y1 for which (xc3, yc3) was calculated in step S5409 and the straight line indicating the edge of the imaging range to be protruded. ), And the intersection (xb (3), yb (3)) of the straight line y calculated in step S5901 and the straight line indicating the edge of the protruding target imaging range are specified as the boundary coordinates (S5902).

また、境界部分特定処理部136は、ステップS5410で(xc4,yc4)を算出した第2の直線y2とはみ出し対象の撮像範囲の端縁を示す直線との交点(xb(2),yb(2))、およびステップS5901で算出した直線yとはみ出し対象の撮像範囲の端縁を示す直線との交点(xb(4),yb(4))が、それぞれ境界座標であると特定する(S5903)。   In addition, the boundary part specifying processing unit 136 determines the intersection (xb (2), yb (2) of the second straight line y2 for which (xc4, yc4) is calculated in step S5410 with the straight line indicating the edge of the imaging range to be projected )) And the intersection (xb (4), yb (4)) of the straight line y calculated in step S5901 and the straight line indicating the edge of the protruding target imaging range are specified as boundary coordinates (S5903). .

そして、非検査領域設定部138は、撮像範囲からはみ出している第1の原稿頂点(xc3,yc3)と、境界部分特定処理部136がステップS5902にて特定した2つの境界座標(xb(1),yb(1))、(xb(3),yb(3))の、計3点で囲まれた領域を非検査領域(非検査部1)に設定する(S5904)。また、非検査領域設定部138は、撮像範囲からはみ出している第2の原稿頂点(xc4,yc4)と、境界部分特定処理部136がステップS5903にて特定した2つの境界座標(xb(2),yb(2))、(xb(4),yb(4))の、計3点で囲まれた領域を非検査領域(非検査部2)に設定し(S5905)、非検査領域設定処理21を終了する。   Then, the non-inspection area setting unit 138 determines the first document vertex (xc3, yc3) protruding from the imaging range and the two boundary coordinates (xb (1)) specified by the boundary part specification processing unit 136 in step S5902. , Yb (1)) and (xb (3), yb (3)) are set as the non-inspection area (non-inspection unit 1) (S5904). Further, the non-inspection area setting unit 138 determines the second document vertex (xc4, yc4) protruding from the imaging range and the two boundary coordinates (xb (2)) specified by the boundary part specification processing unit 136 in step S5903. , Yb (2)) and (xb (4), yb (4)) are set as the non-inspection area (non-inspection unit 2) (S5905), and the non-inspection area setting processing is performed. 21 is ended.

これらの処理は、撮像範囲からはみ出している2つの原稿頂点(xc3,yc3)と(xc4,yc4)間に形成される原稿辺縁をなす直線を求めることで、矩形状の原稿辺縁をなす4つの直線式を特定してから、非検査領域を設定するもので、4辺検出による非検査領域特定処理(S5502)と、事実上等価となる。   These processes form a rectangular document edge by obtaining a straight line that forms a document edge formed between two document vertices (xc3, yc3) and (xc4, yc4) that protrude from the imaging range. The non-inspection area is set after the four straight line equations are specified, which is practically equivalent to the non-inspection area specification processing by detecting four sides (S5502).

図78および図79は、境界部分特定処理部136と非検査領域設定部138による、3辺検出による非検査領域特定処理(S5504)による処理結果例を示す図である。ここで、図78は、図37(B)や図49などに示したと同様に、透視変換後の撮像画像範囲の上端にて、2つの原稿頂点が、撮像範囲からはみ出した状態にある撮像画像を処理対象とする場合の処理結果を示している。   FIGS. 78 and 79 are diagrams illustrating an example of the processing result of the non-inspection area specifying process (S5504) by the three-side detection by the boundary portion specifying processing unit 136 and the non-inspection area setting unit 138. Here, FIG. 78 shows a captured image in which two document vertices are out of the imaging range at the upper end of the captured image range after the perspective transformation, as shown in FIGS. 37B and 49. Shows a processing result in the case where is set as a processing target.

この状態では、edgetop が“2”のため、上記の3辺検出による非検査領域特定処理において、ステップS5802を経由したステップS5805の処理によって、(xc3,yc3)、(xc4,yc4)、(xb(1),yb(1))、(xb(2),yb(2))で囲まれた4角形の領域が非検査領域に設定される。   In this state, since the edgetop is “2”, in the above-described non-inspection area specifying processing by three side detection, (xc3, yc3), (xc4, yc4), (xb A rectangular area surrounded by (1), yb (1)) and (xb (2), yb (2)) is set as a non-inspection area.

一方、図79は、2つの原稿頂点が図37(E)に示したように左上側にはみ出している場合の処理結果を示している。この状態では、edgeleftとedgetopが“1”のため、上記の3辺検出による非検査領域特定処理において、ステップS5806を経由した非検査領域設定処理21(S5807)によって、先ず、図79(A)に示すように、第3の直線y3=a(4)・x+b(4)が特定される。   On the other hand, FIG. 79 shows a processing result when two document vertices protrude to the upper left as shown in FIG. In this state, since edgeleft and edgetop are “1”, in the above-described non-inspection area specifying processing by three-side detection, the non-inspection area setting processing 21 (S5807) via step S5806 first performs FIG. , A third straight line y3 = a (4) .x + b (4) is specified.

そして、図79(B)に示すように、原稿頂点(xc3,yc3)、境界座標(xb(1),yb(1))、(xb(3),yb(3))の、計3点で囲まれた3角形の非検査部1が非検査領域に設定される。また、図79(C)に示すように、原稿頂点(xc4,yc4)、境界座標(xb(2),yb(2))、(xb(4),yb(4))の、計3点で囲まれた3角形の非検査部2が非検査領域に設定される。   Then, as shown in FIG. 79 (B), a total of three points of the document vertex (xc3, yc3), the boundary coordinates (xb (1), yb (1)), and (xb (3), yb (3)) The triangular non-inspection section 1 surrounded by is set in the non-inspection area. Further, as shown in FIG. 79 (C), a total of three points of the document vertex (xc4, yc4), boundary coordinates (xb (2), yb (2)), (xb (4), yb (4)) The triangular non-inspection section 2 surrounded by is set in the non-inspection area.

以上説明したように、第3実施形態の構成に依れば、チルトスキャンにより撮像画像の原稿の複数の頂点が撮像画像からはみ出した場合に対しても、撮像範囲内に4辺が存在する場合には、4辺のエッジ有効部を検出することで、頂点を推算して非検査部を設定することにより、はみ出し部分を検査対象から除外して基準画像と比較することができる。   As described above, according to the configuration of the third embodiment, even when a plurality of vertices of the document of the captured image protrude from the captured image due to the tilt scan, there are four sides within the imaging range. By detecting the edge effective portions of the four sides, estimating the vertices and setting the non-inspection portion, the protruding portion can be excluded from the inspection target and compared with the reference image.

また、撮像範囲内に4辺が存在しないが3辺が存在する場合には、3辺のエッジ有効部を検出することで、頂点を推算して非検査部を設定することにより、はみ出し部分を検査対象から除外して基準画像と比較することができる。   When there are no four sides but three sides in the imaging range, by detecting an edge effective part of the three sides and estimating a vertex and setting a non-inspection part, a protruding part is determined. It can be excluded from the inspection target and compared with the reference image.

<<電子計算機での対応>>
図80は、CPUやメモリを利用して、上述した各実施形態の画像検査装置5をソフトウェア的に構成する、すなわち電子計算機(コンピュータ)を用いて構成する場合のハードウェア構成の一例を示した図である。
<< Response by computer >>
FIG. 80 illustrates an example of a hardware configuration in which the image inspection apparatus 5 of each of the above-described embodiments is configured as software using a CPU and a memory, that is, configured using an electronic computer (computer). FIG.

画像検査装置5を構成するコンピュータシステム900は、CPU902、ROM(Read Only Memory)904、RAM906、および通信I/F(インターフェース)908を備える。RAM906は、撮像画像データを格納する領域を含んでいる。   The computer system 900 constituting the image inspection apparatus 5 includes a CPU 902, a ROM (Read Only Memory) 904, a RAM 906, and a communication I / F (interface) 908. The RAM 906 includes an area for storing captured image data.

また、たとえばメモリ読出部907、ハードディスク装置914、フレキシブルディスク(FD)ドライブ916、あるいはCD−ROM(Compact Disk ROM)ドライブ918などの、記憶媒体からデータを読み出したり記録したりするための記録・読取装置を備えてもよい。画像データは、データバスを通じて各ハードウェア間をやり取りされる。   In addition, recording / reading for reading / recording data from / to a storage medium such as a memory reading unit 907, a hard disk device 914, a flexible disk (FD) drive 916, or a CD-ROM (Compact Disk ROM) drive 918. An apparatus may be provided. Image data is exchanged between the hardware via a data bus.

ハードディスク装置914、FDドライブ916、あるいはCD−ROMドライブ918は、たとえば、CPU902にソフトウェア処理をさせるためのプログラムデータを登録するなどのために利用される。また、ハードディスク装置914は、処理対象画像データを格納する領域を含んでいる。   The hard disk device 914, the FD drive 916, or the CD-ROM drive 918 is used, for example, for registering program data for causing the CPU 902 to perform software processing. Further, the hard disk device 914 includes an area for storing image data to be processed.

通信I/F908は、インターネットなどの通信網との間の通信データの受け渡しを仲介する。またコンピュータシステム900は、カメラヘッド102との間のインターフェース(IOTコントローラ)の機能をなすカメラI/F部930と、プリントエンジン570との間のインターフェースの機能をなすIOTコントローラ932とを備える。カメラI/F部930は、カメラヘッド102からの出力データをアナログデジタル変換してRAM906もしくはハードディスク装置914へ格納する。   The communication I / F 908 mediates the exchange of communication data with a communication network such as the Internet. Further, the computer system 900 includes a camera I / F unit 930 that functions as an interface (IOT controller) with the camera head 102, and an IOT controller 932 that functions as an interface with the print engine 570. The camera I / F unit 930 converts the output data from the camera head 102 from analog to digital and stores the data in the RAM 906 or the hard disk device 914.

なお、上記実施形態で示した撮像画像処理部110や画像画像検査処理部200の各機能部分の全ての処理をソフトウェアで行なうのではなく、これら機能部分の一部をハードウェアにて処理回路940として設けてもよい。   Note that not all processing of each functional part of the captured image processing unit 110 and the image image inspection processing unit 200 described in the above embodiment is performed by software, but a part of these functional parts is processed by a processing circuit 940 by hardware. May be provided.

このような構成のコンピュータシステム900は、上記実施形態に示した画像検査装置5の基本的な構成および動作と同様とすることができる。また、上述した処理をコンピュータに実行させるプログラムは、CD−ROM922などの記録媒体を通じて配布される。あるいは、プログラムは、CD−ROM922ではなくFD920に格納されてもよい。また、MOドライブを設け、MOに前記プログラムを格納してもよく、またフラッシュメモリなどの不揮発性の半導体メモリカード924など、その他の記録媒体に前記プログラムを格納してもよい。   The computer system 900 having such a configuration can be the same as the basic configuration and operation of the image inspection device 5 described in the above embodiment. Further, a program for causing a computer to execute the above-described processing is distributed through a recording medium such as a CD-ROM 922. Alternatively, the program may be stored in FD 920 instead of CD-ROM 922. Further, an MO drive may be provided, and the program may be stored in the MO, or the program may be stored in another recording medium such as a nonvolatile semiconductor memory card 924 such as a flash memory.

さらに、他のサーバなどからインターネットなどの通信網を経由して前記プログラムをダウンロードして取得したり、あるいは更新したりしてもよい。なお、記録媒体としては、FD920やCD−ROM922などの他にも、DVDなどの光学記録媒体、MDなどの磁気記録媒体、PDなどの光磁気記録媒体、テープ媒体、磁気記録媒体、ICカードやミニチュアカードなどの半導体メモリを用いることができる。   Further, the program may be downloaded from another server or the like via a communication network such as the Internet, acquired, or updated. As a recording medium, in addition to the FD 920 and the CD-ROM 922, an optical recording medium such as a DVD, a magnetic recording medium such as an MD, a magneto-optical recording medium such as a PD, a tape medium, a magnetic recording medium, an IC card, A semiconductor memory such as a miniature card can be used.

記録媒体の一例としてのFD920やCD−ROM922などには、上記実施形態で説明した画像検査装置5における処理の一部または全ての機能を格納することができる。したがって、以下のプログラムや当該プログラムを格納した記憶媒体を提供することができる。たとえば、基準画像処理部210や画像検査部230用のプログラム、すなわちRAM906などにインストールされるソフトウェアは、上記実施形態に示された基準画像処理部210や画像検査部230と同様の各機能部をソフトウェアとして備える。   The FD 920, the CD-ROM 922, or the like as an example of a recording medium can store some or all of the functions of the processing in the image inspection apparatus 5 described in the above embodiment. Therefore, it is possible to provide the following program and a storage medium storing the program. For example, a program for the reference image processing unit 210 and the image inspection unit 230, that is, software installed in the RAM 906 and the like includes the same functional units as the reference image processing unit 210 and the image inspection unit 230 described in the above embodiment. Prepare as software.

このようなソフトウェアは、画像処理ソフトウェア、あるいは画像検査用アプリケーションソフトなどとして、CD−ROMやFDなどの可搬型の記憶媒体に格納され、あるいはネットワークを介して配布されるとよい。   Such software may be stored in a portable storage medium such as a CD-ROM or FD as image processing software or application software for image inspection, or distributed via a network.

以上、本発明を実施形態を用いて説明したが、本発明の技術的範囲は上記実施形態に記載の範囲には限定されない。発明の要旨を逸脱しない範囲で上記実施形態に多様な変更または改良を加えることができ、そのような変更または改良を加えた形態も本発明の技術的範囲に含まれる。   As described above, the present invention has been described using the embodiment. However, the technical scope of the present invention is not limited to the scope described in the embodiment. Various changes or improvements can be made to the above-described embodiment without departing from the spirit of the invention, and embodiments with such changes or improvements are also included in the technical scope of the present invention.

また、上記の実施形態は、クレーム(請求項)にかかる発明を限定するものではなく、また実施形態の中で説明されている特徴の組合せの全てが発明の解決手段に必須であるとは限らない。前述した実施形態には種々の段階の発明が含まれており、開示される複数の構成要件における適宜の組合せにより種々の発明を抽出できる。実施形態に示される全構成要件から幾つかの構成要件が削除されても、効果が得られる限りにおいて、この幾つかの構成要件が削除された構成が発明として抽出され得る。   Further, the above embodiments do not limit the invention according to the claims (claims), and all combinations of the features described in the embodiments are not necessarily essential to the means for solving the invention. Absent. The embodiments described above include inventions at various stages, and various inventions can be extracted by appropriately combining a plurality of disclosed constituent features. Even if some components are deleted from all the components shown in the embodiment, as long as the effect is obtained, a configuration from which some components are deleted can be extracted as an invention.

たとえば、上記実施形態では、矩形状を呈した原稿を取り扱う場合について説明したが、他の角形状を呈した原稿を取り扱う場合であっても、上述した実施形態とほぼ同様に、原稿辺縁を表す線分の式(直線式)を求め、その線分と撮像範囲を示す境界線との交点座標を特定することで、原稿辺縁と撮像範囲を示す境界線との位置関係を特定することで、はみ出し部分を非検査部分に設定するようにすればよい。   For example, in the above-described embodiment, a case where a document having a rectangular shape is handled has been described. However, even when a document having another angular shape is handled, the edge of the document is substantially similar to the above-described embodiment. To determine the positional relationship between the document margin and the boundary indicating the imaging range by determining the expression (linear expression) of the line segment to be expressed and specifying the coordinates of the intersection of the line and the boundary indicating the imaging range. The protruding portion may be set as the non-inspection portion.

また、角形状の原稿に限らず、たとえば円形状(楕円状も含む)や他の任意の形状を呈する原稿であっても、撮像画像中の原稿の辺縁を示す線分を求め、この求めた線分と撮像範囲を示す境界線との位置関係を特定し、この特定した位置関係に基づいて、撮像範囲からはみ出している原稿部分を非検査領域に設定するものであればよい。この場合、たとえば、予め分かっている原稿の形状と撮像画像から抽出した原稿の辺縁を示す線分とのパターンマッチングにより原稿辺縁と撮像範囲を示す境界線との位置関係を特定することで、原稿の撮像範囲の外部に位置する部分を非検査部分に設定すればよい。   In addition to a document having a square shape, for example, a document having a circular shape (including an elliptical shape) or any other shape, a line segment indicating the edge of the document in the captured image is obtained. Any relationship may be used as long as the positional relationship between the line segment and the boundary line indicating the imaging range is specified, and based on the specified positional relationship, the document portion protruding from the imaging range is set as the non-inspection area. In this case, for example, by specifying the positional relationship between the document edge and the boundary line indicating the imaging range by pattern matching between the document shape known in advance and the line segment indicating the edge of the document extracted from the captured image. The portion located outside the imaging range of the document may be set as the non-inspection portion.

本発明に係る画像処理装置の一実施形態を備えた画像検査装置を示す概略図である。FIG. 1 is a schematic diagram illustrating an image inspection apparatus provided with an embodiment of an image processing apparatus according to the present invention. 図1に示した画像検査装置の第1実施形態の詳細例を示すブロック図である。FIG. 2 is a block diagram illustrating a detailed example of a first embodiment of the image inspection apparatus illustrated in FIG. 1. 撮像画像と基準画像との関係を示す図である。FIG. 4 is a diagram illustrating a relationship between a captured image and a reference image. 非検査領域特定処理部の一構成例を示すブロック図である。It is a block diagram showing an example of 1 composition of a non-inspection area specific processing part. 実施形態で処理対象とする、原稿部分が撮像範囲からはみ出して撮像される場合の状態を説明する図である。FIG. 4 is a diagram illustrating a state in which a document portion to be processed in the embodiment is imaged out of an imaging range and is imaged. 第1実施形態の画像検査装置における処理手順の概要を示すフローチャートである。5 is a flowchart illustrating an outline of a processing procedure in the image inspection apparatus according to the first embodiment. 第1実施形態で取り扱う画像の一例を示す図である。FIG. 3 is a diagram illustrating an example of an image handled in the first embodiment. 第1実施形態で取り扱う画像の他の一例を示す図である。FIG. 5 is a diagram illustrating another example of an image handled in the first embodiment. エッジ抽出部の処理を説明する図である。FIG. 9 is a diagram for describing processing of an edge extraction unit. 第1実施形態の非検査領域特定処理部の非検査領域特定処理の手順の概要を示すフローチャートである。5 is a flowchart illustrating an outline of a procedure of a non-inspection area specifying process of a non-inspection area specifying processing unit according to the first embodiment. 第1例の非検査領域特定処理におけるエッジ抽出処理を示すフローチャートである。It is a flowchart which shows the edge extraction processing in the non-inspection area | region identification processing of the 1st example. 第1例の非検査領域特定処理における左辺エッジ抽出処理(図11のS210L)の詳細例を示すフローチャートである。It is a flowchart which shows the detailed example of the left side edge extraction processing (S210L of FIG. 11) in the non-inspection area | region identification processing of the 1st example. 左辺エッジ有効部検出処理を、図8(B)の画像に適用した場合を説明する図である。FIG. 9 is a diagram illustrating a case where the left side edge effective portion detection processing is applied to the image of FIG. 第1例の非検査領域特定処理における左辺エッジ有効部検出処理の詳細例を示すフローチャートである。It is a flowchart which shows the detailed example of the left side edge effective part detection process in the non-inspection area | region identification processing of the 1st example. エッジ有効部検出処理で使用する判定条件を示す図表である。9 is a table showing determination conditions used in the edge effective portion detection processing. 第1例の非検査領域特定処理における左辺エッジ有効部仮検出処理(図14のS310L)の詳細例を示すフローチャートである。15 is a flowchart illustrating a detailed example of a left-side edge valid portion provisional detection process (S310L in FIG. 14) in the non-inspection region specifying process of the first example. 第1例の左辺エッジ有効部仮検出処理(図14のS310L)における左辺エッジ有効部選択処理(図16のS3114)の詳細例を示すフローチャートである。FIG. 17 is a flowchart illustrating a detailed example of a left-side edge valid portion selection process (S3114 in FIG. 16) in the left-side edge valid portion temporary detection process (S310L in FIG. 14) of the first example. 第1例の非検査領域特定処理における左辺エッジ有効部検出処理(図14のS334)の詳細例を示すフローチャートである。15 is a flowchart illustrating a detailed example of a left-side edge valid part detection process (S334 in FIG. 14) in the non-inspection area specifying process of the first example. 図18で使用する計算式の導出を説明する図である。FIG. 19 is a diagram illustrating derivation of a calculation formula used in FIG. 18. 第1実施形態のエッジ有効部直線式算出部によるエッジ有効部直線式算出処理(図10のS400)の詳細例を示すフローチャートである。It is a flowchart which shows the detailed example of the edge effective part linear formula calculation processing (S400 of FIG. 10) by the edge effective part linear formula calculation part of 1st Embodiment. 第1実施形態の原稿頂点設定処理部による原稿頂点設定処理(図10のS420)の詳細例を示すフローチャートである。11 is a flowchart illustrating a detailed example of a document vertex setting process (S420 in FIG. 10) by a document vertex setting processing unit according to the first embodiment. 第1実施形態のはみ出し場所判定処理部によるはみ出し場所判定処理(図10のS500)の詳細例を示すフローチャートである。11 is a flowchart illustrating a detailed example of a protruding place determination process (S500 in FIG. 10) by a protruding place determination processing unit according to the first embodiment. 境界部分特定処理部によるはみ出し部の非検査部設定処理(図10のS600)の詳細例を示すフローチャートである。11 is a flowchart illustrating a detailed example of a non-inspection portion setting process of a protruding portion (S600 in FIG. 10) performed by a boundary portion specifying processing unit. はみ出し部の非検査部設定処理の具体例を示す図である。It is a figure which shows the specific example of the non-inspection part setting process of a protruding part. 図24に示した左下についての処理ステップに使用する式や交点座標を、左上、右上、右下に適用させる場合の対応関係を示す図表などである。24 is a chart showing a correspondence relationship in a case where the equations and intersection coordinates used in the processing steps for the lower left shown in FIG. 24 are applied to the upper left, upper right, and lower right. 図1に示した画像検査装置の第2実施形態の詳細例を示すブロック図である。こFIG. 4 is a block diagram illustrating a detailed example of a second embodiment of the image inspection apparatus illustrated in FIG. 1. This 第2実施形態の画像検査装置における処理手順の概要を示すフローチャートである。It is a flow chart which shows an outline of a processing procedure in an image inspection device of a 2nd embodiment. 第2実施形態で取り扱う画像の一例を示す図である。It is a figure showing an example of an image handled by a 2nd embodiment. 第2実施形態のはみ出し場所判定処理部によるはみ出し場所判定処理の詳細例を示すフローチャートである。It is a flow chart which shows the example of the outside place judging processing by the outside place judgment processing part of a 2nd embodiment. はみ出し場所判定処理部によるはみ出し場所判定処理における一事例を示す図である。It is a figure showing an example in the protruding place judgment processing by the protruding place judgment processing part. 第2実施形態の境界部分特定処理部によるはみ出し部の非検査部設定処理の具体例を示すフローチャートである。It is a flowchart which shows the specific example of the non-inspection part setting process of the protruding part by the boundary part identification processing part of 2nd Embodiment. 図31に示した左下についての処理ステップに使用する式や交点座標を、左上、右上、右下に適用させる場合の対応関係を示す図表である。FIG. 32 is a table showing a correspondence relationship in a case where equations and intersection coordinates used in processing steps for the lower left shown in FIG. 31 are applied to the upper left, upper right, and lower right. 図1に示した画像検査装置5の第3実施形態における原稿範囲特定処理の概要を説明する図である。FIG. 11 is a diagram illustrating an outline of a document range specifying process in a third embodiment of the image inspection apparatus 5 illustrated in FIG. 1. 第3実施形態における非検査領域特定処理の概要を説明する図である。It is a figure explaining the outline of the non-inspection area specification processing in a 3rd embodiment. 第3実施形態の処理内容を実現するため処理手順の概要を説明する図である。It is a figure explaining the outline of the processing procedure for realizing the processing contents of a 3rd embodiment. 第3実施形態の処理で対応可能な原稿のはみ出し状態を示す、撮像画像の一例である。13 is an example of a captured image showing a protruding state of a document that can be handled by the processing of the third embodiment. 第3実施形態の処理で対応可能な原稿のはみ出し状態を示す、撮像画像の一例である。13 is an example of a captured image showing a protruding state of a document that can be handled by the processing of the third embodiment. 第3実施形態の処理でも対応できない原稿のはみ出し状態を示す、撮像画像の一例である。13 is an example of a captured image showing a protruding state of a document that cannot be handled by the processing of the third embodiment. 第3実施形態の非検査領域特定処理部の一構成例を示すブロック図である。It is a block diagram showing an example of 1 composition of a non-inspection area specific processing part of a 3rd embodiment. 第3実施形態の非検査領域特定処理部における処理手順の概要を示すフローチャートである。It is a flow chart which shows an outline of a processing procedure in a non-inspection area specific processing part of a 3rd embodiment. 第3実施形態のエッジ有効部検出部の処理における対応関係を説明する図である。It is a figure explaining correspondence in processing of an edge effective part primary detecting element of a 3rd embodiment. エッジ有効部検出部のエッジ追跡部によるエッジ追跡の各方向とエッジ追跡フィルタとを説明する図である。FIG. 3 is a diagram illustrating each direction of edge tracking by an edge tracking unit of an edge valid portion detection unit and an edge tracking filter. 第3実施形態におけるエッジ有効部検出処理とエッジ有効部直線式算出処理の手順の概要を示すフローチャートである。It is a flow chart which shows the outline of the procedure of edge effective part detection processing and edge effective part straight line type calculation processing in a 3rd embodiment. 原稿範囲特定処理(エッジ有効部検出処理+エッジ直線式算出処理)の手順の詳細例を示すフローチャートである。9 is a flowchart illustrating a detailed example of a procedure of a document range specifying process (an edge effective portion detecting process + an edge straight line calculating process). エッジ追跡部による、所定方向にエッジ追跡するエッジ直線検出処理の概要を示すフローチャートである。11 is a flowchart illustrating an outline of an edge straight line detection process of performing edge tracking in a predetermined direction by an edge tracking unit. エッジ追跡部による所定方向へのエッジ追跡処理の詳細例を示すフローチャートである。こ9 is a flowchart illustrating a detailed example of edge tracking processing in a predetermined direction by an edge tracking unit. This エッジ有効部直線式算出処理(S4540)の詳細例を示すフローチャートである。It is a flowchart which shows the detailed example of an edge effective part straight line type | formula calculation process (S4540). 第3実施形態のエッジ追跡による直線検出処理の具体例を説明する図である(4辺検出時)。It is a figure explaining the example of the straight line detection processing by edge tracing of a 3rd embodiment (at the time of 4 side detection). 第3実施形態のエッジ追跡による直線検出処理の具体例を説明する図である(3辺検出時)。It is a figure explaining the example of the straight line detection processing by edge pursuit of a 3rd embodiment (at the time of 3 side detection). エッジ有効部直線式重複判定処理(S4560)の詳細例を示すフローチャートである。It is a flow chart which shows the detailed example of edge effective part straight line type overlap judgment processing (S4560). エッジ有効部直線式重複判定処理の意義を説明する図である。It is a figure explaining the significance of edge effective part straight line type overlap judgment processing. エッジ追跡開始座標調整処理(S4214)の詳細例を示すフローチャートである。It is a flowchart which shows the detailed example of an edge tracking start coordinate adjustment process (S4214). 上下左右の各端からの処理における、エッジ追跡開始座標調整処理の各ステップの処理内容の対応を示す図表である。9 is a table showing the correspondence between the processing contents of each step of the edge tracking start coordinate adjustment processing in the processing from the top, bottom, left, and right ends. この処理における各ステップに対応したはみ出し状態の一例を示す図である。It is a figure showing an example of a protruding state corresponding to each step in this processing. 原稿範囲特定処理によって特定される、原稿辺縁をなす直線式についての具体例を示す図である(4辺検出時)。FIG. 9 is a diagram illustrating a specific example of a straight line formula forming an edge of a document specified by a document range specifying process (when four sides are detected). 原稿範囲特定処理によって特定される、原稿辺縁をなす直線式についての具体例を示す図である(3辺検出時)。FIG. 9 is a diagram illustrating a specific example of a straight line formula forming a document edge, which is specified by the document range specifying process (when three sides are detected). 原稿頂点設定処理の手順の概要を示すフローチャートである。9 is a flowchart illustrating an outline of a procedure of a document vertex setting process. 4点頂点設定処理の手順の一例を示したフローチャートである。It is the flowchart which showed an example of the procedure of the four-point vertex setting process. 4点頂点設定処理における判定対象となる状態と、それに対応した頂点算出処理1〜3を説明する図である。It is a figure explaining the state used as a judgment object in four point vertex setting processing, and corresponding vertex calculation processing 1-3. 4点頂点設定処理によって求められる、4つの原稿頂点の具体例を示す図である。FIG. 9 is a diagram illustrating a specific example of four document vertices obtained by a four-point vertex setting process. 2点頂点設定処理の手順の一例を示したフローチャートである。It is the flowchart which showed an example of the procedure of a two-point vertex setting process. 2点頂点設定処理における判定対象となる状態と、それに対応した頂点算出処理1〜3を説明する図である。It is a figure explaining the state used as a judgment object in two-point vertex setting processing, and vertex calculation processing 1-3 corresponding to it. 2点頂点設定処理によって求められる、2つの原稿頂点の具体例を示す図である。FIG. 9 is a diagram illustrating a specific example of two document vertices obtained by a two-point vertex setting process. はみ出し場所判定処理(S4008)と、はみ出し場所頂点推算処理(S4010)の手順の概要を示したフローチャートである。It is a flowchart showing the outline of the procedure of the protruding place determination processing (S4008) and the protruding place vertex estimation processing (S4010). 2点はみ出し方向判定処理(S5102)の手順の詳細例を示したフローチャートである。It is the flowchart which showed the detailed example of the procedure of two point protruding direction determination processing (S5102). はみ出し場所判定処理の手順の一例を示すフローチャートである。It is a flowchart which shows an example of the procedure of the protruding place determination processing. はみ出し場所判定処理中の各ステップの処理内容について、はみ出し場所判定処理1〜8の対応を示した図表である。It is the chart which showed the correspondence of the protruding place judgment processing 1-8 about the process content of each step in the protruding place judgment processing. 2点はみ出し場所頂点推算処理(S5103)の手順の一例を示すフローチャートである。It is a flowchart which shows an example of the procedure of two point protruding place vertex estimation processing (S5103). 2点はみ出し場所頂点推算処理手順において、はみ出し状態を推算する方向の対応を示した図表である。It is a chart showing correspondence of the direction for estimating the protruding state in the two-point protruding place vertex estimation processing procedure. 2点はみ出し場所頂点推算処理(S5103)による処理結果例を示す図である。It is a figure which shows the example of the processing result by two points protruding place vertex estimation processing (S5103). 境界部分特定処理(S4012)と非検査部設定処理(S4014)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of a boundary part specific process (S4012) and a non-inspection part setting process (S4014). 4辺検出による非検査領域特定処理(S5502)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the non-inspection area | region identification process by four side detection (S5502). 非検査領域特定処理の手順の一例を示したフローチャートである。It is the flowchart which showed an example of the procedure of the non-inspection area | region identification processing. 境界部分特定処理部136と非検査領域設定部138による、4辺検出による非検査領域特定処理(S5502)による処理結果例を示す図である。FIG. 13 is a diagram illustrating an example of a processing result of a non-inspection area specifying process (S5502) by detecting four sides by a boundary portion specifying processing unit 136 and a non-inspection area setting unit 138. 3辺検出による非検査領域特定処理(S5504)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the non-inspection area | region identification process by three side detection (S5504). 各コーナーについての3辺検出による非検査領域設定処理の手順の一例を示すフローチャートである。It is a flowchart which shows an example of the procedure of the non-inspection area setting process by three side detection about each corner. 3辺検出による非検査領域設定処理手順において、非検査領域を特定するための原稿頂点と2つの交点の対応を示した図表である。9 is a table showing the correspondence between the document vertex and two intersections for specifying the non-inspection area in the non-inspection area setting processing procedure based on three side detection. 3辺検出による非検査領域特定処理(S5504)による処理結果例を示す図である(その1;S5805)。It is a figure which shows the example of the processing result by the non-inspection area | region identification processing by three side detection (S5504) (the 1; S5805). 3辺検出による非検査領域特定処理(S5504)による処理結果例を示す図である(その2;S5807)。It is a figure which shows the example of a processing result by the non-inspection area | region identification processing by three side detection (S5504) (the 2; S5807). CPUやメモリを利用して、ソフトウェア的に画像検査装置を構成する場合のハードウェア構成の一例を示した図である。FIG. 3 is a diagram illustrating an example of a hardware configuration when an image inspection apparatus is configured as software using a CPU and a memory.

符号の説明Explanation of reference numerals

1…システム、5…画像検査装置、100…画像読取部、102…カメラヘッド、104…撮影レンズ、106…CCD撮像素子、110…撮像画像処理部、112…シェーディング補正部、114…光学歪補正部、116…透視変換部、120…非検査領域特定処理部、122…エッジ抽出部、124…エッジ有効部検出部、124a…エッジ追跡部、124b…エッジ画素カウント部、126…エッジ有効部直線式算出部(線分算出部)、130…非検査領域特定部、132…原稿頂点設定処理部(位置関係特定処理部)、134…はみ出し場所判定処理部、135…はみ出し頂点座標推定処理部、136…境界部分特定処理部、138…非検査領域設定部、200…画像検査処理部、210…基準画像処理部、212…逆透視変換部、214…解像度変換部、216…暈かし処理部、218…非検査領域削除処理部、230…画像検査部、232…位置合わせ処理部、234…欠陥異常検出処理部、300…データ格納部、320…制御部、500…プリンタ   DESCRIPTION OF SYMBOLS 1 ... System, 5 ... Image inspection apparatus, 100 ... Image reading part, 102 ... Camera head, 104 ... Shooting lens, 106 ... CCD imaging element, 110 ... Shooting image processing part, 112 ... Shading correction part, 114 ... Optical distortion correction Unit, 116: perspective transformation unit, 120: non-inspection area specifying processing unit, 122: edge extraction unit, 124: edge effective unit detection unit, 124a: edge tracking unit, 124b: edge pixel counting unit, 126: edge effective unit straight line Expression calculation section (line segment calculation section), 130: non-inspection area specifying section, 132: original vertex setting processing section (positional relation specifying processing section), 134: protruding place determination processing section, 135: protruding vertex coordinate estimation processing section, 136: boundary part specifying processing unit, 138: non-inspection area setting unit, 200: image inspection processing unit, 210: reference image processing unit, 212: reverse perspective transformation unit, 14: Resolution conversion unit, 216: Shading processing unit, 218: Non-inspection area deletion processing unit, 230: Image inspection unit, 232: Alignment processing unit, 234: Defect abnormality detection processing unit, 300: Data storage unit 320: control unit, 500: printer

Claims (13)

原稿を光学的に読み取って得た撮像画像と検査用の基準画像とを比較することにより前記撮像画像を検査する画像検査方法であって、
前記撮像画像における前記原稿の辺縁を示す線分を求め、
この求めた線分と撮像範囲を示す境界線との位置関係を特定し、
この特定した位置関係に基づいて、撮像範囲からはみ出している原稿部分を非検査領域に設定し、
前記非検査領域を検査対象から除外しつつ、前記基準画像と前記撮像画像における前記原稿部分の画像とを比較することで、前記原稿部分の画像を検査する
ことを特徴とする画像検査方法。
An image inspection method for inspecting the captured image by comparing a captured image obtained by optically reading a document with a reference image for inspection,
Find a line segment indicating the edge of the original in the captured image,
Identify the positional relationship between the obtained line segment and the boundary line indicating the imaging range,
Based on the specified positional relationship, a document portion protruding from the imaging range is set as a non-inspection area,
An image inspection method, wherein an image of the document portion is inspected by comparing the reference image with an image of the document portion in the captured image while excluding the non-inspection region from an inspection target.
原稿を光学的に読み取って得た撮像画像と検査用の基準画像とを比較することにより前記撮像画像を検査する画像検査装置であって、
前記原稿を撮影して撮像画像を取得する撮像部と、
前記撮像部により取得された前記撮像画像における前記原稿の辺縁を示す線分を求める線分算出部と、
前記線分算出部により求められた線分と撮像範囲を示す境界線との位置関係を特定する位置関係特定処理部と、
前記位置関係特定処理部により特定された位置関係に基づいて撮像範囲からはみ出している原稿部分を非検査領域に設定する非検査領域設定部と、
前記非検査領域設定部により設定された前記非検査領域を検査対象から除外しつつ、前記基準画像と前記撮像画像における前記原稿部分の画像とを比較する画像比較部と、
前記画像比較部による比較結果に基づいて、前記原稿部分の画像を検査する画像検査部と
を備えたことを特徴とする画像検査装置。
An image inspection apparatus that inspects the captured image by comparing a captured image obtained by optically reading a document with a reference image for inspection,
An imaging unit that captures the original and acquires a captured image;
A line segment calculation unit that obtains a line segment indicating an edge of the document in the captured image acquired by the imaging unit;
A positional relationship identification processing unit that identifies the positional relationship between the line segment obtained by the line segment calculation unit and the boundary line indicating the imaging range,
A non-inspection area setting unit that sets a document portion that protrudes from the imaging range based on the positional relationship specified by the positional relationship identification processing unit as a non-inspection area;
While excluding the non-inspection area set by the non-inspection area setting unit from the inspection target, an image comparison unit that compares the reference image and the image of the document portion in the captured image,
An image inspection device, comprising: an image inspection unit that inspects an image of the document portion based on a comparison result by the image comparison unit.
前記原稿の形状が略角形状を呈しており、
前記線分算出部は、前記撮像部により取得された、前記略角形状の原稿の辺縁のうちの撮像範囲内に存する原稿辺縁を示す直線を求め、
前記位置関係特定処理部は、前記線分算出部が求めた前記直線について、所定の2つの直線の組合せによる交点座標を特定することで前記略角形状の原稿の頂点の座標を特定し、前記線分算出部が求めた前記直線の数が前記略角形状の原稿の辺縁の数よりも少ないときには、前記線分算出部が求めた前記直線と、略角形状の前記原稿に対応した基準画像の各辺縁間の比とに基づいて、撮像範囲外に存在する前記略角形状の、原稿の頂点の座標を特定し、
前記非検査領域設定部は、前記位置関係特定処理部により特定された前記原稿の頂点の座標に基づいて、撮像範囲からはみ出している原稿部分を非検査領域に設定する
ことを特徴とする請求項2に記載の画像検査装置。
The document has a substantially square shape,
The line segment calculation unit, obtained by the imaging unit, to obtain a straight line indicating the document edge that exists within the imaging range among the edges of the substantially angular document,
The positional relationship specifying processing unit specifies, for the straight line obtained by the line segment calculating unit, coordinates of intersections of a predetermined two straight lines to specify coordinates of vertexes of the substantially rectangular document, When the number of the straight lines determined by the line segment calculating unit is smaller than the number of edges of the substantially square document, the straight line determined by the line segment calculating unit and a reference corresponding to the substantially square document. Based on the ratio between the respective edges of the image, specify the coordinates of the vertex of the document of the substantially angular shape existing outside the imaging range,
The non-inspection area setting unit sets, as a non-inspection area, a portion of the document that protrudes from an imaging range based on coordinates of vertexes of the document specified by the positional relationship specifying processing unit. 3. The image inspection apparatus according to 2.
前記原稿の形状が略角形状を呈しており、
前記線分算出部は、前記撮像部により取得された、前記略角形状の原稿の辺縁を示す直線式を求める直線式算出部であり、
前記位置関係特定処理部は、前記直線式算出部により求められた直線式と撮像範囲を示す境界線との交点座標を特定する境界部分特定処理部である
ことを特徴とする請求項2に記載の画像検査装置。
The document has a substantially square shape,
The line segment calculation unit is a linear expression calculation unit that obtains a linear expression indicating an edge of the substantially angular document acquired by the imaging unit,
The said positional relationship specific | specification processing part is a boundary part specific | specification processing part which specifies the intersection coordinate of the boundary line which shows the imaging range with the linear formula calculated | required by the said linear formula calculation part. Image inspection equipment.
前記直線式算出部により求められた直線式を参照して撮像画像における原稿の頂点座標を特定する原稿頂点設定処理部と、
前記原稿頂点設定処理部が特定した頂点座標の内、撮像範囲からはみ出している頂点座標を特定するはみ出し場所判定処理部とを備え、
前記非検査領域設定部は、前記はみ出し場所判定処理部により特定された前記頂点座標を参照して前記非検査領域を設定する
ことを特徴とする請求項4に記載の画像検査装置。
A document vertex setting processing unit that specifies the vertex coordinates of the document in the captured image with reference to the linear formula obtained by the linear formula calculation unit,
Among the vertex coordinates specified by the document vertex setting processing unit, a protruding place determination processing unit that specifies vertex coordinates that protrude from the imaging range,
The image inspection apparatus according to claim 4, wherein the non-inspection area setting unit sets the non-inspection area with reference to the vertex coordinates specified by the protruding place determination processing unit.
前記直線式算出部により求められた撮像範囲内に存する原稿辺縁を示す直線式を参照して撮像範囲内に存する原稿頂点座標を特定する原稿頂点設定処理部と、
前記原稿頂点設定処理部が取得した撮像範囲内の原稿頂点と、略角形状の前記原稿に対応した基準画像の各辺縁間の比とに基づいて、撮像範囲外に存在する原稿頂点の座標を推測するはみ出し頂点座標推定処理部と
を備え、
前記非検査領域設定部は、前記原稿頂点設定処理部が取得した撮像範囲内の原稿頂点と、前記はみ出し頂点座標推定処理部が取得した、撮像範囲内の原稿頂点との各座標を参照して、前記非検査領域を設定する
ことを特徴とする請求項4に記載の画像検査装置。
A document vertex setting processing unit that specifies a document vertex coordinate existing in the imaging range with reference to a linear formula indicating a document edge existing in the imaging range obtained by the linear formula calculation unit,
The coordinates of the vertex of the document existing outside the image capturing range based on the document vertex in the image capturing range obtained by the document vertex setting processing unit and the ratio between the respective edges of the reference image corresponding to the substantially rectangular document. And a protruding vertex coordinate estimation processing unit for estimating
The non-inspection area setting unit refers to the coordinates of the document vertices in the image capturing range obtained by the document vertex setting processing unit and the document vertices in the image capturing range obtained by the protruding vertex coordinate estimation processing unit. The image inspection apparatus according to claim 4, wherein the non-inspection area is set.
前記撮像画像からエッジ部分を抽出するエッジ抽出部と、
前記エッジ抽出部により抽出されたエッジ部分における有効成分を特定するエッジ有効部検出部と
を備え、
前記直線式算出部は、前記エッジ有効部検出部により特定された有効なエッジ部分を参照して前記直線式を求める
ことを特徴とする請求項3または4に記載の画像検査装置。
An edge extraction unit that extracts an edge portion from the captured image,
An edge effective part detection unit that specifies an effective component in the edge part extracted by the edge extraction unit,
The image inspection apparatus according to claim 3, wherein the straight-line-expression calculating unit obtains the straight-line expression with reference to an effective edge portion specified by the edge-effective-portion detecting unit.
前記エッジ有効部検出部は、
前記エッジ抽出部により抽出されたエッジ部分に対して、所定方向にエッジ画素を探索するエッジ追跡部と、当該エッジ追跡部が探索したエッジ画素の数をカウントするエッジ画素カウント部と
を有し、
前記エッジ追跡部が前記エッジ抽出部により抽出された前記エッジ部分をほぼ直線状に探索する過程で、前記エッジ画素カウント部によってエッジ画素が所定数以上カウントされたとき、それらのエッジ画素を前記有効なエッジ部分として検出する
ことを特徴とする請求項7に記載の画像検査装置。
The edge effective portion detection unit,
For an edge portion extracted by the edge extraction unit, an edge tracking unit that searches for edge pixels in a predetermined direction, and an edge pixel counting unit that counts the number of edge pixels searched by the edge tracking unit,
In the process of the edge tracking unit searching for the edge portion extracted by the edge extraction unit in a substantially straight line, when the edge pixel counting unit counts a predetermined number or more of the edge pixels, the edge pixels are regarded as valid. The image inspection device according to claim 7, wherein the image inspection device detects the image as a sharp edge portion.
前記はみ出し場所判定処理部は、前記直線式算出部が前記エッジ有効部検出部により特定された有効なエッジ部分を参照して求めた前記直線式の交点座標を前記原稿の前記頂点座標とする
ことを特徴とする請求項7に記載の画像検査装置。
The protruding place determination processing unit sets the intersection coordinates of the straight line obtained by the straight line type calculation unit with reference to the valid edge part specified by the edge valid part detection unit as the vertex coordinates of the document. The image inspection apparatus according to claim 7, wherein:
前記境界部分特定処理部は、前記エッジ有効部検出部により検出された前記有効なエッジ部分の両端の座標が、略角形状の撮像範囲の複数の境界線のうちの何れの境界線に接するかによって、原稿がはみ出した方向を判定して前記境界線との交点座標を特定する
ことを特徴とする請求項9に記載の画像検査装置。
The boundary portion identification processing section may determine which edge of the effective edge portion detected by the edge effective portion detection section is in contact with any one of a plurality of boundary lines of the substantially rectangular imaging range. The image inspection apparatus according to claim 9, wherein a direction in which the document protrudes is determined to specify coordinates of an intersection with the boundary line.
前記はみ出し場所判定処理部は、前記原稿頂点設定処理部が特定した頂点座標と、撮像範囲を示す境界線とを比較して、前記撮像範囲に対してはみ出した頂点の位置関係を特定し、撮像時に原稿がどの方向にはみ出していたかを判定する
ことを特徴とする請求項5から10のうちの何れか1項に記載の画像検査装置。
The protruding place determination processing unit compares the vertex coordinates specified by the document vertex setting processing unit with the boundary line indicating the imaging range, specifies the positional relationship of the protruding vertex with respect to the imaging range, and The image inspection apparatus according to claim 5, wherein it is determined in which direction the document protrudes.
前記非検査領域設定部は、前記はみ出し場所判定処理部が判定した前記原稿のはみ出し方向に基づいて、前記非検査領域を設定する
ことを特徴とする請求項7に記載の画像検査装置。
The image inspection apparatus according to claim 7, wherein the non-inspection area setting unit sets the non-inspection area based on a protruding direction of the document determined by the protruding place determination processing unit.
原稿を光学的に読み取って得た撮像画像と検査用の基準画像とを比較することにより前記撮像画像を検査するためのプログラムであって、
コンピュータを、
前記撮像画像における前記原稿の辺縁を示す線分を求める線分算出部と、
前記線分算出部により求められた線分と撮像範囲を示す境界線との位置関係を特定する位置関係特定処理部と、
前記位置関係特定処理部により特定された位置関係に基づいて、撮像範囲からはみ出している原稿部分を非検査領域に設定する非検査領域設定部と、
前記非検査領域設定部により設定された前記非検査領域を検査対象から除外しつつ、前記基準画像と前記撮像画像における前記原稿部分の画像とを比較する画像比較部と、
前記画像比較部による比較結果に基づいて、前記原稿部分の画像を検査する画像検査部と
して機能させることを特徴とするプログラム。
A program for inspecting the captured image by comparing a captured image obtained by optically reading a document with a reference image for inspection,
Computer
A line segment calculation unit that obtains a line segment indicating an edge of the document in the captured image,
A positional relationship identification processing unit that identifies the positional relationship between the line segment obtained by the line segment calculation unit and the boundary line indicating the imaging range,
A non-inspection area setting unit configured to set a document portion protruding from an imaging range as a non-inspection area based on the positional relationship identified by the positional relationship identification processing unit;
While excluding the non-inspection area set by the non-inspection area setting unit from the inspection target, an image comparison unit that compares the reference image and the image of the document portion in the captured image,
A program that functions as an image inspection unit that inspects an image of the document portion based on a comparison result by the image comparison unit.
JP2003283125A 2003-03-24 2003-07-30 Image inspection method, image inspection apparatus, and program Withdrawn JP2004310726A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003283125A JP2004310726A (en) 2003-03-24 2003-07-30 Image inspection method, image inspection apparatus, and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2003080839 2003-03-24
JP2003283125A JP2004310726A (en) 2003-03-24 2003-07-30 Image inspection method, image inspection apparatus, and program

Publications (1)

Publication Number Publication Date
JP2004310726A true JP2004310726A (en) 2004-11-04

Family

ID=33478125

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003283125A Withdrawn JP2004310726A (en) 2003-03-24 2003-07-30 Image inspection method, image inspection apparatus, and program

Country Status (1)

Country Link
JP (1) JP2004310726A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005250327A (en) * 2004-03-08 2005-09-15 Fuji Xerox Co Ltd Image forming apparatus, printed result inspecting apparatus and printed result inspecting method
KR100668325B1 (en) * 2005-01-21 2007-01-12 삼성전자주식회사 Apparatus and method for maunfacturing color filter
JP2007052670A (en) * 2005-08-18 2007-03-01 Nippon Telegr & Teleph Corp <Ntt> Method, apparatus and program for detecting side and evaluating corner
JP2010165011A (en) * 2009-01-13 2010-07-29 Ricoh Co Ltd Image forming apparatus, image forming method, and program
WO2013108727A1 (en) * 2012-01-17 2013-07-25 シャープ株式会社 Image-capturing device, captured image processing system, program, and recording medium
WO2014042280A1 (en) * 2012-09-14 2014-03-20 Ricoh Company, Limited Image inspection apparatus, image inspection system and image inspection method
KR20150043936A (en) * 2013-10-15 2015-04-23 삼성전자주식회사 Method and apparatus of processing images
JP2017151579A (en) * 2016-02-23 2017-08-31 ブラザー工業株式会社 program
US20220150375A1 (en) * 2020-11-09 2022-05-12 Canon Kabushiki Kaisha Image processing apparatus and image processing method

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4525111B2 (en) * 2004-03-08 2010-08-18 富士ゼロックス株式会社 Image forming apparatus, printing result inspection apparatus, printing result inspection method
JP2005250327A (en) * 2004-03-08 2005-09-15 Fuji Xerox Co Ltd Image forming apparatus, printed result inspecting apparatus and printed result inspecting method
KR100668325B1 (en) * 2005-01-21 2007-01-12 삼성전자주식회사 Apparatus and method for maunfacturing color filter
US7775179B2 (en) 2005-01-21 2010-08-17 Samsung Electronics Co., Ltd. Apparatus and method for fabricating a color filter
JP2007052670A (en) * 2005-08-18 2007-03-01 Nippon Telegr & Teleph Corp <Ntt> Method, apparatus and program for detecting side and evaluating corner
JP4525519B2 (en) * 2005-08-18 2010-08-18 日本電信電話株式会社 Quadrilateral evaluation method, apparatus and program
JP2010165011A (en) * 2009-01-13 2010-07-29 Ricoh Co Ltd Image forming apparatus, image forming method, and program
CN104067605A (en) * 2012-01-17 2014-09-24 夏普株式会社 Image-capturing device, captured image processing system, program, and recording medium
WO2013108727A1 (en) * 2012-01-17 2013-07-25 シャープ株式会社 Image-capturing device, captured image processing system, program, and recording medium
JP2013168119A (en) * 2012-01-17 2013-08-29 Sharp Corp Image capturing device, captured image processing system, program, and recording medium
CN104067605B (en) * 2012-01-17 2017-08-11 夏普株式会社 Filming apparatus and captured image processing system
JP2014074711A (en) * 2012-09-14 2014-04-24 Ricoh Co Ltd Image inspection device, image inspection system, and image inspection method
CN103959047A (en) * 2012-09-14 2014-07-30 株式会社理光 Image inspection apparatus, image inspection system and image inspection method
WO2014042280A1 (en) * 2012-09-14 2014-03-20 Ricoh Company, Limited Image inspection apparatus, image inspection system and image inspection method
US9767546B2 (en) 2012-09-14 2017-09-19 Ricoh Company, Limited Image inspection apparatus, image inspection system and image inspection method
KR20150043936A (en) * 2013-10-15 2015-04-23 삼성전자주식회사 Method and apparatus of processing images
KR102135960B1 (en) * 2013-10-15 2020-07-20 삼성전자주식회사 Method and apparatus of processing images
JP2017151579A (en) * 2016-02-23 2017-08-31 ブラザー工業株式会社 program
US20220150375A1 (en) * 2020-11-09 2022-05-12 Canon Kabushiki Kaisha Image processing apparatus and image processing method
US11706363B2 (en) * 2020-11-09 2023-07-18 Canon Kabushiki Kaisha Image processing apparatus and image processing method for inspecting presence/absence of a defect in a print product

Similar Documents

Publication Publication Date Title
US9036223B2 (en) Systems and methods for edge detection during an imaging operation
JP4055385B2 (en) Image inspection device
KR100394202B1 (en) Image correction device
KR101141345B1 (en) Three-dimensional shape measuring device, three-dimensional shape measuring method, three-dimensional shape measuring program, and recording medium
JP6701118B2 (en) Image processing apparatus and image processing method
JP4375523B2 (en) Image processing apparatus, image processing method, image processing program, printed material inspection apparatus, printed material inspection method, printed material inspection program
JP3618056B2 (en) Image processing device
JP2008035173A (en) Image processing method
JP5182182B2 (en) Color correction method and imaging system
JP2004310726A (en) Image inspection method, image inspection apparatus, and program
US10158788B2 (en) Image processing device and image processing method
JP4501701B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
JP2005208847A (en) Image defect detecting apparatus and image forming apparatus
JP4182937B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
JP4600019B2 (en) Imaging apparatus, image processing method, and program
US7545535B2 (en) Robust automatic page size detection algorithm for scan application
US20210281742A1 (en) Document detections from video images
JP4524616B2 (en) Imaging apparatus, image processing method and program for captured image
JP4454297B2 (en) Binarization processing apparatus and binarization processing method
JP2005316550A (en) Image processor, image reader, image inspection device and program
JP2002262083A (en) Image processor
JP2004199542A (en) Image inspection device, program, storage medium
US8488138B2 (en) Method for composing a reflectivity histogram and reprographic apparatus using this method
Boiangiu et al. Target Validation and Image Color Calibration
JP2021177140A (en) Image inspection device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060622

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20070906