JP2013123119A - Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium - Google Patents

Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium Download PDF

Info

Publication number
JP2013123119A
JP2013123119A JP2011270501A JP2011270501A JP2013123119A JP 2013123119 A JP2013123119 A JP 2013123119A JP 2011270501 A JP2011270501 A JP 2011270501A JP 2011270501 A JP2011270501 A JP 2011270501A JP 2013123119 A JP2013123119 A JP 2013123119A
Authority
JP
Japan
Prior art keywords
edge
unit
image
document
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2011270501A
Other languages
Japanese (ja)
Inventor
Yosuke Konishi
陽介 小西
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.)
Sharp Corp
Original Assignee
Sharp Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sharp Corp filed Critical Sharp Corp
Priority to JP2011270501A priority Critical patent/JP2013123119A/en
Publication of JP2013123119A publication Critical patent/JP2013123119A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Facsimiles In General (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide an image processing apparatus, an image forming apparatus, an image reading apparatus, an image processing method, a computer program, and a recording medium for extracting a proper area of a document image even if a document has not been read properly.SOLUTION: In a case where an image forming apparatus 100 is instructed to execute a document inclination and size correction function, a color image input apparatus 1 reads a document in a maximum readable size. On the basis of image data acquired by the color image input apparatus 1, the document inclination and size detection unit 24 of a color image processing apparatus 2 detects a cut off area which has to be extracted as a document area. A document inclination and size correction unit 26 performs inclination and size correction using a correction parameter based on the cut off area detected by the document inclination and size detection unit 24.

Description

本発明は、原稿よりも広い領域を読み取って得られた画像データから、適切な原稿画像の領域を抽出することが可能な画像処理装置、画像形成装置、画像読取装置、画像処理方法、コンピュータプログラム及び記録媒体に関する。   The present invention relates to an image processing apparatus, an image forming apparatus, an image reading apparatus, an image processing method, and a computer program capable of extracting an appropriate original image area from image data obtained by reading an area larger than the original. And a recording medium.

画像読取装置において、読取可能な最大サイズで原稿を読み取り、ユーザが設定した用紙サイズの領域をクロップボックスに設定し、クロップボックス内の領域を、読み取った画像データとして抽出する装置が提案されている(例えば特許文献1)。具体的には、特許文献1に開示されたシステムは、原稿から読み取った画像データにおいて、像密度が予め設定された閾値以上である部分を、画像が存在する領域として検出する。そして例えば、画像が存在する領域がクロップボックスの中央に来るように、ユーザが設定した用紙サイズに合った形状及びサイズの領域をクロップボックスに設定する。   There has been proposed an image reading apparatus that reads an original with a maximum readable size, sets a paper size area set by a user in a crop box, and extracts the area in the crop box as read image data. (For example, patent document 1). Specifically, the system disclosed in Patent Document 1 detects a portion of an image data read from a document whose image density is equal to or higher than a preset threshold as a region where an image exists. Then, for example, an area having a shape and size suitable for the paper size set by the user is set in the crop box so that the area where the image exists is in the center of the crop box.

特開2007−174479号公報JP 2007-174479 A

しかし、特許文献1に開示された方法では、例えば、原稿が、背景が淡い色合いの写真であった場合に、原稿のエッジ部分が正しく検知されない可能性がある。原稿のエッジ部分が正しく検知されなかった場合、原稿から読み取った画像データに基づいて、所定位置にクロップボックスが設定されてしまい、本来クロップボックスを設定したい写真領域が欠けた状態でクロップボックスが設定される虞がある。
また、正しい位置にクロップボックスを設定するために、ユーザが手作業で、クロップボックスの設定又は微調整を行なう場合には、ユーザに煩雑な作業を強いるという問題が生じる。
However, in the method disclosed in Patent Document 1, for example, when the document is a photograph with a light background, the edge portion of the document may not be detected correctly. If the edge part of the document is not detected correctly, the crop box is set at the specified position based on the image data read from the document, and the crop box is set in the state where the photo area to which the crop box is originally set is missing. There is a risk of being.
Further, in order to set the crop box at the correct position, when the user manually performs the setting or fine adjustment of the crop box, there is a problem that the user is forced to perform complicated work.

本発明は、斯かる事情に鑑みてなされたものであって、その目的とするところは、原稿が適切な状態で読み取られなかった場合であっても、適切な原稿画像の領域を抽出することが可能な画像処理装置、画像形成装置、画像読取装置、画像処理方法、コンピュータプログラム及び記録媒体を提供することを目的とする。   The present invention has been made in view of such circumstances, and an object of the present invention is to extract an appropriate area of an original image even when the original is not read in an appropriate state. An image processing apparatus, an image forming apparatus, an image reading apparatus, an image processing method, a computer program, and a recording medium are provided.

本発明に係る画像処理装置は、矩形の原稿を含み、前記原稿よりも広い領域を読み取って得られた画像データから、前記原稿から読み取られた原稿画像データを抽出する画像処理装置において、前記画像データに基づいて、前記画像データに基づく画像のエッジを検出するエッジ検出部と、該エッジ検出部が検出したエッジに基づいて、前記原稿の4辺側のエッジをそれぞれ抽出する原稿エッジ抽出部と、該原稿エッジ抽出部が抽出した各エッジの信頼度を算出する信頼度算出部と、出力画像の用紙サイズを受け付ける受付部と、前記信頼度算出部が算出した信頼度、及び前記受付部が受け付けた用紙サイズに基づいて、前記原稿画像データとして抽出すべき抽出領域を特定する領域特定部とを備えることを特徴とする。   An image processing apparatus according to the present invention includes a rectangular document, and extracts image data read from the document from image data obtained by reading an area larger than the document. An edge detection unit for detecting an edge of an image based on the image data based on the data; an original edge extraction unit for extracting edges on the four sides of the original document based on the edge detected by the edge detection unit; A reliability calculation unit that calculates the reliability of each edge extracted by the document edge extraction unit, a reception unit that receives the paper size of the output image, the reliability calculated by the reliability calculation unit, and the reception unit And an area specifying unit for specifying an extraction area to be extracted as the document image data based on the accepted paper size.

本発明によれば、画像処理装置は、画像データに基づいて画像のエッジを検出し、検出したエッジに基づいて、原稿の4辺側のエッジをそれぞれ抽出する。また画像処理装置は、各エッジの信頼度を算出し、算出した信頼度と、外部から受け付けた出力画像の用紙サイズとに基づいて原稿画像領域(抽出領域)を特定する。原稿画像の各辺として抽出される4辺側のエッジの信頼度に応じて抽出領域(切り取り領域)を特定するので、4辺側全てのエッジが正しく抽出され辛い原稿であっても、抽出領域の検出精度を向上させることができる。よって、原稿のエッジ部分が正しく検知されにくい場合等のように、原稿が適切に読み取られなかった場合であっても、適切な原稿画像データを抽出することができる。なお、原稿画像データは、原稿から読み取られた画像データ、又は、原稿に形成されている画像から読み取られた画像データであり、原稿画像領域は、原稿の用紙サイズによって規定される領域、又は原稿に形成された画像の領域である。   According to the present invention, the image processing apparatus detects the edge of the image based on the image data, and extracts the edges on the four sides of the document based on the detected edge. The image processing apparatus calculates the reliability of each edge, and specifies the document image area (extraction area) based on the calculated reliability and the paper size of the output image received from the outside. Since the extraction region (cut region) is specified in accordance with the reliability of the four side edges extracted as each side of the document image, even if the document is difficult to extract all four side edges correctly, the extraction region Detection accuracy can be improved. Therefore, even when the original is not properly read, such as when it is difficult to detect the edge portion of the original correctly, appropriate original image data can be extracted. The document image data is image data read from a document or image data read from an image formed on a document, and the document image area is an area defined by the paper size of the document, or a document This is an area of an image formed in the area.

本発明に係る画像処理装置は、前記信頼度算出部が算出した各エッジの信頼度が所定閾値以上であるか否かを判断する判断部を備え、前記領域特定部は、前記判断部によって、少なくとも1つのエッジが所定閾値以上であると判断された場合に、所定閾値以上の信頼度のエッジを基準とし、前記受付部が受け付けた用紙サイズの抽出領域を特定するようにしてあることを特徴とする。   The image processing apparatus according to the present invention includes a determination unit that determines whether or not the reliability of each edge calculated by the reliability calculation unit is greater than or equal to a predetermined threshold, and the region specifying unit is When it is determined that at least one edge is equal to or greater than a predetermined threshold, the paper size extraction area received by the receiving unit is specified with reference to an edge having a reliability equal to or higher than the predetermined threshold. And

本発明によれば、原稿の4辺側の各エッジの信頼度のうちの少なくとも1つが所定閾値以上である場合に、所定閾値以上の信頼度のエッジを基準とし、外部から設定された用紙サイズの抽出領域を特定する。信頼度が所定値以上であるエッジを基準として抽出領域を特定するので、4辺側全てのエッジが正しく抽出され辛い原稿であっても、実際の原稿画像領域により近似した抽出領域を検出できる。   According to the present invention, when at least one of the reliability of each edge on the four sides of the document is equal to or greater than a predetermined threshold, the paper size set from the outside with the reliability edge equal to or greater than the predetermined threshold as a reference Specify the extraction area. Since the extraction area is specified based on an edge whose reliability is equal to or higher than a predetermined value, an extraction area that is more approximate to the actual original image area can be detected even if it is difficult to correctly extract all four edges.

本発明に係る画像処理装置は、前記画像データに基づく画像に、前記領域特定部が特定した抽出領域を示す情報を重ね合せた画像を表示させるための表示用データを生成する生成部を備えることを特徴とする。   The image processing apparatus according to the present invention includes a generation unit that generates display data for displaying an image obtained by superimposing information indicating the extraction region specified by the region specifying unit on an image based on the image data. It is characterized by.

本発明によれば、例えば、抽出すべき抽出領域を示す枠を、画像データに基づく画像に重ね合せた画像を表示させることが可能となる。よって、抽出領域が適切であるか否かを容易に判断することが可能となる。   According to the present invention, for example, an image in which a frame indicating an extraction region to be extracted is superimposed on an image based on image data can be displayed. Therefore, it is possible to easily determine whether or not the extraction region is appropriate.

本発明に係る画像処理装置は、前記生成部が生成した表示用データに基づく画像を表示させる表示部と、該表示部が表示した画像に基づいて、前記抽出領域の変更を受け付ける変更受付部と、該変更受付部が受け付けた変更に基づいて、前記領域特定部が特定した抽出領域を変更する抽出領域変更部とを備えることを特徴とする。   An image processing apparatus according to the present invention includes: a display unit that displays an image based on display data generated by the generation unit; a change reception unit that receives a change in the extraction region based on the image displayed by the display unit; And an extraction region changing unit that changes the extraction region specified by the region specifying unit based on the change received by the change receiving unit.

本発明によれば、例えば、抽出すべき抽出領域を示す枠を、画像データに基づく画像に重ね合せた画像を表示させることによって、抽出領域をユーザに通知し、抽出領域が適切ではない場合には、抽出領域の変更をユーザから受け付け、抽出領域を変更する。よって、適切な抽出領域が特定(検出)されなかった場合には、ユーザによって抽出領域の変更が可能となり、エッジが正しく抽出され辛い原稿であっても、適切な抽出領域を特定することができる。   According to the present invention, for example, by displaying an image in which a frame indicating an extraction region to be extracted is superimposed on an image based on image data, the extraction region is notified to the user, and the extraction region is not appropriate. Accepts a change in the extraction area from the user and changes the extraction area. Therefore, when an appropriate extraction area is not specified (detected), the extraction area can be changed by the user, and an appropriate extraction area can be specified even for a document whose edges are difficult to extract correctly. .

本発明に係る画像処理装置は、前記エッジ検出部は、前記画像の4辺側のエッジをそれぞれ検出するようにしてあり、前記エッジ検出部が検出したエッジを構成する各画素について、各注目画素と、各注目画素から所定間隔の画素との座標情報の差分値が所定値未満となる画素数を、各注目画素に対する有効カウント値として計数する計数部と、各エッジ毎に、前記計数部が計数した有効カウント値の平均値を算出する算出部とを備え、前記原稿エッジ抽出部は、前記エッジ検出部が検出した一辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記一辺に対向する他辺から最も離れた位置の画素を前記原稿の一辺側のエッジとして抽出し、前記エッジ検出部が検出した前記他辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記一辺から最も離れた位置の画素を前記原稿の他辺側のエッジとして抽出し、前記エッジ検出部が検出した前記一辺に交差する別の一辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記別の一辺に対向する別の他辺から最も離れた位置の画素を前記別の一辺側のエッジとして抽出し、前記エッジ検出部が検出した前記別の他辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記別の一辺から最も離れた位置の画素を前記別の他辺側のエッジとして抽出するようにしてあり、前記信頼度算出部は、前記原稿エッジ抽出部が各エッジとして抽出した画素の有効カウント値を各エッジの信頼度とするようにしてあることを特徴とする。   In the image processing apparatus according to the present invention, the edge detection unit is configured to detect edges on the four sides of the image, and for each pixel constituting the edge detected by the edge detection unit, each pixel of interest And a counting unit that counts the number of pixels in which the difference value of coordinate information between each pixel of interest and a pixel at a predetermined interval is less than a predetermined value as an effective count value for each pixel of interest, and for each edge, the counter unit A calculation unit that calculates an average value of the counted effective count values, and the document edge extraction unit calculates the average calculated by the calculation unit among the pixels constituting the edge on one side detected by the edge detection unit. A pixel having an effective count value greater than the value, the pixel at the most distant position from the other side facing the one side is extracted as an edge on one side of the document, and the other side detected by the edge detection unit Among the pixels constituting the edge of the document, a pixel having an effective count value larger than the average value calculated by the calculation unit, and a pixel at a position farthest from the one side is extracted as an edge on the other side of the document. Among the pixels constituting the edge on another side intersecting the one side detected by the edge detection unit, the pixel having an effective count value larger than the average value calculated by the calculation unit, and the other side The pixel at the position farthest from the other side opposite to the other side is extracted as the edge on the other side, and among the pixels constituting the edge on the other side detected by the edge detection unit, The pixel having an effective count value larger than the average value calculated by the calculation unit, the pixel at the position farthest from the other side is extracted as an edge on the other side, and the reliability calculation Department is front Wherein the document edge extraction unit are the valid count values of pixels extracted as the edge so that the reliability of each edge.

本発明によれば、画像の各辺側のエッジとして検出された各画素について、各注目画素と、各注目画素から所定間隔の画素との座標情報の差分値が所定値未満となる画素数を、各注目画素に対する有効カウント値として計数し、各エッジ毎に有効カウント値の平均値を算出する。そして、各エッジ毎に、各エッジとして抽出された画素のうちで、平均値よりも大きい有効カウント値の画素であり、4つのエッジで囲まれた領域をより広げる位置の画素を原稿の各辺側のエッジとする。また、各エッジとして抽出された画素の有効カウント値を各エッジの信頼度とする。よって、より広い領域を抽出領域に特定することができ、抽出領域を抽出した場合に画像が欠けることを防止できる。   According to the present invention, for each pixel detected as an edge on each side of the image, the number of pixels for which the difference value of the coordinate information between each pixel of interest and each pixel from the pixel of interest is less than a predetermined value is calculated. Then, counting is performed as an effective count value for each pixel of interest, and an average value of the effective count values is calculated for each edge. Then, for each edge, among the pixels extracted as each edge, a pixel having an effective count value larger than the average value, and a pixel at a position where the area surrounded by the four edges is further expanded is set to each side of the document. The side edge. Further, the effective count value of the pixel extracted as each edge is set as the reliability of each edge. Therefore, a wider area can be specified as the extraction area, and the image can be prevented from being lost when the extraction area is extracted.

本発明に係る画像形成装置は、上述したいずれかの画像処理装置と、該画像処理装置で処理された画像データに基づく画像を形成する画像形成部とを備えることを特徴とする。   An image forming apparatus according to the present invention includes any one of the above-described image processing apparatuses and an image forming unit that forms an image based on image data processed by the image processing apparatus.

本発明によれば、精度良く特定された抽出領域に基づいて原稿画像のデータを抽出することにより、抽出されたデータに基づいて出力された画像が欠けた状態となることを防止できる。よって、適切な画像を出力することができる。   According to the present invention, it is possible to prevent the image output based on the extracted data from being lost by extracting the data of the document image based on the extraction area specified with high accuracy. Therefore, an appropriate image can be output.

本発明に係る画像読取装置は、原稿を読み取って画像データを取得する画像読取部と、上述したいずれかの画像処理装置とを備え、前記画像読取部で読み取った画像を前記画像処理装置で処理するようにしてあることを特徴とする。   An image reading apparatus according to the present invention includes an image reading unit that reads a document and acquires image data, and any one of the image processing devices described above, and processes an image read by the image reading unit by the image processing device. It is made to do so.

本発明によれば、原稿よりも広い領域を読み取って得られた画像データから、精度良く特定された抽出領域内のデータを抽出することにより、原稿が適切な状態で読み取られなかった場合であっても、適切な原稿画像データを抽出することができる。   According to the present invention, the data in the extraction area specified with high accuracy is extracted from the image data obtained by reading an area larger than the original, so that the original cannot be read in an appropriate state. However, appropriate document image data can be extracted.

本発明に係る画像処理方法は、画像処理装置が、矩形の原稿を含み、前記原稿よりも広い領域を読み取って得られた画像データから、前記原稿から読み取られた原稿画像データを抽出する画像処理方法において、前記画像処理装置が、前記画像データに基づいて、前記画像データに基づく画像のエッジを検出するステップと、前記画像処理装置が、検出したエッジに基づいて、前記原稿の4辺側のエッジをそれぞれ抽出するステップと、前記画像処理装置が、抽出した各エッジの信頼度を算出するステップと、前記画像処理装置が、算出した信頼度、及び外部から受け付けた出力画像の用紙サイズに基づいて、前記原稿画像データとして抽出すべき抽出領域を特定するステップとを含むことを特徴とする。   In the image processing method according to the present invention, the image processing apparatus includes a rectangular document and extracts image data read from the document from image data obtained by reading an area larger than the document. In the method, the image processing device detects an edge of an image based on the image data based on the image data; and the image processing device detects four edges of the document based on the detected edge. A step of extracting each edge, a step in which the image processing apparatus calculates a reliability of each extracted edge, a reliability calculated by the image processing apparatus, and a paper size of the output image received from the outside And a step of specifying an extraction area to be extracted as the document image data.

本発明によれば、原稿のエッジ部分が正しく検知されにくい場合等のように、原稿が適切に読み取られなかった場合であっても、原稿が適切な状態で読み取られた場合と同様の適切な原稿画像データを得ることができる。   According to the present invention, even when the original is not properly read, such as when the edge portion of the original is difficult to be detected correctly, the same appropriate as when the original is read in an appropriate state. Document image data can be obtained.

本発明に係るコンピュータプログラムは、コンピュータに、矩形の原稿を含み、前記原稿よりも広い領域を読み取って得られた画像データから、前記原稿から読み取られた原稿画像データを抽出させるためのコンピュータプログラムにおいて、前記コンピュータに、前記画像データに基づいて、前記画像データに基づく画像のエッジを検出させるステップと、前記コンピュータに、検出されたエッジに基づいて、前記原稿の4辺側のエッジをそれぞれ抽出させるステップと、前記コンピュータに、抽出された各エッジの信頼度を算出させるステップと、前記コンピュータに、算出された信頼度、及び外部から受け付けた出力画像の用紙サイズに基づいて、前記原稿画像データとして抽出すべき抽出領域を特定させるステップとを含むことを特徴とする。
本発明によれば、上述したコンピュータプログラムをコンピュータに読み取らせて実行させることにより、上述した画像処理装置をコンピュータ上で実現することが可能となる。
The computer program according to the present invention is a computer program for causing a computer to extract document image data read from the document from image data obtained by reading a region wider than the document including a rectangular document. And causing the computer to detect an edge of an image based on the image data based on the image data, and causing the computer to extract edges on the four sides of the document based on the detected edge. A step of causing the computer to calculate the reliability of each extracted edge; and as the original image data based on the calculated reliability and the paper size of the output image received from the outside. Identifying an extraction region to be extracted. To.
According to the present invention, the above-described image processing apparatus can be realized on a computer by causing the computer program to be read and executed.

本発明に係る記録媒体は、上述したコンピュータプログラムが記録されていることを特徴とする。
本発明によれば、記録媒体に記録してあるコンピュータプログラムをコンピュータに読み取らせて実行させることにより、上述した画像処理装置をコンピュータ上で実現することが可能となる。
A recording medium according to the present invention stores the above-described computer program.
According to the present invention, the above-described image processing device can be realized on a computer by causing the computer to read and execute the computer program recorded on the recording medium.

本発明では、原稿のエッジ部分が正しく検知されにくい場合等のように、原稿が適切に読み取られなかった場合であっても、適切な原稿画像の領域を抽出することができる。即ち、原稿画像の各辺のエッジが正しく抽出され辛い原稿であっても、抽出領域(原稿画像領域)の検出精度を向上させることができる。   According to the present invention, an appropriate document image area can be extracted even when the document is not properly read, such as when the edge portion of the document is difficult to detect correctly. That is, even if the original image is difficult to extract correctly, the detection accuracy of the extraction area (original image area) can be improved.

実施形態1に係る画像形成装置の構成を示すブロック図である。1 is a block diagram illustrating a configuration of an image forming apparatus according to a first embodiment. 操作パネルに表示される設定画面例を示す模式図である。It is a schematic diagram which shows the example of a setting screen displayed on an operation panel. 原稿傾き・サイズ検出部の構成を示すブロック図である。FIG. 4 is a block diagram illustrating a configuration of a document inclination / size detection unit. 座標情報テーブルを示す模式図である。It is a schematic diagram which shows a coordinate information table. 正接角度対応テーブルを示す模式図である。It is a schematic diagram which shows a tangent angle correspondence table. 原稿領域検出部による処理の手順を示すフローチャートである。6 is a flowchart illustrating a processing procedure performed by a document area detection unit. 原稿領域検出部による処理の手順を示すフローチャートである。6 is a flowchart illustrating a processing procedure performed by a document area detection unit. 各エッジが有効であるか否かの判定処理を説明するための模式図である。It is a schematic diagram for demonstrating the determination process whether each edge is effective. 左部最大有効エッジ及び右部最大有効エッジの候補を示す模式図である。It is a schematic diagram which shows the candidate of a left part largest effective edge and a right part largest effective edge. 孤立点ノイズであるか否かの判定処理を説明するための模式図である。It is a schematic diagram for demonstrating the determination process of whether it is isolated point noise. 切り取り領域判定部による処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the process by a cutting area determination part. 切り取り領域を示す模式図である。It is a schematic diagram which shows a cutting area. 切り取り領域を示す模式図である。It is a schematic diagram which shows a cutting area. 第5の切り取り領域判定処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the 5th cutting area determination process. 第5の切り取り領域判定処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the 5th cutting area determination process. 切り取り領域を示す模式図である。It is a schematic diagram which shows a cutting area. 領域表示用パラメータ生成部による処理を説明するための模式図である。It is a schematic diagram for demonstrating the process by the parameter display part for area | region display. 切り取り領域確認画面を示す模式図である。It is a schematic diagram which shows a cut area confirmation screen. 切り取り領域の確認及び補正処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the confirmation and correction | amendment process of a cutting area. 設定画面を示す模式図である。It is a schematic diagram which shows a setting screen. 補間演算を説明するための模式図である。It is a schematic diagram for demonstrating an interpolation calculation. 実施形態2に係る画像形成装置の構成を示すブロック図である。FIG. 4 is a block diagram illustrating a configuration of an image forming apparatus according to a second embodiment. 実施形態3に係る画像読取装置の構成を示すブロック図である。FIG. 10 is a block diagram illustrating a configuration of an image reading apparatus according to a third embodiment. 本発明に係る画像処理装置をコンピュータシステムに適用した場合の構成例を示す模式図である。It is a schematic diagram which shows the structural example at the time of applying the image processing apparatus which concerns on this invention to a computer system.

以下に、本発明に係る画像処理装置、画像形成装置、画像読取装置、画像処理方法、コンピュータプログラム及び記録媒体について、その実施形態を示す図面に基づいて詳述する。   Hereinafter, an image processing apparatus, an image forming apparatus, an image reading apparatus, an image processing method, a computer program, and a recording medium according to the present invention will be described in detail with reference to the drawings illustrating embodiments thereof.

(実施形態1)
図1は実施形態1に係る画像形成装置の構成を示すブロック図である。画像形成装置100(例えば、デジタルカラー複写機)は、カラー画像入力装置1、カラー画像処理装置2(画像処理装置)、カラー画像出力装置3(画像形成部)、各種操作を行なうための操作パネル4、画像メモリ5等を備える。カラー画像入力装置1で原稿を読み取ることにより得られたRGB(R:赤、G:緑、B:青)のアナログ信号の画像データは、カラー画像処理装置2へ出力され、カラー画像処理装置2で所定の処理が行なわれ、CMYK(C:シアン、M:マゼンタ、Y:イエロー、K:黒)のデジタルカラー信号としてカラー画像出力装置3へ出力される。
(Embodiment 1)
FIG. 1 is a block diagram illustrating a configuration of an image forming apparatus according to the first embodiment. An image forming apparatus 100 (for example, a digital color copying machine) includes a color image input device 1, a color image processing device 2 (image processing device), a color image output device 3 (image forming unit), and an operation panel for performing various operations. 4. An image memory 5 is provided. Image data of RGB (R: red, G: green, B: blue) analog signals obtained by reading a document with the color image input device 1 is output to the color image processing device 2, and the color image processing device 2. Then, a predetermined process is performed and output to the color image output device 3 as a digital color signal of CMYK (C: cyan, M: magenta, Y: yellow, K: black).

カラー画像入力装置1は、例えば、CCD(Charged Coupled Device)等の光学情報を電気信号に変換するデバイスを備えたスキャナであり、原稿画像からの反射光像(反射率の信号)をRGBのアナログ信号として読み取る。カラー画像入力装置1は、読み取ったRGB信号をカラー画像処理装置2へ出力する。また、カラー画像入力装置1は、例えば、原稿押さえ台が白板によって構成されている。
カラー画像出力装置3は、原稿画像の画像データを、例えば記録紙上に出力する電子写真方式やインクジェット方式等を用いた画像形成手段である。
The color image input apparatus 1 is a scanner including a device that converts optical information into an electrical signal, such as a CCD (Charged Coupled Device), for example, and converts a reflected light image (reflectance signal) from an original image to an RGB analog. Read as a signal. The color image input device 1 outputs the read RGB signals to the color image processing device 2. Further, in the color image input apparatus 1, for example, the document presser base is configured by a white plate.
The color image output device 3 is an image forming unit using an electrophotographic method, an ink jet method, or the like that outputs image data of a document image onto a recording sheet, for example.

操作パネル4は、例えば、タッチパネル方式の液晶ディスプレイであり、液晶ディスプレイ等の画像表示装置及び設定ボタン等より構成される。操作パネル4は、画像形成装置100の操作を行なうための操作メニュー、画像出力を行なう前のプレビュー画像等を表示する。また、操作パネル4は、数値の入力を行なうテンキー、動作の開始を指示するスタートキー等の設定ボタンを介して、ユーザが画像形成装置100に対して行なった操作を受け付ける。操作パネル4より入力された情報に基づいてカラー画像入力装置1、カラー画像処理装置2、カラー画像出力装置3の動作が制御される。操作パネル4は、画像形成装置100と一体的に設けられてもよく、画像形成装置100から取り外し可能に設けられてもよい。   The operation panel 4 is, for example, a touch panel type liquid crystal display, and includes an image display device such as a liquid crystal display, a setting button, and the like. The operation panel 4 displays an operation menu for operating the image forming apparatus 100, a preview image before image output, and the like. The operation panel 4 accepts operations performed on the image forming apparatus 100 by the user via setting buttons such as a numeric keypad for inputting numerical values and a start key for instructing start of operation. Based on information input from the operation panel 4, operations of the color image input device 1, the color image processing device 2, and the color image output device 3 are controlled. The operation panel 4 may be provided integrally with the image forming apparatus 100 or may be detachable from the image forming apparatus 100.

カラー画像処理装置2は、A/D(アナログ/デジタル)変換部21、シェーディング補正部22、入力階調補正部23、原稿傾き・サイズ検出部24、表示制御部25、原稿傾き・サイズ補正部26、領域分離処理部27、色補正部28、黒生成下色除去部29、空間フィルタ処理部30、出力階調補正部31、階調再現処理部32等を備え、ASIC(Application Specific Integrated Circuit)等により構成される。   The color image processing apparatus 2 includes an A / D (analog / digital) conversion unit 21, a shading correction unit 22, an input tone correction unit 23, a document inclination / size detection unit 24, a display control unit 25, and a document inclination / size correction unit. 26, an area separation processing unit 27, a color correction unit 28, a black generation and under color removal unit 29, a spatial filter processing unit 30, an output gradation correction unit 31, a gradation reproduction processing unit 32, and the like, and includes an ASIC (Application Specific Integrated Circuit). ) Etc.

