JP4941317B2 - Image reading device - Google Patents

Image reading device Download PDF

Info

Publication number
JP4941317B2
JP4941317B2 JP2008006927A JP2008006927A JP4941317B2 JP 4941317 B2 JP4941317 B2 JP 4941317B2 JP 2008006927 A JP2008006927 A JP 2008006927A JP 2008006927 A JP2008006927 A JP 2008006927A JP 4941317 B2 JP4941317 B2 JP 4941317B2
Authority
JP
Japan
Prior art keywords
edge
document
point
group
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2008006927A
Other languages
Japanese (ja)
Other versions
JP2009171218A (en
Inventor
英和 岡田
博章 藤井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries 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 Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2008006927A priority Critical patent/JP4941317B2/en
Publication of JP2009171218A publication Critical patent/JP2009171218A/en
Application granted granted Critical
Publication of JP4941317B2 publication Critical patent/JP4941317B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Input (AREA)
  • Facsimile Scanning Arrangements (AREA)

Description

本発明は、原稿の読取画像を表す画像データを解析する機能を備えた画像読取装置に関する。 The present invention relates to an image reading apparatus having a function of analyzing image data representing a read image of a document .

従来、画像読取装置としては、読取ガラス下に読取ユニットを備え、読取ガラス上に載置された原稿を、読取ガラス下で読取ユニットを通じて読み取るフラットベッド型の画像読取装置が知られている。この種の画像読取装置では、読取ガラス下で読取ユニットを搬送しつつ、その搬送時に読取ユニットに読取動作を実行させることにより、読取ガラス上に配置された原稿を読み取り、原稿の読取画像を表す画像データを生成する。   2. Description of the Related Art Conventionally, as an image reading apparatus, a flat bed type image reading apparatus that includes a reading unit under a reading glass and reads a document placed on the reading glass through the reading unit under the reading glass is known. In this type of image reading apparatus, while the reading unit is conveyed under the reading glass, the reading unit is caused to perform a reading operation during the conveyance, thereby reading a document placed on the reading glass and representing a read image of the document. Generate image data.

この他、画像読取装置としては、コピー機能を有するものが知られており、コピー機能を有する画像読取装置としては、コピー機能の他、プリンタ機能やファックス(FAX)機能などを有したディジタル複合機が知られている。   In addition, an image reading apparatus having a copy function is known. As an image reading apparatus having a copy function, a digital multifunction peripheral having a printer function, a fax (FAX) function, etc. in addition to a copy function. It has been known.

また、画像読取装置としては、読取対象の原稿を、読取ユニットを通じて読み取って、その読取結果から原稿エッジ(原稿の端縁)を検出するものが知られている(例えば、特許文献1〜特許文献3参照)。また、コピー機能を有する画像読取装置としては、プレスキャンにより得られた読取結果から読取対象の原稿のサイズや傾きを検出し(例えば、特許文献4参照)、検出した原稿サイズや傾きの情報に基づいて、変倍率や傾き補正量等を設定する画像読取装置が知られている。
特開2004−201240号公報 特開2005−285010号公報 特開2005−039620号公報 特開2000−022898号公報
Also, as an image reading apparatus, an apparatus that reads a document to be read through a reading unit and detects a document edge (edge of the document) from the reading result is known (for example, Patent Documents 1 to 5). 3). An image reading apparatus having a copy function detects the size and inclination of a document to be read from a reading result obtained by pre-scanning (see, for example, Patent Document 4), and uses the detected document size and inclination information. Based on this, an image reading apparatus that sets a variable magnification, an inclination correction amount, and the like is known.
JP 2004-201240 A JP 2005-285010 A JP 2005-039620 A JP 2000-022898 A

ところで、読取ユニットによる原稿の読取結果から、原稿の端縁である原稿エッジを検出する方法では、原稿内に描写された罫線等を、原稿エッジであると誤検出する可能性がある。即ち、原稿の読取画像を表す画像データにおいては、原稿内の罫線がある地点でも、原稿の端縁に似た画像パターンが現れる。一方で、読取対象の原稿については、原稿が傾いていたり、原稿サイズが不定であるため、読取結果としての上記画像データから、原稿の端縁に対応する画像パターンを見つけて原稿エッジを検出しようとしても、誤って、原稿内部の罫線等の画像パターンを見つけて原稿エッジを誤検出してしまう可能性があるのである。   By the way, in the method of detecting the document edge that is the edge of the document from the result of reading the document by the reading unit, there is a possibility that the ruled line drawn in the document is erroneously detected as the document edge. That is, in the image data representing the read image of the document, an image pattern similar to the edge of the document appears even at a point where the ruled line is present in the document. On the other hand, since the original to be read is tilted or the original size is indeterminate, an image pattern corresponding to the edge of the original is found from the above image data as a read result and the original edge is detected. However, there is a possibility that an image pattern such as a ruled line inside a document is erroneously detected and a document edge is erroneously detected.

また、フラットベッド型の画像読取装置では、読取ガラス上に原稿を載置した状態で、読取ガラスに写る画像を読取ガラス下で読み取るため、読取ガラス上に、埃(髪の毛等)が載っていると、その埃についても読み取ってしまい、読取結果としての画像データに、原稿以外の像が現れることになる。従って、このような埃の像が現れた画像データを解析して、原稿エッジを検出する場合にも、埃の像に惑わされて原稿エッジを誤検出してしまう可能性がある。   Further, in a flat bed type image reading apparatus, dust (hair, etc.) is placed on the reading glass in order to read an image on the reading glass under the reading glass with a document placed on the reading glass. Then, the dust is also read, and an image other than the original appears in the image data as the read result. Therefore, even when image data in which such a dust image appears is analyzed to detect a document edge, the document edge may be misled by the dust image.

このように、読取ユニットによる原稿の読取結果から、原稿エッジを検出する方法では、様々な要因により、原稿エッジを誤検出する可能性がある。勿論、このような原稿エッジの誤検出は、画像データを詳細に解析することで、ある程度抑えることができるが、画像データを詳細に解析する場合には、原稿エッジの検出に長い時間がかかるため、原稿エッジの検出を高速に実行することができなくなる。   As described above, in the method of detecting the document edge from the result of reading the document by the reading unit, the document edge may be erroneously detected due to various factors. Of course, such an erroneous detection of the document edge can be suppressed to some extent by analyzing the image data in detail, but when the image data is analyzed in detail, it takes a long time to detect the document edge. Thus, the detection of the document edge cannot be performed at high speed.

本発明は、こうした問題に鑑みなされたものであり、読取ユニットによる読取結果としての画像データから、原稿エッジ(原稿の端縁)を検出する装置において、原稿内部の罫線や埃等の影響を抑えて、原稿エッジを適切に検出可能で且つ高速に原稿エッジを検出可能な技術を提供することを目的とする。   The present invention has been made in view of these problems, and suppresses the influence of ruled lines, dust, and the like inside a document in an apparatus that detects a document edge (document edge) from image data obtained as a result of reading by a reading unit. An object of the present invention is to provide a technique capable of appropriately detecting a document edge and detecting a document edge at high speed.

かかる目的を達成するためになされた発明は、読取対象の原稿が載置される原稿台と、原稿台に載置された原稿を読み取るための読取ユニットと、読取ユニットに、原稿台に載置された原稿を読み取らせることにより、原稿台に載置された原稿の読取画像を表す画像データを生成する読取制御手段と、を備える画像読取装置であって、更に、変換手段と、選択手段と、検出手段と、を備えるものである。 The invention made to achieve such an object includes an original platen on which an original to be read is placed, a reading unit for reading an original placed on the original plate, and a reading unit. by reading the is document, an image reading equipment comprising a reading control means, the generating image data representing the read image of a document placed on the document table, further converting means and the selecting means And a detecting means.

この画像読取装置における変換手段は、読取制御手段により生成された画像データを、エッジ画像を表す画像データに変換する。また、選択手段は、原稿台において、特定方向に延びる原稿の端縁、を表すエッジ点の候補を、所定の規則に従って、上記変換手段による変換後の画像データから選択する。 The conversion unit in the image reading apparatus converts the image data generated by the reading control unit into image data representing an edge image. Further, the selection means selects, from the image data converted by the conversion means, edge point candidates representing the edge of the document extending in a specific direction on the document table in accordance with a predetermined rule.

この他、検出手段は、上記選択手段により候補として選択されたエッジ点の分布に基づき、選択手段により選択された候補の一群の中から、原稿の端縁を表すエッジ点としての確度が低いエッジ点を破棄することにより、当該破棄後に残る候補を、上記特定方向に延びる原稿の端縁を表すエッジ点として検出する。   In addition, the detection means is an edge having a low accuracy as an edge point representing the edge of the document from the group of candidates selected by the selection means based on the distribution of the edge points selected as candidates by the selection means. By discarding the points, the candidates remaining after the discard are detected as edge points representing the edge of the document extending in the specific direction.

また、選択手段は、具体的に、上記変換後の画像データの端点を、参照開始位置に設定して、当該参照開始位置から、予め定められた第一の方向に沿って、画像データの内側へと、この画像データを構成する各画素の画素値を参照することにより、第一の方向とは垂直な第二の方向へ連続するエッジ点を探索する際の起点とするエッジ点を検出すると共に、検出したエッジ点を起点として、第二の方向へ連続するエッジ点を、その連続性が途切れるまで探索することにより、上記起点としたエッジ点から第二の方向に連続するエッジ点のグループを検出し、当該検出した第二の方向に連続するエッジ点のグループを、上記特定方向に延びる原稿の端縁を表すエッジ点の候補に選択する。   In addition, the selection unit specifically sets the end point of the converted image data as a reference start position, and extends from the reference start position to the inner side of the image data along a predetermined first direction. Then, by referring to the pixel value of each pixel constituting the image data, an edge point as a starting point when searching for an edge point continuous in a second direction perpendicular to the first direction is detected. In addition, a group of edge points that continue in the second direction from the starting edge point by searching for the edge points that continue in the second direction starting from the detected edge point until the continuity is interrupted. And a group of edge points continuous in the detected second direction is selected as an edge point candidate representing an edge of the document extending in the specific direction.

選択手段は、このような動作を、連続性が途切れる度、上記参照開始位置を、第二の方向に更新しながら、繰返し実行することにより、上記特定方向に延びる原稿の端縁を表すエッジ点の候補を選択する。   The selection means repeatedly performs such an operation while updating the reference start position in the second direction every time the continuity is interrupted, whereby an edge point representing an edge of the document extending in the specific direction is obtained. Select candidates for.

即ち、本発明の画像読取装置では、上述した選択手段の動作により、原稿の端縁を表すエッジ点を、高速に画像データ内から抽出できるようにしつつ、高速性のため犠牲にした精度については、検出手段により、選択手段が選択したエッジ点の中から、原稿の端縁を表すエッジ点として確度の低いエッジ点を破棄することにより、補完するようにした。 That is, in the image reading apparatus of the present invention, the edge point representing the edge of the document can be extracted from the image data at high speed by the operation of the selection means described above, and the accuracy sacrificed for high speed is described. The detection means complements the edge points selected by the selection means by discarding edge points with low accuracy as edge points representing the edge of the document.

換言すると、本発明の画像読取装置では、複数段階に分けて、画像データ内から原稿の端縁を表すエッジ点として最もらしいエッジ点を抽出することにより、従来よりも、高速且つ正確に、原稿の端縁を表すエッジ点(原稿エッジ)を正確に検出することができるようにした。 In other words, the image reading apparatus of the present invention extracts the most probable edge point as the edge point representing the edge of the document from the image data in a plurality of stages, so that the document is faster and more accurate than before. The edge point (document edge) representing the edge of the document can be accurately detected.

また、本発明の画像読取装置によれば、検出手段の動作により、原稿台に載置された埃や原稿内部に描写された罫線等の影響を受けて誤選択したエッジ点を破棄できる。従って、この発明によれば、原稿内部の罫線や埃等の影響を抑えて、原稿エッジを適切に検出できると共に、高速に原稿エッジを検出することができる。
また、本発明の画像読取装置によれば、読取制御手段が、第二の方向に垂直な原稿台の一辺から第二の方向に延びる中央までの領域よりも短い領域を、読取ユニットに読み取らせる機能を有し、選択手段は、この機能により読取制御手段が生成した画像データについての変換手段による変換後の画像データから、エッジ点の候補を選択する。従って、本発明によれば、高速に原稿エッジを検出することができる。
Further, according to the image reading apparatus of the present invention, it is possible to discard an erroneously selected edge point due to the influence of dust placed on the document table, ruled lines drawn inside the document, or the like by the operation of the detection means. Therefore, according to the present invention, it is possible to appropriately detect the document edge and to detect the document edge at a high speed while suppressing the influence of ruled lines and dust inside the document.
According to the image reading apparatus of the present invention, the reading control unit causes the reading unit to read an area shorter than the area extending from one side of the document table perpendicular to the second direction to the center extending in the second direction. The selecting means has a function, and the selection means selects edge point candidates from the image data converted by the converting means for the image data generated by the reading control means. Therefore, according to the present invention, document edges can be detected at high speed.

ところで、この画像読取装置が備える検出手段は、検査対象切替設定手段と、第一判定手段と、乖離度算出手段と、第二判定手段と、を備えることができるIncidentally, the image reading device comprises detecting means, and the inspection object switching setting means, a first judging means can Rukoto comprises a deviation calculating unit, a second determination means.

検査対象切替設定手段は、選択手段により上記候補に選択された各グループを、順次、検査対象のグループに設定する手段であり、検査対象のグループを、第二の方向において最も原稿台の中央寄りのグループから端寄りのグループへ、順次切り替えるようにして設定する。   The inspection target switching setting means is a means for sequentially setting each group selected as the candidate by the selection means to the inspection target group. The inspection target group is set closest to the center of the document table in the second direction. It is set so that the group is sequentially switched from one group to the other group.

一方、第一判定手段は、検査対象切替設定手段により検査対象のグループが設定される度、検査対象切替設定手段により現在設定されている検査対象のグループに、検査対象切替設定手段により検査対象のグループが切り替えられる方向において隣接するグループが存在するか否かを、第二の方向に平行な一次元空間上で評価して判定する。即ち、第一判定手段は、検査対象のグループに隣接するグループが、検査対象切替設定手段により検査対象のグループが切り替えられる方向に存在するか否かを、その方向(第二の方向)において評価して判定する。この際、第一の方向については評価しない。   On the other hand, each time the inspection object group is set by the inspection object switching setting means, the first determination means sets the inspection object group currently set by the inspection object switching setting means to the inspection object switching setting means. It is determined by evaluating on a one-dimensional space parallel to the second direction whether there is an adjacent group in the direction in which the group is switched. In other words, the first determination means evaluates in the direction (second direction) whether a group adjacent to the inspection target group exists in a direction in which the inspection target group is switched by the inspection target switching setting means. Judgment. At this time, the first direction is not evaluated.

そして、乖離度算出手段は、第一判定手段により上記隣接するグループが存在すると判定されると、検査対象のグループに属するエッジ点であって最も上記隣接するグループ寄りのエッジ点と、上記隣接するグループに属するエッジ点であって最も検査対象のグループ寄りのエッジ点と、の第一の方向の乖離度を算出する(図9参照)。また、第二判定手段は、乖離度算出手段により算出された乖離度が閾値未満であるか否かを判定する。   When the first determination unit determines that the adjacent group exists, the divergence degree calculation unit is the edge point belonging to the group to be inspected and closest to the adjacent group, and the adjacent point. The degree of deviation in the first direction from the edge point belonging to the group and closest to the group to be inspected is calculated (see FIG. 9). Further, the second determination unit determines whether or not the divergence degree calculated by the divergence degree calculation unit is less than a threshold value.

そして、検出手段は、第一判定手段により隣接するグループが存在しないと判定されるか、第二判定手段により乖離度が閾値以上であると判定されると、その時点までに検査対象のグループに設定されなかったグループ(第二の方向において原稿台の端側に位置するグループ)の全てを、原稿の端縁を表すエッジ点としての確度が低いエッジ点の集合であるとみなして、当該エッジ点の集合を破棄する。   When the first determination unit determines that the adjacent group does not exist or the second determination unit determines that the divergence degree is equal to or greater than the threshold, the detection unit determines that the group to be inspected by that time point. All of the groups that are not set (groups located on the edge side of the document table in the second direction) are regarded as a set of edge points with low accuracy as edge points representing the edge of the document, and the edges Discard the set of points.

上述の画像読取装置においては、原稿台に原稿が正しく載置されたときに検出対象の原稿の端縁が延びる方向を、第二の方向に定め、それとは垂直な方向を第一の方向に定めることで、目的の原稿エッジを検出することができるが、このように第一及び第二の方向を定めた場合には、原稿台に原稿が正しく載置されておらず、傾いて載置されている場合、検出対象の原稿の端縁とは違う原稿の端縁に対応するエッジ点を、連続性を検査する対象のエッジ点として検出してしまう可能性があり、当該端縁から原稿の内部に描写された罫線等を、原稿の端縁を表すエッジ点の候補として誤選択してしまう可能性がある(図9参照)。 In the image reading apparatus described above, the direction in which the edge of the document to be detected extends when the document is correctly placed on the document table is defined as the second direction, and the direction perpendicular thereto is defined as the first direction. In this way, the target document edge can be detected. However, when the first and second directions are determined in this way, the document is not placed correctly on the document table, but placed at an angle. The edge point corresponding to the document edge different from the edge of the document to be detected may be detected as the edge point to be inspected for continuity. There is a possibility that a ruled line or the like drawn inside is erroneously selected as an edge point candidate representing the edge of the document (see FIG. 9).

従って、このように誤選択されたエッジ点については、検出手段により破棄できるのが好ましいが、原稿が傾いていることが原因で発生する誤選択動作は、原稿台の端側で発生する可能性が高く原稿台の中央側で発生する可能性は低い。   Accordingly, it is preferable that the erroneously selected edge point can be discarded by the detecting means. However, an erroneous selection operation that occurs due to the inclination of the document may occur on the end side of the document table. Is high and is unlikely to occur at the center of the platen.

このような理由により、上述の検出手段では、選択手段により候補として選択されたエッジ点の内、原稿台の中央寄りに位置するエッジ点を、原稿の端縁を表すエッジ点である確度の高いエッジ点であると取り扱い、第二の方向において最も原稿台の中央寄りのグループとは乖離したグループに属するエッジ点の全てを、確度が低い候補として破棄するようにしているのである。   For this reason, the detection means described above has a high probability that the edge point located near the center of the document table among the edge points selected as candidates by the selection means is an edge point representing the edge of the document. The edge points are treated as being edge points, and all the edge points belonging to the group that is most distant from the group closest to the center of the document table in the second direction are discarded as candidates with low accuracy.

従って、この検出手段を備える画像読取装置の発明によれば、原稿が傾いていることによる選択手段の誤選択動作を、検出手段で修正して、正しく原稿エッジを検出することができて、原稿の罫線等の影響を受けずに、適切に原稿エッジを検出することができる。 Therefore, according to the invention of the image reading apparatus provided with the detecting means, the erroneous selection operation of the selecting means due to the inclination of the original can be corrected by the detecting means, and the original edge can be detected correctly. Thus, it is possible to appropriately detect the document edge without being affected by the ruled line.

また、検出手段は、選択手段により候補に選択された各グループの内、最も長く連続するグループを、確度が高いエッジ点の集合とみなし、当該最も長く連続するグループ以外のグループを、確度が低いエッジ点の集合とみなして、当該確度が低いエッジ点を破棄する構成にされてもよい。 The detection means may, among the group selected in the candidate by selecting means, the successive groups longest, regarded as a set of probable edge point, a group of non-successive groups the longest, accuracy is A configuration may be adopted in which the edge points with low accuracy are discarded as a set of low edge points.

第二の方向へ長く連続するエッジ点の集合ほど、当該エッジ点の集合が真に検出対象の原稿の端縁を表すエッジ点である可能性が高く、短く連続するエッジ点については、それが原稿台に載置された埃等によって生じたエッジ点である可能性が高い。   The set of edge points that continue long in the second direction is more likely to be the edge point that truly represents the edge of the original document to be detected. There is a high possibility that the edge point is caused by dust or the like placed on the document table.

したがって、このように検出手段を構成して、第二の方向に最も長くエッジ点の集合を、原稿の端縁を表すエッジ点として検出するようにすれば、原稿台に載置された埃等の影響により選択手段で誤選択したエッジ点の集合を、検出手段で破棄して、正しく原稿エッジを検出することができ、埃等の影響を抑えて、適切に原稿エッジを検出することができる。   Therefore, if the detection means is configured in this way so that a set of edge points that are longest in the second direction is detected as an edge point that represents the edge of the document, dust or the like placed on the document table The set of edge points erroneously selected by the selection means due to the influence of the selection means can be discarded by the detection means, and the document edge can be detected correctly, and the influence of dust etc. can be suppressed and the document edge can be detected appropriately. .

この他、検出手段は、近似直線算出手段と、ヒストグラムデータ生成手段と、を備えることができる。近似直線算出手段は、選択手段により候補に選択された各グループを更に細分化してなる小グループ毎に、当該小グループを構成するエッジ点の近似直線を算出する。一方、ヒストグラムデータ生成手段は、近似直線算出手段により算出された各小グループの近似直線の傾き及び切片の情報に基づき、近似直線についてのヒストグラムデータを生成する。 In addition, the detecting means may obtain Preparations and approximate line calculating means, the histogram data generating means. The approximate line calculation means calculates an approximate line of edge points constituting the small group for each small group obtained by further subdividing each group selected as a candidate by the selection means. On the other hand, the histogram data generating means generates histogram data for the approximate line based on the inclination and intercept information of the approximate line of each small group calculated by the approximate line calculation means.

そして、検出手段は、ヒストグラムデータ生成手段により生成されたヒストグラムデータに基づき、度数の最も高い近似直線が算出された小グループの集合を、確度が高いエッジ点の集合とみなし、当該度数の最も高い近似直線が算出された小グループの集合に属さないエッジ点の集合を、確度が低いエッジ点の集合とみなして、当該確度が低いエッジ点を破棄することにより、上記特定方向に延びる原稿の端縁を表すエッジ点を検出する。   Then, the detecting means regards the set of small groups for which the approximate straight line having the highest frequency is calculated based on the histogram data generated by the histogram data generating means as the set of edge points with high accuracy, and has the highest frequency. A set of edge points that do not belong to the set of small groups for which the approximate straight line is calculated is regarded as a set of edge points with low accuracy, and the edge points with low accuracy are discarded. An edge point representing an edge is detected.

即ち、検出手段は、各小グループの近似直線の内、度数の最も高い近似直線に対応する小グループの集合を、原稿の端縁を表すエッジ点の集合として、検出する。
選択手段により選択されたエッジ点の集合が、真に原稿の端縁を表すエッジ点の集合である場合には、当然のことながら各小グループの近似直線の傾き及び切片は一致するはずである。換言すれば、各小グループの近似直線の傾き及び切片の類似性をヒストグラムにより評価して、度数の最も高い近似直線に対応するエッジ点の集合を、原稿の端縁を表すエッジ点として検出するようにすれば、高精度に原稿エッジを検出することができる。
In other words, the detecting means detects a set of small groups corresponding to the approximate straight line having the highest frequency among the approximate straight lines of each small group as a set of edge points representing the edge of the document.
If the set of edge points selected by the selection means is a set of edge points that truly represent the edge of the document, it is natural that the slopes and intercepts of the approximate lines of each small group should match. . In other words, the slope of the approximate line of each small group and the similarity of the intercepts are evaluated by a histogram, and a set of edge points corresponding to the approximate line with the highest frequency is detected as an edge point representing the edge of the document. By doing so, the document edge can be detected with high accuracy.

従って、この画像読取装置によれば、選択手段で候補とするエッジ点を高速に選択しても、検出手段にて誤選択を正しく修正することができて、原稿台に載置された埃や原稿内部の罫線等による影響を極力抑え、原稿エッジを正しく検出することができる。 Therefore, according to this image reading apparatus , even if the selection means selects the edge point as a candidate at high speed, the detection means can correct the erroneous selection correctly, and the dust placed on the document table The influence of the ruled lines inside the document can be suppressed as much as possible, and the document edge can be detected correctly.

また、当該画像読取装置にて検出した原稿の端縁を表すエッジ点の情報(原稿エッジの情報)は、例えば、OCR処理や、変倍率・傾き補正量の設定動作等に利用することができるAlso, edge point information (document edge information) representing the edge of the document detected by the image reading apparatus can be used for, for example, OCR processing, a variable magnification / tilt correction amount setting operation, and the like. .

以下に本発明の実施例について、図面と共に説明する。
図1(a)は、本実施例のディジタル複合機1の構成を表すブロック図である。図1(a)に示すように、本実施例のディジタル複合機1は、画像読取部10、読取制御部20、印刷部30、印刷制御部40、表示操作部50、通信部60、CPU70、RAM80及びフラッシュメモリ90を備え、フラッシュメモリ90に記録されたプログラムに基づきCPU70にて各種処理を実行し、装置全体を統括制御する構成にされている。
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 1A is a block diagram illustrating the configuration of the digital multifunction peripheral 1 according to the present embodiment. As shown in FIG. 1A, the digital multifunction peripheral 1 of this embodiment includes an image reading unit 10, a reading control unit 20, a printing unit 30, a printing control unit 40, a display operation unit 50, a communication unit 60, a CPU 70, A RAM 80 and a flash memory 90 are provided, and various processes are executed by the CPU 70 based on a program recorded in the flash memory 90 to control the entire apparatus.

具体的に、画像読取部10は、図1(b)(c)に示す構成にされている。図1(b)(c)は、画像読取部10の構成を示した説明図である。画像読取部10は、読取対象の原稿Pが載置される透明な板状の読取ガラス11が筐体13に支持された構成にされており、筐体13内の読取ガラス11下に、読取ガラス11に写る画像を主走査方向において光学的に読み取る読取ユニット15と、読取ユニット15を副走査方向に搬送する搬送機構16と、搬送機構16を駆動するモータ17とを備える。   Specifically, the image reading unit 10 is configured as shown in FIGS. FIGS. 1B and 1C are explanatory diagrams showing the configuration of the image reading unit 10. The image reading unit 10 is configured such that a transparent plate-shaped reading glass 11 on which a document P to be read is placed is supported by a housing 13, and the reading is performed below the reading glass 11 in the housing 13. A reading unit 15 that optically reads an image reflected on the glass 11 in the main scanning direction, a conveying mechanism 16 that conveys the reading unit 15 in the sub-scanning direction, and a motor 17 that drives the conveying mechanism 16 are provided.

