JP6852618B2 - Computer programs and image processing equipment - Google Patents

Computer programs and image processing equipment Download PDF

Info

Publication number
JP6852618B2
JP6852618B2 JP2017151957A JP2017151957A JP6852618B2 JP 6852618 B2 JP6852618 B2 JP 6852618B2 JP 2017151957 A JP2017151957 A JP 2017151957A JP 2017151957 A JP2017151957 A JP 2017151957A JP 6852618 B2 JP6852618 B2 JP 6852618B2
Authority
JP
Japan
Prior art keywords
area
margin
region
color
candidate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2017151957A
Other languages
Japanese (ja)
Other versions
JP2019033329A (en
Inventor
鑑地 吉田
鑑地 吉田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2017151957A priority Critical patent/JP6852618B2/en
Publication of JP2019033329A publication Critical patent/JP2019033329A/en
Application granted granted Critical
Publication of JP6852618B2 publication Critical patent/JP6852618B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本明細書は、画像のうちの一部分の色を修正すべきか否かを判断する技術に関する。 The present specification relates to a technique for determining whether or not the color of a part of an image should be corrected.

従来から、スキャナなどの画像読取装置を用いて、原稿を示す画像データが生成されている。また、画像データのうち、原稿の切れた箇所などの欠陥を示す部分を、色を修正してマスキングする技術が、提案されている。 Conventionally, image data indicating a document has been generated by using an image reading device such as a scanner. Further, a technique has been proposed in which a part of the image data showing a defect such as a cut portion of a document is masked by correcting the color.

特開2001−169081号公報Japanese Unexamined Patent Publication No. 2001-169081

ところで、画像データとしては、原稿に加えて、原稿の外側に配置された余白を含む画像を示す画像データが利用される場合がある。このように余白を含む画像を示す画像データを処理する場合に、画像のうちの一部分の色を修正すべきか否かを判断する点については、工夫の余地があった。 By the way, as the image data, in addition to the original, image data indicating an image including a margin arranged outside the original may be used. When processing image data indicating an image including margins in this way, there is room for ingenuity in determining whether or not to correct the color of a part of the image.

本明細書は、原稿と原稿の外側に配置された余白とを含む画像のうちの一部分の色を修正すべきか否かを適切に判断できる技術を開示する。 The present specification discloses a technique capable of appropriately determining whether or not to correct the color of a part of an image including a manuscript and a margin arranged outside the manuscript.

本明細書は、例えば、以下の適用例を開示する。 The present specification discloses, for example, the following application examples.

[適用例1]プログラムであって、原稿を光学的に読み取ることによって生成され、原稿と前記原稿の外側に配置された余白とを含む読取画像を示す前記読取画像データを取得する取得機能と、前記読取画像データを解析することによって、前記読取画像内の前記原稿を含む部分を矩形状の領域に区切って得られる矩形原稿領域の4つの辺を特定する辺特定機能と、前記4つの辺のうちのいずれかの辺に接する前記矩形原稿領域内の領域であって前記原稿ではない領域の候補である候補領域を特定する候補領域特定機能と、前記候補領域の色を修正すべきか否かを判断する第1判断機能と、前記余白を示す領域であって前記矩形原稿領域の外側の領域である余白領域の少なくとも一部を構成する部分余白領域であって、前記4つの辺のうちの互いに異なる辺に接する1以上の部分余白領域のそれぞれに関して、色を修正すべきか否かを判断する第2判断機能と、前記候補領域に関する前記第1判断機能による判断の結果と、前記1以上の部分余白領域のそれぞれに関する前記第2判断機能による判断の結果と、を用いて、色を修正すべきであると判断された領域の色を修正する処理である選択修正処理を実行し、前記選択修正処理済の前記矩形原稿領域と前記選択修正処理済の前記1以上の部分余白領域のそれぞれとを含む出力画像を示す出力画像データを生成する画像生成機能と、をコンピュータに実現させ、前記第2判断機能は、注目部分余白領域と予め決められた連続関係にある領域を構成する領域であって、部分余白領域と候補領域とのうちの少なくとも1つの領域に関して、色を修正すべきではないと判断される場合に、前記注目部分余白領域の色を修正すべきではないと判断し、前記注目部分余白領域の色を修正すべきと前記第2判断機能によって判断されるための条件は、前記1以上の部分余白領域と前記候補領域とのうちの前記注目部分余白領域と前記予め決められた連続関係にある領域を構成する領域が、色を修正すべきではないと判断される領域を含まないことを、含む、コンピュータプログラム。 [Application Example 1] A program, which is a program and has an acquisition function of acquiring the scanned image data indicating a scanned image including a document and a margin arranged outside the document, which is generated by optically scanning the document. A side identification function for identifying four sides of a rectangular document area obtained by dividing a portion of the scanned image including the document into a rectangular area by analyzing the scanned image data, and a side identification function of the four sides. A candidate area identification function for specifying a candidate area that is a candidate for an area that is not the original and is a region in the rectangular original area that touches any of the sides, and whether or not the color of the candidate area should be corrected. The first determination function for determination and the partial margin area which is the area indicating the margin and constitutes at least a part of the margin area which is the area outside the rectangular document area, and which are mutual of the four sides. The second judgment function for determining whether or not to correct the color for each of the one or more partial margin areas in contact with different sides, the result of the judgment by the first judgment function for the candidate area, and the one or more parts. Using the result of the judgment by the second judgment function for each of the margin areas, the selection correction processing, which is the processing for correcting the color of the area where it is determined that the color should be corrected, is executed, and the selection correction is performed. A computer is realized with an image generation function for generating output image data indicating an output image including each of the processed rectangular original area and the one or more partial margin areas after the selection correction processing, and the second. The judgment function is an area that constitutes an area having a predetermined continuous relationship with the attention area margin area, and the color should not be corrected for at least one area of the partial margin area and the candidate area. When it is determined, the condition for determining that the color of the attention portion margin area should not be corrected and determining that the color of the attention portion margin region should be corrected by the second determination function is as described above. The region constituting the region having a predetermined continuous relationship with the attention portion margin region of the one or more partial margin regions and the candidate region includes an region where it is determined that the color should not be corrected. Computer programs, including not.

この構成によれば、注目部分余白領域と予め決められた連続関係にある領域に関して色を修正すべきではないと判断される場合に、注目部分余白領域の色を修正すべきではないと判断される。そして、注目部分余白領域の色を修正すべきと判断されるための条件は、注目部分余白領域と予め決められた連続関係にある領域を構成する部分余白領域と候補領域とが、色を修正すべきではないと判断される領域を含まないことを、含む。これらにより、色が修正された領域に色が修正されない領域が接することが抑制される。この結果、色が修正された領域と色が修正されない領域との間の色の差が目立つことが、抑制される。 According to this configuration, when it is determined that the color should not be corrected for the area having a predetermined continuous relationship with the attention area margin area, it is determined that the color of the attention area margin area should not be corrected. To. Then, the condition for determining that the color of the attention portion margin region should be corrected is that the partial margin region and the candidate region constituting the region having a predetermined continuous relationship with the attention portion margin region correct the color. Includes not including areas that should not be included. As a result, it is possible to prevent the region where the color is corrected from coming into contact with the region where the color is not modified. As a result, the noticeable color difference between the color-corrected area and the color-uncorrected area is suppressed.

[適用例2]適用例1に記載のコンピュータプログラムであって、前記候補領域の前記色を修正すべきではないと前記第1判断機能によって判断されるための条件は、前記候補領域に接する前記辺からの前記候補領域の長さが第1閾値以上であることを含む、コンピュータプログラム。 [Application Example 2] In the computer program according to the application example 1, the condition for the first determination function to determine that the color of the candidate area should not be corrected is the condition in which the candidate area is in contact with the candidate area. A computer program including that the length of the candidate region from the side is equal to or greater than the first threshold.

仮に、大きな候補領域の色が修正される場合、色が修正される領域が大きいので、色が修正された領域が不自然に見える可能性がある。上記構成によれば、大きな候補領域に関しては、色を修正すべきではないと判断されるので、色が修正された領域が不自然に見えることを抑制できる。 If the color of a large candidate area is corrected, the area where the color is corrected is large, so that the area where the color is corrected may look unnatural. According to the above configuration, it is determined that the color should not be corrected for the large candidate area, so that it is possible to suppress that the color-corrected area looks unnatural.

[適用例3]適用例1または2に記載のコンピュータプログラムであって、ユーザの指示に応じて、前記出力画像内における前記1以上の部分余白領域のそれぞれの幅を決定する決定機能を、前記コンピュータに実現させ、前記部分余白領域の色を修正すべきではないと前記第2判断機能によって判断されるための条件は、前記ユーザの指示に応じて決定した前記部分余白領域の前記幅が第2閾値以上であることを含む、コンピュータプログラム。 [Application Example 3] The computer program according to Application Example 1 or 2, wherein the determination function of determining the width of each of the one or more partial margin areas in the output image is performed according to a user's instruction. The condition for the second determination function to determine that the color of the partial margin area should not be corrected by a computer is that the width of the partial margin area determined according to the user's instruction is the first. A computer program that includes being greater than or equal to two thresholds.

仮に、大きな部分余白領域の色が修正される場合、色が修正される領域が大きいので、色が修正された領域が不自然に見える可能性がある。上記構成によれば、大きな部分余白領域に関しては、色を修正すべきではないと判断されるので、色が修正された領域が不自然に見えることを抑制できる。 If the color of the large partial margin area is corrected, the color-corrected area may look unnatural because the color-corrected area is large. According to the above configuration, it is determined that the color should not be corrected for the large partial margin area, so that it is possible to prevent the color-corrected area from appearing unnatural.

[適用例4]適用例1から3のいずれかに記載のコンピュータプログラムであって、前記第2判断機能は、(A)前記注目部分余白領域が、前記部分余白領域の色を修正すべきではないと仮に判断するための非対象仮条件を満たすか否かを判断し、(B)前記注目部分余白領域が、前記非対象仮条件を満たさない場合には、前記注目部分余白領域に接する候補領域であるゼロ個以上の隣接候補領域が、前記候補領域の色を修正すべきではないと判断される候補領域である非対象候補領域を含むか否かを判断し、前記隣接候補領域が前記非対象候補領域を含む場合に、前記注目部分余白領域の色を修正すべきではないと判断し、(C)前記注目部分余白領域が、前記非対象仮条件を満たす場合には、前記隣接候補領域が前記非対象候補領域を含むか否かを判断せずに、前記注目部分余白領域の色を修正すべきではないと判断する、コンピュータプログラム。 [Application Example 4] In the computer program according to any one of Application Examples 1 to 3, in the second determination function, (A) the attention portion margin area should correct the color of the partial margin region. It is determined whether or not the non-target tentative condition for tentatively determining that the color is not satisfied, and (B) if the attention portion margin area does not satisfy the non-target tentative condition, a candidate in contact with the attention portion margin area. It is determined whether or not zero or more adjacent candidate regions, which are regions, include a non-target candidate region, which is a candidate region for which it is determined that the color of the candidate region should not be corrected, and the adjacent candidate region is said to be said. When it is determined that the color of the attention portion margin area should not be corrected when the non-target candidate region is included, (C) the adjacent candidate when the attention portion margin area satisfies the non-target provisional condition. A computer program that determines that the color of the area of interest should not be modified without determining whether the area includes the non-target candidate area.

この構成によれば、注目部分余白領域が非対象仮条件を満たさない場合、すなわち、注目部分余白領域の色を修正すべきと判断され得る場合であっても、隣接候補領域が非対象候補領域を含む場合には、注目部分余白領域の色を修正すべきではないと判断されるので、色が修正された余白に色が修正されない候補領域が隣接することが抑制される。この結果、色が修正されない候補領域が目立つことが、抑制される。また、注目部分余白領域が非対象仮条件を満たす場合には、隣接候補領域が非対象候補領域を含むか否かが判断されずに、注目部分余白領域の色を判断すべきではないと判断されるので、処理速度の低下を抑制しつつ、適切な判断が可能である。 According to this configuration, even if the attention portion margin area does not satisfy the non-target provisional condition, that is, even if it can be determined that the color of the attention portion margin area should be corrected, the adjacent candidate area is the non-target candidate area. In the case of including, since it is determined that the color of the margin area of interest should not be corrected, it is suppressed that the candidate area where the color is not corrected is adjacent to the margin where the color is corrected. As a result, it is suppressed that the candidate area where the color is not corrected is conspicuous. In addition, when the attention area margin area satisfies the non-target provisional condition, it is determined that the color of the attention area margin area should not be determined without determining whether or not the adjacent candidate area includes the non-target candidate area. Therefore, it is possible to make an appropriate judgment while suppressing a decrease in processing speed.

[適用例5]適用例1から4のいずれかに記載のコンピュータプログラムであって、前記第2判断機能は、前記1以上の部分余白領域のそれぞれの色を修正すべきか否かを、他の部分余白領域とは独立に、仮に判断し、前記注目部分余白領域の色を修正すべきと仮に判断した場合には、前記注目部分余白領域に接するとともに基準幅より大きい幅の隣の部分余白領域と、前記隣の部分余白領域に接するとともに前記注目部分余白領域の向かい側に位置する前記基準幅より大きい幅の対向部分余白領域と、の少なくとも一方が、色を修正すべきではないと仮に判断されたか否かを判断し、前記隣の部分余白領域と前記対向部分余白領域との少なくとも一方が、色を修正すべきでないと仮に判断された場合に、前記注目部分余白領域の色を修正すべきではないと判断する、コンピュータプログラム。 [Application Example 5] In the computer program according to any one of Application Examples 1 to 4, the second determination function determines whether or not each color of the partial margin area of 1 or more should be corrected. If it is tentatively determined independently of the partial margin area and it is determined that the color of the attention partial margin area should be corrected, the partial margin area adjacent to the attention portion margin area and the width larger than the reference width is in contact with the attention portion margin area. It is tentatively determined that at least one of the opposed portion margin region having a width larger than the reference width, which is in contact with the adjacent partial margin region and is located opposite to the attention portion margin region, should not be corrected in color. If it is determined whether or not the color should be corrected for at least one of the adjacent partial margin area and the opposite partial margin area, the color of the attention partial margin area should be corrected. A computer program that determines that it is not.

この構成によれば、部分余白領域の色を修正すべきと判断され得る場合であっても、注目部分余白領域に接する他の部分余白領域の色を修正すべきではないと判断される場合に、注目部分余白領域の色を修正すべきでは無いと判断されるので、色が修正される部分余白領域と色が修正されない部分余白領域とが接することが抑制される。この結果、色が修正される部分余白領域と色が修正されない部分余白領域とが接することに起因して色の違いが目立つことが、抑制される。 According to this configuration, even if it can be determined that the color of the partial margin area should be corrected, when it is determined that the color of the other partial margin area in contact with the partial margin area of interest should not be corrected. Since it is determined that the color of the attention portion margin region should not be corrected, the contact between the partial margin region where the color is corrected and the partial margin region where the color is not corrected is suppressed. As a result, it is suppressed that the color difference is conspicuous due to the contact between the partial margin area where the color is corrected and the partial margin area where the color is not corrected.

[適用例6]適用例1から5のいずれかに記載のコンピュータプログラムであって、前記候補領域特定機能は、前記読取画像のうちの前記余白領域を用いずに前記矩形原稿領域を用いて、前記候補領域を特定する、コンピュータプログラム。 [Application Example 6] In the computer program according to any one of Application Examples 1 to 5, the candidate area specifying function uses the rectangular original area without using the margin area of the scanned image. A computer program that identifies the candidate area.

この構成によれば、処理速度の低下を抑制しつつ、適切な判断が可能である。 According to this configuration, it is possible to make an appropriate judgment while suppressing a decrease in processing speed.

なお、本明細書に開示の技術は、種々の態様で実現することが可能であり、例えば、画像処理方法および画像処理装置、それらの方法または装置の機能を実現するためのコンピュータプログラム、そのコンピュータプログラムを記録した記録媒体(例えば、一時的ではない記録媒体)、等の形態で実現することができる。 The techniques disclosed in the present specification can be realized in various aspects, for example, an image processing method and an image processing device, a computer program for realizing the functions of those methods or devices, and a computer thereof. It can be realized in the form of a recording medium on which the program is recorded (for example, a recording medium that is not temporary).

一実施例としての画像処理システムの構成を示す図である。It is a figure which shows the structure of the image processing system as one Example. 画像処理の例を示すフローチャートである。It is a flowchart which shows the example of image processing. 画像処理で用いられる画像の一例を示す図である。It is a figure which shows an example of the image used in image processing. 候補領域の判断の処理の例を示すフローチャートである。It is a flowchart which shows the example of the process of the determination of a candidate area. 補修処理の例を示すフローチャートである。It is a flowchart which shows the example of the repair process. 部分余白領域の仮の判断の処理の例を示すフローチャートである。It is a flowchart which shows the example of the process of the provisional determination of a partial margin area. 部分余白領域の最終的な判断の処理の例を示すフローチャートである。It is a flowchart which shows the example of the processing of the final determination of a partial margin area. 別の画像の処理例を示す説明図である。It is explanatory drawing which shows the processing example of another image. 別の画像の処理例を示す説明図である。It is explanatory drawing which shows the processing example of another image.

A.第1実施例:
A−1.画像処理システムの構成
図1は、一実施例としての画像処理システムの構成を示す図である。この画像処理システムは、画像処理装置800と、スキャナ900と、を含んでいる。画像処理装置800とスキャナ900とは、ネットワークNTに接続されており、互いに通信可能である。
A. First Example:
A-1. Configuration of Image Processing System FIG. 1 is a diagram showing a configuration of an image processing system as an embodiment. This image processing system includes an image processing device 800 and a scanner 900. The image processing device 800 and the scanner 900 are connected to the network NT and can communicate with each other.

画像処理装置800は、例えば、パーソナルコンピュータである(例えば、デスクトップコンピュータ、タブレットコンピュータ)。画像処理装置800は、画像処理装置800のコントローラとしてのCPU810と、記憶装置815と、画像を表示する表示部840と、ユーザによる操作を受け入れる操作部850と、インタフェース890と、を有している。記憶装置815は、揮発性記憶装置820と、不揮発性記憶装置830と、を含んでいる。これらの要素は、バスを介して互いに接続されている。 The image processing device 800 is, for example, a personal computer (for example, a desktop computer or a tablet computer). The image processing device 800 includes a CPU 810 as a controller of the image processing device 800, a storage device 815, a display unit 840 for displaying an image, an operation unit 850 for accepting an operation by a user, and an interface 890. .. The storage device 815 includes a volatile storage device 820 and a non-volatile storage device 830. These elements are connected to each other via a bus.

CPU810は、データ処理を行う演算装置(プロセッサ)である。揮発性記憶装置820は、例えば、DRAMであり、不揮発性記憶装置830は、例えば、フラッシュメモリである。不揮発性記憶装置830は、プログラム832を格納している。CPU810は、プログラム832を実行することによって、スキャナ900に原稿を読み取らせて、読み取った原稿を示す出力画像データを生成する処理を実行する(詳細は後述)。プログラム832は、例えば、スキャナ900を制御するためのスキャナドライバであってよい。CPU810は、プログラム832の実行に利用される種々の中間データを、記憶装置815(例えば、揮発性記憶装置820、不揮発性記憶装置830のいずれか)に、一時的に格納する。プログラム832は、例えば、スキャナ900の製造者によって提供される。 The CPU 810 is an arithmetic unit (processor) that processes data. The volatile storage device 820 is, for example, a DRAM, and the non-volatile storage device 830 is, for example, a flash memory. The non-volatile storage device 830 stores the program 832. By executing the program 832, the CPU 810 causes the scanner 900 to read the document and executes a process of generating output image data indicating the scanned document (details will be described later). Program 832 may be, for example, a scanner driver for controlling the scanner 900. The CPU 810 temporarily stores various intermediate data used for executing the program 832 in the storage device 815 (for example, either the volatile storage device 820 or the non-volatile storage device 830). Program 832 is provided, for example, by the manufacturer of Scanner 900.

表示部840は、画像を表示する装置であり、例えば、液晶ディスプレイである。これに代えて、LEDディスプレイ、有機ELディスプレイなどの、画像を表示する他の種類の装置を採用してもよい。操作部850は、ユーザによる操作を受け取る装置であり、例えば、表示部840上に重ねて配置されたタッチパネルである。これに代えて、ボタン、レバーなどの、ユーザによって操作される他の種類の装置を採用してもよい。ユーザは、操作部850を操作することによって、種々の指示を画像処理装置800に入力可能である。 The display unit 840 is a device for displaying an image, for example, a liquid crystal display. Instead of this, other types of devices that display images, such as LED displays and organic EL displays, may be employed. The operation unit 850 is a device that receives an operation by the user, and is, for example, a touch panel that is superposed on the display unit 840. Alternatively, other types of devices operated by the user, such as buttons and levers, may be employed. The user can input various instructions to the image processing device 800 by operating the operation unit 850.

インタフェース890は、他の装置と通信するためのインタフェースである(例えば、USBインタフェース、有線LANインタフェース、IEEE802.11の無線インタフェース)。本実施例では、インタフェース890は、有線または無線のネットワークインタフェースであり、ネットワークNTに接続されている。 Interface 890 is an interface for communicating with other devices (eg, USB interface, wired LAN interface, IEEE 802.11 wireless interface). In this embodiment, the interface 890 is a wired or wireless network interface and is connected to the network NT.

図1には、スキャナ900の斜視図が示されている。図中の第1方向Dp1と第2方向Dp2とは、水平な方向を示し、第3方向Dp3は、鉛直上方向を示している。第1方向Dp1と第2方向Dp2とは、互いに垂直である。また、第3方向Dp3を、上方向Dp3とも呼ぶ。 FIG. 1 shows a perspective view of the scanner 900. In the figure, the first direction Dp1 and the second direction Dp2 indicate a horizontal direction, and the third direction Dp3 indicates a vertically upward direction. The first direction Dp1 and the second direction Dp2 are perpendicular to each other. Further, the third direction Dp3 is also referred to as an upward Dp3.

スキャナ900は、いわゆるフラットベッド式の画像読取装置である。スキャナ900は、本体部990と、本体部990の上方向Dp3側に開閉可能に取り付けられたカバー950と、を備えている。図1には、カバー950が上方向Dp3に向けて開けられた状態のスキャナ900を示している。 The scanner 900 is a so-called flatbed type image reading device. The scanner 900 includes a main body 990 and a cover 950 attached to the upper Dp3 side of the main body 990 so as to be openable and closable. FIG. 1 shows a scanner 900 with a cover 950 opened toward Dp3 in the upward direction.

本体部990は、制御部910と、原稿を光学的に読み取るイメージセンサ920と、イメージセンサ920を第1方向Dp1に平行に移動させる移動装置930と、原稿台940と、を備えている。 The main body 990 includes a control unit 910, an image sensor 920 that optically reads a document, a moving device 930 that moves the image sensor 920 in parallel with the first direction Dp1, and a document stand 940.

原稿台940は、本体部990(図1)の上方向Dp3側に、設けられている。原稿台940は、カバー950を上方向Dp3に向けて開くことによって、現れる。原稿台940は、第1方向Dp1に平行な2辺と第2方向Dp2に平行な2辺とで囲まれる略矩形状の台であり、透明板(例えば、ガラス板)を用いて構成されている。原稿台940の第3方向Dp3側の面は、読取対象の原稿が載置される載置面Usである。 The platen 940 is provided on the upward Dp3 side of the main body 990 (FIG. 1). The platen 940 appears by opening the cover 950 upward Dp3. The document table 940 is a substantially rectangular table surrounded by two sides parallel to the first direction Dp1 and two sides parallel to the second direction Dp2, and is configured by using a transparent plate (for example, a glass plate). There is. The surface of the platen 940 on the third direction Dp3 side is the mounting surface Us on which the document to be read is placed.

イメージセンサ920は、原稿台940の下側(第3方向Dp3の反対側)、すなわち、原稿台940の下に配置されている。イメージセンサ920は、原稿を光学的に読み取る一次元イメージセンサであり、CCDやCMOSなどの複数の光電変換素子(単に、光学素子とも呼ぶ)が、第2方向Dp2に並んで配置された構成を有している。イメージセンサ920は、原稿台940上の原稿を、光学的に読み取ることによって、読み取った原稿を示す信号を出力する。 The image sensor 920 is arranged below the platen 940 (opposite the third direction Dp3), that is, below the platen 940. The image sensor 920 is a one-dimensional image sensor that optically reads a document, and has a configuration in which a plurality of photoelectric conversion elements (simply also referred to as optical elements) such as a CCD or CMOS are arranged side by side in the second direction Dp2. Have. The image sensor 920 optically reads the document on the platen 940 to output a signal indicating the scanned document.

移動装置930は、動力源(例えば、電気モータ)を含んでいる。移動装置930は、該動力源を用いて、イメージセンサ920を、原稿台940の載置面Usに沿う方向(図1の第1方向Dp1と平行な方向)に移動させる。 The mobile device 930 includes a power source (eg, an electric motor). The moving device 930 uses the power source to move the image sensor 920 in a direction along the mounting surface Us of the platen 940 (a direction parallel to the first direction Dp1 in FIG. 1).

制御部910は、例えば、データ処理を行うCPU911と、記憶装置915と、インタフェース919と、を含むコンピュータである。記憶装置915は、揮発性記憶装置912(例えば、DRAM)と、不揮発性記憶装置913(例えば、フラッシュメモリ)と、を含んでいる。制御部910の各要素は、バスを介して互いに接続されている。不揮発性記憶装置913は、予め、プログラム914を格納している。CPU911は、プログラム914を実行することによって、イメージセンサ920と移動装置930とを制御する。インタフェース919は、他の装置と通信するためのインタフェースである(例えば、USBインタフェース、有線LANインタフェース、IEEE802.11の無線インタフェース)。本実施例では、インタフェース919は、有線または無線のネットワークインタフェースであり、ネットワークNTに接続されている。 The control unit 910 is, for example, a computer including a CPU 911 that performs data processing, a storage device 915, and an interface 919. The storage device 915 includes a volatile storage device 912 (for example, DRAM) and a non-volatile storage device 913 (for example, flash memory). Each element of the control unit 910 is connected to each other via a bus. The non-volatile storage device 913 stores the program 914 in advance. The CPU 911 controls the image sensor 920 and the mobile device 930 by executing the program 914. Interface 919 is an interface for communicating with other devices (eg, USB interface, wired LAN interface, IEEE 802.11 wireless interface). In this embodiment, the interface 919 is a wired or wireless network interface and is connected to the network NT.

CPU911は、移動装置930を制御して、イメージセンサ920を、原稿台940の第1方向Dp1とは反対方向側の端の位置から第1方向Dp1側の端の位置まで、原稿台940に沿って移動させる。CPU911は、イメージセンサ920を移動させながら、イメージセンサ920を制御して、原稿台940に載置された原稿を光学的に読み取らせる。CPU911は、イメージセンサ920から出力される信号に基づいて、読取画像を示す読取画像データを生成する。CPU911は、生成した読取画像データを、画像処理装置800へ送信する。 The CPU 911 controls the moving device 930 to move the image sensor 920 along the platen 940 from the position of the end of the platen 940 opposite to the first direction Dp1 to the position of the end of the platen 940 on the first direction Dp1 side. To move. The CPU 911 controls the image sensor 920 while moving the image sensor 920 to optically read the document placed on the platen 940. The CPU 911 generates scanned image data indicating the scanned image based on the signal output from the image sensor 920. The CPU 911 transmits the generated scanned image data to the image processing device 800.

A−2.画像処理:
図2は、画像処理の例を示すフローチャートである。本実施例では、画像処理装置800のCPU810は、スキャナドライバとして、画像処理を実行する。この画像処理では、スキャナ900に原稿を読み取らせることによって読取画像データが取得され、取得された読取画像データを用いて、欠落の補修などがなされた出力画像を示す出力画像データが生成される。後述するように、出力画像は、原稿と、原稿の外側に配置された余白と、を含んでいる。
A-2. Image processing:
FIG. 2 is a flowchart showing an example of image processing. In this embodiment, the CPU 810 of the image processing apparatus 800 executes image processing as a scanner driver. In this image processing, scanned image data is acquired by causing the scanner 900 to scan the original, and the acquired scanned image data is used to generate output image data indicating an output image in which a defect has been repaired. As will be described later, the output image includes a document and a margin arranged outside the document.

S100では、ユーザは、操作部850を操作することによって、画像処理の開始指示を入力する。また、本実施例では、ユーザは、余白の幅を入力する。ユーザは、矩形状の原稿の四方のそれぞれに設けられるべき余白の幅を、指定することができる。なお、余白の幅は、予め準備された複数の設定から、ユーザによって、選択されてよい。これに代えて、ユーザが、余白の幅を示す数値(例えば、ミリメートル単位の数値)を、入力してもよい。CPU810は、入力された指示に応じて、余白の幅を、入力された値に、決定する。そして、CPU810は、開始指示に応じて、画像処理を開始する。 In S100, the user inputs an instruction to start image processing by operating the operation unit 850. Further, in this embodiment, the user inputs the width of the margin. The user can specify the width of the margins to be provided on each of the four sides of the rectangular document. The width of the margin may be selected by the user from a plurality of settings prepared in advance. Alternatively, the user may enter a numerical value indicating the width of the margin (for example, a numerical value in millimeters). The CPU 810 determines the width of the margin to the input value in response to the input instruction. Then, the CPU 810 starts image processing in response to the start instruction.

S105では、CPU810は、読取画像データを取得する。具体的には、CPU810は、原稿を読み取る指示を、スキャナ900に送信する。スキャナ900の制御部910のCPU911は、画像処理装置800からの指示に応じて、原稿台940に載置された原稿を読み取ることによって、読取画像データを生成し、生成した読取画像データを、画像処理装置800に送信する。CPU810は、スキャナ900から送信される読取画像データを取得する。読取画像データのデータ形式は、種々の形式であってよい。本実施例では、読取画像データは、複数個の画素のRGB値を含むRGB画像データ、あるいは、複数個の画素の輝度値を含むモノクロ画像データである。1個の画素のRGB値は、その画素の色を示し、例えば、赤(R)と緑(G)と青(B)との3個の成分値(以下、R値、G値、B値とも呼ぶ)を含んでいる。本実施例では、各成分値の階調数は、256階調である。輝度値は、その画素の輝度を、例えば、256階調の値で示す値である。なお、読取画像データのデータ形式は、ユーザの指示に応じて、選択される。 In S105, the CPU 810 acquires the read image data. Specifically, the CPU 810 transmits an instruction to read the document to the scanner 900. The CPU 911 of the control unit 910 of the scanner 900 generates scanned image data by reading the document placed on the platen 940 in response to an instruction from the image processing device 800, and obtains the generated scanned image data as an image. It is transmitted to the processing device 800. The CPU 810 acquires the scanned image data transmitted from the scanner 900. The data format of the scanned image data may be various formats. In this embodiment, the scanned image data is RGB image data including RGB values of a plurality of pixels, or monochrome image data including brightness values of a plurality of pixels. The RGB value of one pixel indicates the color of that pixel, and for example, the three component values of red (R), green (G), and blue (B) (hereinafter, R value, G value, and B value). Also called). In this embodiment, the number of gradations of each component value is 256 gradations. The luminance value is a value indicating the luminance of the pixel, for example, as a value of 256 gradations. The data format of the scanned image data is selected according to the user's instruction.