A/D変換部21は、カラー画像入力装置1から入力されたRGB信号を、例えば、10ビットのデジタル信号に変換し、変換後のRGB信号をシェーディング補正部22へ出力する。   The A / D conversion unit 21 converts the RGB signal input from the color image input apparatus 1 into, for example, a 10-bit digital signal, and outputs the converted RGB signal to the shading correction unit 22.

シェーディング補正部22は、入力されたRGB信号に対して、カラー画像入力装置1の照明系、結像系、撮像系等で生じた各種の歪みを取り除く補正処理を行なう。また、シェーディング補正部22は、カラーバランスの調整を行なうと共に、RGB信号(RGBの反射率信号)を濃度(画素値)信号に変換する処理を行ない、処理後のRGB信号を入力階調補正部23へ出力する。   The shading correction unit 22 performs a correction process for removing various distortions generated in the illumination system, the imaging system, the imaging system, and the like of the color image input apparatus 1 on the input RGB signal. In addition, the shading correction unit 22 adjusts the color balance, performs a process of converting the RGB signal (RGB reflectance signal) into a density (pixel value) signal, and converts the processed RGB signal into an input tone correction unit. To 23.

入力階調補正部23は、シェーディング補正部22にて各種の歪みが取り除かれたRGB信号に対して、下地濃度の除去、及びコントラストの調整等の画質調整処理を行なう。入力階調補正部23は、処理後のRGB信号を原稿傾き・サイズ検出部24及び原稿傾き・サイズ補正部26へ出力する。   The input tone correction unit 23 performs image quality adjustment processing such as background density removal and contrast adjustment on the RGB signal from which various distortions have been removed by the shading correction unit 22. The input tone correction unit 23 outputs the processed RGB signals to the document inclination / size detection unit 24 and the document inclination / size correction unit 26.

原稿傾き・サイズ検出部24は、入力階調補正されたRGB信号に対して、原稿のエッジを抽出し、抽出したエッジに基づいて切り取り領域(切り取り領域の候補)を決定する。原稿傾き・サイズ検出部24は、決定した切り取り領域を表示制御部25を介して操作パネル4(表示部)に表示させてユーザに通知する。
ユーザは、操作パネル4に表示された切り取り領域が適切であるか否かを判断し、適切でない場合は操作パネル4を介して微調整を行なう。
The document inclination / size detection unit 24 extracts an edge of the document from the RGB signal whose input gradation has been corrected, and determines a cutting area (cutting area candidate) based on the extracted edge. The document inclination / size detection unit 24 displays the determined cut area on the operation panel 4 (display unit) via the display control unit 25 to notify the user.
The user determines whether or not the cut area displayed on the operation panel 4 is appropriate. If the cut area is not appropriate, the user performs fine adjustment via the operation panel 4.

操作パネル4に表示させた切り取り領域に対して、ユーザが適切であると判断した場合、表示制御部25は、その旨を原稿傾き・サイズ検出部24に通知する。これにより、原稿傾き・サイズ検出部24は、切り取り領域を示す情報に基づいて、傾き・サイズ補正処理のための補正用パラメータ(傾きの角度、補正後の用紙サイズ、補正処理の開始位置等)を算出し、算出した補正用パラメータを原稿傾き・サイズ補正部26へ出力する。また、ユーザが適切ではないと判断し、切り取り領域に対してユーザによる微調整が行なわれた場合、表示制御部25は、ユーザによって微調整された切り取り領域を示す情報を原稿傾き・サイズ検出部24に通知する。この場合、原稿傾き・サイズ検出部24は、表示制御部25から通知された切り取り領域を示す情報に基づいて、傾き・サイズ補正処理のための補正用パラメータを算出して原稿傾き・サイズ補正部26へ出力する。
原稿傾き・サイズ検出部24及び表示制御部25は、処理対象の画像データ及び各種処理に必要な情報を画像メモリ5に適宜記憶させる。なお、原稿傾き・サイズ検出部24及び表示制御部25が行なう具体的な処理の内容については後述する。
When the user determines that the cut area displayed on the operation panel 4 is appropriate, the display control unit 25 notifies the document inclination / size detection unit 24 to that effect. Accordingly, the document inclination / size detection unit 24 performs correction parameters for the inclination / size correction processing (inclination angle, corrected paper size, correction processing start position, etc.) based on the information indicating the cut-out area. And the calculated correction parameters are output to the document inclination / size correction unit 26. If it is determined that the user is not appropriate and the user makes fine adjustments to the cutout area, the display control unit 25 displays information indicating the cutout area finely adjusted by the user as a document inclination / size detection unit. 24. In this case, the document inclination / size detection unit 24 calculates correction parameters for the inclination / size correction processing based on the information indicating the cut-out area notified from the display control unit 25, and the document inclination / size correction unit. 26.
The document inclination / size detection unit 24 and the display control unit 25 appropriately store image data to be processed and information necessary for various processes in the image memory 5. Details of specific processing performed by the document inclination / size detection unit 24 and the display control unit 25 will be described later.

原稿傾き・サイズ補正部26は、原稿傾き・サイズ検出部24から取得した補正用パラメータに基づいて、入力階調補正部23によって処理されたRGB信号に対して、傾き・サイズ補正処理を行ない、処理後のRGB信号を領域分離処理部27へ出力する。なお、原稿傾き・サイズ補正部26が行なう具体的な処理の内容については後述する。また、本実施形態では、画像形成装置100が備える機能として、図2に示すような設定画面を介して「原稿傾き・サイズ補正」機能の実行が選択された場合に、原稿傾き・サイズ検出部24による補正用パラメータの算出処理及び原稿傾き・サイズ補正部26による傾き・サイズ補正処理が実行される。   The document inclination / size correction unit 26 performs an inclination / size correction process on the RGB signal processed by the input tone correction unit 23 based on the correction parameters acquired from the document inclination / size detection unit 24. The processed RGB signal is output to the region separation processing unit 27. The details of specific processing performed by the document inclination / size correction unit 26 will be described later. In the present embodiment, when the execution of the “original skew / size correction” function is selected via the setting screen as shown in FIG. 2 as a function provided in the image forming apparatus 100, the original skew / size detection unit The correction parameter calculation process 24 and the inclination / size correction process by the document inclination / size correction unit 26 are executed.

領域分離処理部27は、入力されたRGB信号に基づいて、入力された画像中の各画素を、例えば、文字領域、網点領域、写真領域(連続階調領域)等のいずれかに分離する。領域分離処理部27は、分離結果に基づき、各画素がどの領域に属しているかを示す領域識別信号を、黒生成下色除去部29、空間フィルタ処理部30、及び階調再現処理部32へ出力する。また、領域分離処理部27は、原稿傾き・サイズ補正部26から入力されたRGB信号をそのまま後段の色補正部28へ出力する。なお、原稿傾き・サイズ補正部26が、傾き・サイズ補正処理後の画像データ(RGB信号)を画像メモリ5に格納している場合、領域分離処理部27は、傾き・サイズ補正処理後の画像データを画像メモリ5から読み出せばよい。また、原稿傾き・サイズ補正部26は、傾き・サイズ補正処理を行なわない場合、入力階調補正部23から入力されたRGB信号をそのまま領域分離処理部27へ出力しているので、この場合、領域分離処理部27は、原稿傾き・サイズ補正部26を介して入力階調補正部23から入力されたRGB信号をそのまま色補正部28へ出力する。   The region separation processing unit 27 separates each pixel in the input image into, for example, a character region, a dot region, a photographic region (continuous tone region), or the like based on the input RGB signal. . Based on the separation result, the region separation processing unit 27 sends a region identification signal indicating which region each pixel belongs to to the black generation and under color removal unit 29, the spatial filter processing unit 30, and the gradation reproduction processing unit 32. Output. The region separation processing unit 27 outputs the RGB signal input from the document inclination / size correction unit 26 to the subsequent color correction unit 28 as it is. When the document inclination / size correction unit 26 stores the image data (RGB signal) after the inclination / size correction processing in the image memory 5, the region separation processing unit 27 performs the image after the inclination / size correction processing. Data may be read from the image memory 5. Further, when the document inclination / size correction unit 26 does not perform the inclination / size correction processing, the RGB signal input from the input gradation correction unit 23 is output to the region separation processing unit 27 as it is. The area separation processing unit 27 outputs the RGB signal input from the input gradation correction unit 23 via the document inclination / size correction unit 26 to the color correction unit 28 as it is.

色補正部28は、入力されたRGB信号をCMYの色空間に変換し、カラー画像出力装置3の特性に合わせて色補正を行ない、補正後のCMY信号を黒生成下色除去部29へ出力する。具体的には、色補正部28は、色再現の忠実化を図るために、不要吸収成分を含むCMY色材の分光特性に基づいた色濁りをCMY信号から取り除く処理を行なう。   The color correction unit 28 converts the input RGB signal into a CMY color space, performs color correction in accordance with the characteristics of the color image output device 3, and outputs the corrected CMY signal to the black generation and under color removal unit 29. To do. Specifically, the color correction unit 28 performs a process of removing color turbidity from the CMY signal based on the spectral characteristics of the CMY color material including the unnecessary absorption component in order to achieve faithful color reproduction.

黒生成下色除去部29は、色補正部28から入力されたCMY信号に対して、CMY信号から黒色(K)信号を生成する黒生成処理と、元のCMY信号から黒生成で得たK信号を差し引いて新たなCMY信号を生成する処理とを行なう。この結果、CMY3色のデジタル信号は、CMYK4色のデジタル信号(以下、CMYK信号という)に変換される。黒生成下色除去部29は、CMY信号を変換したCMYK信号を空間フィルタ処理部30へ出力する。なお、黒生成下色除去部29は、領域識別信号が示す領域に応じた処理を行なう。   The black generation and lower color removal unit 29 performs black generation processing for generating a black (K) signal from the CMY signal, and K obtained by black generation from the original CMY signal for the CMY signal input from the color correction unit 28. A process of generating a new CMY signal by subtracting the signal is performed. As a result, the CMY3 color digital signals are converted into CMYK 4 color digital signals (hereinafter referred to as CMYK signals). The black generation and under color removal unit 29 outputs the CMYK signal obtained by converting the CMY signal to the spatial filter processing unit 30. The black generation and under color removal unit 29 performs processing according to the region indicated by the region identification signal.

黒生成下色除去部29が行なう黒生成処理の一例として、スケルトンブラックによる黒生成を行なう方法が用いられる。この方法では、スケルトンカーブの入出力特性をy=f(x)、入力されるデータをC,M,Y、出力されるデータをC´,M´,Y´,K´、UCR(Under Color Removal )率をα(0<α<1)とすると、黒生成下色除去処理により出力されるデータはそれぞれ、K´=f(min(C,M,Y))、C´=C−αK´、M´=M−αK´、Y´=Y−αK´で表わされる。   As an example of the black generation process performed by the black generation and under color removal unit 29, a method of generating black by skeleton black is used. In this method, the input / output characteristic of the skeleton curve is y = f (x), the input data is C, M, Y, the output data is C ′, M ′, Y ′, K ′, UCR (Under Color) Assuming that the (removal) rate is α (0 <α <1), the data output by the black generation and under color removal processing is K ′ = f (min (C, M, Y)) and C ′ = C−αK, respectively. ', M' = M-αK ', Y' = Y-αK '.

ここで、UCR率α(0<α<1)とは、CMYが重なっている部分をKに置き換えてCMYをどの程度削減するかを示すものである。上記の式では、CMYの各信号強度の内の最も小さい信号強度に応じてK信号が生成されることを示している。   Here, the UCR rate α (0 <α <1) indicates how much CMY is reduced by replacing the portion where CMY overlaps with K. The above equation shows that the K signal is generated in accordance with the smallest signal strength among the CMY signal strengths.

空間フィルタ処理部30は、黒生成下色除去部29から入力されたCMYK信号の画像データに対して、領域識別信号が示す領域に応じたデジタルフィルタによる空間フィルタ処理を行なう。これにより、画像データの空間周波数特性が補正され、カラー画像出力装置3における出力画像のぼやけ又は粒状性劣化を防止する。例えば、領域分離処理部27にて文字領域に分離された領域に対しては、空間フィルタ処理部30は、特に黒文字又は色文字の再現性を高めるために、高周波成分の強調量が大きいフィルタを用いて鮮鋭強調処理を行なう。また、領域分離処理部27にて網点領域に分離された領域に対しては、空間フィルタ処理部30は、入力網点成分を除去するためのローパス・フィルタ処理を施す。空間フィルタ処理部30は、処理後のCMYK信号を出力階調補正部31へ出力する。   The spatial filter processing unit 30 performs spatial filter processing on the image data of the CMYK signal input from the black generation and under color removal unit 29 using a digital filter corresponding to the region indicated by the region identification signal. As a result, the spatial frequency characteristic of the image data is corrected, and blurring or graininess deterioration of the output image in the color image output device 3 is prevented. For example, for a region separated into character regions by the region separation processing unit 27, the spatial filter processing unit 30 uses a filter with a large amount of high-frequency component enhancement in order to improve the reproducibility of black characters or color characters. Use for sharpening enhancement. Further, the spatial filter processing unit 30 performs low-pass filter processing for removing the input halftone dot component on the region separated into halftone dot regions by the region separation processing unit 27. The spatial filter processing unit 30 outputs the processed CMYK signal to the output tone correction unit 31.

出力階調補正部31は、空間フィルタ処理部30から入力されたCMYK信号に対して、カラー画像出力装置3の特性値に基づく出力階調補正処理(γ補正処理)を行ない、出力階調補正処理後のCMYK信号を階調再現処理部32へ出力する。   The output tone correction unit 31 performs output tone correction processing (γ correction processing) based on the characteristic value of the color image output device 3 for the CMYK signal input from the spatial filter processing unit 30 to correct output tone. The processed CMYK signal is output to the gradation reproduction processing unit 32.

階調再現処理部32は、出力階調補正部31から入力されたCMYK信号の画像データに対して、領域識別信号が示す領域に応じた中間調処理を行なう。例えば、領域分離処理部27にて文字領域に分離された領域に対して、階調再現処理部32は、特に黒文字又は色文字の再現性を高めるため、カラー画像出力装置3における高周波成分の再現に適した高解像度のスクリーンによる二値化処理又は多値化処理を行なう。   The gradation reproduction processing unit 32 performs halftone processing corresponding to the region indicated by the region identification signal on the image data of the CMYK signal input from the output gradation correction unit 31. For example, for the region separated into character regions by the region separation processing unit 27, the tone reproduction processing unit 32 reproduces high-frequency components in the color image output device 3 in order to improve the reproducibility of black characters or color characters. A binarization process or a multi-level process is performed using a high-resolution screen suitable for the above.

また、領域分離処理部27にて網点領域に分離された領域に対して、階調再現処理部32は、最終的に画像を画素に分離して、それぞれの階調を再現できるように階調再現処理(中間調生成)を行なう。さらに、領域分離処理部27にて写真領域に分離された領域に対して、階調再現処理部32は、カラー画像出力装置3における階調再現性を重視したスクリーンによる二値化処理又は多値化処理を行なう。   In addition, the gradation reproduction processing unit 32 finally separates the image into pixels for the regions separated into halftone dot regions by the region separation processing unit 27 so that each gradation can be reproduced. Tone reproduction processing (halftone generation) is performed. Furthermore, the gradation reproduction processing unit 32 performs binarization processing or multi-value processing on the screen with an emphasis on gradation reproducibility in the color image output device 3 for the region separated into the photographic regions by the region separation processing unit 27. The process is performed.

カラー画像処理装置2は、階調再現処理部32で処理された画像データ(CMYK信号)を画像メモリ5に一旦記憶し、画像形成をする所定のタイミングで画像メモリ5に記憶した画像データを読み出し、読み出した画像データをカラー画像出力装置3へ出力する。   The color image processing apparatus 2 temporarily stores the image data (CMYK signal) processed by the gradation reproduction processing unit 32 in the image memory 5 and reads out the image data stored in the image memory 5 at a predetermined timing for image formation. The read image data is output to the color image output device 3.

画像形成装置100は、図示しないCPU(Central Processing Unit)又はDSP(Digital Signal Processor)を備えており、画像形成装置100が行なう各種処理は、CPU又はDSPによって制御される。   The image forming apparatus 100 includes a CPU (Central Processing Unit) or a DSP (Digital Signal Processor) (not shown), and various processes performed by the image forming apparatus 100 are controlled by the CPU or DSP.

図2は操作パネル4に表示される設定画面例を示す模式図である。本実施形態1の画像形成装置100は、図2に示すような設定画面を介して、ユーザが原稿傾き・サイズ補正機能の実行を指示した場合に、原稿傾き・サイズ検出部24及び原稿傾き・サイズ補正部26による処理を行なう。図2の上側に示した設定画面は、画像形成装置100が備える各機能に関して各種情報の設定及び各機能の実行を指示するための画面である。図2の下側に示した画面は、原稿傾き・サイズ補正機能に関する情報を設定するための画面である。図2の上側に示した画面中の「原稿傾き・サイズ補正」ボタンが操作された場合、図2の下側に示した画面が操作パネル4に表示され、ユーザは、この画面を介して、傾き・サイズ補正処理において切り取られる領域の用紙サイズを設定する。図2の下側に示した画面例では、設定可能な写真の用紙サイズとして、L判サイズ、2L判サイズ、KGサイズ、四つ切りサイズ、六つ切りサイズ、八つ切りサイズが表示されている。また、図示を省略するが、図2の下側に示した画面には、一般的な用紙サイズとして、A5サイズ、A4サイズ、A3サイズ、B6サイズ、B5サイズ、B4サイズ等が表示される。
原稿傾き・サイズ検出部24は、このように設定(選択)された用紙サイズを基に、原稿から読み取った画像データから切り取る切り取り領域の候補を決定する。
FIG. 2 is a schematic diagram illustrating an example of a setting screen displayed on the operation panel 4. In the image forming apparatus 100 according to the first exemplary embodiment, when the user instructs the execution of the document tilt / size correction function via the setting screen as illustrated in FIG. Processing by the size correction unit 26 is performed. The setting screen shown on the upper side of FIG. 2 is a screen for instructing the setting of various information and the execution of each function regarding each function provided in the image forming apparatus 100. The screen shown at the bottom of FIG. 2 is a screen for setting information related to the document tilt / size correction function. When the “original skew / size correction” button in the screen shown in the upper part of FIG. 2 is operated, the screen shown in the lower part of FIG. 2 is displayed on the operation panel 4. Sets the paper size of the area cut out in the tilt / size correction process. In the example of the screen shown at the bottom of FIG. 2, L size size, 2L size size, KG size, quarter size, six size, and eight size are displayed as settable photo paper sizes. Although not shown, A5 size, A4 size, A3 size, B6 size, B5 size, B4 size, etc. are displayed as general paper sizes on the screen shown at the bottom of FIG.
The document inclination / size detection unit 24 determines a cut-out area candidate to be cut out from image data read from the document based on the paper size set (selected) in this way.

上述したように、本実施形態では、図2に示した設定画面を介して原稿傾き・サイズ補正機能の実行が指示された場合に、原稿傾き・サイズ検出部24及び原稿傾き・サイズ補正部26による処理を行なう構成であるが、このような構成に限定されない。例えば、図2の下側に示した画面を介して、写真の用紙サイズが選択された場合、又は、原稿が写真原稿であることが入力された場合等のように、原稿が写真原稿である場合にのみ、原稿傾き・サイズ検出部24及び原稿傾き・サイズ補正部26による処理を行なうようにしてもよい。また、原稿傾き・サイズ検出部24の前段に原稿種別を判別する構成を設け、入力画像(原稿)が写真原稿(印刷写真原稿又は印画紙写真原稿)であると判断された場合に、原稿傾き・サイズ検出部24及び原稿傾き・サイズ補正部26による処理を行なうようにしてもよい。原稿種別の判別処理としては、例えば、特開2002−232708号公報に開示された方法を用いることができる。以下に、原稿種別の判別処理について説明する。   As described above, in this embodiment, when the execution of the document inclination / size correction function is instructed via the setting screen shown in FIG. 2, the document inclination / size detection unit 24 and the document inclination / size correction unit 26 are instructed. However, the present invention is not limited to such a configuration. For example, when the photo paper size is selected via the screen shown in the lower part of FIG. 2 or when it is input that the original is a photo original, the original is a photo original. Only in this case, processing by the document inclination / size detection unit 24 and the document inclination / size correction unit 26 may be performed. In addition, a configuration for discriminating the document type is provided in the preceding stage of the document tilt / size detection unit 24, and when it is determined that the input image (document) is a photographic document (printed photograph document or photographic paper photograph document), the document skew The processing by the size detection unit 24 and the document inclination / size correction unit 26 may be performed. As the document type discrimination process, for example, a method disclosed in Japanese Patent Laid-Open No. 2002-232708 can be used. The document type determination process will be described below.

(1)注目画素を含むn×m画素(例えば、7×15画素)からなるブロック毎に、各ブロックにおける最小濃度値(最小画素値)及び最大濃度値(最大画素値)を算出する。
(2)算出した最小濃度値及び最大濃度値の差分である最大濃度差を算出する。
(3)ブロック毎に、隣接する画素の濃度差の絶対値の総和である総和濃度繁雑度(例えば、主走査方向及び副走査方向について算出した値の和)を算出する。
(4)算出した最大濃度差と最大濃度差閾値との比較、及び、算出した総和濃度繁雑度と総和濃度繁雑度閾値との比較を行なう。
最大濃度差<最大濃度差閾値、及び、総和濃度繁雑度<総和濃度繁雑度閾値である場合、注目画素は下地・印画紙写真領域に属すると判定する。
それ以外の場合、注目画素は文字・網点領域に属すると判定する。
(5)下地・印画紙写真領域に属すると判定された画素について、最大濃度差と下地・印画紙写真判定用閾値との比較を行なう。
最大濃度差<下地・印画紙写真判定用閾値である場合、注目画素は下地領域に属すると判定する。
それ以外の場合、注目画素は印画紙写真領域(連続階調領域)に属すると判定する。
(6)文字・網点領域に属すると判定された画素について、
総和濃度繁雑度と、最大濃度差に文字・網点判定用閾値を掛けた値との比較を行なう。
総和濃度繁雑度<最大濃度差×文字・網点判定用閾値である場合、注目画素は文字領域に属すると判定する。
それ以外の場合、注目画素は網点領域に属すると判定する。
(7)下地領域、印画紙写真領域、文字領域、網点領域のそれぞれに分類された画素数を領域毎にカウントし、各領域に対して予め定められている閾値と比較することにより、原稿全体の種別を判定する。
例えば、原稿全体の画素数に対して、文字領域に分離された画素数の比率と、網点領域に分離された画素数の比率と、印画紙写真領域に分離された画素数の比率とが、この順番で低くなっている場合、文字領域の比率が全画素数の30%以上であれば文字原稿であると判定し、網点領域の比率が全画素数の20%以上であれば網点原稿(印刷写真原稿)であると判定し、印画紙写真領域の比率が全画素数の10%以上であれば印画紙写真原稿であると判定する。また、原稿全体の画素数に対して、文字領域に分離された画素数の比率が、文字領域用の閾値以上であり、網点領域に分離された画素数の比率が、網点領域用の閾値以上である場合、文字/網点原稿(文字/印刷写真原稿)であると判定する。
(1) The minimum density value (minimum pixel value) and the maximum density value (maximum pixel value) in each block are calculated for each block including n × m pixels (for example, 7 × 15 pixels) including the target pixel.
(2) A maximum density difference that is a difference between the calculated minimum density value and maximum density value is calculated.
(3) For each block, a total density busyness (for example, a sum of values calculated in the main scanning direction and the sub-scanning direction), which is a sum of absolute values of density differences between adjacent pixels, is calculated.
(4) The calculated maximum density difference is compared with the maximum density difference threshold, and the calculated total density busyness is compared with the total density busyness threshold.
When the maximum density difference <the maximum density difference threshold and the total density busyness <the total density busyness threshold, it is determined that the target pixel belongs to the background / photographic paper photograph area.
In other cases, it is determined that the target pixel belongs to the character / halftone dot region.
(5) For the pixels determined to belong to the background / photographic paper photograph region, the maximum density difference is compared with the background / photographic paper photograph determination threshold.
When the maximum density difference <the threshold value for determining the background / photographic paper photograph, it is determined that the target pixel belongs to the background area.
In other cases, it is determined that the target pixel belongs to the photographic paper photograph area (continuous gradation area).
(6) For pixels determined to belong to the character / halftone area,
The total density busyness is compared with the value obtained by multiplying the maximum density difference by the threshold value for character / halftone dot determination.
If the total density busyness <the maximum density difference × the threshold for character / halftone dot determination, it is determined that the pixel of interest belongs to the character area.
In other cases, it is determined that the target pixel belongs to the halftone dot region.
(7) The number of pixels classified into each of the background area, the photographic paper photograph area, the character area, and the halftone dot area is counted for each area, and compared with a predetermined threshold value for each area. The overall type is determined.
For example, the ratio of the number of pixels separated into the character area, the ratio of the number of pixels separated into the halftone dot area, and the ratio of the number of pixels separated into the photographic paper photograph area with respect to the number of pixels of the entire document. If the ratio of the character area is 30% or more of the total number of pixels, it is determined that the original is a character document. If the ratio of the halftone area is 20% or more of the total number of pixels, It is determined that the document is a point document (printed photograph document), and if the ratio of the photographic paper photograph area is 10% or more of the total number of pixels, the document is determined to be a photographic paper photograph document. Further, the ratio of the number of pixels separated into the character area to the number of pixels of the entire document is equal to or greater than the threshold value for the character area, and the ratio of the number of pixels separated into the halftone area is equal to that for the halftone area. If it is equal to or greater than the threshold, it is determined that the document is a character / halftone original (character / printed photo original).

次に、原稿傾き・サイズ検出部24、表示制御部25及び原稿傾き・サイズ補正部26による具体的な処理内容について説明する。図3は原稿傾き・サイズ検出部24の構成を示すブロック図である。原稿傾き・サイズ検出部24は、エッジ検出部241、角度算出部242、座標情報変換部243、原稿領域検出部244、切り取り領域判定部245、領域表示用パラメータ生成部246、切り取り領域選択部247及び補正用パラメータ生成部248等を備える。原稿傾き・サイズ検出部24が備える各部の動作は、画像形成装置100が備えるCPU又はDSPによって制御される。   Next, specific processing contents by the document inclination / size detection unit 24, the display control unit 25, and the document inclination / size correction unit 26 will be described. FIG. 3 is a block diagram showing a configuration of the document inclination / size detection unit 24. The document inclination / size detection unit 24 includes an edge detection unit 241, an angle calculation unit 242, a coordinate information conversion unit 243, a document region detection unit 244, a cut region determination unit 245, a region display parameter generation unit 246, and a cut region selection unit 247. And a correction parameter generation unit 248 and the like. The operation of each unit provided in the document inclination / size detection unit 24 is controlled by the CPU or DSP provided in the image forming apparatus 100.

原稿傾き・サイズ検出部24において、入力階調補正部23から出力されたRGB信号(以下、入力画像データという)は、エッジ検出部241へ入力される。
なお、カラー画像入力装置1が読み取る原稿は、原稿載置台の所定位置に適切に載置されているとは限らず、また、傾いて載置される可能性がある。従って、図2に示した設定画面を介して原稿傾き・サイズ補正機能の実行が指示された場合、カラー画像入力装置1は、読取可能な最大サイズ(例えば、A3サイズ)で原稿の読み取りを行なう。従って、原稿傾き・サイズ補正機能の実行が指示されている場合、原稿傾き・サイズ検出部24には、最大サイズで原稿から読み取られた画像データが入力される。なお、読取可能な最大サイズとは、原稿を含み、原稿よりも広い領域のサイズである。
In the document inclination / size detection unit 24, RGB signals (hereinafter referred to as input image data) output from the input tone correction unit 23 are input to the edge detection unit 241.
Note that the document read by the color image input device 1 is not necessarily properly placed at a predetermined position on the document placement table, and may be placed at an angle. Accordingly, when the execution of the document inclination / size correction function is instructed via the setting screen shown in FIG. 2, the color image input apparatus 1 reads the document at the maximum readable size (for example, A3 size). . Therefore, when the execution of the document inclination / size correction function is instructed, the image inclination / size detection unit 24 receives image data read from the document at the maximum size. Note that the maximum size that can be read is a size of an area that includes a document and is wider than the document.