この画像読取部10は、読取制御部20から入力される制御信号に従って、モータ17の回転力により搬送機構16を駆動し、これにより読取ユニット15を読取ガラス11下で副走査方向(図1(b)(c)に示す点線矢印方向)に搬送すると共に、搬送時において、読取ユニット15に読取動作を実行させる。   The image reading unit 10 drives the transport mechanism 16 by the rotational force of the motor 17 in accordance with a control signal input from the reading control unit 20, thereby causing the reading unit 15 to move under the reading glass 11 in the sub-scanning direction (FIG. 1 ( b) While being conveyed in the direction of the dotted arrow shown in (c), the reading unit 15 is caused to perform a reading operation during conveyance.

尚、読取ユニット15は、読取制御部20に制御され、副走査方向への移動と共に、読取ガラス11に写る画像を、ライン毎に読み取り、その読取画像を表すライン画像信号を出力するコンタクトイメージセンサ(CIS)である。この読取ユニット15から出力されるライン画像信号は、図示しないA/D変換器にてディジタルデータ(ライン画像データ)に変換され、読取制御部20に入力される。   Note that the reading unit 15 is controlled by the reading control unit 20 and, as it moves in the sub-scanning direction, reads an image shown on the reading glass 11 line by line and outputs a line image signal representing the read image. (CIS). The line image signal output from the reading unit 15 is converted into digital data (line image data) by an A / D converter (not shown) and input to the reading control unit 20.

また、画像読取部10には、周知のスキャナと同様、読取ガラス11を被覆可能な蓋が開閉自在に設けられており(図示せず)、読取ユニット15による読取動作の実行時には、ユーザによる手動操作により、読取ガラス11に載置された原稿の上にかぶせられるようにして蓋が閉められる。尚、読取ガラス11と対向する蓋の内側には、読取ユニット15の読取結果である画像データにおいて、原稿外側領域に、黒い影が写らないように、白色部材が設けられている。   The image reading unit 10 is provided with a lid (not shown) that can cover the reading glass 11 so as to be openable and closable similarly to a known scanner. When the reading operation by the reading unit 15 is performed, a manual operation by the user is performed. By the operation, the lid is closed so as to be placed on the document placed on the reading glass 11. A white member is provided on the inner side of the lid facing the reading glass 11 so that a black shadow does not appear in the outer area of the document in the image data that is the reading result of the reading unit 15.

一方、読取制御部20は、CPU70からの指令に従って読取制御処理を実行し、当該読取制御処理にて、読取ユニット15の副走査方向への移動を制御すると共に、読取ユニット15の読取動作を制御する。   On the other hand, the reading control unit 20 executes a reading control process in accordance with an instruction from the CPU 70, and controls the movement of the reading unit 15 in the sub-scanning direction and controls the reading operation of the reading unit 15 in the reading control process. To do.

この制御により、読取制御部20は、読取ユニット15を読取ガラス11下で副走査方向に搬送しつつ、CPU70から指定された読取ガラス11の読取領域に写る画像を、読取ユニット15に読み取らせ、読取ガラスの読取領域に写る画像を表す画像データを、RAM80に記録する。このような動作により、RAM80には、読取ガラス11の読取領域に載置された原稿Pの読取画像を表す画像データ(主走査方向及び副走査方向に画素が配列された二次元画像データ)が記録される。   With this control, the reading control unit 20 causes the reading unit 15 to read an image reflected in the reading area of the reading glass 11 designated by the CPU 70 while conveying the reading unit 15 under the reading glass 11 in the sub-scanning direction. Image data representing an image shown in the reading area of the reading glass is recorded in the RAM 80. By such an operation, image data (two-dimensional image data in which pixels are arranged in the main scanning direction and the sub scanning direction) representing the read image of the document P placed in the reading area of the reading glass 11 is stored in the RAM 80. To be recorded.

尚、読取制御部20は、画像読取部10から入力される各ライン画像データを、一旦内蔵のバッファに蓄積し、各ライン画像データに対してシェーディング補正等の画像処理を実行した後、各ライン画像データを、RAM80に記録する。   The reading control unit 20 temporarily stores each line image data input from the image reading unit 10 in a built-in buffer, performs image processing such as shading correction on each line image data, and then executes each line image data. Image data is recorded in the RAM 80.

この他、印刷部30は、印刷制御部40から入力される制御信号に従い、トレイ(図示せず)に載置された記録紙を、記録位置に搬送し、インクジェット方式やレーザプリンタ方式等の周知の記録方式で、記録紙に、制御信号に対応した画像を形成するものである。   In addition, the printing unit 30 conveys a recording sheet placed on a tray (not shown) to a recording position in accordance with a control signal input from the printing control unit 40, and is well-known such as an ink jet method or a laser printer method. In this recording method, an image corresponding to the control signal is formed on the recording paper.

また、印刷制御部40は、印刷部30を制御して記録紙に画像を形成するものであり、CPU70からの指令に従って、CPU70から指定された印刷対象データに基づく画像を、印刷部30を通じて、記録紙に印刷する。   The print control unit 40 controls the printing unit 30 to form an image on recording paper. In accordance with a command from the CPU 70, an image based on the print target data designated by the CPU 70 is transmitted through the printing unit 30. Print on recording paper.

また、通信部60は、外部機器と通信するためのインタフェース群からなり、USBインタフェース、LANインタフェース、FAXモデム等から構成されている。即ち、複合機1は、通信部60が備えるFAXモデムを通じて外部のFAX装置とFAX通信可能な構成にされ、USBインタフェース又はLANインタフェースを通じて外部のパーソナルコンピュータと通信可能な構成にされている。   The communication unit 60 includes a group of interfaces for communicating with an external device, and includes a USB interface, a LAN interface, a FAX modem, and the like. That is, the multi-function device 1 is configured to be capable of performing FAX communication with an external FAX device through a FAX modem provided in the communication unit 60, and configured to be capable of communicating with an external personal computer through a USB interface or a LAN interface.

この他、表示操作部50は、情報表示用の液晶ディスプレイ(図示せず)と、各種操作キーとを備え、CPU70に制御されて、液晶ディスプレイに、ユーザ向けの情報を表示すると共に、操作キーを通じて入力されたユーザからの指令を、CPU70に入力する。   In addition, the display operation unit 50 includes a liquid crystal display (not shown) for displaying information and various operation keys, and is controlled by the CPU 70 to display information for the user on the liquid crystal display. The command from the user input through is input to the CPU 70.

また、CPU70は、プログラムの実行により、操作キーを通じて入力される指令や通信部60を通じて外部のパーソナルコンピュータ等から入力される指令に従い、コピー機能、FAX機能、スキャナ機能、及び、プリンタ機能等を実現する。   Further, the CPU 70 realizes a copy function, a FAX function, a scanner function, a printer function, and the like according to a command input through an operation key or a command input from an external personal computer or the like through the communication unit 60 by executing a program. To do.

例えば、CPU70は、表示操作部50に設けられた操作キーを通じてユーザからコピー指令が入力されると、複写制御処理(図3参照)を実行して装置内各部を制御し、読取ガラス11上に載置された原稿Pの読取画像を、記録紙に印刷する。詳細には、読取ユニット15による読取結果に基づいて読取ガラス11上に載置された原稿Pのサイズを推定し、推定した原稿サイズと記録紙サイズとから変倍率を設定して、原稿Pの読取画像を、記録紙サイズに適合する大きさに拡大又は縮小し、これを、印刷部30を通じて記録紙に印刷する(自動変倍複写処理)。   For example, when a copy command is input from the user through an operation key provided on the display operation unit 50, the CPU 70 executes a copy control process (see FIG. 3) to control each unit in the apparatus, and on the reading glass 11. The read image of the placed document P is printed on a recording sheet. More specifically, the size of the document P placed on the reading glass 11 is estimated based on the reading result by the reading unit 15, and the scaling ratio is set from the estimated document size and the recording paper size, and the document P The read image is enlarged or reduced to a size suitable for the recording paper size, and this is printed on the recording paper through the printing unit 30 (automatic scaling copying process).

以下、この複写制御処理の内容について具体的に説明するが、それに先駆けては、図2を用いて本実施例の画像読取部10の特徴について説明する。
図2は、読取ガラス11の読取可能領域R0を示した説明図である。当該複合機1においては、一面が開口された長方体状の筐体13の当該開口部において、長方形状のガラス板である読取ガラス11が当該開口部を閉塞するように設けられており、読取ガラス11の周囲が筐体13により支持された構成にされている。
The contents of the copy control process will be specifically described below. Prior to that, the characteristics of the image reading unit 10 of this embodiment will be described with reference to FIG.
FIG. 2 is an explanatory view showing the readable region R0 of the reading glass 11. As shown in FIG. In the multifunction device 1, a reading glass 11 that is a rectangular glass plate is provided so as to close the opening portion in the opening portion of the rectangular housing 13 whose one surface is opened. The periphery of the reading glass 11 is supported by a housing 13.

この読取ガラス11は、筐体13の上面よりも若干筐体13の下側に設けられており、筐体13から露出する読取ガラス11の領域11a(以下、「原稿台」と表現する。)と筐体13との境界BDには、原稿Pを突き当て可能に段差が形成されている(以下、筐体13の読取ガラス11より上方に位置する部位(上記段差を形成する部位)13aを「フレーム」と表現する。)。   The reading glass 11 is provided slightly below the upper surface of the housing 13 from the upper surface of the housing 13, and an area 11 a of the reading glass 11 exposed from the housing 13 (hereinafter, referred to as “original table”). A step is formed at the boundary BD between the casing 13 and the casing 13 so that the original P can be abutted (hereinafter referred to as a portion 13a above the reading glass 11 of the casing 13 (the portion forming the step)). Expressed as “frame”.)

また、画像読取部10においては、読取ユニット15のライン幅と、原稿台11aの大きさとの関係から、四角形状の原稿台11aの全領域よりも若干狭い四角形状の領域R0が、読取ユニット15により原稿を読取可能な読取可能領域R0に定められている。具体的に、読取可能領域R0は、図2において点線で示すように、フレーム13aと読取ガラス11との境界BDから微小量(本実施例では3mm)離れた位置に外周を有した領域となっている。   Further, in the image reading unit 10, due to the relationship between the line width of the reading unit 15 and the size of the document table 11 a, a rectangular region R 0 that is slightly narrower than the entire region of the rectangular document table 11 a is the reading unit 15. Is defined as a readable area R0 where the original can be read. Specifically, the readable area R0 is an area having an outer periphery at a position away from the boundary BD between the frame 13a and the reading glass 11 by a minute amount (3 mm in this embodiment), as indicated by a dotted line in FIG. ing.

また、この画像読取部10においては、フレーム13aの左下部分に、原稿Pの角を突き当てるように指示するマークMKが記されている。尚、本実施例では、マークMKが付された原稿台11aの角を、「左下角」と定義して、この左下角より、主走査方向に離れた地点に位置する原稿台11aの角を「右下角」と定義し、左下角より、副走査方向に離れた地点に位置する原稿台11aの角を「左上角」と定義する。   In the image reading unit 10, a mark MK is instructed in the lower left part of the frame 13a to instruct the corner of the document P to abut. In this embodiment, the corner of the document table 11a to which the mark MK is attached is defined as “lower left corner”, and the corner of the document table 11a located at a point farther in the main scanning direction than the lower left corner is defined. The “lower right corner” is defined, and the corner of the document table 11a located at a point away from the lower left corner in the sub-scanning direction is defined as “upper left corner”.

即ち、複合機1においては、原稿台11aの左下角(換言すれば、フレーム13aの内側左下角)が、原稿Pの角を合わせるべき位置として定められ、原稿台11aの当該左下角から延びる左端縁及び下端縁が、原稿Pの辺(端縁)を合わせるべき端縁として定められており、複合機1は、ユーザが概ね、このマークMKに合わせて原稿Pを載置しているとの仮定の下で、原稿サイズの推定等を行い、原稿のコピー動作を実現する。   That is, in the multifunction machine 1, the lower left corner of the document table 11a (in other words, the lower left corner inside the frame 13a) is determined as the position where the corner of the document P should be aligned, and the left end extending from the lower left corner of the document table 11a. The edge and the lower edge are defined as edges to which the side (edge) of the document P should be aligned, and the multi-function device 1 indicates that the user generally places the document P in alignment with the mark MK. Under the assumption, the manuscript size is estimated, and the manuscript copy operation is realized.

この他、本実施例の複合機1においては、このマークMKが付されたフレーム13aの内側左下角に対応する読取可能領域R0の左下角を原点、主走査方向をX軸、副走査方向をY軸としたXY座標系(図2(b)参照)が導入されており、CPU70は、このXY座標系を用いて図3に示す複写制御処理を実行する。   In addition, in the multifunction machine 1 of this embodiment, the lower left corner of the readable area R0 corresponding to the inner lower left corner of the frame 13a with the mark MK is the origin, the main scanning direction is the X axis, and the sub scanning direction is An XY coordinate system (see FIG. 2B) with the Y axis is introduced, and the CPU 70 executes the copy control process shown in FIG. 3 using this XY coordinate system.

続いて、CPU70が実行する複写制御処理について説明する。図3は、操作キーを通じてコピー指令が入力されると、CPU70が実行する複写制御処理を表すフローチャートである。   Next, a copy control process executed by the CPU 70 will be described. FIG. 3 is a flowchart showing a copy control process executed by the CPU 70 when a copy command is input through the operation keys.

複写制御処理を開始すると、CPU70は、操作キーを通じて入力されたコピー指令が「自動変倍/傾き補正」コピー指令であるか否かを判断し(S110)、「自動変倍/傾き補正」コピー指令であると判断すると(S110でYes)、S120にて、図4に示す自動変倍複写処理を実行する。その後、当該複写制御処理を終了する。   When the copy control process is started, the CPU 70 determines whether or not the copy command input through the operation key is an “automatic scaling / tilt correction” copy command (S110), and copies the “automatic scaling / tilt correction”. If it is determined that it is a command (Yes in S110), the automatic zoom copying process shown in FIG. 4 is executed in S120. Thereafter, the copy control process ends.

一方、操作キーを通じて入力されたコピー指令が、「自動変倍/傾き補正」コピー指令以外のコピー指令であると判断すると(例えば、自動変倍や傾き補正の指示のないノーマルなコピー指令であると判断すると)、CPU70は、S130にて、入力されたコピー指令に対応した処理を実行した後、当該複写制御処理を終了する。   On the other hand, if it is determined that the copy command input through the operation key is a copy command other than the “automatic scaling / tilt correction” copy command (for example, a normal copy command without an automatic scaling or tilt correction instruction). In step S130, the CPU 70 executes processing corresponding to the input copy command, and then ends the copy control processing.

続いて、CPU70がS120にて実行する自動変倍複写処理について説明する。図4は、CPU70が実行する自動変倍複写処理を表すフローチャートである。
CPU70は、S120にて自動変倍複写処理を開始すると、まず、原稿読取開始位置を、読取可能領域R0の下端(Y=0)に設定し、原稿読取終了位置を、設計段階で予め定められた読取可能領域R0の下端から所定距離離れた位置(Y=YPRE)に設定することにより、上記原稿読取開始位置から原稿読取終了位置までの領域に該当する読取可能領域R0の一部を、読取領域(換言すればプレスキャン領域)に設定し、読取制御部20を通じて、画像読取部10に、当該読取領域に対するプレスキャン動作を実行させる(S210:先端部プレスキャン処理)。
Next, the automatic scaling copying process executed by the CPU 70 in S120 will be described. FIG. 4 is a flowchart showing the automatic scaling copying process executed by the CPU 70.
When the CPU 70 starts the automatic scaling copying process in S120, first, the document reading start position is set to the lower end (Y = 0) of the readable area R0, and the document reading end position is predetermined in the design stage. By setting a position (Y = YPRE) that is a predetermined distance away from the lower end of the readable area R0, a part of the readable area R0 corresponding to the area from the original reading start position to the original reading end position is read. An area (in other words, a pre-scan area) is set, and the image reading unit 10 is caused to execute a pre-scan operation on the reading area through the reading control unit 20 (S210: tip portion pre-scanning process).

即ち、S210では、読取可能領域R0全体に対してプレスキャン動作を画像読取部10に実行させるのではなく、読取可能領域R0の下端から読取可能領域R0内側へ所定距離離れた地点まで(本実施例では、読取可能領域R0の下端から30mm離れた地点まで)に対し、プレスキャン動作を画像読取部10に実行させる。これにより、CPU70は、プレスキャン結果として、読取可能領域R0の一部領域の読取結果を表す画像データを画像読取部10から取得する。   That is, in S210, the pre-scanning operation is not performed on the entire readable area R0 by the image reading unit 10, but from the lower end of the readable area R0 to a point a predetermined distance away from the readable area R0 (this embodiment). In the example, the image reading unit 10 is caused to perform a pre-scan operation for a point 30 mm away from the lower end of the readable region R0. As a result, the CPU 70 acquires, as a pre-scan result, image data representing the read result of a partial area of the readable area R0 from the image reading unit 10.

尚、画像読取部10は、プレスキャン動作として、設定された読取領域の端から端まで、プレスキャン用の解像度に対応する速度で、読取ユニット15を副走査方向に搬送し、その読取領域の画像を読取ユニット15に読み取らせ、プレスキャン結果として、低解像度の画像データ(以下、「プレスキャン画像データ」という。)を、読取制御部20を通じて、RAM80に記録する動作を実行する。   As a pre-scan operation, the image reading unit 10 conveys the reading unit 15 in the sub-scanning direction at a speed corresponding to the pre-scan resolution from the end of the set reading area to the end of the reading area. The image is read by the reading unit 15 and, as a prescan result, low resolution image data (hereinafter referred to as “prescan image data”) is recorded in the RAM 80 through the read control unit 20.

このようにしてS210での処理を終えると、次に、CPU70は、RAM80に記録されたプレスキャン画像データに対してエッジ検出処理を実行し、この画像データに対応するエッジ画像データを生成する(S215)。即ち、RAM80に記録されたプレスキャン画像データを、エッジ検出用の画像フィルタ(周知の微分フィルタ)に通して、この画像データに対応するエッジ画像を表すエッジ画像データを生成する。   When the processing in S210 is completed in this way, the CPU 70 next performs edge detection processing on the pre-scan image data recorded in the RAM 80, and generates edge image data corresponding to this image data ( S215). That is, the prescan image data recorded in the RAM 80 is passed through an image filter for edge detection (a well-known differential filter), and edge image data representing an edge image corresponding to the image data is generated.

また、S215での処理を終えると、CPU70は、上記生成したエッジ画像データを、検査対象データに設定して、図5に示す原稿推定処理を実行する(S220)。詳細は後述するが、この原稿推定処理では、検査対象データ(S215で得られたエッジ画像データ)を解析して、原稿エッジを検出し、この検出結果から、原稿台11aに載置された原稿のサイズ(縦幅及び横幅)、及び、原稿の傾き角θ、及び、原稿台11aにおける原稿の載置領域を推定する。   When the process in S215 is completed, the CPU 70 sets the generated edge image data as inspection target data, and executes the document estimation process shown in FIG. 5 (S220). Although details will be described later, in this document estimation process, the inspection target data (edge image data obtained in S215) is analyzed to detect the document edge, and the document placed on the document table 11a is detected from the detection result. Size (vertical width and horizontal width), the inclination angle θ of the original, and the original placement area on the original table 11a.

そして、S220での処理を終えると、CPU70は、印刷制御部40を通じて、印刷部30に給紙動作を実行させると共に(S230)、給紙動作の対象となった記録紙のサイズを検出する(S240)。その後、S251に移行する。尚、記録紙のサイズは、例えば、記録紙の搬送路に設けられたセンサを用いて周知の手法で検出することができる。   When the processing in S220 is completed, the CPU 70 causes the printing unit 30 to perform a paper feeding operation through the print control unit 40 (S230), and detects the size of the recording paper that is the target of the paper feeding operation (S230). S240). Thereafter, the process proceeds to S251. The size of the recording paper can be detected by a well-known method using, for example, a sensor provided in the recording paper conveyance path.

また、S251に移行すると、CPU70は、S220で推定された原稿サイズ及びS240で検出された記録紙サイズに基づき、予め定められた計算式に従って変倍率を設定する。具体的には、変倍率を、原稿サイズと記録紙サイズとの比(例えば、記録紙短辺長さ÷原稿短辺長さ)に対応した倍率に設定し、後続の処理で、原稿のコピー画像が、原稿サイズとの記録紙サイズの比に対応した倍率で拡大(倍率が1未満の場合には縮小)されて記録紙に印刷されるようにする。   In step S251, the CPU 70 sets a scaling ratio according to a predetermined calculation formula based on the document size estimated in step S220 and the recording paper size detected in step S240. Specifically, the scaling factor is set to a magnification corresponding to the ratio between the document size and the recording paper size (for example, recording paper short side length ÷ original short side length), and the copy of the original is performed in the subsequent processing. The image is enlarged (or reduced if the magnification is less than 1) at a magnification corresponding to the ratio of the recording paper size to the document size and printed on the recording paper.

また、この処理を終えると、CPU70は、S220で推定された原稿の傾き角θから、画像データの傾き補正量を設定する(S253)。具体的には、原稿のコピー画像が、傾きのない状態でまっすぐ、記録紙に印刷されるように、傾き補正量を設定する。但し、推定された原稿の傾き角θが微小量(本実施例では−0.5度≦θ≦0.5度)である場合には、誤差も考慮して、傾き補正量をゼロに設定する。   When this processing is completed, the CPU 70 sets the inclination correction amount of the image data from the original inclination angle θ estimated in S220 (S253). Specifically, the tilt correction amount is set so that the copy image of the document is printed straight on the recording paper without tilting. However, when the estimated document inclination angle θ is a minute amount (in the present embodiment, −0.5 degrees ≦ θ ≦ 0.5 degrees), the inclination correction amount is set to zero in consideration of errors. To do.

S253での処理を終えると、CPU70は、S220で推定された原稿の載置領域の情報に基づいて、原稿読取開始位置及び原稿読取終了位置を設定し、原稿読取開始位置及び原稿読取終了位置で定められる読取領域を、原稿台11aにおける原稿の載置領域に対応させる(S255)。   When the processing in S253 is completed, the CPU 70 sets the document reading start position and the document reading end position based on the document placement area information estimated in S220, and sets the document reading start position and the document reading end position. The determined reading area is made to correspond to the document placement area on the document table 11a (S255).

具体的には、原稿の載置領域全体を読取ユニット15が読み取ることができるように、原稿読取開始位置を、副走査方向において最も下側に位置する原稿の端点に対応した位置に設定し、原稿読取終了位置を、副走査方向において最も上側に位置する原稿の端点に対応した位置に設定して、読取領域を原稿台11aにおける原稿の載置領域に対応させる。また、この処理を終えると、S270に移行する。   Specifically, the document reading start position is set to a position corresponding to the end point of the document located on the lowermost side in the sub-scanning direction so that the reading unit 15 can read the entire document placement area. The document reading end position is set to a position corresponding to the end point of the document located on the uppermost side in the sub-scanning direction, and the reading area is made to correspond to the document placement area on the document table 11a. When this process is finished, the process proceeds to S270.

また、S270に移行すると、CPU70は、読取制御部20を通じて画像読取部10を制御することで、画像読取部10に、読取ユニット15を原稿読取開始位置から原稿読取終了位置まで副走査方向に搬送させると共に、当該搬送中にはライン毎の読取動作を読取ユニット15に実行させて、上記設定した読取領域の画像を、読取ユニット15に読み取らせ、当該読取領域の読取結果を表す画像データが、RAM80に記録されるようにする(S270)。   In step S <b> 270, the CPU 70 controls the image reading unit 10 through the reading control unit 20 to convey the reading unit 15 to the image reading unit 10 from the document reading start position to the document reading end position in the sub-scanning direction. In addition, during the conveyance, the reading unit 15 performs a reading operation for each line, causes the reading unit 15 to read the image of the set reading area, and image data representing a reading result of the reading area is It is recorded in the RAM 80 (S270).

また、この処理を終えると、CPU70は、RAM80に記録された上記読取結果を表す画像データを、予め設定された変倍率で拡大又は縮小処理すると共に、予め設定された傾き補正量分、回転処理して、上記読取結果を表す画像データを、印刷用の画像データに変換し、変換後の画像データを、印刷対象データに設定する(S280)。但し、傾き補正量がゼロに設定されている場合には、S280において、回転処理を、実行しないものとする。   When this process is completed, the CPU 70 enlarges or reduces the image data representing the read result recorded in the RAM 80 at a preset magnification, and performs a rotation process for a preset inclination correction amount. Then, the image data representing the read result is converted into image data for printing, and the converted image data is set as print target data (S280). However, if the tilt correction amount is set to zero, the rotation process is not executed in S280.

また、S280での処理を終えると、CPU70は、当該印刷対象データについての印刷処理を実行する(S290)。即ち、印刷制御部40を通じて、印刷部30に印刷対象データに基づく画像を、給紙した記録紙に印刷させる。その後、当該複写制御処理を終了する。   When the process in S280 is completed, the CPU 70 executes a print process for the print target data (S290). That is, the printing unit 30 causes the printing unit 30 to print an image based on the print target data on the fed recording paper. Thereafter, the copy control process ends.

このようにして、自動変倍複写処理では、読取可能領域R0における一部領域のプレスキャン結果から、原稿エッジを検出して、原稿サイズ等を推定し、その結果から、本スキャン時(S270実行時)の読取領域を決定すると共に、変倍率及び傾き補正量を決定する。そして、原稿のコピー画像を、原稿サイズと記録紙サイズとの比に対応する大きさに、拡大又は縮小すると共に、傾き補正して、記録紙に印刷する。   In this way, in the automatic scaling copying process, the document edge is detected from the prescan result of a partial area in the readable area R0, the document size and the like are estimated, and based on the result, during the main scan (S270 execution) ) And a variable magnification and an inclination correction amount are determined. Then, the copy image of the original is enlarged or reduced to a size corresponding to the ratio between the original size and the recording paper size, and the inclination is corrected and printed on the recording paper.

続いて、図5を用いて、CPU70が、S220で実行する原稿推定処理について説明する。図5は、CPU70が実行する原稿推定処理を表すフローチャートである。
この原稿推定処理を開始すると、CPU70は、まず、変数Sを上述のプレスキャン領域上端のY座標であるYPREに設定することにより(S=YPRE)、Y軸方向の検査範囲を、Y=0からY=S=YPREに設定する(S410)。また、この処理を終えると、S420に移行し、右エッジ検出処理を実行する。図6は、CPU70が実行する右エッジ検出処理を表すフローチャートである。
Subsequently, the document estimation process executed by the CPU 70 in S220 will be described with reference to FIG. FIG. 5 is a flowchart showing document estimation processing executed by the CPU 70.
When the document estimation process is started, the CPU 70 first sets the variable S to YPRE which is the Y coordinate of the upper end of the pre-scan area (S = YPRE), thereby setting the inspection range in the Y-axis direction to Y = 0. To Y = S = YPRE (S410). When this process ends, the process proceeds to S420, and a right edge detection process is executed. FIG. 6 is a flowchart showing the right edge detection process executed by the CPU 70.

右エッジ検出処理を開始すると、CPU70は、まずS510にて、副走査方向検査位置Yeを、読取可能領域R0の下端Y座標に設定し(Ye=0)、S515にて、主走査方向検査位置Xeを、読取可能領域R0の右端X座標に設定する(Xe=XMAX)。また、S515では、変数Cを値ゼロに初期化する(C=0)。その後、副走査方向検査位置Yeから副走査(Y軸)方向に8画素進んだ地点(Ye+8)が検査範囲を超えているか否かを判断する(S520)。具体的には、Ye+8>Sであるか否かを判断する。   When the right edge detection process is started, the CPU 70 first sets the sub-scanning direction inspection position Ye to the lower end Y coordinate of the readable area R0 (Ye = 0) in S510, and the main scanning direction inspection position in S515. Xe is set to the right end X coordinate of the readable region R0 (Xe = XMAX). In S515, the variable C is initialized to zero (C = 0). Thereafter, it is determined whether or not a point (Ye + 8) advanced by 8 pixels in the sub-scanning (Y-axis) direction from the sub-scanning direction inspection position Ye exceeds the inspection range (S520). Specifically, it is determined whether or not Ye + 8> S.

そして、Ye+8>Sではないと判断すると(S520でNo)、CPU70は、主走査方向検査位置Xe及び副走査方向検査位置Yeで定まる検査位置(X,Y)=(Xe,Ye)に対応する検査対象データの画素値を参照することにより、検査位置(Xe,Ye)がエッジ点であるか否かを判断する(S525)。尚、図7は、エッジ画像データの構成を抜粋して示し、更に、右エッジ検出処理により追跡するエッジ点の軌跡を表した説明図である。図7に示す例では、画素値「1」の地点がエッジ点に該当する。   If it is determined that Ye + 8> S is not satisfied (No in S520), the CPU 70 corresponds to the inspection position (X, Y) = (Xe, Ye) determined by the main scanning direction inspection position Xe and the sub scanning direction inspection position Ye. By referring to the pixel value of the inspection target data, it is determined whether or not the inspection position (Xe, Ye) is an edge point (S525). FIG. 7 is an explanatory diagram showing the configuration of the edge image data, and further showing the locus of the edge point tracked by the right edge detection process. In the example illustrated in FIG. 7, a point with a pixel value “1” corresponds to an edge point.

そして、検査位置(Xe,Ye)がエッジ点ではないと判断すると(S525でNo)、CPU70は、S541に移行して、主走査方向検査位置Xeを、X軸マイナス方向に1画素移動した位置に更新し(Xe←Xe−1)、更新後の主走査方向検査位置Xeが読取可能領域R0の左端を、はみ出ていないかどうかを判断する。具体的には、Xe<0であるか否かを判断する(S543)。   If the CPU 70 determines that the inspection position (Xe, Ye) is not an edge point (No in S525), the CPU 70 proceeds to S541 and moves the main scanning direction inspection position Xe by one pixel in the X-axis minus direction. (Xe ← Xe−1), and it is determined whether or not the updated main scanning direction inspection position Xe protrudes from the left end of the readable area R0. Specifically, it is determined whether or not Xe <0 (S543).