図3は、画像処理で用いられる画像の一例を示す図である。図3(A)には、読取画像の一例が示されている。読取画像110の形状は、第1方向D1に平行な直線と、第2方向D2に平行な直線と、で囲まれる矩形状である。読取画像110を示す複数の画素は、これらの方向D1、D2に沿って格子状に配置されている。 FIG. 3 is a diagram showing an example of an image used in image processing. FIG. 3A shows an example of the scanned image. The shape of the scanned image 110 is a rectangular shape surrounded by a straight line parallel to the first direction D1 and a straight line parallel to the second direction D2. The plurality of pixels showing the scanned image 110 are arranged in a grid pattern along these directions D1 and D2.

読取画像110は、矩形の原稿を読み取ることによって生成された画像である。読取画像110は、原稿を示す原稿画像21と、原稿画像21の外側の画像である外側画像31と、を含む。外側画像31は、原稿画像21の外側の原稿以外の領域を示す。外側画像31は、原稿画像21の外側の画像、すなわち、原稿画像21の外縁と、読取画像110の外縁(4辺)と、の間に位置する画像である。外側画像31は、本実施例では、カバー950(図1)の原稿台940と対向する対向面Bsを示している。本実施例では、対向面Bsは、白よりも暗く、黒よりも明るいグレーで塗られている。このため、外側画像31は、グレーのほぼ単色の画像である。 The scanned image 110 is an image generated by scanning a rectangular original. The scanned image 110 includes a manuscript image 21 showing a manuscript and an outer image 31 which is an image outside the manuscript image 21. The outer image 31 shows a region other than the original document outside the original image 21. The outer image 31 is an image located between the outer image of the original image 21, that is, the outer edge of the original image 21 and the outer edges (four sides) of the scanned image 110. The outer image 31 shows the facing surface Bs of the cover 950 (FIG. 1) facing the platen 940 in this embodiment. In this embodiment, the facing surfaces Bs are painted in gray, which is darker than white and lighter than black. Therefore, the outer image 31 is a gray, substantially monochromatic image.

原稿画像21の形状は、破れ211を含む不完全な略矩形である。破れ211は、原稿画像21の外縁から内部に向かって延びる欠落部分である。また、原稿画像21は、文字などのオブジェクトObと、背景Bgと、を含んでいる。背景Bgは、原稿の地色の領域である。 The shape of the original image 21 is an incomplete substantially rectangular shape including the tear 211. The tear 211 is a missing portion extending inward from the outer edge of the original image 21. Further, the manuscript image 21 includes an object Ob such as characters and a background Bg. The background Bg is a region of the ground color of the document.

S110(図2)では、CPU810は、読取画像内の原稿を示す矩形領域の4つの辺を特定する。図3(B)は、読取画像110から特定される4つの辺411〜414の例を示す説明図である。図中には、図3(A)と同じ読取画像110が示されている。辺411〜414は、原稿画像21の外縁を示す矩形を形成する。以下、辺411〜414で囲まれる矩形領域を、矩形原稿領域210と呼ぶ。矩形原稿領域210の矩形状の輪郭410は、4個の辺411〜414で構成されている。また、読取画像110のうちの矩形原稿領域210の外側の領域310を、余白領域310と呼ぶ。余白領域310は、原稿画像21の外側の余白を示している。破れ211は、矩形原稿領域210内に、含まれている。 In S110 (FIG. 2), the CPU 810 identifies four sides of a rectangular region indicating the original in the scanned image. FIG. 3B is an explanatory diagram showing an example of four sides 411 to 414 identified from the scanned image 110. In the figure, the same scanned image 110 as in FIG. 3A is shown. The sides 411 to 414 form a rectangle indicating the outer edge of the original image 21. Hereinafter, the rectangular area surrounded by the sides 411 to 414 is referred to as a rectangular document area 210. The rectangular contour 410 of the rectangular document area 210 is composed of four sides 411 to 414. Further, the area 310 outside the rectangular document area 210 in the scanned image 110 is referred to as a margin area 310. The margin area 310 indicates the outer margin of the original image 21. The tear 211 is included in the rectangular document area 210.

矩形原稿領域210の4つの辺411〜414を特定する方法としては、種々の方法を採用可能である。例えば、CPU810は、以下の処理を実行する。CPU810は、読取画像データに対して、縮小処理を実行して、縮小された読取画像である縮小画像を示す縮小画像データを生成する。縮小処理は、画素密度を低減する処理であり、公知の種々の処理であってよい。例えば、一部の画素を間引く処理が採用されてよい。また、読取画像上に低画素密度で配置された複数の画素のそれぞれの色値を、読取画像の複数の画素の色値を用いる補間によって算出する処理が、採用されてよい。 Various methods can be adopted as a method for specifying the four sides 411 to 414 of the rectangular document area 210. For example, the CPU 810 executes the following processing. The CPU 810 executes a reduction process on the scanned image data to generate reduced image data indicating the reduced image which is the reduced scanned image. The reduction process is a process for reducing the pixel density, and may be various known processes. For example, a process of thinning out some pixels may be adopted. Further, a process of calculating the color value of each of a plurality of pixels arranged at a low pixel density on the scanned image by interpolation using the color values of the plurality of pixels of the scanned image may be adopted.

CPU810は、縮小画像内のエッジ画素を抽出するエッジ抽出処理を実行する。エッジ抽出処理は、画像内のエッジを示すエッジ画素を抽出する処理であり、公知の種々の処理であってよい。例えば、各画素のエッジ強度が算出され、エッジ強度が閾値以上である画素がエッジ画素として抽出されてよい。エッジ強度の算出には、ソーベルオペレータやプレウィットオペレータなどの種々のエッジ検出用のオペレータを利用可能である。図3(B)の例では、原稿画像21の外縁(すなわち、輪郭)を示す複数の画素に加えて、オブジェクトObの外縁を示す複数の画素などの、種々の画素が、エッジ画素として、抽出され得る。 The CPU 810 executes an edge extraction process for extracting edge pixels in the reduced image. The edge extraction process is a process for extracting edge pixels indicating edges in an image, and may be various known processes. For example, the edge strength of each pixel is calculated, and pixels having an edge strength equal to or higher than a threshold value may be extracted as edge pixels. Various edge detection operators such as a sobel operator and a prewit operator can be used to calculate the edge strength. In the example of FIG. 3B, in addition to the plurality of pixels indicating the outer edge (that is, the contour) of the original image 21, various pixels such as the plurality of pixels indicating the outer edge of the object Ob are extracted as edge pixels. Can be done.

CPU810は、抽出された複数のエッジ画素を用いるハフ変換を実行し、原稿画像21の外縁を示す直線の候補を特定する。ハフ変換は、公知の処理であるので、その説明を省略する。直線の候補としては、原稿画像21の外縁を示す直線に加えて、破れ211の縁を示す直線や、オブジェクトObの外縁を示す直線などの、種々の直線が、特定される。
CPU810は、特定された候補直線から、矩形状を形成する4本の候補直線を、原稿画像21の外縁を示す直線である縁直線として、選択する。複数の候補直線から原稿画像21の外縁を示す4本の縁直線を選択する方法は、種々の方法であってよい。例えば、矩形状を形成する4本の候補直線が、4本の縁直線として、選択される。選択される4本の候補直線は、矩形状の4つの辺に、それぞれ対応する。4本の候補直線の複数の組み合わせが矩形状を形成する場合には、最も大きい矩形状を形成する4本の候補直線が、選択されてよい。
The CPU 810 executes a Hough transform using the extracted plurality of edge pixels, and identifies a candidate for a straight line indicating the outer edge of the original image 21. Since the Hough transform is a known process, its description will be omitted. As candidates for the straight line, in addition to the straight line indicating the outer edge of the original image 21, various straight lines such as a straight line indicating the edge of the tear 211 and a straight line indicating the outer edge of the object Ob are specified.
The CPU 810 selects four candidate straight lines forming a rectangular shape from the specified candidate straight lines as edge straight lines that are straight lines indicating the outer edge of the original image 21. Various methods may be used for selecting four edge straight lines indicating the outer edges of the original image 21 from the plurality of candidate straight lines. For example, four candidate straight lines forming a rectangular shape are selected as the four edge straight lines. The four candidate straight lines selected correspond to the four sides of the rectangle, respectively. When a plurality of combinations of the four candidate straight lines form a rectangular shape, the four candidate straight lines forming the largest rectangular shape may be selected.

選択された4本の縁直線は、縮小画像上の原稿画像21の輪郭を示している。CPU810は、読取画像110内において、縮小画像内の4本の縁直線に対応する4本の直線を(すなわち、読取画像110内において、縮小画像内の4本の縁直線と同じ位置に位置する4本の直線を)、特定する。これにより、矩形原稿領域の4つの辺(例えば、図3(B)の4つの辺411〜414)が、特定される。以上のように、CPU810は、読取画像110内の原稿を含む部分を矩形状の領域に区切って得られる矩形原稿領域210の4つの辺411〜414を特定する。本実施例では、矩形原稿領域210は、原稿を含む最小の矩形領域である。 The four edge lines selected indicate the outline of the original image 21 on the reduced image. The CPU 810 positions the four straight lines corresponding to the four edge straight lines in the reduced image in the scanned image 110 (that is, in the scanned image 110 at the same positions as the four edge straight lines in the reduced image). ), Identify the four straight lines. As a result, the four sides of the rectangular document area (for example, the four sides 411 to 414 of FIG. 3B) are specified. As described above, the CPU 810 specifies the four sides 411 to 414 of the rectangular document area 210 obtained by dividing the portion including the document in the scanned image 110 into a rectangular area. In this embodiment, the rectangular document area 210 is the smallest rectangular area including the document.

なお、縁直線の特定は、縮小画像を用いずに、読取画像を用いて行われてもよい。ただし、縮小画像を用いる場合には、縁直線の特定に利用される画素数が少ないので、処理の負担を軽減できる。 The edge straight line may be specified by using a scanned image instead of using a reduced image. However, when a reduced image is used, the number of pixels used to identify the edge straight line is small, so that the processing load can be reduced.