エッジ検出部241は、入力画像データに基づいて、入力画像のエッジを検出する。具体的には、エッジ検出部241は、入力画像データに対して、所定の解像度となるように縮小処理を行なう。なお、所定の解像度は、エッジの検出処理に最適な解像度であり、予め設定されて記憶部(図示せず)に記憶されている。また、エッジ検出部241は、縮小処理後の画像データに対して、ライン単位で、隣接画素の画素値の差分が所定閾値よりも大きくなる画素の位置をエッジとして抽出する。なお、ここでの所定閾値は、原稿の背景と原稿領域との境界を検知できる値であり、例えば、3が予め設定されて記憶部に記憶されている。   The edge detection unit 241 detects the edge of the input image based on the input image data. Specifically, the edge detection unit 241 performs a reduction process on the input image data so as to obtain a predetermined resolution. The predetermined resolution is the optimum resolution for the edge detection process, and is set in advance and stored in a storage unit (not shown). In addition, the edge detection unit 241 extracts, as an edge, a pixel position where the difference between the pixel values of adjacent pixels is greater than a predetermined threshold for each line of the image data after the reduction process. Here, the predetermined threshold value is a value that can detect the boundary between the background of the document and the document region. For example, 3 is preset and stored in the storage unit.

エッジ検出部241は、抽出したエッジ(エッジ画像)において、x軸方向(原稿に対して横方向)に走査した際の最も左側の画素(エッジ)の座標を左部エッジ座標、最も右側の画素(エッジ)の座標を右部エッジ座標として算出する。エッジ検出部241は、算出した左部エッジ座標の座標値及び右部エッジ座標の座標値を、図4に示すような座標情報テーブルに格納する。図4は座標情報テーブルを示す模式図であり、座標情報テーブルは、例えば記憶部に格納される。図4に示す座標情報テーブルでは、左部エッジ座標及び右部エッジ座標の座標値をそれぞれM個格納しており、この座標数Mは、縮小処理後の画像データの縦方向のサイズに依存する。   In the extracted edge (edge image), the edge detection unit 241 uses the leftmost pixel (edge) coordinates as the leftmost edge coordinates when scanning in the x-axis direction (lateral direction with respect to the document), and the rightmost pixel. The coordinates of (edge) are calculated as the right edge coordinates. The edge detector 241 stores the calculated coordinate values of the left edge coordinates and the coordinate values of the right edge coordinates in a coordinate information table as shown in FIG. FIG. 4 is a schematic diagram showing a coordinate information table. The coordinate information table is stored in, for example, a storage unit. The coordinate information table shown in FIG. 4 stores M coordinate values of left edge coordinates and right edge coordinates, and the number of coordinates M depends on the vertical size of the image data after reduction processing. .

エッジ検出部241は、同様に、y軸方向(原稿に対して縦方向)に走査した際の最も上側の画素(エッジ)の座標を上部エッジ座標、最も下側の画素(エッジ)の座標を下部エッジ座標として算出し、算出した上部エッジ座標の座標値及び下部エッジ座標の座標値を座標情報テーブルに格納する。図4に示す座標情報テーブルでは、上部エッジ座標及び下部エッジ座標の座標値をそれぞれN個格納しており、この座標数Nは、縮小処理後の画像データの横方向のサイズに依存する。
図4に示した座標情報テーブルには、左部エッジ座標、右部エッジ座標、上部エッジ座標及び下部エッジ座標の各座標値のほかに、左部エッジ補正座標、右部エッジ補正座標、上部エッジ補正座標及び下部エッジ補正座標の各座標値が格納されている。左部エッジ補正座標、右部エッジ補正座標、上部エッジ補正座標及び下部エッジ補正座標の各座標値は、後述する座標情報変換部243によって算出されて格納される値であるので、エッジ検出部241による処理の終了時点では、左部エッジ座標、右部エッジ座標、上部エッジ座標及び下部エッジ座標の各座標値のみが座標情報テーブルに格納される。
Similarly, the edge detection unit 241 uses the coordinates of the uppermost pixel (edge) when scanned in the y-axis direction (vertical direction with respect to the document) as the upper edge coordinates and the coordinates of the lowermost pixel (edge). The lower edge coordinates are calculated, and the calculated upper edge coordinate values and lower edge coordinate values are stored in the coordinate information table. In the coordinate information table shown in FIG. 4, N coordinate values of the upper edge coordinate and the lower edge coordinate are stored, respectively, and the number of coordinates N depends on the size of the image data after the reduction process.
In the coordinate information table shown in FIG. 4, in addition to the left edge coordinates, right edge coordinates, upper edge coordinates, and lower edge coordinates, the left edge correction coordinates, right edge correction coordinates, upper edge Each coordinate value of correction coordinates and lower edge correction coordinates is stored. Since the coordinate values of the left edge correction coordinate, the right edge correction coordinate, the upper edge correction coordinate, and the lower edge correction coordinate are values calculated and stored by the coordinate information conversion unit 243 described later, the edge detection unit 241 At the end of the process according to, only the coordinate values of the left edge coordinates, right edge coordinates, upper edge coordinates and lower edge coordinates are stored in the coordinate information table.

角度算出部242は、エッジ検出部241が検出したエッジ座標(左部エッジ座標、右部エッジ座標、上部エッジ座標及び下部エッジ座標)の各座標値に基づいて、原稿の傾き(角度)を算出する。原稿の傾きを算出する方法としては、例えば、特開平11−331547号公報に開示された傾き検知方法を利用することが可能である。   The angle calculation unit 242 calculates the inclination (angle) of the document based on the coordinate values of the edge coordinates (left edge coordinate, right edge coordinate, upper edge coordinate, and lower edge coordinate) detected by the edge detection unit 241. To do. As a method for calculating the inclination of the document, for example, an inclination detection method disclosed in Japanese Patent Application Laid-Open No. 11-331547 can be used.

角度算出部242は、各エッジ座標(左部エッジ座標、右部エッジ座標、上部エッジ座標又は下部エッジ座標)について、各エッジ座標の各座標値に基づいて、各座標間の傾きの変化を検出し、傾きが変化する点(エッジ変化点)を検出し、検出したエッジ変化点を結ぶ線分を抽出する。角度算出部242は、抽出した線分のうちで、x軸方向(原稿に対して横方向、副走査方向)に対して45°以下の線分で最も長い線分を選択し、選択した線分の始点座標(StartEdgeX,StartEdgeY)及び終点座標(EndEdgeX,EndEdgeY)を算出する。そして、角度算出部242は、始点座標及び終点座標から、tanα=(EndEdgeY−StartEdgeY)/(EndEdgeX−StartEdgeX)に基づいてtanαを算出し、図5に示す正接角度対応テーブルを参照して原稿の傾き角度αを算出する。図5は正接角度対応テーブルを示す模式図であり、正接角度対応テーブルは、例えば記憶部に予め格納されている。   For each edge coordinate (left edge coordinate, right edge coordinate, upper edge coordinate or lower edge coordinate), the angle calculation unit 242 detects a change in inclination between the coordinates based on each coordinate value of each edge coordinate. Then, a point at which the inclination changes (edge change point) is detected, and a line segment connecting the detected edge change points is extracted. The angle calculation unit 242 selects, from the extracted line segments, the longest line segment of 45 degrees or less with respect to the x-axis direction (the horizontal direction with respect to the document, the sub-scanning direction), and the selected line segment The start point coordinates (StartEdgeX, StartEdgeY) and end point coordinates (EndEdgeX, EndEdgeY) of the minute are calculated. Then, the angle calculation unit 242 calculates tanα based on tanα = (EndEdgeY−StartEdgeY) / (EndEdgeX−StartEdgeX) from the start point coordinates and the end point coordinates, and refers to the tangent angle correspondence table shown in FIG. The inclination angle α is calculated. FIG. 5 is a schematic diagram showing a tangent angle correspondence table. The tangent angle correspondence table is stored in advance in a storage unit, for example.

角度算出部242は、各エッジ座標(左部エッジ座標、右部エッジ座標、上部エッジ座標又は下部エッジ座標)のそれぞれについて上述した演算を行ない、x軸方向に対して45°以下の線分で最も長い線分を選択する。
しかし、左部エッジ座標又は右部エッジ座標の各座標値に基づいて抽出される線分は、x軸方向に対して45°以上傾いている場合が多く、上部エッジ座標又は下部エッジ座標の各座標値に基づいて抽出される線分は、x軸方向に対して45°以下となる場合が多い。また、原稿は矩形であることが多く、上部エッジ座標の各座標値に基づいて抽出される線分と、下部エッジ座標の各座標値に基づいて抽出される線分とは同じ傾きを有する場合が多い。そこで、角度算出部242は、上部エッジ座標及び下部エッジ座標の一方についてのみ上述した演算を行ない、x軸方向に対して45°以下の線分で最も長い線分を選択し、その始点座標及び終点座標に基づいて原稿の傾きを算出してもよい。
The angle calculation unit 242 performs the above-described calculation for each edge coordinate (left edge coordinate, right edge coordinate, upper edge coordinate or lower edge coordinate), and with a line segment of 45 ° or less with respect to the x-axis direction. Select the longest line segment.
However, the line segment extracted based on the coordinate values of the left edge coordinate or the right edge coordinate is often inclined by 45 ° or more with respect to the x-axis direction. The line segment extracted based on the coordinate value is often 45 ° or less with respect to the x-axis direction. The original is often rectangular, and the line segment extracted based on the coordinate values of the upper edge coordinates and the line segment extracted based on the coordinate values of the lower edge coordinates have the same inclination. There are many. Therefore, the angle calculation unit 242 performs the above-described calculation for only one of the upper edge coordinates and the lower edge coordinates, selects the longest line segment of 45 ° or less with respect to the x-axis direction, The document inclination may be calculated based on the end point coordinates.

座標情報変換部243は、エッジ検出部241により検出された全てのエッジ座標(左部エッジ座標、右部エッジ座標、上部エッジ座標及び下部エッジ座標)の各座標値(EdgeX, EdgeY)に対して、角度算出部242により算出された角度αに基づく補正処理を行なう。座標情報変換部243は、以下の式に基づいて補正処理を行ない、各エッジ座標の各座標値を補正した補正座標値(CorrEdgeX, CorrEdgeY)を算出する。

各エッジ座標の座標値は、図4に示したように座標情報テーブルに格納されており、座標情報変換部243は、算出した補正座標値(CorrEdgeX, CorrEdgeY)を、それぞれ補正前の座標値に対応付けて座標情報テーブルに格納する。
The coordinate information conversion unit 243 applies the coordinate values (EdgeX, EdgeY) of all the edge coordinates (left edge coordinates, right edge coordinates, upper edge coordinates, and lower edge coordinates) detected by the edge detection unit 241. Then, correction processing based on the angle α calculated by the angle calculation unit 242 is performed. The coordinate information conversion unit 243 performs correction processing based on the following formula, and calculates corrected coordinate values (CorrEdgeX, CorrEdgeY) obtained by correcting each coordinate value of each edge coordinate.

The coordinate values of each edge coordinate are stored in the coordinate information table as shown in FIG. 4, and the coordinate information conversion unit 243 converts the calculated corrected coordinate values (CorrEdgeX, CorrEdgeY) to the coordinate values before correction. Store them in the coordinate information table in association with each other.

原稿領域検出部244は、座標情報変換部243により算出された各エッジ座標の補正座標値(CorrEdgeX, CorrEdgeY)から、有効な原稿エッジを抽出する。原稿領域検出部244は、有効な原稿エッジとして抽出された補正座標値に基づいて、補正後の原稿領域の頂点の座標値を算出する。補正後の原稿領域の頂点の座標値は、有効な原稿エッジとして抽出された補正座標値のうちの、x座標値の最小値(CorrEdgeMinX)、x座標値の最大値(CorrEdgeMaxX)、y座標値の最小値(CorrEdgeMinY)及びy座標値の最大値(CorrEdgeMaxY)によって示される。即ち、原稿領域は、4頂点(CorrEdgeMinX,CorrEdgeMinY),(CorrEdgeMaxX, CorrEdgeMinY),(CorrEdgeMinX, CorrEdgeMaxY),(CorrEdgeMaxX, CorrEdgeMaxY)で囲まれる領域である。
なお、原稿領域検出部244は、原稿の左側のエッジ及び右側のエッジを抽出する際に、角度算出部242により算出された原稿の傾き角度αと処理切替用閾値とを比較し、比較結果に応じて処理を切り替える。処理切替用閾値は、予め最適な角度に設定されており、3°程度の値である。
The document area detection unit 244 extracts a valid document edge from the corrected coordinate values (CorrEdgeX, CorrEdgeY) of each edge coordinate calculated by the coordinate information conversion unit 243. The document area detection unit 244 calculates the coordinate value of the vertex of the corrected document area based on the corrected coordinate value extracted as a valid document edge. The coordinate values of the vertices of the corrected document area are the minimum x coordinate value (CorrEdgeMinX), the maximum x coordinate value (CorrEdgeMaxX), and the y coordinate value among the corrected coordinate values extracted as valid document edges. The minimum value (CorrEdgeMinY) and the maximum y-coordinate value (CorrEdgeMaxY). That is, the document area is an area surrounded by four vertices (CorrEdgeMinX, CorrEdgeMinY), (CorrEdgeMaxX, CorrEdgeMinY), (CorrEdgeMinX, CorrEdgeMaxY), (CorrEdgeMaxX, CorrEdgeMaxY).
The document area detection unit 244 compares the document inclination angle α calculated by the angle calculation unit 242 with the processing switching threshold when extracting the left edge and the right edge of the document, and determines the comparison result. The process is switched accordingly. The process switching threshold is set in advance to an optimum angle, and is a value of about 3 °.

図6及び図7は原稿領域検出部244による処理の手順を示すフローチャートである。エッジ検出部241及び座標情報変換部243による処理によって、図4に示すような座標情報テーブルが生成された後、原稿領域検出部244は、以下の原稿領域検出処理を行なう。
原稿領域検出部244は、座標情報テーブルに格納された上部エッジ補正座標及び下部エッジ補正座標の各座標値(各画素)に対して有効カウント値を算出する(S1)。具体的には、原稿領域検出部244は、上部エッジ及び下部エッジのそれぞれの補正座標値に対して、複数の異なる間隔で存在する補正座標のy座標値の差分が所定閾値(例えば2画素)以下となる場合の数をカウントし、このカウント値を、各補正座標に対する有効カウント値とする。
6 and 7 are flowcharts showing a procedure of processing performed by the document area detection unit 244. After the coordinate information table as shown in FIG. 4 is generated by the processing by the edge detection unit 241 and the coordinate information conversion unit 243, the document region detection unit 244 performs the following document region detection processing.
The document area detection unit 244 calculates an effective count value for each coordinate value (each pixel) of the upper edge correction coordinates and the lower edge correction coordinates stored in the coordinate information table (S1). Specifically, the document area detection unit 244 determines that a difference between y coordinate values of correction coordinates existing at a plurality of different intervals with respect to the correction coordinate values of the upper edge and the lower edge is a predetermined threshold (for example, two pixels). The number of cases where the number is as follows is counted, and this count value is set as an effective count value for each correction coordinate.

原稿領域検出部244は、上部エッジ及び下部エッジのそれぞれについて、各補正座標に対する有効カウント値から、予め設定されている有効カウントパラメータ(例えば、2)よりも大きい有効カウント値を有する補正座標(エッジ)の有効カウント値の平均値と、最も大きな有効カウント値とを算出する(S2)。以下では、上部エッジに対して算出された有効カウント値の平均値をAveEdgeCountTとし、最大値をMaxEdgeCountTとする。また、下部エッジに対して算出された有効カウント値の平均値をAveEdgeCountBとし、最大値をMaxEdgeCountBとする。   The document area detection unit 244 determines, for each of the upper edge and the lower edge, correction coordinates (edges) having an effective count value larger than a preset effective count parameter (for example, 2) from the effective count value for each correction coordinate. ) And the largest effective count value are calculated (S2). In the following, the average value of the valid count values calculated for the upper edge is AveEdgeCountT, and the maximum value is MaxEdgeCountT. Further, the average value of the effective count values calculated for the lower edge is AveEdgeCountB, and the maximum value is MaxEdgeCountB.

原稿領域検出部244は、上部エッジの各補正座標(各画素)において、平均値AveEdgeCountT以上の有効カウント値を有する補正座標のうちで、y座標値が最も小さい補正座標(エッジ)を上部最大有効エッジに設定する。また、原稿領域検出部244は、上部最大有効エッジに設定した補正座標(エッジ)に対する有効カウント値を、上部エッジの信頼度(T_Conf)に設定する(S3)。なお、平均値AveEdgeCountTは、固定値ではなく、ステップS2で算出されて動的に設定されるパラメータであり、0〜88の値を取り得る。   The document area detection unit 244 sets the correction coordinate (edge) having the smallest y coordinate value among the correction coordinates having an effective count value equal to or greater than the average value AveEdgeCountT in each correction coordinate (each pixel) of the upper edge. Set to edge. In addition, the document area detection unit 244 sets the effective count value for the correction coordinate (edge) set as the upper maximum effective edge in the reliability (T_Conf) of the upper edge (S3). The average value AveEdgeCountT is not a fixed value but a parameter that is calculated and dynamically set in step S2, and can take a value of 0 to 88.

原稿領域検出部244は、下部エッジの各補正座標(各画素)において、平均値AveEdgeCountB以上の有効カウント値を有する補正座標のうちで、y座標値が最も大きい補正座標(エッジ)を下部最大有効エッジに設定する。また、原稿領域検出部244は、下部最大有効エッジに設定した補正座標(エッジ)に対する有効カウント値を、下部エッジの信頼度(B_Conf)に設定する(S4)。なお、平均値AveEdgeCountBは、固定値ではなく、ステップS2で算出されて動的に設定されるパラメータであり、0〜88の値を取り得る。   The document area detection unit 244 determines the correction coordinate (edge) having the largest y-coordinate value among the correction coordinates having an effective count value equal to or greater than the average value AveEdgeCountB at the lower edge maximum correction coordinate (each pixel). Set to edge. Further, the document area detection unit 244 sets the effective count value for the correction coordinate (edge) set as the lower maximum effective edge in the reliability (B_Conf) of the lower edge (S4). The average value AveEdgeCountB is not a fixed value but a parameter that is calculated and dynamically set in step S2, and can take a value of 0 to 88.

原稿領域検出部244は、ステップS3で上部最大有効エッジに設定された補正座標のy座標値に基づいて、座標情報テーブルに格納されている上部エッジの各補正座標が有効であるか無効であるかを判定し、上部有効エッジを抽出する(S5)。具体的には、原稿領域検出部244は、上部最大有効エッジに設定された補正座標のy座標値と、座標情報テーブルに格納されている上部エッジの各補正座標のy座標値との差分をそれぞれ算出する。原稿領域検出部244は、算出した差分が、所定範囲(例えば2画素)以下であれば、この補正座標(エッジ)は上部最大有効エッジの延長線上に存在する(有効である)と判断し、有効エッジとして抽出する。一方、算出した差分が所定範囲以下でない場合、原稿領域検出部244は、この補正座標(エッジ)は上部最大有効エッジの延長線上に存在しない(無効である)と判断し、有効エッジとして抽出しない。   Based on the y coordinate value of the correction coordinate set as the upper maximum effective edge in step S3, the document area detection unit 244 determines whether the correction coordinates of the upper edge stored in the coordinate information table are valid or invalid. And the upper effective edge is extracted (S5). Specifically, the document area detection unit 244 calculates a difference between the y coordinate value of the correction coordinate set to the upper maximum effective edge and the y coordinate value of each correction coordinate of the upper edge stored in the coordinate information table. Calculate each. If the calculated difference is equal to or less than a predetermined range (for example, 2 pixels), the document area detection unit 244 determines that the correction coordinate (edge) is present (effective) on the extension line of the upper maximum effective edge, Extract as a valid edge. On the other hand, when the calculated difference is not less than or equal to the predetermined range, the document area detection unit 244 determines that the correction coordinate (edge) does not exist (invalid) on the extension line of the upper maximum effective edge and does not extract it as an effective edge. .

同様に、原稿領域検出部244は、座標情報テーブルに格納されている下部エッジの各補正座標に対しても有効であるか無効であるかの判定を行ない、下部有効エッジを抽出する(S6)。具体的には、原稿領域検出部244は、下部最大有効エッジに設定された補正座標のy座標値と、下部エッジの各補正座標のy座標値との差分をそれぞれ算出する。原稿領域検出部244は、算出した差分が、所定範囲以下であれば、この補正座標(エッジ)は下部最大有効エッジの延長線上に存在する(有効である)と判断し、有効エッジとして抽出する。一方、算出した差分が所定範囲以下でない場合、原稿領域検出部244は、この補正座標(エッジ)は下部最大有効エッジの延長線上に存在しない(無効である)と判断し、有効エッジとして抽出しない。   Similarly, the document area detection unit 244 determines whether the correction coordinates of the lower edge stored in the coordinate information table are valid or invalid, and extracts the lower valid edge (S6). . Specifically, the document area detection unit 244 calculates the difference between the y coordinate value of the correction coordinate set to the lower maximum effective edge and the y coordinate value of each correction coordinate of the lower edge. If the calculated difference is equal to or smaller than the predetermined range, the document area detection unit 244 determines that the corrected coordinate (edge) exists on the extension line of the lower maximum effective edge (is effective) and extracts it as an effective edge. . On the other hand, if the calculated difference is not less than or equal to the predetermined range, the document area detection unit 244 determines that the correction coordinate (edge) does not exist (invalid) on the extension line of the lower maximum effective edge, and does not extract it as an effective edge. .

図8は各エッジが有効であるか否かの判定処理を説明するための模式図である。図8の上側には、上部エッジの補正座標(エッジ)が有効であるか否かの判定処理を説明するための図を示しており、エッジE1が上部最大有効エッジに設定されているものとする。この場合、エッジE2のy座標値とエッジE1のy座標値との差分が所定範囲以下であれば、エッジE2は有効エッジとして抽出され、差分が所定範囲以下でなければ、エッジE2は無効と判定される。また、図8の下側には、下部エッジの補正座標(エッジ)が有効であるか否かの判定処理を説明するための図を示しており、エッジE3が下部最大有効エッジに設定されているものとする。この場合、エッジE4のy座標値とエッジE3のy座標値との差分が所定範囲以下であれば、エッジE4は有効エッジとして抽出され、差分が所定範囲以下でなければ、エッジE4は無効と判定される。   FIG. 8 is a schematic diagram for explaining processing for determining whether or not each edge is valid. The upper side of FIG. 8 shows a diagram for explaining whether or not the correction coordinate (edge) of the upper edge is valid, and that the edge E1 is set as the upper maximum valid edge. To do. In this case, if the difference between the y-coordinate value of the edge E2 and the y-coordinate value of the edge E1 is less than or equal to a predetermined range, the edge E2 is extracted as an effective edge, and if the difference is not less than or equal to the predetermined range, the edge E2 is invalid. Determined. Further, the lower side of FIG. 8 shows a diagram for explaining the determination process of whether or not the correction coordinate (edge) of the lower edge is valid, and the edge E3 is set as the lower maximum valid edge. It shall be. In this case, if the difference between the y-coordinate value of the edge E4 and the y-coordinate value of the edge E3 is less than or equal to a predetermined range, the edge E4 is extracted as an effective edge, and if the difference is not less than or equal to the predetermined range, the edge E4 is invalid. Determined.

原稿領域検出部244は、ステップS1と同様の処理を行ない、座標情報テーブルに格納された左部エッジ補正座標及び右部エッジ補正座標の各座標値(各画素)に対する有効カウント値を算出する(S7)。ここでは、原稿領域検出部244は、左部エッジ及び右部エッジのそれぞれの補正座標値に対して、複数の異なる間隔で存在する補正座標のx座標値の差分が所定閾値(例えば2画素)以下となる場合の数をカウントし、このカウント値を、各補正座標に対する有効カウント値とする。   The document area detection unit 244 performs the same processing as step S1, and calculates an effective count value for each coordinate value (each pixel) of the left edge correction coordinates and the right edge correction coordinates stored in the coordinate information table ( S7). Here, the document area detection unit 244 determines that a difference between x coordinate values of correction coordinates existing at a plurality of different intervals with respect to the correction coordinate values of the left edge and the right edge is a predetermined threshold (for example, two pixels). The number of cases where the number is as follows is counted, and this count value is set as an effective count value for each correction coordinate.

また、原稿領域検出部244は、ステップS2と同様の処理を行ない、左部エッジ及び右部エッジのそれぞれについて、各補正座標に対する有効カウント値から、予め設定されている有効カウントパラメータ(例えば、2)よりも大きい有効カウント値を有する補正座標(エッジ)の有効カウント値の平均値と、最も大きな有効カウント値とを算出する(S8)。以下では、左部エッジに対して算出された有効カウント値の平均値をAveEdgeCountLとし、最大値をMaxEdgeCountLとする。また、右部エッジに対して算出された有効カウント値の平均値をAveEdgeCountRとし、最大値をMaxEdgeCountRとする。   In addition, the document area detection unit 244 performs the same processing as in step S2, and for each of the left edge and the right edge, a valid count parameter (for example, 2) set in advance from the valid count value for each correction coordinate. The average value of the effective count values of the correction coordinates (edge) having an effective count value larger than () and the largest effective count value are calculated (S8). In the following, the average value of the effective count values calculated for the left edge is AveEdgeCountL, and the maximum value is MaxEdgeCountL. Further, the average value of the effective count values calculated for the right edge is AveEdgeCountR, and the maximum value is MaxEdgeCountR.

ここで、原稿領域検出部244は、角度算出部242により算出された原稿の傾き角度αと処理切替用閾値とを比較し、傾き角度αが閾値以上であるか否かを判断する(S9)。傾き角度αが閾値以上であると判断した場合(S9:YES)、原稿領域検出部244は、ステップS3と同様の処理を行なう。具体的には、原稿領域検出部244は、左部エッジの各補正座標(各画素)において、平均値AveEdgeCountL以上の有効カウント値を有する補正座標のうちで、x座標値が最も小さい補正座標(エッジ)を左部最大有効エッジに設定する。また、原稿領域検出部244は、左部最大有効エッジに設定した補正座標(エッジ)に対する有効カウント値を、左部エッジの信頼度(L_Conf)に設定する(S10)。なお、平均値AveEdgeCountLは、固定値ではなく、ステップS8で算出されて動的に設定されるパラメータであり、0〜88の値を取り得る。   Here, the document area detection unit 244 compares the document inclination angle α calculated by the angle calculation unit 242 with the process switching threshold value, and determines whether the inclination angle α is equal to or greater than the threshold value (S9). . When it is determined that the inclination angle α is equal to or greater than the threshold (S9: YES), the document area detection unit 244 performs the same process as in step S3. Specifically, the document area detection unit 244 has a correction coordinate (x coordinate value having the smallest x coordinate value among correction coordinates having an effective count value equal to or greater than the average value AveEdgeCountL at each correction coordinate (each pixel) of the left edge. Edge) is set to the left most effective edge. Further, the document area detection unit 244 sets the effective count value for the correction coordinate (edge) set to the left maximum effective edge in the reliability (L_Conf) of the left edge (S10). Note that the average value AveEdgeCountL is not a fixed value but a parameter that is calculated and dynamically set in step S8 and can take a value of 0 to 88.