そして、主走査方向検査位置Xeが、読取可能領域R0の左端をはみ出ていないと判断すると(S543でNo)、CPU70は、S520に移行する。
一方、S543において、主走査方向検査位置Xeが読取可能領域R0の左端をはみ出ていると判断すると(Xe<0であると判断すると)、CPU70は、S545に移行し、主走査方向検査位置Xeを、読取可能領域R0の右端(XMAX)に設定すると共に(Xe=XMAX)、副走査方向検査位置Yeを、現在値Yeに8加えた値に更新する(Ye←Ye+8)。即ち、副走査方向検査位置Yeを、Y軸方向に8画素進んだ位置に設定する。その後、S520に移行して、上述の処理を実行する。
If the CPU 70 determines that the main scanning direction inspection position Xe does not protrude from the left end of the readable area R0 (No in S543), the CPU 70 proceeds to S520.
On the other hand, in S543, when it is determined that the main scanning direction inspection position Xe protrudes from the left end of the readable region R0 (when it is determined that Xe <0), the CPU 70 proceeds to S545, and the main scanning direction inspection position Xe. Is set to the right end (XMAX) of the readable region R0 (Xe = XMAX), and the sub-scanning direction inspection position Ye is updated to a value obtained by adding 8 to the current value Ye (Ye ← Ye + 8). That is, the sub-scanning direction inspection position Ye is set to a position advanced by 8 pixels in the Y-axis direction. Thereafter, the process proceeds to S520 and the above-described processing is executed.

また、検査位置(Xe,Ye)がエッジ点であると判断すると(S525でYes)、CPU70は、S530に移行し、変数(X0,Y0)に、現在の検査位置(Xe,Ye)の座標値を、設定する(X0←Xe,Y0←Ye)。また、変数Y1を、座標Y=Y0からY軸方向に8画素進んだ座標値Y1(=Y0+8)に更新する(S533)。   If the CPU 70 determines that the inspection position (Xe, Ye) is an edge point (Yes in S525), the CPU 70 proceeds to S530, and the coordinates of the current inspection position (Xe, Ye) are set in the variable (X0, Y0). The value is set (X0 ← Xe, Y0 ← Ye). Further, the variable Y1 is updated to a coordinate value Y1 (= Y0 + 8) advanced by 8 pixels from the coordinate Y = Y0 in the Y-axis direction (S533).

その後、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点の少なくとも一つが、エッジ点であるか否かを判断し(S537)、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点のいずれもがエッジ点でない場合には(S537でNo)、S539に移行して、変数Cが値8以上であるか否かを判断する。そして、変数Cが値8未満であると判断すると(S539でNo)、S541に移行して、主走査方向検査位置Xeを、X軸マイナス方向に1画素移動した位置に更新する(Xe←Xe−1)。   Thereafter, it is determined whether at least one of the point of coordinates (X0-1, Y1), the point of coordinates (X0, Y1), and the point of coordinates (X0 + 1, Y1) is an edge point (S537). When none of the point of (X0-1, Y1), the point of coordinates (X0, Y1), and the point of coordinates (X0 + 1, Y1) is an edge point (No in S537), the process proceeds to S539 and the variable It is determined whether C is 8 or more. If it is determined that the variable C is less than 8 (No in S539), the process proceeds to S541, and the main scanning direction inspection position Xe is updated to a position moved by one pixel in the X axis minus direction (Xe ← Xe). -1).

一方、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点の少なくとも一つがエッジ点であると判断した場合には(S537でYes)、S550に移行して、座標(X0,Y0)の地点が連続性のあるエッジ点であると判定し、この座標(X0,Y0)を、連続性のあるエッジ点の座標データとして、一時記憶する。   On the other hand, when it is determined that at least one of the point of coordinates (X0-1, Y1), the point of coordinates (X0, Y1), and the point of coordinates (X0 + 1, Y1) is an edge point (Yes in S537), The process proceeds to S550, where it is determined that the point of coordinates (X0, Y0) is a continuous edge point, and this coordinate (X0, Y0) is temporarily stored as coordinate data of the continuous edge point. .

また、この処理を終えると、CPU70は、S560に移行し、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点の内、エッジ点である地点の一つを、予め定められた優先度に従って選択する。   When this processing is finished, the CPU 70 proceeds to S560, and at the point of the coordinates (X0-1, Y1), the coordinates (X0, Y1), and the coordinates (X0 + 1, Y1) at the edge point. One of the points is selected according to a predetermined priority.

具体的に、右エッジ検出処理においては、読取可能領域R0右端側に近い座標ほど高い優先度が設定されている。即ち、読取可能領域R0右端側に近い座標(X0+1,Y1)の地点が優先度「大」に設定され、座標(X0,Y1)の地点が優先度「中」に設定され、座標(X0−1,Y1)の地点が優先度「小」に設定されている。   Specifically, in the right edge detection process, higher priority is set for coordinates closer to the right end side of the readable area R0. That is, the point of the coordinate (X0 + 1, Y1) close to the right end side of the readable area R0 is set to the priority “high”, the point of the coordinate (X0, Y1) is set to the priority “medium”, and the coordinate (X0− 1, Y1) is set to the priority “small”.

このように優先度が設定されているのは、原稿の右端より右側においては、原稿台11aに何も存在せず、エッジ点は存在しないはずであり、読取可能領域R0右端側に近いエッジ点であるほど、そのエッジ点が原稿の右端に対応するエッジ点である可能性が高いためである。   The priority is set in this way because nothing exists on the platen 11a on the right side from the right end of the document, and there should be no edge point, and an edge point close to the right end side of the readable area R0. This is because there is a higher possibility that the edge point corresponds to the right edge of the document.

即ち、S560では、上記優先度に従って、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点、及び、座標(X0+1,Y1)の地点の内、エッジ点である地点であって優先度の最も高い地点を選択する。そして、変数X0を、選択した地点のX座標に更新し、変数Y0を、選択した地点のY座標に更新する。その後、変数Cを1加算した値に更新する(S563)。   That is, in S560, according to the above priority, the point of the coordinate (X0-1, Y1), the point of the coordinate (X0, Y1), and the point of the coordinate (X0 + 1, Y1) are points that are edge points. To select the point with the highest priority. Then, the variable X0 is updated to the X coordinate of the selected point, and the variable Y0 is updated to the Y coordinate of the selected point. Thereafter, the variable C is updated to a value obtained by adding 1 (S563).

また、この処理を終えると、CPU70は、更新後の変数Cが値8以上であるか否かを判断し(S567)、C≧8ではないと判断すると(S567でNo)、S580に移行して、座標Y=Y0からY軸方向に8画素進んだ地点(Y0+8)が検査範囲を超えているか否かを判断する。具体的には、Y0+8>Sであるか否かを判断する。   When this process is finished, the CPU 70 determines whether or not the updated variable C is 8 or more (S567). If it is determined that C ≧ 8 is not satisfied (No in S567), the CPU 70 proceeds to S580. Thus, it is determined whether or not the point (Y0 + 8) advanced by 8 pixels in the Y-axis direction from the coordinate Y = Y0 exceeds the inspection range. Specifically, it is determined whether or not Y0 + 8> S.

そして、Y0+8>Sではないと判断すると(S580でNo)、S533に移行して、変数Y1を、座標Y=Y0からY軸方向に8画素進んだ地点のY座標に更新する(Y1=Y0+8)。その後、S537以降の処理を実行する。   If it is determined that Y0 + 8> S is not satisfied (No in S580), the process proceeds to S533, and the variable Y1 is updated to the Y coordinate of a point advanced by 8 pixels from the coordinate Y = Y0 (Y1 = Y0 + 8). ). Thereafter, the processing after S537 is executed.

CPU70は、このような処理を繰返し実行することにより、図7に示すように、Y軸方向に8画素おきに、エッジ点がY軸方向に連続するものであるか否かを検査する。そして、変数Cが8以上となると、S567でYesと判断して、連続性のあるエッジ点として判定した座標データを、原稿右エッジデータとしてRAM80に記憶する(S570,S575)。   By repeatedly executing such processing, the CPU 70 checks whether the edge points are continuous in the Y-axis direction every 8 pixels in the Y-axis direction, as shown in FIG. When the variable C becomes 8 or more, it is determined Yes in S567, and the coordinate data determined as the continuous edge point is stored in the RAM 80 as the document right edge data (S570, S575).

具体的に、C=8である場合には、S569でYesと判断して、C=8となるまでにS550の処理で連続性のあるエッジ点として判定した計8地点の各座標データを、原稿右エッジデータとしてRAM80に記憶する(S570)。一方、C>8である場合には、S569でNoと判断して、S575に移行し、直前のS550の処理で連続性のあるエッジ点として判定した地点の座標データを、原稿右エッジデータとしてRAM80に記憶する。その後、S580に移行する。   Specifically, when C = 8, it is determined as Yes in S569, and the coordinate data of a total of 8 points determined as continuous edge points in the process of S550 until C = 8 is obtained. The original right edge data is stored in the RAM 80 (S570). On the other hand, if C> 8, it is determined No in S569, the process proceeds to S575, and the coordinate data of the point determined as the continuous edge point in the immediately preceding processing of S550 is used as the document right edge data. Store in RAM 80. Thereafter, the process proceeds to S580.

このようにして、CPU70は、検査位置(Xe,Ye)からY軸方向に8点以上連続するエッジ点については、その連続性が途切れるか(S537でNo)、Y軸方向末端まで画素値を参照するまで(S580でYes)、Y軸方向に画素値を参照して、連続するエッジ点を順次RAM80に記録する。   In this way, the CPU 70 determines that the continuity of the edge points that are continuous in the Y-axis direction from the inspection position (Xe, Ye) is 8 points or more is interrupted (No in S537) or the pixel value is obtained up to the end in the Y-axis direction. Until reference is made (Yes in S580), continuous edge points are sequentially recorded in the RAM 80 with reference to pixel values in the Y-axis direction.

そして、連続性が途切れることで、S537でNoと判断した場合には、S539に移行し、C≧8であると判断して(S539でYes)、S547で、副走査方向検査位置Yeを、変数Y0の値に設定する(Ye=Y0)。即ち、副走査方向検査位置Yeを、エッジ点の連続性が途切れた地点に対応するY座標値に設定する。   If the continuity is interrupted and it is determined No in S537, the process proceeds to S539, C ≧ 8 is determined (Yes in S539), and the sub-scanning direction inspection position Ye is determined in S547. The value of the variable Y0 is set (Ye = Y0). That is, the sub-scanning direction inspection position Ye is set to the Y coordinate value corresponding to the point where the continuity of the edge points is interrupted.

また、S547での処理を終えると、CPU70は、連続性が途切れた地点をマーキングするために、特定のコード(以下、「区分けコード)と称する。)を、原稿右エッジデータに追加する(S549)。具体的には、最後に記録した連続性が途切れる直前のエッジ点の座標データに続けるようにして、区分けコードを追加する。このような区分けコードを用いて、本実施例では、Y軸方向に連続するエッジ点の集合を、グループ化して、原稿右エッジデータに登録する。即ち、当該右エッジ検出処理においては、Y軸方向に連続するエッジ点の座標データを、Y座標値最小の座標データから、連続性が途切れる地点で区分けコードを挟んで、順に配列することで、連続するエッジ点の集合を区分けコードで区分けして、原稿右エッジデータを構築する。   When the processing in S547 is completed, the CPU 70 adds a specific code (hereinafter referred to as “classification code”) to the original right edge data in order to mark the point where the continuity is interrupted (S549). Specifically, a classification code is added so as to continue to the coordinate data of the edge point immediately before the last recorded continuity is interrupted. A set of edge points continuous in the direction is grouped and registered in the original right edge data, that is, in the right edge detection process, the coordinate data of the edge points continuous in the Y-axis direction is set to the minimum Y coordinate value. From the coordinate data, a set of consecutive edge points is divided by the division code by placing the division code at points where continuity is interrupted and arranging them in order. To build.

また、S549での処理を終えると、CPU70は、S515に移行し、主走査方向検査位置Xeを、読取可能領域R0の右端(XMAX)に設定することで、検査位置(Xe,Ye)を、連続性が途切れた地点に対応する画像データの右端に、再設定する。また、同時に、変数Cを、C=0に初期化する。その後、S520以降の処理を実行する。   When the process in S549 is completed, the CPU 70 proceeds to S515, and sets the inspection position (Xe, Ye) by setting the main scanning direction inspection position Xe to the right end (XMAX) of the readable area R0. Reset to the right end of the image data corresponding to the point where the continuity is interrupted. At the same time, the variable C is initialized to C = 0. Thereafter, the processing after S520 is executed.

一方、連続性が途切れずに、Y0+8>Sとなると(S580でYes)、CPU70は、S590に移行し、S570,S575で原稿右エッジデータとして記録した座標データ群の中から、右エッジ(原稿の右端を表すエッジ点)として確度の低い座標データを削除して、原稿右エッジデータを確定する。尚、Ye+8>Sとなった場合にも(S520でYes)、S590に移行して、同様に原稿右エッジデータを確定する。   On the other hand, if continuity is not interrupted and Y0 + 8> S is satisfied (Yes in S580), the CPU 70 proceeds to S590, and the right edge (original document) is selected from the coordinate data group recorded as the original right edge data in S570 and S575. The coordinate data with low accuracy is deleted as the edge point representing the right edge of the document, and the document right edge data is determined. Even when Ye + 8> S is satisfied (Yes in S520), the process proceeds to S590, and the document right edge data is similarly determined.

具体的に、S590では、原稿右エッジデータを処理対象データに設定して、図8に示す第一エッジ確定処理を実行することで、右エッジとして確度の低い座標データ群を原稿右エッジデータから削除し、原稿右エッジデータを確定する。図8は、CPU70が実行する第一エッジ確定処理を表すフローチャートである。   Specifically, in S590, the original right edge data is set as processing target data, and the first edge determination process shown in FIG. 8 is executed, whereby a coordinate data group with low accuracy is selected as the right edge from the original right edge data. Delete and confirm the document right edge data. FIG. 8 is a flowchart showing the first edge determination process executed by the CPU 70.

第一エッジ確定処理を開始すると、CPU70は、予め設定された処理対象データが、少なくとも8つ以上のエッジ点の座標データを含むものであるか否かを判断し(S610)、処理対象データが8つ以上のエッジ点の座標データを含むものであると判断すると(S610でYes)、S620に移行し、処理対象データが8つ以上のエッジ点の座標データを含むものではない(換言すれば処理対象データが空データである)と判断すると(S610でNo)、S620〜S690の処理を実行することなく、当該第一エッジ確定処理を終了する。   When the first edge determination process is started, the CPU 70 determines whether or not the preset processing target data includes coordinate data of at least eight edge points (S610), and the eight processing target data are included. If it is determined that the coordinate data of the edge point is included (Yes in S610), the process proceeds to S620, and the processing target data does not include the coordinate data of eight or more edge points (in other words, the processing target data is not included). If it is determined that the data is empty data (No in S610), the first edge determination process is terminated without executing the processes of S620 to S690.

一方、S620に移行すると、CPU70は、処理対象データを構成するエッジ点の座標データに基づき、処理対象データに登録されたエッジ点であって、Y座標値が最大のエッジ点を、検査開始点に設定する。   On the other hand, when the process proceeds to S620, the CPU 70 determines an edge point registered in the processing target data and having the maximum Y coordinate value based on the coordinate data of the edge points constituting the processing target data as the inspection start point. Set to.

また、S620での処理を終えると、CPU70は、S630に移行し、検査開始点からY軸マイナス方向に、処理対象データに登録されたエッジ点を辿り、連続するエッジ点の当該連続性が途切れる地点を探索する。上述したように、処理対象データに設定される原稿右エッジデータ及び原稿左エッジデータにおいては、エッジ点の座標データが、Y座標値最小のエッジ点の座標データから、途中区分けコードを挟んで、順に配列される。従って、S630では、処理対象データを、検査開始点に対応するエッジ点の座標データから、Y軸マイナス方向に遡るようにして参照して、最初に現れる区分けコードを検出する。   When the process in S620 is completed, the CPU 70 proceeds to S630 and follows the edge point registered in the processing target data in the Y-axis minus direction from the inspection start point, and the continuity of successive edge points is interrupted. Search for a point. As described above, in the document right edge data and the document left edge data set as the processing target data, the coordinate data of the edge point is sandwiched from the coordinate data of the edge point having the smallest Y coordinate value, with the intermediate division code interposed therebetween. Arranged in order. Accordingly, in S630, the processing target data is referred to from the coordinate data of the edge point corresponding to the inspection start point so as to go back in the negative direction of the Y axis, and the classification code that appears first is detected.

そして、区分けコードを検出できた場合には、連続性が途切れる地点があると判断して(S640でYes)、S650に移行する。
一方、区分けコードを検出できなかった場合には、連続性が途切れる地点がないと判断して(S640でNo)、S650〜S690の処理を実行することなく、当該第一エッジ確定処理を終了する。このようにして、S640でNoと判断した場合には、処理対象データに登録されているエッジ点の全てが、原稿の端縁を表すエッジ点として確度の高いエッジ点であると取扱って、処理対象データに登録されたエッジ点を削除することなく、原稿エッジを確定し、第一エッジ確定処理を終了する。
If the division code can be detected, it is determined that there is a point where continuity is interrupted (Yes in S640), and the process proceeds to S650.
On the other hand, when the classification code cannot be detected, it is determined that there is no point where continuity is interrupted (No in S640), and the first edge determination process is terminated without executing the processes of S650 to S690. . In this manner, when it is determined No in S640, all the edge points registered in the processing target data are handled as edge points with high accuracy as edge points representing the edge of the document, and processing is performed. The document edge is determined without deleting the edge point registered in the target data, and the first edge determination process is terminated.

これに対し、S650に移行すると、CPU70は、連続性が途切れる地点直前のエッジ点(換言すると、連続性が途切れる地点よりY軸プラス方向に位置するエッジ点であってY座標値最小のエッジ点)に対し、Y軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれているか否かを判断する。   In contrast, when the process proceeds to S650, the CPU 70 determines that the edge point immediately before the point where continuity is interrupted (in other words, the edge point located in the Y-axis plus direction from the point where continuity is interrupted and having the minimum Y coordinate value). ) On the Y axis minus direction side, it is determined whether or not the coordinate data of the edge point adjacent to the processing target data is included.

ここでは、連続性が途切れる地点直前のエッジ点の画素位置(X,Y)=(X0,Y0)に対して、Y座標値がY=Y0−8を採るエッジ点の当該座標データが、処理対象データに含まれている場合には、Y軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていると判断し、Y座標値がY=Y0−8を採るエッジ点の当該座標データが、処理対象データに含まれていない場合には、Y軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていないと判断する。これにより、Y軸のみの一次元空間上で、連続性が途切れる地点を挟んで、隣接するエッジ点の有無を判断する。   Here, for the pixel position (X, Y) = (X0, Y0) of the edge point immediately before the point where the continuity is interrupted, the coordinate data of the edge point where the Y coordinate value takes Y = Y0-8 is processed. If it is included in the target data, it is determined that the coordinate data of the edge point adjacent on the Y axis minus direction side is included in the processing target data, and the Y coordinate value is Y = Y0-8. If the coordinate data of the point is not included in the processing target data, it is determined that the coordinate data of the edge point adjacent on the Y axis minus direction side is not included in the processing target data. Thereby, the presence or absence of an adjacent edge point is determined across a point where continuity is interrupted in a one-dimensional space only on the Y axis.

そして、連続性が途切れる地点直前のエッジ点に対し、Y軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていると判断すると(S650でYes)、CPU70は、S660に移行する。一方、Y軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていないと判断すると(S650でNo)、S690に移行する。   If it is determined that the coordinate data of the edge point adjacent to the edge point immediately before the point where the continuity is interrupted on the Y-axis minus direction side is included in the processing target data (Yes in S650), the CPU 70 proceeds to S660. Migrate to On the other hand, if it is determined that the coordinate data of the edge point adjacent on the Y-axis minus direction side is not included in the processing target data (No in S650), the process proceeds to S690.

また、S660に移行すると、CPU70は、連続性が途切れる地点を挟んで、隣接するエッジ点のX軸方向の乖離度を算出する。具体的には、連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)であり、このエッジ点に隣接するエッジ点の画素位置が(X,Y)=(X1,Y0−8)であるとすると、上記乖離度として、これら2つのエッジ点のX座標値の差δX=|X0−X1|を算出する。   In S660, the CPU 70 calculates the degree of divergence in the X-axis direction between adjacent edge points across points where continuity is interrupted. Specifically, the pixel position of the edge point immediately before the point where continuity is interrupted is (X, Y) = (X0, Y0), and the pixel position of the edge point adjacent to this edge point is (X, Y) = Assuming that (X1, Y0-8), the difference δX = | X0−X1 | between these two edge points is calculated as the divergence.

また、この処理を終えると、CPU70は、差δXが、予め設計段階で定められた閾値未満であるか否かを判断し(S670)、閾値未満であると判断すると(S670でYes)、検査開始点を、上記連続性が途切れる地点直前のエッジ点に隣接するエッジ点(X1,Y0−8)に更新する(S680)。その後、S630に移行する。   When this process is finished, the CPU 70 determines whether or not the difference δX is less than a threshold value determined in advance in the design stage (S670), and determines that the difference δX is less than the threshold value (Yes in S670). The start point is updated to the edge point (X1, Y0-8) adjacent to the edge point immediately before the point where the continuity is interrupted (S680). Thereafter, the process proceeds to S630.

一方、差δXが、閾値以上であると判断すると(S670でNo)、CPU70は、上記連続性が途切れる地点よりY軸マイナス方向に位置するエッジ点については、原稿エッジ(原稿の端縁を表すエッジ点)としての確度が低いと判断して、S690に移行し、上記連続性が途切れる地点よりY軸マイナス方向に位置するエッジ点の座標データを、全て処理対象データから削除して、処理対象データを更新する。   On the other hand, if it is determined that the difference δX is equal to or greater than the threshold (No in S670), the CPU 70 represents the document edge (represents the edge of the document) for the edge point located in the negative Y-axis direction from the point where the continuity is interrupted. It is determined that the accuracy as the edge point) is low, the process proceeds to S690, and all the coordinate data of the edge point located in the Y-axis minus direction from the point where the continuity is interrupted are deleted from the processing target data, and the processing target Update the data.

例えば、直前のS630で検出した連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)である場合には、Y座標値がY0未満のエッジ点の座標データを全て処理対象データから削除して、処理対象データを更新する。その後、当該第一エッジ確定処理を終了する。第一エッジ確定処理では、このようにして、処理対象データを構成するエッジ点の座標データの内、原稿エッジとして確度の低い座標データを削除する。   For example, when the pixel position of the edge point immediately before the point where the continuity detected in the previous S630 is interrupted is (X, Y) = (X0, Y0), the coordinate data of the edge point whose Y coordinate value is less than Y0 Are all deleted from the processing target data, and the processing target data is updated. Thereafter, the first edge determination process ends. In the first edge determination process, the coordinate data having low accuracy as the document edge is deleted from the coordinate data of the edge points constituting the processing target data in this way.

即ち、右エッジ検出処理のS590では、このようにして、原稿右エッジデータから右エッジとして確度の低いエッジ点の座標データを削除し、原稿右エッジデータを確定する。尚、図9は、S590における原稿右エッジデータの確定手法を示した説明図であり、δXの算出手法を視覚的に表した説明図である。   That is, in S590 of the right edge detection process, the coordinate data of the edge point with low accuracy is deleted as the right edge from the document right edge data in this way, and the document right edge data is determined. FIG. 9 is an explanatory diagram showing a method for determining document right edge data in S590, and is a diagram visually showing a method for calculating δX.

S590で、上述のようにして、Y座標値が大きいエッジ点程、エッジ点が原稿の右端を表すエッジ点(右エッジ)である確度が高いと取り扱い、Y座標値が大きいエッジ点群からX軸方向に大きくずれた位置に存在するY座標値が小さいエッジ点群を、原稿右エッジデータから削除する理由は、右エッジ検出処理にて、Ye=0から順に検査位置(Xe,Ye)をずらして原稿の右端を表すエッジ点を検索すると、原稿が左側に傾いている場合には、原稿の右端ではなく、図9に示すように、原稿内部に描写された罫線等に対応するエッジ点を、原稿の右端を表すエッジ点として誤検出してしまう可能性があるためである。   In S590, as described above, an edge point having a larger Y coordinate value is treated as having a higher probability that the edge point is an edge point (right edge) representing the right edge of the document. The reason why the edge point group having a small Y coordinate value existing at a position greatly displaced in the axial direction is deleted from the original right edge data is that the inspection positions (Xe, Ye) are sequentially detected from Ye = 0 in the right edge detection process. When the edge point representing the right edge of the document is shifted and searched, if the document is tilted to the left, the edge point corresponding to the ruled line drawn inside the document as shown in FIG. 9 instead of the right edge of the document. Is erroneously detected as an edge point representing the right edge of the document.

このような誤検出は、原稿台11aの下端寄りに位置するY座標値が小さいエッジ点群において発生している可能性が高く、原稿台11aの中央寄りに位置するY座標値が大きいエッジ点群において発生している可能性は、小さい。このような理由から、S590では、Y座標値が大きいエッジ点程、エッジ点が原稿の右端を表すエッジ点(右エッジ)である確度が高いと取り扱って、Y座標値が大きいエッジ点を基準に、これから大きく乖離したエッジ点を確度の低いエッジ点とみなして原稿右エッジデータから削除し、原稿右エッジデータを確定するようにしている。   Such an erroneous detection is likely to occur at an edge point group with a small Y coordinate value located near the lower end of the document table 11a, and an edge point with a large Y coordinate value located near the center of the document table 11a. It is unlikely that it is occurring in a group. For this reason, in S590, an edge point having a larger Y coordinate value is treated as having a higher probability that the edge point is an edge point (right edge) representing the right edge of the document, and an edge point having a larger Y coordinate value is used as a reference. In addition, an edge point greatly deviating from this is regarded as an edge point with low accuracy, and is deleted from the document right edge data to determine the document right edge data.

また、このようにしてS590での処理を終えると、CPU70は、S420での右エッジ検出処理を終了して、S430に移行し、S430では、直前の右エッジ検出処理で右エッジの検出に失敗したか否かを判断する。具体的には、直前の右エッジ検出処理で原稿右エッジデータとして登録された座標データがない場合、右エッジの検出に失敗したと判断し、原稿右エッジデータとして登録された座標データがある場合には、右エッジの検出に成功したと判断する。   In addition, when the processing in S590 is completed in this way, the CPU 70 ends the right edge detection processing in S420 and proceeds to S430, and in S430, the detection of the right edge fails in the immediately preceding right edge detection processing. Determine whether or not. Specifically, when there is no coordinate data registered as document right edge data in the immediately preceding right edge detection process, it is determined that detection of the right edge has failed, and there is coordinate data registered as document right edge data It is determined that the right edge has been successfully detected.

但し、例外的に、原稿右エッジデータとして登録された座標データが読取可能領域R0の左端(Y=0)近傍にある場合には、左エッジ(原稿の左端を表すエッジ点)の座標データが間違って原稿右エッジデータとして登録されているとみなして、原稿右エッジデータとして登録された座標データがある場合でも、右エッジの検出に失敗したと判断してもよい。   However, exceptionally, when the coordinate data registered as the document right edge data is in the vicinity of the left end (Y = 0) of the readable region R0, the coordinate data of the left edge (the edge point representing the left end of the document) is It may be determined that the detection of the right edge has failed even when there is coordinate data registered as the right edge data of the document, assuming that it is erroneously registered as the right edge data of the document.

尚、右エッジの検出に失敗するケースとしては、原稿サイズが原稿台11aのサイズより大きく、原稿の右端が原稿台11aからはみ出しているケースなどを挙げることができる。   Examples of cases where the detection of the right edge fails include a case where the document size is larger than the size of the document table 11a and the right edge of the document protrudes from the document table 11a.