S120(図2)では、CPU810は、矩形原稿領域内の領域であって原稿ではない領域の候補である候補領域を特定する。図3(B)の例では、破れ211を示す領域213が、矩形原稿領域210内の領域であって原稿ではない領域である。このような候補領域を特定する方法は、種々の方法であってよい。本実施例では、CPU810は、矩形原稿領域を二値化することによって、候補領域を特定する。具体的には、CPU810は、上記の縮小画像内の矩形原稿領域に対応する領域の複数の画素を、特定輝度範囲内の輝度を有する第1種画素と、特定輝度範囲外の輝度を有する第2種画素と、に分ける二値化処理を実行する。特定輝度範囲は、予め決められた輝度の範囲であり、カバー950(図1)の対向面Bsの色の輝度を含む範囲である。第1種画素は、カバー950の対向面Bsの色に類似する色を示している。 In S120 (FIG. 2), the CPU 810 identifies a candidate area that is a candidate area within the rectangular document area and not the document. In the example of FIG. 3B, the area 213 showing the tear 211 is an area within the rectangular document area 210, not a document. Various methods may be used to identify such a candidate region. In this embodiment, the CPU 810 specifies a candidate area by binarizing the rectangular document area. Specifically, the CPU 810 has a plurality of pixels in a region corresponding to a rectangular original region in the reduced image, a first-class pixel having a brightness within a specific luminance range, and a first-class pixel having a luminance outside the specific luminance range. The binarization process of dividing into two types of pixels is executed. The specific luminance range is a predetermined luminance range, and is a range including the luminance of the color of the facing surface Bs of the cover 950 (FIG. 1). The first-class pixels show a color similar to the color of the facing surface Bs of the cover 950.

CPU810は、縮小画像内の第1種画素が連続する領域のうち、縁直線に接触する領域を、候補領域として選択する。原稿内のオブジェクトがカバー950の対向面Bsの色に類似する色の部分を含む場合がある。この場合、オブジェクトのその部分も、第1種画素によって示される。通常は、原稿内のオブジェクトは、原稿の外縁よりも内側に配置されている。従って、第1種画素が連続する領域のうち縁直線に接触する領域は、破れ211の領域213のように、原稿のうちの欠落した部分を示す可能性が高い。 The CPU 810 selects, as a candidate region, a region in contact with the edge straight line among the regions in the reduced image in which the first-class pixels are continuous. Objects in the manuscript may include a portion of color similar to the color of the facing surface Bs of the cover 950. In this case, that part of the object is also indicated by the first-class pixels. Normally, the objects in the manuscript are located inside the outer edge of the manuscript. Therefore, the region in which the first-class pixels are continuous and in contact with the edge straight line is likely to indicate a missing portion of the document, such as region 213 of the tear 211.

特定された候補領域は、縮小画像上の領域である。CPU810は、読取画像110内において、縮小画像内の候補領域に対応する領域を(すなわち、読取画像110内において、縮小画像内の候補領域と同じ位置に位置する領域を)、特定する。これにより、矩形原稿領域内の候補領域が、特定される。 The identified candidate area is an area on the reduced image. The CPU 810 specifies an area in the scanned image 110 corresponding to the candidate area in the reduced image (that is, an area in the scanned image 110 located at the same position as the candidate area in the reduced image). As a result, the candidate area in the rectangular document area is specified.

図3(C)には、矩形原稿領域210が示されている。図中では、特定された候補領域が、ハッチングで示されている。図示するように、破れ211を示す領域213が、候補領域として特定されている。なお、原稿には、複数の破れが形成され得る。従って、複数の破れに対応する複数の候補領域が、特定され得る。また、原稿に破れが形成されていない場合、特定される候補領域の総数は、ゼロであり得る。 FIG. 3C shows a rectangular document area 210. In the figure, the identified candidate regions are indicated by hatching. As shown, the region 213 showing the tear 211 is specified as a candidate region. It should be noted that a plurality of tears may be formed in the manuscript. Therefore, a plurality of candidate regions corresponding to a plurality of breaks can be identified. Also, if no tears are formed in the manuscript, the total number of candidate regions identified can be zero.

なお、候補領域の特定は、縮小画像を用いずに、読取画像を用いて行われてもよい。ただし、縮小画像を用いる場合には、候補領域の特定に利用される画素数が少ないので、処理の負担を軽減できる。 The candidate region may be specified by using a scanned image instead of using a reduced image. However, when a reduced image is used, the number of pixels used to identify the candidate area is small, so that the processing load can be reduced.

S130(図2)では、CPU810は、候補領域が補修の対象であるか否かを判断する。CPU810は、候補領域に接する辺(具体的には、矩形原稿領域の辺)からの候補領域の長さが第1閾値以上である場合に、候補領域が補修の対象ではないと判断する。 In S130 (FIG. 2), the CPU 810 determines whether or not the candidate area is the target of repair. The CPU 810 determines that the candidate area is not the target of repair when the length of the candidate area from the side in contact with the candidate area (specifically, the side of the rectangular original area) is equal to or greater than the first threshold value.

図4は、候補領域の判断の処理の例を示すフローチャートである。S200では、CPU810は、S120(図2)で特定された候補領域のうち、図4の処理において未処理の1つの候補領域を、判断対象の候補領域として選択する(注目候補領域と呼ぶ)。S210では、CPU810は、注目候補領域の長さ(具体的には、注目候補領域に接する辺からの、その辺に垂直な方向の長さ)が、第1閾値Th1以上であるか否かを判断する。本実施例では、第1閾値Th1は、予め決められており、ゼロよりも大きい。図3(D)には、読取画像110の処理例が示されている。図中の長さL11は、候補領域213の辺413からの長さである。以下、長さL11が、第1閾値Th1未満であることとして、説明を行う。 FIG. 4 is a flowchart showing an example of the process of determining the candidate region. In S200, the CPU 810 selects one candidate area that has not been processed in the process of FIG. 4 among the candidate areas specified in S120 (FIG. 2) as a candidate area to be determined (referred to as a candidate area of interest). In S210, the CPU 810 determines whether or not the length of the candidate area of interest (specifically, the length from the side in contact with the candidate area of interest in the direction perpendicular to that side) is equal to or greater than the first threshold Th1. to decide. In this embodiment, the first threshold Th1 is predetermined and is greater than zero. FIG. 3D shows a processing example of the scanned image 110. The length L11 in the figure is the length from the side 413 of the candidate region 213. Hereinafter, it will be described that the length L11 is less than the first threshold value Th1.

注目候補領域の長さが第1閾値Th1未満である場合(S210:No)、S220で、CPU810は、注目候補領域を補修の対象として、選択する。すなわち、CPU810は、注目候補領域を補修すべきと判断する。図3(D)の候補領域213は、補修すべきと判断される。そして、CPU810は、S240へ移行する。 When the length of the attention candidate region is less than the first threshold Th1 (S210: No), in S220, the CPU 810 selects the attention candidate region as the repair target. That is, the CPU 810 determines that the candidate region of interest should be repaired. It is determined that the candidate area 213 of FIG. 3D should be repaired. Then, the CPU 810 shifts to S240.

注目候補領域の長さが第1閾値Th1以上である場合(S210:Yes)、S230で、CPU810は、注目候補領域を補修の対象から除く。すなわち、CPU810は、注目候補領域を補修すべきではないと判断する。そして、CPU810は、S240へ移行する。 When the length of the attention candidate region is equal to or greater than the first threshold Th1 (S210: Yes), in S230, the CPU 810 excludes the attention candidate region from the repair target. That is, the CPU 810 determines that the candidate region of interest should not be repaired. Then, the CPU 810 shifts to S240.

このように、候補領域の長さが第1閾値Th1以上である場合に、候補領域を補修すべきではないと判断する理由は、長い候補領域の色が後述する補修処理で修正される場合に、色が修正された領域が不自然に見える可能性があるからである。 In this way, the reason for determining that the candidate region should not be repaired when the length of the candidate region is equal to or greater than the first threshold Th1 is when the color of the long candidate region is corrected by the repair process described later. This is because the color-corrected area may look unnatural.

S240では、CPU810は、全ての候補領域の処理が完了したか否かを判断する。未処理の候補領域が残っている場合(S240:No)、CPU810は、S200へ移行して、未処理の候補領域の処理を行う。全ての候補領域の処理が完了した場合(S240:Yes)、CPU810は、図4の処理(ひいては、S130(図2))を終了する。 In S240, the CPU 810 determines whether or not the processing of all the candidate areas has been completed. When the unprocessed candidate area remains (S240: No), the CPU 810 shifts to S200 and processes the unprocessed candidate area. When the processing of all the candidate areas is completed (S240: Yes), the CPU 810 ends the processing of FIG. 4 (and by extension, S130 (FIG. 2)).

S135(図2)では、CPU810は、部分余白領域を特定する。図3(D)には、特定される部分余白領域の例が示されている(部分余白領域511〜514)。上述したように、S100では、ユーザによって、矩形状の原稿の四方のそれぞれの余白の幅が指定される。CPU810は、矩形原稿領域210(図3(D))の辺411〜414の外側に接触する、指定された幅W21〜S24の、部分余白領域511〜514を特定する。 In S135 (FIG. 2), the CPU 810 specifies a partial margin area. FIG. 3 (D) shows an example of the specified partial margin region (partial margin region 511 to 514). As described above, in S100, the width of each margin on each side of the rectangular document is specified by the user. The CPU 810 specifies a partial margin area 511-514 of a designated width W21-S24 that contacts the outside of the sides 411-414 of the rectangular document area 210 (FIG. 3D).

具体的には、CPU810は、矩形原稿領域210の4個の辺411〜414から、ユーザによって指定された幅W21〜W24だけ外側に位置する4個の辺411x〜414xで構成される矩形輪郭111sを特定する。外側の辺411x〜414xと、内側の辺411〜414とは、それぞれ、平行である。そして、外側の辺411x〜414xと内側の辺411〜414との間の距離は、それぞれ、ユーザによって指定された幅W21〜W24である。そして、CPU810は、矩形輪郭111sと、矩形原稿領域210の輪郭410と、の間の領域510を、4個の辺411〜414にそれぞれ接する4個の部分余白領域511〜514に区分する。部分余白領域511〜514は、台形状の領域である。部分余白領域511〜514の上底と下底とは、内側の辺411〜414と、外側の辺411x〜414xとである。 Specifically, the CPU 810 has a rectangular contour 111s composed of four sides 411x to 414x located outside the four sides 411 to 414 of the rectangular document area 210 by the widths W21 to W24 specified by the user. To identify. The outer sides 411x to 414x and the inner sides 411 to 414 are parallel to each other. The distances between the outer sides 411x to 414x and the inner sides 411 to 414 are the widths W21 to W24 specified by the user, respectively. Then, the CPU 810 divides the area 510 between the rectangular contour 111s and the contour 410 of the rectangular original region 210 into four partial margin areas 511 to 514 that are in contact with the four sides 411 to 414, respectively. The partial margin areas 511 to 514 are trapezoidal areas. The upper base and the lower base of the partial margin regions 511 to 514 are inner sides 411 to 414 and outer sides 411x to 414x.

例えば、矩形原稿領域210の左側の辺411に接する部分余白領域511の上底と下底とは、内側の辺411と、辺411から幅W21だけ外側に位置する外側の辺411xと、である(辺411、411xは、平行であり、辺411、411xの間の距離は、幅W21である)。 For example, the upper and lower bases of the partial margin area 511 in contact with the left side 411 of the rectangular document area 210 are the inner side 411 and the outer side 411x located outside the side 411 by the width W21. (The sides 411 and 411x are parallel, and the distance between the sides 411 and 411x is the width W21).

読取画像110のうち、外側の辺411x〜414xで囲まれる領域111、すなわち、矩形原稿領域210と4個の部分余白領域511〜514とで構成される領域111は、後述するように、出力画像に含まれる領域である(出力領域111と呼ぶ)。 Of the scanned image 110, the area 111 surrounded by the outer sides 411x to 414x, that is, the area 111 composed of the rectangular document area 210 and the four partial margin areas 511 to 514 is the output image as described later. It is an area included in (referred to as an output area 111).

S140(図2)では、CPU810は、部分余白領域が補修の対象であるか否かを仮に判断する。S140では、各部分余白領域の仮の判断が、他の部分余白領域の判断とは独立に、行われる。本実施例では、CPU810は、部分余白領域の幅が第2閾値以上である場合と、部分余白領域に補修の対象ではない候補領域が接触している場合とに、部分余白領域が補修の対象ではないと判断する。他の場合には、部分余白領域が補修の対象であると判断される。図3(D)の例では、部分余白領域511〜514の幅は、それぞれ、幅W21〜W24である。これらの幅W21〜W24が、ゼロよりも大きく、かつ、第2閾値未満である。そして、部分余白領域511〜514には、補修の対象ではない候補領域は、接触していない。従って、部分余白領域511〜514は、それぞれ、補修の対象であると判断される。なお、S140の処理の詳細については、後述する。 In S140 (FIG. 2), the CPU 810 tentatively determines whether or not the partial margin area is the target of repair. In S140, the provisional determination of each partial margin area is performed independently of the determination of the other partial margin areas. In this embodiment, in the CPU 810, the partial margin area is the target of repair when the width of the partial margin area is equal to or larger than the second threshold value and when the partial margin area is in contact with a candidate area which is not the target of repair. Judge that it is not. In other cases, the partial margin area is determined to be the target of repair. In the example of FIG. 3D, the widths of the partial margin areas 511 to 514 are widths W21 to W24, respectively. These widths W21 to W24 are greater than zero and less than the second threshold. Then, the partial margin areas 511 to 514 are not in contact with the candidate areas that are not the targets of repair. Therefore, each of the partial margin areas 511 to 514 is determined to be the target of repair. The details of the processing of S140 will be described later.

S150(図2)では、CPU810は、部分余白領域が補修の対象であるか否かを最終的に判断する。S150では、各部分余白領域の最終的な判断結果が、他の部分余白領域の判断結果を考慮して、変更され得る。CPU810は、少なくとも1つの部分余白領域とゼロ以上の候補領域とで構成される連続な領域に、補修すべきでないと仮に判断される領域が含まれる場合に、その連続な領域の全体を、補修すべきではないと判断する。図3(D)の例では、部分余白領域511〜514と候補領域213とは、連続な領域を形成する。S130では、候補領域213は、補修の対象であると判断され、S140では、部分余白領域511〜514の全てが、補修の対象であると、判断される。従って、S150では、部分余白領域511〜514と候補領域213とは、補修の対象であると最終的に判断される。なお、S150の処理の詳細については、後述する。 In S150 (FIG. 2), the CPU 810 finally determines whether or not the partial margin area is the target of repair. In S150, the final judgment result of each partial margin area can be changed in consideration of the judgment result of the other partial margin area. When the continuous area composed of at least one partial margin area and zero or more candidate areas includes an area that is tentatively determined not to be repaired, the CPU 810 repairs the entire continuous area. Judge that it should not be done. In the example of FIG. 3D, the partial margin areas 511 to 514 and the candidate area 213 form a continuous area. In S130, the candidate area 213 is determined to be the target of repair, and in S140, all of the partial margin areas 511 to 514 are determined to be the target of repair. Therefore, in S150, the partial margin areas 511 to 514 and the candidate areas 213 are finally determined to be the targets of repair. The details of the processing of S150 will be described later.

S160(図2)では、CPU810は、補修対象の領域の補修処理を実行する。図5は、補修処理の例を示すフローチャートである。S500では、CPU810は、S135(図2)で特定された部分余白領域のうち、図5の処理において未処理の1つの部分余白領域を、処理対象の部分余白領域として選択する(注目部分余白領域と呼ぶ)。S510では、CPU810は、注目部分余白領域が、補修の対象であるか否かを判断する。 In S160 (FIG. 2), the CPU 810 executes the repair process of the area to be repaired. FIG. 5 is a flowchart showing an example of the repair process. In S500, the CPU 810 selects one unprocessed partial margin area in the process of FIG. 5 from the partial margin areas specified in S135 (FIG. 2) as the partial margin area to be processed (attention partial margin area). Called). In S510, the CPU 810 determines whether or not the attention portion margin area is the target of repair.

注目部分余白領域が補修の対象である場合(S510:Yes)、S520で、CPU810は、注目部分余白領域を補修する。具体的には、注目部分余白領域の色が、修正される。本実施例では、CPU810は、注目部分余白領域の全ての画素の色値を、原稿画像21(図3(A))の背景Bgを示す色値に、修正する。背景Bgの色値の特定方法は、種々の方法であってよい。例えば、矩形原稿領域210内の複数の画素の各色成分のヒストグラムのそれぞれの最頻値が、背景Bgの色を示す値として、採用されてよい。また、最頻値は、矩形原稿領域210から候補領域(例えば、図3(C)の候補領域213)を除いた残りの領域の縁部分の複数の画素を用いて、特定されてよい。 When the attention portion margin area is the target of repair (S510: Yes), in S520, the CPU 810 repairs the attention portion margin area. Specifically, the color of the margin area of interest is corrected. In this embodiment, the CPU 810 corrects the color values of all the pixels in the margin area of interest to the color values indicating the background Bg of the original image 21 (FIG. 3A). The method for specifying the color value of the background Bg may be various methods. For example, the mode of each of the histograms of the color components of the plurality of pixels in the rectangular document area 210 may be adopted as the value indicating the color of the background Bg. Further, the mode may be specified by using a plurality of pixels at the edge portion of the remaining region excluding the candidate region (for example, the candidate region 213 of FIG. 3C) from the rectangular original region 210.

図3(E)は、補修処理によって得られる画像112の例を示している。この画像112は、図3(D)の出力領域111の画像に補修処理を行うことによって得られる画像である(出力画像112とも呼ぶ)。領域210x、511x〜514xは、図3(D)の領域210、511〜514に補修処理を行って得られる画像を、それぞれ示している。部分余白領域513(図3(D))が注目部分余白領域である場合、注目部分余白領域513の複数の画素の色は、背景Bgの色に修正される。補修済の画像112(図3(E))において、矩形原稿領域210xの背景Bgと部分余白領域513xとの間の色の差が小さくなる。この結果、領域210x、513xの境界(ここでは、辺413)は、目立たなくなる。 FIG. 3 (E) shows an example of the image 112 obtained by the repair process. This image 112 is an image obtained by performing a repair process on the image of the output region 111 of FIG. 3D (also referred to as an output image 112). Regions 210x, 511x to 514x show images obtained by performing repair processing on regions 210 and 511 to 514 in FIG. 3D, respectively. When the partial margin region 513 (FIG. 3 (D)) is the attention portion margin region, the color of the plurality of pixels in the attention portion margin region 513 is corrected to the color of the background Bg. In the repaired image 112 (FIG. 3 (E)), the color difference between the background Bg of the rectangular original area 210x and the partial margin area 513x becomes small. As a result, the boundaries of the regions 210x and 513x (here, sides 413) become inconspicuous.

S530(図5)では、CPU810は、注目部分余白領域に接する補修の対象の候補領域を補修する。具体的には、補修の対象の候補領域の色が、修正される。本実施例では、CPU810は、補修対象の候補領域の全ての画素の色を、原稿画像21(図3(A))の背景Bgの色に、修正する。背景Bgの色は、S520で特定された色と、同じである。部分余白領域513(図3(D))が注目部分余白領域である場合、補修の対象である候補領域213の複数の画素の色は、背景Bgの色に修正される。補修済の画像112(図3(E))において、候補領域213xは、候補領域213(図3(D))の補修済の画像を示している。補修処理によって、矩形原稿領域210xの背景Bgと候補領域213xとの間の色の差が小さくなる。この結果、領域210xの背景Bgと候補領域213xとの境界は、目立たなくなる。 In S530 (FIG. 5), the CPU 810 repairs the candidate area to be repaired in contact with the attention portion margin area. Specifically, the color of the candidate area to be repaired is corrected. In this embodiment, the CPU 810 corrects the colors of all the pixels in the candidate area to be repaired to the color of the background Bg of the original image 21 (FIG. 3 (A)). The color of the background Bg is the same as the color specified in S520. When the partial margin area 513 (FIG. 3 (D)) is the attention partial margin area, the color of the plurality of pixels of the candidate area 213 to be repaired is corrected to the color of the background Bg. In the repaired image 112 (FIG. 3 (E)), the candidate region 213x shows the repaired image of the candidate region 213 (FIG. 3 (D)). The repair process reduces the color difference between the background Bg of the rectangular original region 210x and the candidate region 213x. As a result, the boundary between the background Bg of the region 210x and the candidate region 213x becomes inconspicuous.