また、原稿領域検出部244は、ステップS4と同様の処理を行ない、右部エッジの各補正座標(各画素)において、平均値AveEdgeCountR以上の有効カウント値を有する補正座標のうちで、x座標値が最も大きい補正座標(エッジ)を右部最大有効エッジに設定する。また、原稿領域検出部244は、右部最大有効エッジに設定した補正座標(エッジ)に対する有効カウント値を、右部エッジの信頼度(R_Conf)に設定する(S11)。なお、平均値AveEdgeCountRは、固定値ではなく、ステップS8で算出されて動的に設定されるパラメータであり、0〜88の値を取り得る。   Further, the document area detection unit 244 performs the same processing as in step S4, and among the correction coordinates having an effective count value equal to or greater than the average value AveEdgeCountR at each correction coordinate (each pixel) of the right edge, the x coordinate value The correction coordinate (edge) having the largest value is set as the right maximum effective edge. Further, the document area detection unit 244 sets the effective count value for the correction coordinates (edge) set to the right maximum effective edge in the reliability (R_Conf) of the right edge (S11). The average value AveEdgeCountR is not a fixed value but a parameter that is calculated and dynamically set in step S8 and can take a value of 0 to 88.

一方、傾き角度αが閾値以上でない場合(S9:NO)、原稿領域検出部244は、左部エッジ及び右部エッジの各補正座標に基づいて、左部最大有効エッジの候補及び右部最大有効エッジの候補をそれぞれ3つずつ算出する(S12)。
まず、原稿領域検出部244は、ステップS10,S11と同様の処理を行ない、左部最大有効エッジ及び右部最大有効エッジの1つ目の候補を算出する。
On the other hand, when the inclination angle α is not greater than or equal to the threshold (S9: NO), the document area detection unit 244 determines the left maximum effective edge candidate and the right maximum effective based on the correction coordinates of the left edge and the right edge. Three edge candidates are calculated (S12).
First, the document area detection unit 244 performs the same processing as steps S10 and S11, and calculates the first candidate of the left maximum effective edge and the right maximum effective edge.

次に、原稿領域検出部244は、ステップS5,S6で抽出された上部有効エッジ及び下部有効エッジの端部(左端部)よりも外側(左側)にあり、且つ、ステップS8で算出した平均値AveEdgeCountL以上の有効カウント値を有する補正座標(画素)のうちで、最も外側(左側)の補正座標を特定する。即ち、原稿領域検出部244は、上部有効エッジ及び下部有効エッジとして抽出された補正座標のx座標値のうちで最小のx座標値を特定し、特定したx座標値よりも小さいx座標値を有し、且つ、平均値AveEdgeCountL以上の有効カウント値を有する補正座標(画素)を特定し、特定した補正座標のうちで、x座標値が最小である補正座標を特定する。原稿領域検出部244は、特定した補正座標を、左部最大有効エッジの2つ目の候補とする。   Next, the document area detection unit 244 is located outside (on the left side) the end (left end) of the upper effective edge and the lower effective edge extracted in steps S5 and S6, and the average value calculated in step S8. Among correction coordinates (pixels) having an effective count value equal to or greater than AveEdgeCountL, the outermost (left side) correction coordinates are specified. In other words, the document area detection unit 244 specifies the minimum x coordinate value among the x coordinate values of the corrected coordinates extracted as the upper effective edge and the lower effective edge, and sets an x coordinate value smaller than the specified x coordinate value. A correction coordinate (pixel) having an effective count value equal to or greater than the average value AveEdgeCountL is specified, and a correction coordinate having a minimum x coordinate value is specified among the specified correction coordinates. The document area detection unit 244 sets the specified correction coordinates as the second candidate for the leftmost maximum effective edge.

同様に、原稿領域検出部244は、ステップS5,S6で抽出された上部有効エッジ及び下部有効エッジの端部(右端部)よりも外側(右側)にあり、且つ、ステップS8で算出した平均値AveEdgeCountR以上の有効カウント値を有する補正座標(画素)のうちで、最も外側(右側)の補正座標を特定する。即ち、原稿領域検出部244は、上部有効エッジ及び下部有効エッジとして抽出された補正座標のx座標値のうちで最大のx座標値を特定し、特定したx座標値よりも大きいx座標値を有し、且つ、平均値AveEdgeCountR以上の有効カウント値を有する補正座標(画素)を特定し、特定した補正座標のうちで、x座標値が最大である補正座標を特定する。原稿領域検出部244は、特定した補正座標を、右部最大有効エッジの2つ目の候補とする。   Similarly, the document area detection unit 244 is located outside (on the right side) the end (right end) of the upper and lower effective edges extracted in steps S5 and S6, and the average value calculated in step S8. Among correction coordinates (pixels) having an effective count value equal to or greater than AveEdgeCountR, the outermost (right) correction coordinates are specified. That is, the document area detection unit 244 specifies the maximum x coordinate value among the x coordinate values of the correction coordinates extracted as the upper effective edge and the lower effective edge, and sets an x coordinate value larger than the specified x coordinate value. The correction coordinate (pixel) having an effective count value equal to or greater than the average value AveEdgeCountR is specified, and the correction coordinate having the maximum x coordinate value is specified among the specified correction coordinates. The document area detection unit 244 sets the specified correction coordinate as the second candidate for the rightmost maximum effective edge.

最後に、原稿領域検出部244は、ステップS5,S6で抽出された上部有効エッジ及び下部有効エッジの端部(左端)を中心とする所定範囲内にあり、且つ、ステップS8で算出した平均値AveEdgeCountL以上の有効カウント値を有する補正座標(画素)のうちで、最も外側(左側)の補正座標を特定する。即ち、原稿領域検出部244は、上部有効エッジ及び下部有効エッジとして抽出された補正座標のx座標値のうちで最小のx座標値を特定し、特定したx座標値を中心とした所定範囲内のx座標値を有し、且つ、平均値AveEdgeCountL以上の有効カウント値を有する補正座標(画素)を特定し、特定した補正座標のうちで、x座標値が最小である補正座標を特定する。原稿領域検出部244は、特定した補正座標を、左部最大有効エッジの3つ目の候補とする。   Finally, the document area detection unit 244 is within a predetermined range centered on the ends (left end) of the upper effective edge and the lower effective edge extracted in steps S5 and S6, and the average value calculated in step S8. Among correction coordinates (pixels) having an effective count value equal to or greater than AveEdgeCountL, the outermost (left side) correction coordinates are specified. That is, the document area detection unit 244 specifies the minimum x coordinate value among the x coordinate values of the correction coordinates extracted as the upper effective edge and the lower effective edge, and falls within a predetermined range centered on the specified x coordinate value. Correction coordinates (pixels) having an x-coordinate value and an effective count value equal to or greater than the average value AveEdgeCountL are identified, and among the identified correction coordinates, the correction coordinate having the smallest x-coordinate value is identified. The document area detection unit 244 sets the specified correction coordinates as the third candidate for the leftmost maximum effective edge.

同様に、原稿領域検出部244は、ステップS5,S6で抽出された上部有効エッジ及び下部有効エッジの端部(右端部)を中心とする所定範囲内にあり、且つ、ステップS8で算出した平均値AveEdgeCountR以上の有効カウント値を有する補正座標(画素)のうちで、最も外側(右側)の補正座標を特定する。即ち、原稿領域検出部244は、上部有効エッジ及び下部有効エッジとして抽出された補正座標のx座標値のうちで最大のx座標値を特定し、特定したx座標値を中心とした所定範囲内のx座標値を有し、且つ、平均値AveEdgeCountR以上の有効カウント値を有する補正座標(画素)を特定し、特定した補正座標のうちで、x座標値が最大である補正座標を特定する。原稿領域検出部244は、特定した補正座標を、右部最大有効エッジの3つ目の候補とする。   Similarly, the document area detection unit 244 is within a predetermined range centered on the end (right end) of the upper effective edge and the lower effective edge extracted in steps S5 and S6, and the average calculated in step S8. Among the correction coordinates (pixels) having an effective count value equal to or greater than the value AveEdgeCountR, the outermost (right side) correction coordinates are specified. In other words, the document area detection unit 244 specifies the maximum x coordinate value among the x coordinate values of the correction coordinates extracted as the upper effective edge and the lower effective edge, and falls within a predetermined range centered on the specified x coordinate value. Correction coordinates (pixels) having an x-coordinate value and an effective count value equal to or greater than the average value AveEdgeCountR are identified, and among the identified correction coordinates, the correction coordinate having the maximum x-coordinate value is identified. The document area detection unit 244 sets the specified correction coordinates as the third candidate for the rightmost maximum effective edge.

図9は左部最大有効エッジ及び右部最大有効エッジの候補を示す模式図である。図9の上側には、左部最大有効エッジの3つの候補の例を示し、図9の下側には、右部最大有効エッジの3つの候補の例を示す。図中の2本の破線の間が、上部有効エッジ及び下部有効エッジの端部を中心とする所定範囲を示す。   FIG. 9 is a schematic diagram showing candidates for the left maximum effective edge and the right maximum effective edge. The upper part of FIG. 9 shows an example of three candidates for the left maximum effective edge, and the lower part of FIG. 9 shows an example of three candidates for the right maximum effective edge. Between the two broken lines in the figure, a predetermined range centering on the ends of the upper effective edge and the lower effective edge is shown.

原稿領域検出部244は、左部最大有効エッジの3つの候補から1つを選択し、右部最大有効エッジの3つの候補から1つを選択し、左部最大有効エッジ及び右部最大有効エッジを決定する(S13)。ここでは、左部最大有効エッジ及び右部最大有効エッジのそれぞれについて、上述した3つ目の候補(図9ではエッジE7,E10)が算出されていた場合、3つ目の候補を左部最大有効エッジ又は右部最大有効エッジに決定する。3つ目の候補は、上部エッジ及び下部エッジの補正座標も利用し、範囲を限定して抽出されるので、最も信頼度の高い候補となり、このような候補が存在する場合は、この候補(エッジ)を最大有効エッジとする。   The document area detection unit 244 selects one of the three candidates for the left maximum effective edge, selects one of the three candidates for the right maximum effective edge, and selects the left maximum effective edge and the right maximum effective edge. Is determined (S13). Here, when the above-mentioned third candidate (edges E7 and E10 in FIG. 9) is calculated for each of the left maximum effective edge and the right maximum effective edge, the third candidate is determined to be the left maximum The effective edge or the right maximum effective edge is determined. The third candidate is also extracted by limiting the range using the correction coordinates of the upper edge and the lower edge. Therefore, the third candidate is the most reliable candidate. If such a candidate exists, this candidate ( Edge) is the maximum effective edge.

3つ目の候補が算出されなかった場合、2つ目の候補(図9ではエッジE6,E9)を左部最大有効エッジ又は右部最大有効エッジに決定する。2つ目の候補は、原稿内のコンテンツが欠けることを防止するために極力広い領域となるように抽出されるので、3つ目の候補が存在しない場合は、この候補(エッジ)を最大有効エッジとする。2つ目の候補も算出されなかった場合、1つ目の候補(図9ではエッジE5,E8)を左部最大有効エッジ又は右部最大有効エッジに決定する。1つ目の候補は、実際の原稿エッジを抽出できなかった場合であっても、原稿内のコンテンツ欠けが発生しないように抽出されるので、2つ目の候補及び3つ目の候補が共に存在しない場合にのみ、この候補(エッジ)を最大有効エッジとする。   When the third candidate is not calculated, the second candidate (edges E6 and E9 in FIG. 9) is determined as the left maximum effective edge or the right maximum effective edge. The second candidate is extracted so as to be as wide as possible in order to prevent the content in the document from being lost. If the third candidate does not exist, this candidate (edge) is maximized. Edge. When the second candidate is not calculated, the first candidate (edges E5 and E8 in FIG. 9) is determined as the left maximum effective edge or the right maximum effective edge. The first candidate is extracted so as not to cause missing content in the document even if the actual document edge cannot be extracted. Therefore, both the second candidate and the third candidate are included. Only when it does not exist, this candidate (edge) is set as the maximum effective edge.

原稿領域検出部244は、左部最大有効エッジに設定した補正座標(エッジ)に対する有効カウント値を、左部エッジの信頼度(L_Conf)に設定し、右部最大有効エッジに設定した補正座標(エッジ)に対する有効カウント値を、右部エッジの信頼度(R_Conf)に設定する(S14)。   The document area detection unit 244 sets the effective count value for the correction coordinate (edge) set to the left maximum effective edge to the reliability (L_Conf) of the left edge, and the correction coordinate ( The effective count value for the edge) is set to the reliability (R_Conf) of the right edge (S14).

原稿領域検出部244は、ステップS10又はS13で左部最大有効エッジに設定された補正座標(画素)のx座標値に基づいて、座標情報テーブルに格納されている左部エッジの各補正座標が有効であるか無効であるかを判定し、左部有効エッジを抽出する(S15)。具体的には、原稿領域検出部244は、左部最大有効エッジに設定された補正座標のx座標値と、座標情報テーブルに格納されている左部エッジの各補正座標のx座標値との差分をそれぞれ算出する。原稿領域検出部244は、算出した差分が、所定範囲(例えば2画素)以下であれば、この補正座標(エッジ)は左部最大有効エッジの延長線上に存在する(有効である)と判断し、有効エッジとして抽出する。一方、算出した差分が所定範囲以下でない場合、原稿領域検出部244は、この補正座標(エッジ)は左部最大有効エッジの延長線上に存在しない(無効である)と判断し、有効エッジとして抽出しない。   Based on the x coordinate value of the correction coordinates (pixels) set as the left maximum effective edge in step S10 or S13, the document area detection unit 244 determines the correction coordinates of the left edge stored in the coordinate information table. It is determined whether it is valid or invalid, and the left effective edge is extracted (S15). Specifically, the document area detection unit 244 calculates the x coordinate value of the correction coordinate set to the left maximum effective edge and the x coordinate value of each correction coordinate of the left edge stored in the coordinate information table. Each difference is calculated. If the calculated difference is equal to or less than a predetermined range (for example, two pixels), the document area detection unit 244 determines that the correction coordinate (edge) is present (effective) on the extension line of the left maximum effective edge. , Extracted as a valid edge. On the other hand, if the calculated difference is not less than or equal to the predetermined range, the document area detection unit 244 determines that the correction coordinate (edge) does not exist (invalid) on the extension line of the left maximum effective edge and extracts it as an effective edge. do not do.

同様に、原稿領域検出部244は、座標情報テーブルに格納されている右部エッジの各補正座標に対しても有効であるか無効であるかの判定を行ない、右部有効エッジを抽出する(S16)。具体的には、原稿領域検出部244は、右部最大有効エッジに設定された補正座標(画素)のx座標値と、右部エッジの各補正座標のx座標値との差分をそれぞれ算出する。原稿領域検出部244は、算出した差分が、所定範囲以下であれば、この補正座標(エッジ)は右部最大有効エッジの延長線上に存在する(有効である)と判断し、有効エッジとして抽出する。一方、算出した差分が所定範囲以下でない場合、原稿領域検出部244は、この補正座標(エッジ)は右部最大有効エッジの延長線上に存在しない(無効である)と判断し、有効エッジとして抽出しない。   Similarly, the document area detection unit 244 determines whether it is valid or invalid for each correction coordinate of the right edge stored in the coordinate information table, and extracts the right effective edge ( S16). Specifically, the document area detection unit 244 calculates the difference between the x coordinate value of the correction coordinate (pixel) set to the right maximum effective edge and the x coordinate value of each correction coordinate of the right edge. . If the calculated difference is equal to or smaller than the predetermined range, the document area detection unit 244 determines that the correction coordinate (edge) exists on the extension line of the right maximum effective edge (is effective) and extracts it as an effective edge. To do. On the other hand, if the calculated difference is not less than or equal to the predetermined range, the document area detection unit 244 determines that the correction coordinate (edge) does not exist (invalid) on the extension line of the right maximum effective edge and extracts it as an effective edge. do not do.

原稿領域検出部244は、ステップS5,S6,S15,S16でそれぞれ上部有効エッジ、下部有効エッジ、左部有効エッジ又は右部有効エッジとして抽出された各補正座標(画素)について、有効エッジのままとするか、孤立点ノイズとして破棄するかを判定する(S17)。具体的には、原稿領域検出部244は、ステップS15で抽出された左部有効エッジの中に、ステップS5,S6で抽出された上部有効エッジ及び下部有効エッジよりも外側(上側又は下側)に存在するエッジ(画素)がある場合、そのエッジを有効エッジのままとするか、孤立点ノイズとするかを判定する。より具体的には、原稿領域検出部244は、左部有効エッジの中に、上部有効エッジのy座標値よりも小さいy座標値を有するエッジがある場合、及び下部有効エッジのy座標値よりも大きいy座標値を有するエッジがある場合、そのエッジを有効エッジのままとするか、孤立点ノイズとするかを判定する。   The document area detection unit 244 remains the effective edge for each correction coordinate (pixel) extracted as the upper effective edge, the lower effective edge, the left effective edge, or the right effective edge in steps S5, S6, S15, and S16, respectively. Or whether it is discarded as isolated point noise (S17). Specifically, the document area detecting unit 244 is outside (upper or lower) of the upper effective edge and the lower effective edge extracted in steps S5 and S6 in the left effective edge extracted in step S15. If there is an edge (pixel) existing in the area, it is determined whether the edge remains an effective edge or is isolated point noise. More specifically, the document area detection unit 244 determines that the left effective edge includes an edge having a y coordinate value smaller than the y coordinate value of the upper effective edge, and the y effective coordinate value of the lower effective edge. If there is an edge having a larger y coordinate value, it is determined whether the edge remains an effective edge or is isolated point noise.

判定方法としては、例えば、各エッジから所定範囲(例えば3画素分)内に存在する有効エッジ数が所定数(例えば2画素)以下である場合に、そのエッジを孤立点ノイズとして無効とする。また、例えば、各エッジの補正座標(各画素)が、上部有効エッジ及び下部有効エッジの各補正座標から所定距離(例えば3画素分)以上離れている場合に、そのエッジを孤立点ノイズとして無効とする。   As a determination method, for example, when the number of valid edges existing within a predetermined range (for example, 3 pixels) from each edge is equal to or less than a predetermined number (for example, 2 pixels), the edge is invalidated as isolated point noise. Also, for example, when the correction coordinates (each pixel) of each edge are separated from the correction coordinates of the upper effective edge and lower effective edge by a predetermined distance (for example, 3 pixels) or more, the edge is invalid as isolated point noise. And

同様に、原稿領域検出部244は、ステップS16で抽出された右部有効エッジの中に、ステップS5,S6で抽出された上部有効エッジ及び下部有効エッジよりも外側(上側又は下側)に存在するエッジ(画素)がある場合、このエッジを有効エッジのままとするか、孤立点ノイズとするかを判定する。また、原稿領域検出部244は、ステップS5で抽出された上部有効エッジの中に、ステップS15,S16で抽出された左部有効エッジ及び右部有効エッジよりも外側(左側又は右側)に存在するエッジ(画素)がある場合、このエッジを有効エッジのままとするか、孤立点ノイズとするかを判定する。更に、原稿領域検出部244は、ステップS6で抽出された下部有効エッジの中に、ステップS15,S16で抽出された左部有効エッジ及び右部有効エッジよりも外側(左側又は右側)に存在するエッジ(画素)がある場合、このエッジを有効エッジのままとするか、孤立点ノイズとするかを判定する。   Similarly, the document area detection unit 244 exists outside (upper or lower) of the upper and lower effective edges extracted in steps S5 and S6 in the right effective edge extracted in step S16. If there is an edge (pixel) to be used, it is determined whether this edge remains as an effective edge or is isolated point noise. Further, the document area detection unit 244 exists in the upper effective edge extracted in step S5 outside the left effective edge and the right effective edge extracted in steps S15 and S16 (left side or right side). If there is an edge (pixel), it is determined whether this edge remains as an effective edge or is isolated point noise. Further, the document area detection unit 244 exists outside (on the left or right side) the left and right effective edges extracted in steps S15 and S16 among the lower effective edges extracted in step S6. If there is an edge (pixel), it is determined whether this edge remains as an effective edge or is isolated point noise.

図10は孤立点ノイズであるか否かの判定処理を説明するための模式図である。図10には、左部有効エッジの中に、上部有効エッジのy座標値よりも小さいy座標値を有するエッジE11がある場合を示している。この場合、エッジE11から所定範囲内に存在する有効エッジの数、又はエッジE11の補正座標値等に基づいて、エッジE11が孤立点ノイズであるか否かが判定される。   FIG. 10 is a schematic diagram for explaining a process for determining whether or not it is isolated point noise. FIG. 10 shows a case where the left effective edge includes an edge E11 having a y coordinate value smaller than the y coordinate value of the upper effective edge. In this case, it is determined whether or not the edge E11 is isolated point noise based on the number of effective edges existing within a predetermined range from the edge E11, the correction coordinate value of the edge E11, or the like.

原稿領域検出部244は、ステップS17で有効エッジであると判定された有効エッジ(上部有効エッジ、下部有効エッジ、左部有効エッジ及び右部有効エッジ)の補正座標値に基づいて、補正後の原稿領域の頂点の座標値を算出する(S18)。原稿領域検出部244は、各有効エッジの補正座標値のうちで、最小のx座標値(CorrEdgeMinX)、最大のx座標値(CorrEdgeMaxX)、最小のy座標値(CorrEdgeMinY)及び最大のy座標値(CorrEdgeMaxY)を特定し、補正後の原稿領域の頂点の各座標値とする。   The document area detection unit 244 performs the correction based on the corrected coordinate values of the effective edges (upper effective edge, lower effective edge, left effective edge, and right effective edge) determined to be effective edges in step S17. The coordinate value of the vertex of the document area is calculated (S18). The document area detection unit 244 has a minimum x coordinate value (CorrEdgeMinX), a maximum x coordinate value (CorrEdgeMaxX), a minimum y coordinate value (CorrEdgeMinY), and a maximum y coordinate value among the correction coordinate values of each effective edge. (CorrEdgeMaxY) is specified, and each coordinate value of the vertex of the corrected document area is set.

図3に戻り、切り取り領域判定部245による処理について説明をする。
切り取り領域判定部245は、原稿領域検出部244により算出された補正後の原稿領域の4頂点の座標値、各エッジの信頼度(T_Conf,B_Conf,L_Conf,R_Conf)及び予め指定された出力画像のサイズ情報(OutSizeX,OutSizeY)に基づいて、入力画像に対して切り取るべき領域を判定する。切り取り領域判定部245は、1又は2つの切り取り領域を特定し、各切り取り領域を特定するための4頂点の座標値を1組又は2組算出する。なお、切り取り領域を特定するための4頂点の座標値は、x座標値の最小値(CropAreaMinX1,CropAreaMinX2)、x座標値の最大値(CropAreaMaxX1,CropAreaMaxX2)、y座標値の最小値(CropAreaMinY1,CropAreaMinY2)及びy座標値の最大値(CropAreaMaxY1,CropAreaMaxY2)によって示される。即ち、切り取り領域は、4頂点(CropAreaMinX,CropAreaMinY),(CropAreaMaxX,CropAreaMinY),(CropAreaMinX,CropAreaMaxY),(CropAreaMaxX,CropAreaMaxY)で囲まれる領域である。以下では、切り取り領域の4頂点の座標値を(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1)及び(CropAreaMinX2, CropAreaMaxX2, CropAreaMinY2, CropAreaMaxY2)と省略して示す。
Returning to FIG. 3, processing by the cut region determination unit 245 will be described.
The cut region determination unit 245 calculates the coordinate values of the four vertices of the corrected document region calculated by the document region detection unit 244, the reliability of each edge (T_Conf, B_Conf, L_Conf, R_Conf), and the output image specified in advance. Based on the size information (OutSizeX, OutSizeY), an area to be cut out from the input image is determined. The cut area determination unit 245 specifies one or two cut areas, and calculates one or two sets of coordinate values of four vertices for specifying each cut area. Note that the coordinate values of the four vertices for specifying the cropping area are the minimum value of the x coordinate value (CropAreaMinX1, CropAreaMinX2), the maximum value of the x coordinate value (CropAreaMaxX1, CropAreaMaxX2), and the minimum value of the y coordinate value (CropAreaMinY1, CropAreaMinY2) ) And the maximum value of the y-coordinate values (CropAreaMaxY1, CropAreaMaxY2). That is, the cut region is a region surrounded by four vertices (CropAreaMinX, CropAreaMinY), (CropAreaMaxX, CropAreaMinY), (CropAreaMinX, CropAreaMaxY), (CropAreaMaxX, CropAreaMaxY). In the following, the coordinate values of the four vertices of the cropping area are abbreviated as (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1) and (CropAreaMinX2, CropAreaMaxX2, CropAreaMinY2, CropAreaMaxY2).

図11は切り取り領域判定部245による処理の手順を示すフローチャートである。切り取り領域判定部245は、まず、補正後の原稿領域の頂点の座標値に基づいて、以下の2つのパラメータCorrEdgeDiffX及びCorrEdgeDiffYを算出しておく。
CorrEdgeDiffX=CorrEdgeMaxX−CorrEdgeMinX
CorrEdgeDiffY=CorrEdgeMaxY−CorrEdgeMinY
FIG. 11 is a flowchart illustrating a processing procedure performed by the cut-out area determination unit 245. The cut area determination unit 245 first calculates the following two parameters CorrEdgeDiffX and CorrEdgeDiffY based on the coordinate values of the vertices of the corrected document area.
CorrEdgeDiffX = CorrEdgeMaxX−CorrEdgeMinX
CorrEdgeDiffY = CorrEdgeMaxY−CorrEdgeMinY

切り取り領域判定部245は、原稿領域検出部244により算出された上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)が共に、高信頼度判定用閾値(TH)以上であるか否かを判断する(S21)。信頼度(T_Conf,B_Conf)が共に高信頼度判定用閾値(TH)以上である場合(S21:YES)、切り取り領域判定部245は、(OutSizeY−CorrEdgeDiffY)の絶対値(|OutSizeY−CorrEdgeDiffY|)と、(OutSizeX−CorrEdgeDiffY)の絶対値(|OutSizeX−CorrEdgeDiffY|)とを算出し、
|OutSizeY−CorrEdgeDiffY|<|OutSizeX−CorrEdgeDiffY|
であるか否かを判断する(S22)。
The cut area determination unit 245 has the reliability (T_Conf) of the upper effective edge and the reliability (B_Conf) of the lower effective edge calculated by the document area detection unit 244 both equal to or higher than the threshold value (TH) for high reliability determination. It is determined whether or not (S21). When the reliability (T_Conf, B_Conf) is equal to or higher than the high reliability determination threshold (TH) (S21: YES), the cutout area determination unit 245 determines the absolute value (| OutSizeY−CorrEdgeDiffY |) of (OutSizeY−CorrEdgeDiffY |) And the absolute value (| OutSizeX−CorrEdgeDiffY |) of (OutSizeX−CorrEdgeDiffY)
| OutSizeY−CorrEdgeDiffY | <| OutSizeX−CorrEdgeDiffY |
It is determined whether or not (S22).

|OutSizeY−CorrEdgeDiffY|<|OutSizeX−CorrEdgeDiffY|であるか否かを判断することにより、原稿領域検出部244によって検出された領域が、実際の出力画像サイズと比べて、縦横サイズが入れ替わっているか否かを判断することができる。
|OutSizeY−CorrEdgeDiffY|<|OutSizeX−CorrEdgeDiffY|である場合(S22:YES)、縦横サイズが入れ替わっていないとして、切り取り領域判定部245は、第1の切り取り領域判定処理を実行する(S23)。第1の切り取り領域判定処理の詳細については後述する。
By determining whether or not | OutSizeY−CorrEdgeDiffY | <| OutSizeX−CorrEdgeDiffY |, whether the vertical / horizontal size of the area detected by the document area detection unit 244 is switched compared to the actual output image size. Can be determined.
When | OutSizeY−CorrEdgeDiffY | <| OutSizeX−CorrEdgeDiffY | (S22: YES), the cut area determination unit 245 executes the first cut area determination process on the assumption that the vertical and horizontal sizes are not switched (S23). Details of the first cut-out area determination process will be described later.

|OutSizeY−CorrEdgeDiffY|<|OutSizeX−CorrEdgeDiffY|でない場合(S22:NO)、縦横サイズが入れ替わっているとし、切り取り領域判定部245は、第2の切り取り領域判定処理を実行する(S24)。第2の切り取り領域判定処理の詳細については後述する。   If | OutSizeY−CorrEdgeDiffY | <| OutSizeX−CorrEdgeDiffY | is not satisfied (S22: NO), it is assumed that the vertical and horizontal sizes are switched, and the cut region determination unit 245 executes the second cut region determination process (S24). Details of the second cut-out area determination process will be described later.