そして、右エッジの検出に失敗したと判断すると(S430でYes)、CPU70は、S431に移行し、エラー処理を実行する。例えば、複合機1は、S431におけるエラー処理として、『原稿を正しく載置するか、自動変倍複写機能は使用できないので他のコピー指令を入力するように促すメッセージを表示操作部50のディスプレイに表示した後、S431を実行するに至ったコピー指令に対応する当該複写制御処理を強制終了して、当該コピー指令を無効にする』処理を実行する構成にすることができる。   If it is determined that the detection of the right edge has failed (Yes in S430), the CPU 70 proceeds to S431 and executes error processing. For example, the multi-function device 1 displays, as an error process in S431, a message prompting the user to input another copy command because the document is placed correctly or the automatic scaling copying function cannot be used. After the display, the process can be configured to execute the process of forcibly terminating the copy control process corresponding to the copy command that led to the execution of S431 and invalidating the copy command.

この他、複合機1は、S431におけるエラー処理として、『原稿台11aに載置された原稿のサイズを、予め定められた固定サイズであると形式的に推定すると共に、原稿の傾き角θをゼロと推定し、更に、原稿の載置領域を、上記推定したサイズの原稿の左下角が原稿台11aの左下角に正しく突き当てられていると仮定したときに原稿が載置される領域に推定する』処理を実行し、その後、当該原稿推定処理を終了して、S230に移行する構成にされてもよい。   In addition, the multi function device 1 performs the error processing in S431 as follows: “The size of the document placed on the document table 11a is formally estimated to be a predetermined fixed size, and the inclination angle θ of the document is determined. Further, it is estimated that the original is placed on the area where the original is placed when it is assumed that the lower left corner of the estimated size of the original is correctly abutted against the lower left corner of the original table 11a. The “estimating” process may be executed, and then the document estimation process may be terminated and the process may proceed to S230.

一方、S430において右エッジの検出に成功したと判断すると(S430でNo)、CPU70は、S433に移行し、右エッジ検出処理で確定された原稿右エッジデータが示す各点を直線近似して、原稿右エッジデータが示す点群の近似直線(以下、「右エッジ近似直線」と表現する。)を算出する。   On the other hand, if it is determined in S430 that the right edge has been successfully detected (No in S430), the CPU 70 proceeds to S433 and linearly approximates each point indicated by the document right edge data determined in the right edge detection process. An approximate straight line of the point group indicated by the original right edge data (hereinafter referred to as “right edge approximate straight line”) is calculated.

また、この処理を終えると、CPU70は、S440に移行して、右エッジ近似直線がY軸に対し所定角度より大きく傾いているか否かを判断する。本実施例では、具体的に、右エッジ近似直線がY軸に対し0.5度より大きく傾いているか否かを判断する。   When this process is finished, the CPU 70 proceeds to S440 and determines whether or not the right edge approximate straight line is inclined more than a predetermined angle with respect to the Y axis. In this embodiment, specifically, it is determined whether or not the right edge approximate straight line is inclined more than 0.5 degrees with respect to the Y axis.

そして、右エッジ近似直線の傾きが上記所定角度以下であると判断すると(S440でNo)、CPU70は、原稿がフレーム13aの内側左下角に突き当てられて原稿台11aに正しく載置されていると推定して、図5右図に示すように、右エッジ近似直線と原稿台11a下端縁との交点を、原稿の右下角位置であると推定する(S441)。   If it is determined that the slope of the right edge approximate straight line is equal to or smaller than the predetermined angle (No in S440), the CPU 70 is placed on the document table 11a by being abutted against the inner left lower corner of the frame 13a. As shown in the right diagram of FIG. 5, the intersection of the right edge approximate straight line and the lower edge of the document table 11a is estimated as the lower right corner position of the document (S441).

また、この処理を終えると、CPU70は、原稿の左下角位置が原稿台11aの左下角の地点であると推定し(S443)、S441及びS443で推定した角位置の位置座標に基づき、原稿台11aに載置されている原稿が四角形状の定型用紙であるとの仮定の下で、原稿台11aに載置された原稿のサイズ及び原稿台11aにおける原稿の載置領域を推定すると共に、原稿の傾き角θを推定する(S445)。   When this processing is completed, the CPU 70 estimates that the lower left corner position of the document is the lower left corner point of the document table 11a (S443), and based on the position coordinates of the angular position estimated in S441 and S443, the document table. Under the assumption that the document placed on the document 11a is a square-shaped standard paper, the size of the document placed on the document table 11a and the placement area of the document on the document table 11a are estimated, and the document Is estimated (S445).

具体的には、S441及びS443で推定した原稿の左下角位置から右下角位置までの長さを、原稿の短辺長さ(横幅)と推定し、この短辺長さの√2倍を、原稿の長辺長さ(縦幅)と推定して、原稿サイズを推定すると共に、上記推定した左下角位置及び右下角位置を起点に上記原稿サイズの原稿が原稿台11aに載置されているものとして、原稿の左上角及び右上角が位置する座標を導出し、これら4つの角を結んでできる四角形内の領域を、原稿の載置領域であると推定する。尚、ここで原稿短辺長さの√2倍を、原稿の長辺長さとして推定しているのは、定型用紙の短辺長さ:長辺長さの比が1:√2となっているためである。   Specifically, the length from the lower left corner position to the lower right corner position of the document estimated in S441 and S443 is estimated as the short side length (horizontal width) of the document, and √2 times the short side length is The document size is estimated by estimating the long side length (vertical width) of the document, and the document of the document size is placed on the document table 11a starting from the estimated lower left corner position and lower right corner position. As an example, the coordinates at which the upper left corner and the upper right corner of the document are located are derived, and an area within a quadrilateral formed by connecting these four corners is estimated as the document placement area. Here, the reason why √2 times the original short side length is estimated as the long side length of the original is that the ratio of the short side length to the long side length of the standard paper is 1: √2. This is because.

また、S441,S443では、原稿が原稿台11aの左下角に正確に突き当てられて原稿台11aに載置されていると仮定して角位置を求めているので、S445では、原稿の傾き角θがゼロである(傾きがない)と推定する。   Further, in S441 and S443, the angular position is obtained on the assumption that the document is accurately abutted against the lower left corner of the document table 11a and placed on the document table 11a. Therefore, in S445, the inclination angle of the document is determined. It is estimated that θ is zero (no slope).

このようにして、S445での処理を終えると、CPU70は、当該原稿推定処理(S220)を終えて、S230に移行し、上述したようにして、後続の処理を実行する。即ち、原稿推定処理で推定した原稿サイズ、原稿の傾き角、原稿の載置領域の情報を基に、変倍率及び傾き補正量を設定し(S251,S253)、更に読取領域を設定する(S255)。その後、本スキャンに移行して(S270)、コピー動作を実現する。但し、ここでは、原稿の傾き角θがゼロと推定されるので、傾き補正は実質実行されない。   When the process in S445 is completed in this way, the CPU 70 ends the document estimation process (S220), proceeds to S230, and executes the subsequent process as described above. That is, based on the document size estimated by the document estimation process, the document tilt angle, and the document placement area information, the scaling factor and the tilt correction amount are set (S251, S253), and the reading area is further set (S255). ). Thereafter, the process shifts to the main scan (S270), and the copy operation is realized. However, since the inclination angle θ of the document is estimated to be zero here, the inclination correction is not actually executed.

話を原稿推定処理のS440(図5参照)に戻すと、CPU70は、ここで、右エッジ近似直線がY軸に対し所定角度より大きく傾いていると判断した場合(S440でYes)、S450に移行して、図10に示す左エッジ検出処理を実行する。図10は、CPU70が実行する左エッジ検出処理を表すフローチャートである。   When the story is returned to S440 (see FIG. 5) of the document estimation process, the CPU 70 determines that the right edge approximate straight line is inclined more than a predetermined angle with respect to the Y axis (Yes in S440), the process proceeds to S450. Then, the left edge detection process shown in FIG. 10 is executed. FIG. 10 is a flowchart showing the left edge detection process executed by the CPU 70.

左エッジ検出処理を開始すると、CPU70は、S710にて、副走査方向検査位置Ye=0に設定し、S715にて、主走査方向検査位置Xeを、読取可能領域R0の左端X座標に設定する(Xe=0)。また、S715では、変数Cを値ゼロに初期化する(C=0)。   When the left edge detection process is started, the CPU 70 sets the sub-scanning direction inspection position Ye = 0 in S710, and sets the main scanning direction inspection position Xe to the left end X coordinate of the readable area R0 in S715. (Xe = 0). In S715, the variable C is initialized to zero (C = 0).

その後、副走査方向検査位置YeからY軸方向に8画素進んだ地点(Ye+8)が検査範囲を超えているか否かを判断し(S720)、検査範囲を超えていないと判断すると(S720でNo)、検査位置(X,Y)=(Xe,Ye)に対応する検査対象データの画素値を参照して、検査位置(Xe,Ye)がエッジ点であるか否かを判断する(S725)。   Thereafter, it is determined whether or not the point (Ye + 8) advanced by 8 pixels in the Y-axis direction from the sub-scanning direction inspection position Ye exceeds the inspection range (S720), and if it is determined that it does not exceed the inspection range (No in S720) ) With reference to the pixel value of the inspection object data corresponding to the inspection position (X, Y) = (Xe, Ye), it is determined whether or not the inspection position (Xe, Ye) is an edge point (S725). .

そして、検査位置(Xe,Ye)がエッジ点ではないと判断すると(S725でNo)、S741に移行し、主走査方向検査位置Xeを、X軸プラス方向に1画素移動した地点に更新し(Xe←Xe+1)、更新した主走査方向検査位置Xeが、読取可能領域R0の右端を、はみ出ていないかどうかを判断する(S743)。具体的には、Xe>XMAXであるか否かを判断する(S743)。そして、主走査方向検査位置Xeが、読取可能領域R0の右端をはみ出ていないと判断すると(S743でNo)、S720に移行する。   If it is determined that the inspection position (Xe, Ye) is not an edge point (No in S725), the process proceeds to S741, and the main scanning direction inspection position Xe is updated to a point moved by one pixel in the X axis plus direction ( Xe ← Xe + 1), it is determined whether or not the updated main scanning direction inspection position Xe protrudes from the right end of the readable area R0 (S743). Specifically, it is determined whether Xe> XMAX (S743). If it is determined that the main scanning direction inspection position Xe does not protrude from the right end of the readable area R0 (No in S743), the process proceeds to S720.

一方、S743で主走査方向検査位置Xeが読取可能領域R0の右端をはみ出ていると判断すると(Xe>XMAXであると判断すると)、CPU70は、S745に移行し、主走査方向検査位置Xeを、読取可能領域R0の左端に設定すると共に(Xe=0)、副走査方向検査位置Yeを、Y軸方向に8画素進んだ位置に設定する(Ye←Ye+8)。その後、S720に移行する。   On the other hand, if it is determined in S743 that the main scanning direction inspection position Xe protrudes from the right end of the readable region R0 (when it is determined that Xe> XMAX), the CPU 70 proceeds to S745 and sets the main scanning direction inspection position Xe. The sub scanning direction inspection position Ye is set to a position advanced by 8 pixels in the Y-axis direction (Y ← Ye + 8) while being set to the left end of the readable region R0 (Xe = 0). Thereafter, the process proceeds to S720.

また、検査位置(Xe,Ye)がエッジ点であると判断すると(S725でYes)、CPU70は、S730に移行して、変数(X0,Y0)に、現在の検査位置(Xe,Ye)の座標値を設定する(X0←Xe,Y0←Ye)と共に、変数Y1を、値Y1=Y0+8に更新する(S733)。   If the CPU 70 determines that the inspection position (Xe, Ye) is an edge point (Yes in S725), the CPU 70 proceeds to S730 and sets the variable (X0, Y0) to the current inspection position (Xe, Ye). The coordinate value is set (X0 ← Xe, Y0 ← Ye), and the variable Y1 is updated to the value Y1 = Y0 + 8 (S733).

その後、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点の少なくとも一つが、エッジ点であるか否かを判断し(S737)、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点のいずれもがエッジ点でない場合には(S737でNo)、S739に移行して、変数Cが値8以上であるか否かを判断し、変数Cが値8未満であると判断すると(S739でNo)、S741に移行する。   Thereafter, it is determined whether at least one of the point of coordinates (X0-1, Y1), the point of coordinates (X0, Y1), and the point of coordinates (X0 + 1, Y1) is an edge point (S737). If none of the point of (X0-1, Y1), the point of coordinates (X0, Y1), and the point of coordinates (X0 + 1, Y1) is an edge point (No in S737), the process proceeds to S739, and the variable It is determined whether or not C is 8 or more, and if it is determined that the variable C is less than 8 (No in S739), the process proceeds to S741.

一方、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点の少なくとも一つがエッジ点であると判断した場合には(S737でYes)、S750に移行して、座標(X0,Y0)の地点が連続性のあるエッジ点であると判定し、この座標(X0,Y0)を、連続性のあるエッジ点の座標データとして、一時記憶する。   On the other hand, when it is determined that at least one of the point of coordinates (X0-1, Y1), the point of coordinates (X0, Y1), and the point of coordinates (X0 + 1, Y1) is an edge point (Yes in S737), Moving to S750, it is determined that the point of coordinates (X0, Y0) is a continuous edge point, and the coordinates (X0, Y0) are temporarily stored as coordinate data of the continuous edge point. .

また、この処理を終えると、CPU70は、S760に移行し、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点及び座標(X0+1,Y1)の地点の内、エッジ点である地点の一つを、予め定められた優先度に従って選択する。   When this process is finished, the CPU 70 proceeds to S760, where the coordinates (X0-1, Y1), the coordinates (X0, Y1), and the coordinates (X0 + 1, Y1) are the edge points. One of the points is selected according to a predetermined priority.

具体的に、左エッジ検出処理においては、読取可能領域R0左端側に近い座標ほど高い優先度が設定されている。即ち、読取可能領域R0左端側に近い座標(X0−1,Y1)の地点が優先度「大」に設定され、座標(X0,Y1)の地点が優先度「中」に設定され、座標(X0+1,Y1)の地点が優先度「小」に設定されている。このように優先度が設定されているのは、原稿の左端より左側においては、原稿台11aに何も存在せず、エッジ点は存在しないはずであり、読取可能領域R0左端側に近いエッジ点であるほど、そのエッジ点が原稿の左端に対応するエッジ点である可能性が高いためである。   Specifically, in the left edge detection process, higher priority is set for coordinates closer to the left end side of the readable area R0. That is, the point of the coordinates (X0-1, Y1) close to the left end side of the readable area R0 is set to the priority “large”, the point of the coordinates (X0, Y1) is set to the priority “medium”, and the coordinates ( The point of X0 + 1, Y1) is set to the priority “small”. The priority is set in this way because there is nothing on the document table 11a on the left side of the left edge of the document, and there should be no edge point, and the edge point close to the left edge side of the readable area R0. This is because there is a high possibility that the edge point is an edge point corresponding to the left end of the document.

従って、S760では、この優先度に従って、座標(X0−1,Y1)の地点、座標(X0,Y1)の地点、及び、座標(X0+1,Y1)の地点の内、エッジ点である地点であって優先度の最も高い地点を選択する。そして、変数X0を、選択した地点のX座標に更新し、変数Y0を、選択した地点のY座標に更新する。その後、変数Cを1加算した値に更新する(S763)。   Therefore, in S760, according to the priority, the point of the coordinate (X0-1, Y1), the point of the coordinate (X0, Y1), and the point of the coordinate (X0 + 1, Y1) are points that are edge points. To select the point with the highest priority. Then, the variable X0 is updated to the X coordinate of the selected point, and the variable Y0 is updated to the Y coordinate of the selected point. Thereafter, the variable C is updated to a value obtained by adding 1 (S763).

また、この処理を終えると、CPU70は、更新後の変数Cが値8以上であるか否かを判断し(S767)、C≧8でないと判断すると(S767でNo)、S780に移行して、座標Y=Y0からY軸方向に8画素進んだ地点(Y0+8)が検査範囲を超えているか否かを判断する。具体的には、Y0+8>Sであるか否かを判断する。   When this process is finished, the CPU 70 determines whether or not the updated variable C is 8 or more (S767). If it is determined that C ≧ 8 is not satisfied (No in S767), the CPU 70 proceeds to S780. Then, it is determined whether or not a point (Y0 + 8) advanced by 8 pixels in the Y-axis direction from the coordinate Y = Y0 exceeds the inspection range. Specifically, it is determined whether or not Y0 + 8> S.

そして、Y0+8>Sではないと判断すると(S780でNo)、S733に移行して、変数Y1を、Y1=Y0+8に更新する。その後、S737以降の処理を実行する。
このような処理手順により、CPU70は、右エッジ検出処理と同様(図7参照)、Y軸方向に8画素おきに、エッジ点がY軸方向に連続するものであるか否かを検査する。そして、変数Cが8以上となると、S767でYesと判断して、連続性のあるエッジ点として判定した座標データを、原稿左エッジデータとしてRAM80に記憶する(S770,S775)。
If it is determined that Y0 + 8> S is not satisfied (No in S780), the process proceeds to S733, and the variable Y1 is updated to Y1 = Y0 + 8. Thereafter, the processing after S737 is executed.
By such a processing procedure, the CPU 70 checks whether the edge points are continuous in the Y-axis direction every 8 pixels in the Y-axis direction, as in the right edge detection process (see FIG. 7). When the variable C is 8 or more, it is determined Yes in S767, and the coordinate data determined as a continuous edge point is stored in the RAM 80 as document left edge data (S770, S775).

具体的に、C=8である場合には、S769でYesと判断して、C=8となるまでにS750の処理で連続性のあるエッジ点として判定した計8地点の各座標データを、原稿左エッジデータとしてRAM80に記憶する(S770)。一方、C>8である場合には、S769でNoと判断して、S775に移行し、直前のS750の処理で連続性のあるエッジ点として判定した地点の座標データを、原稿左エッジデータとしてRAM80に記憶する。その後、S780に移行する。   Specifically, when C = 8, it is determined as Yes in S769, and the coordinate data of a total of eight points determined as continuous edge points in the process of S750 until C = 8 is obtained. The original left edge data is stored in the RAM 80 (S770). On the other hand, if C> 8, it is determined No in S769, the process proceeds to S775, and the coordinate data of the point determined as the continuous edge point in the immediately preceding processing of S750 is used as the document left edge data. Store in RAM 80. Thereafter, the process proceeds to S780.

このようにして、CPU70は、検査位置(Xe,Ye)からY軸方向に8点以上連続するエッジ点については、その連続性が途切れるか(S737でNo)、Y軸方向末端まで画素値を参照するまで(S780でYes)、Y軸方向に画素値を参照して、連続するエッジ点を順次RAM80に記録する。   In this way, the CPU 70 determines that the continuity of the edge points that are continuous in the Y-axis direction from the inspection position (Xe, Ye) is 8 points or more is interrupted (No in S737), or the pixel value is obtained up to the end in the Y-axis direction. Until reference is made (Yes in S780), continuous edge points are sequentially recorded in the RAM 80 with reference to pixel values in the Y-axis direction.

そして、連続性が途切れることで、S737でNoと判断した場合には、S739に移行し、C≧8であると判断して(S739でYes)、S747で、副走査方向検査位置Yeを、変数Y0の値に設定する(Ye=Y0)。   If the continuity is interrupted and it is determined No in S737, the process proceeds to S739, C ≧ 8 is determined (Yes in S739), and the sub-scanning direction inspection position Ye is determined in S747. The value of the variable Y0 is set (Ye = Y0).

また、S747での処理を終えると、CPU70は、連続性が途切れた地点をマーキングするために、S549での処理と同様にして、区分けコードを、原稿左エッジデータに追加する(S749)。このような動作により、当該左エッジ検出処理においては、Y軸方向に連続するエッジ点の座標データを、Y座標値最小の座標データから、連続性が途切れる地点で区分けコードを挟んで、順に配列し、連続するエッジ点の集合を区分けコードで区分けして、原稿左エッジデータを構築する。   When the processing in S747 is completed, the CPU 70 adds a classification code to the document left edge data in the same manner as the processing in S549 in order to mark the point where the continuity is interrupted (S749). With such an operation, in the left edge detection process, the coordinate data of edge points continuous in the Y-axis direction are sequentially arranged from the coordinate data with the smallest Y coordinate value, with a segmentation code sandwiched at a point where continuity is interrupted. Then, a set of continuous edge points is divided by a division code to construct document left edge data.

また、S749での処理を終えると、CPU70は、S715に移行し、主走査方向検査位置Xeを、読取可能領域R0の左端に設定することで(Xe=0)、検査位置(Xe,Ye)を、連続性が途切れた地点に対応する画像データの左端に、再設定する。また、同時に、変数Cを、C=0に初期化する。その後、S720以降の処理を実行する。   When the process in S749 is finished, the CPU 70 proceeds to S715, and sets the main scanning direction inspection position Xe to the left end of the readable area R0 (Xe = 0), so that the inspection position (Xe, Ye). Is reset to the left end of the image data corresponding to the point where the continuity is interrupted. At the same time, the variable C is initialized to C = 0. Thereafter, the processing after S720 is executed.

一方、連続性が途切れずに、Y0+8>Sとなると(S780でYes)、CPU70は、S790に移行し、S770,S775で原稿左エッジデータとして記録した座標データ群の中から、左エッジ(原稿の左端を表すエッジ点)として確度の低い座標データを削除して、原稿左エッジデータを確定する。尚、Ye+8>Sとなった場合にも(S720でYes)、S790に移行し、同様に原稿左エッジデータを確定する。   On the other hand, if continuity is not interrupted and Y0 + 8> S is satisfied (Yes in S780), the CPU 70 proceeds to S790, and the left edge (original document) is selected from the coordinate data group recorded as the original left edge data in S770 and S775. The coordinate data with low accuracy is deleted as the edge point representing the left end of the document), and the document left edge data is determined. Even when Ye + 8> S is satisfied (Yes in S720), the process proceeds to S790, and the document left edge data is similarly determined.

具体的に、S790では、S590での処理と同様、原稿左エッジデータを処理対象データに設定して、図8に示す第一エッジ確定処理を実行することで、左エッジとして確度の低い座標データ群を原稿左エッジデータから削除し、原稿左エッジデータを確定する。   Specifically, in S790, as in the process in S590, the document left edge data is set as the processing target data, and the first edge determination process shown in FIG. The group is deleted from the document left edge data, and the document left edge data is determined.

また、このようにして、左エッジ検出処理を終えると、CPU70は、S455に移行し、左エッジ検出処理で確定された原稿左エッジデータが示す各点を直線近似して、原稿左エッジデータが示す点群の近似直線(以下、「左エッジ近似直線」という。)を算出する。その後、S460に移行する。   In addition, when the left edge detection process is completed in this way, the CPU 70 proceeds to S455, linearly approximates each point indicated by the document left edge data determined by the left edge detection process, and the document left edge data is obtained. An approximate straight line (hereinafter referred to as “left edge approximate straight line”) of the point group shown is calculated. Thereafter, the process proceeds to S460.

但し、直前の左エッジ検出処理で原稿左エッジデータとして登録された座標データがない場合には、左エッジの検出に失敗したと判断して、左エッジ近似直線を算出することなく、S460に移行するものとする。この他、原稿左エッジデータとして登録されている座標データの全て又は一部が原稿右エッジデータにも登録されている場合には、右エッジ(原稿の右端を表すエッジ点)の座標データが間違って原稿左エッジデータとして登録されているとみなして、原稿左エッジデータとして登録された座標データがある場合でも、左エッジの検出に失敗したと判断し、左エッジ近似直線を算出することなく、S460に移行するようにしてもよい。   However, if there is no coordinate data registered as document left edge data in the immediately preceding left edge detection process, it is determined that detection of the left edge has failed, and the process proceeds to S460 without calculating the left edge approximate straight line. It shall be. In addition, when all or part of the coordinate data registered as the document left edge data is also registered in the document right edge data, the coordinate data of the right edge (the edge point representing the right edge of the document) is incorrect. Even if there is coordinate data registered as document left edge data, it is determined that detection of the left edge has failed, and without calculating the left edge approximate straight line, You may make it transfer to S460.

また、S460に移行すると、CPU70は、図11に示す下エッジ検出処理を実行する。図11は、CPU70が実行する下エッジ検出処理を表すフローチャートである。
下エッジ検出処理を開始すると、CPU70は、S810にて、主走査方向検査位置Xeを、読取可能領域R0の左端X座標に設定し(Xe=0)、S815にて、副走査方向検査位置Yeを、読取可能領域R0の下端Y座標に設定する(Ye=0)。また、S815では、変数Cを値ゼロに初期化する(C=0)。
In S460, the CPU 70 executes the lower edge detection process shown in FIG. FIG. 11 is a flowchart showing the lower edge detection process executed by the CPU 70.
When the lower edge detection process is started, the CPU 70 sets the main scanning direction inspection position Xe to the left end X coordinate of the readable area R0 (Xe = 0) in S810, and the sub scanning direction inspection position Ye in S815. Is set to the lower end Y coordinate of the readable area R0 (Ye = 0). In S815, the variable C is initialized to zero (C = 0).

また、この処理を終えると、CPU70は、主走査方向検査位置XeからX軸方向に8画素進んだ地点(Xe+8)が読取可能領域R0の右端を超えているか否か(即ち、Xe+8>XMAXであるか否か)を判断し(S820)、読取可能領域R0の右端を超えていないと判断すると(S820でNo)、検査位置(X,Y)=(Xe,Ye)に対応する検査対象データの画素値を参照して、検査位置(Xe,Ye)がエッジ点であるか否かを判断する(S825)。   When this process is finished, the CPU 70 determines whether or not a point (Xe + 8) advanced by 8 pixels in the X-axis direction from the main scanning direction inspection position Xe exceeds the right end of the readable area R0 (ie, Xe + 8> XMAX). (S820) and if it is determined that the right end of the readable area R0 is not exceeded (No in S820), the inspection object data corresponding to the inspection position (X, Y) = (Xe, Ye) Whether the inspection position (Xe, Ye) is an edge point or not is determined with reference to the pixel value (S825).

そして、検査位置(Xe,Ye)がエッジ点ではないと判断すると(S825でNo)、S841に移行して、副走査方向検査位置Yeを、Y軸プラス方向に1画素移動した位置に更新し(Ye←Ye+1)、更新後の副走査方向検査位置Yeが検査範囲を超えているか否か(Ye>Sであるか否か)を判断する(S843)。   If it is determined that the inspection position (Xe, Ye) is not an edge point (No in S825), the process proceeds to S841, and the sub-scanning inspection position Ye is updated to a position moved by one pixel in the Y-axis plus direction. (Ye ← Ye + 1), it is determined whether or not the updated sub-scanning direction inspection position Ye exceeds the inspection range (whether or not Ye> S) (S843).

そして、副走査方向検査位置Yeが検査範囲を超えていないと判断すると(S843でNo)、S820に移行する。
一方、S843で副走査方向検査位置Yeが検査範囲を超えていると判断すると(Ye>Sであると判断すると)、CPU70は、S845に移行し、副走査方向検査位置Yeを、読取可能領域R0の下端に設定すると共に(Ye=0)、主走査方向検査位置Xeを、X軸方向に8画素進んだ位置に設定する(Xe←Xe+8)。その後、S820に移行する。
If it is determined that the sub-scanning direction inspection position Ye does not exceed the inspection range (No in S843), the process proceeds to S820.
On the other hand, when it is determined in S843 that the sub-scanning direction inspection position Ye exceeds the inspection range (when it is determined that Ye> S), the CPU 70 proceeds to S845, and the sub-scanning direction inspection position Ye is set in the readable area. While setting at the lower end of R0 (Ye = 0), the main scanning direction inspection position Xe is set to a position advanced by 8 pixels in the X-axis direction (Xe ← Xe + 8). Thereafter, the process proceeds to S820.

この他、CPU70は、S825において、検査位置(Xe,Ye)がエッジ点であると判断すると(S825でYes)、S830に移行し、変数(X0,Y0)に、現在の検査位置(Xe,Ye)の座標値を、設定する(X0←Xe,Y0←Ye)。また、変数X1を、値X1=X0+8に更新する(S833)。   In addition, when the CPU 70 determines in S825 that the inspection position (Xe, Ye) is an edge point (Yes in S825), the CPU 70 proceeds to S830 and sets the current inspection position (Xe, Y0) in the variable (X0, Y0). The coordinate value of (Ye) is set (X0 ← Xe, Y0 ← Ye). Also, the variable X1 is updated to the value X1 = X0 + 8 (S833).