なお、後述するように、部分余白領域の幅は、ゼロであり得る。本実施例では、部分余白領域の幅がゼロである場合であっても、図2のS140、S150の処理によって、部分余白領域の色を修正すべきと判断され得る。そして、図5の処理では、注目部分余白領域の幅がゼロである場合であっても、注目部分余白領域の色を修正すべきと判断されている場合には、S510の判断結果がYesであり、S530で、注目部分余白領域に接する補修対象の候補領域の色が修正される。なお、注目部分余白領域の幅がゼロである場合、注目部分余白領域は、実際には、形成されない。従って、S520での色の修正は、省略される。 As will be described later, the width of the partial margin area can be zero. In this embodiment, even when the width of the partial margin region is zero, it can be determined that the color of the partial margin region should be corrected by the processing of S140 and S150 of FIG. Then, in the process of FIG. 5, even when the width of the attention portion margin area is zero, if it is determined that the color of the attention portion margin region should be corrected, the determination result of S510 is Yes. Yes, in S530, the color of the candidate area to be repaired in contact with the margin area of interest is corrected. When the width of the attention portion margin region is zero, the attention portion margin region is not actually formed. Therefore, the color correction in S520 is omitted.

注目候補領域と候補領域との補修(S520、S530)の後、CPU810は、S540へ移行する。注目部分余白領域が補修の対象ではない場合(S510:No)、CPU810は、S520、S530をスキップして、S540へ移行する。S540では、CPU810は、全ての部分余白領域の処理が完了したか否かを判断する。未処理の部分余白領域が残っている場合(S540:No)、CPU810は、S500へ移行して、未処理の部分余白領域の処理を行う。図3(D)の例では、部分余白領域511〜514の全てが、補修の対象である。この結果、補修済の画像112(図3(E))において、部分余白領域511x〜514xの全てが、補修される。これにより、矩形原稿領域210xの背景Bgと部分余白領域511x〜514xとの間の色の差が小さくなる。この結果、矩形原稿領域210xと部分余白領域511x〜514xとの境界(ここでは、辺411〜414)は、目立たなくなる。 After repairing the candidate area of interest and the candidate area (S520, S530), the CPU 810 shifts to S540. When the attention portion margin area is not the target of repair (S510: No), the CPU 810 skips S520 and S530 and shifts to S540. In S540, the CPU 810 determines whether or not the processing of all the partial margin areas is completed. When the unprocessed partial margin area remains (S540: No), the CPU 810 shifts to S500 and processes the unprocessed partial margin area. In the example of FIG. 3D, all of the partial margin areas 511 to 514 are the targets of repair. As a result, in the repaired image 112 (FIG. 3 (E)), all of the partial margin areas 511x to 514x are repaired. As a result, the color difference between the background Bg of the rectangular original area 210x and the partial margin areas 511x to 514x becomes small. As a result, the boundary between the rectangular original area 210x and the partial margin areas 511x to 514x (here, sides 411 to 414) becomes inconspicuous.

全ての部分余白領域の処理が完了した場合(図5:S540:Yes)、CPU810は、図5の処理(ひいては、S160(図2))を、終了する。 When the processing of all the partial margin areas is completed (FIG. 5: S540: Yes), the CPU 810 ends the processing of FIG. 5 (by extension, S160 (FIG. 2)).

S170(図2)では、CPU810は、補修済みの画像(例えば、図3(E)の出力画像112)を示す出力画像データを生成する。出力画像データのデータ形式は、任意のであってよい。例えば、JPEG形式の出力画像データが、生成されてよい。 In S170 (FIG. 2), the CPU 810 generates output image data showing the repaired image (for example, the output image 112 of FIG. 3 (E)). The data format of the output image data may be arbitrary. For example, output image data in JPEG format may be generated.

S180では、CPU810は、出力画像データを、出力する。出力先の装置は、任意の装置であってよい。例えば、出力先は、画像処理装置800に設けられた内部の記憶装置815(例えば、不揮発性記憶装置830)であってよい。この場合、CPU810は、出力画像データを、不揮発性記憶装置830に格納する。ユーザは、不揮発性記憶装置830に格納された出力画像データを、任意の用途(例えば、印刷や表示など)に、利用してよい。また、出力先の装置は、画像処理装置800に接続された、図示しない外部の記憶装置であってよい(例えば、USBメモリ)。この場合、CPU810は、外部の記憶装置に、出力画像データを格納する。また、出力先の装置は、画像処理装置800に接続された、図示しないプリンタであってもよい。この場合、CPU810は、出力画像データをプリンタに出力することによって、プリンタに出力画像(すなわち、補修済の画像)を、印刷させてよい。S180の完了に応じて、CPU810は、図2の処理を終了する。 In S180, the CPU 810 outputs the output image data. The output destination device may be any device. For example, the output destination may be an internal storage device 815 (for example, a non-volatile storage device 830) provided in the image processing device 800. In this case, the CPU 810 stores the output image data in the non-volatile storage device 830. The user may use the output image data stored in the non-volatile storage device 830 for any purpose (for example, printing or display). Further, the output destination device may be an external storage device (for example, a USB memory) connected to the image processing device 800 (not shown). In this case, the CPU 810 stores the output image data in an external storage device. Further, the output destination device may be a printer (not shown) connected to the image processing device 800. In this case, the CPU 810 may print the output image (that is, the repaired image) on the printer by outputting the output image data to the printer. Upon completion of S180, the CPU 810 ends the process of FIG.

A−3.部分余白領域の仮の判断処理:
図6は、部分余白領域の仮の判断の処理(図2:S140)の例を示すフローチャートである。S300では、CPU810は、S135(図2)で特定された部分余白領域のうち、図6の処理において未処理の1つの部分余白領域を、判断対象の部分余白領域として選択する(注目部分余白領域と呼ぶ)。S310では、CPU810は、注目部分余白領域を、補修の対象として、仮に選択する。S320では、CPU810は、注目部分余白領域の幅(具体的には、矩形原稿領域の4個の辺のうちの注目部分余白領域に接する辺からの、その辺に垂直な方向の幅)が、第2閾値Th2以上であるか否かを判断する。本実施例では、第2閾値Th2は、予め決められており、ゼロよりも大きい。図3(D)の例では、部分余白領域511〜514の幅は、それぞれ、幅W21〜W24である。以下、これらの幅W21〜W24が、ゼロよりも大きく、かつ、閾値Th2未満であることとして、説明を行う。
A-3. Temporary judgment processing of partial margin area:
FIG. 6 is a flowchart showing an example of a provisional determination process (FIG. 2: S140) of the partial margin area. In S300, the CPU 810 selects one unprocessed partial margin area in the process of FIG. 6 among the partial margin areas specified in S135 (FIG. 2) as the partial margin area to be determined (attention partial margin area). Called). In S310, the CPU 810 tentatively selects the attention portion margin area as a repair target. In S320, the CPU 810 determines that the width of the attention portion margin area (specifically, the width in the direction perpendicular to the side from the side in contact with the attention portion margin area among the four sides of the rectangular document area). It is determined whether or not the second threshold value is Th2 or more. In this embodiment, the second threshold Th2 is predetermined and is greater than zero. In the example of FIG. 3D, the widths of the partial margin areas 511 to 514 are widths W21 to W24, respectively. Hereinafter, it will be described that these widths W21 to W24 are larger than zero and less than the threshold value Th2.

注目部分余白領域の幅が第2閾値Th2以上である場合(S320:Yes)、S330で、CPU810は、注目部分余白領域を、補修の対象から除く。すなわち、CPU810は、注目部分余白領域を補修すべきではないと、仮に判断する。そして、CPU810は、S340へ移行する。 When the width of the attention portion margin region is equal to or larger than the second threshold Th2 (S320: Yes), in S330, the CPU 810 excludes the attention portion margin region from the repair target. That is, the CPU 810 tentatively determines that the margin area of interest should not be repaired. Then, the CPU 810 shifts to S340.

このように、部分余白領域の幅が第2閾値Th2以上である場合に、部分余白領域を補修すべきではないと仮に判断される。この理由は、以下の通りである。大きな部分余白領域の色が修正される場合、色が修正される領域が大きいので、色が修正された領域が不自然に見える可能性がある。本実施例では、部分余白領域の幅が第2閾値Th2以上である場合に、部分余白領域を補修すべきではないと仮に判断されるので、色が修正された領域が不自然に見えることを抑制できる。 As described above, when the width of the partial margin region is equal to or larger than the second threshold value Th2, it is tentatively determined that the partial margin region should not be repaired. The reason for this is as follows. When the color of the large partial margin area is corrected, the color-corrected area may look unnatural because the color-corrected area is large. In this embodiment, when the width of the partial margin region is equal to or greater than the second threshold value Th2, it is tentatively determined that the partial margin region should not be repaired. Can be suppressed.

注目部分余白領域の幅が第2閾値Th2未満である場合(S320:No)、CPU810は、S350〜S390の処理を実行する。これにより、注目部分余白領域に、補修の対象ではない非対象の候補領域が接している場合に、注目部分余白領域が、補修の対象から除かれる。 When the width of the attention portion margin area is less than the second threshold value Th2 (S320: No), the CPU 810 executes the processes of S350 to S390. As a result, when the non-target candidate area that is not the target of repair is in contact with the attention area margin area, the attention area margin area is excluded from the repair target.

具体的には、S350で、CPU810は、注目部分余白領域の幅がゼロよりも大きいか否かを判断する。上述したように、ユーザによって指定される余白の幅がゼロである場合、注目部分余白領域の幅は、ゼロである。注目部分余白領域の幅がゼロである場合(S350)、CPU810は、S355〜S390をスキップし、注目部分余白領域を補修の対象から除かずに、S340へ移行する。 Specifically, in S350, the CPU 810 determines whether or not the width of the attention portion margin region is larger than zero. As described above, when the width of the margin specified by the user is zero, the width of the attention portion margin area is zero. When the width of the attention portion margin region is zero (S350), the CPU 810 skips S355 to S390 and shifts to S340 without excluding the attention portion margin region from the repair target.

注目部分余白領域の幅がゼロよりも大きい場合(S350:Yes)、S355で、CPU810は、注目部分余白領域に接する候補領域が存在するか否かを判断する。注目部分余白領域に接する候補領域が存在しない場合(S355:No)、CPU810は、S360〜S390をスキップし、注目部分余白領域を補修の対象から除かずに、S340へ移行する。 When the width of the attention portion margin region is larger than zero (S350: Yes), in S355, the CPU 810 determines whether or not there is a candidate region in contact with the attention portion margin region. When there is no candidate area in contact with the attention portion margin region (S355: No), the CPU 810 skips S360 to S390 and shifts to S340 without excluding the attention portion margin region from the repair target.

例えば、図3(D)の部分余白領域511、512、514には、候補領域は、接していない。従って、これらの部分余白領域511、512、514が注目部分余白領域である場合、S355の判断結果は、Noである。この結果、部分余白領域511、512、514は、補修の対象から除かれずに、補修すべきであるという仮の判断(S310)は、維持される。 For example, the candidate region does not touch the partial margin regions 511, 512, and 514 in FIG. 3 (D). Therefore, when these partial margin regions 511, 512, and 514 are the partial margin regions of interest, the judgment result of S355 is No. As a result, the tentative determination (S310) that the partial margin areas 511, 512, and 514 should be repaired without being excluded from the repair target is maintained.

注目部分余白領域に接する候補領域が存在する場合(S355:Yes)、S360で、CPU810は、注目部分余白領域に接する候補領域から、未判断の1つの候補領域を、処理対象の候補領域として選択する(注目候補領域と呼ぶ)。S370では、CPU810は、注目候補領域が、補修の非対象であるか否かを判断する。注目候補領域が補修の非対象である場合、すなわち、注目候補領域が補修の対象ではない場合(S370:Yes)、S380で、CPU810は、注目部分余白領域を、補修の対象から除く。すなわち、CPU810は、注目部分余白領域を補修すべきではないと、判断する。そして、CPU810は、S390へ移行する。 When there is a candidate area in contact with the attention area margin area (S355: Yes), in S360, the CPU 810 selects one undetermined candidate area as the candidate area to be processed from the candidate areas in contact with the attention area margin area. (Called a candidate area of interest). In S370, the CPU 810 determines whether or not the candidate region of interest is not subject to repair. When the candidate region of interest is not the target of repair, that is, when the candidate region of interest is not the target of repair (S370: Yes), in S380, the CPU 810 excludes the region of interest from the repair target. That is, the CPU 810 determines that the attention portion margin area should not be repaired. Then, the CPU 810 shifts to S390.

注目候補領域が補修の対象である場合、すなわち、注目候補領域が補修の対象である場合(S370:No)、CPU810は、S380をスキップして、S390へ移行する。 When the candidate area of interest is the target of repair, that is, when the candidate area of interest is the target of repair (S370: No), the CPU 810 skips S380 and shifts to S390.

例えば、図3(D)の部分余白領域513が注目部分余白領域である場合、候補領域213が、注目候補領域であり得る。候補領域213は、補修の対象であるので、S370の判断結果は、Noである。この結果、部分余白領域513は、補修の対象から除かれずに、補修すべきであるという仮の判断(S310)は、維持される。 For example, when the partial margin area 513 of FIG. 3D is the attention partial margin area, the candidate area 213 may be the attention candidate area. Since the candidate area 213 is the target of repair, the judgment result of S370 is No. As a result, the tentative determination (S310) that the partial margin region 513 should be repaired without being excluded from the repair target is maintained.

S390では、CPU810は、注目部分余白領域に接する全ての候補領域の処理が完了したか否かを判断する。未処理の候補領域が残っている場合(S390:No)、CPU810は、S360へ移行して、未処理の候補領域の処理を行う。全ての候補領域の処理が完了した場合(S390:Yes)、CPU810は、S340へ移行する。 In S390, the CPU 810 determines whether or not the processing of all the candidate areas in contact with the attention portion margin area is completed. When the unprocessed candidate area remains (S390: No), the CPU 810 shifts to S360 and processes the unprocessed candidate area. When the processing of all the candidate areas is completed (S390: Yes), the CPU 810 shifts to S340.

S340では、CPU810は、全ての部分余白領域の仮の判断の処理が完了したか否かを判断する。未処理の部分余白領域が残っている場合(S340:No)、CPU810は、S300へ移行して、未処理の部分余白領域の処理を行う。全ての部分余白領域の処理が完了した場合(S340:Yes)、CPU810は、図6の処理(ひいては、S140(図2))を、終了する。 In S340, the CPU 810 determines whether or not the provisional determination process of all the partial margin areas has been completed. When the unprocessed partial margin area remains (S340: No), the CPU 810 shifts to S300 and processes the unprocessed partial margin area. When the processing of all the partial margin areas is completed (S340: Yes), the CPU 810 ends the processing of FIG. 6 (and by extension, S140 (FIG. 2)).

A−4.部分余白領域の最終的な判断処理:
図7は、部分余白領域の最終的な判断の処理(図2:S150)の例を示すフローチャートである。S400では、CPU810は、S135(図2)で特定された部分余白領域のうち、図7の処理において未処理の1つの部分余白領域を、判断対象の部分余白領域として選択する(注目部分余白領域と呼ぶ)。S410では、CPU810は、注目部分余白領域のS140(図2)での仮の判断結果が、「補修すべきである(すなわち、補修の対象である)」か否かを判断する。注目部分余白領域が、補修の対象ではない場合(S410:No)、CPU810は、注目部分余白領域の判断結果(補修の対象ではない)を変更せずに、S480へ移行する。
A-4. Final judgment processing of partial margin area:
FIG. 7 is a flowchart showing an example of the final determination process (FIG. 2: S150) of the partial margin area. In S400, the CPU 810 selects one unprocessed partial margin area in the process of FIG. 7 among the partial margin areas specified in S135 (FIG. 2) as the partial margin area to be determined (attention partial margin area). Called). In S410, the CPU 810 determines whether or not the tentative determination result in S140 (FIG. 2) of the attention portion margin area is "should be repaired (that is, is the target of repair)". When the attention portion margin area is not the target of repair (S410: No), the CPU 810 shifts to S480 without changing the determination result (not the repair target) of the attention portion margin area.

注目部分余白領域が、補修の対象である場合(S410:Yes)、S420で、CPU810は、注目部分余白領域の幅がゼロよりも大きいか否かを判断する。注目部分余白領域の幅がゼロである場合(S420:No)、CPU810は、注目部分余白領域の判断結果(補修の対象である)を変更せずに維持し、そして、S480へ移行する。 When the attention portion margin area is the target of repair (S410: Yes), in S420, the CPU 810 determines whether or not the width of the attention portion margin area is larger than zero. When the width of the attention portion margin region is zero (S420: No), the CPU 810 maintains the determination result (the target of repair) of the attention portion margin region without changing, and then shifts to S480.

注目部分余白領域の幅がゼロよりも大きい場合(S420:Yes)、S430で、CPU810は、注目部分余白領域の一方の隣の部分余白領域が、「幅がゼロより大きい」かつ「補修の対象ではない(補修の非対象である)」という条件を満たすか否かを判断する。S430の判断結果がNoである場合、S440で、CPU810は、注目部分余白領域の他方の隣の部分余白領域が、「幅がゼロより大きい」かつ「補修の対象ではない(補修の非対象である)」という条件を満たすか否かを判断する。 When the width of the attention portion margin area is larger than zero (S420: Yes), in S430, the CPU 810 determines that the partial margin area adjacent to one of the attention portion margin areas is "the width is larger than zero" and "the object to be repaired". It is judged whether or not the condition of "not (not subject to repair)" is satisfied. When the judgment result of S430 is No, in S440, the CPU 810 states that the partial margin area adjacent to the other of the attention portion margin area is "the width is larger than zero" and "is not the target of repair (not the target of repair). It is judged whether or not the condition of "is)" is satisfied.

例えば、図3(D)の部分余白領域513が注目部分余白領域である場合、S430では、注目部分余白領域513の時計回り方向の隣の部分余白領域514に関する判断が行われ、S440では、注目部分余白領域513の反時計回り方向の隣の部分余白領域512に関する判断が行われる。部分余白領域514の幅W24は、ゼロよりも大きく、かつ、部分余白領域514は、補修の対象であるので、S430の判断結果は、Noである。また、部分余白領域512の幅W22は、ゼロよりも大きく、かつ、部分余白領域512は、補修の対象であるので、S440の判断結果は、Noである。 For example, when the partial margin area 513 of FIG. 3D is the attention portion margin region, in S430, a determination is made regarding the portion margin region 514 adjacent to the attention portion margin region 513 in the clockwise direction, and in S440, attention is paid. A determination is made regarding the partial margin area 512 adjacent to the partial margin area 513 in the counterclockwise direction. Since the width W24 of the partial margin region 514 is larger than zero and the partial margin region 514 is the target of repair, the judgment result of S430 is No. Further, since the width W22 of the partial margin region 512 is larger than zero and the partial margin region 512 is the target of repair, the judgment result of S440 is No.

具体的な図の例については後述するが、両隣の部分余白領域のうちの少なくとも1個の部分余白領域に関して、部分余白領域の幅がゼロより大きく、かつ、部分余白領域が補修の対象ではない場合(S430:Yes、または、S440:Yes)、S470で、CPU810は、注目部分余白領域を補修の対象から除き、S480へ移行する。このように、幅がゼロよりも大きく、かつ、補修の対象ではない部分余白領域に隣接する注目部分余白領域は、補修の対象から除かれる。この理由は、補修の対象である注目部分余白領域の隣に補修の対象ではない部分余白領域が配置される場合、それらの領域が接する境界で、色の差が目立ち易いからである。なお、隣の部分余白領域の幅がゼロである場合には、出力画像において隣の部分余白領域は実際には形成されないので、色の差を目立たせるような境界は、形成されない。そこで、本実施例では、隣の部分余白領域の幅がゼロである場合には、S430、S440の判断結果がNoであることとした。 A specific example of the figure will be described later, but for at least one of the adjacent partial margin areas, the width of the partial margin area is larger than zero and the partial margin area is not the target of repair. In the case (S430: Yes, or S440: Yes), in S470, the CPU 810 removes the attention portion margin area from the repair target and shifts to S480. As described above, the attention portion margin region having a width larger than zero and adjacent to the partial margin region that is not the target of repair is excluded from the repair target. The reason for this is that when a partial margin area that is not the target of repair is arranged next to the partial margin area of interest that is the target of repair, the color difference is easily noticeable at the boundary where those areas are in contact. When the width of the adjacent partial margin region is zero, the adjacent partial margin region is not actually formed in the output image, so that the boundary that makes the color difference conspicuous is not formed. Therefore, in this embodiment, when the width of the adjacent partial margin area is zero, the judgment results of S430 and S440 are set to No.