ステップS21で、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)の少なくとも一方が高信頼度判定用閾値(TH)未満である場合(S21:NO)、切り取り領域判定部245は、原稿領域検出部244により算出された左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)が共に、高信頼度判定用閾値(TH)以上であるか否かを判断する(S25)。信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)以上である場合(S25:YES)、切り取り領域判定部245は、(OutSizeX−CorrEdgeDiffX)の絶対値(|OutSizeX−CorrEdgeDiffX|)と、(OutSizeY−CorrEdgeDiffX)の絶対値(|OutSizeY−CorrEdgeDiffX|)とを算出し、
|OutSizeX−CorrEdgeDiffX|<|OutSizeY−CorrEdgeDiffX|
であるか否かを判断する(S26)。
If at least one of the reliability (T_Conf) of the upper effective edge and the reliability (B_Conf) of the lower effective edge is less than the high reliability determination threshold (TH) in step S21 (S21: NO), a cut region determination unit Whether the reliability of the left effective edge (L_Conf) and the reliability of the right effective edge (R_Conf) calculated by the document area detection unit 244 are both equal to or higher than the threshold value for high reliability determination (TH) 245. Is determined (S25). When the reliability (L_Conf, R_Conf) is equal to or higher than the high reliability determination threshold (TH) (S25: YES), the cutout area determination unit 245 determines the absolute value (| OutSizeX−CorrEdgeDiffX |) of (OutSizeX−CorrEdgeDiffX |) And the absolute value (| OutSizeY−CorrEdgeDiffX |) of (OutSizeY−CorrEdgeDiffX)
| OutSizeX−CorrEdgeDiffX | <| OutSizeY−CorrEdgeDiffX |
It is determined whether or not (S26).

|OutSizeX−CorrEdgeDiffX|<|OutSizeY−CorrEdgeDiffX|であるか否かを判断することにより、原稿領域検出部244によって検出された領域が、実際の出力画像サイズと比べて、縦横サイズが入れ替わっているか否かを判断することができる。
|OutSizeX−CorrEdgeDiffX|<|OutSizeY−CorrEdgeDiffX|である場合(S26:YES)、縦横サイズが入れ替わっていないとして、切り取り領域判定部245は、第3の切り取り領域判定処理を実行する(S27)。第3の切り取り領域判定処理の詳細については後述する。
By determining whether or not | OutSizeX−CorrEdgeDiffX | <| OutSizeY−CorrEdgeDiffX |, whether the vertical / horizontal size of the area detected by the document area detection unit 244 is switched compared to the actual output image size. Can be determined.
When | OutSizeX−CorrEdgeDiffX | <| OutSizeY−CorrEdgeDiffX | (S26: YES), the cut area determination unit 245 executes the third cut area determination process on the assumption that the vertical and horizontal sizes have not been switched (S27). Details of the third cut-out area determination process will be described later.

|OutSizeX−CorrEdgeDiffX|<|OutSizeY−CorrEdgeDiffX|でない場合(S26:NO)、縦横サイズが入れ替わっているとし、切り取り領域判定部245は、第4の切り取り領域判定処理を実行する(S28)。第4の切り取り領域判定処理の詳細については後述する。
ステップS25で、左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)の少なくとも一方が高信頼度判定用閾値(TH)未満である場合(S25:NO)、切り取り領域判定部245は、第5の切り取り領域判定処理を実行する(S29)。第5の切り取り領域判定処理の詳細については後述する。
If | OutSizeX−CorrEdgeDiffX | <| OutSizeY−CorrEdgeDiffX | is not satisfied (S26: NO), it is assumed that the vertical and horizontal sizes have been switched, and the cut region determination unit 245 executes the fourth cut region determination process (S28). Details of the fourth cut area determination processing will be described later.
If at least one of the reliability of the left effective edge (L_Conf) and the reliability of the right effective edge (R_Conf) is less than the high reliability determination threshold (TH) in step S25 (S25: NO), the cut region The determination unit 245 executes a fifth cut area determination process (S29). Details of the fifth cut region determination process will be described later.

以下に、第1〜第5の切り取り領域判定処理について説明する。
第1の切り取り領域判定処理を行なう場合、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)をそれぞれ高信頼度判定用閾値(TH)と比較し、比較結果に応じて1組の4頂点座標(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1)を算出する。即ち、1つの切り取り領域が特定される。
Below, the 1st-5th cut area determination process is demonstrated.
When the first cut region determination process is performed, the cut region determination unit 245 sets the reliability of the left effective edge (L_Conf) and the reliability of the right effective edge (R_Conf) as a high reliability determination threshold (TH). And a set of four vertex coordinates (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1) are calculated according to the comparison result. That is, one cut area is specified.

切り取り領域判定部245は、まず、以下の4つのパラメータMerginY1,MerginY2,MerginX1,MerginX2を算出する。
MerginY1=(OutSizeY−CorrEdgeDiffY)/2
MerginY2=(OutSizeY−CorrEdgeDiffY)−(OutSizeY−CorrEdgeDiffY)/2
MerginX1=(OutSizeX−CorrEdgeDiffX)/2
MerginX2=(OutSizeX−CorrEdgeDiffX)−(OutSizeX−CorrEdgeDiffX)/2
The cut region determination unit 245 first calculates the following four parameters MerginY1, MerginY2, MerginX1, and MerginX2.
MerginY1 = (OutSizeY−CorrEdgeDiffY) / 2
MerginY2 = (OutSizeY−CorrEdgeDiffY) − (OutSizeY−CorrEdgeDiffY) / 2
MerginX1 = (OutSizeX−CorrEdgeDiffX) / 2
MerginX2 = (OutSizeX−CorrEdgeDiffX) − (OutSizeX−CorrEdgeDiffX) / 2

切り取り領域判定部245は、上部有効エッジ及び下部有効エッジを、それぞれが出力画像サイズの中央からy軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMinY−MerginY1
CropAreaMaxY1=CorrEdgeMaxY+MerginY2
The cut region determination unit 245 arranges the upper effective edge and the lower effective edge so that each is located at equal intervals in the y-axis direction from the center of the output image size. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMinY−MerginY1
CropAreaMaxY1 = CorrEdgeMaxY + MerginY2

次に、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)を高信頼度判定用閾値(TH)と比較し、信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)以上である場合、左部有効エッジ及び右部有効エッジを、それぞれが出力画像サイズの中央からx軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX−MerginX1
CropAreaMaxX1=CorrEdgeMaxX+MerginX2
Next, the cutout region determination unit 245 compares the reliability (L_Conf) of the left effective edge and the reliability (R_Conf) of the right effective edge with the high reliability determination threshold (TH), and determines the reliability (L_Conf, When both R_Conf) are equal to or higher than the high reliability determination threshold (TH), the left and right effective edges are arranged at equal intervals from the center of the output image size in the x-axis direction. To do. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX−MerginX1
CropAreaMaxX1 = CorrEdgeMaxX + MerginX2

信頼度(L_Conf)のみが高信頼度判定用閾値(TH)以上である場合、切り取り領域判定部245は、左部有効エッジを、出力画像サイズの左端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX
CropAreaMaxX1=CorrEdgeMinX+OutSizeX
When only the reliability (L_Conf) is equal to or higher than the high reliability determination threshold (TH), the cut region determination unit 245 arranges the left effective edge so as to match the left end of the output image size. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX
CropAreaMaxX1 = CorrEdgeMinX + OutSizeX

信頼度(R_Conf)のみが高信頼度判定用閾値(TH)以上である場合、切り取り領域判定部245は、右部有効エッジを、出力画像サイズの右端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMaxX−OutSizeX
CropAreaMaxX1=CorrEdgeMaxX
When only the reliability (R_Conf) is equal to or higher than the high reliability determination threshold (TH), the cut region determination unit 245 arranges the right effective edge so as to match the right end of the output image size. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMaxX−OutSizeX
CropAreaMaxX1 = CorrEdgeMaxX

信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)未満である場合、左部有効エッジ及び右部有効エッジを、それぞれが出力画像サイズの中央からx軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX−MerginX1
CropAreaMaxX1=CorrEdgeMaxX+MerginX2
When the reliability (L_Conf, R_Conf) is less than the high reliability determination threshold (TH), the left and right effective edges are positioned at equal intervals in the x-axis direction from the center of the output image size. Arrange so that Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX−MerginX1
CropAreaMaxX1 = CorrEdgeMaxX + MerginX2

図12は切り取り領域を示す模式図である。上述した第1の切り取り領域判定処理によって、図12に示すような切り取り領域が抽出される。具体的には、信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)以上である場合は、原稿画像に略一致する切り取り領域が抽出される。また、信頼度(L_Conf)のみが高信頼度判定用閾値(TH)以上である場合は、原稿画像の左端に、左端を一致させた切り取り領域が抽出され、信頼度(R_Conf)のみが高信頼度判定用閾値(TH)以上である場合は、原稿画像の右端に、右端を一致させた切り取り領域が抽出される。また、信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)未満である場合は、原稿画像の中央に、中央を一致させた切り取り領域が抽出される。   FIG. 12 is a schematic diagram showing a cut-out area. By the first cut area determination process described above, a cut area as shown in FIG. 12 is extracted. Specifically, when both the reliability levels (L_Conf, R_Conf) are equal to or higher than the high reliability determination threshold value (TH), a cutout region that substantially matches the document image is extracted. Further, when only the reliability (L_Conf) is equal to or higher than the high reliability determination threshold (TH), a cutout region with the left edge matched with the left edge of the original image is extracted, and only the reliability (R_Conf) is reliable. When it is equal to or greater than the degree determination threshold value (TH), a cutout region in which the right end coincides with the right end of the document image is extracted. When both the reliability levels (L_Conf, R_Conf) are less than the high reliability determination threshold value (TH), a cutout region with the center aligned with the center of the document image is extracted.

次に、第2の切り取り領域判定処理について説明する。
第2の切り取り領域判定処理を行なう場合も、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)をそれぞれ高信頼度判定用閾値(TH)と比較し、比較結果に応じて1組の4頂点座標(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1)を算出する。即ち、1つの切り取り領域が特定される。
Next, the second cut area determination process will be described.
Also in the case of performing the second cut region determination process, the cut region determination unit 245 sets the reliability of the left effective edge (L_Conf) and the reliability of the right effective edge (R_Conf) to the high reliability determination threshold (TH ) And a set of four vertex coordinates (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1) are calculated according to the comparison result. That is, one cut area is specified.

切り取り領域判定部245は、まず、以下の4つのパラメータMerginY1,MerginY2,MerginX1,MerginX2を算出する。
MerginY1=(OutSizeX−CorrEdgeDiffY)/2
MerginY2=(OutSizeX−CorrEdgeDiffY)−(OutSizeX−CorrEdgeDiffY)/2
MerginX1=(OutSizeY−CorrEdgeDiffX)/2
MerginX2=(OutSizeY−CorrEdgeDiffX)−(OutSizeY−CorrEdgeDiffX)/2
The cut region determination unit 245 first calculates the following four parameters MerginY1, MerginY2, MerginX1, and MerginX2.
MerginY1 = (OutSizeX−CorrEdgeDiffY) / 2
MerginY2 = (OutSizeX−CorrEdgeDiffY) − (OutSizeX−CorrEdgeDiffY) / 2
MerginX1 = (OutSizeY−CorrEdgeDiffX) / 2
MerginX2 = (OutSizeY−CorrEdgeDiffX) − (OutSizeY−CorrEdgeDiffX) / 2

切り取り領域判定部245は、上部有効エッジ及び下部有効エッジを、それぞれが出力画像サイズの中央からy軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMinY−MerginY1
CropAreaMaxY1=CorrEdgeMaxY+MerginY2
The cut region determination unit 245 arranges the upper effective edge and the lower effective edge so that each is located at equal intervals in the y-axis direction from the center of the output image size. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMinY−MerginY1
CropAreaMaxY1 = CorrEdgeMaxY + MerginY2

次に、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)を高信頼度判定用閾値(TH)と比較し、信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)以上である場合、左部有効エッジ及び右部有効エッジを、それぞれが出力画像サイズの中央からx軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX−MerginX1
CropAreaMaxX1=CorrEdgeMaxX+MerginX2
Next, the cutout region determination unit 245 compares the reliability (L_Conf) of the left effective edge and the reliability (R_Conf) of the right effective edge with the high reliability determination threshold (TH), and determines the reliability (L_Conf, When both R_Conf) are equal to or higher than the high reliability determination threshold (TH), the left and right effective edges are arranged at equal intervals from the center of the output image size in the x-axis direction. To do. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX−MerginX1
CropAreaMaxX1 = CorrEdgeMaxX + MerginX2

信頼度(L_Conf)のみが高信頼度判定用閾値(TH)以上である場合、切り取り領域判定部245は、左部有効エッジを、出力画像サイズの左端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX
CropAreaMaxX1=CorrEdgeMinX+OutSizeX
When only the reliability (L_Conf) is equal to or higher than the high reliability determination threshold (TH), the cut region determination unit 245 arranges the left effective edge so as to match the left end of the output image size. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX
CropAreaMaxX1 = CorrEdgeMinX + OutSizeX

信頼度(R_Conf)のみが高信頼度判定用閾値(TH)以上である場合、切り取り領域判定部245は、右部有効エッジを、出力画像サイズの右端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMaxX−OutSizeX
CropAreaMaxX1=CorrEdgeMaxX
When only the reliability (R_Conf) is equal to or higher than the high reliability determination threshold (TH), the cut region determination unit 245 arranges the right effective edge so as to match the right end of the output image size. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMaxX−OutSizeX
CropAreaMaxX1 = CorrEdgeMaxX

信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)未満である場合、左部有効エッジ及び右部有効エッジを、それぞれが出力画像サイズの中央からx軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX−MerginX1
CropAreaMaxX1=CorrEdgeMaxX+MerginX2
When the reliability (L_Conf, R_Conf) is less than the high reliability determination threshold (TH), the left and right effective edges are positioned at equal intervals in the x-axis direction from the center of the output image size. Arrange so that Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX−MerginX1
CropAreaMaxX1 = CorrEdgeMaxX + MerginX2

上述した第2の切り取り領域判定処理を行なった場合、第1の切り取り領域判定処理と同様に、図12に示すような切り取り領域が抽出される。   When the above-described second cut area determination process is performed, a cut area as illustrated in FIG. 12 is extracted in the same manner as the first cut area determination process.

次に、第3の切り取り領域判定処理について説明する。
第3の切り取り領域判定処理を行なう場合、切り取り領域判定部245は、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)をそれぞれ高信頼度判定用閾値(TH)と比較し、比較結果に応じて1組の4頂点座標(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1)を算出する。即ち、1つの切り取り領域が特定される。
Next, the third cut area determination process will be described.
When performing the third cut region determination process, the cut region determination unit 245 compares the reliability of the upper effective edge (T_Conf) and the reliability of the lower effective edge (B_Conf) with the high reliability determination threshold (TH), respectively. Then, a set of four vertex coordinates (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1) is calculated according to the comparison result. That is, one cut area is specified.

切り取り領域判定部245は、まず、以下の4つのパラメータMerginY1,MerginY2,MerginX1,MerginX2を算出する。
MerginY1=(OutSizeY−CorrEdgeDiffY)/2
MerginY2=(OutSizeY−CorrEdgeDiffY)−(OutSizeY−CorrEdgeDiffY)/2
MerginX1=(OutSizeX−CorrEdgeDiffX)/2
MerginX2=(OutSizeX−CorrEdgeDiffX)−(OutSizeX−CorrEdgeDiffX)/2
The cut region determination unit 245 first calculates the following four parameters MerginY1, MerginY2, MerginX1, and MerginX2.
MerginY1 = (OutSizeY−CorrEdgeDiffY) / 2
MerginY2 = (OutSizeY−CorrEdgeDiffY) − (OutSizeY−CorrEdgeDiffY) / 2
MerginX1 = (OutSizeX−CorrEdgeDiffX) / 2
MerginX2 = (OutSizeX−CorrEdgeDiffX) − (OutSizeX−CorrEdgeDiffX) / 2

切り取り領域判定部245は、左部有効エッジ及び右部有効エッジを、それぞれが出力画像サイズの中央からx軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX−MerginX1
CropAreaMaxX1=CorrEdgeMaxX+MerginX2
The cut region determination unit 245 arranges the left and right effective edges so that the left and right effective edges are equally spaced in the x-axis direction from the center of the output image size. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX−MerginX1
CropAreaMaxX1 = CorrEdgeMaxX + MerginX2

次に、切り取り領域判定部245は、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)を高信頼度判定用閾値(TH)と比較し、信頼度(T_Conf)のみが高信頼度判定用閾値(TH)以上である場合、上部有効エッジを、出力画像サイズの上端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMinY
CropAreaMaxY1=CorrEdgeMinY+OutSizeY
Next, the cut region determination unit 245 compares the reliability (T_Conf) of the upper effective edge and the reliability (B_Conf) of the lower effective edge with the threshold value for high reliability determination (TH), and only the reliability (T_Conf) is obtained. When it is equal to or higher than the high reliability determination threshold (TH), the upper effective edge is arranged so as to coincide with the upper end of the output image size. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMinY
CropAreaMaxY1 = CorrEdgeMinY + OutSizeY

信頼度(B_Conf)のみが高信頼度判定用閾値(TH)以上である場合、切り取り領域判定部245は、下部有効エッジを、出力画像サイズの下端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMaxY−OutSizeY
CropAreaMaxY1=CorrEdgeMaxY
When only the reliability (B_Conf) is equal to or higher than the high reliability determination threshold (TH), the cutout region determination unit 245 arranges the lower effective edge so as to coincide with the lower end of the output image size. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMaxY−OutSizeY
CropAreaMaxY1 = CorrEdgeMaxY

信頼度(T_Conf,B_Conf)が共に高信頼度判定用閾値(TH)未満である場合、上部有効エッジ及び下部有効エッジを、それぞれが出力画像サイズの中央からy軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMinY−MerginY1
CropAreaMaxY1=CorrEdgeMaxY+MerginY2
When the reliability (T_Conf, B_Conf) is both less than the threshold value for high reliability determination (TH), the upper effective edge and the lower effective edge are positioned at equal intervals in the y-axis direction from the center of the output image size. Arrange so that. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMinY−MerginY1
CropAreaMaxY1 = CorrEdgeMaxY + MerginY2

図13は切り取り領域を示す模式図である。上述した第3の切り取り領域判定処理によって、図13に示すような切り取り領域が抽出される。具体的には、信頼度(L_Conf)のみが高信頼度判定用閾値(TH)以上である場合は、原稿画像の上端に、上端を一致させた切り取り領域が抽出され、信頼度(R_Conf)のみが高信頼度判定用閾値(TH)以上である場合は、原稿画像の下端に、下端を一致させた切り取り領域が抽出される。また、信頼度(L_Conf,R_Conf)が共に高信頼度判定用閾値(TH)未満である場合は、原稿画像の中央に、中央を一致させた切り取り領域が抽出される。   FIG. 13 is a schematic diagram showing a cut-out area. By the third cut area determination process described above, a cut area as shown in FIG. 13 is extracted. Specifically, when only the reliability (L_Conf) is equal to or higher than the high reliability determination threshold value (TH), a clipping region with the upper end matched is extracted from the upper end of the document image, and only the reliability (R_Conf) is extracted. Is equal to or higher than the high reliability determination threshold value (TH), a cut-out area with the lower end matched with the lower end of the document image is extracted. When both the reliability levels (L_Conf, R_Conf) are less than the high reliability determination threshold value (TH), a cutout region with the center aligned with the center of the document image is extracted.

次に、第4の切り取り領域判定処理について説明する。
第4の切り取り領域判定処理を行なう場合も、切り取り領域判定部245は、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)をそれぞれ高信頼度判定用閾値(TH)と比較し、比較結果に応じて1組の4頂点座標(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1)を算出する。即ち、1つの切り取り領域が特定される。
Next, a fourth cut area determination process will be described.
Even when the fourth cut region determination process is performed, the cut region determination unit 245 sets the reliability of the upper effective edge (T_Conf) and the reliability of the lower effective edge (B_Conf) as the high reliability determination threshold (TH), respectively. Compare and calculate a set of four vertex coordinates (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1) according to the comparison result. That is, one cut area is specified.

切り取り領域判定部245は、まず、以下の4つのパラメータMerginY1,MerginY2,MerginX1,MerginX2を算出する。
MerginY1=(OutSizeX−CorrEdgeDiffY)/2
MerginY2=(OutSizeX−CorrEdgeDiffY)−(OutSizeX−CorrEdgeDiffY)/2
MerginX1=(OutSizeY−CorrEdgeDiffX)/2
MerginX2=(OutSizeY−CorrEdgeDiffX)−(OutSizeY−CorrEdgeDiffX)/2
The cut region determination unit 245 first calculates the following four parameters MerginY1, MerginY2, MerginX1, and MerginX2.
MerginY1 = (OutSizeX−CorrEdgeDiffY) / 2
MerginY2 = (OutSizeX−CorrEdgeDiffY) − (OutSizeX−CorrEdgeDiffY) / 2
MerginX1 = (OutSizeY−CorrEdgeDiffX) / 2
MerginX2 = (OutSizeY−CorrEdgeDiffX) − (OutSizeY−CorrEdgeDiffX) / 2

切り取り領域判定部245は、左部有効エッジ及び右部有効エッジを、それぞれが出力画像サイズの中央からx軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のx座標値の最小値(CropAreaMinX1)及び最大値(CropAreaMaxX1)を算出する。
CropAreaMinX1=CorrEdgeMinX−MerginX1
CropAreaMaxX1=CorrEdgeMaxX+MerginX2
The cut region determination unit 245 arranges the left and right effective edges so that the left and right effective edges are equally spaced in the x-axis direction from the center of the output image size. Specifically, the minimum value (CropAreaMinX1) and the maximum value (CropAreaMaxX1) of the x coordinate value of the cut region are calculated based on the following formula.
CropAreaMinX1 = CorrEdgeMinX−MerginX1
CropAreaMaxX1 = CorrEdgeMaxX + MerginX2

次に、切り取り領域判定部245は、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)を高信頼度判定用閾値(TH)と比較し、信頼度(T_Conf)のみが高信頼度判定用閾値(TH)以上である場合、上部有効エッジを、出力画像サイズの上端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMinY
CropAreaMaxY1=CorrEdgeMinY+OutSizeY
Next, the cut region determination unit 245 compares the reliability (T_Conf) of the upper effective edge and the reliability (B_Conf) of the lower effective edge with the threshold value for high reliability determination (TH), and only the reliability (T_Conf) is obtained. When it is equal to or higher than the high reliability determination threshold (TH), the upper effective edge is arranged so as to coincide with the upper end of the output image size. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMinY
CropAreaMaxY1 = CorrEdgeMinY + OutSizeY

信頼度(B_Conf)のみが高信頼度判定用閾値(TH)以上である場合、切り取り領域判定部245は、下部有効エッジを、出力画像サイズの下端に一致させるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMaxY−OutSizeY
CropAreaMaxY1=CorrEdgeMaxY
When only the reliability (B_Conf) is equal to or higher than the high reliability determination threshold (TH), the cutout region determination unit 245 arranges the lower effective edge so as to coincide with the lower end of the output image size. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMaxY−OutSizeY
CropAreaMaxY1 = CorrEdgeMaxY

信頼度(T_Conf,B_Conf)が共に高信頼度判定用閾値(TH)未満である場合、上部有効エッジ及び下部有効エッジを、それぞれが出力画像サイズの中央からy軸方向に等間隔の位置となるように配置する。具体的には、以下の式に基づき、切り取り領域のy座標値の最小値(CropAreaMinY1)及び最大値(CropAreaMaxY1)を算出する。
CropAreaMinY1=CorrEdgeMinY−MerginY1
CropAreaMaxY1=CorrEdgeMaxY+MerginY2
When the reliability (T_Conf, B_Conf) is both less than the threshold value for high reliability determination (TH), the upper effective edge and the lower effective edge are positioned at equal intervals in the y-axis direction from the center of the output image size. Arrange as follows. Specifically, the minimum value (CropAreaMinY1) and the maximum value (CropAreaMaxY1) of the y coordinate value of the cut region are calculated based on the following formula.
CropAreaMinY1 = CorrEdgeMinY−MerginY1
CropAreaMaxY1 = CorrEdgeMaxY + MerginY2

上述した第4の切り取り領域判定処理を行なった場合、第3の切り取り領域判定処理と同様に、図13に示すような切り取り領域が抽出される。   When the above-described fourth cut area determination process is performed, a cut area as shown in FIG. 13 is extracted as in the third cut area determination process.

次に、第5の切り取り領域判定処理について説明する。図14及び図15は第5の切り取り領域判定処理の手順を示すフローチャートである。
第5の切り取り領域判定処理を行なう場合、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)、右部有効エッジの信頼度(R_Conf)、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)をそれぞれ高信頼度判定用閾値(TH)と比較し、比較結果に応じて2組の4頂点座標(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1)、(CropAreaMinX2, CropAreaMaxX2, CropAreaMinY2, CropAreaMaxY2)を算出する。即ち、2つの切り取り領域が特定される。
Next, a fifth cut area determination process will be described. 14 and 15 are flowcharts showing the procedure of the fifth cut area determination process.
When performing the fifth cut region determination process, the cut region determination unit 245 includes the left effective edge reliability (L_Conf), the right effective edge reliability (R_Conf), the upper effective edge reliability (T_Conf), and The reliability of the lower effective edge (B_Conf) is compared with the threshold value for high reliability determination (TH), and two sets of four vertex coordinates (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1), (CropAreaMinX2, CropAreaMaxX2, respectively) according to the comparison result CropAreaMinY2, CropAreaMaxY2) is calculated. That is, two cutout areas are specified.

切り取り領域判定部245は、まず、以下の8つのパラメータMerginX11,MerginX12,MerginY11, MerginY12, MerginX21, MerginX22,MerginY21, MerginY22を算出する。
MerginX11=(OutSizeX−CorrEdgeDiffX)/2
MerginX12=(OutSizeX−CorrEdgeDiffX)−(OutSizeX−CorrEdgeDiffX)/2
MerginY11=(OutSizeY−CorrEdgeDiffY)/2
MerginY12=(OutSizeY−CorrEdgeDiffY)−(OutSizeY−CorrEdgeDiffY)/2
MerginX21=(OutSizeY−CorrEdgeDiffX)/2
MerginX22=(OutSizeY−CorrEdgeDiffX)−(OutSizeY−CorrEdgeDiffX)/2
MerginY21=(OutSizeX−CorrEdgeDiffY)/2
MerginY22=(OutSizeX−CorrEdgeDiffY)−(OutSizeX−CorrEdgeDiffY)/2
The cut area determination unit 245 first calculates the following eight parameters MerginX11, MerginX12, MerginY11, MerginY12, MerginX21, MerginX22, MerginY21, MerginY22.
MerginX11 = (OutSizeX−CorrEdgeDiffX) / 2
MerginX12 = (OutSizeX−CorrEdgeDiffX) − (OutSizeX−CorrEdgeDiffX) / 2
MerginY11 = (OutSizeY−CorrEdgeDiffY) / 2
MerginY12 = (OutSizeY−CorrEdgeDiffY) − (OutSizeY−CorrEdgeDiffY) / 2
MerginX21 = (OutSizeY−CorrEdgeDiffX) / 2
MerginX22 = (OutSizeY−CorrEdgeDiffX) − (OutSizeY−CorrEdgeDiffX) / 2
MerginY21 = (OutSizeX−CorrEdgeDiffY) / 2
MerginY22 = (OutSizeX−CorrEdgeDiffY) − (OutSizeX−CorrEdgeDiffY) / 2

切り取り領域判定部245は、上部有効エッジの信頼度(T_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S41)。
なお、図11のフローチャートに示した通り、第5の切り取り領域判定処理を実行する場合は、左部有効エッジの信頼度(L_Conf)及び右部有効エッジの信頼度(R_Conf)の少なくとも一方が高信頼度判定用閾値(TH)未満であり、且つ、上部有効エッジの信頼度(T_Conf)及び下部有効エッジの信頼度(B_Conf)の少なくとも一方が高信頼度判定用閾値(TH)未満である。従って、上部有効エッジの信頼度(T_Conf)が高信頼度判定用閾値(TH)以上である場合、下部有効エッジの信頼度(B_Conf)が高信頼度判定用閾値(TH)未満であり、左部有効エッジの信頼度(L_Conf)が高信頼度判定用閾値(TH)以上である場合、右部有効エッジの信頼度(R_Conf)が高信頼度判定用閾値(TH)未満である。
The cut region determination unit 245 determines whether or not the reliability (T_Conf) of the upper effective edge is equal to or higher than the high reliability determination threshold (TH) (S41).
As shown in the flowchart of FIG. 11, when the fifth cut region determination process is executed, at least one of the reliability of the left effective edge (L_Conf) and the reliability of the right effective edge (R_Conf) is high. It is less than the reliability determination threshold (TH), and at least one of the reliability of the upper effective edge (T_Conf) and the reliability of the lower effective edge (B_Conf) is less than the high reliability determination threshold (TH). Therefore, when the reliability (T_Conf) of the upper effective edge is equal to or higher than the high reliability determination threshold (TH), the reliability (B_Conf) of the lower effective edge is less than the high reliability determination threshold (TH), and the left When the reliability (L_Conf) of the partial effective edge is equal to or higher than the high reliability determination threshold (TH), the reliability of the right effective edge (R_Conf) is less than the high reliability determination threshold (TH).