その後、CPU70は、座標(X1,Y0−1)の地点、座標(X1,Y0)の地点及び座標(X1,Y0+1)の地点の少なくとも一つが、エッジ点であるか否かを判断し(S837)、座標(X1,Y0−1)の地点、座標(X1,Y0)の地点及び座標(X1,Y0+1)の地点のいずれもがエッジ点でない場合には(S837でNo)、S839に移行して、変数Cが値8以上であるか否かを判断し、変数Cが値8未満であると判断すると(S839でNo)、S841に移行する。   Thereafter, the CPU 70 determines whether or not at least one of the coordinates (X1, Y0-1), the coordinates (X1, Y0), and the coordinates (X1, Y0 + 1) is an edge point (S837). ), If none of the coordinates (X1, Y0-1), coordinates (X1, Y0), and coordinates (X1, Y0 + 1) is an edge point (No in S837), the process proceeds to S839. Then, it is determined whether or not the variable C is greater than or equal to 8, and if it is determined that the variable C is less than 8 (No in S839), the process proceeds to S841.

一方、座標(X1,Y0−1)の地点、座標(X1,Y0)の地点及び座標(X1,Y0+1)の地点の少なくとも一つがエッジ点であると判断すると(S837でYes)、CPU70は、S850に移行して、座標(X0,Y0)の地点が連続性のあるエッジ点であると判定し、この座標(X0,Y0)を、連続性のあるエッジ点の座標データとして、一時記憶する。   On the other hand, if it is determined that at least one of the coordinates (X1, Y0-1), the coordinates (X1, Y0), and the coordinates (X1, Y0 + 1) is an edge point (Yes in S837), the CPU 70 Moving to S850, it is determined that the point of coordinates (X0, Y0) is a continuous edge point, and this coordinate (X0, Y0) is temporarily stored as coordinate data of a continuous edge point. .

また、この処理を終えると、CPU70は、S860に移行し、座標(X1,Y0−1)の地点、座標(X1,Y0)の地点及び座標(X1,Y0+1)の地点の内、エッジ点である地点の一つを、予め定められた優先度に従って選択する。   When this process is finished, the CPU 70 proceeds to S860, where the coordinates (X1, Y0-1), the coordinates (X1, Y0), and the coordinates (X1, Y0 + 1) are the edge points. One of the points is selected according to a predetermined priority.

具体的に、下エッジ検出処理においては、読取可能領域R0下端側に近い座標ほど高い優先度が設定されている。即ち、読取可能領域R0下端側に近い座標(X1,Y0−1)の地点が優先度「大」に設定され、座標(X1,Y0)の地点が優先度「中」に設定され、座標(X1,Y0+1)の地点が優先度「小」に設定されている。このように優先度が設定されているのは、原稿の下端より下側においては、原稿台11aに何も存在せず、エッジ点は存在しないはずであり、読取可能領域R0下端側に近いエッジ点であるほど、そのエッジ点が原稿の下端に対応するエッジ点である可能性が高いためである。   Specifically, in the lower edge detection process, a higher priority is set for coordinates closer to the lower end side of the readable area R0. That is, the point of the coordinates (X1, Y0-1) close to the lower end side of the readable area R0 is set to the priority “large”, the point of the coordinates (X1, Y0) is set to the priority “medium”, and the coordinates ( The point of (X1, Y0 + 1) is set to the priority “small”. The priority is set in this way because there is nothing on the document table 11a below the lower end of the original, there should be no edge point, and the edge close to the lower end of the readable area R0. This is because the point is more likely to be the edge point corresponding to the lower end of the document.

従って、S860では、この優先度に従って、座標(X1,Y0−1)の地点、座標(X1,Y0)の地点及び座標(X1,Y0+1)の地点の内、エッジ点である地点であって優先度の最も高い地点を選択する。そして、変数X0を、選択した地点のX座標に更新し、変数Y0を、選択した地点のY座標に更新する。その後、変数Cを1加算した値に更新する(S863)。   Therefore, in S860, according to this priority, the point that is the edge point among the point of the coordinate (X1, Y0-1), the point of the coordinate (X1, Y0), and the point of the coordinate (X1, Y0 + 1) is preferred. Select the point with the highest degree. Then, the variable X0 is updated to the X coordinate of the selected point, and the variable Y0 is updated to the Y coordinate of the selected point. Thereafter, the variable C is updated to a value obtained by adding 1 (S863).

また、この処理を終えると、CPU70は、更新後の変数Cが値8以上であるか否かを判断し(S867)、C≧8でないと判断すると(S867でNo)、S880に移行して、座標X=X0からX軸方向に8画素進んだ地点(X0+8)が読取可能領域R0の右端を超えているか否かを判断する。具体的には、X0+8>XMAXであるか否かを判断する。   When this process is finished, the CPU 70 determines whether or not the updated variable C is 8 or more (S867). If it is determined that C ≧ 8 is not satisfied (No in S867), the CPU 70 proceeds to S880. Then, it is determined whether or not the point (X0 + 8) advanced by 8 pixels in the X-axis direction from the coordinate X = X0 exceeds the right end of the readable area R0. Specifically, it is determined whether X0 + 8> XMAX.

そして、X0+8>XMAXではないと判断すると(S880でNo)、S833に移行して、変数X1を、X1=X0+8に更新する。その後、S837以降の処理を実行する。   If it is determined that X0 + 8> XMAX is not satisfied (No in S880), the process proceeds to S833, and the variable X1 is updated to X1 = X0 + 8. Thereafter, the processing after S837 is executed.

このような処理を実行することにより、CPU70は、X軸方向に8画素おきに、エッジ点がX軸方向に連続するものであるか否かを検査する。そして、変数Cが8以上となると、S867でYesと判断して、連続性のあるエッジ点として判定した座標データを、原稿下エッジデータとしてRAM80に記憶する(S870,S875)。   By executing such processing, the CPU 70 checks whether the edge points are continuous in the X-axis direction every 8 pixels in the X-axis direction. If the variable C is 8 or more, it is determined Yes in S867, and the coordinate data determined as a continuous edge point is stored in the RAM 80 as document lower edge data (S870, S875).

具体的に、C=8である場合には、S869でYesと判断して、C=8となるまでにS850の処理で連続性のあるエッジ点として判定した計8地点の各座標データを、原稿下エッジデータとしてRAM80に記憶する(S870)。一方、C>8である場合には、S869でNoと判断して、S875に移行し、直前のS850の処理で連続性のあるエッジ点として判定した地点の座標データを、原稿下エッジデータとしてRAM80に記憶する。その後、S880に移行する。   Specifically, when C = 8, it is determined as Yes in S869, and the coordinate data of a total of 8 points determined as continuous edge points in the process of S850 until C = 8 is obtained. The document lower edge data is stored in the RAM 80 (S870). On the other hand, if C> 8, it is determined No in S869, the process proceeds to S875, and the coordinate data of the point determined as a continuous edge point in the immediately preceding processing of S850 is used as the document lower edge data. Store in RAM 80. Thereafter, the process proceeds to S880.

このようにして、CPU70は、検査位置(Xe,Ye)からX軸方向に8点以上連続するエッジ点については、その連続性が途切れるか(S837でNo)、X軸方向末端まで画素値を参照するまで(S880でYes)、X軸方向に画素値を参照して、連続するエッジ点を順次RAM80に記録する。   In this way, the CPU 70 determines whether the continuity of the edge points that are continuous in the X-axis direction from the inspection position (Xe, Ye) is 8 points or more is interrupted (No in S837), or the pixel value is obtained up to the X-axis direction end. Until reference is made (Yes in S880), continuous edge points are sequentially recorded in the RAM 80 with reference to the pixel value in the X-axis direction.

そして、連続性が途切れることで、S837でNoと判断した場合には、S839に移行し、C≧8であると判断して(S839でYes)、S847で、主走査方向検査位置Xeを、変数X0の値に設定する(Xe=X0)。   If it is determined No in S837 due to the interruption of continuity, the process proceeds to S839, C ≧ 8 is determined (Yes in S839), and the main scanning direction inspection position Xe is determined in S847. The value of the variable X0 is set (Xe = X0).

また、S847での処理を終えると、CPU70は、連続性が途切れた地点をマーキングするために、S549での処理と同様にして、区分けコードを、原稿下エッジデータに追加する(S849)。このような動作により、当該下エッジ検出処理においては、X軸方向に連続するエッジ点の座標データを、X座標値最小の座標データから、連続性が途切れる地点で区分けコードを挟んで、順に配列し、連続するエッジ点の集合を区分けコードで区分けして、原稿下エッジデータを構築する。   When the processing in S847 is completed, the CPU 70 adds a classification code to the document lower edge data in the same manner as in S549 in order to mark the point where the continuity is interrupted (S849). By such an operation, in the lower edge detection process, the coordinate data of the edge points continuous in the X-axis direction are sequentially arranged from the coordinate data with the minimum X coordinate value at the point where the continuity is interrupted, with the segmentation code interposed therebetween. Then, a set of continuous edge points is classified by a classification code to construct document lower edge data.

また、S849での処理を終えると、CPU70は、S815に移行し、副走査方向検査位置Yeを、読取可能領域R0の下端に設定することで(Ye=0)、検査位置(Xe,Ye)を、連続性が途切れた地点に対応する画像データの下端に、再設定する。また、同時に、変数Cを、C=0に初期化する。その後、S820以降の処理を実行する。   When the processing in S849 is finished, the CPU 70 proceeds to S815, and sets the sub-scanning direction inspection position Ye to the lower end of the readable area R0 (Ye = 0), so that the inspection position (Xe, Ye). Is reset to the lower end of the image data corresponding to the point where the continuity is interrupted. At the same time, the variable C is initialized to C = 0. Thereafter, the processing after S820 is executed.

一方、連続性が途切れずに、X0+8>XMAXとなると(S880でYes)、CPU70は、S890に移行し、S870,S875で原稿下エッジデータとして記録した座標データ群の中から、下エッジ(原稿の下端を表すエッジ点)として確度の低い座標データを削除して、原稿下エッジデータを確定する。尚、Xe+8>XMAXとなった場合にも(S820でYes)、S890に移行して、同様に原稿下エッジデータを確定する。   On the other hand, if continuity is not interrupted and X0 + 8> XMAX is satisfied (Yes in S880), the CPU 70 proceeds to S890, and the lower edge (original document) is selected from the coordinate data group recorded as the original lower edge data in S870 and S875. The coordinate data with low accuracy is deleted as the edge point representing the lower end of the document, and the document lower edge data is determined. Even when Xe + 8> XMAX (Yes in S820), the process proceeds to S890, and the document lower edge data is determined in the same manner.

具体的に、S890では、原稿下エッジデータを処理対象データに設定して、図12に示す第二エッジ確定処理を実行することで、下エッジとして確度の低い座標データ群を原稿下エッジデータから削除し、原稿下エッジデータを確定する。図12は、CPU70が実行する第二エッジ確定処理を表すフローチャートである。   Specifically, in S890, the lower edge data of the document is set as the processing target data, and the second edge determination process shown in FIG. Delete and confirm the document lower edge data. FIG. 12 is a flowchart showing the second edge determination process executed by the CPU 70.

第二エッジ確定処理を開始すると、CPU70は、予め設定された処理対象データが、少なくとも8つ以上のエッジ点の座標データを含むものであるか否かを判断し(S910)、処理対象データが8つ以上のエッジ点の座標データを含むものであると判断すると(S910でYes)、S920に移行し、処理対象データが8つ以上のエッジ点の座標データを含むものではない(換言すれば処理対象データが空データである)と判断すると(S910でNo)、S920〜S990の処理を実行することなく、当該第二エッジ確定処理を終了する。   When the second edge determination process is started, the CPU 70 determines whether or not the preset processing target data includes coordinate data of at least eight edge points (S910), and the eight processing target data are included. If it is determined that the coordinate data of the edge point is included (Yes in S910), the process proceeds to S920, and the processing target data does not include coordinate data of eight or more edge points (in other words, the processing target data is not included). If it is determined that the data is empty data (No in S910), the second edge determination process is terminated without executing the processes of S920 to S990.

一方、S920に移行すると、CPU70は、処理対象データを構成するエッジ点の座標データに基づき、処理対象データに登録されたエッジ点であって、X座標値が最大のエッジ点を、検査開始点に設定する。   On the other hand, when the process proceeds to S920, the CPU 70 determines the edge point registered in the processing target data and having the maximum X coordinate value based on the coordinate data of the edge points constituting the processing target data as the inspection start point. Set to.

また、S920での処理を終えると、CPU70は、S930に移行し、検査開始点からX軸マイナス方向に、処理対象データに登録されたエッジ点を辿り、連続するエッジ点の当該連続性が途切れる地点を探索する。上述したように、処理対象データに設定される原稿下エッジデータにおいては、エッジ点の座標データが、X座標値最小のエッジ点の座標データから、途中区分けコードを挟んで、順に配列される。従って、S930では、処理対象データを、検査開始点に対応するエッジ点の座標データから、X軸マイナス方向に遡るようにして参照して、最初に現れる区分けコードを検出する。   When the processing in S920 is completed, the CPU 70 proceeds to S930 and follows the edge point registered in the processing target data in the X-axis minus direction from the inspection start point, and the continuity of successive edge points is interrupted. Search for a point. As described above, in the document lower edge data set as the processing target data, the coordinate data of the edge point is sequentially arranged from the coordinate data of the edge point having the smallest X coordinate value with the intermediate division code interposed therebetween. Accordingly, in S930, the processing target data is referred to from the coordinate data of the edge point corresponding to the inspection start point so as to go back in the minus direction of the X axis, and the first division code that appears is detected.

そして、区分けコードを検出できた場合には、連続性が途切れる地点があると判断して(S940でYes)、S950に移行する。
一方、区分けコードを検出できなかった場合には、連続性が途切れる地点がないと判断して(S940でNo)、S950〜S990の処理を実行することなく、当該第二エッジ確定処理を終了する。このようにして、S940でNoと判断した場合には、処理対象データに登録されているエッジ点の全てが、原稿の端縁を表すエッジ点として確度の高いエッジ点であると取扱って、処理対象データに登録されたエッジ点を削除することなく、原稿エッジを確定し、第二エッジ確定処理を終了する。
If the division code can be detected, it is determined that there is a point where continuity is interrupted (Yes in S940), and the process proceeds to S950.
On the other hand, if the classification code cannot be detected, it is determined that there is no point where continuity is interrupted (No in S940), and the second edge determination process is terminated without executing the processes of S950 to S990. . In this manner, when it is determined No in S940, all the edge points registered in the processing target data are handled as edge points with high accuracy as edge points representing the edge of the document, and processing is performed. The document edge is determined without deleting the edge point registered in the target data, and the second edge determination process is terminated.

これに対し、S950に移行すると、CPU70は、連続性が途切れる地点直前のエッジ点(換言すると、連続性が途切れる地点よりX軸プラス方向に位置するエッジ点であってX座標値最小のエッジ点)に対し、X軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれているか否かを判断する。   In contrast, when the process proceeds to S950, the CPU 70 determines that the edge point immediately before the point at which the continuity is interrupted (in other words, the edge point located in the plus direction of the X axis from the point at which the continuity is interrupted and having the minimum X coordinate value) ) Is determined whether or not the coordinate data of edge points adjacent on the X-axis minus direction side is included in the processing target data.

ここでは、連続性が途切れる地点直前のエッジ点の画素位置(X,Y)=(X0,Y0)に対して、X座標値がX=X0−8を採るエッジ点の座標データが、処理対象データに含まれている場合には、X軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていると判断し、X座標値がX=X0−8を採るエッジ点の当該座標データが、処理対象データに含まれていない場合には、X軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていないと判断する。これにより、X軸のみの一次元空間上で、連続性が途切れる地点を挟んで、隣接するエッジ点の有無を判断する。   Here, with respect to the pixel position (X, Y) = (X0, Y0) of the edge point immediately before the point where continuity is interrupted, the coordinate data of the edge point where the X coordinate value is X = X0-8 is processed. If included in the data, it is determined that the coordinate data of the edge point adjacent on the X axis minus direction side is included in the processing target data, and the edge point at which the X coordinate value takes X = X0-8 Is not included in the processing target data, it is determined that the processing target data does not include the coordinate data of the edge point adjacent on the X-axis minus direction side. Thereby, the presence or absence of the adjacent edge point is determined across the point where the continuity is interrupted on the one-dimensional space only on the X axis.

そして、連続性が途切れる地点直前のエッジ点に対し、X軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていると判断すると(S950でYes)、CPU70は、S960に移行する。一方、X軸マイナス方向側で隣接するエッジ点の座標データが、処理対象データに含まれていないと判断すると(S950でNo)、S990に移行する。   If the CPU 70 determines that the coordinate data of the edge point adjacent to the edge point immediately before the point where the continuity is interrupted is included in the processing target data (Yes in S950), the CPU 70 proceeds to S960. Migrate to On the other hand, when it is determined that the coordinate data of the edge point adjacent on the X-axis minus direction side is not included in the processing target data (No in S950), the process proceeds to S990.

また、S960に移行すると、CPU70は、連続性が途切れる地点を挟んで、隣接するエッジ点のY軸方向の乖離度を算出する。具体的には、連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)であり、このエッジ点に隣接するエッジ点の画素位置が(X,Y)=(X0−8,Y1)であるとすると、上記乖離度として、これら2つのエッジ点のY座標値の差δY=|Y0−Y1|を算出する。   In S960, the CPU 70 calculates the degree of divergence in the Y-axis direction between adjacent edge points across the point where continuity is interrupted. Specifically, the pixel position of the edge point immediately before the point where continuity is interrupted is (X, Y) = (X0, Y0), and the pixel position of the edge point adjacent to this edge point is (X, Y) = Assuming that (X0-8, Y1), the difference δY = | Y0−Y1 | between these two edge points is calculated as the divergence.

また、この処理を終えると、CPU70は、差δYが、予め設計段階で定められた閾値未満であるか否かを判断し(S970)、閾値未満であると判断すると(S970でYes)、検査開始点を、上記連続性が途切れる地点直前のエッジ点に隣接するエッジ点(X0−8,Y1)に更新する(S980)。その後、S930に移行する。   When this process is completed, the CPU 70 determines whether or not the difference δY is less than a threshold value determined in advance in the design stage (S970). If the CPU 70 determines that the difference δY is less than the threshold value (Yes in S970), the inspection is performed. The start point is updated to the edge point (X0-8, Y1) adjacent to the edge point immediately before the point where the continuity is interrupted (S980). Thereafter, the process proceeds to S930.

一方、差δYが、閾値以上であると判断すると(S970でNo)、CPU70は、上記連続性が途切れる地点よりX軸マイナス方向に位置するエッジ点については、原稿エッジ(原稿の端縁を表すエッジ点)としての確度が低いと判断して、S990に移行し、上記連続性が途切れる地点よりX軸マイナス方向に位置するエッジ点の座標データを、全て処理対象データから削除して、処理対象データを更新する。   On the other hand, if it is determined that the difference δY is equal to or greater than the threshold value (No in S970), the CPU 70 represents the document edge (represents the edge of the document) with respect to the edge point positioned in the negative X-axis direction from the point where the continuity is interrupted. It is determined that the accuracy as the edge point) is low, and the process proceeds to S990, in which all the coordinate data of the edge point located in the X-axis minus direction from the point where the continuity is interrupted are deleted from the processing target data. Update the data.

例えば、直前のS930で検出した連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)である場合には、X座標値がX0未満のエッジ点の座標データを全て処理対象データから削除して、処理対象データを更新する。その後、当該第二エッジ確定処理を終了する。第二エッジ確定処理では、このようにして、処理対象データを構成するエッジ点の座標データの内、原稿エッジとして確度の低い座標データを削除する。   For example, when the pixel position of the edge point immediately before the point where the continuity detected in the previous S930 is interrupted is (X, Y) = (X0, Y0), the coordinate data of the edge point whose X coordinate value is less than X0 Are all deleted from the processing target data, and the processing target data is updated. Thereafter, the second edge determination process ends. In the second edge determination process, the coordinate data having low accuracy as the document edge is deleted from the coordinate data of the edge points constituting the processing target data.

即ち、下エッジ検出処理のS890では、このようにして、原稿下エッジデータから下エッジとして確度の低いエッジ点の座標データを削除し、原稿下エッジデータを確定する。尚、S890で、上述のようにして、X座標値が大きいエッジ点程、エッジ点が原稿の下端を表すエッジ点(下エッジ)である確度が高いと取り扱い、X座標値が大きいエッジ点群からY軸方向に大きくずれた位置に存在するX座標値が小さいエッジ点群を、原稿下エッジデータから削除する理由は、下エッジ検出処理にて、Xe=0から順に検査位置(Xe,Ye)をずらして原稿の下端を表すエッジ点を検索すると、原稿が左側に傾いている場合には、原稿の下端ではなく、原稿内部に描写された罫線等に対応するエッジ点を、原稿の下端を表すエッジ点として誤検出してしまう可能性があるためである。   That is, in S890 of the lower edge detection process, the coordinate data of the edge point with low accuracy is deleted from the document lower edge data as the lower edge in this way, and the document lower edge data is determined. In S890, as described above, an edge point having a larger X coordinate value is treated as having a higher probability that the edge point is an edge point (lower edge) representing the lower end of the document, and an edge point group having a larger X coordinate value. The reason why the edge point group having a small X coordinate value existing at a position greatly deviated in the Y axis direction from the document is deleted from the document lower edge data is that the inspection positions (Xe, Ye in order from Xe = 0 in the lower edge detection process) ) To search for an edge point representing the bottom edge of the document. If the document is tilted to the left, the edge point corresponding to the ruled line drawn inside the document is not the bottom edge of the document. This is because there is a possibility of erroneous detection as an edge point representing.

このような誤検出は、X座標値が小さいエッジ点群において発生している可能性が高く、X座標値が大きいエッジ点群において発生している可能性は、小さい。このような理由から、S890では、X座標値が大きいエッジ点程、エッジ点が原稿の下端を表すエッジ点(下エッジ)である確度が高いと取り扱って、確度の低いエッジ点を原稿下エッジデータから削除し、原稿下エッジデータを確定するようにしている。   Such an erroneous detection is highly likely to occur in an edge point group having a small X coordinate value, and is unlikely to occur in an edge point group having a large X coordinate value. For this reason, in S890, an edge point with a larger X coordinate value is treated as having a higher probability that the edge point is an edge point (lower edge) representing the lower end of the document, and an edge point with lower accuracy is treated as the lower edge of the document. The data is deleted from the data, and the document lower edge data is determined.

また、このようにしてS890での処理を終えると、CPU70は、S460での下エッジ検出処理を終了して、S465に移行し、S465では、下エッジ検出処理で確定された原稿下エッジデータが示す各点を直線近似して、原稿下エッジデータが示す点群の近似直線(以下、「下エッジ近似直線」という。)を算出する。その後、S470に移行する。但し、直前の下エッジ検出処理で原稿下エッジデータとして登録された座標データがない場合には、下エッジの検出に失敗したと判断して、下エッジ近似直線を算出することなく、S470に移行するものとする。   When the processing in S890 is completed in this manner, the CPU 70 ends the lower edge detection processing in S460 and proceeds to S465. In S465, the document lower edge data determined in the lower edge detection processing is determined. Each point shown is approximated by a straight line, and an approximate straight line of the point group indicated by the document lower edge data (hereinafter referred to as a “lower edge approximate straight line”) is calculated. Thereafter, the process proceeds to S470. However, if there is no coordinate data registered as the document lower edge data in the immediately preceding lower edge detection process, it is determined that the lower edge detection has failed, and the process proceeds to S470 without calculating the lower edge approximate straight line. It shall be.

また、S470に移行すると、CPU70は、右エッジ近似直線、左エッジ近似直線、及び下エッジ近似直線の相互関係から、右エッジ検出処理(S420)、左エッジ検出処理(S450)及び下エッジ検出処理(S460)にて正しく原稿エッジが検出されたか否かを判断する。即ち、右エッジ、左エッジ及び下エッジの全てが正常に検出されたか否かを判断する。   In step S470, the CPU 70 determines the right edge detection process (S420), the left edge detection process (S450), and the lower edge detection process from the mutual relationship between the right edge approximate line, the left edge approximate line, and the lower edge approximate line. In (S460), it is determined whether or not the document edge is correctly detected. That is, it is determined whether all of the right edge, the left edge, and the lower edge have been detected normally.

具体的には、右エッジ近似直線と左エッジ近似直線とが平行な関係にあり、右エッジ近似直線と下エッジ近似直線とが直交関係にあり、左エッジ近似直線と下エッジ近似直線とが直交関係にある場合には、正しく原稿エッジが検出されたとして、S470でYesと判断する。   Specifically, the right edge approximate line and the left edge approximate line are parallel, the right edge approximate line and the lower edge approximate line are orthogonal, and the left edge approximate line and the lower edge approximate line are orthogonal If there is a relationship, it is determined that the document edge is correctly detected, and the determination in S470 is Yes.

一方、右エッジ、左エッジ及び下エッジのいずれか一つの検出にでも失敗している場合や、右エッジ、左エッジ及び下エッジの関係が正しい関係にない場合には、S470でNoと判断する。即ち、右エッジ近似直線と左エッジ近似直線とが平行な関係にあり、右エッジ近似直線と下エッジ近似直線とが直交関係にあり、且つ、左エッジ近似直線と下エッジ近似直線とが直交関係にある場合を除いては、原稿エッジが正しく検出されていないとして、S470でNoと判断する。但し、ここでの相互関係の判定は、誤差を考慮して実行すべきである。   On the other hand, if detection of any one of the right edge, the left edge, and the lower edge fails, or if the relationship between the right edge, the left edge, and the lower edge is not correct, it is determined No in S470. . That is, the right edge approximate line and the left edge approximate line are parallel, the right edge approximate line and the lower edge approximate line are orthogonal, and the left edge approximate line and the lower edge approximate line are orthogonal. Except in the case of No., it is determined that the document edge is not correctly detected, and No is determined in S470. However, the determination of the mutual relationship here should be executed in consideration of an error.

そして、原稿エッジが正しく検出されていないと判断すると(S470でNo)、CPU70は、S471に移行して、S431での処理と同様のエラー処理を実行する。
一方、S470で原稿エッジが正しく検出されていると判断すると(S470でYes)、CPU70は、S480に移行して、原稿の左下角位置を、左エッジ近似直線と下エッジ近似直線との交点であると推定して、その座標値を算出し、更に、原稿の右下角位置を、右エッジ近似直線と下エッジ近似直線との交点であると推定して、その座標値を算出する(S485)。尚、図13は、S480及びS485での原稿左下角位置Ka及び原稿右下角位置Kbの推定方法を示した説明図である。図中、白丸がエッジ点を表し、黒丸が角位置Ka,Kbを表す。
If it is determined that the document edge is not correctly detected (No in S470), the CPU 70 proceeds to S471 and executes error processing similar to the processing in S431.
On the other hand, if it is determined in S470 that the document edge is correctly detected (Yes in S470), the CPU 70 proceeds to S480, and the lower left corner position of the document is determined by the intersection of the left edge approximate line and the lower edge approximate line. Assuming that there is a coordinate value, the coordinate value is calculated. Further, the lower right corner position of the document is estimated to be the intersection of the right edge approximate line and the lower edge approximate line, and the coordinate value is calculated (S485). . FIG. 13 is an explanatory diagram showing a method for estimating the document lower left corner position Ka and the document lower right corner position Kb in S480 and S485. In the figure, white circles represent edge points, and black circles represent the corner positions Ka and Kb.