S430、S440の判断結果がNoである場合、S450で、CPU810は、注目部分余白領域の向かい側の部分余白領域(対向部分余白領域と呼ぶ)が、「幅がゼロより大きい」かつ「補修の対象ではない(補修の非対象である)」という条件を満たすか否かを判断する。S450の判断結果がNoである場合、CPU810は、S480へ移行し、注目部分余白領域を補修の対象から除かずに、補修すべきであるという仮の判断を維持する。例えば、図3(D)の部分余白領域513が注目部分余白領域である場合、注目部分余白領域513の向かい側の対向部分余白領域511は、補修の対象であり、その幅W21は、ゼロより大きい。従って、S450の判断結果は、Noである。S450の判断結果がNoである場合、注目部分余白領域と対向部分余白領域との両方が、補修の対象であり得、また、対向部分余白領域の幅がゼロであり得る。この場合、注目部分余白領域と対向部分余白領域との間で、補修処理後の色の差が目立つことは、抑制される。例えば、図3(D)の部分余白領域513が注目部分余白領域である場合、注目部分余白領域513と対向部分余白領域511との両方が、補修の対象である(S450:No)。注目部分余白領域と対向部分余白領域との両方が補修される場合、これらの領域の間で、補修処理後の色の差が目立つことは、抑制される。そこで、CPU810は、注目部分余白領域を補修の対象から除かずに、補修すべきであるという仮の判断を維持する。 When the judgment results of S430 and S440 are No, in S450, the CPU 810 has a partial margin area (referred to as an opposite partial margin area) opposite to the attention portion margin region, which is "the width is larger than zero" and "the target of repair". It is judged whether or not the condition of "not (not subject to repair)" is satisfied. If the determination result of S450 is No, the CPU 810 shifts to S480 and maintains a tentative determination that the attention portion margin area should be repaired without being excluded from the repair target. For example, when the partial margin region 513 of FIG. 3D is the attention portion margin region, the opposite portion margin region 511 opposite the attention portion margin region 513 is the target of repair, and its width W21 is larger than zero. .. Therefore, the judgment result of S450 is No. When the determination result of S450 is No, both the attention portion margin region and the facing portion margin region may be the target of repair, and the width of the facing portion margin region may be zero. In this case, it is suppressed that the color difference after the repair treatment is conspicuous between the attention portion margin region and the opposite portion margin region. For example, when the partial margin area 513 of FIG. 3D is the attention portion margin region, both the attention portion margin region 513 and the opposite portion margin region 511 are the targets of repair (S450: No). When both the attention portion margin region and the opposite portion margin region are repaired, the conspicuous color difference after the repair treatment is suppressed between these regions. Therefore, the CPU 810 maintains a tentative determination that the attention portion margin area should be repaired without being excluded from the repair target.

S450の判断結果がYesである場合、S460で、CPU810は、注目部分余白領域の少なくとも1つの隣の部分余白領域の幅が、ゼロよりも大きいか否かを判断する。 When the determination result of S450 is Yes, in S460, the CPU 810 determines whether or not the width of at least one adjacent partial margin region of the attention portion margin region is larger than zero.

S460の判断結果がYesである場合、CPU810は、S470へ移行し、注目部分余白領域を補修の対象から除き、S480へ移行する。具体的な図の例については後述するが、S450、S460の判断結果がYesである場合、補修の対象である注目部分余白領域と、補修の対象ではない対向部分余白領域とが、ゼロより大きい幅を有する隣の部分余白領域を介して、連続する。この結果、連続する注目部分余白領域と対向部分余白領域との間で、補修処理後の色の差が、大きくなり得る。そこで、本実施例では、注目部分余白領域は、対向部分余白領域に合わせて、補修の対象から除かれる。 When the determination result of S460 is Yes, the CPU 810 shifts to S470, removes the attention portion margin area from the repair target, and shifts to S480. A specific example of the figure will be described later, but when the judgment result of S450 and S460 is Yes, the attention portion margin area to be repaired and the opposite portion margin area not to be repaired are larger than zero. It is continuous through the adjacent partial margin area having a width. As a result, the color difference after the repair treatment can be large between the continuous attention portion margin region and the opposite portion margin region. Therefore, in the present embodiment, the attention portion margin region is excluded from the repair target in accordance with the facing portion margin region.

S460の判断結果がNoである場合、CPU810は、S480へ移行し、注目部分余白領域を補修の対象から除かずに、補修すべきであるという仮の判断を維持する。S460の判断結果がNoである場合、注目部分余白領域と対向部分余白領域とは、連続ではない。従って、注目部分余白領域と対向部分余白領域との間で、補修処理後の色の差が目立つことは、抑制される。そこで、そこで、CPU810は、注目部分余白領域を補修の対象から除かずに、補修すべきであるという仮の判断を維持する。 If the determination result of S460 is No, the CPU 810 shifts to S480 and maintains a tentative determination that the attention portion margin area should be repaired without being excluded from the repair target. When the judgment result of S460 is No, the attention portion margin region and the opposite portion margin region are not continuous. Therefore, it is suppressed that the color difference after the repair treatment is conspicuous between the attention portion margin region and the opposite portion margin region. Therefore, the CPU 810 maintains a tentative determination that the attention portion margin area should be repaired without being excluded from the repair target.

S480では、CPU810は、全ての部分余白領域の判断の処理が完了したか否かを判断する。未処理の部分余白領域が残っている場合(S480:No)、CPU810は、S400へ移行して、未処理の部分余白領域の処理を行う。全ての部分余白領域の処理が完了した場合(S480:Yes)、CPU810は、図7の処理(ひいては、S150(図2))を、終了する。 In S480, the CPU 810 determines whether or not the processing for determining all the partial margin areas has been completed. When the unprocessed partial margin area remains (S480: No), the CPU 810 shifts to S400 and processes the unprocessed partial margin area. When the processing of all the partial margin areas is completed (S480: Yes), the CPU 810 ends the processing of FIG. 7 (and by extension, S150 (FIG. 2)).

以上のように、図2のS130、S140、S150の処理において、注目部分余白領域の色を修正すべきと判断されるための条件は、注目部分余白領域に連続する領域を構成する部分余白領域と候補領域とが、色を修正すべきではないと判断される領域を含まないことを、含んでいる。従って、色が修正された領域に色が修正されない領域が接することが抑制される。この結果、色が修正された領域と色が修正されない領域との間の色の差が目立つことが、抑制される。 As described above, in the processing of S130, S140, and S150 of FIG. 2, the condition for determining that the color of the attention portion margin region should be corrected is the partial margin region constituting the region continuous with the attention portion margin region. And the candidate area include not including the area where it is judged that the color should not be corrected. Therefore, it is possible to prevent the region where the color is modified from coming into contact with the region where the color is not modified. As a result, the noticeable color difference between the color-corrected area and the color-uncorrected area is suppressed.

A−5.別の画像の処理例:
図8は、別の画像の処理例を示す説明図である。図8(A)〜図8(E)の説明図は、図3(A)〜図3(E)の説明図に、それぞれ対応している。図8(A)には、読取画像120が示されている。図3(A)の読取画像110との差異は、破れ221が長い点だけである。原稿画像22と外側画像32とのうち破れ221以外の部分は、図3(A)の原稿画像21と外側画像32との対応する部分と同じである。
A-5. Another image processing example:
FIG. 8 is an explanatory diagram showing an example of processing another image. The explanatory views of FIGS. 8 (A) to 8 (E) correspond to the explanatory views of FIGS. 3 (A) to 3 (E), respectively. FIG. 8A shows the scanned image 120. The only difference from the scanned image 110 in FIG. 3 (A) is that the tear 221 is long. The portion of the original image 22 and the outer image 32 other than the tear 221 is the same as the corresponding portion of the original image 21 and the outer image 32 in FIG. 3 (A).

図8(B)には、図2のS110で特定される辺421〜424が、示されている。図2のS110では、図3(B)の辺411〜414と同様に、原稿画像22の輪郭を示す辺421〜424が、特定される。矩形原稿領域220は、辺421〜424によって形成される輪郭420に囲まれる矩形領域である。矩形原稿領域220の外側の領域である余白領域320は、原稿画像22の外側の余白を示している。破れ221を示す領域223は、矩形原稿領域220に含まれている。 8 (B) shows sides 421 to 424 identified in S110 of FIG. In S110 of FIG. 2, the sides 421 to 424 showing the outline of the original image 22 are specified as in the sides 411 to 414 of FIG. 3 (B). The rectangular document area 220 is a rectangular area surrounded by the contour 420 formed by the sides 421 to 424. The margin area 320, which is an area outside the rectangular document area 220, indicates the outside margin of the document image 22. The area 223 showing the tear 221 is included in the rectangular document area 220.

図8(C)には、図2のS120で特定される候補領域が示されている。図示するように、破れ221を示す領域223が、候補領域として特定される。候補領域223は、辺423に接する領域である。 FIG. 8C shows a candidate region identified in S120 of FIG. As shown, the region 223 showing the tear 221 is specified as a candidate region. The candidate area 223 is an area tangent to the side 423.

図8(D)には、読取画像120の処理例が示されている。図中の長さL21は、候補領域223の、候補領域223に接する辺423からの長さ(ここでは、辺423に垂直な方向の長さ)である。図2のS130(ひいては、図4の処理)では、この長さL21に応じて、候補領域223を補修すべきか否かが、判断される。本実施例では、長さL21は、第1閾値Th1以上であることとする。この場合、図4のS210の判断結果がYesであるので、候補領域223は、補修の対象から除かれる(S230)。 FIG. 8D shows a processing example of the scanned image 120. The length L21 in the figure is the length of the candidate region 223 from the side 423 in contact with the candidate region 223 (here, the length in the direction perpendicular to the side 423). In S130 of FIG. 2 (and by extension, the process of FIG. 4), it is determined whether or not the candidate region 223 should be repaired according to the length L21. In this embodiment, the length L21 is equal to or greater than the first threshold value Th1. In this case, since the determination result of S210 in FIG. 4 is Yes, the candidate region 223 is excluded from the repair target (S230).

また、図8(D)には、図2のS135で特定される部分余白領域521〜524が、示されている。本実施例では、ユーザによって指定される幅W21〜W24は、図3(D)の幅W21〜W24と、それぞれ同じである。そして、図3(D)の実施例と同様に、矩形原稿領域220の4個の辺421〜424から、ユーザによって指定された幅W21〜W24だけ外側に位置する4個の辺421x〜424xで構成される矩形輪郭121sが、特定される。そして、矩形輪郭121sと矩形原稿領域220の輪郭420との間の領域520が、4個の辺421〜424にそれぞれ接する4個の部分余白領域521〜524に区分される。部分余白領域521〜524は、内側の辺421〜424と外側の辺421x〜424xとを上底および下底として有する台形の領域である。矩形原稿領域220と4個の部分余白領域521〜524とで構成される領域121は、出力画像に含まれる出力領域である(出力領域121と呼ぶ)。 Further, FIG. 8D shows a partial margin region 521 to 524 specified in S135 of FIG. In this embodiment, the widths W21 to W24 specified by the user are the same as the widths W21 to W24 in FIG. 3 (D), respectively. Then, as in the embodiment of FIG. 3D, the four sides 421x to 424x located outside the four sides 421 to 424 of the rectangular document area 220 by the widths W21 to W24 specified by the user. The rectangular contour 121s to be constructed is specified. Then, the region 520 between the rectangular contour 121s and the contour 420 of the rectangular original region 220 is divided into four partial margin regions 521 to 524 that are in contact with the four sides 421 to 424, respectively. The partial margin areas 521 to 524 are trapezoidal areas having inner sides 421 to 424 and outer sides 421x to 424x as upper and lower bases. The area 121 composed of the rectangular document area 220 and the four partial margin areas 521 to 524 is an output area included in the output image (referred to as an output area 121).

図2のS140(ひいては、図6の処理)では、部分余白領域521〜524(図8(D))を補修すべきか否かの仮の判断が行われる。部分余白領域521〜524の幅W21〜W24は、第2閾値Th2未満である(図6:S320)。従って、これらの部分余白領域521〜524は、この段階では、補修対象から除かれない(すなわち、補修すべきであると仮に判断される(S320:No))。そして、左側、上側、下側の3個の部分余白領域521、522、524には、候補領域は接していない(S355:No)。従って、3個の部分余白領域521、522、524に関しては、補修すべきであるという仮の判断結果が、維持される。右側の部分余白領域523には、候補領域223が接している(S355:Yes)。この候補領域223は、補修の非対象である(S370:Yes)。従って、部分余白領域523は、補修の対象から除かれる(S380)。 In S140 of FIG. 2 (and by extension, the process of FIG. 6), a tentative determination is made as to whether or not the partial margin areas 521 to 524 (FIG. 8 (D)) should be repaired. The widths W21 to W24 of the partial margin regions 521 to 524 are less than the second threshold Th2 (FIG. 6: S320). Therefore, these partial margin areas 521 to 524 are not excluded from the repair target at this stage (that is, it is tentatively determined that they should be repaired (S320: No)). The candidate regions do not touch the three partial margin regions 521, 522, and 524 on the left side, the upper side, and the lower side (S355: No). Therefore, the tentative judgment result that the three partial margin areas 521, 522, and 524 should be repaired is maintained. The candidate area 223 is in contact with the partial margin area 523 on the right side (S355: Yes). This candidate area 223 is not subject to repair (S370: Yes). Therefore, the partial margin area 523 is excluded from the repair target (S380).

図2のS150(ひいては、図7の処理)では、部分余白領域521〜524(図8(D))を補修すべきか否かの最終的な判断が行われる。左側の部分余白領域521が注目部分余白領域である場合、注目部分余白領域521は、補修の対象であり(S410:Yes)、幅W21は、ゼロよりも大きい(S420:Yes)。両隣の部分余白領域522、524は、補修の対象である(S430:No、S440:No)。対向部分余白領域523は、補修の非対象であり、その幅W23は、ゼロよりも大きい(S450:Yes)。隣の部分余白領域522、524の幅W22、W24は、ゼロよりも大きい(S460:Yes)。これらの結果、部分余白領域521は、補修の対象から除かれる(S470)。 In S150 of FIG. 2 (and by extension, the process of FIG. 7), a final determination is made as to whether or not the partial margin areas 521 to 524 (FIG. 8 (D)) should be repaired. When the left partial margin region 521 is the attention portion margin region, the attention portion margin region 521 is the target of repair (S410: Yes), and the width W21 is larger than zero (S420: Yes). The partial margin areas 522 and 524 on both sides are the targets of repair (S430: No, S440: No). The facing portion margin area 523 is not subject to repair, and its width W23 is larger than zero (S450: Yes). The widths W22 and W24 of the adjacent partial margin areas 522 and 524 are larger than zero (S460: Yes). As a result, the partial margin area 521 is excluded from the repair target (S470).

上側の部分余白領域522が注目部分余白領域である場合、注目部分余白領域522は、補修の対象であり(S410:Yes)、幅W22は、ゼロよりも大きい(S420:Yes)。隣の部分余白領域523は、補修の非対象であり、幅W23はゼロよりも大きい(S430:Yes)。これらの結果、部分余白領域522は、補修の対象から除かれる(S470)。 When the upper partial margin region 522 is the attention portion margin region, the attention portion margin region 522 is the target of repair (S410: Yes), and the width W22 is larger than zero (S420: Yes). The adjacent partial margin area 523 is not subject to repair, and the width W23 is greater than zero (S430: Yes). As a result, the partial margin area 522 is excluded from the repair target (S470).

下側の部分余白領域524が注目部分余白領域である場合、上側の部分余白領域522が注目部分余白領域である場合と同様に、処理が進行する。そして、部分余白領域524は、補修の対象から除かれる(S470)。 When the lower partial margin region 524 is the attention portion margin region, the process proceeds in the same manner as when the upper partial margin region 522 is the attention portion margin region. Then, the partial margin area 524 is excluded from the repair target (S470).

右側の部分余白領域523が注目部分余白領域である場合、部分余白領域523は、補修の対象ではない(S410:No)。従って、部分余白領域523を補修すべきではない、という仮の判断は、維持される。 When the partial margin area 523 on the right side is the partial margin area of interest, the partial margin area 523 is not the target of repair (S410: No). Therefore, the tentative determination that the partial margin area 523 should not be repaired is maintained.

このように、図2のS130、S140、S150によって、部分余白領域521〜524と候補領域223との全てが、補修すべきではないと判断される。そして、図2のS160(ひいては、図5の処理)では、これらの判断結果に従って、補修処理が行われる。 As described above, according to S130, S140, and S150 of FIG. 2, it is determined that all of the partial margin areas 521 to 524 and the candidate area 223 should not be repaired. Then, in S160 of FIG. 2 (and by extension, the process of FIG. 5), the repair process is performed according to these determination results.

図8(E)は、補修処理によって得られる出力画像122の例を示している。この画像122は、図8(D)の出力領域121の画像に補修処理を行うことによって得られる画像である。上述したように、部分余白領域521〜524と候補領域223との全てが、補修すべきではないと判断されている。従って、これらの領域521〜524、223の画像は、補修されずに、そのまま維持される(図5:S510:No)。 FIG. 8E shows an example of the output image 122 obtained by the repair process. This image 122 is an image obtained by performing a repair process on the image of the output region 121 of FIG. 8 (D). As described above, it is determined that all of the partial margin areas 521 to 524 and the candidate area 223 should not be repaired. Therefore, the images of these regions 521 to 524 and 223 are maintained as they are without being repaired (FIG. 5: S510: No).

このように、図4の処理で、候補領域223の長さL21が第1閾値Th1以上である場合には、候補領域223を補修すべきではないと判断される(S210:Yes)。仮に、大きな候補領域の色が補修処理によって修正される場合、色が修正される領域が大きいので、色が修正された領域が不自然に見える可能性がある。上記構成によれば、大きな候補領域に関しては、色を修正すべきではないと判断されるので、色が修正された領域が不自然に見えることを抑制できる。また、候補領域が大きい場合、候補領域は、意図しない破れではなく、意図的に切り取られた部分を示す可能性が高い。このような意図的に形成された部分の色の修正が抑制されるので、出力画像が不自然に見えることを抑制できる。 As described above, in the process of FIG. 4, when the length L21 of the candidate region 223 is equal to or larger than the first threshold value Th1, it is determined that the candidate region 223 should not be repaired (S210: Yes). If the color of a large candidate area is corrected by the repair process, the color-corrected area may look unnatural because the color-corrected area is large. According to the above configuration, it is determined that the color should not be corrected for the large candidate area, so that it is possible to suppress that the color-corrected area looks unnatural. Also, if the candidate area is large, the candidate area is likely to indicate a deliberately cut portion rather than an unintended tear. Since the correction of the color of the intentionally formed portion is suppressed, it is possible to suppress the output image from appearing unnatural.

また、図6の処理で、右側の部分余白領域523が注目部分余白領域である場合、S320では、注目部分余白領域523は、補修の対象であると仮に判断される。すなわち、注目部分余白領域523は、補修すべきではないと仮に判断するための条件である非対象仮条件(S320)を、満たしていない。この場合、S355〜S390では、注目部分余白領域523に接する候補領域であるゼロ個以上の隣接候補領域が、補修の対象ではない非対象候補領域を含むか否かが判断される。図8(D)の例では、注目部分余白領域523に接する候補領域223は、非対象候補領域である。このように、隣接候補領域が非対象候補領域を含む場合に(S370:Yes)、注目部分余白領域523は、補修の対象から除かれる(S380)。これにより、色が修正された部分余白領域に色が修正されない候補領域が接することが抑制される。この結果、色が修正されない候補領域が目立つことが、抑制される。 Further, in the process of FIG. 6, when the right partial margin area 523 is the attention partial margin region, in S320, it is tentatively determined that the attention partial margin region 523 is the target of repair. That is, the attention portion margin area 523 does not satisfy the non-target tentative condition (S320), which is a condition for tentatively determining that the repair should not be performed. In this case, in S355 to S390, it is determined whether or not zero or more adjacent candidate regions, which are candidate regions in contact with the attention portion margin region 523, include non-target candidate regions that are not the targets of repair. In the example of FIG. 8D, the candidate area 223 in contact with the attention portion margin area 523 is a non-target candidate area. In this way, when the adjacent candidate region includes the non-target candidate region (S370: Yes), the attention portion margin region 523 is excluded from the repair target (S380). As a result, it is possible to prevent the candidate area where the color is not corrected from contacting the partial margin area where the color is corrected. As a result, it is suppressed that the candidate area where the color is not corrected is conspicuous.

図8(F)は、仮に、候補領域223が補修されずに、部分余白領域521〜524が補修される場合に生成される画像122xの例を示している。図示するように、矩形原稿領域220の外側には、色が修正された部分余白領域521x〜524xが、配置されている。特に、候補領域223には、補修済の部分余白領域523xが、接している。これにより、画像122xにおいて、色が修正されていない候補領域223は、矩形原稿領域220の背景Bgと部分余白領域523xとに囲まれた孤島のように、示される。この結果、候補領域223は、意図せずに、目立ち得る。本実施例では、このように候補領域223が意図せずに目立つことが、抑制される。 FIG. 8F shows an example of an image 122x generated when the candidate region 223 is not repaired and the partial margin regions 521 to 524 are repaired. As shown in the figure, color-corrected partial margin areas 521x to 524x are arranged outside the rectangular document area 220. In particular, the repaired partial margin area 523x is in contact with the candidate area 223. As a result, in the image 122x, the candidate region 223 whose color is not corrected is shown as an isolated island surrounded by the background Bg of the rectangular original region 220 and the partial margin region 523x. As a result, the candidate region 223 can be unintentionally noticeable. In this embodiment, it is suppressed that the candidate region 223 is unintentionally conspicuous in this way.