信頼度(T_Conf)が高信頼度判定用閾値(TH)以上である場合(S41:YES)、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S42)。信頼度(L_Conf)が高信頼度判定用閾値(TH)以上である場合(S42:YES)、切り取り領域判定部245は、以下の式に基づいて第1領域を算出し(S43)、処理を終了する。
CropAreaMinX1=CorrEdgeMinX
CropAreaMaxX1=CorrEdgeMinX+OutSizeX
CropAreaMinY1=CorrEdgeMinY
CropAreaMaxY1=CorrEdgeMinY+OutSizeY
CropAreaMinX2=CorrEdgeMinX
CropAreaMaxX2=CorrEdgeMinX+OutSizeY
CropAreaMinY2=CorrEdgeMinY
CropAreaMaxY2=CorrEdgeMinY+OutSizeX
When the reliability (T_Conf) is equal to or higher than the high reliability determination threshold (TH) (S41: YES), the clipping region determination unit 245 determines that the reliability (L_Conf) of the left effective edge is the high reliability determination threshold ( TH) or more is determined (S42). When the reliability (L_Conf) is equal to or higher than the high reliability determination threshold (TH) (S42: YES), the cut region determination unit 245 calculates the first region based on the following formula (S43), and performs the processing. finish.
CropAreaMinX1 = CorrEdgeMinX
CropAreaMaxX1 = CorrEdgeMinX + OutSizeX
CropAreaMinY1 = CorrEdgeMinY
CropAreaMaxY1 = CorrEdgeMinY + OutSizeY
CropAreaMinX2 = CorrEdgeMinX
CropAreaMaxX2 = CorrEdgeMinX + OutSizeY
CropAreaMinY2 = CorrEdgeMinY
CropAreaMaxY2 = CorrEdgeMinY + OutSizeX

ステップS42で、信頼度(L_Conf)が高信頼度判定用閾値(TH)未満である場合(S42:NO)、切り取り領域判定部245は、右部有効エッジの信頼度(R_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S44)。信頼度(R_Conf)が高信頼度判定用閾値(TH)以上である場合(S44:YES)、切り取り領域判定部245は、以下の式に基づいて第2領域を算出し(S45)、処理を終了する。
CropAreaMinX1=CorrEdgeMaxX−OutSizeX
CropAreaMaxX1=CorrEdgeMaxX
CropAreaMinY1=CorrEdgeMinY
CropAreaMaxY1=CorrEdgeMinY+OutSizeY
CropAreaMinX2=CorrEdgeMaxX−OutSizeY
CropAreaMaxX2=CorrEdgeMaxX
CropAreaMinY2=CorrEdgeMinY
CropAreaMaxY2=CorrEdgeMinY+OutSizeX
In step S42, when the reliability (L_Conf) is less than the high reliability determination threshold (TH) (S42: NO), the clipping region determination unit 245 determines that the reliability of the right effective edge (R_Conf) is high. It is determined whether or not the threshold value for determination (TH) is exceeded (S44). When the reliability (R_Conf) is equal to or higher than the high reliability determination threshold (TH) (S44: YES), the cut region determination unit 245 calculates the second region based on the following formula (S45), and performs the processing. finish.
CropAreaMinX1 = CorrEdgeMaxX−OutSizeX
CropAreaMaxX1 = CorrEdgeMaxX
CropAreaMinY1 = CorrEdgeMinY
CropAreaMaxY1 = CorrEdgeMinY + OutSizeY
CropAreaMinX2 = CorrEdgeMaxX−OutSizeY
CropAreaMaxX2 = CorrEdgeMaxX
CropAreaMinY2 = CorrEdgeMinY
CropAreaMaxY2 = CorrEdgeMinY + OutSizeX

ステップS44で、信頼度(R_Conf)が高信頼度判定用閾値(TH)未満である場合(S44:NO)、切り取り領域判定部245は、以下の式に基づいて第3領域を算出し(S46)、処理を終了する。
CropAreaMinX1=CorrEdgeMinX−MerginX11
CropAreaMaxX1=CorrEdgeMaxX+MerginX12
CropAreaMinY1=CorrEdgeMinY
CropAreaMaxY1=CorrEdgeMinY+OutSizeY
CropAreaMinX2=CorrEdgeMinX−MerginX21
CropAreaMaxX2=CorrEdgeMaxX+MerginX22
CropAreaMinY2=CorrEdgeMinY
CropAreaMaxY2=CorrEdgeMinY+OutSizeX
If the reliability (R_Conf) is less than the high reliability determination threshold (TH) in step S44 (S44: NO), the cut region determination unit 245 calculates the third region based on the following equation (S46). ), The process is terminated.
CropAreaMinX1 = CorrEdgeMinX−MerginX11
CropAreaMaxX1 = CorrEdgeMaxX + MerginX12
CropAreaMinY1 = CorrEdgeMinY
CropAreaMaxY1 = CorrEdgeMinY + OutSizeY
CropAreaMinX2 = CorrEdgeMinX−MerginX21
CropAreaMaxX2 = CorrEdgeMaxX + MerginX22
CropAreaMinY2 = CorrEdgeMinY
CropAreaMaxY2 = CorrEdgeMinY + OutSizeX

ステップS41で、上部有効エッジの信頼度(T_Conf)が高信頼度判定用閾値(TH)未満である場合(S41:NO)、切り取り領域判定部245は、下部有効エッジの信頼度(B_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S47)。信頼度(B_Conf)が高信頼度判定用閾値(TH)以上である場合(S47:YES)、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S48)。信頼度(L_Conf)が高信頼度判定用閾値(TH)以上である場合(S48:YES)、切り取り領域判定部245は、以下の式に基づいて第4領域を算出し(S49)、処理を終了する。
CropAreaMinX1=CorrEdgeMinX
CropAreaMaxX1=CorrEdgeMinX+OutSizeX
CropAreaMinY1=CorrEdgeMaxY−OutSizeY
CropAreaMaxY1=CorrEdgeMaxY
CropAreaMinX2=CorrEdgeMinX
CropAreaMaxX2=CorrEdgeMinX+OutSizeY
CropAreaMinY2=CorrEdgeMaxY−OutSizeX
CropAreaMaxY2=CorrEdgeMaxY
When the reliability (T_Conf) of the upper effective edge is less than the high reliability determination threshold (TH) in step S41 (S41: NO), the cut region determination unit 245 determines that the reliability (B_Conf) of the lower effective edge is It is determined whether or not the threshold value is higher than the high reliability determination threshold (TH) (S47). When the reliability (B_Conf) is equal to or higher than the high reliability determination threshold (TH) (S47: YES), the clipping region determination unit 245 determines that the reliability (L_Conf) of the left effective edge is the high reliability determination threshold ( TH) or more is determined (S48). When the reliability (L_Conf) is equal to or higher than the threshold (TH) for high reliability determination (S48: YES), the cut region determination unit 245 calculates the fourth region based on the following formula (S49), and performs the processing. finish.
CropAreaMinX1 = CorrEdgeMinX
CropAreaMaxX1 = CorrEdgeMinX + OutSizeX
CropAreaMinY1 = CorrEdgeMaxY−OutSizeY
CropAreaMaxY1 = CorrEdgeMaxY
CropAreaMinX2 = CorrEdgeMinX
CropAreaMaxX2 = CorrEdgeMinX + OutSizeY
CropAreaMinY2 = CorrEdgeMaxY−OutSizeX
CropAreaMaxY2 = CorrEdgeMaxY

ステップS48で、信頼度(L_Conf)が高信頼度判定用閾値(TH)未満である場合(S48:NO)、切り取り領域判定部245は、右部有効エッジの信頼度(R_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S50)。信頼度(R_Conf)が高信頼度判定用閾値(TH)以上である場合(S50:YES)、切り取り領域判定部245は、以下の式に基づいて第5領域を算出し(S51)、処理を終了する。
CropAreaMinX1=CorrEdgeMaxX−OutSizeX
CropAreaMaxX1=CorrEdgeMaxX
CropAreaMinY1=CorrEdgeMaxY−OutSizeY
CropAreaMaxY1=CorrEdgeMaxY
CropAreaMinX2=CorrEdgeMaxX−OutSizeY
CropAreaMaxX2=CorrEdgeMaxX
CropAreaMinY2=CorrEdgeMaxY−OutSizeX
CropAreaMaxY2=CorrEdgeMaxY
In step S48, when the reliability (L_Conf) is less than the high reliability determination threshold (TH) (S48: NO), the clipping region determination unit 245 determines that the reliability of the right effective edge (R_Conf) is high. It is determined whether or not the threshold value for determination (TH) is exceeded (S50). When the reliability (R_Conf) is equal to or higher than the high reliability determination threshold (TH) (S50: YES), the cut region determination unit 245 calculates the fifth region based on the following formula (S51), and performs the processing. finish.
CropAreaMinX1 = CorrEdgeMaxX−OutSizeX
CropAreaMaxX1 = CorrEdgeMaxX
CropAreaMinY1 = CorrEdgeMaxY−OutSizeY
CropAreaMaxY1 = CorrEdgeMaxY
CropAreaMinX2 = CorrEdgeMaxX−OutSizeY
CropAreaMaxX2 = CorrEdgeMaxX
CropAreaMinY2 = CorrEdgeMaxY−OutSizeX
CropAreaMaxY2 = CorrEdgeMaxY

ステップS50で、信頼度(R_Conf)が高信頼度判定用閾値(TH)未満である場合(S50:NO)、切り取り領域判定部245は、以下の式に基づいて第6領域を算出し(S52)、処理を終了する。
CropAreaMinX1=CorrEdgeMinX−MerginX11
CropAreaMaxX1=CorrEdgeMaxX+MerginX12
CropAreaMinY1=CorrEdgeMaxY−OutSizeY
CropAreaMaxY1=CorrEdgeMaxY
CropAreaMinX2=CorrEdgeMinX−MerginX21
CropAreaMaxX2=CorrEdgeMaxX+MerginX22
CropAreaMinY2=CorrEdgeMaxY−OutSizeX
CropAreaMaxY2=CorrEdgeMaxY
If the reliability (R_Conf) is less than the high reliability determination threshold (TH) in step S50 (S50: NO), the cut region determination unit 245 calculates the sixth region based on the following equation (S52). ), The process is terminated.
CropAreaMinX1 = CorrEdgeMinX−MerginX11
CropAreaMaxX1 = CorrEdgeMaxX + MerginX12
CropAreaMinY1 = CorrEdgeMaxY−OutSizeY
CropAreaMaxY1 = CorrEdgeMaxY
CropAreaMinX2 = CorrEdgeMinX−MerginX21
CropAreaMaxX2 = CorrEdgeMaxX + MerginX22
CropAreaMinY2 = CorrEdgeMaxY−OutSizeX
CropAreaMaxY2 = CorrEdgeMaxY

ステップS47で、信頼度(B_Conf)が高信頼度判定用閾値(TH)未満である場合(S47:NO)、切り取り領域判定部245は、左部有効エッジの信頼度(L_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S53)。信頼度(L_Conf)が高信頼度判定用閾値(TH)以上である場合(S53:YES)、切り取り領域判定部245は、以下の式に基づいて第7領域を算出し(S54)、処理を終了する。
CropAreaMinX1=CorrEdgeMinX
CropAreaMaxX1=CorrEdgeMinX+OutSizeX
CropAreaMinY1=CorrEdgeMinY−MerginY11
CropAreaMaxY1=CorrEdgeMaxY+MerginY12
CropAreaMinX2=CorrEdgeMinX
CropAreaMaxX2=CorrEdgeMinX+OutSizeY
CropAreaMinY2=CorrEdgeMinY−MerginY21
CropAreaMaxY2=CorrEdgeMaxY+MerginY22
In step S47, when the reliability (B_Conf) is less than the high reliability determination threshold (TH) (S47: NO), the clipping region determination unit 245 determines that the reliability of the left effective edge (L_Conf) is high. It is determined whether or not the threshold value for determination (TH) is exceeded (S53). When the reliability (L_Conf) is equal to or higher than the high reliability determination threshold (TH) (S53: YES), the cut region determination unit 245 calculates the seventh region based on the following formula (S54), and performs the processing. finish.
CropAreaMinX1 = CorrEdgeMinX
CropAreaMaxX1 = CorrEdgeMinX + OutSizeX
CropAreaMinY1 = CorrEdgeMinY−MerginY11
CropAreaMaxY1 = CorrEdgeMaxY + MerginY12
CropAreaMinX2 = CorrEdgeMinX
CropAreaMaxX2 = CorrEdgeMinX + OutSizeY
CropAreaMinY2 = CorrEdgeMinY−MerginY21
CropAreaMaxY2 = CorrEdgeMaxY + MerginY22

ステップS53で、信頼度(L_Conf)が高信頼度判定用閾値(TH)未満である場合(S53:NO)、切り取り領域判定部245は、右部有効エッジの信頼度(R_Conf)が高信頼度判定用閾値(TH)以上であるか否かを判断する(S55)。信頼度(R_Conf)が高信頼度判定用閾値(TH)以上である場合(S55:YES)、切り取り領域判定部245は、以下の式に基づいて第8領域を算出し(S56)、処理を終了する。
CropAreaMinX1=CorrEdgeMaxX−OutSizeX
CropAreaMaxX1=CorrEdgeMaxX
CropAreaMinY1=CorrEdgeMinY−MerginY11
CropAreaMaxY1=CorrEdgeMaxY+MerginY12
CropAreaMinX2=CorrEdgeMaxX−OutSizeY
CropAreaMaxX2=CorrEdgeMaxX
CropAreaMinY2=CorrEdgeMinY−MerginY21
CropAreaMaxY2=CorrEdgeMaxY+MerginY22
In step S53, when the reliability (L_Conf) is less than the high reliability determination threshold (TH) (S53: NO), the clipping region determination unit 245 determines that the reliability (R_Conf) of the right effective edge is high. It is determined whether or not the threshold value for determination (TH) is exceeded (S55). When the reliability (R_Conf) is equal to or higher than the high reliability determination threshold (TH) (S55: YES), the cut region determination unit 245 calculates the eighth region based on the following formula (S56), and performs the processing. finish.
CropAreaMinX1 = CorrEdgeMaxX−OutSizeX
CropAreaMaxX1 = CorrEdgeMaxX
CropAreaMinY1 = CorrEdgeMinY−MerginY11
CropAreaMaxY1 = CorrEdgeMaxY + MerginY12
CropAreaMinX2 = CorrEdgeMaxX−OutSizeY
CropAreaMaxX2 = CorrEdgeMaxX
CropAreaMinY2 = CorrEdgeMinY−MerginY21
CropAreaMaxY2 = CorrEdgeMaxY + MerginY22

ステップS55で、信頼度(R_Conf)が高信頼度判定用閾値(TH)未満である場合(S55:NO)、切り取り領域判定部245は、以下の式に基づいて第9領域を算出し(S57)、処理を終了する。
CropAreaMinX1=CorrEdgeMinX−MerginX11
CropAreaMaxX1=CorrEdgeMaxX+MerginX12
CropAreaMinY1=CorrEdgeMinY−MerginY11
CropAreaMaxY1=CorrEdgeMaxY+MerginY12
CropAreaMinX2=CorrEdgeMinX−MerginX21
CropAreaMaxX2=CorrEdgeMaxX+MerginX22
CropAreaMinY2=CorrEdgeMinY−MerginY21
CropAreaMaxY2=CorrEdgeMaxY+MerginY22
If the reliability (R_Conf) is less than the high reliability determination threshold (TH) in step S55 (S55: NO), the cut region determination unit 245 calculates the ninth region based on the following equation (S57). ), The process is terminated.
CropAreaMinX1 = CorrEdgeMinX−MerginX11
CropAreaMaxX1 = CorrEdgeMaxX + MerginX12
CropAreaMinY1 = CorrEdgeMinY−MerginY11
CropAreaMaxY1 = CorrEdgeMaxY + MerginY12
CropAreaMinX2 = CorrEdgeMinX−MerginX21
CropAreaMaxX2 = CorrEdgeMaxX + MerginX22
CropAreaMinY2 = CorrEdgeMinY−MerginY21
CropAreaMaxY2 = CorrEdgeMaxY + MerginY22

図16は切り取り領域を示す模式図である。上述した第5の切り取り領域判定処理によって、図16に示すような切り取り領域が抽出される。   FIG. 16 is a schematic diagram showing a cut-out area. By the fifth cut area determination process described above, a cut area as shown in FIG. 16 is extracted.

図3に戻り、領域表示用パラメータ生成部246による処理以降の処理について説明をする。領域表示用パラメータ生成部246は、切り取り領域判定部245が算出した、切り取り領域を特定するための4頂点座標(CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1),(CropAreaMinX2, CropAreaMaxX2, CropAreaMinY2, CropAreaMaxY2)に基づいて、出力画像サイズにおいて、各4頂点座標が示す切り取り領域の開始座標(StartX,StartY)、高さh(y軸方向の長さ)及び幅w(x軸方向の長さ)をそれぞれ算出する。なお、領域表示用パラメータ生成部246は、以下の式を用いて、各値を算出する。また、αは、角度算出部242により算出された原稿の傾き角度である。


h=CropAreaMaxY−CropAreaMinY
w=CropAreaMaxX−CropAreaMinX
Returning to FIG. 3, processing after the processing by the area display parameter generation unit 246 will be described. The area display parameter generation unit 246 is based on the four vertex coordinates (CropAreaMinX1, CropAreaMaxX1, CropAreaMinY1, CropAreaMaxY1), (CropAreaMinX2, CropAreaMaxX2, CropAreaMinY2, CropAreaMaxY2) for specifying the cutout area calculated by the cutout area determination unit 245. In the output image size, the start coordinates (StartX, StartY), the height h (length in the y-axis direction), and the width w (length in the x-axis direction) of the cut area indicated by each of the four vertex coordinates are calculated. The area display parameter generation unit 246 calculates each value using the following formula. Further, α is the document inclination angle calculated by the angle calculation unit 242.


h = CropAreaMaxY−CropAreaMinY
w = CropAreaMaxX−CropAreaMinX

図17は領域表示用パラメータ生成部246による処理を説明するための模式図である。図17の上側には、領域表示用パラメータ生成部246による処理前、即ち、入力画像の座標系への変換前の切り取り領域を示し、ここでは、原稿領域検出部244で特定された各頂点(CorrEdgeMinX,CorrEdgeMaxX,CorrEdgeMinY,CorrEdgeMaxY)で示される切り取り領域を示す。図17の下側には、領域表示用パラメータ生成部246による処理後、即ち、入力画像の座標系への変換後の切り取り領域を示し、ここでは、入力画像の座標系への変換後の切り取り領域が原稿画像(入力画像)に重ね合せられた状態を示す。
領域表示用パラメータ生成部246は、切り取り領域判定部245によって特定された切り取り領域の各座標(CropAreaMinX, CropAreaMaxX, CropAreaMinY, CropAreaMaxY)を、図17の上側に示した座標系から図17の下側に示した座標系に変換し、変換後の切り取り領域の開始座標(StartX,StartY)、高さh及び幅wを取得する。領域表示用パラメータ生成部246は、変換後の切り取り領域を、入力画像(出力画像サイズのデータ)に重ね合せ、重ね合せたデータを画像メモリ5に格納する。
FIG. 17 is a schematic diagram for explaining processing by the area display parameter generation unit 246. The upper side of FIG. 17 shows a clipping area before processing by the area display parameter generation unit 246, that is, before conversion of the input image into the coordinate system. Here, each vertex (specified by the document area detection unit 244) CorrEdgeMinX, CorrEdgeMaxX, CorrEdgeMinY, CorrEdgeMaxY) indicates a cut area. The lower side of FIG. 17 shows a cutout area after processing by the area display parameter generation unit 246, that is, after conversion of the input image into the coordinate system. Here, the cutout of the input image after conversion into the coordinate system is shown. A state in which the area is superimposed on the original image (input image) is shown.
The area display parameter generation unit 246 moves the coordinates (CropAreaMinX, CropAreaMaxX, CropAreaMinY, CropAreaMaxY) of the cut area specified by the cut area determination unit 245 from the coordinate system shown on the upper side of FIG. 17 to the lower side of FIG. It converts into the coordinate system shown, and acquires the start coordinate (StartX, StartY), height h, and width w of the cut-out area after conversion. The area display parameter generation unit 246 superimposes the cut area after conversion on the input image (data of the output image size), and stores the overlapped data in the image memory 5.

表示制御部25は、領域表示用パラメータ生成部246によって生成されて画像メモリ5に格納されたデータ(切り取り領域を重ね合せた出力画像サイズのデータ)を読み出す。また、表示制御部25は、入力階調補正部23から原稿傾き・サイズ検出部24に入力されたRGB信号(画像データ)を取得する。なお、表示制御部25は、この画像データを、原稿傾き・サイズ検出部24を介して取得してもよいし、一旦画像メモリ5に格納された後に画像メモリ5から読み出してもよい。   The display control unit 25 reads the data (the output image size data obtained by superimposing the cut regions) generated by the region display parameter generation unit 246 and stored in the image memory 5. Further, the display control unit 25 acquires RGB signals (image data) input from the input tone correction unit 23 to the document inclination / size detection unit 24. The display control unit 25 may acquire the image data via the document inclination / size detection unit 24, or may read the image data from the image memory 5 once stored in the image memory 5.

表示制御部25は、RGBの画像データ(処理対象の画像データ)に対して、画素を間引く等の処理を行ない、画像データに基づく画像全体が操作パネル4に表示できるようにする。画素の間引き処理としては、ニアレストネイバー法、バイリニア法、バイキュービック法などの補間方法を用いることができる。ニアレストネイバー法は、補間する画素(補間画素)に一番近い既存画素の画素値、又は補間画素に対して所定の位置関係にある既存画素の画素値を補間画素の画素値とする方法である。バイリニア法は、補間画素を囲む4点の既存画素の画素値に、補間画素からの距離に比例した値を重み付けし、得られた値の平均値を補間画素の画素値とする方法である。バイキュービック法は、補間画素を囲む4点の既存画素に、それらを囲む12点の既存画素を加えた合計16点の既存画素の画素値に基づいて算出した値を補間画素の画素値とする方法である。   The display control unit 25 performs processing such as thinning out pixels on RGB image data (image data to be processed) so that the entire image based on the image data can be displayed on the operation panel 4. As the pixel thinning process, an interpolation method such as a nearest neighbor method, a bilinear method, or a bicubic method can be used. The nearest neighbor method is a method in which a pixel value of an existing pixel closest to a pixel to be interpolated (interpolated pixel) or a pixel value of an existing pixel having a predetermined positional relationship with respect to the interpolated pixel is used as the pixel value of the interpolated pixel. is there. The bilinear method is a method in which the pixel values of four existing pixels surrounding the interpolation pixel are weighted with values proportional to the distance from the interpolation pixel, and the average value of the obtained values is used as the pixel value of the interpolation pixel. In the bicubic method, a value calculated based on pixel values of a total of 16 existing pixels obtained by adding 12 existing pixels surrounding them to 4 existing pixels surrounding the interpolation pixel is used as the pixel value of the interpolation pixel. Is the method.

表示制御部25は、間引き処理後の画像データに対して、切り取り領域を重ね合せた出力画像サイズのデータに基づく矩形の枠を付加し、切り取り領域確認用の画像データ(表示用データ)を生成する。なお、切り取り領域判定部245で2つの切り取り領域が抽出されていた場合、表示制御部25は、2つの切り取り領域確認用画像データを生成する。
表示制御部25は、生成した切り取り領域確認用画像データに対して、操作パネル4の表示部の表示特性に基づいて階調補正(ガンマ補正)を行なった後、操作パネル4に表示させる。
The display control unit 25 adds a rectangular frame based on the output image size data obtained by superimposing the cut areas to the image data after the thinning process, and generates image data (display data) for checking the cut area. To do. When two cut areas are extracted by the cut area determination unit 245, the display control unit 25 generates two pieces of cut area confirmation image data.
The display control unit 25 performs gradation correction (gamma correction) on the generated cut region confirmation image data based on the display characteristics of the display unit of the operation panel 4 and then causes the operation panel 4 to display the image data.

図18は切り取り領域確認画面を示す模式図、図19は切り取り領域の確認及び補正処理の手順を示すフローチャートである。表示制御部25は、図18の上側及び左下側に表示したような確認画面を操作パネル4に表示させる(S61)。なお、図18の上側には、原稿画像の領域にほぼ一致した切り取り領域が検出(抽出)された場合の例を示しており、図18の左下側には、原稿画像から少しずれた位置の切り取り領域が検出された場合の例を示している。ユーザは、確認画面によって、画像形成装置100(切り取り領域判定部245)が抽出した切り取り領域を確認し、表示された切り取り領域が適切であるか否かを判断し、適切であると判断した場合、OKボタンを操作し、適切でないと判断した場合、NGボタンを操作する。
切り取り領域確認画面を表示中の操作パネル4は、ユーザがOKボタンを操作したか否かを判断しており(S62)、ユーザによってOKボタンが操作された場合(図18の上側の図参照)、その旨を表示制御部25に通知し、表示制御部25は、その旨を切り取り領域選択部247に通知する。
FIG. 18 is a schematic diagram showing a cut area confirmation screen, and FIG. 19 is a flowchart showing a cut area confirmation and correction process. The display control unit 25 causes the operation panel 4 to display confirmation screens such as those displayed on the upper and lower left sides of FIG. 18 (S61). The upper side of FIG. 18 shows an example in which a cutout area that substantially matches the area of the original image is detected (extracted), and the lower left side of FIG. 18 shows a position slightly shifted from the original image. An example in which a cutout area is detected is shown. When the user confirms the cut area extracted by the image forming apparatus 100 (cut area determination unit 245) on the confirmation screen, determines whether or not the displayed cut area is appropriate, and determines that it is appropriate If the OK button is operated and it is determined that it is not appropriate, the NG button is operated.
The operation panel 4 displaying the cut area confirmation screen determines whether or not the user has operated the OK button (S62), and when the user has operated the OK button (see the upper diagram in FIG. 18). This is notified to the display control unit 25, and the display control unit 25 notifies the cut region selection unit 247 to that effect.

切り取り領域選択部247は、ユーザがOKボタンを操作した場合(S62:YES)、切り取り領域の情報を補正用パラメータ生成部248へ出力し(S63)、処理を終了する。切り取り領域の情報としては、領域表示用パラメータ生成部246によって生成された切り取り領域の開始座標(StartX,StartY)、高さh及び幅wであってもよいし、切り取り領域判定部245が算出した、切り取り領域を特定するための4頂点座標であってもよい。なお、切り取り領域判定部245が算出した4頂点座標が補正用パラメータ生成部248へ出力される場合、補正用パラメータ生成部248が、取得した4頂点座標に基づいて、各4頂点座標が示す切り取り領域の開始座標(StartX,StartY)、高さh及び幅wを算出する。   When the user operates the OK button (S62: YES), the cut area selection unit 247 outputs cut area information to the correction parameter generation unit 248 (S63), and ends the process. The information on the cut area may be the start coordinates (StartX, StartY), height h, and width w of the cut area generated by the area display parameter generation unit 246, or calculated by the cut area determination unit 245. Further, it may be a four-vertex coordinate for specifying the cut-out area. In addition, when the four vertex coordinates calculated by the cut region determination unit 245 are output to the correction parameter generation unit 248, the correction parameter generation unit 248 uses the cut four-vertex coordinates indicated by the four vertex coordinates acquired. The start coordinates (StartX, StartY), height h, and width w of the area are calculated.