また、S485での処理を終えると、CPU70は、S480及びS485で推定した角位置の位置座標に基づき、原稿台11aに載置されている原稿が定型用紙であるとの仮定の下で、原稿台11aに載置された原稿のサイズ及び原稿台11aにおける原稿の載置領域を推定すると共に、右エッジ近似直線に基づき、原稿台11aに載置されている原稿の傾き角θを推定する(S490)。   When the process in S485 is completed, the CPU 70 assumes that the document placed on the document table 11a is a standard sheet based on the position coordinates of the angular position estimated in S480 and S485. The size of the document placed on the table 11a and the document placement area on the document table 11a are estimated, and the inclination angle θ of the document placed on the document table 11a is estimated based on the right-edge approximate straight line ( S490).

即ち、S480及びS485で推定した原稿の左下角位置から右下角位置までの長さを、原稿の短辺長さ(横幅)と推定し、この短辺長さの√2倍を、原稿の長辺長さ(縦幅)と推定して、原稿サイズを推定すると共に、上記推定した左下角位置及び右下角位置を起点に上記原稿サイズの原稿が原稿台11aに載置されているものとして、原稿の左上角及び右上角が位置する座標を導出し、これら4つの角を結んでできる四角形内の領域を、原稿の載置領域であると推定する。   That is, the length from the lower left corner position to the lower right corner position of the document estimated in S480 and S485 is estimated as the short side length (horizontal width) of the document, and √2 times the short side length is set to the document length. Assuming that the document size is estimated by estimating the side length (vertical width), the document of the document size is placed on the document table 11a starting from the estimated lower left corner position and lower right corner position. The coordinates where the upper left corner and the upper right corner of the document are located are derived, and an area within a quadrilateral formed by connecting these four corners is estimated as the document placement area.

この他、S490では、Y軸に対して右エッジ近似直線がなす角度を、原稿の傾き角θと推定する。そして、この処理を終えると、CPU70は、S220での原稿推定処理を終了して、S230に移行し、後続の処理を実行する。即ち、原稿推定処理での推定結果に基づき、変倍率及び傾き補正量を設定し(S251,S253)、更に読取領域を設定する(S255)。その後、本スキャンに移行する(S270)。   In addition, in S490, the angle formed by the right edge approximate line with respect to the Y axis is estimated as the document inclination angle θ. When this process is completed, the CPU 70 ends the document estimation process in S220, proceeds to S230, and executes the subsequent process. That is, based on the estimation result in the document estimation process, a scaling factor and an inclination correction amount are set (S251, S253), and a reading area is further set (S255). Thereafter, the process proceeds to the main scan (S270).

そして、本スキャン(S270)では、上記設定した読取領域下において読取ユニット15を搬送し、その領域に写る画像を読取ユニット15に読み取らせる。そして、その読取結果を、上記設定した変倍率に合わせて拡大/縮小処理すると共に、上記設定した傾き補正量に合わせて回転処理して、印刷用の画像データを生成する。また、これを印刷対象データとして印刷処理することで、原稿のコピー画像であって、自動変倍され、更に傾き補正された画像を、印刷部30を通じて、記録紙に印刷する。   In the main scan (S270), the reading unit 15 is transported under the set reading area, and the reading unit 15 is caused to read an image shown in the area. Then, the read result is enlarged / reduced in accordance with the set variable magnification, and rotated in accordance with the set inclination correction amount to generate image data for printing. Also, by printing this as print target data, a copy image of the original, which has been automatically scaled and further tilt-corrected, is printed on recording paper through the printing unit 30.

以上、本実施例のディジタル複合機1の構成について説明したが、本実施例の複合機1によれば、読取可能領域R0の一部領域をプレスキャンして、その読取結果に基づき、原稿エッジを検出し、原稿の状態(原稿サイズ・原稿の傾き・原稿の載置領域)を推定するようにしているので、従来のように、読取可能領域R0全体をプレスキャンする手法よりも高速にプレスキャン動作を終了することができ、効率的に原稿の状態を推定することができる。   The configuration of the digital multi-function peripheral 1 according to the present embodiment has been described above. According to the multi-function peripheral 1 according to the present embodiment, a part of the readable area R0 is pre-scanned, and the document edge is based on the read result. Is detected, and the state of the original (original size, original inclination, original placement area) is estimated, so that the press can be performed at a higher speed than the conventional method of pre-scanning the entire readable area R0. The can operation can be terminated, and the state of the document can be estimated efficiently.

また、本実施例では、S510〜S580,S710〜S780,S810〜S880での処理により、原稿の端縁を表すエッジ点の候補を、高速に画像データ内から抽出し、その後、S590,S790,S890で、上記選択したエッジ点の候補の中から、原稿の端縁を表すエッジ点として確度の低いエッジ点を破棄することによって、原稿の端縁を表すエッジ点を高速且つ正確に検出するようにした。   In the present embodiment, edge point candidates representing the edge of the document are extracted from the image data at high speed by the processing in S510 to S580, S710 to S780, S810 to S880, and thereafter, S590, S790, In S890, the edge point representing the edge of the document is detected at high speed by discarding the edge point having low accuracy as the edge point representing the edge of the document from the selected edge point candidates. I made it.

即ち、S510〜S580,S710〜S780,S810〜S880では、単純な手順で原稿の端縁を表すエッジ点の候補を選ぶことにより、高速に原稿の端縁を表すエッジ点を、画像データ内から抽出するが、上記高速性のため犠牲にした精度については、第一及び第二エッジ確定処理にて、原稿の端縁を表すエッジ点として確度の低いエッジ点を破棄することにより、補完するようにした。   In other words, in S510 to S580, S710 to S780, and S810 to S880, edge points representing the edge of the document are selected from the image data at high speed by selecting edge point candidates representing the edge of the document by a simple procedure. Although the accuracy is sacrificed due to the high speed, the accuracy is sacrificed by discarding edge points with low accuracy as edge points representing the edge of the document in the first and second edge determination processing. I made it.

このように、本実施例では、複数段階に分けて、画像データ内から原稿の端縁を表すエッジ点として最もらしいエッジ点を抽出する。従って、本実施例によれば、従来よりも、高速且つ正確に、原稿の端縁を表すエッジ点(原稿エッジ)を検出することができる。   As described above, in this embodiment, an edge point that is most likely as an edge point representing the edge of the document is extracted from the image data in a plurality of stages. Therefore, according to the present embodiment, it is possible to detect an edge point (document edge) representing the edge of the document faster and more accurately than in the past.

この他、本実施例によれば、第一及び第二エッジ確定処理により、埃や原稿内部に描写された罫線等のエッジ点を破棄できるので、原稿内部の罫線や埃等の影響を抑えて、原稿エッジを適切に検出できる。   In addition, according to the present embodiment, the edge points such as dust and ruled lines drawn inside the document can be discarded by the first and second edge determination processing, so that the influence of ruled lines and dust inside the document can be suppressed. The document edge can be detected appropriately.

また特に、本実施例では、右エッジ及び左エッジを検出する際、原稿台11aの中央側にある原稿エッジの候補点ほど、それが原稿エッジである確度が高いと取り扱って、原稿台11aの中央寄りにあるエッジ点(Y座標値が大きいエッジ点)を基準に、原稿右エッジデータ及び原稿左エッジデータを確定し、これらのデータに基づいて右エッジ近似直線及び左エッジ近似直線を求めるようにした。   In particular, in the present embodiment, when detecting the right edge and the left edge, the document edge candidate point on the center side of the document table 11a is treated as having a higher probability of being the document edge, and the document table 11a The document right edge data and the document left edge data are determined based on the edge point near the center (the edge point having a large Y coordinate value), and the right edge approximate line and the left edge approximate line are obtained based on these data. I made it.

従って、本実施例によれば、原稿が傾いていることが原因で原稿内部に描写された罫線等を原稿エッジ(右エッジ又は左エッジ)として誤検出してしまい、結果として、近似直線に誤差が大きく現れるのを抑えることができる。よって、本実施例によれば、一部領域のプレスキャン程度で、高精度に、原稿サイズや原稿の傾き角、原稿の載置領域を推定することができる。   Therefore, according to the present embodiment, a ruled line or the like drawn inside the document is erroneously detected as a document edge (right edge or left edge) due to the document being inclined, and as a result, an error occurs in the approximate straight line. Can be suppressed from appearing greatly. Therefore, according to the present embodiment, it is possible to estimate the document size, the inclination angle of the document, and the document placement area with high accuracy with a pre-scan of a partial region.

また、本実施例では、下エッジ近似直線を求める際に、原稿台11aの右側にある下エッジの候補点(エッジ点)程、それが真に下エッジである確度が高いと取り扱って、原稿台11aの右側寄りにあるエッジ点を基準に、原稿下エッジデータを確定し、これらのデータに基づいて下エッジ近似直線を求めるようにした。従って、本実施例によれば、原稿が左側に傾いて載置されている場合の下エッジの誤検出を極力抑えることができて、高精度に、原稿サイズや原稿の傾き角、原稿の載置領域を推定することができる。
[第一変形例]
続いて、第一変形例について説明する。但し、第一変形例の複合機は、S590,S790で実行する第一エッジ確定処理及びS890で実行する第二エッジ確定処理の内容が一部変更された程度のものであり、他の構成は、上記実施例の複合機1と同一であるので、以下では、上記実施例と同一構成の部位についての説明を適宜省略する。
Further, in this embodiment, when the approximate straight line of the lower edge is obtained, the lower edge candidate point (edge point) on the right side of the document table 11a is treated as having a high probability of being truly the lower edge, and the original document is processed. The document lower edge data is determined based on the edge point on the right side of the table 11a, and the lower edge approximate straight line is obtained based on these data. Therefore, according to the present embodiment, it is possible to suppress erroneous detection of the lower edge when the document is placed on the left side as much as possible, and with high accuracy, the document size, the inclination angle of the document, and the placement of the document. The placement area can be estimated.
[First modification]
Subsequently, a first modification will be described. However, the multifunctional machine of the first modification is such that the contents of the first edge determination process executed in S590 and S790 and the contents of the second edge determination process executed in S890 are partially changed. Since it is the same as the MFP 1 of the above embodiment, the description of the parts having the same configuration as the above embodiment will be omitted as appropriate.

図14は、第一変形例において、CPU70が実行する第一エッジ確定処理を表すフローチャートである。
CPU70は、S590又はS790で図14に示す第一エッジ確定処理を開始すると、まず、変数LMAXを値ゼロに初期化する(S1010)。その後、S1015に移行して、予め設定された処理対象データが、少なくとも8つ以上のエッジ点の座標データを含むものであるか否かを判断する。
FIG. 14 is a flowchart showing a first edge determination process executed by the CPU 70 in the first modification.
When starting the first edge determination process shown in FIG. 14 in S590 or S790, the CPU 70 first initializes a variable LMAX to a value of zero (S1010). Thereafter, the process proceeds to S1015, and it is determined whether or not the preset processing target data includes coordinate data of at least eight edge points.

そして、処理対象データが8つ以上のエッジ点の座標データを含むものであると判断すると(S1015でYes)、S1020に移行し、処理対象データが8つ以上のエッジ点の座標データを含むものではないと判断すると(S1015でNo)、S1020〜S1090の処理を実行することなく、当該第一エッジ確定処理を終了する。   If it is determined that the processing target data includes coordinate data of eight or more edge points (Yes in S1015), the process proceeds to S1020, and the processing target data does not include coordinate data of eight or more edge points. (No in S1015), the first edge determination process is terminated without executing the processes of S1020 to S1090.

一方、S1020に移行すると、CPU70は、S620での処理と同様に、処理対象データに登録されたエッジ点であって、Y座標値が最大のエッジ点を、検査開始点に設定する。その後、S1025に移行する。   On the other hand, when the process proceeds to S1020, the CPU 70 sets the edge point registered in the processing target data and having the maximum Y coordinate value as the inspection start point, similarly to the process in S620. Thereafter, the process proceeds to S1025.

また、S1025に移行すると、CPU70は、S630での処理と同様に、検査開始点からY軸マイナス方向に、処理対象データに登録されたエッジ点を辿り、連続するエッジ点の当該連続性が途切れる地点を探索する。即ち、S1025では、検査開始点に対応するエッジ点の座標データから、処理対象データを、Y軸マイナス方向に遡るようにして参照して、最初に現れる区分けコードを検出する。   When the process proceeds to S1025, the CPU 70 follows the edge point registered in the processing target data in the Y-axis minus direction from the inspection start point in the same manner as the process in S630, and the continuity of successive edge points is interrupted. Search for a point. That is, in S1025, the processing target data is referred to in the Y-axis minus direction from the coordinate data of the edge point corresponding to the inspection start point, and the classification code that appears first is detected.

そして、区分けコードを検出できた場合には、連続性が途切れる地点があると判断して(S1030でYes)、S1040に移行し、区分けコードを検出できなかった場合には、検査開始点からY軸マイナス方向に連続性が途切れる地点がないと判断して(S1030でNo)、S1070に移行する。   If the classification code can be detected, it is determined that there is a point where the continuity is interrupted (Yes in S1030), and the process proceeds to S1040. If the classification code cannot be detected, the test starts from the inspection start point. It is determined that there is no point where continuity is interrupted in the negative axis direction (No in S1030), and the process proceeds to S1070.

また、S1040に移行すると、CPU70は、検査開始点から、連続性が途切れる直前のエッジ点までのY軸方向長さLを算出する。ここでは、検査開始点が座標(X,Y)=(Xs,Ys)の地点であり、連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)であるとすると、検査開始点から、連続性が途切れる直前のエッジ点までのY軸方向長さLとして、L=|Ys−Y0|を算出する。   In S1040, the CPU 70 calculates the length L in the Y-axis direction from the inspection start point to the edge point immediately before the continuity is interrupted. Here, the inspection start point is the point of coordinates (X, Y) = (Xs, Ys), and the pixel position of the edge point immediately before the point where the continuity is interrupted is (X, Y) = (X0, Y0). Then, L = | Ys−Y0 | is calculated as the length L in the Y-axis direction from the inspection start point to the edge point immediately before the continuity is interrupted.

また、この処理を終えると、CPU70は、S1050に移行して、変数Lの現在値が、変数LMAXより大きいか否かを判断し、変数Lの現在値が、変数LMAXより大きいと判断すると(S1050でYes)、処理対象データに登録されたエッジ点であって検査開始点から連続性が途切れる直前までの区間に位置するエッジ点を、最も長く連続するエッジ点の集合であると判断し、この集合に属するエッジ点の各座標データを、最終候補データとして、RAM80に記録する(S1055)。尚、ここでは、前回記録した最終候補データに上書きするようにして、RAM80に、最新の最終候補データを記録することで、最終候補データの前回値を破棄する。   When this process ends, the CPU 70 proceeds to S1050, determines whether or not the current value of the variable L is greater than the variable LMAX, and determines that the current value of the variable L is greater than the variable LMAX ( (Yes in S1050), it is determined that the edge points registered in the processing target data and located in the section from the inspection start point to immediately before the continuity is interrupted are the longest continuous edge point set, The coordinate data of the edge points belonging to this set is recorded in the RAM 80 as final candidate data (S1055). Here, the last candidate data recorded last time is overwritten, and the latest last candidate data is recorded in the RAM 80, thereby discarding the previous value of the last candidate data.

また、S1055での処理を終えると、CPU70は、S1057に移行し、変数LMAXの値を、変数Lの現在値に更新する(LMAX←L)。その後、S1060に移行する。   When the processing in S1055 is completed, the CPU 70 proceeds to S1057 and updates the value of the variable LMAX to the current value of the variable L (LMAX ← L). Thereafter, the process proceeds to S1060.

一方、変数Lの現在値が、変数LMAX以下であると判断すると(S1050でNo)、CPU70は、S1055,S1057の処理を実行することなく、S1060に移行する。   On the other hand, when determining that the current value of the variable L is equal to or smaller than the variable LMAX (No in S1050), the CPU 70 proceeds to S1060 without executing the processes of S1055 and S1057.

また、S1060に移行すると、CPU70は、連続性が途切れる地点よりY軸マイナス方向に位置するエッジ点の座標データが、処理対象データに含まれているか否かを判断する。具体的には、連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)であるとすると、Y座標値が値Y0未満であるエッジ点の座標データが、処理対象データに含まれているか否かを判断する。   In step S1060, the CPU 70 determines whether the coordinate data of the edge point located in the negative Y-axis direction from the point where the continuity is interrupted is included in the processing target data. Specifically, when the pixel position of the edge point immediately before the point where continuity is interrupted is (X, Y) = (X0, Y0), the coordinate data of the edge point whose Y coordinate value is less than the value Y0 is It is determined whether it is included in the processing target data.

そして、Y軸マイナス方向に位置するエッジ点の座標データが処理対象データに含まれていると判断すると(S1060でYes)、S1065に移行し、Y軸マイナス方向に位置するエッジ点の座標データが処理対象データに含まれていないと判断すると(S1060でNo)、S1090に移行する。   If it is determined that the coordinate data of the edge point located in the Y axis minus direction is included in the processing target data (Yes in S1060), the process proceeds to S1065, and the coordinate data of the edge point located in the Y axis minus direction is obtained. If it is determined that the data is not included in the processing target data (No in S1060), the process proceeds to S1090.

また、S1065に移行すると、CPU70は、検査開始点を、処理対象データに登録されたエッジ点であって、上記連続性が途切れる地点よりY軸マイナス方向に位置するY座標値が最大のエッジ点、換言すれば、上記連続性が途切れる地点に最も近いエッジ点に更新する。その後、S1025に移行し、新たな検査開始点を起点として、当該検査開始点よりY軸マイナス方向で、エッジ点の連続性が途切れる地点を探索する。   In step S1065, the CPU 70 sets the inspection start point as the edge point registered in the processing target data, and the edge point having the maximum Y coordinate value located in the negative Y-axis direction from the point where the continuity is interrupted. In other words, the edge point is updated to the edge point closest to the point where the continuity is interrupted. Thereafter, the process proceeds to S1025, and a point where the continuity of the edge points is interrupted in the negative Y-axis direction from the new inspection start point as a starting point is searched.

そして、連続性が途切れる地点がない場合には(S1030でNo)、S1070に移行し、検査開始点から、処理対象データに登録されたエッジ点であってY座標値が最小のエッジ点(以下、「Y値最小エッジ点」と称する。)までのY軸方向長さLを算出する。ここでは、検査開始点が座標(X,Y)=(Xs,Ys)であり、Y値最小エッジ点の画素位置が(X,Y)=(Xm,Ym)であるとすると、Y軸方向長さLとして、L=|Ys−Ym|を算出する。   If there is no point at which the continuity is interrupted (No in S1030), the process proceeds to S1070, and from the inspection start point, the edge point registered in the processing target data and having the smallest Y coordinate value (hereinafter referred to as the “Y” coordinate value). , Referred to as “Y value minimum edge point”). Here, assuming that the inspection start point is coordinates (X, Y) = (Xs, Ys) and the pixel position of the Y value minimum edge point is (X, Y) = (Xm, Ym), the Y-axis direction As the length L, L = | Ys−Ym | is calculated.

また、この処理を終えると、CPU70は、S1080に移行して、変数Lの現在値が、変数LMAXより大きいか否かを判断し、変数Lの現在値が、変数LMAXより大きいと判断すると(S1080でYes)、処理対象データに登録されたエッジ点であって検査開始点からY値最小エッジ点までの区間に位置するエッジ点の集合を、最も長く連続するエッジ点の集合であると判断し、この集合に属するエッジ点の各座標データを、最終候補データとして、S1055での処理と同様に、RAM80に記録する(S1085)。そして、この処理を終えると、S1090に移行する。   When this process is finished, the CPU 70 proceeds to S1080, determines whether or not the current value of the variable L is greater than the variable LMAX, and determines that the current value of the variable L is greater than the variable LMAX ( (Yes in S1080), it is determined that the set of edge points that are registered in the processing target data and located in the section from the inspection start point to the minimum Y value edge point is the longest continuous edge point set. Then, the coordinate data of the edge points belonging to this set is recorded in the RAM 80 as final candidate data in the same manner as the processing in S1055 (S1085). Then, when this process ends, the process proceeds to S1090.

また、S1090に移行すると、CPU70は、その時点で最終候補データとしてRAM80に登録されているエッジ点以外の各エッジ点の座標データを、処理対象データから削除して、処理対象データを更新する。その後、当該第一エッジ確定処理を終了する。   In step S1090, the CPU 70 deletes the coordinate data of each edge point other than the edge points registered in the RAM 80 as final candidate data at that time from the processing target data, and updates the processing target data. Thereafter, the first edge determination process ends.

第一エッジ確定処理では、このようにして、Y軸方向に最も長く連続するエッジ点の集合を、原稿エッジとして確度の高いエッジ点であると取り扱い、この集合に属するエッジ点以外のエッジ点の座標データを処理対象データから削除することで、処理対象データから、原稿エッジとして確度の低い座標データを削除する。   In the first edge determination process, a set of edge points that are longest and continuous in the Y-axis direction is treated as a highly accurate edge point as a document edge in this way, and edge points other than the edge points belonging to this set are handled. By deleting the coordinate data from the processing target data, the coordinate data having low accuracy as the document edge is deleted from the processing target data.

尚、図15は、第一変形例での原稿右エッジデータの確定手法を示した説明図である。
図15に示す例では、変数Lの値として計測された連続するエッジ点の集合の長さが夫々、L[0],L[1],L[2]であり、その大小関係がL[1]>L[2]>L[0]であるので、長さL[1]のエッジ点の集合が、右エッジとして確度の高いエッジ点の集合であると取り扱って、この集合に属するエッジ点の座標データのみを原稿右エッジデータに残して、原稿右エッジデータを確定する。そして、最終的に、このエッジ点の集合から、右エッジ近似直線を求める。
FIG. 15 is an explanatory diagram showing a method for determining document right edge data in the first modification.
In the example illustrated in FIG. 15, the lengths of sets of continuous edge points measured as the value of the variable L are L [0], L [1], and L [2], respectively, and the magnitude relationship is L [0]. Since 1]> L [2]> L [0], the set of edge points of length L [1] is treated as a set of edge points with high accuracy as the right edge, and the edges belonging to this set Only the point coordinate data is left in the document right edge data, and the document right edge data is determined. Finally, a right edge approximate straight line is obtained from the set of edge points.

このような手順により、第一変形例では、S590において原稿右エッジデータを確定し、S790において原稿左エッジデータを確定する。
一方、S890においては、原稿下エッジデータを処理対象データに設定して、図16に示す第二エッジ確定処理を実行することにより、当該原稿下エッジデータを確定する。尚、図16は、第一変形例において、CPU70が実行する第二エッジ確定処理を表すフローチャートである。
According to such a procedure, in the first modification, the document right edge data is determined in S590, and the document left edge data is determined in S790.
On the other hand, in S890, the document lower edge data is set as processing target data, and the second edge determination process shown in FIG. 16 is executed to determine the document lower edge data. FIG. 16 is a flowchart showing the second edge determination process executed by the CPU 70 in the first modification.

図16に示す第二エッジ確定処理を開始すると、CPU70は、まず、変数LMAXを値ゼロに初期化する(S1110)。その後、S1115に移行して、予め設定された処理対象データが、少なくとも8つ以上のエッジ点の座標データを含むものであるか否かを判断する。   When the second edge determination process shown in FIG. 16 is started, the CPU 70 first initializes a variable LMAX to a value of zero (S1110). Thereafter, the process proceeds to S1115, and it is determined whether or not the preset processing target data includes coordinate data of at least eight edge points.

そして、処理対象データが8つ以上のエッジ点の座標データを含むものであると判断すると(S1115でYes)、S1120に移行し、処理対象データが8つ以上のエッジ点の座標データを含むものではないと判断すると(S1115でNo)、S1120〜S1190の処理を実行することなく、当該第二エッジ確定処理を終了する。   If it is determined that the processing target data includes coordinate data of eight or more edge points (Yes in S1115), the process proceeds to S1120, and the processing target data does not include coordinate data of eight or more edge points. (No in S1115), the second edge determination process is terminated without executing the processes in S1120 to S1190.

一方、S1120に移行すると、CPU70は、S920での処理と同様に、処理対象データに登録されたエッジ点であって、X座標値が最大のエッジ点を、検査開始点に設定する。その後、S1125に移行する。   On the other hand, when the process proceeds to S1120, the CPU 70 sets the edge point registered in the processing target data and having the maximum X coordinate value as the inspection start point, similarly to the process in S920. Thereafter, the process proceeds to S1125.

また、S1125に移行すると、CPU70は、S930での処理と同様に、検査開始点からX軸マイナス方向に、処理対象データに登録されたエッジ点を辿り、連続するエッジ点の当該連続性が途切れる地点を探索する。即ち、S1125では、検査開始点に対応するエッジ点の座標データから、処理対象データを、X軸マイナス方向に遡るようにして参照して、最初に現れる区分けコードを検出する。   When the process proceeds to S1125, the CPU 70 follows the edge point registered in the processing target data in the X axis minus direction from the inspection start point in the same manner as the process in S930, and the continuity of the continuous edge points is interrupted. Search for a point. That is, in S1125, from the coordinate data of the edge point corresponding to the inspection start point, the processing target data is referred back to the X-axis minus direction, and the first division code that appears is detected.

そして、区分けコードを検出できた場合には、連続性が途切れる地点があると判断して(S1130でYes)、S1140に移行し、区分けコードを検出できなかった場合には、連続性が途切れる地点がないと判断して(S1130でNo)、S1170に移行する。   If the segmentation code can be detected, it is determined that there is a point where continuity is interrupted (Yes in S1130), the process proceeds to S1140, and if the segmentation code cannot be detected, the point where continuity is interrupted (No in S1130), the process proceeds to S1170.

また、S1140に移行すると、CPU70は、検査開始点から、連続性が途切れる直前のエッジ点までのX軸方向長さLを算出する。ここでは、検査開始点が座標(X,Y)=(Xs,Ys)であり、連続性が途切れる地点直前のエッジ点、換言すれば、「連続性が途切れる地点よりもX軸プラス方向に位置するエッジ点であってX座標値が最小のエッジ点」の画素位置が(X,Y)=(X0,Y0)であるとすると、検査開始点から連続性が途切れる直前のエッジ点までのX軸方向長さLとして、L=|Xs−X0|を算出する。   In S1140, the CPU 70 calculates the length L in the X-axis direction from the inspection start point to the edge point immediately before the continuity is interrupted. Here, the inspection start point is coordinates (X, Y) = (Xs, Ys), in other words, the edge point immediately before the point where continuity is interrupted, in other words, “position in the X axis plus direction from the point where continuity is interrupted. Assuming that the pixel position of the edge point having the smallest X coordinate value is (X, Y) = (X0, Y0), the X from the inspection start point to the edge point immediately before the continuity is interrupted As the axial length L, L = | Xs−X0 | is calculated.

また、この処理を終えると、CPU70は、S1150に移行して、変数Lの現在値が、変数LMAXより大きいか否かを判断し、変数Lの現在値が、変数LMAXより大きいと判断すると(S1150でYes)、処理対象データに登録されたエッジ点であって検査開始点から連続性が途切れる直前までの区間に位置するエッジ点の集合を、最も長く連続するエッジ点の集合であると判断し、この集合に属するエッジ点の各座標データを、最終候補データとして、S1055での処理と同様に、RAM80に記録する(S1155)。   When this process is finished, the CPU 70 proceeds to S1150, determines whether or not the current value of the variable L is greater than the variable LMAX, and determines that the current value of the variable L is greater than the variable LMAX ( In S1150, Yes), it is determined that a set of edge points that are registered in the processing target data and are located in a section from the inspection start point to immediately before the continuity is interrupted is the longest continuous edge point set. Then, each coordinate data of the edge point belonging to this set is recorded as final candidate data in the RAM 80 as in the process in S1055 (S1155).

また、S1155での処理を終えると、CPU70は、S1157に移行し、変数LMAXの値を、変数Lの現在値に更新する(LMAX←L)。その後、S1160に移行する。   When the processing in S1155 is completed, the CPU 70 proceeds to S1157 and updates the value of the variable LMAX to the current value of the variable L (LMAX ← L). Thereafter, the process proceeds to S1160.

一方、変数Lの現在値が、変数LMAX以下であると判断すると(S1150でNo)、CPU70は、S1155,S1157の処理を実行することなく、S1160に移行する。   On the other hand, when determining that the current value of the variable L is equal to or smaller than the variable LMAX (No in S1150), the CPU 70 proceeds to S1160 without executing the processes of S1155 and S1157.