また、図6の処理で、左側と上側と下側の部分余白領域521、522、524が注目部分余白領域である場合、注目部分余白領域521、522、524は、補修の対象であると仮に判断される(S310、S320:No、S355:No)。そして、図7の処理で、上側と下側の部分余白領域522、524が注目部分余白領域である場合、S430、S440では、注目部分余白領域522、524に接する隣の部分余白領域が、補修の非対象であるか否か、すなわち、補修すべきではないと判断されるか否かが、判断される。図8(D)の例では、隣の部分余白領域523は、補修の非対象であり、その幅W23は、ゼロより大きい。従って、S430、S440の少なくとも一方の判断結果が、Yesである。この場合、注目部分余白領域522、524は、補修の対象から除かれる(S470)。 Further, in the process of FIG. 6, when the left side, upper side, and lower side partial margin areas 521, 522, and 524 are the attention part margin areas, it is assumed that the attention part margin areas 521, 522, and 524 are the targets of repair. It is determined (S310, S320: No, S355: No). Then, in the process of FIG. 7, when the upper and lower partial margin areas 522 and 524 are the attention partial margin areas, in S430 and S440, the adjacent partial margin areas in contact with the attention partial margin areas 522 and 524 are repaired. It is judged whether or not it is not a target of the above, that is, whether or not it is judged that it should not be repaired. In the example of FIG. 8D, the adjacent partial margin area 523 is not subject to repair and its width W23 is greater than zero. Therefore, the determination result of at least one of S430 and S440 is Yes. In this case, the attention portion margin areas 522 and 524 are excluded from the repair target (S470).

また、図7の処理で、左の部分余白領域521が注目部分余白領域である場合、S430、S440では、注目部分余白領域521に接する隣の部分余白領域522、524が、補修の非対象であるか否か、すなわち、補修すべきではないと判断されるか否かが、判断される。部分余白領域522、524は、図2のS140で補修の対象であると仮に判断されているので、S430、S440の判断結果は、Noである。この場合、S450、S460では、隣の部分余白領域522、524を介して注目部分余白領域521に連続な対向部分余白領域523が、補修の非対象であるか否か、すなわち、補修すべきではないと判断されるか否かが、判断される。図8(D)の例では、対向部分余白領域523は補修の非対象である(S450:Yes)。そして、隣の部分余白領域522、524の幅W22、W24は、ゼロよりも大きい(S460:Yes)。この場合、注目部分余白領域521は、補修の対象から除かれる(S470) Further, in the process of FIG. 7, when the left partial margin area 521 is the attention partial margin area, in S430 and S440, the adjacent partial margin areas 522 and 524 in contact with the attention portion margin area 521 are not subject to repair. It is determined whether or not there is, that is, whether or not it is determined that the repair should not be performed. Since the partial margin areas 522 and 524 are tentatively determined to be the target of repair in S140 of FIG. 2, the determination results of S430 and S440 are No. In this case, in S450 and S460, whether or not the opposite partial margin region 523 continuous to the attention partial margin region 521 via the adjacent partial margin regions 522 and 524 is not subject to repair, that is, should be repaired. It is judged whether or not it is judged not to be. In the example of FIG. 8D, the facing portion margin area 523 is not subject to repair (S450: Yes). The widths W22 and W24 of the adjacent partial margin areas 522 and 524 are larger than zero (S460: Yes). In this case, the attention portion margin area 521 is excluded from the repair target (S470).

このように、注目部分余白領域に接する隣の部分余白領域と、隣の部分余白領域に接する対向部分余白領域と、の少なくとも一方が、色を修正すべきではないと判断される場合に、注目部分余白領域の色を修正すべきではないと、判断される。このように、注目部分余白領域に連続する他の部分余白領域の色を修正すべきではないと判断される場合に、注目部分余白領域の色を修正すべきでは無いと判断されるので、色が修正される部分余白領域と色が修正されない部分余白領域とが連続することが抑制される。この結果、色が修正される部分余白領域と色が修正されない部分余白領域とが連続することに起因して色の違いが目立つことが、抑制される。 In this way, when it is determined that at least one of the adjacent partial margin area in contact with the attention partial margin area and the opposite partial margin area in contact with the adjacent partial margin area should not be corrected in color, attention is paid. It is determined that the color of the partial margin area should not be modified. In this way, when it is determined that the color of the other partial margin area continuous with the attention portion margin area should not be corrected, it is determined that the color of the attention portion margin area should not be corrected. It is suppressed that the partial margin area where the color is corrected and the partial margin area where the color is not corrected are continuous. As a result, it is suppressed that the color difference is conspicuous due to the continuity of the partial margin area where the color is corrected and the partial margin area where the color is not corrected.

以上のように、図2のS130、S140、S150の処理では、1以上の部分余白領域と候補領域とのうちの注目部分余白領域に連続する領域を構成する領域であって、部分余白領域と候補領域とのうちの少なくとも1つの領域に関して、色を修正すべきではないと判断される場合に、注目部分余白領域の色を修正すべきではないと判断される。従って、色が修正された領域に色が修正されない領域が隣接することが抑制される。この結果、色が修正された領域と色が修正されない領域との間の色の差が目立つことが、抑制される。 As described above, in the processing of S130, S140, and S150 of FIG. 2, the region constitutes a region continuous with the attention portion margin region of one or more partial margin regions and the candidate region, and is referred to as the partial margin region. When it is determined that the color should not be modified with respect to at least one of the candidate regions, it is determined that the color of the attention portion margin region should not be modified. Therefore, it is suppressed that the area where the color is not corrected is adjacent to the area where the color is corrected. As a result, the noticeable color difference between the color-corrected area and the color-uncorrected area is suppressed.

A−6.別の画像の処理例:
図9は、別の画像の処理例を示す説明図である。図9(A)〜図9(E)の説明図は、図3(A)〜図3(E)の説明図に、それぞれ対応している。図9(A)には、読取画像130が示されている。読取画像130は、原稿を示す原稿画像23と、原稿画像23の外側の画像である外側画像33と、を含む。図3(A)の読取画像110とは異なり、原稿画像23には、2個の破れ231、232が形成されている。また、原稿画像23の幅は、図3(A)の原稿画像21の幅よりも、小さい。
A-6. Another image processing example:
FIG. 9 is an explanatory diagram showing an example of processing another image. The explanatory views of FIGS. 9 (A) to 9 (E) correspond to the explanatory views of FIGS. 3 (A) to 3 (E), respectively. FIG. 9A shows the scanned image 130. The scanned image 130 includes a manuscript image 23 showing a manuscript and an outer image 33 which is an image outside the manuscript image 23. Unlike the scanned image 110 of FIG. 3A, two tears 231 and 232 are formed in the original image 23. Further, the width of the original image 23 is smaller than the width of the original image 21 of FIG. 3 (A).

図9(B)には、図2のS110で特定される辺431〜434が、示されている。図2のS110では、図3(B)の辺411〜414と同様に、原稿画像23の輪郭を示す辺431〜434が、特定される。矩形原稿領域230は、辺431〜434によって形成される輪郭430に囲まれる矩形領域である。矩形原稿領域230の外側の領域である余白領域330は、原稿画像23の外側の余白を示している。破れ231、232を示す領域233、234は、矩形原稿領域230に含まれている。 9 (B) shows sides 431 to 434 identified in S110 of FIG. In S110 of FIG. 2, the sides 431 to 434 showing the outline of the original image 23 are specified as in the sides 411 to 414 of FIG. 3 (B). The rectangular document area 230 is a rectangular area surrounded by the contour 430 formed by the sides 431 to 434. The margin area 330, which is an area outside the rectangular document area 230, indicates the outside margin of the document image 23. Areas 233 and 234 showing tears 231 and 232 are included in the rectangular document area 230.

図9(C)には、図2のS120で特定される候補領域が示されている。図示するように、破れ231、232を示す領域233、234が、候補領域として特定される。右側の候補領域233は、右側の辺433に接する領域であり、左側の候補領域234は、左側の辺431に接する領域である。 FIG. 9C shows a candidate region identified in S120 of FIG. As shown, the regions 233 and 234 showing the tears 231 and 232 are specified as candidate regions. The candidate area 233 on the right side is an area in contact with the side 433 on the right side, and the candidate area 234 on the left side is an area in contact with the side 431 on the left side.

図9(D)には、読取画像130の処理例が示されている。図中の長さL31は、候補領域233の、候補領域233に接する辺433に垂直な方向の長さである。長さL32は、候補領域234の、候補領域234に接する辺431に垂直な方向の長さである。図2のS130(ひいては、図4の処理)では、この長さL31、L32に応じて、候補領域233、234を補修すべきか否かが、判断される。本実施例では、長さL31、L32は、それぞれ、第1閾値Th1未満であることとする。この場合、図4のS210の判断結果がNoであるので、候補領域233、234は、いずれも、補修の対象として選択される(S220)。 FIG. 9D shows a processing example of the scanned image 130. The length L31 in the figure is the length of the candidate region 233 in the direction perpendicular to the side 433 in contact with the candidate region 233. The length L32 is the length of the candidate region 234 in the direction perpendicular to the side 431 in contact with the candidate region 234. In S130 of FIG. 2 (and by extension, the process of FIG. 4), it is determined whether or not the candidate regions 233 and 234 should be repaired according to the lengths L31 and L32. In this embodiment, the lengths L31 and L32 are each less than the first threshold Th1. In this case, since the determination result of S210 in FIG. 4 is No, all of the candidate regions 233 and 234 are selected as targets for repair (S220).

また、図8(D)には、図2のS135で特定される部分余白領域531〜534が、示されている。本実施例では、左側の幅W21は、ゼロより大きく、第2閾値Th2(図6)未満であり、上側と下側の幅W22、W24は、ゼロであり、右側の幅W23は、第2閾値Th2以上である。矩形原稿領域230の4個の辺431〜434から、ユーザによって指定された幅W21〜W24だけ外側に位置する4個の辺431x〜434xで構成される矩形輪郭131sが、特定される。そして、矩形輪郭131sと矩形原稿領域230の輪郭430との間の領域530が、部分余白領域531〜534に区分される。部分余白領域531〜534は、内側の辺431〜434と外側の辺431x〜434xとを上底および下底として有する台形の領域である。なお、上側と下側の辺432x、434xは、元の辺432、434に重なっている。上側と下側の部分余白領域532、534は、幅がゼロの領域である。幅がゼロである領域532、534は、実際には形成されない。従って、左側の部分余白領域531と、右側の部分余白領域533とは、矩形原稿領域230の外側において、連続せずに、互いに離れている。矩形原稿領域230と、ゼロより大きい幅を有する部分余白領域531、533とで構成される領域131は、出力画像に含まれる出力領域である(出力領域131と呼ぶ)。 Further, FIG. 8D shows a partial margin region 513 to 534 specified in S135 of FIG. In this embodiment, the left width W21 is greater than zero and less than the second threshold Th2 (FIG. 6), the upper and lower widths W22 and W24 are zero, and the right width W23 is the second. The threshold is Th2 or higher. From the four sides 431 to 434 of the rectangular document area 230, the rectangular contour 131s composed of the four sides 431x to 434x located outside by the widths W21 to W24 specified by the user is specified. Then, the area 530 between the rectangular contour 131s and the contour 430 of the rectangular document area 230 is divided into partial margin areas 531 to 534. The partial margin region 513 to 534 is a trapezoidal region having an inner side 431 to 434 and an outer side 431x to 434x as an upper base and a lower base. The upper and lower sides 432x and 434x overlap the original sides 432 and 434. The upper and lower partial margin areas 532 and 534 are areas having a width of zero. Regions 532, 534 with zero width are not actually formed. Therefore, the left partial margin region 531 and the right partial margin region 533 are not continuous and are separated from each other outside the rectangular original region 230. The area 131 composed of the rectangular document area 230 and the partial margin areas 531 and 533 having a width larger than zero is an output area included in the output image (referred to as an output area 131).

図2のS140(ひいては、図6の処理)では、部分余白領域531〜534(図9(D))を補修すべきか否かの仮の判断が行われる。 In S140 of FIG. 2 (and by extension, the process of FIG. 6), a tentative determination is made as to whether or not the partial margin area 531 to 534 (FIG. 9 (D)) should be repaired.

左側の部分余白領域531の幅W21は、第2閾値Th2未満である(図6:S320:No)。従って、部分余白領域531は、この段階では、補修すべきであると仮に判断される。この部分余白領域531に接触する候補領域234は、補修の対象である(S370:No)。従って、部分余白領域531を補修すべきであるという仮の判断は、維持される。 The width W21 of the left partial margin region 531 is less than the second threshold Th2 (FIG. 6: S320: No). Therefore, it is tentatively determined that the partial margin area 531 should be repaired at this stage. The candidate region 234 in contact with the partial margin region 531 is the target of repair (S370: No). Therefore, the tentative determination that the partial margin region 531 should be repaired is maintained.

右側の部分余白領域533の幅W23は、第2閾値Th2以上である(S320:Yes)。従って、S330で、部分余白領域533は、補修の対象から除かれる。 The width W23 of the right partial margin region 533 is equal to or greater than the second threshold value Th2 (S320: Yes). Therefore, in S330, the partial margin area 533 is excluded from the repair target.

上側と下側の部分余白領域532、534の幅W22、W24は、ゼロ、すなわち、第2閾値Th2未満である(S320:No)。従って、部分余白領域532、534は、この段階では、補修すべきであると仮に判断される。また、これらの部分余白領域532、534の幅W22、W24は、ゼロである(S350:No)。従って、部分余白領域532、534を補修すべきであるという仮の判断は、維持される。 The widths W22 and W24 of the upper and lower partial margin regions 532 and 534 are zero, that is, less than the second threshold Th2 (S320: No). Therefore, it is tentatively determined that the partial margin areas 532 and 534 should be repaired at this stage. Further, the widths W22 and W24 of these partial margin regions 532 and 534 are zero (S350: No). Therefore, the tentative determination that the partial margin areas 532 and 534 should be repaired is maintained.

図2のS150(ひいては、図7の処理)では、部分余白領域531〜534(図9(D))を補修すべきか否かの最終的な判断が行われる。左側の部分余白領域531が注目部分余白領域である場合、注目部分余白領域531は、補修の対象であり(S410:Yes)、幅W21は、ゼロよりも大きい(S420:Yes)。両隣の部分余白領域522、524に関しては、幅W22、W24がゼロである(S430:No、S440:No)。対向部分余白領域533は、補修の非対象であり、その幅W23は、ゼロよりも大きい(S450:Yes)、隣の部分余白領域532、534の幅W22、W24は、ゼロである(S460:No)。これらの結果、部分余白領域521を補修すべきという仮の判断結果は、維持される。 In S150 of FIG. 2 (and by extension, the process of FIG. 7), a final determination is made as to whether or not the partial margin area 531 to 534 (FIG. 9 (D)) should be repaired. When the left partial margin region 531 is the attention portion margin region, the attention portion margin region 531 is the target of repair (S410: Yes), and the width W21 is larger than zero (S420: Yes). With respect to the partial margin areas 522 and 524 on both sides, the widths W22 and W24 are zero (S430: No, S440: No). The opposite partial margin area 533 is not subject to repair, its width W23 is larger than zero (S450: Yes), and the widths W22 and W24 of the adjacent partial margin areas 532 and 534 are zero (S460: Yes). No). As a result, the tentative judgment result that the partial margin area 521 should be repaired is maintained.

このように、注目部分余白領域531の対向部分余白領域533が補修の非対象である場合であっても、注目部分余白領域531と対向部分余白領域533が、ゼロより大きい幅の共通の部分余白領域に接していない場合には、注目部分余白領域531を補修すべきという仮の判断結果は、維持される。この理由は、注目部分余白領域531と対向部分余白領域533が、矩形原稿領域230の外側において、連続せずに離れている場合には、注目部分余白領域531と対向部分余白領域533との間の補修処理後の色の差が目立つことが、抑制されるからである。 In this way, even when the opposite portion margin region 533 of the attention portion margin region 531 is not the target of repair, the attention portion margin region 531 and the opposite portion margin region 533 have a common partial margin having a width larger than zero. When not in contact with the region, the tentative determination result that the attention portion margin region 531 should be repaired is maintained. The reason for this is that when the attention portion margin area 531 and the facing portion margin region 533 are separated from each other outside the rectangular original region 230 without being continuous, the attention portion margin region 531 and the facing portion margin area 533 are separated from each other. This is because the conspicuous color difference after the repair treatment is suppressed.

上側と下側の部分余白領域532、534に関しては、幅W22、W24がゼロであるので(S420:No)、部分余白領域532、534を補修すべきであるという仮の判断は、維持される。右側の部分余白領域533に関しては、部分余白領域533は補修の対象ではないので(S410:No)、部分余白領域533を補修すべきではないという仮の判断結果は、維持される。 With respect to the upper and lower partial margin areas 532 and 534, since the widths W22 and W24 are zero (S420: No), the tentative judgment that the partial margin areas 532 and 534 should be repaired is maintained. .. Regarding the partial margin area 533 on the right side, since the partial margin area 533 is not the target of repair (S410: No), the tentative determination result that the partial margin area 533 should not be repaired is maintained.

図2のS160(ひいては、図5の処理)では、これらの判断結果に従って、補修処理が行われる。 In S160 of FIG. 2 (and by extension, the process of FIG. 5), the repair process is performed according to these determination results.

図9(E)は、補修処理によって得られる出力画像132の例を示している。この画像132は、図9(D)の出力領域131の画像に補修処理を行うことによって得られる画像である。領域230x、531x、234xは、図9(D)の領域230x、531x、234xに補修処理を行って得られる画像を、それぞれ示している。 FIG. 9E shows an example of the output image 132 obtained by the repair process. This image 132 is an image obtained by performing a repair process on the image of the output region 131 of FIG. 9 (D). The regions 230x, 533x, and 234x show images obtained by performing repair processing on the regions 230x, 533x, and 234x in FIG. 9 (D), respectively.

上述したように、左側の部分余白領域531と候補領域234とは、補修すべきと判断されている。従って、部分余白領域531は補修され(S510:Yes、S520)、そして、部分余白領域531に接する候補領域234も、補修される(S530)。補修済の画像132(図9(E))において、矩形原稿領域230xの背景Bgと候補領域234xとの境界と、矩形原稿領域230xの背景Bgと部分余白領域531xとの境界とは、目立たなくなる。 As described above, it is determined that the left partial margin area 531 and the candidate area 234 should be repaired. Therefore, the partial margin region 531 is repaired (S510: Yes, S520), and the candidate region 234 in contact with the partial margin region 531 is also repaired (S530). In the repaired image 132 (FIG. 9E), the boundary between the background Bg of the rectangular document area 230x and the candidate area 234x and the boundary between the background Bg of the rectangular document area 230x and the partial margin area 531x become inconspicuous. ..

右側の部分余白領域533は、補修すべきでないと判断されている。従って、部分余白領域533は補修されず(図5:S510:No)、そして、部分余白領域533に接する候補領域233も、補修されない。 It has been determined that the right partial margin area 533 should not be repaired. Therefore, the partial margin region 533 is not repaired (FIG. 5: S510: No), and the candidate region 233 in contact with the partial margin region 533 is also not repaired.

このように、部分余白領域の幅が第2閾値Th2以上である場合(図6:S320:Yes)、部分余白領域は、補修すべきでないと判断される(図6:S330、図7:S410:No)。従って、ユーザの指示に応じて設けられる大きな部分余白領域は、補修の対象から除かれるので、色が修正された領域が不自然に見えることを抑制できる。 As described above, when the width of the partial margin region is equal to or larger than the second threshold value Th2 (FIG. 6: S320: Yes), it is determined that the partial margin region should not be repaired (FIG. 6: S330, FIG. 7: S410). : No). Therefore, since the large partial margin area provided according to the user's instruction is excluded from the repair target, it is possible to prevent the color-corrected area from appearing unnatural.

また、図6の処理で、部分余白領域を補修すべきでないと仮に判断される場合(S320:Yes、S330、S370:Yes、S380)、図7の処理では、その部分余白領域に接する候補領域が補修の非対象の候補領域を含むか否かを判断する処理(S355〜S390)が行われずに、部分余白領域を補修すべきでないという仮の判断結果が、最終的な判断結果として採用される(S410:No)。従って、処理速度の低下を抑制しつつ、適切な判断が可能である。 Further, when it is tentatively determined in the process of FIG. 6 that the partial margin area should not be repaired (S320: Yes, S330, S370: Yes, S380), in the process of FIG. 7, the candidate area in contact with the partial margin area is tentatively determined. The tentative judgment result that the partial margin area should not be repaired is adopted as the final judgment result without performing the process (S355-S390) for determining whether or not includes the non-target candidate area for repair. (S410: No). Therefore, it is possible to make an appropriate judgment while suppressing a decrease in processing speed.