一方、図18の左下側の図に示すように、ユーザがNGボタンを操作した場合(S62:NO)、操作パネル4は、その旨を表示制御部25に通知する。このような通知を受けた表示制御部25は、切り取り領域判定部245が算出した切り取り領域(切り取り領域を特定するための4頂点座標)を補正するために、有効なエッジをユーザに選択させるための選択画面を操作パネル4に表示させる(S64)。図18の右下側には選択画面の例を示しており、原稿領域検出部244により算出された補正後の原稿領域の4頂点の座標値に基づく画像(原稿画像)が表示されている。ユーザは、上ボタン、下ボタン、左ボタン又は右ボタンを適宜操作することにより、原稿画像に対して適切に検出されていると判断されるエッジを選択(指示)する。例えば、図18の右下側の図では、原稿画像の上部エッジ及び左部エッジは適切であることが指示されている状態を示している。   On the other hand, as shown in the lower left diagram of FIG. 18, when the user operates the NG button (S62: NO), the operation panel 4 notifies the display control unit 25 to that effect. In response to such notification, the display control unit 25 causes the user to select an effective edge in order to correct the cut region calculated by the cut region determination unit 245 (four vertex coordinates for specifying the cut region). Is displayed on the operation panel 4 (S64). An example of the selection screen is shown on the lower right side of FIG. 18, and an image (original image) based on the coordinate values of the four vertices of the corrected original area calculated by the original area detecting unit 244 is displayed. The user selects (instructs) an edge that is determined to be appropriately detected for the document image by appropriately operating the upper button, the lower button, the left button, or the right button. For example, the lower right diagram in FIG. 18 shows a state in which it is instructed that the upper edge and the left edge of the document image are appropriate.

図18の右下側の図に示すような状態で、ユーザがOKボタンを操作した場合、操作パネル4は、ユーザが適切であると選択したエッジを受け付ける(S65)。操作パネル4は、ユーザによって選択されたエッジ(ユーザが適切であると判断したエッジ)を表示制御部25を介して切り取り領域判定部245に通知する。切り取り領域判定部245は、通知されたエッジを、高信頼度判定用閾値(TH)以上の信頼度を有するエッジとして、切り取り領域判定処理を再度行なう(S66)。   When the user operates the OK button in the state shown in the lower right diagram of FIG. 18, the operation panel 4 receives the edge selected as appropriate by the user (S65). The operation panel 4 notifies the cut region determination unit 245 of the edge selected by the user (the edge determined to be appropriate by the user) via the display control unit 25. The cut region determination unit 245 performs the cut region determination process again using the notified edge as an edge having a reliability equal to or higher than the high reliability determination threshold (TH) (S66).

そして、領域表示用パラメータ生成部246は、切り取り領域判定部245が再度算出した情報(切り取り領域を特定するための4頂点座標)に基づいて、切り取り領域の情報(切り取り領域の開始座標、高さ及び幅)を再度算出する。また、表示制御部25は、領域表示用パラメータ生成部246が再度算出した情報に基づいて、切り取り領域確認用の画像データを再度生成し、切り取り領域確認用の画像データに基づく確認画面を操作パネル4に再度表示させる(S67)。   Then, based on the information (four vertex coordinates for specifying the cutting area) calculated again by the cutting area determination unit 245, the area display parameter generation unit 246 extracts information on the cutting area (starting coordinates and height of the cutting area). And width) again. Further, the display control unit 25 regenerates the image data for confirming the cut region based on the information calculated again by the region display parameter generating unit 246, and displays a confirmation screen based on the image data for confirming the cut region. 4 is displayed again (S67).

操作パネル4は、ユーザがOKボタンを操作したか否かを判断しており(S68)、ユーザがOKボタンを操作した場合(S68:YES)、その旨を表示制御部25を介して切り取り領域選択部247に通知する。そして、切り取り領域選択部247は、切り取り領域の情報を補正用パラメータ生成部248へ出力し(S63)、処理を終了する。なお、ここでも、切り取り領域の情報としては、領域表示用パラメータ生成部246によって生成された切り取り領域の開始座標(StartX,StartY)、高さh及び幅wであってもよいし、切り取り領域判定部245が算出した、切り取り領域を特定するための4頂点座標であってもよい。
このように、ユーザが適切であると判断したエッジに基づいて再度切り取り領域判定処理を行なうことにより、切り取り領域の修正作業におけるユーザの負担を軽減することができる。
The operation panel 4 determines whether or not the user has operated the OK button (S68), and if the user has operated the OK button (S68: YES), this is indicated via the display control unit 25 in the cut-out area. Notify the selection unit 247. Then, the cut region selection unit 247 outputs the cut region information to the correction parameter generation unit 248 (S63), and ends the process. In this case as well, the cut area information may be the start coordinates (StartX, StartY), the height h and the width w of the cut area generated by the area display parameter generation unit 246, or the cut area determination. The four vertex coordinates calculated by the unit 245 for specifying the cutout area may be used.
In this way, by performing the cut region determination process again based on the edge that the user has determined to be appropriate, the burden on the user in the cut region correction work can be reduced.

一方、ここでもユーザがNGボタンを操作した場合(S68:NO)、操作パネル4は、その旨を表示制御部25に通知する。この場合、切り取り領域の自動抽出が難しい原稿であるとし、ユーザが手動で切り取り領域(切り取り領域を特定するための4頂点座標)を微調整することになる。従って、表示制御部25は、ユーザが切り取り領域の各エッジを微調整するための設定画面を操作パネル4に表示させ、設定画面を介して、切り取り領域の指定を受け付ける(S69)。   On the other hand, when the user operates the NG button (S68: NO), the operation panel 4 notifies the display control unit 25 to that effect. In this case, it is assumed that the document is difficult to automatically extract the cut area, and the user manually finely adjusts the cut area (four vertex coordinates for specifying the cut area). Accordingly, the display control unit 25 causes the operation panel 4 to display a setting screen for the user to finely adjust each edge of the cut area, and accepts designation of the cut area via the setting screen (S69).

図20は設定画面を示す模式図である。設定画面は、例えば、図18に示した確認画面のように、原稿画像と、切り取り領域判定部245で抽出された切り取り領域を示す枠とを表示している。また、設定画面は、切り取り領域の上部エッジ、下部エッジ、左部エッジ及び右部エッジのそれぞれに対応して+ボタン及び−ボタンを表示している。設定画面を介してユーザが+ボタンを操作した場合、表示制御部25は、操作パネル4に表示中の切り取り領域を示す枠において、対応するエッジが上部エッジ又は下部エッジであれば、対応するエッジを下方向に移動させ、また、対応するエッジが左部エッジ又は右部エッジであれば、対応するエッジを右方向に移動させる。また、設定画面を介してユーザが−ボタンを操作した場合、表示制御部25は、操作パネル4に表示中の切り取り領域を示す枠において、対応するエッジが上部エッジ又は下部エッジであれば、対応するエッジを上方向に移動させ、また、対応するエッジが左部エッジ又は右部エッジであれば、対応するエッジを左方向に移動させる。   FIG. 20 is a schematic diagram showing a setting screen. The setting screen displays, for example, a document image and a frame indicating the cut area extracted by the cut area determination unit 245 as in the confirmation screen illustrated in FIG. The setting screen displays a + button and a − button corresponding to each of the upper edge, the lower edge, the left edge, and the right edge of the cut area. When the user operates the + button via the setting screen, the display control unit 25 displays the corresponding edge if the corresponding edge is the upper edge or the lower edge in the frame indicating the cut region displayed on the operation panel 4. If the corresponding edge is the left edge or the right edge, the corresponding edge is moved to the right. Further, when the user operates the − button via the setting screen, the display control unit 25 responds if the corresponding edge is an upper edge or a lower edge in the frame indicating the cut region displayed on the operation panel 4. If the corresponding edge is a left edge or a right edge, the corresponding edge is moved leftward.

ユーザは、表示中の切り取り領域の各エッジ(各端辺)を所望の位置に移動させた後、OKボタンを操作する。設定画面を介してユーザがOKボタンを操作した場合、表示制御部25は、操作パネル4を介して、ユーザによって指定された切り取り領域を受け付ける。表示制御部25は、ユーザが指定した切り取り領域の情報を生成し(S70)、生成した切り取り領域の情報を補正用パラメータ生成部248へ出力し(S63)、処理を終了する。なお、表示制御部25は、領域表示用パラメータ生成部246によって生成された切り取り領域の開始座標(StartX,StartY)、高さh及び幅wを、ユーザの操作に従って変更し、変更した各情報を補正用パラメータ生成部248へ出力すればよい。   The user operates the OK button after moving each edge (each edge) of the cut region being displayed to a desired position. When the user operates the OK button via the setting screen, the display control unit 25 receives the cut area specified by the user via the operation panel 4. The display control unit 25 generates information on the cut region specified by the user (S70), outputs the generated cut region information to the correction parameter generation unit 248 (S63), and ends the process. The display control unit 25 changes the start coordinates (StartX, StartY), the height h, and the width w of the cut region generated by the region display parameter generation unit 246 according to the user's operation, and changes the changed information. What is necessary is just to output to the parameter generation part 248 for correction | amendment.

なお、例えば、上述したような切り取り領域の確認処理を行なうか否かを判定するための確認判定用閾値(TH2,TH2>TH1)を用意しておき、原稿領域検出部244が算出した各エッジの信頼度が全て確認判定用閾値(TH2)以上であった場合に、確認画面を介したユーザによる確認を行なわない構成としてもよい。この場合、切り取り領域選択部247は処理を行なわずに、領域表示用パラメータ生成部246が算出した情報を補正用パラメータ生成部248へ出力する。又は、領域表示用パラメータ生成部246及び切り取り領域選択部247は処理を行なわずに、切り取り領域判定部245が算出した情報を補正用パラメータ生成部248へ出力する。   Note that, for example, threshold values for confirmation determination (TH2, TH2> TH1) for determining whether or not to perform the cut region confirmation processing as described above are prepared, and each edge calculated by the document region detection unit 244 is prepared. When the reliability of all is equal to or greater than the threshold value for confirmation determination (TH2), the user may not perform confirmation via the confirmation screen. In this case, the cut region selection unit 247 outputs the information calculated by the region display parameter generation unit 246 to the correction parameter generation unit 248 without performing processing. Alternatively, the region display parameter generation unit 246 and the cut region selection unit 247 output the information calculated by the cut region determination unit 245 to the correction parameter generation unit 248 without performing processing.

図3に戻り、補正用パラメータ生成部248による処理について説明をする。補正用パラメータ生成部248は、領域表示用パラメータ生成部246によって生成された切り取り領域の開始座標(StartX,StartY)、高さh及び幅wと、角度算出部242によって算出された原稿の傾き角度αとを、原稿傾き・サイズ補正部26によって補正される画像の解像度(入力画像の解像度と同一)に合わせた値に変換し、補正用パラメータとして原稿傾き・サイズ補正部26へ出力する。
なお、補正用パラメータ生成部248は、切り取り領域判定部245が算出した、切り取り領域を特定するための4頂点座標を取得していた場合、領域表示用パラメータ生成部246による処理と同様の処理を行なって、切り取り領域の開始座標(StartX,StartY)、高さh及び幅wを算出する。
Returning to FIG. 3, processing by the correction parameter generation unit 248 will be described. The correction parameter generation unit 248 includes the start coordinates (StartX, StartY), the height h and the width w of the cut region generated by the region display parameter generation unit 246, and the document inclination angle calculated by the angle calculation unit 242. α is converted into a value that matches the resolution of the image to be corrected by the document inclination / size correction unit 26 (same as the resolution of the input image), and is output to the document inclination / size correction unit 26 as a correction parameter.
The correction parameter generation unit 248 performs the same processing as the processing by the region display parameter generation unit 246 when the four-vertex coordinates for specifying the cutting region calculated by the cutting region determination unit 245 have been acquired. The start coordinates (StartX, StartY), height h, and width w of the cut area are calculated.

次に原稿傾き・サイズ補正部26による補正処理について説明する。原稿傾き・サイズ補正部26は、原稿傾き・サイズ検出部24から取得した補正用パラメータに基づいて、入力階調補正部23から取得したRGB信号に対して傾き・サイズ補正処理を行なう。なお、入力階調補正部23は、処理後のRGB信号を一旦画像メモリ5に格納している場合、原稿傾き・サイズ補正部26は、画像メモリ5からRGB信号を読み出す。原稿傾き・サイズ補正部26が行なう傾き補正処理(回転処理)としては、例えば、以下の回転行列式を用いたアフィン変換処理が一般的である。なお、(x´,y´)は、座標(x,y)を角度θだけ回転させた後の座標値を示す。また、ここで用いられる三角比(sinθ,cosθ)の値も図5に示すようなテーブルを用いることにより、高速な演算が可能となる。

Next, correction processing by the document inclination / size correction unit 26 will be described. The document tilt / size correction unit 26 performs tilt / size correction processing on the RGB signals acquired from the input tone correction unit 23 based on the correction parameters acquired from the document tilt / size detection unit 24. When the input tone correction unit 23 temporarily stores the processed RGB signal in the image memory 5, the document inclination / size correction unit 26 reads the RGB signal from the image memory 5. As an inclination correction process (rotation process) performed by the document inclination / size correction unit 26, for example, an affine transformation process using the following rotation determinant is generally used. Note that (x ′, y ′) indicates a coordinate value after the coordinate (x, y) is rotated by an angle θ. Further, the trigonometric ratio (sin θ, cos θ) values used here can be calculated at high speed by using a table as shown in FIG.

そして、原稿傾き・サイズ補正部26は、サイズ補正処理として、回転処理後の座標(x´,y´)に対してバイリニア等の補間演算を行ない、サイズ補正後の出力画像の画素値を算出する。なお、上記の回転行列式の逆変換式(以下の行列式)により、補間画素の回転処理後の座標(x´,y´)の画素値を算出する際に必要となる補間画素の回転処理前の座標(xs ,ys )が分かる。よって、補間画素の画素値が、回転処理前にこの補間画素の近傍にあった画素の画素値に基づいて算出される。

Then, as the size correction process, the document inclination / size correction unit 26 performs an interpolation operation such as bilinear on the coordinates (x ′, y ′) after the rotation process, and calculates the pixel value of the output image after the size correction. To do. It should be noted that the interpolation pixel rotation processing necessary for calculating the pixel value of the coordinates (x ′, y ′) after the interpolation pixel rotation processing by the inverse transformation formula (the following determinant) of the rotation determinant described above. The previous coordinates (x s , y s ) are known. Therefore, the pixel value of the interpolation pixel is calculated based on the pixel value of the pixel that was in the vicinity of this interpolation pixel before the rotation process.

図21は補間演算を説明するための模式図である。図21には、回転処理前の画像を示しており、補間画素Z(xs ,ys )の画素値が、補間画素Zを囲む近傍の4画素Z1,Z2,Z3,Z4の画素値(各画素値をそれぞれZ1,Z2,Z3,Z4という)に基づいて算出される例を説明する。なお、図21において、xi ≦xs <xi+1,yi≦ys <yi+1であり、x座標において補間画素Zと画素Z1,Z2との距離の比がu:1−uであり、y座標において補間画素Zと画素Z1,Z3との距離の比がv:1−vであり、u,vは共に0以上1未満の数値である。原稿傾き・サイズ補正部26は、補間画素Zの画素値(Z)を以下の式に基づいて算出する。

FIG. 21 is a schematic diagram for explaining the interpolation calculation. FIG. 21 shows an image before the rotation process, and the pixel values of the interpolation pixel Z (x s , y s ) are the pixel values (4) of the neighboring four pixels Z1, Z2, Z3, Z4 surrounding the interpolation pixel Z ( An example in which each pixel value is calculated based on Z1, Z2, Z3, and Z4) will be described. In FIG. 21, x i ≦ x s <x i + 1 , y i ≦ y s <y i + 1 , and the ratio of the distance between the interpolation pixel Z and the pixels Z1 and Z2 in the x coordinate is u: 1. -U, and the ratio of the distance between the interpolation pixel Z and the pixels Z1 and Z3 in the y coordinate is v: 1-v, and u and v are both numerical values of 0 or more and less than 1. The document inclination / size correction unit 26 calculates the pixel value (Z) of the interpolation pixel Z based on the following equation.

原稿傾き・サイズ補正部26による傾き・サイズ補正処理後の各画素の座標値(x´,y´)は、0≦x´<補正後の原稿画像の幅、0≦y´<補正後の原稿画像の高さとなる。なお、原稿傾き・サイズ補正部26は、サイズ補正処理(補間演算)を行なった後に、傾き補正処理(回転処理)を行なってもよい。
原稿傾き・サイズ補正部26は、処理後の画像データ(RGB信号)を領域分離処理部27へ出力する。なお、原稿傾き・サイズ補正部26は、処理後の画像データを画像メモリ5に格納し、領域分離処理部27が、画像メモリ5から画像データを読み出すようにしてもよい。
The coordinate value (x ′, y ′) of each pixel after the inclination / size correction processing by the original inclination / size correction unit 26 is 0 ≦ x ′ <corrected original image width, 0 ≦ y ′ <corrected This is the height of the original image. The document inclination / size correction unit 26 may perform the inclination correction process (rotation process) after performing the size correction process (interpolation calculation).
The document inclination / size correction unit 26 outputs the processed image data (RGB signal) to the region separation processing unit 27. The document skew / size correction unit 26 may store the processed image data in the image memory 5, and the region separation processing unit 27 may read the image data from the image memory 5.

上述したように、本実施形態1では、原稿のエッジとして抽出された上部エッジ、下部エッジ、左部エッジ及び右部エッジのそれぞれの信頼度に応じて切り取り領域を特定することにより、原稿のエッジが正しく抽出され辛い原稿であっても、切り取り領域(原稿領域)の検出精度を向上させることができる。   As described above, in the first embodiment, the edge of the document is specified by specifying the cutout area according to the reliability of each of the upper edge, the lower edge, the left edge, and the right edge extracted as the edges of the document. Even if the original is difficult to extract correctly, the detection accuracy of the cut-out area (original area) can be improved.

(実施形態2)
図22は実施形態2に係る画像形成装置の構成を示すブロック図である。本実施形態2の画像形成装置101は、実施形態1におけるカラー画像処理装置2の代わりに2つの前段カラー画像処理装置2a及び後段カラー画像処理装置2bを備える。また、本実施形態2の画像形成装置101は、ハードディスクドライブ(HDD)等の大容量の画像記憶装置6を備える。本実施形態2の画像形成装置101は、上述の実施形態1のカラー画像処理装置2による画像処理を前段の画像処理と後段の画像処理とに分離し、それぞれを前段カラー画像処理装置2a及び後段カラー画像処理装置2bが実行する構成である。なお、実施形態1で説明した各部と同様の構成については、同一の符号を付して説明を省略する。
(Embodiment 2)
FIG. 22 is a block diagram illustrating a configuration of an image forming apparatus according to the second embodiment. The image forming apparatus 101 according to the second embodiment includes two front-stage color image processing apparatuses 2a and rear-stage color image processing apparatuses 2b instead of the color image processing apparatus 2 according to the first embodiment. The image forming apparatus 101 according to the second embodiment includes a large-capacity image storage device 6 such as a hard disk drive (HDD). The image forming apparatus 101 according to the second exemplary embodiment separates the image processing performed by the color image processing apparatus 2 according to the first exemplary embodiment into the first-stage image processing and the second-stage image processing, and the first-stage color image processing apparatus 2a and the second-stage image processing, respectively. This is a configuration executed by the color image processing apparatus 2b. In addition, about the structure similar to each part demonstrated in Embodiment 1, the same code | symbol is attached | subjected and description is abbreviate | omitted.

具体的には、前段カラー画像処理装置2aは、A/D変換部21、シェーディング補正部22、入力階調補正部23、原稿傾き・サイズ検出部24及び表示制御部25を備え、後段カラー画像処理装置2bは、原稿傾き・サイズ補正部26、領域分離処理部27、色補正部28、黒生成下色除去部29、空間フィルタ処理部30、出力階調補正部31及び階調再現処理部32を備える。   Specifically, the front color image processing apparatus 2a includes an A / D conversion unit 21, a shading correction unit 22, an input tone correction unit 23, a document inclination / size detection unit 24, and a display control unit 25, and a subsequent color image. The processing device 2b includes a document inclination / size correction unit 26, a region separation processing unit 27, a color correction unit 28, a black generation and under color removal unit 29, a spatial filter processing unit 30, an output gradation correction unit 31, and a gradation reproduction processing unit. 32.

前段カラー画像処理装置2aは、入力階調補正部23で処理された画像データ(RGB信号)を画像記憶装置6に格納する。また、前段カラー画像処理装置2aは、原稿傾き・サイズ補正機能の実行がユーザによって指示されている場合、原稿傾き・サイズ検出部24によって算出された補正用パラメータも画像記憶装置6へ出力し、入力階調補正部23による処理後の画像データに対応付けて画像記憶装置6に格納する。   The pre-stage color image processing device 2 a stores the image data (RGB signal) processed by the input tone correction unit 23 in the image storage device 6. The pre-stage color image processing apparatus 2a also outputs the correction parameters calculated by the document inclination / size detection unit 24 to the image storage device 6 when the user instructs the execution of the document inclination / size correction function. The image data is stored in the image storage device 6 in association with the image data processed by the input tone correction unit 23.

一方、後段カラー画像処理装置2bは、画像記憶装置6に格納された画像データ及び補正用パラメータを読み出し、原稿傾き・サイズ補正部26による処理以降の処理を実行する。なお、後段カラー画像処理装置2bの原稿傾き・サイズ補正部26は、傾き・サイズ補正処理後の画像データを順次画像メモリ5bに格納し、領域分離処理部27は、画像メモリ5bに格納された画像データに対して領域分離処理を行なう。領域分離処理以降の各処理は、パイプライン方式にて行なわれる。
本実施形態2では、上述した実施形態1と同様の効果が得られる。また、本実施形態2では、前段カラー画像処理装置2aによる処理と、後段カラー画像処理装置2bによる処理とを非同期で実行することが可能である。
On the other hand, the post-stage color image processing apparatus 2b reads out the image data and correction parameters stored in the image storage device 6, and executes the processes after the process by the document inclination / size correction unit 26. The document inclination / size correction unit 26 of the subsequent color image processing apparatus 2b sequentially stores the image data after the inclination / size correction processing in the image memory 5b, and the area separation processing unit 27 stores the image data in the image memory 5b. A region separation process is performed on the image data. Each processing after the region separation processing is performed by a pipeline method.
In the second embodiment, the same effect as in the first embodiment described above can be obtained. In the second embodiment, it is possible to asynchronously execute the processing by the preceding color image processing apparatus 2a and the processing by the subsequent color image processing apparatus 2b.

(実施形態3)
以下に、本発明に係る画像読取装置について説明する。図23は実施形態3に係る画像読取装置の構成を示すブロック図である。図に示すように、画像読取装置102は、カラー画像入力装置1(画像読取部)、カラー画像処理装置2、操作パネル4、画像メモリ5及び画像記憶装置6等を備える。また、カラー画像処理装置2は、A/D変換部21、シェーディング補正部22、入力階調補正部23、原稿傾き・サイズ検出部24、表示制御部25、原稿傾き・サイズ補正部26及びセレクタ33等を有する。なお、実施形態1,2で説明した各部と同様の構成については、同一の符号を付して説明を省略する。
(Embodiment 3)
The image reading apparatus according to the present invention will be described below. FIG. 23 is a block diagram illustrating a configuration of an image reading apparatus according to the third embodiment. As shown in the figure, the image reading device 102 includes a color image input device 1 (image reading unit), a color image processing device 2, an operation panel 4, an image memory 5, an image storage device 6, and the like. The color image processing apparatus 2 includes an A / D conversion unit 21, a shading correction unit 22, an input tone correction unit 23, a document inclination / size detection unit 24, a display control unit 25, a document inclination / size correction unit 26, and a selector. 33 etc. In addition, about the structure similar to each part demonstrated in Embodiment 1, 2, the same code | symbol is attached | subjected and description is abbreviate | omitted.

本実施形態3のカラー画像処理装置2では、原稿傾き・サイズ検出部24が、補正用パラメータと共に、入力階調補正部23から取得した画像データ(RGB信号)を原稿傾き・サイズ補正部26へ出力する。原稿傾き・サイズ補正部26は、原稿傾き・サイズ検出部24から取得した補正用パラメータに基づいて、原稿傾き・サイズ検出部24から取得した画像データに対して処理を行なう。なお、画像データは、画像メモリ5に一旦格納された後、原稿傾き・サイズ補正部26によって読み出されてもよい。   In the color image processing apparatus 2 according to the third embodiment, the document inclination / size detection unit 24 supplies the image data (RGB signal) acquired from the input tone correction unit 23 together with the correction parameters to the document inclination / size correction unit 26. Output. The document inclination / size correction unit 26 performs processing on the image data acquired from the document inclination / size detection unit 24 based on the correction parameters acquired from the document inclination / size detection unit 24. The image data may be temporarily stored in the image memory 5 and then read by the document inclination / size correction unit 26.

また、本実施形態3のカラー画像処理装置2では、入力階調補正部23によって処理された画像データと、原稿傾き・サイズ補正部26によって処理された画像データとがセレクタ33に入力されている。セレクタ33は、原稿傾き・サイズ補正機能の実行がユーザによって指示されていない場合、入力階調補正部23から入力された画像データを画像記憶装置6に格納する。即ち、原稿傾き・サイズ補正部26による処理が施されていない画像データが画像記憶装置6に格納される。一方、セレクタ33は、原稿傾き・サイズ補正機能の実行がユーザによって指示されている場合、原稿傾き・サイズ補正部26から入力された画像データを画像記憶装置6に格納する。即ち、原稿傾き・サイズ補正部26による処理が施された画像データが画像記憶装置6に格納される。   In the color image processing apparatus 2 according to the third embodiment, the image data processed by the input tone correction unit 23 and the image data processed by the document inclination / size correction unit 26 are input to the selector 33. . The selector 33 stores the image data input from the input tone correction unit 23 in the image storage device 6 when the user is not instructed to execute the document skew / size correction function. That is, image data that has not been processed by the document inclination / size correction unit 26 is stored in the image storage device 6. On the other hand, the selector 33 stores the image data input from the document inclination / size correction unit 26 in the image storage device 6 when the user instructs the execution of the document inclination / size correction function. That is, the image data subjected to the processing by the document inclination / size correction unit 26 is stored in the image storage device 6.

なお、原稿傾き・サイズ補正機能の実行が指示されている場合、入力階調補正部23は、処理後の画像データを一旦画像メモリ5に格納し、原稿傾き・サイズ補正部26は、画像メモリ5から画像データを読み出し、傾き・サイズ補正処理を実行し、処理後の画像データを再度画像メモリ5に格納する。原稿の1ページ分の画像データに対する傾き・サイズ補正処理が終了した後、画像メモリ5に格納された処理後の画像データが、画像形成装置100のCPU又はDSPによって画像メモリ5から読み出され、画像記憶装置6へ出力される。即ち、本実施形態3では、セレクタ33が、画像記憶装置6へ転送されるデータを、入力階調補正処理後の画像データとするか、傾き・サイズ補正処理後の画像データとするかを切り替える。   When the execution of the document inclination / size correction function is instructed, the input tone correction unit 23 temporarily stores the processed image data in the image memory 5, and the document inclination / size correction unit 26 stores the image memory. The image data is read from 5, the inclination / size correction process is executed, and the processed image data is stored in the image memory 5 again. After the inclination / size correction processing for the image data of one page of the document is completed, the processed image data stored in the image memory 5 is read from the image memory 5 by the CPU or DSP of the image forming apparatus 100, and It is output to the image storage device 6. That is, in the third embodiment, the selector 33 switches whether the data transferred to the image storage device 6 is the image data after the input tone correction process or the image data after the inclination / size correction process. .

画像読取装置102が傾き・サイズ補正処理後の画像データを画像記憶装置6に転送する構成に限らず、例えば、ネットワークを介して、コンピュータ、サーバ、デジタル複合機、プリンタ等に画像データを送信するように画像読取装置102を構成してもよい。
また、傾き・サイズ補正処理を実行させるか否かの指示は、操作パネル4を介して行なわれる構成に限らず、例えば、コンピュータにおいて、スキャナドライバの設定画面(画像読取装置102の読取条件の設定画面)を介して、マウス又はキーボードを用いて行なわれてもよい。
The image reading device 102 is not limited to the configuration in which the image data after the tilt / size correction processing is transferred to the image storage device 6, and for example, the image data is transmitted to a computer, a server, a digital multi-function peripheral, a printer, etc. The image reading apparatus 102 may be configured as described above.
In addition, the instruction whether or not to execute the tilt / size correction processing is not limited to the configuration performed via the operation panel 4. For example, in a computer, a scanner driver setting screen (setting of reading conditions of the image reading apparatus 102) is performed. Via a screen) using a mouse or a keyboard.