また、S1160に移行すると、CPU70は、上記連続性が途切れる地点よりX軸マイナス方向に、位置するエッジ点の座標データが、処理対象データに含まれているか否かを判断する。具体的には、連続性が途切れる地点直前のエッジ点の画素位置が(X,Y)=(X0,Y0)であるとすると、X座標値が値X0未満であるエッジ点の座標データが、処理対象データに含まれているか否かを判断する。   In step S1160, the CPU 70 determines whether or not the processing target data includes coordinate data of edge points located in the X-axis minus direction from the point where the continuity is interrupted. Specifically, if the pixel position of the edge point immediately before the point where continuity is interrupted is (X, Y) = (X0, Y0), the coordinate data of the edge point whose X coordinate value is less than the value X0 is It is determined whether it is included in the processing target data.

そして、上記エッジ点の座標データが処理対象データに含まれていると判断すると(S1160でYes)、S1165に移行し、上記エッジ点の座標データが処理対象データに含まれていないと判断すると(S1160でNo)、S1190に移行する。   If it is determined that the coordinate data of the edge point is included in the processing target data (Yes in S1160), the process proceeds to S1165 and if it is determined that the coordinate data of the edge point is not included in the processing target data ( No in S1160), the process proceeds to S1190.

また、S1165に移行すると、CPU70は、検査開始点を、上記連続性が途切れる地点よりX軸マイナス方向に位置する上記処理対象データに登録されたエッジ点であって、X座標値が最大のエッジ点に更新する。その後、S1125に移行し、新たな検査開始点を起点として、当該検査開始点よりX軸マイナス方向で、エッジ点の連続性が途切れる地点を探索する。   In step S1165, the CPU 70 determines that the inspection start point is an edge point registered in the processing target data positioned in the X-axis minus direction from the point where the continuity is interrupted, and has the maximum X coordinate value. Update to point. Thereafter, the process proceeds to S1125, where a new inspection start point is set as a starting point, and a point where the continuity of edge points is interrupted in the X-axis minus direction from the inspection starting point is searched.

そして、連続性が途切れる地点がない場合には(S1130でNo)、S1170に移行して、検査開始点から、処理対象データに登録されたエッジ点であってX座標値が最小のエッジ点(以下、「X値最小エッジ点」と称する。)までのX軸方向長さLを算出する。ここでは、検査開始点が座標(X,Y)=(Xs,Ys)の地点であり、X値最小エッジ点の画素位置が(X,Y)=(Xm,Ym)であるとすると、X軸方向長さLとして、L=|Xs−Xm|を算出する。   If there is no point where continuity is interrupted (No in S1130), the process proceeds to S1170, and from the inspection start point, the edge point registered in the processing target data and having the smallest X coordinate value ( Hereinafter, the length L in the X-axis direction up to “X value minimum edge point”) is calculated. Here, if the inspection start point is a point of coordinates (X, Y) = (Xs, Ys) and the pixel position of the X value minimum edge point is (X, Y) = (Xm, Ym), X As the axial length L, L = | Xs−Xm | is calculated.

また、この処理を終えると、CPU70は、S1180に移行して、変数Lの現在値が、変数LMAXより大きいか否かを判断し、変数Lの現在値が、変数LMAXより大きいと判断すると(S1180でYes)、処理対象データに登録されたエッジ点であって検査開始点からX値最小エッジ点までの区間に位置するエッジ点の集合を、最も長く連続するエッジ点の集合であると判断し、この集合に属するエッジ点の各座標データを、最終候補データとして、S1085での処理と同様に、RAM80に記録する(S1185)。そして、この処理を終えると、S1190に移行する。   When this process ends, the CPU 70 proceeds to S1180, determines whether or not the current value of the variable L is greater than the variable LMAX, and determines that the current value of the variable L is greater than the variable LMAX ( In S1180, the edge point registered in the processing target data and located in the section from the inspection start point to the X value minimum edge point is determined to be the longest continuous edge point set. Then, the coordinate data of the edge points belonging to this set is recorded in the RAM 80 as final candidate data in the same manner as in S1085 (S1185). When this process is finished, the flow shifts to S1190.

また、S1190に移行すると、CPU70は、その時点で最終候補データとしてRAM80に登録されているエッジ点以外の各エッジ点の座標データを、処理対象データから削除して、処理対象データを更新する。その後、当該第二エッジ確定処理を終了する。   In step S1190, the CPU 70 deletes the coordinate data of each edge point other than the edge points registered in the RAM 80 as final candidate data at that time from the processing target data, and updates the processing target data. Thereafter, the second edge determination process ends.

第二エッジ確定処理では、このようにして、X軸方向に最も長く連続するエッジ点の集合を、原稿エッジとして確度の高いエッジ点であると取り扱い、この集合に属するエッジ点以外のエッジ点の座標データを処理対象データから削除することで、処理対象データから、原稿エッジとして確度の低い座標データを削除する。   In the second edge determination process, a set of edge points that are longest in the X-axis direction is treated as a highly accurate edge point as a document edge in this way, and edge points other than the edge points belonging to this set are handled. By deleting the coordinate data from the processing target data, the coordinate data having low accuracy as the document edge is deleted from the processing target data.

このようにして、第一変形例では、X軸方向に最も長く連続するエッジ点の集合に属するエッジ点の座標データのみを原稿下エッジデータに残して、原稿下エッジデータを確定する。そして、最終的に、このエッジ点の集合から、下エッジ近似直線を求める。   In this way, in the first modification, only the coordinate data of the edge points belonging to the set of edge points that are longest in the X-axis direction are left in the document lower edge data, and the document lower edge data is determined. Finally, a lower edge approximate straight line is obtained from the set of edge points.

以上、第一変形例について説明したが、第一変形例では、最も長く連続するエッジ点の集合を最も原稿エッジとして確度の高いエッジ点の集合として取り扱って、右エッジ近似直線、左エッジ近似直線、及び、下エッジ近似直線を求めるようにした。   The first modification has been described above. In the first modification, the longest continuous edge point set is treated as the most accurate edge point set as the document edge, and the right edge approximate straight line and the left edge approximate straight line are handled. And a lower edge approximate straight line.

従って、第一変形例によれば、原稿内部の罫線や埃等に惑わされて、原稿エッジの近似直線として誤った近似直線を求めてしまうのを、極力防止することができて、一部領域のプレスキャン程度で、高精度に、原稿サイズや原稿の傾き角、原稿の載置領域を推定することができる。   Therefore, according to the first modification, it is possible to prevent as much as possible from obtaining an approximate straight line as an approximate straight line of the document edge by being confused by ruled lines or dust inside the original, Thus, it is possible to estimate the document size, the inclination angle of the document, and the document placement area with high accuracy.

[第二変形例]
続いて、第二変形例について説明する。但し、第二変形例の複合機は、S590,S790で実行する第一エッジ確定処理及びS890で実行する第二エッジ確定処理の内容が一部変更された程度のものであり、他の構成は、上述した実施例の複合機1と同一であるので、以下では、上記実施例と同一構成の部位についての説明を適宜省略する。
[Second modification]
Subsequently, a second modification will be described. However, the MFP of the second modified example is such that the contents of the first edge determination process executed in S590 and S790 and the contents of the second edge determination process executed in S890 are partially changed. Since it is the same as the multifunction device 1 of the above-described embodiment, the description of the parts having the same configuration as the above-described embodiment will be appropriately omitted below.

図17は、第二変形例において、CPU70が実行する第一エッジ確定処理を表すフローチャートである。
CPU70は、S590又はS790で、図17に示す第一エッジ確定処理を開始すると、まず、S1210にて、予め設定された処理対象データが、少なくとも8つ以上のエッジ点の座標データを含むものであるか否かを判断する。
FIG. 17 is a flowchart showing a first edge determination process executed by the CPU 70 in the second modification.
When the CPU 70 starts the first edge determination process shown in FIG. 17 in S590 or S790, first, in S1210, whether the preset processing target data includes coordinate data of at least eight or more edge points. Judge whether or not.

そして、処理対象データが8つ以上のエッジ点の座標データを含むものであると判断すると(S1210でYes)、S1220に移行し、処理対象データが8つ以上のエッジ点の座標データを含むものではないと判断すると(S1210でNo)、S1220〜S1290の処理を実行することなく、当該第一エッジ確定処理を終了する。   If it is determined that the processing target data includes coordinate data of eight or more edge points (Yes in S1210), the process proceeds to S1220, and the processing target data does not include coordinate data of eight or more edge points. (No in S1210), the first edge determination process is terminated without executing the processes in S1220 to S1290.

一方、S1220に移行すると、CPU70は、S620での処理と同様に、処理対象データに登録されたエッジ点であって、Y座標値が最大のエッジ点を、検査開始点に設定する。その後、S1230に移行する。   On the other hand, when the process proceeds to S1220, the CPU 70 sets the edge point registered in the processing target data and having the maximum Y coordinate value as the inspection start point, similarly to the process in S620. Thereafter, the process proceeds to S1230.

また、S1230に移行すると、CPU70は、検査開始点を1つ目のエッジ点として、処理対象データから、Y軸マイナス方向に続く計8個のエッジ点の座標データを抽出する。但し、検査開始点から8つ目のエッジ点までの区間において連続性が途切れる地点がある場合、即ち、区分けコードが挿入されている場合には(以下、「ケースA」と称する。)、8個のエッジ点の座標データを抽出せずに、検査開始点からその連続性が途切れる地点の直前までのエッジ点を抽出する。同様に、検査開始点からY軸マイナス方向に位置するエッジ点が8個未満である場合には(以下、「ケースB」と称する。)、検査開始点から終端のエッジ点(即ちY値最小エッジ点)までのエッジ点を抽出する。   In step S1230, the CPU 70 extracts coordinate data of a total of eight edge points in the Y-axis minus direction from the processing target data with the inspection start point as the first edge point. However, when there is a point where continuity is interrupted in the section from the inspection start point to the eighth edge point, that is, when a segmentation code is inserted (hereinafter referred to as “Case A”), 8 Without extracting the coordinate data of the individual edge points, the edge points from the inspection start point to just before the point where the continuity is interrupted are extracted. Similarly, when the number of edge points located in the Y-axis minus direction from the inspection start point is less than 8 (hereinafter referred to as “case B”), the edge point from the inspection start point to the end point (that is, the minimum Y value). Edge points up to (edge point) are extracted.

また、S1230での処理を終えると、CPU70は、S1235に移行し、S1230での抽出過程でケースA及びケースBのいずれか一方の事象が発生したか否かを判断し、ケースA及びケースBのいずれか一方の事象が発生したと判断した場合には(S1235でYes)、S1260に移行し、ケースA及びケースBのいずれの事象も発生しなかったと判断した場合には(S1235でNo)、S1240に移行する。   When the process in S1230 is completed, the CPU 70 proceeds to S1235, determines whether any one of the cases A and B occurs in the extraction process in S1230, and the case A and the case B. If it is determined that one of the events has occurred (Yes in S1235), the process proceeds to S1260, and if it is determined that neither event in Case A or Case B has occurred (No in S1235). , The process proceeds to S1240.

また、S1240に移行すると、CPU70は、直前のS1230で抽出した計8個のエッジ点の座標データを用いて、これらエッジ点の近似直線を算出し、この後には、算出した近似直線の傾き及び切片の値を、当該近似直線の算出に用いたエッジ点の座標データと関連付けて、RAM80に記憶する(S1245)。その後、S1250に移行する。   In S1240, the CPU 70 uses the coordinate data of the eight edge points extracted in the previous S1230 to calculate approximate lines of these edge points, and thereafter, calculates the slopes of the calculated approximate lines and The intercept value is stored in the RAM 80 in association with the coordinate data of the edge point used for calculating the approximate straight line (S1245). Thereafter, the process proceeds to S1250.

また、S1250に移行すると、CPU70は、S1230で抽出したエッジ点の内、Y座標値が最小のエッジ点を基準にして、当該Y座標値が最小のエッジ点よりY軸マイナス方向に位置するエッジ点が、処理対象データに登録されているか否かを判断する。即ち、上記基準とするエッジ点の画素位置が(X,Y)=(X0,Y0)である場合、Y座標値がY0未満のエッジ点が処理対象データに登録されているか否かを判断する。   In step S1250, the CPU 70 uses the edge point extracted in step S1230 as the reference to the edge point having the smallest Y coordinate value, and the edge located in the Y axis minus direction from the edge point having the smallest Y coordinate value. It is determined whether or not the point is registered in the processing target data. That is, when the pixel position of the reference edge point is (X, Y) = (X0, Y0), it is determined whether or not an edge point having a Y coordinate value less than Y0 is registered in the processing target data. .

そして、上記基準とするエッジ点よりY軸マイナス方向に位置するエッジ点が、処理対象データに登録されていると判断すると(S1250でYes)、検査開始点を、上記基準とするエッジ点よりY軸マイナス方向に位置するエッジ点であって、Y座標値が最大のエッジ点に更新する(S1255)。その後、S1230に移行する。   When it is determined that an edge point located in the Y-axis minus direction from the reference edge point is registered in the processing target data (Yes in S1250), the inspection start point is set to Y from the reference edge point. The edge point located in the axis minus direction is updated to the edge point having the maximum Y coordinate value (S1255). Thereafter, the process proceeds to S1230.

このようにして、CPU70は、S1230〜S1255の処理を繰返し実行し、処理対象データに登録されたエッジ点の近似直線を、8個のエッジ点からなる小グループ毎に求めて、各小グループの近似直線の傾き及び切片の値を、その近似直線の算出に用いたエッジ点の座標データと関連付け、RAM80に蓄積する。   In this way, the CPU 70 repeatedly executes the processing of S1300 to S1255, obtains an approximate straight line of edge points registered in the processing target data for each small group of eight edge points, and calculates each small group. The slope and intercept values of the approximate line are associated with the coordinate data of the edge point used for calculating the approximate line and stored in the RAM 80.

そして、Y軸マイナス方向に位置するエッジ点が、処理対象データ内でなくなると(S1250でNo)、CPU70は、S1270に移行する。この他、S1230〜S1255の処理を繰返し実行する過程で、上記ケースA及びケースBのいずれか一方の事象が発生し(S1235でYes)、S1260に移行した場合には、発生した事象がケースBであるか否かを判断し、発生した事象がケースAである場合には(S1260でNo)、S1250に移行して、後続のエッジ点について、S1230〜S1255の処理を実行するが、発生した事象がケースBである場合には、近似直線の算出を止めて、S1270に移行する。   When the edge point located in the negative Y-axis direction is not in the processing target data (No in S1250), the CPU 70 proceeds to S1270. In addition, in the process of repeatedly executing the processing of S1230 to S1255, one of the cases A and B occurs (Yes in S1235), and when the process proceeds to S1260, the generated event is case B. If the generated event is case A (No in S1260), the process proceeds to S1250, and the processing of S1230 to S1255 is executed for the subsequent edge points. If the event is case B, the calculation of the approximate line is stopped and the process proceeds to S1270.

また、S1270に移行すると、CPU70は、それまでに算出しRAM80に記録した各小グループの近似直線の傾きから、傾きについてのヒストグラムデータを生成する(S1270)。尚、図18は、S1270で生成する傾きのヒストグラムデータを、グラフ化して示した説明図である。   In S1270, the CPU 70 generates histogram data about the inclination from the inclination of the approximate straight line of each small group calculated and recorded in the RAM 80 (S1270). FIG. 18 is an explanatory diagram showing the histogram data of the slope generated in S1270 as a graph.

本変形例では、近似直線が採りうる傾きの範囲を複数のクラスに区分することで、傾きに対して複数のクラスを設定している。S1270では、各小グループの傾きを、その値に応じたクラスに分類し、各クラスの度数を算出することで、傾きのヒストグラムデータを生成する。   In this modification, a plurality of classes are set for the inclination by dividing the range of inclination that the approximate straight line can take into a plurality of classes. In S1270, the inclination of each small group is classified into classes according to the values, and the histogram data of the inclination is generated by calculating the frequency of each class.

そして、傾きのヒストグラムデータから、傾きについて度数が最大のクラスを特定し、処理対象データの中から、度数が最大のクラスに属する傾きの近似直線を算出するに至った小グループ(エッジ点の集合)の全てを選択する(S1275)。   Then, from the histogram data of the slope, the class having the highest frequency is specified for the slope, and the small group (set of edge points) from which the approximate straight line of the slope belonging to the class having the highest frequency is calculated from the processing target data. ) Are selected (S1275).

また、S1275での処理を終えると、CPU70は、RAM80に蓄積された各小グループの近似直線の切片の情報に基づき、S1275で選択した各小グループの近似直線の切片についてのヒストグラムデータを生成する(S1280)。   When the processing in S1275 is finished, the CPU 70 generates histogram data for the intercepts of the approximate straight lines of each small group selected in S1275 based on the information of the intercepts of the approximate straight lines of each small group accumulated in the RAM 80. (S1280).

即ち、RAM80に蓄積された各小グループの近似直線の切片の情報の中から、S1275で選択した小グループについての切片の情報を選択的に用いて、切片についてのヒストグラムデータを生成する。   That is, from the information of the intercept of the approximate straight line of each small group stored in the RAM 80, the intercept data for the small group selected in S1275 is selectively used to generate histogram data for the intercept.

尚、本変形例では、近似直線が採りうる切片の範囲を複数のクラスに区分することで、切片に対して複数のクラスを設定している。S1280では、S1275で選択した各小グループの切片を、その値に応じたクラスに分類して、各クラスの度数を算出することで、切片のヒストグラムデータを生成する。   In this modification, a plurality of classes are set for the intercept by dividing the range of the intercept that the approximate straight line can take into a plurality of classes. In S1280, the intercept of each small group selected in S1275 is classified into classes according to the values, and the frequency of each class is calculated to generate histogram data of the intercept.

そして、切片のヒストグラムデータから、切片について度数が最大のクラスを特定し、S1275で選択した小グループ群の中から、当該特定したクラスに属する切片の近似直線を算出するに至った小グループの全てを選択する(S1285)。   Then, from the histogram data of the intercept, the class having the highest frequency for the intercept is identified, and all of the small groups that have led to the calculation of the approximate straight line of the intercept belonging to the identified class from the small group group selected in S1275. Is selected (S1285).

そして、S1285での処理を終えると、CPU70は、S1290に移行し、S1285で選択した小グループに属するエッジ点以外のエッジ点の座標データを、処理対象データから削除して、処理対象データ内に、S1285で選択した小グループに属するエッジ点の座標データのみが残るように、処理対象データを更新する。その後、当該第一エッジ確定処理を終了する。   After completing the processing in S1285, the CPU 70 proceeds to S1290, deletes the coordinate data of the edge points other than the edge points belonging to the small group selected in S1285 from the processing target data, and stores them in the processing target data. , The processing target data is updated so that only the coordinate data of the edge points belonging to the small group selected in S1285 remains. Thereafter, the first edge determination process ends.

このようにして、第二変形例の第一エッジ確定処理では、度数の最も高い近似直線が算出された小グループの集合を、原稿エッジである確度の高いエッジ点の集合であると取り扱って、これらのエッジ点の座標データのみが残るように、処理対象データを更新する。   In this way, in the first edge determination process of the second modified example, the set of small groups for which the approximate straight line with the highest frequency is calculated is treated as a set of edge points with a high probability of being document edges, The processing target data is updated so that only the coordinate data of these edge points remains.

このような手順により、第二変形例では、S590において原稿右エッジデータを確定し、S790において原稿左エッジデータを確定する。
一方、S890においては、原稿下エッジデータを処理対象データに設定して、図19に示す第二エッジ確定処理を実行することにより、当該原稿下エッジデータを確定する。尚、図19は、第二変形例において、CPU70が実行する第二エッジ確定処理を表すフローチャートである。
According to such a procedure, in the second modification, the document right edge data is determined in S590, and the document left edge data is determined in S790.
On the other hand, in S890, the document lower edge data is set as processing target data, and the second edge determination process shown in FIG. 19 is executed to determine the document lower edge data. FIG. 19 is a flowchart illustrating a second edge determination process executed by the CPU 70 in the second modification.

図19に示す第二エッジ確定処理を開始すると、CPU70は、まず、S1310にて、予め設定された処理対象データが、少なくとも8つ以上のエッジ点の座標データを含むものであるか否かを判断する。   When the second edge determination process shown in FIG. 19 is started, the CPU 70 first determines in S1310 whether the preset processing target data includes coordinate data of at least eight or more edge points. .

そして、処理対象データが8つ以上のエッジ点の座標データを含むものであると判断すると(S1310でYes)、S1320に移行し、処理対象データが8つ以上のエッジ点の座標データを含むものではないと判断すると(S1310でNo)、S1320〜S1390の処理を実行することなく、当該第二エッジ確定処理を終了する。   If it is determined that the processing target data includes coordinate data of eight or more edge points (Yes in S1310), the process proceeds to S1320, and the processing target data does not include coordinate data of eight or more edge points. (No in S1310), the second edge determination process is terminated without executing the processes in S1320 to S1390.

一方、S1320に移行すると、CPU70は、S920での処理と同様に、処理対象データに登録されたエッジ点であって、X座標値が最大のエッジ点を、検査開始点に設定する。その後、S1330に移行する。   On the other hand, when the process proceeds to S1320, the CPU 70 sets the edge point registered in the processing target data and having the maximum X coordinate value as the inspection start point, similarly to the process in S920. Thereafter, the process proceeds to S1330.

また、S1330に移行すると、CPU70は、検査開始点を1つ目のエッジ点として、処理対象データから、X軸マイナス方向に続く計8個のエッジ点の座標データを抽出する。但し、検査開始点から8つ目のエッジ点までの区間において連続性が途切れる地点がある場合、即ち、区分けコードが挿入されている地点がある場合には(ケースA)、8個のエッジ点の座標データを抽出せずに、検査開始点からその連続性が途切れる地点の直前までのエッジ点を抽出する。同様に、検査開始点からX軸マイナス方向に続くエッジ点が8個未満である場合には(以下、「ケースC」と称する。)、検査開始点から終端のエッジ点(即ちX値最小エッジ点)までのエッジ点を抽出する。   In step S1330, the CPU 70 extracts coordinate data of a total of eight edge points that follow the X-axis minus direction from the processing target data with the inspection start point as the first edge point. However, if there is a point where continuity is interrupted in the section from the inspection start point to the eighth edge point, that is, if there is a point where a segmentation code is inserted (case A), eight edge points Without extracting the coordinate data, the edge points from the inspection start point to just before the point where the continuity is interrupted are extracted. Similarly, when there are less than eight edge points in the X-axis minus direction from the inspection start point (hereinafter referred to as “Case C”), the edge point from the inspection start point to the end edge (that is, the X value minimum edge). Edge points up to point) are extracted.

また、S1330での処理を終えると、CPU70は、S1335に移行し、S1330での抽出過程でケースA及びケースCのいずれか一方の事象が発生したか否かを判断し、ケースA及びケースCのいずれか一方の事象が発生したと判断した場合には(S1335でYes)、S1360に移行し、ケースA及びケースCのいずれの事象も発生しなかったと判断した場合には(S1335でNo)、S1340に移行する。   When the process in S1330 is completed, the CPU 70 proceeds to S1335, determines whether one of the cases A and C occurs in the extraction process in S1330, and the case A and the case C. If it is determined that one of the events has occurred (Yes in S1335), the process proceeds to S1360, and if it is determined that neither event in Case A or Case C has occurred (No in S1335). , The process proceeds to S1340.

また、S1340に移行すると、CPU70は、直前のS1330で抽出した計8個のエッジ点の座標データを用いて、これらエッジ点の近似直線を算出し、この後には、上記算出した近似直線の傾き及び切片の値を、当該近似直線の算出に用いたエッジ点の座標データと関連付けて、RAM80に記憶する(S1345)。その後、S1350に移行する。   In S1340, the CPU 70 uses the coordinate data of the eight edge points extracted in the immediately preceding S1330 to calculate approximate lines of these edge points, and thereafter, calculates the slope of the calculated approximate line. And the value of the intercept is stored in the RAM 80 in association with the coordinate data of the edge point used for the calculation of the approximate straight line (S1345). Thereafter, the process proceeds to S1350.

また、S1350に移行すると、CPU70は、S1330で抽出したエッジ点の内、X座標値が最小のエッジ点を基準にして、当該X座標値が最小のエッジ点よりX軸マイナス方向に位置するエッジ点が、処理対象データに登録されているか否かを判断する。即ち、上記基準とするX座標値が最小のエッジ点の画素位置が(X,Y)=(X0,Y0)である場合、X座標値がX0未満のエッジ点が処理対象データに登録されているか否かを判断する。   In step S1350, the CPU 70 uses the edge point having the smallest X coordinate value as the reference among the edge points extracted in step S1330, and sets the edge located in the X axis minus direction from the edge point having the smallest X coordinate value. It is determined whether or not the point is registered in the processing target data. That is, when the pixel position of the edge point having the minimum X coordinate value as the reference is (X, Y) = (X0, Y0), an edge point having an X coordinate value less than X0 is registered in the processing target data. Determine whether or not.

そして、上記基準のエッジ点よりX軸マイナス方向に位置するエッジ点が、処理対象データに登録されていると判断すると(S1350でYes)、検査開始点を、上記基準のエッジ点よりX軸マイナス方向に位置するエッジ点であって、X座標値が最大のエッジ点に更新する(S1355)。その後、S1330に移行する。   If it is determined that an edge point located in the minus direction of the X axis from the reference edge point is registered in the processing target data (Yes in S1350), the inspection start point is minus the X axis from the reference edge point. The edge point located in the direction and having the maximum X coordinate value is updated (S1355). Thereafter, the process proceeds to S1330.

このようにして、CPU70は、S1330〜S1355の処理を繰返し実行し、処理対象データに登録されたエッジ点の近似直線を、8個のエッジ点からなる小グループ毎に求め、各小グループの近似直線の傾き及び切片の値を、その近似直線の算出に用いたエッジ点の座標データと関連付けて、RAM80に蓄積する。   In this manner, the CPU 70 repeatedly executes the processing of S1330 to S1355, obtains an approximate straight line of edge points registered in the processing target data for each small group of eight edge points, and approximates each small group. The values of the slope and intercept of the straight line are stored in the RAM 80 in association with the coordinate data of the edge point used for calculating the approximate straight line.

そして、X軸マイナス方向に位置するエッジ点が、処理対象データ内でなくなると(S1350でNo)、CPU70は、S1370に移行する。この他、S1330〜S1355の処理を繰返し実行する過程で、上記ケースA及びケースCのいずれか一方の事象が発生し(S1335でYes)、S1360に移行した場合には、発生した事象がケースCであるか否かを判断し、発生した事象がケースAである場合には(S1360でNo)、S1350に移行して、後続のエッジ点について、S1330〜S1355の処理を実行するが、発生した事象がケースCである場合には、近似直線の算出を止めて、S1370に移行する。   Then, when the edge point located in the X-axis minus direction is not in the processing target data (No in S1350), the CPU 70 proceeds to S1370. In addition, in the process of repeatedly executing the processing of S1330 to S1355, one of the cases A and C occurs (Yes in S1335), and when the process proceeds to S1360, the generated event is case C. If the generated event is case A (No in S1360), the process proceeds to S1350 and the processing of S1330 to S1355 is executed for the subsequent edge points. When the event is case C, the calculation of the approximate line is stopped and the process proceeds to S1370.

また、S1370に移行すると、CPU70は、それまでに算出しRAM80に記録した各小グループの近似直線の傾きから、S1270での処理と同様に、傾きのヒストグラムデータを生成する。   In step S1370, the CPU 70 generates histogram data of inclination from the inclination of the approximate straight line of each small group calculated so far and recorded in the RAM 80 in the same manner as the processing in step S1270.

そして、傾きのヒストグラムデータから、傾きについて度数が最大のクラスを特定し、処理対象データの中から、度数が最大のクラスに属する傾きの近似直線を算出するに至った小グループの全てを選択する(S1375)。   Then, from the histogram data of the slope, the class with the highest frequency is specified for the slope, and from the processing target data, all of the small groups that have come to calculate the approximate straight line of the slope belonging to the class with the highest frequency are selected. (S1375).