B.変形例:
(1)図4のS210で、候補領域の色を修正すべきではないと判断するための条件は、種々の条件であってよい。この条件は、例えば、候補領域に接する辺に平行な方向の候補領域の長さが、閾値以上であることを、含んでよく、また、候補領域の面積(例えば、画素数)が閾値以上であることを含んでよい。一般的には、候補領域が大きいことを示す種々の条件が、用いられてよい。
B. Modification example:
(1) In S210 of FIG. 4, the conditions for determining that the color of the candidate region should not be corrected may be various conditions. This condition may include, for example, that the length of the candidate region in the direction parallel to the side tangent to the candidate region is equal to or greater than the threshold value, and the area of the candidate region (for example, the number of pixels) is equal to or greater than the threshold value. It may include that there is. In general, various conditions indicating that the candidate region is large may be used.

(2)図6のS320で、部分余白領域の色を修正すべきではないと仮に判断するための条件は、種々の条件であってよい。この条件は、例えば、部分余白領域の面積(例えば、画素数)が閾値以上であることを含んでよい。一般的には、部分余白領域が大きいことを示す種々の条件が、用いられてよい。 (2) In S320 of FIG. 6, the conditions for tentatively determining that the color of the partial margin region should not be corrected may be various conditions. This condition may include, for example, that the area of the partial margin region (for example, the number of pixels) is equal to or larger than the threshold value. In general, various conditions indicating that the partial margin area is large may be used.

また、図6の処理において、注目部分余白領域の色を修正すべきではないと仮に判断するための条件は、S320、S355、S370を用いる条件、すなわち、「注目部分余白領域の幅が第2閾値Th2以上である(S320:Yes)、または、注目部分余白領域に補修の対象の候補領域が接している(S355:Yes、かつ、S370:Yes)」に代えて、他の種々の条件であってよい。注目部分余白領域の色を修正すべきではないと仮に判断するための条件は、例えば、注目部分余白領域の色と、矩形原稿領域の背景Bgの色と、の間の差が閾値未満であることを含んでもよい。 Further, in the process of FIG. 6, the condition for tentatively determining that the color of the attention portion margin region should not be corrected is the condition of using S320, S355, and S370, that is, "the width of the attention portion margin region is the second. Instead of the threshold Th2 or more (S320: Yes), or the candidate area to be repaired is in contact with the attention portion margin area (S355: Yes, and S370: Yes) ”, under various other conditions. It may be there. The condition for tentatively determining that the color of the attention area margin area should not be corrected is, for example, that the difference between the color of the attention area margin area and the background Bg color of the rectangular original area is less than the threshold value. May include that.

一般的には、図6の処理では、注目部分余白領域の色を修正すべきか否かは、他の部分余白領域とは独立に、判断されてよい。他の部分余白領域とは独立に行われる判断の結果は、仮の判断結果として、利用されてよい。そして、図7の処理のように、色が修正される部分余白領域と色が修正されない部分余白領域とが、矩形原稿領域の外側で連続しないように、注目部分余白領域の最終的な判断結果を、他の部分余白領域の仮の判断結果を考慮して調整する処理が、行われてよい。 Generally, in the process of FIG. 6, whether or not the color of the attention portion margin region should be corrected may be determined independently of the other partial margin regions. The result of the judgment made independently of the other partial margin area may be used as a tentative judgment result. Then, as in the process of FIG. 7, the final determination result of the attention portion margin region so that the partial margin region where the color is corrected and the partial margin region where the color is not corrected are not continuous outside the rectangular original region. May be adjusted in consideration of the tentative determination result of the other partial margin area.

なお、判断結果を調整する処理は、図7の処理に代えて、他の種々の処理であってよい。一般的には、注目部分余白領域の色を修正すべきと判断されるための条件は、1以上の部分余白領域と候補領域とのうちの注目部分余白領域に連続する領域を構成する領域が、色を修正すべきではないと判断される領域を含まないことを、含む種々の条件であってよい。また、注目部分余白領域の色を修正すべきではないと判断するための条件は、1以上の部分余白領域と前記候補領域とのうちの注目部分余白領域に連続する領域を構成する領域であって、部分余白領域と候補領域とのうちの少なくとも1つの領域に関して、色を修正すべきではないと判断されることを含む、種々の条件であってよい。 The process of adjusting the determination result may be various other processes instead of the process of FIG. 7. In general, the condition for determining that the color of the attention portion margin area should be corrected is that the region constituting the region continuous with the attention portion margin region among one or more partial margin regions and the candidate region , Various conditions may be included, including not including a region where it is determined that the color should not be modified. Further, the condition for determining that the color of the attention portion margin region should not be corrected is an region constituting a region continuous with the attention portion margin region of one or more partial margin regions and the candidate region. Therefore, various conditions may be used, including that it is determined that the color should not be corrected with respect to at least one region of the partial margin region and the candidate region.

なお、図9(D)に示すように、部分余白領域の幅は、ゼロであり得る。このように幅がゼロである部分余白領域は、出力画像内に実際に形成される領域ではなく、仮想的な領域である。従って、隣り合う2つの部分余白領域の少なくとも一方の幅がゼロである場合、それら2つの部分余白領域は、連続な領域を形成していない、ということができる。 As shown in FIG. 9D, the width of the partial margin region can be zero. The partial margin area having a width of zero in this way is not an area actually formed in the output image, but a virtual area. Therefore, when the width of at least one of the two adjacent partial margin regions is zero, it can be said that the two partial margin regions do not form a continuous region.

(3)部分余白領域の幅がゼロより大きい場合であっても、幅が小さい場合には、ユーザが目視で部分余白領域を認識することが難しい場合がある。例えば、出力画像の全体の大きさに対する部分余白領域の幅が小さい場合、出力画像の全体を観察するユーザは、小さい幅の部分余白領域を認識できない場合がある。この場合、部分余白領域に他の小さい幅の部分余白領域が接している場合であっても、ユーザにとっては、部分余白領域に小さい幅の部分余白領域が連続していることを認識することが、困難であり得る。 (3) Even when the width of the partial margin area is larger than zero, if the width is small, it may be difficult for the user to visually recognize the partial margin area. For example, when the width of the partial margin area with respect to the total size of the output image is small, the user who observes the entire output image may not be able to recognize the small width partial margin area. In this case, even if the partial margin area is in contact with another small width partial margin area, the user can recognize that the partial margin area is continuous with the small width partial margin area. , Can be difficult.

このように小さい幅の部分余白領域を介して2つの大きな部分余白領域が接続されている場合、ユーザは、2つの大きな部分余白領域が離間しているように、認識し得る。従って、図6、図7の処理は、小さい幅の部分余白領域を、他の部分余白領域と連続な領域を形成しない領域として、扱ってよい。例えば、図6のS350、図7のS420、S430、S440、S450、S460の条件において、「幅がゼロより大きい」は、「幅が基準幅よりも大きい」に置換されてよい。ここで、基準幅は、ゼロであってよく、ゼロより大きい値であってよい。基準幅は、ユーザが目視で部分余白領域を認識し得るように、決定されてよい。例えば、基準幅は、出力画像の縦と横とのうちの短い方の長さの1/20以下であることが好ましく、1/50以下であることが特に好ましく、1/100以下であることが更に好ましく、ゼロであることが最も好ましい。 When two large partial margin areas are connected via such a small width partial margin area, the user can recognize that the two large partial margin areas are separated from each other. Therefore, in the processing of FIGS. 6 and 7, the small-width partial margin region may be treated as a region that does not form a continuous region with the other partial margin region. For example, under the conditions of S350 in FIG. 6 and S420, S430, S440, S450, and S460 in FIG. 7, "width is larger than zero" may be replaced with "width is larger than the reference width". Here, the reference width may be zero and may be a value larger than zero. The reference width may be determined so that the user can visually recognize the partial margin area. For example, the reference width is preferably 1/20 or less, particularly preferably 1/50 or less, and 1/100 or less of the shorter length of the output image. Is more preferable, and most preferably zero.

いずれの場合も、図2のS130、S140、S150の処理において、注目部分余白領域の色を修正すべきと判断するための条件は、1以上の部分余白領域と候補領域とのうちの注目部分余白領域と予め決められた連続関係にある領域を構成する領域が、色を修正すべきではないと判断される領域を含まないこと、を含む種々の条件であってよい。ここで、「予め決められた連続関係」は、以下のような関係である。すなわち、複数の部分余白領域が順番に接続され、そして、全ての部分余白領域のそれぞれの幅が基準幅よりも大きい場合に、複数の部分余白領域は、予め決められた連続関係にある。また、部分余白領域に候補領域が接しており、その部分余白領域の幅が基準幅よりも大きい場合に、部分余白領域と候補領域とは、予め決められた連続関係にある。そして、予め決められた連続関係にある複数の部分余白領域のうちの1つの部分余白領域に候補領域が接している場合には、複数の部分余白領域と候補領域とは、予め決められた連続関係にある。 In any case, in the processing of S130, S140, and S150 of FIG. 2, the condition for determining that the color of the attention portion margin region should be corrected is the attention portion of one or more partial margin regions and the candidate region. It may be various conditions including that the region constituting the region having a predetermined continuous relationship with the margin region does not include the region where it is determined that the color should not be corrected. Here, the "predetermined continuous relationship" is the following relationship. That is, when a plurality of partial margin areas are connected in order and the widths of all the partial margin areas are larger than the reference width, the plurality of partial margin areas have a predetermined continuous relationship. Further, when the candidate area is in contact with the partial margin area and the width of the partial margin area is larger than the reference width, the partial margin area and the candidate area have a predetermined continuous relationship. When the candidate area is in contact with one of the plurality of partial margin areas having a predetermined continuous relationship, the plurality of partial margin areas and the candidate area are continuously determined in advance. There is a relationship.

また、図2のS130、S140、S150の処理において、1以上の部分余白領域と候補領域とのうちの注目部分余白領域と予め決められた連続関係にある領域を構成する領域であって、部分余白領域と候補領域とのうちの少なくとも1つの領域に関して、色を修正すべきではないと判断される場合に、注目部分余白領域の色を修正すべきではないと判断されてよい。 Further, in the processing of S130, S140, and S150 of FIG. 2, it is a region constituting a region having a predetermined continuous relationship with the attention portion margin region of one or more partial margin regions and the candidate region, and is a portion. When it is determined that the color should not be modified with respect to at least one of the margin region and the candidate region, it may be determined that the color of the attention portion margin region should not be modified.

(4)矩形原稿領域内の領域であって原稿ではない領域の候補である候補領域を特定する方法は、上記実施例の方法に代えて、原稿ではない領域を特定可能な他の種々の方法であってよい。例えば、輝度以外の他の色成分が、利用されてよい(色相、彩度など)。一般的には、1以上色成分のそれぞれの範囲であって原稿の外側の余白を示す色の範囲である余白色範囲を用いて、候補領域が特定されてよい。注目画素の1以上の色成分のそれぞれの色値が、対応する色成分の余白色範囲内にある場合に、注目画素は、原稿を示さない画素に分類される。注目画素の少なくとも1つの色成分の色値が、その色成分の余白色範囲外にある場合に、注目画素は、原稿を示す画素に分類される。そして、原稿を示さない複数の画素が連続する領域であって、矩形原稿領域の辺(すなわち、外縁)に接する領域が、候補領域として特定されてよい。 (4) The method of specifying a candidate area that is a candidate for an area that is not a manuscript but is an area in the rectangular manuscript area is different from the method of the above embodiment, and various other methods that can specify a non-manuscript area It may be. For example, color components other than luminance may be utilized (hue, saturation, etc.). In general, a candidate region may be specified by using a marginal white range, which is a range of one or more color components and is a color range indicating a margin outside the original. When each color value of one or more color components of the pixel of interest is within the marginal white range of the corresponding color component, the pixel of interest is classified as a pixel that does not indicate the original. When the color value of at least one color component of the pixel of interest is outside the marginal white range of that color component, the pixel of interest is classified as a pixel indicating a document. Then, a region in which a plurality of pixels that do not indicate the original are continuous and is in contact with the side (that is, the outer edge) of the rectangular original region may be specified as a candidate region.

また、上記の実施例では、候補領域を特定する処理(図2:S120)では、矩形原稿領域の外側の余白領域を用いずに、矩形原稿領域を用いて、候補領域が特定される。ただし、矩形原稿領域に加えて、余白領域を用いて、候補領域が特定されてよい。例えば、CPU810は、原稿を示す画素と原稿を示さない画素とを特定するために利用される余白色範囲を、予め決められた範囲ではなく、余白領域を解析することによって、決定してよい。例えば、余白領域内の複数の画素の各色成分のヒストグラムのそれぞれの最頻値を中心とする所定幅の色範囲が、余白色範囲として利用されてよい。 Further, in the above embodiment, in the process of specifying the candidate area (FIG. 2: S120), the candidate area is specified by using the rectangular original area without using the margin area outside the rectangular original area. However, a candidate area may be specified by using a margin area in addition to the rectangular document area. For example, the CPU 810 may determine the margin white range used for identifying the pixels showing the original and the pixels not showing the original by analyzing the margin area instead of the predetermined range. For example, a color range having a predetermined width centered on the mode of each of the histograms of each color component of a plurality of pixels in the margin region may be used as the margin white range.

(5)色を修正すべきと判断された領域の色を修正する処理は、図5で説明した処理に代えて、種々の処理であってよい。例えば、図5の処理において、補修対象の候補領域がゼロの幅を有する部分余白領域(より一般的には、上記の基準幅以下の幅を有する部分余白領域)に接する場合には、その候補領域の色を修正しないこととしてもよい。また、補修対象の候補領域の色は、その候補領域に接する部分余白領域が補修の対象であるか否かに拘わらずに、修正されることとしてもよい。 (5) The process of correcting the color of the region determined to be corrected may be various processes instead of the process described with reference to FIG. For example, in the process of FIG. 5, when the candidate area to be repaired touches a partial margin area having a width of zero (more generally, a partial margin area having a width equal to or less than the above reference width), the candidate area is the candidate. The color of the area may not be modified. Further, the color of the candidate area to be repaired may be corrected regardless of whether or not the partial margin area in contact with the candidate area is the target of repair.

また、読取画像内における余白領域の幅が、ユーザによって指定された部分余白領域の幅よりも、小さい場合があり得る。例えば、図3(D)の画像例において、読取画像110の上側の縁118が、矩形原稿領域210の上側の辺412から幅W22だけ外側に位置する辺412xよりも、内側に位置する場合がある。すなわち、出力領域111の一部が、読取画像110の外にはみ出る場合がある。このような場合、CPU810は、補修処理(図2のS160)において、出力領域のうちの読取画像の外にはみ出た部分を、補修する処理(すなわち、追加する処理)を実行してよい。CPU810は、例えば、はみ出た部分の画素の色値を、はみ出た部分を含む部分余白領域の色値と同じ色値に、修正してよい。はみ出た部分が、補修の対象の部分余白領域に含まれる場合、はみ出た部分の画素の色値は、補修済の部分余白領域の画素の色値と同じ色値に、修正される。はみ出た部分が、補修の非対象の部分余白領域に含まれる場合、はみ出た部分の画素の色値は、未補修の部分余白領域の画素の色値と同じ色値に、修正される。ただし、CPU810は、出力領域のうちの読取画像の外にはみ出た部分を、補修(ここでは、追加)する代わりに、出力領域から削除してもよい。すなわち、出力領域のうちの読取画像に重なる部分が、最終的な出力領域として用いられてよい。 Further, the width of the margin area in the scanned image may be smaller than the width of the partial margin area specified by the user. For example, in the image example of FIG. 3D, the upper edge 118 of the scanned image 110 may be located inside the side 412x located outside the upper side 412 of the rectangular document area 210 by the width W22. is there. That is, a part of the output area 111 may protrude outside the scanned image 110. In such a case, in the repair process (S160 of FIG. 2), the CPU 810 may execute a process of repairing (that is, a process of adding) a portion of the output area that extends outside the scanned image. For example, the CPU 810 may modify the color value of the pixel of the protruding portion to the same color value as the color value of the partial margin area including the protruding portion. When the protruding portion is included in the partial margin area to be repaired, the color value of the pixel of the protruding portion is corrected to the same color value as the color value of the pixel of the repaired partial margin area. When the protruding portion is included in the non-repaired partial margin area, the color value of the pixel of the protruding portion is corrected to the same color value as the color value of the pixel of the unrepaired partial margin area. However, the CPU 810 may delete the portion of the output area that extends outside the scanned image from the output area instead of repairing (adding it here). That is, the portion of the output region that overlaps the scanned image may be used as the final output region.

(6)画像処理は、上記の処理に代えて、他の種々の処理であってよい。例えば、読取画像に対して、原稿画像は、傾き得る。この場合、CPU810は、原稿画像の傾きを補正する傾き補正を行ってよい。傾き補正は、画像処理の任意の段階で行われてよい。例えば、CPU810は、図2のS110とS120との間で、S110で特定された辺に応じて、読取画像に対する原稿画像の傾きを補正する傾き補正を行ってよい。そして、CPU810は、傾き補正済の読取画像を表す画像データを用いて、S120以降の処理を実行してよい。また、矩形原稿領域の辺を特定する処理は、上記の処理に代えて、他の種々の処理であってよい。例えば、CPU810は、最小二乗法を用いて、複数のエッジ画素の配置を近似する線分を特定し、特定された線分を辺として採用してよい。 (6) The image processing may be various other processing instead of the above processing. For example, the original image can be tilted with respect to the scanned image. In this case, the CPU 810 may perform tilt correction to correct the tilt of the original image. Tilt correction may be performed at any stage of image processing. For example, the CPU 810 may perform tilt correction between S110 and S120 in FIG. 2 to correct the tilt of the original image with respect to the scanned image according to the side specified in S110. Then, the CPU 810 may execute the processing after S120 using the image data representing the tilt-corrected read image. Further, the process of specifying the side of the rectangular document area may be various other processes instead of the above process. For example, the CPU 810 may specify a line segment that approximates the arrangement of a plurality of edge pixels by using the least squares method, and adopt the specified line segment as an edge.

また、図2のS100では、CPU810は、矩形原稿領域の四方に配置される4つの部分余白領域のそれぞれの幅(例えば、図3(D)の4つの部分余白領域511〜514のそれぞれの幅W21〜W24)を、ユーザの指示に応じて、個別に決定する。これに代えて、CPU810は、4つの部分余白領域に共通の1つの幅を、ユーザの指示に応じて決定してもよい。また、部分余白領域の幅は、ユーザの指示に応じて決定される代わりに、予め決められていてもよい。 Further, in S100 of FIG. 2, the CPU 810 has a width of each of the four partial margin areas arranged on all four sides of the rectangular document area (for example, the width of each of the four partial margin areas 511 to 514 of FIG. 3D). W21 to W24) are individually determined according to the user's instruction. Instead, the CPU 810 may determine one width common to the four partial margin areas according to the user's instruction. Further, the width of the partial margin area may be predetermined instead of being determined according to the instruction of the user.

(7)図1の画像処理装置は、パーソナルコンピュータとは異なる種類の装置(例えば、デジタルカメラ、スキャナ、スマートフォン)であってもよい。また、画像処理装置が、スキャナ900の一部であってもよい。また、ネットワークを介して互いに通信可能な複数の装置(例えば、コンピュータ)が、画像処理装置による画像処理の機能を一部ずつ分担して、全体として、画像処理の機能を提供してもよい(これらの装置を備えるシステムが画像処理装置に対応する)。 (7) The image processing device of FIG. 1 may be a device of a type different from that of a personal computer (for example, a digital camera, a scanner, a smartphone). Further, the image processing device may be a part of the scanner 900. Further, a plurality of devices (for example, a computer) capable of communicating with each other via a network may partially share the image processing function of the image processing device and provide the image processing function as a whole (for example). A system equipped with these devices corresponds to an image processing device).

また、原稿を光学的に読み取ることによって、原稿と原稿の外側に配置された余白とを含む読取画像を示す読取画像データを生成する読取装置は、図1のスキャナ900に代えて、他の種々の装置であってよい。例えば、デジタルカメラ(例えば、スマートフォンに組み込まれたデジタルカメラ)によって生成された読取画像データが、出力画像データの生成に利用されてよい。ここで、読取装置と画像処理装置とが、1つの装置(例えば、スキャナ、スマートフォンなど)に組み込まれてもよく、読取装置と画像処理装置とは、別の装置であってもよい。 Further, the scanning device for generating the scanned image data indicating the scanned image including the document and the margins arranged outside the document by optically scanning the document is different from the scanner 900 of FIG. 1 in various other scanning devices. It may be the device of. For example, the scanned image data generated by a digital camera (for example, a digital camera incorporated in a smartphone) may be used to generate the output image data. Here, the reading device and the image processing device may be incorporated into one device (for example, a scanner, a smartphone, etc.), and the reading device and the image processing device may be different devices.