上述の実施形態1,2で説明した画像形成装置100,101は、デジタルカラー複写機に限らず、コピア機能、プリンタ機能、ファクシミリ送受信機能、scan to e-mail機能等を備えるデジタルカラー複合機に適用しても良い。デジタルカラー複合機はさらに、例えば、モデムやネットワークカードよりなる通信装置を備えることもできる。この場合、例えばファクシミリの送信を行なうときは、モデムにて、相手先との送信手続きを行ない送信可能な状態が確保されると、所定の形式で圧縮された画像データ(スキャナで読み込まれた画像データ)をメモリから読み出し、圧縮形式の変更等必要な処理を施して、相手先に通信回線を介して順次送信する。   The image forming apparatuses 100 and 101 described in the first and second embodiments are not limited to a digital color copying machine, but may be a digital color multifunction peripheral having a copier function, a printer function, a facsimile transmission / reception function, a scan to e-mail function, and the like. It may be applied. The digital color multi-function peripheral can further include a communication device such as a modem or a network card. In this case, for example, when transmitting a facsimile, if the modem performs a transmission procedure with the other party and secures the transmission possible state, the image data compressed in a predetermined format (the image read by the scanner) Data) is read from the memory, subjected to necessary processing such as changing the compression format, and sequentially transmitted to the other party via a communication line.

また、画像形成装置100,101を、ネットワークカード、LANケーブル等を介して、ネットワークに接続されたコンピュータや他のデジタル複合機等との間でデータ通信を行なうように構成してもよい。また、カラー複合機だけでなく、モノクロの画像を扱う複合機においても本発明を適用することができる。   Further, the image forming apparatuses 100 and 101 may be configured to perform data communication with a computer or other digital multi-function peripheral connected to the network via a network card, a LAN cable, or the like. Further, the present invention can be applied not only to a color multifunction peripheral but also to a multifunction peripheral that handles monochrome images.

上述の実施形態1〜3において、画像形成装置100,101及び画像読取装置102に備えられる原稿傾き・サイズ検出部24及び原稿傾き・サイズ補正部26を含む各部は、ハードウェアロジックによって実現してもよいし、CPU又はMPU等のプロセッサを用いてソフトウェアによって実現してもよい。即ち、画像形成装置100,101及び画像読取装置102は、各機能を実現するための制御プログラムの命令を実行するCPU、この制御プログラムを格納したROM、各種の制御プログラムを展開するRAM、各種の制御プログラム及び各種データを格納するメモリ等の記憶装置(記録媒体)等を備えている。   In the first to third embodiments, each unit including the document inclination / size detection unit 24 and the document inclination / size correction unit 26 provided in the image forming apparatuses 100 and 101 and the image reading apparatus 102 is realized by hardware logic. Alternatively, it may be realized by software using a processor such as a CPU or MPU. That is, the image forming apparatuses 100 and 101 and the image reading apparatus 102 include a CPU that executes instructions of a control program for realizing each function, a ROM that stores the control program, a RAM that develops various control programs, A storage device (recording medium) such as a memory for storing the control program and various data is provided.

そして、本発明の目的は、各機能をコンピュータに実行させるための制御プログラムのプログラムコード(実行形式プログラム、中間コードプログラム、ソースプログラム)を記録した、コンピュータでの読み取りが可能な記録媒体をコンピュータに供給し、コンピュータ(CPU又はMPU)が、記録媒体に記録されているプログラムコードを読み出して実行することによっても達成される。この場合には、本発明に係る画像処理(原稿傾き・サイズ検出処理及び傾き・サイズ補正処理)を実現するコンピュータプログラムを記録した記録媒体を持ち運び自在に提供することができる。   An object of the present invention is to provide a computer-readable recording medium on which a program code (execution format program, intermediate code program, source program) of a control program for causing a computer to execute each function is recorded. The program (CPU or MPU) is supplied, and the program code recorded in the recording medium is read and executed. In this case, a recording medium on which a computer program that realizes image processing (original tilt / size detection processing and tilt / size correction processing) according to the present invention is recorded can be provided in a portable manner.

図24は本発明に係る画像処理装置をコンピュータシステムに適用した場合の構成例を示す模式図である。図24に示すコンピュータシステム70では、パーソナルコンピュータ71に、画像入力装置75、画像表示装置72、キーボード73、マウス74、画像形成装置76等の周辺機器が接続されている。画像入力装置75としては、フラットベッドスキャナ、フィルムスキャナ、デジタルカメラ、携帯電話機等が用いられる。また、画像表示装置72としては、CRTディスプレイ、液晶ディスプレイ等が用いられる。画像形成装置76としては、電子写真方式又はインクジェット方式のプリンタが用いられる。   FIG. 24 is a schematic diagram showing a configuration example when the image processing apparatus according to the present invention is applied to a computer system. In a computer system 70 shown in FIG. 24, peripheral devices such as an image input device 75, an image display device 72, a keyboard 73, a mouse 74, and an image forming device 76 are connected to a personal computer 71. As the image input device 75, a flatbed scanner, a film scanner, a digital camera, a mobile phone, or the like is used. As the image display device 72, a CRT display, a liquid crystal display, or the like is used. As the image forming apparatus 76, an electrophotographic or inkjet printer is used.

パーソナルコンピュータ71は、本発明に係る記録媒体77に記録されているコンピュータプログラムを読み取るための読取装置を備えている。従って、本発明に係る記録媒体77に記録されているコンピュータプログラムをパーソナルコンピュータ71にインストールすることにより、上述の実施形態で説明した原稿傾き・サイズ検出処理及び傾き・サイズ補正処理を含む各種機能をパーソナルコンピュータ71によって実現することができる。具体的には、パーソナルコンピュータ71は、CPU又はMPUを備えており、CPU又はMPUが、インストール(ロード)された所定のコンピュータプログラムを実行することにより、種々の処理を実行する。なお、パーソナルコンピュータ71は、ネットワークを介してサーバ等に接続するための通信手段として、ネットワークカードやモデム等を備えていてもよい。   The personal computer 71 includes a reading device for reading a computer program recorded on the recording medium 77 according to the present invention. Therefore, by installing the computer program recorded on the recording medium 77 according to the present invention in the personal computer 71, various functions including the document inclination / size detection process and the inclination / size correction process described in the above-described embodiment are performed. It can be realized by the personal computer 71. Specifically, the personal computer 71 includes a CPU or MPU, and the CPU or MPU executes various processes by executing a predetermined computer program installed (loaded). The personal computer 71 may include a network card, a modem, or the like as communication means for connecting to a server or the like via a network.

記録媒体77としては、パーソナルコンピュータ71に対して着脱可能な外部記憶装置であり、パーソナルコンピュータ71に設けられた読取装置に挿入することで、記録されているプログラムの読み取りが可能となるプログラムメディアであってもよい。また、記録されているプログラムがマイクロコンピュータで処理されるため、記録媒体77としては、例えばROMのようなプログラムメディアであってもよい。   The recording medium 77 is an external storage device that can be attached to and detached from the personal computer 71, and is a program medium that can read a recorded program by being inserted into a reading device provided in the personal computer 71. There may be. Further, since the recorded program is processed by the microcomputer, the recording medium 77 may be a program medium such as a ROM.

いずれの場合においても、格納されているプログラムコードはマイクロプロセッサがアクセスして実行させる構成であっても良いし、あるいは、いずれの場合もプログラムコードを読み出し、読み出されたプログラムコードは、マイクロコンピュータの図示されていないプログラム記憶エリアにダウンロードされて、そのプログラムコードが実行される方式であってもよい。この場合、ダウンロード用のプログラムは予め本体装置に格納されているものとする。   In any case, the stored program code may be configured to be accessed and executed by the microprocessor, or in any case, the program code is read and the read program code is the microcomputer. The program code may be downloaded to a program storage area (not shown) and executed. In this case, it is assumed that the download program is stored in the main device in advance.

ここで、上記プログラムメディアは、本体と分離可能に構成される記録媒体であり、磁気テープやカセットテープ等のテープ系、フレキシブルディスクやハードディスク等の磁気ディスク並びにCD−ROM/MO/MD/DVD/CD−R等の光ディスクを含むディスク系、ICカード(メモリカードを含む)/光カード等のカード系、あるいはマスクROM、EPROM(Erasable Programmable Read Only Memory)、EEPROM(Electrically Erasable Programmable Read Only Memory)、フラッシュROM等による半導体メモリを含めた固定的にコンピュータプログラムを担持する媒体を用いることができる。   Here, the program medium is a recording medium configured to be separable from the main body, and includes a tape system such as a magnetic tape and a cassette tape, a magnetic disk such as a flexible disk and a hard disk, and a CD-ROM / MO / MD / DVD / Disk systems including optical disks such as CD-R, card systems such as IC cards (including memory cards) / optical cards, mask ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), A medium that carries a fixed computer program including a semiconductor memory such as a flash ROM can be used.

また、上述のコンピュータシステム70は、パーソナルコンピュータ71をインターネットを含む通信ネットワークと接続可能に構成できるので、通信ネットワークを介して上記プログラムコードをダウンロードしてもよい。このように通信ネットワークからプログラムコードをダウンロードする場合には、そのダウンロード用のプログラムは予め本体装置に格納しておくか、あるいは別な記録媒体からインストールされるものであっても良い。   Further, since the computer system 70 described above can be configured so that the personal computer 71 can be connected to a communication network including the Internet, the program code may be downloaded via the communication network. When the program code is downloaded from the communication network in this way, the program for downloading may be stored in the main device in advance or may be installed from another recording medium.

また、通信ネットワークとしては、特に限定されず、例えば、インターネット、イントラネット、エキストラネット、LAN、ISDN、VAN、CATV通信網、仮想専用網(virtual private network)、電話回線網、移動体通信網、衛星通信網等が利用可能である。なお、本発明は、上記プログラムコードが電子的な伝送で具現化された、搬送波に埋め込まれたコンピュータデータ信号の形態でも実現され得る。   The communication network is not particularly limited. For example, the Internet, intranet, extranet, LAN, ISDN, VAN, CATV communication network, virtual private network, telephone line network, mobile communication network, satellite A communication network or the like is available. The present invention can also be realized in the form of a computer data signal embedded in a carrier wave in which the program code is embodied by electronic transmission.

また、画像形成装置100,101又は画像読取装置102が備える各部は、ハードウェアロジックによって実現される構成又はソフトウェアによって実現される構成に限らない。例えば、画像形成装置100,101又は画像読取装置102の各部の一部をハードウェアによって実現し、残りの各部とハードウェアの制御とをソフトウェアによって実現するようにしてもよい。   Each unit included in the image forming apparatuses 100 and 101 or the image reading apparatus 102 is not limited to a configuration realized by hardware logic or a configuration realized by software. For example, a part of each part of the image forming apparatuses 100 and 101 or the image reading apparatus 102 may be realized by hardware, and the remaining parts and hardware control may be realized by software.

以上、本発明の好適な実施形態について具体的に説明したが、各構成及び動作等は適宜変更可能であって、上述の実施形態に限定されることはない。   The preferred embodiments of the present invention have been specifically described above. However, each configuration, operation, and the like can be changed as appropriate, and are not limited to the above-described embodiments.

100 画像形成装置
1 カラー画像入力装置(画像読取部)
2 カラー画像処理装置(画像処理装置)
3 カラー画像出力装置(画像形成部)
4 操作パネル(表示部、受付部、変更受付部)
24 原稿傾き・サイズ検出部
25 表示制御部(生成部、抽出領域変更部)
26 原稿傾き・サイズ補正部
77 記録媒体
241 エッジ検出部
244 原稿領域検出部(原稿エッジ抽出部、信頼度算出部、計数部、算出部)
245 切り取り領域判定部(領域特定部、判断部)
100 Image Forming Apparatus 1 Color Image Input Device (Image Reading Unit)
2 Color image processing device (image processing device)
3 Color image output device (image forming unit)
4 Operation panels (display unit, reception unit, change reception unit)
24 Document inclination / size detection unit 25 Display control unit (generation unit, extraction area change unit)
26 Document tilt / size correction unit 77 Recording medium 241 Edge detection unit 244 Document area detection unit (document edge extraction unit, reliability calculation unit, counting unit, calculation unit)
245 Cut region determination unit (region specifying unit, determination unit)

Claims (10)

矩形の原稿を含み、前記原稿よりも広い領域を読み取って得られた画像データから、前記原稿から読み取られた原稿画像データを抽出する画像処理装置において、
前記画像データに基づいて、前記画像データに基づく画像のエッジを検出するエッジ検出部と、
該エッジ検出部が検出したエッジに基づいて、前記原稿の4辺側のエッジをそれぞれ抽出する原稿エッジ抽出部と、
該原稿エッジ抽出部が抽出した各エッジの信頼度を算出する信頼度算出部と、
出力画像の用紙サイズを受け付ける受付部と、
前記信頼度算出部が算出した信頼度、及び前記受付部が受け付けた用紙サイズに基づいて、前記原稿画像データとして抽出すべき抽出領域を特定する領域特定部と
を備えることを特徴とする画像処理装置。
In an image processing apparatus for extracting document image data read from the document from image data obtained by reading a wider area than the document including a rectangular document,
An edge detection unit for detecting an edge of an image based on the image data based on the image data;
A document edge extraction unit for extracting edges on each of the four sides of the document based on edges detected by the edge detection unit;
A reliability calculation unit for calculating the reliability of each edge extracted by the document edge extraction unit;
A reception unit for receiving the paper size of the output image;
And an area specifying unit that specifies an extraction area to be extracted as the document image data based on the reliability calculated by the reliability calculating unit and the paper size received by the receiving unit. apparatus.
前記信頼度算出部が算出した各エッジの信頼度が所定閾値以上であるか否かを判断する判断部を備え、
前記領域特定部は、前記判断部によって、少なくとも1つのエッジが所定閾値以上であると判断された場合に、所定閾値以上の信頼度のエッジを基準とし、前記受付部が受け付けた用紙サイズの抽出領域を特定するようにしてあることを特徴とする請求項1に記載の画像処理装置。
A determination unit that determines whether or not the reliability of each edge calculated by the reliability calculation unit is greater than or equal to a predetermined threshold;
When the determination unit determines that at least one edge is equal to or greater than a predetermined threshold, the area specifying unit extracts a paper size received by the reception unit based on an edge having a reliability greater than or equal to the predetermined threshold. The image processing apparatus according to claim 1, wherein an area is specified.
前記画像データに基づく画像に、前記領域特定部が特定した抽出領域を示す情報を重ね合せた画像を表示させるための表示用データを生成する生成部を備えることを特徴とする請求項1又は2に記載の画像処理装置。   3. The image processing apparatus according to claim 1, further comprising: a generation unit that generates display data for displaying an image in which information indicating the extraction region specified by the region specifying unit is superimposed on an image based on the image data. An image processing apparatus according to 1. 前記生成部が生成した表示用データに基づく画像を表示させる表示部と、
該表示部が表示した画像に基づいて、前記抽出領域の変更を受け付ける変更受付部と、
該変更受付部が受け付けた変更に基づいて、前記領域特定部が特定した抽出領域を変更する抽出領域変更部と
を備えることを特徴とする請求項3に記載の画像処理装置。
A display unit for displaying an image based on the display data generated by the generation unit;
A change accepting unit for accepting a change in the extraction area based on the image displayed by the display unit;
The image processing apparatus according to claim 3, further comprising: an extraction region changing unit that changes the extraction region specified by the region specifying unit based on a change received by the change receiving unit.
前記エッジ検出部は、前記画像の4辺側のエッジをそれぞれ検出するようにしてあり、
前記エッジ検出部が検出したエッジを構成する各画素について、各注目画素と、各注目画素から所定間隔の画素との座標情報の差分値が所定値未満となる画素数を、各注目画素に対する有効カウント値として計数する計数部と、
各エッジ毎に、前記計数部が計数した有効カウント値の平均値を算出する算出部とを備え、
前記原稿エッジ抽出部は、
前記エッジ検出部が検出した一辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記一辺に対向する他辺から最も離れた位置の画素を前記原稿の一辺側のエッジとして抽出し、
前記エッジ検出部が検出した前記他辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記一辺から最も離れた位置の画素を前記原稿の他辺側のエッジとして抽出し、
前記エッジ検出部が検出した前記一辺に交差する別の一辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記別の一辺に対向する別の他辺から最も離れた位置の画素を前記別の一辺側のエッジとして抽出し、
前記エッジ検出部が検出した前記別の他辺側のエッジを構成する画素のうちで、前記算出部が算出した平均値よりも大きい有効カウント値の画素であり、前記別の一辺から最も離れた位置の画素を前記別の他辺側のエッジとして抽出するようにしてあり、
前記信頼度算出部は、前記原稿エッジ抽出部が各エッジとして抽出した画素の有効カウント値を各エッジの信頼度とするようにしてあることを特徴とする請求項1から4までのいずれかひとつに記載の画像処理装置。
The edge detection unit is configured to detect edges on the four sides of the image,
For each pixel constituting the edge detected by the edge detection unit, the number of pixels for which the difference value of the coordinate information between each pixel of interest and each pixel at a predetermined interval from the pixel of interest is less than a predetermined value is determined for each pixel of interest. A counting unit for counting as a count value;
A calculation unit that calculates an average value of effective count values counted by the counting unit for each edge,
The document edge extraction unit
Among the pixels constituting the edge on one side detected by the edge detection unit, the pixel having an effective count value larger than the average value calculated by the calculation unit, and the position farthest from the other side facing the one side Are extracted as edges on one side of the document,
Among the pixels constituting the edge on the other side detected by the edge detection unit, the pixel having an effective count value larger than the average value calculated by the calculation unit, and a pixel at a position farthest from the one side Extracted as the other side edge of the document,
Among the pixels constituting the edge on another side intersecting the one side detected by the edge detection unit, the pixel having an effective count value larger than the average value calculated by the calculation unit, and on the other side Extract a pixel at a position farthest from the other opposite side as an edge on the other side,
Among the pixels constituting the edge on the other other side detected by the edge detection unit, the pixel having an effective count value larger than the average value calculated by the calculation unit and farthest from the other side A pixel at a position is extracted as an edge on the other side, and
5. The reliability calculation unit according to claim 1, wherein the effective count value of the pixel extracted as each edge by the document edge extraction unit is used as the reliability of each edge. An image processing apparatus according to 1.
請求項1から5までのいずれかひとつに記載の画像処理装置と、
該画像処理装置で処理された画像データに基づく画像を形成する画像形成部と
を備えることを特徴とする画像形成装置。
An image processing apparatus according to any one of claims 1 to 5,
An image forming apparatus comprising: an image forming unit that forms an image based on image data processed by the image processing apparatus.
原稿を読み取って画像データを取得する画像読取部と、
請求項1から5までのいずれかひとつに記載の画像処理装置とを備え、
前記画像読取部で読み取った画像を前記画像処理装置で処理するようにしてあることを特徴とする画像読取装置。
An image reading unit for reading image data to obtain image data;
An image processing apparatus according to any one of claims 1 to 5,
An image reading apparatus, wherein an image read by the image reading unit is processed by the image processing apparatus.
画像処理装置が、矩形の原稿を含み、前記原稿よりも広い領域を読み取って得られた画像データから、前記原稿から読み取られた原稿画像データを抽出する画像処理方法において、
前記画像処理装置が、前記画像データに基づいて、前記画像データに基づく画像のエッジを検出するステップと、
前記画像処理装置が、検出したエッジに基づいて、前記原稿の4辺側のエッジをそれぞれ抽出するステップと、
前記画像処理装置が、抽出した各エッジの信頼度を算出するステップと、
前記画像処理装置が、算出した信頼度、及び外部から受け付けた出力画像の用紙サイズに基づいて、前記原稿画像データとして抽出すべき抽出領域を特定するステップと
を含むことを特徴とする画像処理方法。
In an image processing method in which an image processing apparatus extracts a document image data read from the document from image data obtained by reading a region wider than the document including a rectangular document,
The image processing device detecting an edge of an image based on the image data based on the image data;
The image processing apparatus extracting each of the four side edges of the document based on the detected edges;
The image processing apparatus calculating a reliability of each extracted edge;
The image processing apparatus includes a step of specifying an extraction area to be extracted as the document image data based on the calculated reliability and the paper size of the output image received from the outside. .
コンピュータに、矩形の原稿を含み、前記原稿よりも広い領域を読み取って得られた画像データから、前記原稿から読み取られた原稿画像データを抽出させるためのコンピュータプログラムにおいて、
前記コンピュータに、前記画像データに基づいて、前記画像データに基づく画像のエッジを検出させるステップと、
前記コンピュータに、検出されたエッジに基づいて、前記原稿の4辺側のエッジをそれぞれ抽出させるステップと、
前記コンピュータに、抽出された各エッジの信頼度を算出させるステップと、
前記コンピュータに、算出された信頼度、及び外部から受け付けた出力画像の用紙サイズに基づいて、前記原稿画像データとして抽出すべき抽出領域を特定させるステップと
を含むことを特徴とするコンピュータプログラム。
In a computer program for causing a computer to extract original image data read from an original from image data obtained by reading a region wider than the original including a rectangular original,
Causing the computer to detect an edge of an image based on the image data based on the image data;
Causing the computer to extract four side edges of the document based on the detected edges, respectively;
Causing the computer to calculate the reliability of each extracted edge;
And a step of causing the computer to specify an extraction area to be extracted as the document image data based on the calculated reliability and the paper size of the output image received from the outside.
請求項9に記載のコンピュータプログラムが記録されていることを特徴とするコンピュータでの読み取り可能な記録媒体。   A computer-readable recording medium on which the computer program according to claim 9 is recorded.
JP2011270501A 2011-12-09 2011-12-09 Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium Pending JP2013123119A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011270501A JP2013123119A (en) 2011-12-09 2011-12-09 Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011270501A JP2013123119A (en) 2011-12-09 2011-12-09 Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium

Publications (1)

Publication Number Publication Date
JP2013123119A true JP2013123119A (en) 2013-06-20

Family

ID=48774866

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011270501A Pending JP2013123119A (en) 2011-12-09 2011-12-09 Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium

Country Status (1)

Country Link
JP (1) JP2013123119A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9369607B2 (en) 2014-10-30 2016-06-14 Kyocera Document Solutions Inc. Image reading device, image forming apparatus, and image reading method
US10009494B2 (en) 2015-11-04 2018-06-26 Canon Kabushiki Kaisha Image reading apparatus with end detection and image reading method
US10334137B2 (en) 2015-11-04 2019-06-25 Canon Kabushiki Kaisha Image reading apparatus and image reading method
JP2019161639A (en) * 2018-03-13 2019-09-19 キヤノン株式会社 Image processing apparatus, program and image processing method
US10491770B2 (en) 2015-11-04 2019-11-26 Canon Kabushiki Kaisha Image reading apparatus with skew feed correction and image reading method thereof
JP2020181510A (en) * 2019-04-26 2020-11-05 キヤノンメディカルシステムズ株式会社 Medical image processing device and medical image processing program
KR20210001858A (en) * 2019-06-27 2021-01-06 베이징 바이두 넷컴 사이언스 앤 테크놀로지 코., 엘티디. Methods and devices for determining the color of a text
US11991325B2 (en) 2020-07-14 2024-05-21 Canon Kabushiki Kaisha Image processing apparatus, control method, and storage medium to detect a sheet edge based on marks printed on an adjustment chart and acquired regions of interest images

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9369607B2 (en) 2014-10-30 2016-06-14 Kyocera Document Solutions Inc. Image reading device, image forming apparatus, and image reading method
US10009494B2 (en) 2015-11-04 2018-06-26 Canon Kabushiki Kaisha Image reading apparatus with end detection and image reading method
US10334137B2 (en) 2015-11-04 2019-06-25 Canon Kabushiki Kaisha Image reading apparatus and image reading method
US10491770B2 (en) 2015-11-04 2019-11-26 Canon Kabushiki Kaisha Image reading apparatus with skew feed correction and image reading method thereof
JP7250526B2 (en) 2018-03-13 2023-04-03 キヤノン株式会社 Image processing device, program, image processing method
JP2019161639A (en) * 2018-03-13 2019-09-19 キヤノン株式会社 Image processing apparatus, program and image processing method
JP2020181510A (en) * 2019-04-26 2020-11-05 キヤノンメディカルシステムズ株式会社 Medical image processing device and medical image processing program
JP7296773B2 (en) 2019-04-26 2023-06-23 キヤノンメディカルシステムズ株式会社 MEDICAL IMAGE PROCESSING APPARATUS AND MEDICAL IMAGE PROCESSING PROGRAM
KR20210001858A (en) * 2019-06-27 2021-01-06 베이징 바이두 넷컴 사이언스 앤 테크놀로지 코., 엘티디. Methods and devices for determining the color of a text
US11481927B2 (en) 2019-06-27 2022-10-25 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and apparatus for determining text color
KR102360271B1 (en) 2019-06-27 2022-02-07 베이징 바이두 넷컴 사이언스 앤 테크놀로지 코., 엘티디. Methods and devices for determining the color of a text
JP2021006982A (en) * 2019-06-27 2021-01-21 ベイジン バイドゥ ネットコム サイエンス アンド テクノロジー カンパニー リミテッド Method and device for determining character color
US11991325B2 (en) 2020-07-14 2024-05-21 Canon Kabushiki Kaisha Image processing apparatus, control method, and storage medium to detect a sheet edge based on marks printed on an adjustment chart and acquired regions of interest images

Similar Documents

Publication Publication Date Title
JP4927122B2 (en) Image processing method, image processing apparatus, image forming apparatus, program, and recording medium
JP2013123119A (en) Image processing apparatus, image forming apparatus, image reading apparatus, image processing method, computer program, and recording medium
JP4886053B2 (en) CONTROL DEVICE, IMAGE READING DEVICE, IMAGE FORMING DEVICE, IMAGE READING DEVICE CONTROL METHOD, PROGRAM, AND RECORDING MEDIUM
JP4758502B2 (en) Image processing apparatus, image reading apparatus, image transmitting apparatus, image forming apparatus, image processing method, program, and recording medium thereof
US8634650B2 (en) Image processing apparatus, image forming apparatus, image reading apparatus, and image processing method
JP5813523B2 (en) Image processing apparatus, image forming apparatus, image processing method, program, and recording medium
US8848240B2 (en) Image processing apparatus, image reading apparatus, image forming apparatus, image processing method, and recording medium
JP4749477B2 (en) Image processing apparatus, image forming apparatus, image processing method, computer program, and recording medium
JP4772889B2 (en) Portable terminal device, captured image processing system, program, and recording medium
JP2011055467A (en) Captured image processing system, image output method, program, and recording medium
JP2011066690A (en) Portable terminal apparatus, image output apparatus, captured image processing system, method of controlling portable terminal apparatus, image output method, program, and recording medium
JP2019205110A (en) Image processing apparatus for performing multi-crop processing, method for generating image of document unit by multi-crop processing, and program
JP2011010033A (en) Image processing apparatus, image forming apparatus, image processing method, computer program and recording medium
JP6628279B2 (en) Image processing apparatus, image processing method, image processing program, and recording medium
JP4487000B2 (en) Image processing apparatus, image forming apparatus, image processing method, image processing system, image processing program, and recording medium thereof
JP2012118863A (en) Image reading device, image formation device, image reading method, program and recording medium therefor
JP5819378B2 (en) Image determination apparatus, image processing system, program, and recording medium
JP2012227569A (en) Image processing apparatus, image forming apparatus, computer program, recording medium and image processing method
JP5025611B2 (en) Image processing apparatus, image forming apparatus, computer program, recording medium, and image processing method
JP6262102B2 (en) Image processing apparatus, image processing system, computer program, and recording medium
JP2010161745A (en) Image processor, image reader, image transmission device, image formation device, image processing method, program, and recording medium of the same
JP4545167B2 (en) Image processing method, image processing apparatus, image forming apparatus, computer program, and recording medium
JP4334498B2 (en) Image processing apparatus, image forming apparatus, image processing method, and computer program
JP2010258706A (en) Image processing apparatus, image forming apparatus, method of controlling image processing apparatus, program, and recording medium
JP5265040B2 (en) Image processing apparatus, image forming apparatus, computer program, recording medium, and image processing method