また、S1375での処理を終えると、CPU70は、RAM80に蓄積された各小グループの近似直線の切片の情報に基づき、S1375で選択した各小グループの近似直線の切片についてのヒストグラムデータを生成する(S1380)。即ち、RAM80に蓄積された各小グループの近似直線の切片の情報の中から、S1375で選択した小グループについての切片の情報を選択的に用いて、切片についてのヒストグラムデータを生成する。具体的には、S1280での処理と同様、S1375で選択した各小グループの切片を、その値に応じたクラスに分類して、各クラスの度数を算出することで、切片のヒストグラムデータを生成する。   When the processing in S1375 is finished, the CPU 70 generates histogram data for the intercepts of the approximate straight lines of each small group selected in S1375 based on the information on the intercepts of the approximate straight lines of each small group accumulated in the RAM 80. (S1380). That is, from the information of the intercept of the approximate straight line of each small group stored in the RAM 80, the intercept data for the small group selected in S1375 is selectively used to generate histogram data for the intercept. Specifically, similar to the processing in S1280, the intercept of each small group selected in S1375 is classified into classes according to the values, and the histogram data of the intercept is generated by calculating the frequency of each class. To do.

その後、CPU70は、切片のヒストグラムデータから、切片について度数が最大のクラスを特定し、S1375で選択した小グループ群の中から、当該特定したクラスに属する切片の近似直線を算出するに至った小グループの全てを選択する(S1385)。   Thereafter, the CPU 70 identifies the class having the highest frequency for the intercept from the histogram data of the intercept, and calculates the approximate straight line of the intercept belonging to the identified class from the small group group selected in S1375. All the groups are selected (S1385).

そして、S1385での処理を終えると、CPU70は、S1390に移行し、S1385で選択した小グループに属するエッジ点以外のエッジ点の座標データを、処理対象データから削除して、処理対象データ内に、S1385で選択した小グループに属するエッジ点の座標データのみが残るように、処理対象データを更新する。その後、当該第二エッジ確定処理を終了する。   When the processing in S1385 is completed, the CPU 70 proceeds to S1390, deletes the coordinate data of the edge points other than the edge points belonging to the small group selected in S1385 from the processing target data, and stores them in the processing target data. , The processing target data is updated so that only the coordinate data of the edge points belonging to the small group selected in S1385 remain. Thereafter, the second edge determination process ends.

このようにして、第二変形例の第二エッジ確定処理では、度数の最も高い近似直線が算出された小グループの集合を、原稿エッジ(下エッジ)である確度の高いエッジ点の集合であると取り扱って、これらのエッジ点の座標データのみが残るように、処理対象データを更新する。このような手順により、第二変形例では、S890において原稿下エッジデータを確定する。   In this way, in the second edge determination process of the second modification, the set of small groups for which the approximate straight line having the highest frequency is calculated is the set of edge points with high accuracy that are the document edges (lower edges). And the processing target data is updated so that only the coordinate data of these edge points remains. According to such a procedure, in the second modified example, the document lower edge data is determined in S890.

以上、第二変形例について説明したが、第二変形例では、度数の最も高い近似直線が算出された小グループの集合を、原稿エッジとしての確度の高いエッジ点の集合として取り扱い、右エッジ近似直線、左エッジ近似直線、及び、下エッジ近似直線を求める。   Although the second modification has been described above, in the second modification, a set of small groups for which an approximate straight line having the highest frequency is calculated is treated as a set of edge points with high accuracy as document edges, and right edge approximation is performed. A straight line, a left edge approximate line, and a lower edge approximate line are obtained.

従って、第二変形例によれば、原稿内部の罫線や埃等に惑わされて、原稿エッジの近似直線として誤った近似直線を求めてしまうのを、極力防止することができ、一部領域のプレスキャン程度で、高精度に、原稿サイズや原稿の傾き角、原稿の載置領域を推定することができる。
[特許請求の範囲との対応関係]
以上、本発明の実施例について説明したが、本発明の画像読取装置が有する画像解析機能は、CPU70によりソフトウェア的に実現されている。また、読取制御手段は、読取制御部20により実現されている。
Therefore, according to the second modified example, it is possible to prevent as much as possible the determination of an incorrect approximate line as an approximate line of the document edge, which is confused by ruled lines, dust, etc. inside the document, It is possible to estimate the document size, the document inclination angle, and the document placement area with a high degree of accuracy by pre-scanning.
[Correspondence with Claims]
Although the embodiments of the present invention have been described above, the image analysis function of the image reading apparatus of the present invention is realized by the CPU 70 as software. The reading control unit is realized by the reading control unit 20.

また、変換手段は、CPU70が実行するS215の処理により実現され、選択手段は、CPU70が実行するS510〜S580,S710〜S780,S810〜S880の処理により実現されている。特に、「第一の方向とは垂直な第二の方向へ連続するエッジ点を探索する際の起点とするエッジ点を検出する」動作は、S525,S725,S825等の処理により実現されている。   The conversion means is realized by the processing of S215 executed by the CPU 70, and the selection means is realized by the processing of S510 to S580, S710 to S780, S810 to S880 executed by the CPU 70. In particular, the operation of “detecting an edge point as a starting point when searching for a continuous edge point in a second direction perpendicular to the first direction” is realized by processing such as S525, S725, and S825. .

この他、検出手段は、CPU70が実行するS590,S790,S890の処理により実現されている。特に、検査対象切替設定手段は、CPU70が実行するS620,S680の処理により実現されている。尚、上述した実施例では、一部領域のプレスキャンにより得られた画像データを検査対象データに設定して原稿エッジを検出しており、プレスキャン領域は、原稿台の中央より端側に位置しているので、Y座標値が最大のエッジ点を検査開始点に設定することで、最も原稿台の中央寄りのグループを検査対象のグループに設定する動作を実現している。   In addition, the detection means is realized by the processing of S590, S790, and S890 executed by the CPU. In particular, the inspection object switching setting means is realized by the processing of S620 and S680 executed by the CPU. In the above-described embodiment, image data obtained by pre-scanning a partial area is set as inspection target data to detect a document edge, and the pre-scan area is located on the end side from the center of the document table. Therefore, by setting the edge point having the maximum Y coordinate value as the inspection start point, the operation of setting the group closest to the center of the document table as the inspection target group is realized.

また、第一判定手段は、S650の処理により実現され、乖離度算出手段は、S660の処理により実現され、第二判定手段は、S670の処理により実現されている。
この他、近似直線算出手段は、S1240,S1340の処理により実現され、ヒストグラムデータ生成手段は、S1270,S1280,S1370,S1380の処理により実現されている。
[その他]
また、本発明は、上記実施例に限定されるものではなく、種々の態様を採ることができる。例えば、上記実施例では、コンタクトイメージセンサを読取ユニットとして備えるディジタル複合機1に、本発明を適用した例を説明したが、本発明は、コンタクトイメージセンサを読取ユニットとして備える画像読取装置に限定されるものではないことは言うまでもない。
Further, the first determination means is realized by the process of S650, the divergence degree calculation means is realized by the process of S660, and the second determination means is realized by the process of S670.
In addition, the approximate straight line calculation means is realized by the processes of S1240 and S1340, and the histogram data generation means is realized by the processes of S1270, S1280, S1370, and S1380.
[Others]
Further, the present invention is not limited to the above-described embodiments, and can take various forms. For example, in the above-described embodiment, the example in which the present invention is applied to the digital multifunction peripheral 1 including the contact image sensor as a reading unit has been described. However, the present invention is limited to an image reading apparatus including the contact image sensor as a reading unit. Needless to say, it is not something.

ディジタル複合機1の構成を表すブロック図である。1 is a block diagram illustrating a configuration of a digital multifunction machine 1. FIG. 読取ガラス11の読取可能領域R0を示した説明図である。It is explanatory drawing which showed readable area | region R0 of the reading glass. CPU70が実行する複写制御処理を表すフローチャートである。6 is a flowchart illustrating a copy control process executed by a CPU. CPU70が実行する自動変倍複写処理を表すフローチャートである。6 is a flowchart showing an automatic scaling copying process executed by a CPU. CPU70が実行する原稿推定処理を表すフローチャートである。6 is a flowchart showing document estimation processing executed by CPU. CPU70が実行する右エッジ検出処理を表すフローチャートである。It is a flowchart showing the right edge detection process which CPU70 performs. エッジ画像データの構成を示した説明図である。It is explanatory drawing which showed the structure of edge image data. CPU70が実行する第一エッジ確定処理を表すフローチャートである。It is a flowchart showing the 1st edge determination process which CPU70 performs. 原稿右エッジデータの確定手法を説明した説明図である。FIG. 6 is an explanatory diagram illustrating a method for determining original right edge data. CPU70が実行する左エッジ検出処理を表すフローチャートである。It is a flowchart showing the left edge detection process which CPU70 performs. CPU70が実行する下エッジ検出処理を表すフローチャートである。It is a flowchart showing the lower edge detection process which CPU70 performs. CPU70が実行する第二エッジ確定処理を表すフローチャートである。It is a flowchart showing the 2nd edge determination process which CPU70 performs. 原稿左下角位置及び原稿右下角位置の推定方法を示した説明図である。FIG. 5 is an explanatory diagram showing a method for estimating a document lower left corner position and a document lower right corner position. 第一変形例の第一エッジ確定処理を表すフローチャートである。It is a flowchart showing the 1st edge determination process of a 1st modification. 第一変形例における原稿右エッジデータの確定手法を表す説明図である。It is explanatory drawing showing the determination method of the original right edge data in a 1st modification. 第一変形例の第二エッジ確定処理を表すフローチャートである。It is a flowchart showing the 2nd edge confirmation process of a 1st modification. 第二変形例の第一エッジ確定処理を表すフローチャートである。It is a flowchart showing the 1st edge determination process of a 2nd modification. ヒストグラムデータを表す説明図である。It is explanatory drawing showing histogram data. 第二変形例の第二エッジ確定処理を表すフローチャートである。It is a flowchart showing the 2nd edge confirmation process of a 2nd modification.

符号の説明Explanation of symbols

1…ディジタル複合機、10…画像読取部、11…読取ガラス、11a…原稿台、13…筐体、13a…フレーム、15…読取ユニット、16…搬送機構、17…モータ、20…読取制御部、30…印刷部、40…印刷制御部、50…表示操作部、60…通信部、70…CPU、80…RAM、90…フラッシュメモリ、MK…マーク、P…原稿、R0…読取可能領域 DESCRIPTION OF SYMBOLS 1 ... Digital compound machine, 10 ... Image reading part, 11 ... Reading glass, 11a ... Original plate, 13 ... Housing | casing, 13a ... Frame, 15 ... Reading unit, 16 ... Conveyance mechanism, 17 ... Motor, 20 ... Reading control part , 30 ... printing section, 40 ... print control section, 50 ... display operation section, 60 ... communication section, 70 ... CPU, 80 ... RAM, 90 ... flash memory, MK ... mark, P ... original, R0 ... readable area

Claims (5)

読取対象の原稿が載置される原稿台と、
前記原稿台に載置された原稿を読み取るための読取ユニットと、
前記読取ユニットに、前記原稿台に載置された原稿を読み取らせることにより、前記原稿台に載置された原稿の読取画像を表す画像データを生成する読取制御手段と、
前記読取制御手段により生成された画像データを、エッジ画像を表す画像データに変換する変換手段と、
特定方向に延びる原稿の端縁、を表すエッジ点の候補を、所定の規則に従って、前記変換手段による変換後の画像データから選択する手段であって、前記変換後の画像データの端点を、参照開始位置に設定して、この画像データを構成する各画素の画素値を、前記設定した参照開始位置から、予め定められた第一の方向に沿って、前記画像データの内側へと参照することにより、前記第一の方向とは垂直な第二の方向へ連続するエッジ点を探索する際の起点とするエッジ点を検出すると共に、検出したエッジ点を起点として、前記第二の方向に、前記変換後の画像データを構成する各画素の画素値を参照して、前記第二の方向へ連続するエッジ点を、その連続性が途切れるまで探索することにより、前記起点としたエッジ点から前記第二の方向に連続するエッジ点のグループを検出し、当該検出した前記第二の方向に連続するエッジ点のグループを、前記特定方向に延びる原稿の端縁を表すエッジ点の候補に選択する動作を、前記連続性が途切れる度、前記参照開始位置を、前記第二の方向に更新しながら、繰返し実行することにより、前記特定方向に延びる原稿の端縁を表すエッジ点の候補を選択する選択手段と、
前記選択手段により前記候補として選択されたエッジ点の分布に基づき、前記選択手段により選択された前記候補の一群の中から、前記原稿の端縁を表すエッジ点としての確度が低いエッジ点を破棄することで、当該破棄後に残る前記候補を、前記変換後の画像データにおいて前記特定方向に延びる原稿の端縁を表すエッジ点として検出する検出手段と、
を備え、
前記読取制御手段は、前記第二の方向に垂直な前記原稿台の一辺から前記第二の方向に延びる中央までの領域よりも短い領域を、前記読取ユニットに読み取らせる機能を有し、
前記選択手段は、前記機能により前記読取制御手段が生成した画像データについての前記変換手段による変換後の画像データから、前記エッジ点の候補を選択すること
を特徴とする画像読取装置
A document table on which a document to be read is placed;
A reading unit for reading a document placed on the document table;
Reading control means for generating image data representing a read image of the document placed on the document table by causing the reading unit to read the document placed on the document table ;
The image data generated by the reading control means, conversion means for converting the image data representing an edge image,
A means for selecting edge point candidates representing an edge of a document extending in a specific direction from image data after being converted by the converting means according to a predetermined rule, wherein the end point of the converted image data is referred to Set to the start position, and refer to the pixel value of each pixel constituting the image data from the set reference start position to the inside of the image data along a predetermined first direction. To detect an edge point as a starting point when searching for a continuous edge point in a second direction perpendicular to the first direction, and using the detected edge point as a starting point in the second direction, By referring to the pixel value of each pixel constituting the image data after conversion and searching for an edge point continuous in the second direction until the continuity is interrupted, the edge point as the starting point is Second one Detecting an edge point group that is continuous in the second direction, and selecting the detected edge point group that is continuous in the second direction as a candidate of an edge point that represents an edge of the document extending in the specific direction, Selecting means for selecting edge point candidates representing the edge of the document extending in the specific direction by repeatedly executing the reference start position while updating the reference start position in the second direction each time continuity is interrupted ;
Based on the distribution of the edge points selected as the candidates by the selection means, the edge points having low accuracy as edge points representing the edges of the document are discarded from the group of candidates selected by the selection means. Detecting means for detecting the candidate remaining after the discarding as an edge point representing an edge of the document extending in the specific direction in the converted image data;
With
The reading control unit has a function of causing the reading unit to read an area shorter than an area extending from one side of the document table perpendicular to the second direction to a center extending in the second direction;
The image reading apparatus characterized in that the selection means selects the edge point candidates from the image data converted by the conversion means for the image data generated by the reading control means by the function .
前記検出手段は、
前記選択手段により前記候補に選択された各グループを、順次、検査対象のグループに設定する手段であって、前記検査対象のグループを、前記第二の方向において前記最も原稿台の中央寄りのグループから端寄りのグループへ、順次切り替えるようにして設定する検査対象切替設定手段と、
前記検査対象切替設定手段により前記検査対象のグループが設定される度、前記検査対象切替設定手段により現在設定されている検査対象のグループに、前記検査対象切替設定手段により検査対象のグループが切り替えられる方向において、隣接するグループが存在するか否かを、前記第二の方向に平行な一次元空間上で評価して判定する第一判定手段と、
前記第一判定手段により前記隣接するグループが存在すると判定されると、前記検査対象のグループに属するエッジ点であって最も前記隣接するグループ寄りのエッジ点と、前記隣接するグループに属するエッジ点であって最も前記検査対象のグループ寄りのエッジ点と、の前記第一の方向の乖離度を算出する乖離度算出手段と、
前記乖離度算出手段により算出された乖離度が閾値未満であるか否かを判定する第二判定手段と、
を備え、前記第一判定手段により前記隣接するグループが存在しないと判定されるか、前記第二判定手段により前記乖離度が閾値以上であると判定されると、その時点までに検査対象のグループに設定されなかった前記第二の方向において原稿台の端側に位置するグループを、前記原稿の端縁を表すエッジ点としての確度が低いエッジ点の集合であるとみなして、当該エッジ点の集合を破棄する構成にされていること
を特徴とする請求項1記載の画像読取装置
The detection means includes
Each of the groups selected as candidates by the selection means is sequentially set as a group to be inspected, and the group to be inspected is a group closest to the center of the document table in the second direction. An inspection object switching setting unit configured to sequentially switch from the group to the edge group,
Each time the inspection target group is set by the inspection target switching setting unit, the inspection target group is switched by the inspection target switching setting unit to the inspection target group currently set by the inspection target switching setting unit. A first determination means for evaluating whether or not there is an adjacent group in a direction by evaluating on a one-dimensional space parallel to the second direction;
When it is determined by the first determination means that the adjacent group exists, an edge point belonging to the group to be inspected and closest to the adjacent group and an edge point belonging to the adjacent group A deviation degree calculating means for calculating a deviation degree in the first direction of the edge point closest to the group to be inspected;
Second determination means for determining whether or not the deviation degree calculated by the deviation degree calculation means is less than a threshold;
And when the first determination means determines that the adjacent group does not exist or the second determination means determines that the degree of divergence is equal to or greater than a threshold, the group to be inspected up to that point The group located on the end side of the document table in the second direction that is not set to be considered as a set of edge points with low accuracy as an edge point representing the edge of the document, and The image reading apparatus according to claim 1, wherein the set is configured to discard the set.
前記検出手段は、前記選択手段により前記候補に選択された各グループの内、最も長く連続するグループを、前記確度が高いエッジ点の集合とみなし、当該最も長く連続するグループ以外のグループを、前記確度が低いエッジ点の集合とみなして、当該確度が低いエッジ点を破棄することで、前記特定方向に延びる原稿の端縁を表すエッジ点を検出することを特徴とする請求項1記載の画像読取装置The detection means regards the longest continuous group among the groups selected as the candidates by the selection means as a set of edge points with high accuracy, and groups other than the longest continuous group are 2. The image according to claim 1, wherein an edge point representing an edge of a document extending in the specific direction is detected by discarding the edge point having the low accuracy, which is regarded as a set of edge points having low accuracy. Reader . 前記検出手段は、
前記選択手段により前記候補に選択された各グループを更に細分化してなる小グループ毎に、当該小グループを構成するエッジ点の近似直線を算出する近似直線算出手段と、
前記近似直線算出手段により算出された各小グループの近似直線の傾き及び切片の情報に基づき、近似直線についてのヒストグラムデータを生成するヒストグラムデータ生成手段と、
を備え、前記ヒストグラムデータ生成手段により生成された前記ヒストグラムデータに基づき、度数の最も高い近似直線が算出された小グループの集合を、前記確度が高いエッジ点の集合とみなし、当該度数の最も高い近似直線が算出された小グループの集合に属さないエッジ点の集合を、前記確度が低いエッジ点の集合とみなして、当該確度が低いエッジ点を破棄することで、前記特定方向に延びる原稿の端縁を表すエッジ点を検出することを特徴とする請求項1記載の画像読取装置
The detection means includes
For each small group obtained by further subdividing each group selected as the candidate by the selecting means, an approximate straight line calculating means for calculating an approximate straight line of edge points constituting the small group;
Based on the gradient and the switching piece information of the approximate straight line of each small group calculated by the approximate straight line calculating means, the histogram data generating means for generating histogram data of the approximate line,
A set of small groups for which an approximate straight line having the highest frequency is calculated based on the histogram data generated by the histogram data generating means is regarded as a set of edge points having the highest accuracy, and the highest frequency A set of edge points that do not belong to the set of small groups for which an approximate straight line has been calculated is regarded as a set of edge points with low accuracy, and the edge points with low accuracy are discarded, so that the document extending in the specific direction is discarded. The image reading apparatus according to claim 1, wherein an edge point representing an edge is detected.
読取対象の原稿が載置される原稿台と、A document table on which a document to be read is placed;
前記原稿台に載置された原稿を読み取るための読取ユニットと、  A reading unit for reading a document placed on the document table;
前記読取ユニットに、前記原稿台に載置された原稿を読み取らせることにより、前記原稿台に載置された原稿の読取画像を表す画像データを生成する読取制御手段と、  Reading control means for generating image data representing a read image of the document placed on the document table by causing the reading unit to read the document placed on the document table;
前記読取制御手段により生成された画像データを、エッジ画像を表す画像データに変換する変換手段と、  Conversion means for converting the image data generated by the reading control means into image data representing an edge image;
特定方向に延びる原稿の端縁、を表すエッジ点の候補を、所定の規則に従って、前記変換手段による変換後の画像データから選択する選択手段と、  Selection means for selecting candidate edge points representing the edge of the document extending in a specific direction from the image data converted by the conversion means according to a predetermined rule;
前記選択手段により前記候補として選択されたエッジ点の分布に基づき、前記選択手段により選択された前記候補の一群の中から、前記原稿の端縁を表すエッジ点としての確度が低いエッジ点を破棄することで、当該破棄後に残る前記候補を、前記変換後の画像データにおいて前記特定方向に延びる原稿の端縁を表すエッジ点として検出する検出手段と、  Based on the distribution of the edge points selected as the candidates by the selection means, the edge points having low accuracy as edge points representing the edges of the document are discarded from the group of candidates selected by the selection means. Detecting means for detecting the candidate remaining after the discarding as an edge point representing an edge of the document extending in the specific direction in the converted image data;
を備え、  With
前記選択手段は、前記変換後の画像データの端点を、参照開始位置に設定して、この画像データを構成する各画素の画素値を、前記設定した参照開始位置から、予め定められた第一の方向に沿って、前記画像データの内側へと参照することにより、前記第一の方向とは垂直な第二の方向へ連続するエッジ点を探索する際の起点とするエッジ点を検出すると共に、検出したエッジ点を起点として、前記第二の方向に、前記変換後の画像データを構成する各画素の画素値を参照して、前記第二の方向へ連続するエッジ点を、その連続性が途切れるまで探索することにより、前記起点としたエッジ点から前記第二の方向に連続するエッジ点のグループを検出し、当該検出した前記第二の方向に連続するエッジ点のグループを、前記特定方向に延びる原稿の端縁を表すエッジ点の候補に選択する動作を、前記連続性が途切れる度、前記参照開始位置を、前記第二の方向に更新しながら、繰返し実行することにより、前記特定方向に延びる原稿の端縁を表すエッジ点の候補を選択する構成にされ、  The selection means sets an end point of the converted image data as a reference start position, and sets a pixel value of each pixel constituting the image data from the set reference start position in a predetermined first By referring to the inside of the image data along the direction of, an edge point as a starting point when searching for a continuous edge point in a second direction perpendicular to the first direction is detected. The continuity of the edge point that continues in the second direction with reference to the pixel value of each pixel constituting the image data after the conversion in the second direction from the detected edge point as a starting point By searching until a break occurs, a group of edge points continuous in the second direction is detected from the starting edge point, and the group of edge points continuous in the second direction is detected. Extending in the direction The operation of selecting an edge point candidate representing the edge of the document is repeatedly executed while updating the reference start position in the second direction each time the continuity is interrupted, thereby extending in the specific direction. It is configured to select edge point candidates representing the edge of the document,
前記検出手段は、  The detection means includes
前記選択手段により前記候補に選択された各グループを更に細分化してなる小グループ毎に、当該小グループを構成するエッジ点の近似直線を算出する近似直線算出手段と、  For each small group obtained by further subdividing each group selected as the candidate by the selecting means, an approximate straight line calculating means for calculating an approximate straight line of edge points constituting the small group;
前記近似直線算出手段により算出された各小グループの近似直線の傾き及び切片の情報に基づき、近似直線についてのヒストグラムデータを生成するヒストグラムデータ生成手段と、  Histogram data generating means for generating histogram data for the approximate line based on the inclination and intercept information of the approximate line of each small group calculated by the approximate line calculation means;
を備え、前記ヒストグラムデータ生成手段により生成された前記ヒストグラムデータに基づき、度数の最も高い近似直線が算出された小グループの集合を、前記確度が高いエッジ点の集合とみなし、当該度数の最も高い近似直線が算出された小グループの集合に属さないエッジ点の集合を、前記確度が低いエッジ点の集合とみなして、当該確度が低いエッジ点を破棄することで、前記特定方向に延びる原稿の端縁を表すエッジ点を検出すること  A set of small groups for which an approximate straight line having the highest frequency is calculated based on the histogram data generated by the histogram data generation means is regarded as a set of edge points having the highest accuracy, and the highest frequency A set of edge points that do not belong to the set of small groups for which an approximate straight line has been calculated is regarded as a set of edge points with low accuracy, and the edge points with low accuracy are discarded, so that the document extending in the specific direction is discarded. Detecting edge points that represent edges
を特徴とする画像読取装置。  An image reading apparatus.
JP2008006927A 2008-01-16 2008-01-16 Image reading device Active JP4941317B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008006927A JP4941317B2 (en) 2008-01-16 2008-01-16 Image reading device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008006927A JP4941317B2 (en) 2008-01-16 2008-01-16 Image reading device

Publications (2)

Publication Number Publication Date
JP2009171218A JP2009171218A (en) 2009-07-30
JP4941317B2 true JP4941317B2 (en) 2012-05-30

Family

ID=40971912

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008006927A Active JP4941317B2 (en) 2008-01-16 2008-01-16 Image reading device

Country Status (1)

Country Link
JP (1) JP4941317B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5766073B2 (en) * 2011-09-08 2015-08-19 株式会社Pfu Image processing apparatus, image processing method, image processing program, and image processing system
JP6345224B1 (en) * 2016-12-19 2018-06-20 株式会社Pfu Image processing apparatus, rectangle detection method, and computer program

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3249605B2 (en) * 1992-11-25 2002-01-21 イーストマン・コダックジャパン株式会社 Document edge detection device
JPH11177775A (en) * 1997-12-15 1999-07-02 Minolta Co Ltd Detector for original
JP3670571B2 (en) * 2000-10-31 2005-07-13 株式会社Pfu Image reading device
JP2004282517A (en) * 2003-03-17 2004-10-07 Sharp Corp Original reader
JP4598426B2 (en) * 2004-03-30 2010-12-15 富士通株式会社 Boundary extraction method, program, and apparatus using the same
JP2007150849A (en) * 2005-11-29 2007-06-14 Kyocera Mita Corp Image reader and image forming apparatus
JP4482898B2 (en) * 2007-10-26 2010-06-16 村田機械株式会社 Image processing apparatus and image reading apparatus

Also Published As

Publication number Publication date
JP2009171218A (en) 2009-07-30

Similar Documents

Publication Publication Date Title
JP4941316B2 (en) Image reading device
JP5205963B2 (en) Image reading device
US8174737B2 (en) Image reading apparatus
EP3487159B1 (en) Image forming apparatus, scanned image correction method thereof, and non-transitory computer-readable recording medium
US8284463B2 (en) Image reading apparatus
JPH04313958A (en) Picture processor
JP5915628B2 (en) Image forming apparatus, text data embedding method, and embedding program
US7173731B2 (en) Apparatus and method for image-processing and computer program product for image-processing
JP4952576B2 (en) Image reading device
JP2021128356A (en) Information processing apparatus and program
JP4888439B2 (en) Image reading apparatus and original size determination program
JP4858437B2 (en) Image reading device
JP4941317B2 (en) Image reading device
JP4924416B2 (en) Image reading device
WO2017056799A1 (en) Image-reading device and image-forming device
JP4933415B2 (en) Image processing apparatus, method, and program
JP2008199110A (en) Remote copy system, image forming apparatus and its control method, and program and storage medium
JP4924417B2 (en) Image analysis device
JP4952575B2 (en) Image reading device
JP2020184207A (en) Image processing device, image processing method and program
US20090310991A1 (en) Image forming apparatus, image forming system, computer readable medium storing program and image forming method
JP2008040598A (en) Image input apparatus
JP2006340103A (en) Image processor, image processing method, and program
JP2006295794A (en) Image processor, image processing method, image processing program and computer-readable recording medium recorded with the program
JP5474222B2 (en) Image processing apparatus, image processing method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100212

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110628

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110726

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110926

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120131

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120213

R150 Certificate of patent or registration of utility model

Ref document number: 4941317

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20150309

Year of fee payment: 3