上記各実施例において、ハードウェアによって実現されていた構成の一部をソフトウェアに置き換えるようにしてもよく、逆に、ソフトウェアによって実現されていた構成の一部あるいは全部をハードウェアに置き換えるようにしてもよい。例えば、図2のS100〜S180の処理の少なくとも一部が、専用のハードウェア回路によって実現されてもよい。 In each of the above embodiments, a part of the configuration realized by the hardware may be replaced with software, and conversely, a part or all of the configuration realized by the software may be replaced with the hardware. May be good. For example, at least a part of the processing of S100 to S180 in FIG. 2 may be realized by a dedicated hardware circuit.

また、本発明の機能の一部または全部がコンピュータプログラムで実現される場合には、そのプログラムは、コンピュータ読み取り可能な記録媒体(例えば、一時的ではない記録媒体)に格納された形で提供することができる。プログラムは、提供時と同一または異なる記録媒体(コンピュータ読み取り可能な記録媒体)に格納された状態で、使用され得る。「コンピュータ読み取り可能な記録媒体」は、メモリーカードやCD−ROMのような携帯型の記録媒体に限らず、各種ROM等のコンピュータ内の内部記憶装置や、ハードディスクドライブ等のコンピュータに接続されている外部記憶装置も含み得る。 In addition, when a part or all of the functions of the present invention are realized by a computer program, the program is provided in a form stored in a computer-readable recording medium (for example, a non-temporary recording medium). be able to. The program may be used while being stored on the same or different recording medium (computer-readable recording medium) as it was provided. The "computer-readable recording medium" is not limited to a portable recording medium such as a memory card or a CD-ROM, but is connected to an internal storage device in the computer such as various ROMs or a computer such as a hard disk drive. It may also include an external storage device.

以上、実施例、変形例に基づき本発明について説明してきたが、上記した発明の実施の形態は、本発明の理解を容易にするためのものであり、本発明を限定するものではない。本発明は、その趣旨並びに特許請求の範囲を逸脱することなく、変更、改良され得ると共に、本発明にはその等価物が含まれる。 Although the present invention has been described above based on Examples and Modifications, the above-described embodiments of the invention are for facilitating the understanding of the present invention and do not limit the present invention. The present invention may be modified or improved without departing from the spirit and claims, and the present invention includes an equivalent thereof.

21〜23…原稿画像、31〜33…外側画像、110、120、130…読取画像、111、121、131…出力領域、111s、121s、131s…矩形輪郭、112、122、132…出力画像、122x…画像、118…縁、210、210x、220、230、230x…矩形原稿領域、213、213x、223、233、234、234x…候補領域、310、320、330…余白領域、410、420、430…輪郭、411、411x、412、412x、413、413x、414、414x、421、421x、422、422x、423、423x、424、424x、431、431x、432、432x、433、433x、434、434x…辺、510、520、530…領域、511、511x、512、512x、513、513x、514、514x、521、521x、522、522x、523、523x、524、524x、531、531x、532、533、534…部分余白領域、800…画像処理装置、810…CPU、815…記憶装置、820…揮発性記憶装置、830…不揮発性記憶装置、832…プログラム、840…表示部、850…操作部、890…インタフェース、900…スキャナ、910…制御部、911…CPU、912…揮発性記憶装置、913…不揮発性記憶装置、914…プログラム、915…記憶装置、919…インタフェース、920…イメージセンサ、930…移動装置、940…原稿台、950…カバー、990…本体部、D1…第1方向、D2…第2方向、NT…ネットワーク、Ob…オブジェクト、Bg…背景、Us…載置面、Bs…対向面、W21〜W24…幅、Th1…第1閾値、Th2…第2閾値、Dp1…第1方向、Dp2…第2方向、Dp3…第3方向(上方向) 21-23 ... Original image, 31-33 ... Outer image, 110, 120, 130 ... Scanned image, 111, 121, 131 ... Output area, 111s, 121s, 131s ... Rectangular contour, 112, 122, 132 ... Output image, 122x ... image, 118 ... edge, 210, 210x, 220, 230, 230x ... rectangular original area, 213, 213x, 223, 233, 234, 234x ... candidate area, 310, 320, 330 ... margin area, 410, 420, 430 ... Contours 411, 411x, 421, 421x, 413, 413x, 414, 414x, 421, 421x, 422, 422x, 423, 423x, 424, 424x, 431, 431x, 432, 432x, 433, 433x, 434, 434x ... Sides, 510, 520, 530 ... Areas, 511, 511x, 512, 512x, 513, 513x, 514, 514x, 521, 521x, 522, 522x, 523, 523x, 524, 524x, 531, 513x, 532, 533 ... Partial margin area, 800 ... Image processing device, 810 ... CPU, 815 ... Storage device, 820 ... Volatile storage device, 830 ... Non-volatile storage device, 832 ... Program, 840 ... Display unit, 850 ... Operation unit , 890 ... interface, 900 ... scanner, 910 ... control unit, 911 ... CPU, 912 ... volatile storage device, 913 ... non-volatile storage device, 914 ... program, 915 ... storage device, 919 ... interface, 920 ... image sensor, 930 ... moving device, 940 ... platen, 950 ... cover, 990 ... main body, D1 ... first direction, D2 ... second direction, NT ... network, Ob ... object, Bg ... background, Us ... mounting surface, Bs ... Opposing surface, W21 to W24 ... Width, Th1 ... 1st threshold, Th2 ... 2nd threshold, Dp1 ... 1st direction, Dp2 ... 2nd direction, Dp3 ... 3rd direction (upward)

Claims (7)

プログラムであって、
原稿を光学的に読み取ることによって生成され、原稿と前記原稿の外側に配置された余白とを含む読取画像を示す前記読取画像データを取得する取得機能と、
前記読取画像データを解析することによって、前記読取画像内の前記原稿を含む部分を矩形状の領域に区切って得られる矩形原稿領域の4つの辺を特定する辺特定機能と、
前記4つの辺のうちのいずれかの辺に接する前記矩形原稿領域内の領域であって前記原稿ではない領域の候補である候補領域を特定する候補領域特定機能と、
前記候補領域の色を修正すべきか否かを判断する第1判断機能と、
前記余白を示す領域であって前記矩形原稿領域の外側の領域である余白領域の少なくとも一部を構成する部分余白領域であって、前記4つの辺のうちの互いに異なる辺に接する1以上の部分余白領域のそれぞれに関して、色を修正すべきか否かを判断する第2判断機能と、
前記候補領域に関する前記第1判断機能による判断の結果と、前記1以上の部分余白領域のそれぞれに関する前記第2判断機能による判断の結果と、を用いて、色を修正すべきであると判断された領域の色を修正する処理である選択修正処理を実行し、前記選択修正処理済の前記矩形原稿領域と前記選択修正処理済の前記1以上の部分余白領域のそれぞれとを含む出力画像を示す出力画像データを生成する画像生成機能と、
をコンピュータに実現させ、
前記第2判断機能は、注目部分余白領域と予め決められた連続関係にある領域を構成する領域であって、部分余白領域と候補領域とのうちの少なくとも1つの領域に関して、色を修正すべきではないと判断される場合に、前記注目部分余白領域の色を修正すべきではないと判断し、
前記注目部分余白領域の色を修正すべきと前記第2判断機能によって判断されるための条件は、前記1以上の部分余白領域と前記候補領域とのうちの前記注目部分余白領域と前記予め決められた連続関係にある領域を構成する領域が、色を修正すべきではないと判断される領域を含まないことを、含む、コンピュータプログラム。
It ’s a program
An acquisition function for acquiring the scanned image data indicating the scanned image including the document and the margins arranged outside the document, which is generated by optically scanning the document, and the acquisition function.
A side identification function for identifying four sides of a rectangular document area obtained by dividing a portion of the scanned image including the document into a rectangular area by analyzing the scanned image data, and
A candidate area specifying function that identifies a candidate area that is a candidate for an area that is not the manuscript but is a region in the rectangular manuscript area that is in contact with any one of the four sides.
The first judgment function for judging whether or not the color of the candidate area should be corrected, and
A partial margin area that is a region indicating the margin and constitutes at least a part of a margin area that is an area outside the rectangular original region, and is one or more portions that are in contact with different sides of the four sides. A second judgment function that determines whether or not to correct the color for each of the margin areas,
It is determined that the color should be corrected by using the result of the judgment by the first judgment function regarding the candidate area and the result of the judgment by the second judgment function regarding each of the one or more partial margin areas. A selection correction process, which is a process of correcting the color of the selected area, is executed, and an output image including each of the rectangular original area after the selection correction processing and the one or more partial margin areas after the selection correction processing is shown. Image generation function to generate output image data and
To the computer,
The second determination function is an area that constitutes a region having a predetermined continuous relationship with the attention portion margin region, and the color should be corrected with respect to at least one region of the partial margin region and the candidate region. If it is determined that this is not the case, it is determined that the color of the margin area of interest should not be corrected.
The condition for the second determination function to determine that the color of the attention portion margin region should be corrected is determined in advance as the attention portion margin region of the one or more partial margin regions and the candidate region. A computer program that includes that the areas that make up the contiguous areas do not include areas that are determined not to be color-corrected.
請求項1に記載のコンピュータプログラムであって、
前記候補領域の前記色を修正すべきではないと前記第1判断機能によって判断されるための条件は、前記候補領域に接する前記辺からの前記候補領域の長さが第1閾値以上であることを含む、
コンピュータプログラム。
The computer program according to claim 1.
The condition for the first determination function to determine that the color of the candidate region should not be modified is that the length of the candidate region from the side in contact with the candidate region is equal to or greater than the first threshold value. including,
Computer program.
請求項1または2に記載のコンピュータプログラムであって、
ユーザの指示に応じて、前記出力画像内における前記1以上の部分余白領域のそれぞれの幅を決定する決定機能を、前記コンピュータに実現させ、
前記部分余白領域の色を修正すべきではないと前記第2判断機能によって判断されるための条件は、前記ユーザの指示に応じて決定した前記部分余白領域の前記幅が第2閾値以上であることを含む、
コンピュータプログラム。
The computer program according to claim 1 or 2.
The computer is realized with a determination function of determining the width of each of the one or more partial margin areas in the output image in response to a user's instruction.
The condition for the second determination function to determine that the color of the partial margin region should not be modified is that the width of the partial margin region determined according to the user's instruction is equal to or greater than the second threshold value. Including that
Computer program.
請求項1から3のいずれかに記載のコンピュータプログラムであって、
前記第2判断機能は、
(A)前記注目部分余白領域が、前記部分余白領域の色を修正すべきではないと仮に判断するための非対象仮条件を満たすか否かを判断し、
(B)前記注目部分余白領域が、前記非対象仮条件を満たさない場合には、
前記注目部分余白領域に接する候補領域であるゼロ個以上の隣接候補領域が、前記候補領域の色を修正すべきではないと判断される候補領域である非対象候補領域を含むか否かを判断し、
前記隣接候補領域が前記非対象候補領域を含む場合に、前記注目部分余白領域の色を修正すべきではないと判断し、
(C)前記注目部分余白領域が、前記非対象仮条件を満たす場合には、前記隣接候補領域が前記非対象候補領域を含むか否かを判断せずに、前記注目部分余白領域の色を修正すべきではないと判断する、
コンピュータプログラム。
The computer program according to any one of claims 1 to 3.
The second judgment function is
(A) It is determined whether or not the attention portion margin area satisfies the non-target provisional condition for tentatively determining that the color of the partial margin area should not be corrected.
(B) When the attention portion margin area does not satisfy the non-target tentative condition,
It is determined whether or not zero or more adjacent candidate regions, which are candidate regions in contact with the attention portion margin region, include non-target candidate regions, which are candidate regions for which it is determined that the color of the candidate region should not be corrected. And
When the adjacent candidate region includes the non-target candidate region, it is determined that the color of the attention portion margin region should not be corrected.
(C) When the attention portion margin area satisfies the non-target provisional condition, the color of the attention portion margin region is changed without determining whether or not the adjacent candidate region includes the non-target candidate region. Judge that it should not be fixed,
Computer program.
請求項1から4のいずれかに記載のコンピュータプログラムであって、
前記第2判断機能は、
前記1以上の部分余白領域のそれぞれの色を修正すべきか否かを、他の部分余白領域とは独立に、仮に判断し、
前記注目部分余白領域の色を修正すべきと仮に判断した場合には、前記注目部分余白領域に接するとともに基準幅より大きい幅の隣の部分余白領域と、前記隣の部分余白領域に接するとともに前記注目部分余白領域の向かい側に位置する前記基準幅より大きい幅の対向部分余白領域と、の少なくとも一方が、色を修正すべきではないと仮に判断されたか否かを判断し、
前記隣の部分余白領域と前記対向部分余白領域との少なくとも一方が、色を修正すべきでないと仮に判断された場合に、前記注目部分余白領域の色を修正すべきではないと判断する、
コンピュータプログラム。
The computer program according to any one of claims 1 to 4.
The second judgment function is
Whether or not each color of the one or more partial margin areas should be corrected is tentatively determined independently of the other partial margin areas.
If it is determined that the color of the attention portion margin area should be corrected, the color of the attention portion margin region is in contact with the adjacent partial margin region having a width larger than the reference width, and the adjacent partial margin region is in contact with the attention portion margin region. It is determined whether or not at least one of the opposite portion margin region having a width larger than the reference width, which is located opposite the attention portion margin region, is tentatively determined that the color should not be corrected.
If it is tentatively determined that at least one of the adjacent partial margin area and the opposite partial margin area should not be corrected in color, it is determined that the color of the attention partial margin area should not be corrected.
Computer program.
請求項1から5のいずれかに記載のコンピュータプログラムであって、
前記候補領域特定機能は、前記読取画像のうちの前記余白領域を用いずに前記矩形原稿領域を用いて、前記候補領域を特定する、
コンピュータプログラム。
The computer program according to any one of claims 1 to 5.
The candidate area identification function identifies the candidate area by using the rectangular original area without using the margin area of the scanned image.
Computer program.
画像処理装置であって、
原稿を光学的に読み取ることによって生成され、原稿と前記原稿の外側に配置された余白とを含む読取画像を示す前記読取画像データを取得する取得部と、
前記読取画像データを解析することによって、前記読取画像内の前記原稿を含む部分を矩形状の領域に区切って得られる矩形原稿領域の4つの辺を特定する辺特定部と、
前記4つの辺のうちのいずれかの辺に接する前記矩形原稿領域内の領域であって前記原稿ではない領域の候補である候補領域を特定する候補領域特定部と、
前記候補領域の色を修正すべきか否かを判断する第1判断部と、
前記余白を示す領域であって前記矩形原稿領域の外側の領域である余白領域の少なくとも一部を構成する部分余白領域であって、前記4つの辺のうちの互いに異なる辺に接する1以上の部分余白領域のそれぞれに関して、色を修正すべきか否かを判断する第2判断部と、
前記候補領域に関する前記第1判断部による判断の結果と、前記1以上の部分余白領域のそれぞれに関する前記第2判断部による判断の結果と、を用いて、色を修正すべきであると判断された領域の色を修正する処理である選択修正処理を実行し、前記選択修正処理済の前記矩形原稿領域と前記選択修正処理済の前記1以上の部分余白領域のそれぞれとを含む出力画像を示す出力画像データを生成する画像生成部と、
を備え、
前記第2判断部は、注目部分余白領域と予め決められた連続関係にある領域を構成する領域であって、部分余白領域と候補領域とのうちの少なくとも1つの領域に関して、色を修正すべきではないと判断される場合に、前記注目部分余白領域の色を修正すべきではないと判断し、
前記注目部分余白領域の色を修正すべきと前記第2判断部によって判断されるための条件は、前記1以上の部分余白領域と前記候補領域とのうちの前記注目部分余白領域と前記予め決められた連続関係にある領域を構成する領域が、色を修正すべきではないと判断される領域を含まないことを、含む、
画像処理装置。
It is an image processing device
An acquisition unit that acquires the scanned image data, which is generated by optically scanning the original and shows the scanned image including the original and the margins arranged outside the original.
By analyzing the scanned image data, a side specifying portion for specifying four sides of a rectangular document area obtained by dividing a portion of the scanned image including the document into a rectangular area, and
A candidate area specifying unit that specifies a candidate area that is a candidate for an area that is not the manuscript but is a region in the rectangular manuscript area that is in contact with any one of the four sides.
The first judgment unit that determines whether or not the color of the candidate area should be corrected, and
A partial margin area that is a region indicating the margin and constitutes at least a part of a margin area that is an area outside the rectangular original region, and is one or more portions that are in contact with different sides of the four sides. A second judgment unit that determines whether or not to correct the color for each of the margin areas,
It is determined that the color should be corrected by using the result of the judgment by the first judgment unit regarding the candidate area and the result of the judgment by the second judgment unit regarding each of the one or more partial margin areas. A selection correction process, which is a process of correcting the color of the selected area, is executed, and an output image including each of the rectangular original area after the selection correction processing and the one or more partial margin areas after the selection correction processing is shown. An image generator that generates output image data and
With
The second determination unit is an area that constitutes a region having a predetermined continuous relationship with the attention portion margin region, and the color should be corrected with respect to at least one region of the partial margin region and the candidate region. If it is determined that this is not the case, it is determined that the color of the margin area of interest should not be corrected.
The conditions for the second determination unit to determine that the color of the attention portion margin region should be corrected are determined in advance with the attention portion margin region of the one or more partial margin regions and the candidate region. Includes that the regions that make up the contiguous regions do not include regions where it is determined that the color should not be modified.
Image processing device.
JP2017151957A 2017-08-04 2017-08-04 Computer programs and image processing equipment Active JP6852618B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017151957A JP6852618B2 (en) 2017-08-04 2017-08-04 Computer programs and image processing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017151957A JP6852618B2 (en) 2017-08-04 2017-08-04 Computer programs and image processing equipment

Publications (2)

Publication Number Publication Date
JP2019033329A JP2019033329A (en) 2019-02-28
JP6852618B2 true JP6852618B2 (en) 2021-03-31

Family

ID=65523712

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017151957A Active JP6852618B2 (en) 2017-08-04 2017-08-04 Computer programs and image processing equipment

Country Status (1)

Country Link
JP (1) JP6852618B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023013021A1 (en) * 2021-08-06 2023-02-09 株式会社Pfu Image processing device, image processing method, and program

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007194997A (en) * 2006-01-20 2007-08-02 Sharp Corp Image-recording apparatus
JP2008022161A (en) * 2006-07-11 2008-01-31 Canon Inc Printer, print method, and program
JP2009272723A (en) * 2008-04-30 2009-11-19 Ricoh Co Ltd Image processing apparatus, method and program
JP2010204806A (en) * 2009-03-02 2010-09-16 Oki Electric Ind Co Ltd Information processor, document processing system, and document processing method
JP6099457B2 (en) * 2013-03-28 2017-03-22 株式会社Pfu Image processing apparatus, area determination method, and computer program

Also Published As

Publication number Publication date
JP2019033329A (en) 2019-02-28

Similar Documents

Publication Publication Date Title
US7227990B2 (en) Color image processing device and color image processing method
JP2017126869A (en) Image processing apparatus, image processing method and program
JP2018056873A (en) Image processing device and computer program
JP6852618B2 (en) Computer programs and image processing equipment
JP4930423B2 (en) Image processing apparatus, image forming apparatus, image processing apparatus control method, and image processing apparatus control program
CN110099192B (en) Image forming apparatus, control method thereof, and storage medium storing control program thereof
JP6943102B2 (en) Scanner, scan data production method and scan control program
JP6516103B2 (en) Image processing apparatus, image processing method and image processing program
JP6974791B2 (en) Image processing equipment and computer programs
JP5535138B2 (en) Image processing apparatus and image forming apparatus
JP2011176463A (en) Image processor and image forming apparatus
JP5644282B2 (en) Image processing apparatus and program
US10250777B2 (en) Image processing apparatus and non-transitory computer readable medium for image difference confirmation
JP6897405B2 (en) Image processing equipment and computer programs
JP6905210B2 (en) Image processing equipment and computer programs
JP5569107B2 (en) Image processing apparatus and program
JP6500638B2 (en) Image processing apparatus and computer program
JP6694165B2 (en) Image processing apparatus, image forming apparatus, image processing method, and image processing program
JP2005109807A (en) Image processing method, image processor, image forming device and image processing system
JP2006215785A (en) Image processing method, image processing device, image processing program and recording medium
JP6781398B2 (en) Image processing equipment and computer programs
JP6331772B2 (en) Image processing apparatus and computer program
JP2019092127A (en) Image processing apparatus, image forming apparatus, image processing method, and image processing program
JP6350362B2 (en) Computer program and image processing apparatus
JP6079371B2 (en) Image processing apparatus and image processing program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200519

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210121

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210209

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210222

R150 Certificate of patent or registration of utility model

Ref document number: 6852618

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150