Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP6897405B2 - Image processing equipment and computer programs - Google Patents
[go: Go Back, main page]

JP6897405B2 - Image processing equipment and computer programs - Google Patents

Image processing equipment and computer programs Download PDF

Info

Publication number
JP6897405B2
JP6897405B2 JP2017151734A JP2017151734A JP6897405B2 JP 6897405 B2 JP6897405 B2 JP 6897405B2 JP 2017151734 A JP2017151734 A JP 2017151734A JP 2017151734 A JP2017151734 A JP 2017151734A JP 6897405 B2 JP6897405 B2 JP 6897405B2
Authority
JP
Japan
Prior art keywords
straight line
image
pixels
outer edge
condition
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
JP2017151734A
Other languages
Japanese (ja)
Other versions
JP2019033318A (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 JP2017151734A priority Critical patent/JP6897405B2/en
Publication of JP2019033318A publication Critical patent/JP2019033318A/en
Application granted granted Critical
Publication of JP6897405B2 publication Critical patent/JP6897405B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Facsimile Scanning Arrangements (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Analysis (AREA)

Description

本明細書は、読取画像内の原稿領域を特定するための画像処理に関する。 The present specification relates to image processing for identifying a document area in a scanned image.

従来から、スキャナなどの画像読取装置を用いて、原稿画像を含む読取画像を表す読取画像データが生成されている。例えば、特許文献1に開示された画像読取装置は、原稿を読み取って生成される画像データを用いて、ハフ変換や最小二乗法を用いて、原稿領域のエッジに対応する直線を算出し、算出された直線に基づいて原稿の傾きを算出する。画像読取装置は、原稿領域の端と思われる画素を通り、かつ、算出した傾きを有する直線を算出することによって、原稿領域を決定する。 Conventionally, scanned image data representing a scanned image including a document image has been generated by using an image scanning device such as a scanner. For example, the image reading device disclosed in Patent Document 1 calculates a straight line corresponding to the edge of the document region by using the image data generated by scanning the document and using the Hough transform or the least squares method. The tilt of the document is calculated based on the straight line. The image reading device determines the document area by passing through the pixels that are considered to be the edges of the document area and calculating a straight line having the calculated inclination.

特開2009−218953号公報Japanese Unexamined Patent Publication No. 2009-218953

しかしながら、上記技術では、例えば、原稿領域を特定する手法について、十分に工夫されているとは言えなかった。このために、画像の種類によっては、原稿領域を精度良く特定できない可能性があった。 However, in the above technique, for example, it cannot be said that the method for specifying the manuscript area is sufficiently devised. Therefore, depending on the type of image, there is a possibility that the original area cannot be specified accurately.

本明細書は、読取画像データに基づく対象画像内の原稿領域を精度良く特定できる技術を開示する。 The present specification discloses a technique capable of accurately identifying a manuscript area in a target image based on scanned image data.

本明細書に開示された技術は、上述の課題の少なくとも一部を解決するためになされたものであり、以下の適用例として実現することが可能である。 The techniques disclosed herein have been made to solve at least a portion of the above problems and can be realized as the following application examples.

[適用例1]画像処理装置であって、原稿を光学的に読み取ることによって生成される読取画像データを取得する画像データ取得部と、前記読取画像データに基づく対象画像データを用いて、前記対象画像データによって示される対象画像内の注目直線を決定する注目直線決定部であって、前記対象画像は、前記原稿を示す原稿画像を含み、前記注目直線は、前記原稿画像の特定の外縁に平行な直線である、前記注目直線決定部と、前記対象画像データを用いて、前記注目直線に位置する複数個の画素を、それぞれ、前記原稿画像を構成する原稿画素を含むN種類の画素(Nは3以上の整数)に分類する分類部と、前記N種類の画素のうち、前記原稿画素の個数と、前記原稿画素を含むN1種類の画素(N1は3≦N1≦Nを満たす整数)の個数と、前記原稿画素を含むN2種類の画素(N2は2≦N2<N1を満たす整数)の個数と、を算出する個数算出部と、前記注目直線が第1の条件を満たすか否かを判断する第1の条件判断部であって、前記第1の条件は、前記注目直線に位置する前記N1種類の画素に占める前記原稿画素の割合が第1の閾値以上であることである、前記第1の条件判断部と、前記注目直線が前記第1の条件とは異なる第2の条件を満たすか否かを判断する第2の条件判断部であって、前記第2の条件は、前記注目直線に平行で前記注目直線と交差する方向に連続するM本の直線(Mは2以上の整数)のそれぞれが特定条件を満たすことであり、前記M本の直線は、前記注目直線を含み、前記特定条件は、対象の直線に位置する前記N2種類の画素に占める前記原稿画素の割合が第2の閾値以上であることである、前記第2の条件判断部と、前記注目直線が前記第1の条件を満たす場合に、前記注目直線に基づいて前記原稿画像の外縁に位置する外縁直線を決定する第1の外縁直線決定部と、前記注目直線が前記第2の条件を満たす場合に、前記注目直線に基づいて前記外縁直線を決定する第2の外縁直線決定部と、前記外縁直線を用いて、前記対象画像内の前記原稿画像に対応する原稿領域を特定する領域特定部と、を備える、画像処理装置。 [Application Example 1] The target is an image processing apparatus using an image data acquisition unit that acquires scanned image data generated by optically scanning a document and target image data based on the scanned image data. A line-of-sight determination unit that determines a straight line of interest in a target image indicated by image data, wherein the target image includes a manuscript image indicating the manuscript, and the straight line of attention is parallel to a specific outer edge of the manuscript image. Using the attention straight line determining unit and the target image data, which are straight lines, a plurality of pixels located on the attention straight line are each composed of N types of pixels (N) including the original pixels constituting the original image. Is an integer of 3 or more), the number of the manuscript pixels among the N types of pixels, and N1 types of pixels including the manuscript pixels (N1 is an integer satisfying 3 ≦ N1 ≦ N). The number calculation unit for calculating the number and the number of N2 types of pixels (N2 is an integer satisfying 2 ≦ N2 <N1) including the original image, and whether or not the straight line of interest satisfies the first condition. The first condition determination unit for determining, the first condition is that the ratio of the original image pixel to the N1 type of image located in the attention straight line is equal to or more than the first threshold value. The first condition determination unit and the second condition determination unit for determining whether or not the attention straight line satisfies the second condition different from the first condition, and the second condition is the above. Each of the M straight lines (M is an integer of 2 or more) parallel to the straight line of interest and continuous in the direction intersecting the straight line of interest satisfies the specific condition, and the M straight lines include the straight line of interest. The specific condition is that the ratio of the original image pixel to the N2 types of pixels located on the target straight line is equal to or greater than the second threshold value. When the first outer edge straight line determining unit which determines the outer edge straight line located at the outer edge of the original image based on the attention straight line and the attention straight line satisfy the second condition when the first condition is satisfied. A second outer edge straight line determining unit that determines the outer edge straight line based on the attention straight line, and an area specifying unit that uses the outer edge straight line to specify a document area corresponding to the original document image in the target image. An image processing device.

上記構成によれば、注目直線が第1条件を満たすか否かと、注目直線が第2条件を満たすか否かと、が判断され得る。そして、注目直線が第1の条件を満たす場合と、注目直線が第2の条件を満たす場合とに、注目直線に基づいて原稿画像の外縁に位置する外縁直線が決定される。この結果、外縁直線を適切に決定できる。したがって、外縁直線を用いて、読取画像データに基づく対象画像内の原稿領域を精度良く特定できる。 According to the above configuration, it can be determined whether or not the straight line of interest satisfies the first condition and whether or not the straight line of interest satisfies the second condition. Then, when the straight line of interest satisfies the first condition and when the straight line of interest satisfies the second condition, the outer edge straight line located at the outer edge of the original image is determined based on the straight line of interest. As a result, the outer edge straight line can be appropriately determined. Therefore, the original area in the target image based on the scanned image data can be accurately specified by using the outer edge straight line.

なお、本明細書に開示される技術は、種々の形態で実現することが可能であり、例えば、複合機、スキャナ、画像処理方法、これら装置の機能または上記方法を実現するためのコンピュータプログラム、そのコンピュータプログラムを記録した記録媒体、等の形態で実現することができる。 The techniques disclosed in the present specification can be realized in various forms, for example, a multifunction device, a scanner, an image processing method, a function of these devices, or a computer program for realizing the above method. It can be realized in the form of a recording medium or the like on which the computer program is recorded.

一実施例としての画像処理システムの構成を示す図である。It is a figure which shows the structure of the image processing system as one Example. 本実施例の画像処理のフローチャートである。It is a flowchart of image processing of this Example. 画像処理で用いられる画像の一例を示す図である。It is a figure which shows an example of the image used in image processing. 輪郭特定処理のフローチャートである。It is a flowchart of contour identification processing. 輪郭特定処理の説明図である。It is explanatory drawing of the contour specifying process. 読取画像OIを示す図である。It is a figure which shows the scanned image OI. 図6の読取画像OIの一部の領域ARの拡大図である。It is an enlarged view of a part area AR of the scanned image OI of FIG. 開始直線の決定の処理ステップを示すフローチャートである。It is a flowchart which shows the processing step of determination of a start straight line. 原稿領域AAの特定の処理ステップを示すフローチャートである。It is a flowchart which shows the specific processing step of a document area AA. 補修処理のフローチャートである。It is a flowchart of a repair process. 原稿領域の特定の一例を示す図である。It is a figure which shows an example of a specific document area.

A.実施例:
A−1.画像処理システムの構成
図1は、一実施例としての画像処理システムの構成を示す図である。この画像処理システムは、画像処理装置100と、スキャナ400と、を含んでいる。画像処理装置100とスキャナ400とは、ネットワークNTに接続されており、互いに通信可能である。
A. 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 100 and a scanner 400. The image processing device 100 and the scanner 400 are connected to the network NT and can communicate with each other.

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

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

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

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

図1には、スキャナ400の斜視図が示されている。図中の第1方向Dp1と第2方向Dp2とは、水平な方向を示し、第3方向Dp3は、鉛直上方向を示している。第1方向Dp1と第2方向Dp2とは、互いに垂直である。また、第3方向Dp3を、上方向Dp3とも呼ぶ。 FIG. 1 shows a perspective view of the scanner 400. 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 direction Dp3.

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

本体部490は、制御部410と、イメージセンサ420と、イメージセンサ420を第1方向Dp1に平行に移動させる移動装置430と、原稿台440と、を備えている。 The main body 490 includes a control unit 410, an image sensor 420, a moving device 430 that moves the image sensor 420 in parallel with the first direction Dp1, and a document base 440.

原稿台440は、本体部490(図1)の上方向Dp3側に、設けられている。原稿台440は、カバー450を上方向Dp3に向けて開くことによって、現れる。原稿台440は、第1方向Dp1に平行な2辺と第2方向Dp2に平行な2辺とで囲まれる略矩形状の台であり、透明板(例えば、ガラス板)を用いて構成されている。原稿台440の第3方向Dp3側の面は、読取対象の原稿が載置される載置面Usである。 The platen 440 is provided on the upward Dp3 side of the main body 490 (FIG. 1). The platen 440 appears by opening the cover 450 upward Dp3. The document table 440 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 440 on the third direction Dp3 side is the mounting surface Us on which the document to be read is placed.

イメージセンサ420は、原稿台440の下側(第3方向Dp3の反対側)、すなわち、原稿台440の下に配置されている。イメージセンサ420は、原稿を光学的に読み取る一次元イメージセンサであり、CCDやCMOSなどの複数の光電変換素子(単に、光学素子とも呼ぶ)が、第2方向Dp2に並んで配置された構成を有している。イメージセンサ420は、原稿台440上の原稿を、光学的に読み取ることによって、読み取った原稿を表す信号を出力する。 The image sensor 420 is arranged below the platen 440 (opposite the third direction Dp3), that is, below the platen 440. The image sensor 420 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 420 optically reads the document on the platen 440 to output a signal representing the scanned document.

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

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

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

A−2.画像処理の概要
図2は、本実施例の画像処理のフローチャートである。本実施例では、画像処理装置100のCPU110は、スキャナドライバとして、画像処理を実行する。この画像処理では、スキャナ400に原稿を読み取らせることによって読取画像データが取得され、取得された読取画像データを用いて、傾き補正や欠落の補修などがなされた補修済画像(後述)を表す補修済画像データが生成される。ユーザは、操作部150を操作することによって、画像処理の開始指示を入力する。CPU110は、入力された開始指示に応じて、図2の処理を開始する。
A-2. Outline of image processing FIG. 2 is a flowchart of image processing of this embodiment. In this embodiment, the CPU 110 of the image processing device 100 executes image processing as a scanner driver. In this image processing, scanned image data is acquired by causing the scanner 400 to scan the original, and the acquired scanned image data is used to represent a repaired image (described later) that has been subjected to tilt correction, missing repair, and the like. Finished image data is generated. The user inputs an image processing start instruction by operating the operation unit 150. The CPU 110 starts the process of FIG. 2 in response to the input start instruction.

S10では、CPU110は、読取画像データを取得する。具体的には、CPU110は、原稿を読み取る指示を、スキャナ400に送信する。スキャナ400の制御部410のCPU411は、画像処理装置100からの指示に応じて、原稿台440に載置された原稿を読み取ることによって、読取画像データを生成し、生成した読取画像データを、画像処理装置100に送信する。CPU110は、スキャナ400から送信される読取画像データを取得する。読取画像データのデータ形式は、種々の形式であってよい。本実施例では、読取画像データは、複数個の画素のRGB値を含むRGB画像データ、あるいは、複数個の画素の輝度値を含むモノクロ画像データである。1個の画素のRGB値は、その画素の色を示し、例えば、赤(R)と緑(G)と青(B)との3個の成分値(以下、R値、G値、B値とも呼ぶ)を含んでいる。本実施例では、各成分値の階調数は、256階調である。輝度値は、その画素の輝度を、例えば、256階調の値で示す値である。 In S10, the CPU 110 acquires the read image data. Specifically, the CPU 110 transmits an instruction to read the document to the scanner 400. The CPU 411 of the control unit 410 of the scanner 400 generates scanned image data by reading the document placed on the platen 440 in response to an instruction from the image processing device 100, and obtains the generated scanned image data as an image. It is transmitted to the processing device 100. The CPU 110 acquires the scanned image data transmitted from the scanner 400. 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.

図3は、画像処理で用いられる画像の一例を示す図である。図3(A)には、読取画像OIの一例が示されている。読取画像OIの形状は、矩形である。 FIG. 3 is a diagram showing an example of an image used in image processing. FIG. 3A shows an example of the scanned image OI. The shape of the scanned image OI is rectangular.

読取画像OIは、矩形の原稿を読み取ることによって生成された画像である。読取画像OIは、原稿を示す原稿画像Adと、原稿画像Adの外側に位置する背景画像Abと、を含む。背景画像Abは、原稿画像Adの外側の原稿以外の領域を示す。背景画像Abは、原稿画像Adの外側の画像、すなわち、原稿画像Adの外縁と、読取画像OIの外縁(4辺)と、の間に位置する画像である。背景画像Abは、特定の背景色を有している。本実施例では、背景画像Abは、カバー450の原稿台440と対向する対向面Bs(図1)を示している。このため、特定の背景色は、対向面Bsの色である。本実施例では、対向面Bsの色は、白よりも暗く、黒よりも明るいグレーである。 The scanned image OI is an image generated by scanning a rectangular original. The scanned image OI includes a manuscript image Ad showing the manuscript and a background image Ab located outside the manuscript image Ad. The background image Ab indicates an area other than the original outside the original image Ad. The background image Ab is an image outside the original image Ad, that is, an image located between the outer edge of the original image Ad and the outer edges (four sides) of the scanned image OI. The background image Ab has a specific background color. In this embodiment, the background image Ab shows the facing surface Bs (FIG. 1) facing the platen 440 of the cover 450. Therefore, the specific background color is the color of the facing surface Bs. In this embodiment, the color of the facing surface Bs is darker than white and lighter gray than black.

原稿画像Adの形状は、原稿の矩形の右上の角に対応する領域Daと、右下の角に対応する領域Dbと、が欠けた不完全な略矩形である。右上の領域Daの欠けは、原稿の対応する部分が、原稿台440上の読取可能領域からはみ出した状態で、原稿の読み取りが行われたことに起因する。右下の領域Dbの欠けは、原稿台440上において、原稿の対応する角が折り曲げられた状態で、原稿の読取が行われたことに起因する。また、原稿画像Adの略矩形は、読取画像OIの外形の矩形に対して、傾いている。この傾きは、原稿台440上において、原稿が傾いた状態で、原稿の読み取りが行われたことに起因する。 The shape of the original image Ad is an incomplete substantially rectangular shape in which the region Da corresponding to the upper right corner of the rectangle of the original and the region Db corresponding to the lower right corner are missing. The chipping of the upper right area Da is caused by the fact that the original is read with the corresponding portion of the original protruding from the readable area on the platen 440. The chipping of the lower right region Db is caused by the fact that the original is read on the platen 440 with the corresponding corners of the original bent. Further, the substantially rectangle of the original image Ad is inclined with respect to the rectangle of the outer shape of the scanned image OI. This inclination is due to the fact that the original is read on the platen 440 with the original tilted.

原稿画像Adは、文字や描画などのオブジェクトOb1、Ob2と、地色領域Saと、を含んでいる。地色領域Saは、原稿の地色を示す領域である。 The manuscript image Ad includes objects Ob1 and Ob2 such as characters and drawings, and a ground color region Sa. The ground color area Sa is an area indicating the ground color of the original.

S15では、CPU110は、読取画像データを用いて、画像を縮小する縮小処理を実行して、縮小画像MIを示す縮小画像データを生成する。縮小処理は、公知の処理が用いられる。例えば、縮小画像MIは、縦100dpi(dot per inch)×横100dpi相当の画素数を有する。読取画像データの縦方向および横方向の解像度が、100dpi以下である場合には、S15の処理は、省略される。図3(A)は、縮小画像MIを示す図である、とも言うことができる。 In S15, the CPU 110 uses the scanned image data to execute a reduction process for reducing the image to generate reduced image data indicating the reduced image MI. A known process is used for the reduction process. For example, the reduced image MI has a number of pixels corresponding to 100 dpi (dot per inch) in length × 100 dpi in width. When the vertical and horizontal resolutions of the scanned image data are 100 dpi or less, the process of S15 is omitted. It can also be said that FIG. 3A is a diagram showing a reduced image MI.

S20では、CPU110は、縮小画像データに対して、縮小画像MI内のエッジを抽出するエッジ抽出処理をして、エッジ抽出データを生成する。具体的には、CPU110は、縮小画像データの各画素の値に、いわゆるソーベルフィルタ(Sobel filter)を適用して、エッジ強度Seを算出する。CPU110は、これらのエッジ強度Seを、複数個の画素の値とするエッジ抽出データを生成する。 In S20, the CPU 110 performs an edge extraction process for extracting the edge in the reduced image MI on the reduced image data to generate the edge extraction data. Specifically, the CPU 110 applies a so-called Sobel filter to the value of each pixel of the reduced image data to calculate the edge strength Se. The CPU 110 generates edge extraction data in which these edge strength Se are set as the values of a plurality of pixels.

以下に、エッジ強度の算出式(1)を示す。式(1)の階調値P(x,y)は、縮小画像MI内の特定の画素位置(x,y)の輝度を表している。位置xは、方向D1(縦方向)の画素位置を示し、位置yは、方向D2(横方向)の画素位置を示している。縮小画像MI内の画素位置(x,y)におけるエッジ強度Se(x,y)は、その画素位置(x,y)を中心とし隣り合う3行3列の9つの画素の値を用いて算出される。算出式の第1項および第2項は、9つの位置の画素の階調値に、対応する係数をそれぞれ乗じた値の和の絶対値である。第1項は、方向D1の階調値の微分(すなわち、横方向の微分)であり、第2項は、方向D2の階調値の微分(すなわち、縦方向の微分)である。算出されるエッジ強度Se(x,y)は、0〜255の範囲の256階調の値に正規化される。 The formula (1) for calculating the edge strength is shown below. The gradation value P (x, y) in the formula (1) represents the brightness of a specific pixel position (x, y) in the reduced image MI. The position x indicates the pixel position in the direction D1 (vertical direction), and the position y indicates the pixel position in the direction D2 (horizontal direction). The edge strength Se (x, y) at the pixel position (x, y) in the reduced image MI is calculated using the values of nine pixels in three rows and three columns adjacent to each other with the pixel position (x, y) as the center. Will be done. The first and second terms of the calculation formula are absolute values of the sum of the gradation values of the pixels at the nine positions multiplied by the corresponding coefficients. The first term is the derivative of the gradation value in the direction D1 (that is, the derivative in the horizontal direction), and the second term is the derivative of the gradation value in the direction D2 (that is, the derivative in the vertical direction). The calculated edge strength Se (x, y) is normalized to a value of 256 gradations in the range of 0 to 255.

Figure 0006897405

…(1)
Figure 0006897405

… (1)

生成されるエッジ抽出データによって示されるエッジ抽出画像では、縮小画像MIにおけるエッジに対応する位置、例えば、図3(A)の縮小画像MIにおける原稿画像Adと背景画像Abとの境界に対応する画素や、オブジェクトOb1、Ob2の輪郭に対応する画素の値が、他の位置の画素の値と比較して大きくなる。 In the edge extraction image indicated by the generated edge extraction data, the position corresponding to the edge in the reduced image MI, for example, the pixel corresponding to the boundary between the original image Ad and the background image Ab in the reduced image MI of FIG. 3 (A). Or, the value of the pixel corresponding to the contour of the objects Ob1 and Ob2 becomes larger than the value of the pixel at another position.

S25では、CPU110は、S20にて生成済みのエッジ抽出データを二値化して、エッジ二値画像EIを示すエッジ二値画像データを生成する。例えば、CPU110は、エッジ抽出データにおいて、画素の値(すなわち、エッジ強度)が閾値(例えば、128)以上である画素を、エッジ画素PXeとして特定し、画素の値が閾値未満である画素を、非エッジ画素PXnとして特定する。エッジ二値画像データでは、エッジ画素PXeの値は、「1」とされ、非エッジ画素PXnの値は、「0」とされる。 In S25, the CPU 110 binarizes the edge extraction data generated in S20 to generate edge binary image data indicating the edge binary image EI. For example, in the edge extraction data, the CPU 110 specifies a pixel whose pixel value (that is, edge strength) is equal to or greater than a threshold value (for example, 128) as an edge pixel PXe, and a pixel whose pixel value is less than the threshold value is defined as an edge pixel PXe. It is specified as a non-edge pixel PXn. In the edge binary image data, the value of the edge pixel PXe is set to "1", and the value of the non-edge pixel PXn is set to "0".

図3(B)には、エッジ二値画像EIの一例が示されている。このエッジ二値画像EIでは、縮小画像MIにおける原稿画像Adと背景画像Abとの境界に対応する画素やオブジェクトOb1、Ob2の輪郭に対応する画素が、エッジ画素PXeとして特定されていることが解る。なお、縮小画像MI内の各画素は、読取画像OIの1個以上の画素と対応しているので、縮小画像MI内のエッジ画素PXeおよび非エッジ画素PXnを特定することは、読取画像OI内の対応するエッジ画素および非エッジ画素を特定することに等しい。 FIG. 3B shows an example of the edge binary image EI. In this edge binary image EI, it can be seen that the pixels corresponding to the boundary between the original image Ad and the background image Ab in the reduced image MI and the pixels corresponding to the contours of the objects Ob1 and Ob2 are specified as the edge pixels PXe. .. Since each pixel in the reduced image MI corresponds to one or more pixels of the scanned image OI, specifying the edge pixel PXe and the non-edge pixel PXn in the reduced image MI is in the scanned image OI. Is equivalent to identifying the corresponding edge and non-edge pixels of.

本実施例では、縮小画像データを用いて、エッジ画素PXeの特定を行うので、例えば、読取画像データを用いる場合と比較して、処理する画素数を低減できる。したがって、エッジ画素PXeの特定に要する処理時間やメモリ容量を低減できる。 In this embodiment, since the edge pixel PXe is specified using the reduced image data, the number of pixels to be processed can be reduced as compared with the case where the scanned image data is used, for example. Therefore, the processing time and memory capacity required to identify the edge pixel PXe can be reduced.

S30では、CPU110は、輪郭特定処理を実行する。輪郭特定処理は、エッジ二値画像データを用いて、縮小画像MIにおいて特定された複数個のエッジ画素PXeの中から、原稿画像の輪郭を構成する複数個の輪郭画素PXoを特定することによって、原稿画像Adの輪郭を示す輪郭画像OLIを示す輪郭画像データを生成する処理である。 In S30, the CPU 110 executes the contour specifying process. The contour identification process uses edge binary image data to identify a plurality of contour pixels PXo constituting the contour of the original image from the plurality of edge pixels PXe specified in the reduced image MI. This is a process of generating contour image data showing a contour image OLI showing the contour of the original image Ad.

図3(C)には、輪郭画像OLIの一例が示されている。この例では、輪郭画像OLI内に、6本の直線L1〜L6によって示される原稿画像Adの輪郭を構成する複数個の輪郭画素PXoが特定されている。輪郭画像OLIは、縮小画像MIの複数個の画素と一対一で対応する複数個の画素で構成された画像である。輪郭画像データは、二値データであり、輪郭画像データの各画素の値は、縮小画像MIの対応する画素が、輪郭画素PXoであるか否かを示す。縮小画像MI内の各画素は、読取画像OIの1個以上の画素と対応しているので、縮小画像MI内の輪郭画素PXoを特定することは、読取画像OI内の対応する輪郭画素を特定することに等しい。輪郭特定処理の詳細は、後述する。 FIG. 3C shows an example of the contour image OLI. In this example, a plurality of contour pixels PXo constituting the contour of the original image Ad indicated by the six straight lines L1 to L6 are specified in the contour image OLI. The contour image OLI is an image composed of a plurality of pixels corresponding to a plurality of pixels of the reduced image MI on a one-to-one basis. The contour image data is binary data, and the value of each pixel of the contour image data indicates whether or not the corresponding pixel of the reduced image MI is the contour pixel PXo. Since each pixel in the reduced image MI corresponds to one or more pixels in the scanned image OI, specifying the contour pixel PXo in the reduced image MI identifies the corresponding contour pixel in the scanned image OI. Is equivalent to doing. Details of the contour identification process will be described later.

S40では、CPU110は、原稿領域特定処理を実行する。原稿領域特定処理は、輪郭画像データを用いて、原稿画像Adに対応する原稿領域AAを特定する処理である。図3(A)に示すように、原稿領域AAは、原稿画像Adにおいて欠けている上述した領域Da、Dbを補って得られる矩形の領域である。 In S40, the CPU 110 executes the document area specifying process. The manuscript area specifying process is a process of specifying the manuscript area AA corresponding to the manuscript image Ad by using the contour image data. As shown in FIG. 3A, the document area AA is a rectangular area obtained by compensating for the above-mentioned areas Da and Db that are missing in the document image Ad.

S45では、CPU110は、原稿領域AAの特定結果を用いて、読取画像データに対して補修処理を実行して、補修済画像RIを示す補修済画像データを生成する。図3(D)には、補修済画像RIの一例が示されている。この補修済画像RIは、補修済みの原稿画像Adrと、補修済みの背景画像Abrと、を含んでいる。原稿画像Adrは、原稿領域AAに対応する矩形を有し、補修済画像RIの外形の矩形に対して傾いていない。また、原稿画像Adrの外側の背景画像Abrは、予め指定された指定色(例えば、白)で塗られている。補修処理の詳細は、後述する。 In S45, the CPU 110 executes a repair process on the read image data using the specific result of the document area AA to generate the repaired image data indicating the repaired image RI. FIG. 3D shows an example of the repaired image RI. The repaired image RI includes a repaired manuscript image Dr and a repaired background image Abr. The manuscript image Adr has a rectangle corresponding to the manuscript area AA and is not tilted with respect to the rectangle of the outer shape of the repaired image RI. Further, the background image Abr outside the original image Adr is painted with a designated color (for example, white) designated in advance. Details of the repair process will be described later.

S50では、CPU110は、補修済画像データを出力する。本実施例では、CPU110は、補修済画像データを、画像処理装置100の内部の記憶装置(例えば、不揮発性記憶装置130)に格納する。これに代えて、CPU110は、画像処理装置100に接続された外部記憶装置(例えば、図示しないUSBメモリ)に、補修済画像データを格納してもよい。また、CPU110は、例えば、補修済画像データをプリンタに送信することによって、該プリンタに補修済画像RIを印刷させる形態で、補修済画像データを出力しても良い。補修済画像データのデータ形式としては、任意の形式を採用可能である。本実施例では、CPU110は、JPEG形式の補修済画像データを出力する。 In S50, the CPU 110 outputs the repaired image data. In this embodiment, the CPU 110 stores the repaired image data in a storage device (for example, a non-volatile storage device 130) inside the image processing device 100. Instead, the CPU 110 may store the repaired image data in an external storage device (for example, a USB memory (not shown)) connected to the image processing device 100. Further, the CPU 110 may output the repaired image data in a form of printing the repaired image RI on the printer by transmitting the repaired image data to the printer, for example. Any format can be adopted as the data format of the repaired image data. In this embodiment, the CPU 110 outputs the repaired image data in JPEG format.

以上説明した画像処理によれば、読取画像データを用いて、原稿を示す補修済画像RIを示す補修済画像データが出力される。この結果、原稿を適切に示す画像データを、ユーザに提供できる。 According to the image processing described above, the repaired image data showing the repaired image RI showing the original is output by using the scanned image data. As a result, it is possible to provide the user with image data that appropriately indicates the original.

A−3.輪郭特定処理
図2のS30の輪郭特定処理について説明する。輪郭特定処理は、上述したように、エッジ二値画像データを用いて、輪郭画素PXoを特定する処理である。図4は、輪郭特定処理のフローチャートである。図5は、輪郭特定処理の説明図である。
A-3. Contour identification process The contour identification process of S30 of FIG. 2 will be described. As described above, the contour specifying process is a process of specifying the contour pixel PXo using the edge binary image data. FIG. 4 is a flowchart of the contour specifying process. FIG. 5 is an explanatory diagram of the contour specifying process.

図4のS100では、CPU110は、輪郭画像OLIを示す輪郭画像データの初期データを、揮発性記憶装置120内に準備する。初期データは、縮小画像MIやエッジ二値画像EIと同じサイズの画像を示す二値画像データであり、全ての画素の値が、初期値として、「0」に設定されている。 In S100 of FIG. 4, the CPU 110 prepares the initial data of the contour image data indicating the contour image OLI in the volatile storage device 120. The initial data is binary image data indicating an image having the same size as the reduced image MI and the edge binary image EI, and the values of all the pixels are set to "0" as the initial values.

S105では、CPU110は、エッジ二値画像EIの外形の4個の辺に対応する4個の端、すなわち、上端TU、下端TB、左端TL、右端TR(図5)から、1個の注目端を選択する。S110では、CPU110は、注目端上の複数個の画素の中から、1個の注目画素を選択する。 In S105, the CPU 110 has one attention end from the four ends corresponding to the four sides of the outer shape of the edge binary image EI, that is, the upper end TU, the lower end TB, the left end TL, and the right end TR (FIG. 5). Select. In S110, the CPU 110 selects one pixel of interest from the plurality of pixels on the end of interest.

S115では、CPU110は、注目画素を始点として、注目端からエッジ二値画像EIの内側に向かって探索して、最初に探索されるエッジ画素PXeを特定する。エッジ二値画像EIの内側に向かう方向は、具体的には、注目端と垂直な方向であって、かつ、注目端と向かい合うエッジ二値画像EIの他の端に向かう方向である。図5に示すように、上端TU上に位置する画素PXt1が注目画素である場合には、下側に向かって探索が行われ、最初に探索されるエッジ画素PXe1が特定される。同様にして、右端TR、下端TB、左端TL上にそれぞれ位置する画素PXt2、PXt3、PXt4が注目画素である場合には、それぞれ、左側、上側、右側に向かって検索が行われ、最初に探索されるエッジ画素PXe2、PXe3、PXe4が特定される。 In S115, the CPU 110 searches from the attention end toward the inside of the edge binary image EI, starting from the attention pixel, and identifies the edge pixel PXe to be searched first. Specifically, the direction toward the inside of the edge binary image EI is a direction perpendicular to the attention end and toward the other end of the edge binary image EI facing the attention end. As shown in FIG. 5, when the pixel PXt1 located on the upper end TU is the pixel of interest, the search is performed downward, and the edge pixel PXe1 to be searched first is specified. Similarly, when the pixels PXt2, PXt3, and PXt4 located on the right end TR, the lower end TB, and the left end TL are the pixels of interest, the search is performed toward the left side, the upper side, and the right side, respectively, and the search is performed first. The edge pixels PXe2, PXe3, and PXe4 to be formed are specified.

S118では、CPU110は、エッジ画素は特定されたか否かを判断する。具体的には、注目画素から探索方向に探索した結果、探索の限界位置、例えば、注目端と向かい合う他の端に到達するまでに、エッジ画素PXe1が探索された場合には、エッジ画素PXe1は特定されたと判断される。探索の限界位置に到達しても、エッジ画素PXe1が探索されない場合には、エッジ画素PXe1は特定されないと判断される。 In S118, the CPU 110 determines whether or not the edge pixel has been specified. Specifically, as a result of searching from the pixel of interest in the search direction, if the edge pixel PXe1 is searched before reaching the limit position of the search, for example, another end facing the end of interest, the edge pixel PXe1 is used. Judged as identified. If the edge pixel PXe1 is not searched even when the search limit position is reached, it is determined that the edge pixel PXe1 is not specified.

エッジ画素PXeが特定された場合には(S118:YES)、S120にて、CPU110は、特定されたエッジ画素PXeを、輪郭画素PXoとして、輪郭画像データに記録する。具体的には、特定されたエッジ画素PXeに対応する輪郭画像データにおける画素の値を「1」に変更する。 When the edge pixel PXe is specified (S118: YES), in S120, the CPU 110 records the specified edge pixel PXe as the contour pixel PXo in the contour image data. Specifically, the pixel value in the contour image data corresponding to the specified edge pixel PXe is changed to "1".

エッジ画素PXeが特定されない場合には(S118:NO)、S120はスキップされる。したがって、この場合には、注目画素に対応する輪郭画素PXoは、記録されない。 If the edge pixel PXe is not specified (S118: NO), S120 is skipped. Therefore, in this case, the contour pixel PXo corresponding to the pixel of interest is not recorded.

S125では、CPU110は、注目端上の全ての画素を注目画素として処理したか否かを判断する。未処理の画素がある場合には(S125:NO)、CPU110は、S110に処理を戻す。全ての画素が処理された場合(S125:YES)、CPU110は、S130に処理を進める。 In S125, the CPU 110 determines whether or not all the pixels on the attention end are processed as the attention pixels. If there are unprocessed pixels (S125: NO), the CPU 110 returns the processing to S110. When all the pixels are processed (S125: YES), the CPU 110 proceeds to S130.

S130では、CPU110は、全てのエッジ二値画像EIの端TU、TB、TL、TRを、注目端として処理したか否かを判断する。未処理の端がある場合には(S130:NO)、CPU110は、S105に処理を戻す。全ての端が処理された場合には(S130:YES)、CPU110は、輪郭特定処理を終了する。輪郭特定処理によって、図3(C)に示す輪郭画像OLIを示す輪郭画像データが生成される。 In S130, the CPU 110 determines whether or not the ends TU, TB, TL, and TR of all the edge binary image EIs have been processed as the attention ends. If there is an unprocessed end (S130: NO), the CPU 110 returns the process to S105. When all the edges have been processed (S130: YES), the CPU 110 ends the contour specifying process. The contour identification process generates contour image data showing the contour image OLI shown in FIG. 3C.

本実施例の輪郭特定処理によれば、エッジ二値画像EIの端から内側に向かってエッジ画素PXeが探索され、最初に探索される特定のエッジ画素PXe(例えば、PXe1〜PXe4)が、輪郭画素PXoとして特定される。したがって、エッジ二値画像EI内において、原稿画像Adの輪郭を、容易、かつ、適切に特定することができる。 According to the contour specifying process of this embodiment, the edge pixels PXe are searched from the edge of the edge binary image EI toward the inside, and the specific edge pixels PXe (for example, PXe1 to PXe4) searched first are contoured. Specified as pixel PXo. Therefore, the contour of the original image Ad can be easily and appropriately specified in the edge binary image EI.

A−4.原稿領域特定処理
図2のS40の原稿領域特定処理について説明する。原稿領域特定処理は、上述したように、輪郭画像データを用いて、原稿画像Adに対応する原稿領域AAを特定する処理である。原稿領域特定処理は、図2に示すように、S42の開始直線の決定と、S44の原稿領域AAの特定と、を含んでいる。
A-4. Original area specifying process The document area specifying process of S40 of FIG. 2 will be described. As described above, the manuscript area specifying process is a process of specifying the manuscript area AA corresponding to the manuscript image Ad by using the contour image data. As shown in FIG. 2, the manuscript area specifying process includes determining the start straight line of S42 and specifying the manuscript area AA of S44.

図6は、読取画像OIを示す図である。図7は、図6の読取画像OIの一部の領域ARの拡大図である。領域ARは、読取画像OI内の原稿画像Adの左側の外縁LPeの一部を含む領域である。原稿画像Adの外縁LPeの外側には、上述した背景画像Abが存在している。そして、原稿画像Adの外縁LPeと、背景画像Abと、の間には、影を示す影画像SHが存在している(図7)。図6では、図の煩雑を避けるために影画像SHの図示が省略されている。影画像SHは、原稿画像Adの地色領域Saの色(例えば、白)や、背景画像Abの色(例えば、グレー)よりも暗い色(例えば、黒)を有している。このような影画像SHは、例えば、カバー450の対向面Bs(図1)と、読取対象の原稿と、の段差に起因して生じる細い画像である。 FIG. 6 is a diagram showing a scanned image OI. FIG. 7 is an enlarged view of a part of the region AR of the scanned image OI of FIG. The region AR is a region including a part of the outer edge LPe on the left side of the original image Ad in the scanned image OI. The background image Ab described above exists outside the outer edge LPe of the original image Ad. Then, a shadow image SH showing a shadow exists between the outer edge LPe of the original image Ad and the background image Ab (FIG. 7). In FIG. 6, the shadow image SH is omitted in order to avoid complication of the drawing. The shadow image SH has a color (for example, black) darker than the color of the ground color region Sa of the original image Ad (for example, white) and the color of the background image Ab (for example, gray). Such a shadow image SH is, for example, a thin image generated due to a step between the facing surface Bs (FIG. 1) of the cover 450 and the original document to be read.

開始直線Ltは、後述するS44の原稿領域AAの特定において、原稿画像Adの外縁LPeを特定するための探索の開始位置を示す直線である。開始直線Ltは、原稿画像Adの左側の外縁LPeに略平行で、かつ、原稿画像Adよりも外側に決定される。より具体的には、開始直線Ltは、影画像SHの外縁LSeの位置に決定される。S42の開始直線の決定では、原稿画像Adの外縁LPe、UPe、RPe、BPeのそれぞれに略平行な4本の開始直線Lt、Ut、Rt、Bt(図6)が決定される。 The start straight line Lt is a straight line indicating the start position of the search for specifying the outer edge LPe of the original image Ad in the specification of the document region AA of S44, which will be described later. The start straight line Lt is determined to be substantially parallel to the outer edge LPe on the left side of the original image Ad and outside the original image Ad. More specifically, the starting straight line Lt is determined at the position of the outer edge LSe of the shadow image SH. In the determination of the start straight line of S42, four start straight lines Lt, Ut, Rt, and Bt (FIG. 6) substantially parallel to each of the outer edges LPe, UPe, RPe, and BPe of the original image Ad are determined.

図8は、開始直線の決定の処理ステップを示すフローチャートである。図8のS310では、輪郭画像データを用いて、縮小画像MI上において複数個の候補直線を特定する。具体的には、輪郭画素PXoによって表される直線が、候補直線として採用される。候補直線を特定する方法としては、輪郭画素PXoを用いるハフ変換が用いられる。ハフ変換は、公知の処理であるので、その説明を省略する。ハフ変換の結果、図3(C)の例では、原稿画像Adの輪郭に対応した6本の候補直線L1〜L6が特定される。具体的には、候補直線L1〜L6の傾きと、位置と、を示す情報が取得される。 FIG. 8 is a flowchart showing a processing step of determining the starting straight line. In S310 of FIG. 8, a plurality of candidate straight lines are specified on the reduced image MI by using the contour image data. Specifically, the straight line represented by the contour pixel PXo is adopted as the candidate straight line. As a method of specifying the candidate straight line, a Hough transform using the contour pixel PXo is used. Since the Hough transform is a known process, its description will be omitted. As a result of the Hough transform, in the example of FIG. 3C, six candidate straight lines L1 to L6 corresponding to the contour of the original image Ad are specified. Specifically, information indicating the slopes and positions of the candidate straight lines L1 to L6 is acquired.

S320では、CPU110は、6本の候補直線L1〜L6から、原稿画像Adの外縁と平行な4本の暫定直線を選択する。具体的には、CPU110は、6本の候補直線L1〜L6から、輪郭画像OLIの外形の4個の端(辺)に位置する直線を除外する。例えば、図3(A)の例では、輪郭画像OLIの上端に位置する候補直線L2が除外される。輪郭画像OLIの4個の端に位置する直線(例えば、L2)は、読取画像OIの対応する端に位置している。このような直線L2は、読取時において、読取可能領域からはみ出した原稿上の領域Da(図3(A))に対応しており、原稿の縁を示していないと考えられる。CPU110は、残りの候補直線L1、L3〜L6から、互いに平行な2本の直線の組を、2組抽出する。図3(A)の例では、直線L3とL6の組と、直線L2とL4の組と、が抽出される。これらの4本の直線L2、L3、L4、L6が、4本の暫定直線として選択される。4本の暫定直線L2、L3、L4、L6の傾きは、原稿画像Adの傾きを示しているので、4本の暫定直線L2、L3、L4、L6を特定することによって、原稿画像Adの傾きが特定される。 In S320, the CPU 110 selects four provisional straight lines parallel to the outer edge of the original image Ad from the six candidate straight lines L1 to L6. Specifically, the CPU 110 excludes straight lines located at the four ends (sides) of the outer shape of the contour image OLI from the six candidate straight lines L1 to L6. For example, in the example of FIG. 3A, the candidate straight line L2 located at the upper end of the contour image OLI is excluded. The straight lines (eg, L2) located at the four ends of the contour image OLI are located at the corresponding ends of the scanned image OI. It is considered that such a straight line L2 corresponds to the area Da (FIG. 3A) on the document that protrudes from the readable area at the time of reading, and does not indicate the edge of the document. The CPU 110 extracts two sets of two lines parallel to each other from the remaining candidate straight lines L1 and L3 to L6. In the example of FIG. 3A, a pair of straight lines L3 and L6 and a pair of straight lines L2 and L4 are extracted. These four straight lines L2, L3, L4, and L6 are selected as the four provisional straight lines. Since the inclinations of the four provisional straight lines L2, L3, L4, and L6 indicate the inclination of the original image Ad, the inclination of the original image Ad is determined by specifying the four provisional straight lines L2, L3, L4, and L6. Is identified.

S322では、CPU110は、縮小前の読取画像OI(図6)上において、縮小画像MI上にて選択された4本の暫定直線L2、L3、L4、L6に対応する参照直線L2C、L3C、L4C、L6Cを決定する。 In S322, the CPU 110 determines the reference straight lines L2C, L3C, and L4C corresponding to the four provisional straight lines L2, L3, L4, and L6 selected on the reduced image MI on the scanned image OI (FIG. 6) before reduction. , L6C is determined.

図7にて、原稿画像Adの左側の外縁LPeと略平行な参照直線L3Cについて示すように、参照直線L2C、L3C、L4C、L6Cは、原稿画像Adから見て、原稿画像Adの外縁に沿う影画像SHよりもさらに外側に位置する。換言すれば、参照直線L2C、L3C、L4C、L6Cは、原稿画像Adから見て、決定すべき開始直線Lt、Ut、Rt、Btよりもさらに外側に位置する。この理由は、以下の通りである。 As shown in FIG. 7 for the reference straight line L3C substantially parallel to the outer edge LPe on the left side of the original image Ad, the reference straight lines L2C, L3C, L4C, and L6C are along the outer edge of the original image Ad when viewed from the original image Ad. It is located further outside the shadow image SH. In other words, the reference straight lines L2C, L3C, L4C, and L6C are located further outside the starting straight lines Lt, Ut, Rt, and Bt to be determined when viewed from the original image Ad. The reason for this is as follows.

エッジ二値画像EIにて特定されるエッジ画素には、影画像SHと背景画像Abとの境界を構成する画素であって、背景画像Abに属する画素を含む。そして、エッジ二値画像EIを用いて特定される輪郭画像OLIにおける輪郭画素PXo(図3(C))には、輪郭特定処理(図4、図5)から解るように、原稿画像Adから見て外側に位置するエッジ画素PXeが優先的に選択される。このために、輪郭画素PXoに基づいて、縮小画像MIにて特定される暫定直線L2、L3、L4、L6は、背景画像Ab内に位置することになる。そして、100dpi相当の縮小画像MIにて特定された暫定直線L2、L3、L4、L6に対応する参照直線L2C、L3C、L4C、L6Cは、縮小前の読取画像OI(例えば、300〜1200dpi相当)にて決定される。このために、参照直線L2C、L3C、L4C、L6Cは、縮小前の読取画像OIにおいて、影画像SHよりも数画素分外側に位置し得る(図7)。 The edge pixels specified by the edge binary image EI include pixels that form a boundary between the shadow image SH and the background image Ab and belong to the background image Ab. Then, the contour pixel PXo (FIG. 3 (C)) in the contour image OLI specified by using the edge binary image EI is viewed from the original image Ad as can be seen from the contour identification process (FIGS. 4 and 5). The edge pixel PXe located on the outer side is preferentially selected. Therefore, the provisional straight lines L2, L3, L4, and L6 specified in the reduced image MI based on the contour pixel PXo are located in the background image Ab. Then, the reference straight lines L2C, L3C, L4C, and L6C corresponding to the provisional straight lines L2, L3, L4, and L6 specified by the reduced image MI equivalent to 100 dpi are the read image OI before reduction (for example, equivalent to 300 to 1200 dpi). It is decided by. Therefore, the reference straight lines L2C, L3C, L4C, and L6C may be located several pixels outside the shadow image SH in the scanned image OI before reduction (FIG. 7).

以上の説明から解るように、S322では、原稿画像Adの特定の外縁(例えば、外縁LPe)に沿う参照直線(例えば、参照直線L3C)であって、原稿画像Adの特定の外縁から原稿画像Adの外側に離れた参照直線が特定される。 As can be seen from the above description, in S322, it is a reference straight line (for example, the reference straight line L3C) along a specific outer edge (for example, outer edge LPe) of the original image Ad, and the original image Ad is from the specific outer edge of the original image Ad. A distant reference line is identified outside of.

S325では、CPU110は、4本の参照直線L2C、L3C、L4C、L6Cの中から、処理対象の一本の参照直線を選択する。例えば、原稿画像Adの左側の外縁LPeと略平行な左側の参照直線L3Cが、処理対象の参照直線として選択される(図7)。S330では、CPU110は、処理対象の一本の参照直線を注目直線として設定する。 In S325, the CPU 110 selects one reference straight line to be processed from the four reference straight lines L2C, L3C, L4C, and L6C. For example, the reference straight line L3C on the left side, which is substantially parallel to the outer edge LPe on the left side of the original image Ad, is selected as the reference straight line to be processed (FIG. 7). In S330, the CPU 110 sets one reference straight line to be processed as a straight line of interest.

S335では、CPU110は、注目直線上に位置する複数個の画素を、背景色を有する背景画素と、背景色とは異なる色を有する非背景画素と、に分類する。具体的には、CPU110は、特定の背景色(本実施例では、カバー450の対向面Bsの色)を示す背景色範囲内の色値を有する画素を、背景画素として分類し、背景色範囲外の色値を有する画素を、非背景画素として分類する。本実施例では、特定の背景色は、グレーであるので、背景色範囲は、グレーを示す色値の範囲である。背景色範囲は、例えば、彩度Cが彩度範囲CR1を満たし、かつ、輝度Yが輝度範囲YR1を満たす色値の範囲である。 In S335, the CPU 110 classifies the plurality of pixels located on the straight line of interest into a background pixel having a background color and a non-background pixel having a color different from the background color. Specifically, the CPU 110 classifies pixels having a color value within the background color range indicating a specific background color (in this embodiment, the color of the facing surface Bs of the cover 450) as the background pixel, and classifies the background color range. Pixels with outside color values are classified as non-background pixels. In this embodiment, since the specific background color is gray, the background color range is a range of color values indicating gray. The background color range is, for example, a range of color values in which the saturation C satisfies the saturation range CR1 and the luminance Y satisfies the luminance range YR1.

本実施例では、対向面Bsの色は、グレー(無彩色)であるので、彩度範囲CR1は、C≦Cthを満たす彩度Cの範囲である。閾値Cthは、例えば、彩度Cが0〜255の256階調で表される場合に、32である。 In this embodiment, the color of the facing surface Bs is gray (achromatic color), so the saturation range CR1 is the range of saturation C satisfying C ≦ Cth. The threshold value Cth is 32, for example, when the saturation C is represented by 256 gradations of 0 to 255.

輝度範囲YR1は、例えば、対向面Bsの色の輝度Ybsを中心とする範囲である。具体的には、輝度範囲YR1は、(Ybs−ΔY)≦Y≦(Ybs+ΔY)を満たす輝度Yの範囲である。ΔYは、例えば、輝度Yが0〜255の256階調で表される場合に、32である。白(輝度255)および黒(輝度0)は、輝度範囲YR1外である。 The luminance range YR1 is, for example, a range centered on the luminance Ybs of the color of the facing surface Bs. Specifically, the luminance range YR1 is a range of luminance Y satisfying (Ybs−ΔY) ≦ Y ≦ (Ybs + ΔY). ΔY is 32, for example, when the luminance Y is represented by 256 gradations of 0 to 255. White (luminance 255) and black (luminance 0) are outside the brightness range YR1.

例えば、図7において、背景画像Abを構成する画素は、背景画素に分類される。また、影画像SHや原稿画像Adを構成する画素は、非背景画素に分類される。 For example, in FIG. 7, the pixels constituting the background image Ab are classified into background pixels. Further, the pixels constituting the shadow image SH and the original image Ad are classified into non-background pixels.

S340では、CPU110は、注目直線上に、連続するK個以上の非背景画素が存在するか否かを判断する。Kは、2以上の整数であり、例えば、20である。注目直線上に連続するK個以上の非背景画素が存在しない場合には(S340:NO)、S342に処理を進める。 In S340, the CPU 110 determines whether or not there are K or more consecutive non-background pixels on the line of interest. K is an integer of 2 or more, for example 20. If there are no consecutive K or more non-background pixels on the straight line of interest (S340: NO), the process proceeds to S342.

S342では、CPU110は、注目直線が、探索の限界位置に到達したか否かを判断する。図6には、下側の開始直線Btに対応する探索の限界位置LLaが、図示されている。限界位置LLaは、開始直線Btから矢印BMの方向に、所定の幅Waだけ離れた位置である。矢印AMaは、開始直線Btと垂直な方向であり、原稿画像Adの中心に近づく方向である、と言うことができる。所定の幅Waは、例えば、3〜10cm分の幅に相当する画素数である。探索の限界位置に到達した場合には(S342:YES)、CPU110は、S344にて、処理対象の参照直線を、開始直線として決定する。探索の限界位置に到達していない場合には(S342:NO)、CPU110は、S345に処理を進める。 In S342, the CPU 110 determines whether or not the straight line of interest has reached the limit position of the search. FIG. 6 shows the search limit position LLa corresponding to the lower start straight line Bt. The limit position LLa is a position separated from the start straight line Bt in the direction of the arrow BM by a predetermined width Wa. It can be said that the arrow AMa is a direction perpendicular to the start straight line Bt and is a direction approaching the center of the original image Ad. The predetermined width Wa is, for example, the number of pixels corresponding to a width of 3 to 10 cm. When the search limit position is reached (S342: YES), the CPU 110 determines in S344 the reference straight line to be processed as the start straight line. If the search limit position has not been reached (S342: NO), the CPU 110 proceeds to S345.

S345では、CPU110は、現在の注目直線よりも1画素だけ原稿画像Ad側に位置する直線を、新たな注目直線として設定する。例えば、図7の参照直線L3Cが現在の注目直線である場合には、図7の隣接直線Lnxが新たな注目直線として設定される。隣接直線Lnxは、参照直線L3Cと平行であり、かつ、参照直線L3Cに対して原稿画像Adの外縁LPeに向かう側に隣接する直線である。このように、注目直線を原稿画像Adの外縁に向かって1画素分ずつずらしながら、図7の矢印AMの方向に開始直線の探索が行われる。 In S345, the CPU 110 sets a straight line located on the original image Ad side by one pixel from the current straight line of interest as a new straight line of interest. For example, when the reference straight line L3C in FIG. 7 is the current straight line of interest, the adjacent straight line Lnx in FIG. 7 is set as a new straight line of interest. The adjacent straight line Lnx is a straight line parallel to the reference straight line L3C and adjacent to the reference straight line L3C toward the outer edge LPe of the original image Ad. In this way, the search for the start straight line is performed in the direction of the arrow AM in FIG. 7 while shifting the straight line of interest toward the outer edge of the original image Ad by one pixel.

注目直線上に連続するK個以上の非背景画素が存在する場合には(S340:YES)、S350にて、CPU110は、現在の注目直線を、処理対象の参照直線に対応する開始直線として決定する。図7の例では、例えば、影画像SHの左側の外縁LSeの位置に、左側の参照直線L3Cに対応する開始直線Ltが決定される。 When there are K or more consecutive non-background pixels on the line of interest (S340: YES), in S350, the CPU 110 determines the current line of interest as the start line corresponding to the reference line to be processed. To do. In the example of FIG. 7, for example, the start straight line Lt corresponding to the reference straight line L3C on the left side is determined at the position of the outer edge LSe on the left side of the shadow image SH.

S355では、CPU110は、全ての参照直線L2C、L3C、L4C、L6Cを、処理対象として処理したか否かを判断する。未処理の参照直線がある場合には(S355:NO)、CPU110は、S325に処理を戻す。全ての参照直線が処理された場合には(S355:YES)、開始直線の決定を終了する。この時点で、4本の参照直線L2C、L3C、L4C、L6Cに対応する4本の開始直線Lt、Ut、Rt、Bt(図6)が決定されている。 In S355, the CPU 110 determines whether or not all the reference straight lines L2C, L3C, L4C, and L6C have been processed as processing targets. If there is an unprocessed reference line (S355: NO), the CPU 110 returns the process to S325. When all the reference straight lines have been processed (S355: YES), the determination of the start straight line ends. At this point, the four start lines Lt, Ut, Rt, and Bt (FIG. 6) corresponding to the four reference lines L2C, L3C, L4C, and L6C have been determined.

開始直線Lt、Ut、Rt、Btが決定されると、図2のS44にて、原稿領域AAの特定が行われる。図9は、原稿領域AAの特定の処理ステップを示すフローチャートである。 When the start straight lines Lt, Ut, Rt, and Bt are determined, the document region AA is specified in S44 of FIG. FIG. 9 is a flowchart showing a specific processing step of the document area AA.

S400では、CPU110は、4本の開始直線Lt、Ut、Rt、Btの中から、処理対象の一本の開始直線を選択する。例えば、原稿画像Adの左側の外縁LPeと略平行な左側の開始直線Ltが、処理対象の開始直線として選択される(図7)。S405では、CPU110は、処理対象の一本の開始直線を注目直線として設定する。すなわち、処理対象の一本の開始直線は、図9の原稿領域AAの特定の処理の最初の注目直線である。 In S400, the CPU 110 selects one start straight line to be processed from among the four start straight lines Lt, Ut, Rt, and Bt. For example, the left start straight line Lt substantially parallel to the left outer edge LPe of the original image Ad is selected as the start straight line to be processed (FIG. 7). In S405, the CPU 110 sets one start straight line to be processed as a straight line of interest. That is, one starting straight line to be processed is the first straight line of interest for the specific processing of the document area AA in FIG.

S410では、CPU110は、注目直線上に位置する複数個の画素を、背景画素と、原稿画素と、影画素と、に分類する。具体的には、CPU110は、上述した特定の背景色を示す背景色範囲内の色値を有する画素を、背景画素として分類する。また、CPU110は、原稿色範囲内の色値を有する画素を、原稿画素として分類し、影色範囲内の色値を有する画素を、影画素として分類する。 In S410, the CPU 110 classifies the plurality of pixels located on the straight line of interest into background pixels, original pixels, and shadow pixels. Specifically, the CPU 110 classifies pixels having a color value within the background color range indicating the above-mentioned specific background color as background pixels. Further, the CPU 110 classifies pixels having a color value within the document color range as document pixels, and classifies pixels having a color value within the shadow color range as shadow pixels.

原稿色範囲は、輝度Yが輝度範囲YR2を満たす、または、彩度Cが彩度範囲CR2を満たす色値の範囲である。輝度範囲YR2は、背景色範囲を定義する上述した輝度範囲YR1の上限値(Ybs+ΔY)より高い輝度Yの範囲である。すなわち、輝度範囲YR2は、Y>(Ybs+ΔY)を満たす輝度Yの範囲である。彩度範囲CR2は、背景色範囲を定義する上述した彩度範囲CR1の上限値Cthより高い彩度Cの範囲である。すなわち、彩度範囲CR2は、C>Cthを満たす彩度Cの範囲である。 The original color range is a range of color values in which the luminance Y satisfies the luminance range YR2 or the saturation C satisfies the saturation range CR2. The luminance range YR2 is a range of luminance Y higher than the upper limit value (Ybs + ΔY) of the above-mentioned luminance range YR1 that defines the background color range. That is, the luminance range YR2 is a range of luminance Y satisfying Y> (Ybs + ΔY). The saturation range CR2 is a range of saturation C higher than the upper limit value Cth of the above-mentioned saturation range CR1 that defines the background color range. That is, the saturation range CR2 is a range of saturation C that satisfies C> Cth.

影色範囲は、輝度Yが輝度範囲YR3を満たし、かつ、彩度Cが彩度範囲CR1を満たす色値の範囲である。輝度範囲YR3は、背景色範囲を定義する上述した輝度範囲YR1の下限値(Ybs−ΔY)より低い輝度Yの範囲である。すなわち、輝度範囲YR3は、Y<(Ybs−ΔY)を満たす輝度Yの範囲である。彩度範囲CR1は、背景色範囲を定義する上述した彩度範囲CR1と同じ範囲、すなわち、C≦Cthを満たす彩度Cの範囲である。このように、影画素は、背景画素とも原稿画素とも異なる色を有するので、異色画素とも呼ぶ。 The shadow color range is a range of color values in which the luminance Y satisfies the luminance range YR3 and the saturation C satisfies the saturation range CR1. The luminance range YR3 is a range of luminance Y lower than the lower limit value (Ybs−ΔY) of the above-mentioned luminance range YR1 that defines the background color range. That is, the luminance range YR3 is a range of luminance Y satisfying Y <(Ybs−ΔY). The saturation range CR1 is the same range as the above-mentioned saturation range CR1 that defines the background color range, that is, the range of saturation C that satisfies C ≦ Cth. As described above, since the shadow pixel has a color different from that of the background pixel and the original pixel, it is also called a different color pixel.

S415では、CPU110は、注目直線上の全画素に占める原稿画素の割合Raを算出する。すなわち、CPU110は、注目直線上の画素の総数PNtと、注目直線上の原稿画素の個数PNpと、を算出し、割合Raを算出する(Ra=(PNp/PNt))。 In S415, the CPU 110 calculates the ratio Ra of the original pixels to all the pixels on the straight line of interest. That is, the CPU 110 calculates the total number of pixels PNt on the straight line of interest and the number PNp of the original pixels on the straight line of interest, and calculates the ratio Ra (Ra = (PNp / Pnt)).

S420では、CPU110は、算出された割合Raが、所定の閾値THa以上であるか否かを判断する。閾値THaは、本実施例では、5%である。算出された割合Raが、所定の閾値THa未満である場合には(S420:NO)、CPU110は、S425に処理を進める。算出された割合Raが、所定の閾値THa以上である場合には(S420:YES)、CPU110は、S460に処理を進める。 In S420, the CPU 110 determines whether or not the calculated ratio Ra is equal to or greater than a predetermined threshold value THa. The threshold THa is 5% in this example. When the calculated ratio Ra is less than the predetermined threshold value THA (S420: NO), the CPU 110 proceeds to S425. When the calculated ratio Ra is equal to or greater than the predetermined threshold value THa (S420: YES), the CPU 110 proceeds to S460.

S425では、CPU110は、注目直線上の非背景画素に占める原稿画素の割合Rbを算出する。すなわち、CPU110は、注目線上の影画素の個数PNsと、原稿画素の個数PNpと、を算出し、割合Rbを算出する(Pb={PNp/(PNs+PNp)})。 In S425, the CPU 110 calculates the ratio Rb of the original pixel to the non-background pixel on the straight line of interest. That is, the CPU 110 calculates the number of shadow pixels PNs on the line of interest and the number of original pixels PNp, and calculates the ratio Rb (Pb = {PNp / (PNs + PNp)}).

S430では、CPU110は、算出された割合Rbが、所定の閾値THb以上であるか否かを判断する。閾値THbは、本実施例では、5%である。算出された割合Rbが、所定の閾値THb未満である場合には(S430:NO)、CPU110は、S435に処理を進める。算出された割合Rbが、所定の閾値THb以上である場合には(S430:YES)、CPU110は、S440に処理を進める。 In S430, the CPU 110 determines whether or not the calculated ratio Rb is equal to or greater than a predetermined threshold value THb. The threshold THb is 5% in this example. When the calculated ratio Rb is less than the predetermined threshold value THb (S430: NO), the CPU 110 proceeds to S435. When the calculated ratio Rb is equal to or higher than the predetermined threshold value THb (S430: YES), the CPU 110 proceeds to S440.

S435では、CPU110は、連続カウント値Ccをリセットする、すなわち、連続カウント値Ccを0とする。連続カウント値Ccは、割合Rbが閾値THb以上である注目直線が、注目直線と交差する方向(図7の矢印AMの方向)に連続する数をカウントするための変数である。 In S435, the CPU 110 resets the continuous count value Cc, that is, sets the continuous count value Cc to 0. The continuous count value Cc is a variable for counting the number of continuous lines of interest in which the ratio Rb is equal to or greater than the threshold value THb in the direction intersecting the straight lines of interest (direction of arrow AM in FIG. 7).

S440では、CPU110は、連続カウント値Ccをカウントアップする、すなわち、連続カウント値Ccに1を加算する。 In S440, the CPU 110 counts up the continuous count value Cc, that is, adds 1 to the continuous count value Cc.

S445では、CPU110は、連続カウント値Ccは、所定値Mであるか否かを判断する。所定値Mは、例えば、2mm分の幅に相当する画素数である。連続カウント値CcがMであることは、割合Rbが閾値THb以上である注目直線が、M本連続したことを意味している。連続カウント値CcがMである場合には(S445:YES)、CPU110は、S470に処理を進める。連続カウント値CcがM未満である場合には(S445:NO)、CPU110は、S450に処理を進める。 In S445, the CPU 110 determines whether or not the continuous count value Cc is a predetermined value M. The predetermined value M is, for example, the number of pixels corresponding to a width of 2 mm. When the continuous count value Cc is M, it means that there are M consecutive lines of interest in which the ratio Rb is equal to or higher than the threshold value THb. When the continuous count value Cc is M (S445: YES), the CPU 110 proceeds to S470. If the continuous count value Cc is less than M (S445: NO), the CPU 110 proceeds to S450.

S450では、CPU110は、注目直線が、探索の限界位置に到達したか否かを判断する。図6には、左側の開始直線Ltに対応する探索の限界位置LLが、図示されている。限界位置LLは、開始直線Ltから矢印AMの方向に、所定の幅Wだけ離れた位置である。矢印AMは、開始直線Ltと垂直な方向であり、原稿画像Adの中心に近づく方向である、とも言うことができる。所定の幅Wは、例えば、3〜10cm分の幅に相当する画素数である。探索の限界位置に到達した場合には(S455:YES)、CPU110は、S475にて、開始直線を外縁直線として決定する。探索の限界位置に到達していない場合には(S455:NO)、CPU110は、S455に処理を進める。 In S450, the CPU 110 determines whether or not the straight line of interest has reached the limit position of the search. FIG. 6 shows the search limit position LL corresponding to the start straight line Lt on the left side. The limit position LL is a position separated from the start straight line Lt in the direction of the arrow AM by a predetermined width W. It can also be said that the arrow AM is a direction perpendicular to the start straight line Lt and is a direction approaching the center of the original image Ad. The predetermined width W is, for example, the number of pixels corresponding to a width of 3 to 10 cm. When the search limit position is reached (S455: YES), the CPU 110 determines in S475 the start straight line as the outer edge straight line. If the search limit position has not been reached (S455: NO), the CPU 110 proceeds to S455.

S455では、CPU110は、現在の注目直線よりも1画素だけ原稿画像Adの中心側に位置する直線を、新たな注目直線として設定する。換言すれば、現在の注目直線と平行で、現在の注目直線に対して、原稿画像Adの中心に向かう側に隣接する直線を、新たな注目直線として設定する。S455の後に、CPU110は、S410に処理を戻す。このように、開始直線(例えば、開始直線Lt)から、原稿画像Adの中心に向かって、原稿画像Adの外縁(例えば、外縁LPe)を示す直線が探索される。 In S455, the CPU 110 sets a straight line located on the center side of the original image Ad by one pixel from the current straight line of interest as a new straight line of interest. In other words, a straight line parallel to the current straight line of interest and adjacent to the current straight line of interest toward the center of the original image Ad is set as a new straight line of interest. After S455, the CPU 110 returns the process to S410. In this way, from the start straight line (for example, the start straight line Lt), a straight line indicating the outer edge (for example, the outer edge LPe) of the original image Ad is searched toward the center of the original image Ad.

S460では、CPU110は、連続カウント値Ccは、1以上であるか否かを判断する。現在の注目直線の直前の注目直線において、割合Rbが閾値THb以上である場合には(S430:YES)、連続カウント値Ccは1以上である。連続カウント値Ccが1以上である場合には(S460:YES)、CPU110は、S470に処理を進める。連続カウント値Ccが1未満、すなわち、ゼロである場合には(S460:NO)、S465にて、CPU110は、現在の注目直線を、処理対象の開始直線に対応する外縁直線として決定する。 In S460, the CPU 110 determines whether or not the continuous count value Cc is 1 or more. In the straight line of interest immediately before the current straight line of interest, when the ratio Rb is equal to or greater than the threshold value THb (S430: YES), the continuous count value Cc is 1 or more. When the continuous count value Cc is 1 or more (S460: YES), the CPU 110 proceeds to S470. When the continuous count value Cc is less than 1, that is, zero (S460: NO), in S465, the CPU 110 determines the current straight line of interest as the outer edge straight line corresponding to the start straight line to be processed.

S470では、CPU110は、連続カウント値Ccのカウント開始時の注目直線を、外縁直線として決定する。すなわち、連続カウント値Ccが1以上である場合には、割合Rbが閾値THb以上である注目直線が少なくとも2本以上連続している。本ステップでは、2本以上連続している当該注目直線のうちの最初の注目直線を外縁直線として決定する。例えば、連続カウント値CcがMであれば、M本連続している注目直線のうちの最初の注目直線を外縁直線として決定される。上述したように、M本の連続する直線は、原稿画像Adの中心から離れる側(外側)から原稿画像Adの中心に向かう側(内側)に向かって順次に、注目直線として選択されるので、M本の連続する直線のうち、原稿画像Adから見て最も外側の直線が外縁直線として決定される。 In S470, the CPU 110 determines the straight line of interest at the start of counting the continuous count value Cc as the outer edge straight line. That is, when the continuous count value Cc is 1 or more, at least two or more straight lines of interest having a ratio Rb of the threshold value THb or more are continuous. In this step, the first straight line of interest among the two or more continuous straight lines of interest is determined as the outer edge straight line. For example, if the continuous count value Cc is M, the first straight line of interest among the M consecutive straight lines of interest is determined as the outer edge straight line. As described above, the M continuous straight lines are sequentially selected as the straight lines of interest from the side away from the center of the original image Ad (outside) toward the side toward the center of the original image Ad (inside). Of the M continuous straight lines, the outermost straight line when viewed from the original image Ad is determined as the outer edge straight line.

S480では、CPU110は、全ての開始直線Lt、Ut、Rt、Btを、処理対象として処理したか否かを判断する。未処理の開始直線がある場合には(S480:NO)、CPU110は、S400に処理を戻す。全ての開始直線が処理された場合には(S480:YES)、S485に処理を進める。この時点で、4本の開始直線Lt、Ut、Rt、Btに対応する4本の外縁直線、換言すれば、原稿画像Adの4個の外縁LPe、UPe、RPe、BPeに位置する4本の外縁直線が決定されている。例えば、図7の例では、原稿画像Adの左側の外縁LPeに位置する外縁直線Lfが決定される。外縁直線Lfは、対応する原稿画像Adの外縁LPeと略平行であり、対応する開始直線Ltと平行である。 In S480, the CPU 110 determines whether or not all the start straight lines Lt, Ut, Rt, and Bt have been processed as processing targets. If there is an unprocessed start straight line (S480: NO), the CPU 110 returns the process to S400. When all the start straight lines have been processed (S480: YES), the process proceeds to S485. At this point, the four outer edge straight lines corresponding to the four start straight lines Lt, Ut, Rt, and Bt, in other words, the four outer edge lines located at the four outer edge LPe, UPe, RPe, and BPe of the original image Ad. The outer edge straight line has been determined. For example, in the example of FIG. 7, the outer edge straight line Lf located at the outer edge LPe on the left side of the original image Ad is determined. The outer edge straight line Lf is substantially parallel to the outer edge LPe of the corresponding original image Ad, and is parallel to the corresponding start straight line Lt.

S485では、CPU110は、決定された4本の外縁直線に基づいて、原稿領域AAを特定する。具体的には、4本の外縁直線で形成される矩形の内部領域を原稿領域AAとして特定される。例えば、CPU110は、4本の外縁直線の4個の交点CP1〜CP4(図6)を特定することで、該4個の交点CP1〜CP4によって定義される原稿領域AAを特定する。 In S485, the CPU 110 identifies the document area AA based on the four determined outer edge straight lines. Specifically, the rectangular inner region formed by the four outer edge straight lines is specified as the document region AA. For example, the CPU 110 identifies the manuscript area AA defined by the four intersections CP1 to CP4 by specifying the four intersections CP1 to CP4 (FIG. 6) of the four outer edge straight lines.

A−5.補修処理
図2のS45の補修処理について説明する。補修処理は、上述したように、原稿領域AAの特定結果を用いて、読取画像データに対して実行される処理である。図10は、補修処理のフローチャートである。
A-5. Repair process The repair process of S45 in FIG. 2 will be described. As described above, the repair process is a process executed on the scanned image data using the specific result of the document area AA. FIG. 10 is a flowchart of the repair process.

図10のS510では、読取画像データに対して、原稿画像Adの傾きを補正する傾き補正処理が実行される。具体的には、例えば、原稿領域AAの左側の辺(左側の外縁直線Lf)の読取画像OIの縦方向に対する角度が算出される。そして、該角度分だけ読取画像OIを回転させることによって、原稿領域AAの左側の辺を、読取画像OIの縦方向と平行にする回転処理が実行される。 In S510 of FIG. 10, a tilt correction process for correcting the tilt of the original image Ad is executed on the scanned image data. Specifically, for example, the angle of the left side of the document area AA (the outer edge straight line Lf on the left side) with respect to the vertical direction of the scanned image OI is calculated. Then, by rotating the scanned image OI by the angle, the rotation process of making the left side of the document region AA parallel to the vertical direction of the scanned image OI is executed.

S520では、CPU110は、傾き補正済みの読取画像OIにおいて、原稿画像Adの欠落部分を描画する。具体的には、傾き補正済みの読取画像OIにおいて、輪郭画像OLIを用いて特定される原稿画像Adの輪郭よりも外側であって、かつ、原稿領域AAよりも内側の領域、具体的には、図6の領域Da、Dbが特定される。傾き補正済みの読取画像OIにおいて、領域Da、Db内の複数個の画素の値が、原稿画像Adの地色領域Saの色を示す値に置換される。地色領域Saの色を示す値には、例えば、輪郭画像OLIを用いて特定される原稿画像Adの輪郭に沿い、かつ、原稿画像Ad内に位置する複数個の画素の値の平均値が用いられる。 In S520, the CPU 110 draws a missing portion of the original image Ad in the tilt-corrected scanned image OI. Specifically, in the tilt-corrected scanned image OI, a region outside the contour of the original image Ad specified by using the contour image OLI and inside the original region AA, specifically, a region inside the original region AA. , The regions Da and Db of FIG. 6 are specified. In the tilt-corrected scanned image OI, the values of the plurality of pixels in the regions Da and Db are replaced with values indicating the color of the ground color region Sa of the original image Ad. The value indicating the color of the ground color region Sa is, for example, the average value of the values of a plurality of pixels located along the contour of the original image Ad specified by using the contour image OLI and within the original image Ad. Used.

S530では、CPU110は、欠落部分が描画済の読取画像OIにおいて、背景画像Abの色を、指定色に変更する。具体的には、傾き補正済みの読取画像OIにおいて、原稿領域AAの外側に位置する複数個の画素の値が、予め指定された色(例えば、白)を示す値に置換される。これによって、図3(D)の補修済画像RIを示す補修済画像データが生成される。 In S530, the CPU 110 changes the color of the background image Ab to the designated color in the read image OI in which the missing portion has been drawn. Specifically, in the tilt-corrected scanned image OI, the values of the plurality of pixels located outside the original area AA are replaced with values indicating a color (for example, white) specified in advance. As a result, the repaired image data showing the repaired image RI of FIG. 3D is generated.

以上説明した本実施例の原稿領域特定処理(図8、図9)によれば、CPU110は、読取画像データを用いて、読取画像OI(図6)内の注目直線を決定する(S405、S455)。注目直線は、原稿画像の外縁LPe、UPe、RPe、BPeのいずれかに平行な直線である(図6、図7)。CPU110は、読取画像データを用いて、注目直線に位置する複数個の画素を、原稿画素を含む3種類の画素、具体的には、原稿画素と背景画素と影画素とに分類する(S410)。CPU110は、3種類の画素のうち、原稿画素の個数PNpと、原稿画素を含む3種類の画素の個数(すなわち、注目直線上の画素の総数PNt)と、原稿画素を含む2種類の画素の個数(具体的には、影画素の個数PNsと原稿画素の個数PNpとの和((PNs+PNp)))と、を算出し、割合Ra、Rbを算出する(S415、S430)。CPU110は、注目直線が外縁直線であるか否かを判断するための第1の条件を満たすか否かを判断する(S420)。第1の条件は、上述のように、割合Raが閾値THa以上であることである。CPU110は、注目直線が第1の条件とは異なる第2の条件を満たすか否かを判断する(S430〜S445)。第2の条件は、注目直線を含むM本の直線であって、注目直線に平行で注目直線と交差する方向(図7の矢印AMの方向)に連続するM本の直線のそれぞれが特定条件を満たすことである(S430〜S445)。特定条件は、割合Rbが閾値THb以上であることである(S430)。CPU110は、注目直線が第1の条件を満たす場合(S420:YES)、注目直線に基づいて原稿画像Adの外縁に位置する外縁直線(例えば、図7の外縁直線Lf)を決定する(S460〜S470)。また、CPU110は、注目直線が第2の条件を満たす場合に(S430:YES、かつ、S445:YES)、注目直線に基づいて外縁直線を決定する(S470)。CPU110は、外縁直線を用いて、原稿画像Adに対応する原稿領域AAを特定する。この結果、注目直線が第1条件を満たすか否かと、注目直線が第2条件を満たすか否かと、が判断され得る。そして、注目直線が第1の条件を満たす場合と、注目直線が第2の条件を満たす場合とに、注目直線に基づいて原稿画像Adの外縁に位置する外縁直線が決定される。この結果、外縁直線を適切に決定できる。したがって、外縁直線を用いて、原稿領域AAを精度良く特定できる。 According to the document area specifying process (FIGS. 8 and 9) of the present embodiment described above, the CPU 110 uses the scanned image data to determine the straight line of interest in the scanned image OI (FIG. 6) (S405, S455). ). The straight line of interest is a straight line parallel to any of the outer edges LPe, UPe, RPe, and BPe of the original image (FIGS. 6 and 7). The CPU 110 uses the scanned image data to classify the plurality of pixels located on the straight line of interest into three types of pixels including the original pixel, specifically, the original pixel, the background pixel, and the shadow pixel (S410). .. The CPU 110 has three types of pixels, the number of original pixels PNp, the number of three types of pixels including the original pixels (that is, the total number of pixels on the straight line of interest PNT), and the number of two types of pixels including the original pixels. The number (specifically, the sum of the number PNs of shadow pixels and the number PNp of original pixels ((PNs + PNp))) is calculated, and the ratios Ra and Rb are calculated (S415, S430). The CPU 110 determines whether or not the first condition for determining whether or not the straight line of interest is an outer edge straight line is satisfied (S420). The first condition is that the ratio Ra is equal to or higher than the threshold value THa, as described above. The CPU 110 determines whether or not the straight line of interest satisfies the second condition different from the first condition (S430 to S445). The second condition is M straight lines including the straight line of interest, and each of the M straight lines parallel to the straight line of interest and continuous in the direction intersecting the straight line of interest (direction of arrow AM in FIG. 7) is a specific condition. Satisfy (S430-S445). The specific condition is that the ratio Rb is equal to or higher than the threshold value THb (S430). When the straight line of interest satisfies the first condition (S420: YES), the CPU 110 determines an outer straight line (for example, the outer straight line Lf of FIG. 7) located at the outer edge of the original image Ad based on the straight line of interest (S460-). S470). Further, the CPU 110 determines the outer edge straight line based on the straight line of interest (S470) when the straight line of interest satisfies the second condition (S430: YES and S445: YES). The CPU 110 uses the outer edge straight line to specify the document area AA corresponding to the document image Ad. As a result, it can be determined whether or not the straight line of interest satisfies the first condition and whether or not the straight line of interest satisfies the second condition. Then, when the straight line of interest satisfies the first condition and when the straight line of interest satisfies the second condition, the outer edge straight line located at the outer edge of the original image Ad is determined based on the straight line of interest. As a result, the outer edge straight line can be appropriately determined. Therefore, the original region AA can be accurately specified by using the outer edge straight line.

図11は、原稿領域の特定の一例を示す図である。図11(A)は、ラベルシール付きの原稿を示す原稿画像Adaと影画像SHaと背景画像Abaとを含む読取画像の拡大図ARaを示す。この拡大図ARaは、原稿画像Adaの左側の外縁LPeaの近傍を拡大して示している。原稿画像Adaは、外側に向かって突出したラベルシールを示すラベル画像LBを含んでいる。この例では、原稿画像Ada(ラベル画像LBを含む)の全体を含むように原稿領域AAが特定されることが好ましく、原稿画像Adaの一部がはみ出すような原稿領域AAが特定されることは好ましくない。したがって、図11(A)の読取画像では、原稿領域AAを定義する外縁直線は、図11(A)の直線La1の位置に決定されることが好ましい。例えば、外縁直線が、直線La2の位置に決定されると、ラベル画像LBが、原稿領域AAの外側にはみ出すので好ましくない。 FIG. 11 is a diagram showing a specific example of the document area. FIG. 11A shows an enlarged view ARa of a scanned image including a manuscript image Ada, a shadow image Sha, and a background image Aba showing a manuscript with a label sticker. This enlarged view ARa is shown by enlarging the vicinity of the outer edge LPea on the left side of the original image Ada. The manuscript image Ada includes a label image LB showing a label sticker protruding outward. In this example, the manuscript area AA is preferably specified so as to include the entire manuscript image Ada (including the label image LB), and the manuscript area AA such that a part of the manuscript image Ada protrudes is specified. Not preferred. Therefore, in the scanned image of FIG. 11 (A), the outer edge straight line that defines the document region AA is preferably determined at the position of the straight line La1 of FIG. 11 (A). For example, if the outer edge straight line is determined at the position of the straight line La2, the label image LB protrudes outside the document area AA, which is not preferable.

図11(A)の読取画像の場合において、上述した第1の条件だけを用いるとする。すなわち、注目直線上の全画素に占める原稿画素の割合Raが閾値THa以上である場合に、注目直線を外縁直線として特定するとする。この場合には、直線La2の位置に外縁直線が決定されてしまう。例えば、直線La1が注目直線である場合には、直線La1上の画素のほとんどが背景画像Abaを示す背景画素に分類されてしまうからである。 In the case of the scanned image of FIG. 11A, only the first condition described above is used. That is, when the ratio Ra of the original pixels to all the pixels on the straight line of interest is equal to or greater than the threshold value THa, the straight line of interest is specified as the outer edge straight line. In this case, the outer edge straight line is determined at the position of the straight line La2. For example, when the straight line La1 is a straight line of interest, most of the pixels on the straight line La1 are classified as background pixels indicating the background image Aba.

これに対して、上述した第2の条件を用いる場合、すなわち、注目直線を含む連続するM本の直線のそれぞれにおいて直線上の非背景画素(原稿画素+影画素)に占める原稿画素の割合Rbが閾値THb以上である場合に、M本の直線のうち、原稿画像Adaから見て最も外側の直線を外縁直線として特定するとする。この場合には、直線La1の位置に外縁直線を決定することができる。 On the other hand, when the second condition described above is used, that is, the ratio Rb of the original pixel to the non-background pixels (original pixel + shadow pixel) on the straight line in each of the continuous M straight lines including the straight line of interest Rb. When is equal to or greater than the threshold THb, it is assumed that the outermost straight line seen from the original image Ada is specified as the outer edge straight line among the M straight lines. In this case, the outer edge straight line can be determined at the position of the straight line La1.

図11(B)には、複数本の黒い罫線(例えば、RL1、RL2)を端部の近傍に有する原稿を示す原稿画像Adbと影画像SHbと背景画像Abbとを含む読取画像の拡大図ARbである。拡大図ARbは、原稿画像Adbの左側の外縁LPebの近傍を拡大して示している。この例では、原稿画像Adbの全体を含む原稿領域AAを特定するために、外縁直線は、直線Lb1の位置に決定されることが好ましい。 FIG. 11B shows an enlarged view ARb of a scanned image including a manuscript image Adb, a shadow image SHb, and a background image Abb showing a manuscript having a plurality of black ruled lines (for example, RL1 and RL2) in the vicinity of the edges. Is. The enlarged view ARb shows the vicinity of the outer edge LPeb on the left side of the original image Adb in an enlarged manner. In this example, the outer edge straight line is preferably determined at the position of the straight line Lb1 in order to identify the manuscript region AA including the entire manuscript image Adb.

図11(B)の読取画像の場合において、上述した第2の条件だけを用いるとする。この場合には、注目直線が、原稿画像Adbに示される罫線RL1上にある場合には、割合Rbは閾値THb未満になる。罫線RL1上にある画素は、黒色であるので、原稿画素に分類されず、影画素に分類されるためである。したがって、直線Lb1を含むM本の直線に、罫線RL1上の直線が含まれる場合には、連続カウント値Ccがリセットされる結果、直線Lb1が外縁直線として決定されない。 In the case of the scanned image of FIG. 11B, only the above-mentioned second condition is used. In this case, when the straight line of interest is on the ruled line RL1 shown in the original image Adb, the ratio Rb is less than the threshold value THb. This is because the pixels on the ruled line RL1 are black, so that they are not classified as original pixels but are classified as shadow pixels. Therefore, when the M straight lines including the straight line Lb1 include a straight line on the ruled line RL1, the continuous count value Cc is reset, and as a result, the straight line Lb1 is not determined as the outer edge straight line.

これに対して、上述した第1の条件を用いる場合には、直線Lb1が注目直線である場合に、割合Raが閾値THa以上になるので、直線Lb1が適切に外縁直線として決定される。 On the other hand, when the first condition described above is used, when the straight line Lb1 is the straight line of interest, the ratio Ra is equal to or higher than the threshold value THa, so that the straight line Lb1 is appropriately determined as the outer edge straight line.

以上の説明から解るように、本実施例では、第1の条件と第2の条件とを併用して、外縁直線が決定されるので、例えば、様々な種類の読取画像を示す読取画像データが用いられる場合に、適切な原稿領域AAを特定することができる。例えば、図11(A)の原稿画像Adaを含む読取画像であっても、図11(B)の原稿画像Adbを含む読取画像であっても、これらの読取画像上に適切な原稿領域AAを特定することができる。 As can be seen from the above description, in the present embodiment, the outer edge straight line is determined by using the first condition and the second condition in combination. Therefore, for example, the scanned image data showing various types of scanned images can be obtained. When used, an appropriate manuscript area AA can be identified. For example, whether it is a scanned image including the original image Ada of FIG. 11 (A) or a scanned image including the original image Adb of FIG. 11 (B), an appropriate document area AA is provided on these scanned images. Can be identified.

ここで、第2の条件では、注目直線だけでなく、注目直線を含むM本の直線のそれぞれについて、割合Rbが閾値THb以上であることが要求される理由について説明する。割合Rbは、注目直線上の画素の総数PNtに代えて、非背景画素の個数(PNp/PNt)を分母とする。このために、注目直線上の原稿画素の個数PNpが比較的少ない場合であっても、割合Rbが閾値THb以上になりやすい。したがって、注目直線だけに着目して判断すると、例えば、ノイズなどの影響によって、原稿画像Adの外縁とは無関係な場所に誤って外縁直線を決定する可能性が高くなる。本実施例の第2の条件では、注目直線を含むM本の直線のそれぞれに着目して判断するので、誤った外縁直線が決定されることを抑制できる。 Here, in the second condition, the reason why the ratio Rb is required to be equal to or higher than the threshold value THb for each of the M straight lines including the straight line of interest as well as the straight line of interest will be described. The ratio Rb uses the number of non-background pixels (PNp / Pnt) as the denominator instead of the total number of pixels PNT on the straight line of interest. Therefore, even when the number of original pixels PNp on the straight line of interest is relatively small, the ratio Rb tends to be equal to or higher than the threshold value THb. Therefore, if the judgment is made by paying attention only to the straight line of interest, for example, there is a high possibility that the outer edge straight line is erroneously determined at a place irrelevant to the outer edge of the original image Ad due to the influence of noise or the like. In the second condition of this embodiment, since the determination is made by paying attention to each of the M straight lines including the straight line of interest, it is possible to suppress the determination of an erroneous outer edge straight line.

さらに、上記実施例によれば、読取画像OIは、原稿画像Ad以外の領域を示す画像として、背景画像Abと、背景色とは異なる色を有する影画像SHと、を含む(図7)。CPU110は、原稿画素と背景画素と影画素との3種類の画素を用いて、割合Raを算出し、原稿画素と影画素との2種類の画素を用いて、背景画素を用いずに、割合Rbを算出する。この結果、割合Raと、割合Rbと、を用いて、原稿領域AAを精度良く特定できる。 Further, according to the above embodiment, the scanned image OI includes a background image Ab and a shadow image SH having a color different from the background color as an image showing a region other than the original image Ad (FIG. 7). The CPU 110 calculates the ratio Ra using three types of pixels of the original pixel, the background pixel, and the shadow pixel, and uses the two types of pixels of the original pixel and the shadow pixel without using the background pixel. Calculate Rb. As a result, the original region AA can be accurately specified by using the ratio Ra and the ratio Rb.

さらに、上記実施例によれば、CPU110は、注目直線が第1の条件を満たす場合には(S420:YES)、現在の注目直線を外縁直線として決定し得る(S465)。この結果、適切な外縁直線を決定できる。 Further, according to the above embodiment, the CPU 110 can determine the current straight line of interest as the outer edge straight line when the straight line of interest satisfies the first condition (S420: YES) (S465). As a result, an appropriate outer edge straight line can be determined.

さらに、上記実施例によれば、CPU110は、注目直線が第1の条件を満たし(S420:YES)、かつ、連続カウント値Ccが1以上である場合には(S460:YES)、連続カウント値Ccのカウント開始時の注目直線を外縁直線として決定する(S470)。連続カウント値Ccが1以上である場合とは、注目直線から図7の矢印AMとは反対の方向に連続するK本の直線(KはM未満の整数)のそれぞれにおいて、割合Rbが閾値THb以上であることを意味する。矢印AMとは反対の方向は、注目直線と交差する方向であって、原稿画像Adの中心から離れる方向である。連続カウント値Ccのカウント開始時の注目直線を外縁直線として決定することは、連続するK本の直線のうち、矢印AMとは反対の方向の端に位置する直線を外縁直線として決定することを意味する。この構成によれば、K本の連続する直線のうち、原稿画像Adの中心から離れる方向の端に位置する直線が外縁直線として決定される。この結果、原稿画像Adの全体が含まれる適切な原稿領域AAを決定できる。上述したように、外縁直線は、原稿画像Adが原稿領域AAの外側にはみ出さないように決定されることが好ましい。このために、外縁直線である可能性がある直線が複数本ある場合には、該複数本の直線のうち、原稿画像Adの中心から離れた直線を、外縁直線として決定することが適切であると考えられる。 Further, according to the above embodiment, when the straight line of interest satisfies the first condition (S420: YES) and the continuous count value Cc is 1 or more (S460: YES), the CPU 110 has a continuous count value. The straight line of interest at the start of counting Cc is determined as the outer edge straight line (S470). When the continuous count value Cc is 1 or more, the ratio Rb is the threshold value THb in each of the K straight lines (K is an integer less than M) continuous in the direction opposite to the arrow AM in FIG. 7 from the straight line of interest. It means that it is the above. The direction opposite to the arrow AM is a direction that intersects the straight line of interest and is a direction away from the center of the original image Ad. Determining the straight line of interest at the start of counting of the continuous count value Cc as the outer edge straight line means that the straight line located at the end of the continuous K straight lines in the direction opposite to the arrow AM is determined as the outer edge straight line. means. According to this configuration, among the K continuous straight lines, the straight line located at the end in the direction away from the center of the original image Ad is determined as the outer edge straight line. As a result, an appropriate manuscript area AA including the entire manuscript image Ad can be determined. As described above, it is preferable that the outer edge straight line is determined so that the original image Ad does not protrude outside the original area AA. For this reason, when there are a plurality of straight lines that may be outer edge straight lines, it is appropriate to determine the straight line away from the center of the original image Ad as the outer edge straight line among the plurality of straight lines. it is conceivable that.

さらに、上記実施例によれば、CPU110は、注目直線が第2の条件を満たす場合には(S430:YES、かつ、S445:YES)、連続するM本の直線のうち、図7の矢印AMとは反対の方向の端に位置する直線が、外縁直線として決定される(S470)。この結果、原稿画像Adの全体が含まれる適切な原稿領域AAを決定できる。 Further, according to the above embodiment, when the straight line of interest satisfies the second condition (S430: YES and S445: YES), the CPU 110 has the arrow AM of FIG. 7 out of the continuous M straight lines. A straight line located at the end in the opposite direction is determined as the outer edge straight line (S470). As a result, an appropriate manuscript area AA including the entire manuscript image Ad can be determined.

さらに、上記実施例によれば、CPU110は、縮小画像データを解析することによって、注目直線を決定するための特定するための解析情報を取得する。具体的には、CPU110は、縮小画像データを用いてエッジ二値画像データを生成し(図2のS20、S25)、該エッジ二値画像データを用いて輪郭画像データを生成し(図2のS30)、輪郭画像データを用いて縮小画像MI上に4本の暫定直線L2、L3、L4、L6を決定する(図8のS310〜S320)。暫定直線L2、L3、L4、L6を示す情報、具体的には、S310にてハフ変換によって取得される情報は、注目直線を決定するための特定するための解析情報と言うことができる。このように、縮小画像データを解析するので、注目直線を決定するための処理時間、ひいては、外縁直線を決定するための処理時間を低減できる。また、縮小画像データを用いて解析する場合であっても、外縁直線を適切に決定できるので、読取画像OI内の原稿領域AAを精度良く特定できる。 Further, according to the above embodiment, the CPU 110 acquires analysis information for identification for determining the straight line of interest by analyzing the reduced image data. Specifically, the CPU 110 generates edge binary image data using the reduced image data (S20 and S25 in FIG. 2), and generates contour image data using the edge binary image data (FIG. 2). S30), four provisional straight lines L2, L3, L4, and L6 are determined on the reduced image MI using the contour image data (S310 to S320 in FIG. 8). The information indicating the provisional straight lines L2, L3, L4, and L6, specifically, the information acquired by the Hough transform in S310 can be said to be the analysis information for identifying the straight line of interest. Since the reduced image data is analyzed in this way, the processing time for determining the straight line of interest, and by extension, the processing time for determining the outer edge straight line can be reduced. Further, even when the analysis is performed using the reduced image data, the outer edge straight line can be appropriately determined, so that the document region AA in the scanned image OI can be accurately specified.

さらに、上記実施例によれば、CPU110は、図8のS320にて、4本の暫定直線L2、L3、L4、L6を特定することによって、原稿画像Adの傾きを特定する。CPU110は、図9にて原稿領域AAを特定する際に、4本の暫定直線L2、L3、L4、L6に対応する参照直線L2C、L3C、L4C、L6Cのいずれかと平行な注目直線を決定する(S405、S455)。この結果、原稿画像Adの傾きに応じた傾きを有する注目直線が適切に決定される。 Further, according to the above embodiment, the CPU 110 specifies the inclination of the original image Ad by specifying the four provisional straight lines L2, L3, L4, and L6 in S320 of FIG. When specifying the document area AA in FIG. 9, the CPU 110 determines a straight line of interest parallel to any of the reference straight lines L2C, L3C, L4C, and L6C corresponding to the four provisional straight lines L2, L3, L4, and L6. (S405, S455). As a result, a straight line of interest having an inclination corresponding to the inclination of the original image Ad is appropriately determined.

さらに、上記実施例によれば、CPU110は、原稿画像Adの特定の外縁LPe(図7)から原稿画像Adの外側に離れた参照直線L3C(図7)を特定し(図8のS322)、参照直線L3Cから特定の外縁LPeに向かって、探索条件を満たす直線を探索する(S330〜S345)。探索条件は、対象の直線上に、連続するK個以上の非背景画素が存在することである(S340)。そして、CPU110は、最初に探索条件を満たす直線を、開始直線、すなわち、図9の原稿領域AAの特定における最初の注目直線として決定する(図8のS350)。この構成によれば、参照直線L3Cを特定した後には、参照直線L3Cから特定の外縁LPeに向かって比較的簡易な探索条件を用いて注目直線を決定するので、原稿領域AAを特定するための処理時間を低減できる。例えば、図9の原稿領域AAの特定で用いられる第1の条件と第2の条件の判断では、注目直線上の複数個の画素を、背景画素と原稿画素と影画素との3種類の画素に分類する必要があるが、上記探索条件の判断では、背景画素と非背景画素の2種類の画素に分類するだけで良い。 Further, according to the above embodiment, the CPU 110 identifies a reference straight line L3C (FIG. 7) away from the specific outer edge LPe (FIG. 7) of the document image Ad outside the document image Ad (S322 in FIG. 8). A straight line satisfying the search condition is searched from the reference straight line L3C toward the specific outer edge LPe (S330 to S345). The search condition is that there are K or more consecutive non-background pixels on the target straight line (S340). Then, the CPU 110 first determines a straight line satisfying the search condition as a starting straight line, that is, as the first straight line of interest in specifying the document area AA in FIG. 9 (S350 in FIG. 8). According to this configuration, after the reference straight line L3C is specified, the straight line of interest is determined from the reference straight line L3C toward the specific outer edge LPe using a relatively simple search condition. The processing time can be reduced. For example, in the determination of the first condition and the second condition used for specifying the document area AA in FIG. 9, a plurality of pixels on the line of interest are defined as three types of pixels, a background pixel, a document pixel, and a shadow pixel. However, in the determination of the above search conditions, it is sufficient to classify the pixels into two types of pixels, a background pixel and a non-background pixel.

さらに、上記実施例によれば、図9のS450にて、注目直線が探索の限界位置に到達した場合には(S450:YES)、開始直線が外縁直線として決定される(S475)。注目直線が探索の限界位置に到達した場合には、第1の条件や第2の条件を用いて原稿画像Adの外縁の位置に、外縁直線を決定することは困難であると考えられる。この場合には、開始直線が外縁直線として決定されるので、原稿画像Adの外側に、外縁直線が決定される可能性を高くすることができる。この結果、原稿画像Adの一部がはみ出ないように、適切な原稿領域AAを決定することができる。 Further, according to the above embodiment, in S450 of FIG. 9, when the straight line of interest reaches the limit position of the search (S450: YES), the starting straight line is determined as the outer edge straight line (S475). When the straight line of interest reaches the limit position of the search, it is considered difficult to determine the outer edge straight line at the position of the outer edge of the original image Ad using the first condition and the second condition. In this case, since the start straight line is determined as the outer edge straight line, it is possible to increase the possibility that the outer edge straight line is determined outside the original image Ad. As a result, an appropriate document area AA can be determined so that a part of the document image Ad does not protrude.

さらに、上記実施例によれば、図8のS342にて、注目直線が探索の限界位置に到達した場合には(S342:YES)、参照直線が、開始直線として決定される(S344)。注目直線が探索の限界位置に到達した場合には、S340の判断条件では、開始条件を決定することは困難であると考えられる。この場合には、参照直線が開始直線として決定されるので、原稿画像Adの外側に、確実に開始直線を決定することができる。原稿画像Adの内部に、開始直線が誤って決定されると、図9の処理にて外縁直線を適切に決定できない可能性が高い。本実施例では、このような不都合を避けて、図9の処理にて、外縁直線を適切に決定できる可能性を高くすることができる。 Further, according to the above embodiment, in S342 of FIG. 8, when the straight line of interest reaches the limit position of the search (S342: YES), the reference straight line is determined as the starting straight line (S344). When the straight line of interest reaches the limit position of the search, it is considered difficult to determine the start condition under the determination condition of S340. In this case, since the reference straight line is determined as the start straight line, the start straight line can be reliably determined outside the original image Ad. If the start straight line is erroneously determined inside the original image Ad, there is a high possibility that the outer edge straight line cannot be appropriately determined by the process of FIG. In this embodiment, it is possible to avoid such inconveniences and increase the possibility that the outer edge straight line can be appropriately determined by the process of FIG.

B.変形例:
(1)上記実施例の原稿領域AAの特定(図9)では、注目直線に位置する複数個の画素は、3種類の画素に分類される(S410)。これに代えて、これらの複数個の画素は、4種類の画素、例えば、原稿画素と、背景画素と、影画素と、他の画素と、に分類されても良い。例えば、原稿の地色領域Saの色が白であると解っている場合には、白を示す色値を有する画素が原稿画素に分類され、背景色を示す色値を有する画素が背景画素に分類され、黒を示す色を有する画素が影画素に分類され、いずれでもない画素が他の画素に分類されても良い。さらに、この場合には、第1の条件の判断に用いられる割合Raは、他の画素を除いた3種類の画素に占める原稿画素の割合であっても良い。そして、第2の条件の判断に用いられる割合Rbは、影画素と原稿画素との2種類の画素に占める原稿画素の割合であっても良い。
B. Modification example:
(1) In the identification of the document area AA of the above embodiment (FIG. 9), the plurality of pixels located on the straight line of interest are classified into three types of pixels (S410). Instead of this, these plurality of pixels may be classified into four types of pixels, for example, a document pixel, a background pixel, a shadow pixel, and another pixel. For example, when it is known that the color of the ground color region Sa of the document is white, the pixels having the color value indicating white are classified as the document pixels, and the pixels having the color value indicating the background color are classified as the background pixels. Pixels having a color indicating black may be classified as shadow pixels, and pixels that are neither of them may be classified into other pixels. Further, in this case, the ratio Ra used for determining the first condition may be the ratio of the original pixel to the three types of pixels excluding the other pixels. The ratio Rb used for determining the second condition may be the ratio of the original pixels to the two types of pixels, the shadow pixels and the original pixels.

また、注目直線に位置する複数個の画素は、5種類の画素に分類され、さらに、割合Raは、そのうちの4種類の画素に占める原稿画素の割合であり、割合Rbは、そのうちの3種類の画素に占める原稿画素の割合であっても良い。割合Raの算出に用いる画素は、原稿画素を含めばよく、例えば、背景画素や影画素の少なくとも一方を含まなくても良いし、他の種類の画素(例えば、ノイズ画素)を含んでも良い。また、割合Rbの算出に用いる画素は、原稿画素を含めば良く、例えば、影画素を含まなくても良いし、背景画素を含んでも良い。 Further, the plurality of pixels located in the straight line of interest are classified into five types of pixels, the ratio Ra is the ratio of the original pixel to the four types of pixels, and the ratio Rb is three types of them. It may be the ratio of the original pixel to the pixel of. The pixels used for calculating the ratio Ra may include original pixels, for example, may not include at least one of background pixels and shadow pixels, or may include other types of pixels (for example, noise pixels). Further, the pixels used for calculating the ratio Rb may include original pixels, and may not include shadow pixels or may include background pixels, for example.

一般的に言えば、注目直線に位置する複数個の画素は、原稿画素を含むN種類の画素(Nは3以上の整数)に分類され、割合Raは、N種類の画素のうち、原稿画素を含むN1種類の画素(N1は3≦N1≦Nを満たす整数)の個数に占める原稿画素の割合であり、割合Rbは、N種類の画素のうち、原稿画素を含むN2種類の画素(N2は2≦N2<N1を満たす整数)に占める原稿画素の割合であっても良い。 Generally speaking, a plurality of pixels located on the straight line of interest are classified into N types of pixels including original pixel (N is an integer of 3 or more), and the ratio Ra is the original pixel among the N types of pixels. Is the ratio of the original pixel to the number of N1 type pixels (N1 is an integer satisfying 3 ≦ N1 ≦ N) including, and the ratio Rb is N2 type pixels (N2) including the original pixel among the N types of pixels. May be the ratio of the original pixels to 2 ≦ N2 <an integer satisfying N1).

(2)上記実施例では、読取画像データを用いて、読取画像データによって示される読取画像OI内の原稿画像Adに対応する原稿領域AAが特定される。これに代えて、読取画像データを用いて生成される他の画像データによって示される画像内の原稿画像に対応する原稿領域が特定されても良い。他の画像データは、例えば、読取画像データに対して、画像を拡大する拡大処理を実行して得られる拡大画像データであっても良い。一般的には、読取画像データに基づく対象画像データ(例えば、読取画像データそのもの、または、上記拡大画像データ)を用いて、対象画像データによって示される対象画像内の原稿領域が特定されれば良い。 (2) In the above embodiment, the scanned image data is used to specify the document region AA corresponding to the document image Ad in the scanned image OI indicated by the scanned image data. Instead of this, a manuscript region corresponding to the manuscript image in the image represented by other image data generated using the scanned image data may be specified. The other image data may be, for example, enlarged image data obtained by executing an enlargement process for enlarging the image on the read image data. Generally, the target image data based on the scanned image data (for example, the scanned image data itself or the enlarged image data) may be used to specify the manuscript area in the target image indicated by the target image data. ..

(3)上記実施例の図9のS465では、現在の注目直線が外縁直線として決定されているが、これに限られない。例えば、原稿画像Adが原稿領域AAからはみ出る可能性をより低減するために、現在の注目直線よりも、原稿画像Adの中心から所定画素(例えば、1または2画素)だけ離れた直線であって注目直線と平行な直線が、外縁直線として決定されても良い。 (3) In S465 of FIG. 9 of the above embodiment, the current straight line of interest is determined as the outer edge straight line, but the present invention is not limited to this. For example, in order to further reduce the possibility that the original image Ad protrudes from the original area AA, it is a straight line separated from the center of the original image Ad by a predetermined pixel (for example, 1 or 2 pixels) from the current straight line of interest. A straight line parallel to the straight line of interest may be determined as the outer edge straight line.

(4)上記実施例の図9において、S460は省略されても良い。この場合には、例えば、注目直線が第1の条件を満たす場合には(S420:YES)、常に、S465にて、CPU110は、現在の注目直線を外縁直線として決定しても良い。 (4) In FIG. 9 of the above embodiment, S460 may be omitted. In this case, for example, when the straight line of interest satisfies the first condition (S420: YES), the CPU 110 may always determine the current straight line of interest as the outer edge straight line in S465.

(5)上記実施例の図9において、注目直線が第2の条件を満たす場合には(S430:YES、かつ、S445:YES)、連続カウント値Ccのカウント開始時の注目直線が外縁直線として決定される(S470)。これに代えて、例えば、現在の注目直線、あるいは、現在の注目直線よりも所定画素(例えば、1また2画素)だけ原稿画像Adの中心から離れた直線であって注目直線と平行な直線が、外縁直線として決定されても良い。 (5) In FIG. 9 of the above embodiment, when the straight line of interest satisfies the second condition (S430: YES and S445: YES), the straight line of interest at the start of counting the continuous count value Cc is set as the outer edge straight line. It is determined (S470). Instead, for example, a straight line of interest or a straight line that is separated from the center of the original image Ad by a predetermined pixel (for example, 1 or 2 pixels) from the current straight line of interest and is parallel to the straight line of interest. , May be determined as an outer edge straight line.

(6)上記実施例の図8のS325〜S355の処理は省略されても良い。この場合には、図9のS400では、S322にて決定された4本の参照直線L2C、L3C、L4C、L6Cの中から、1本の開始直線が選択され、S410では、当該選択された開始直線(参照直線)が、最初の注目直線として設定される。 (6) The processing of S325 to S355 in FIG. 8 of the above embodiment may be omitted. In this case, in S400 of FIG. 9, one start straight line is selected from the four reference straight lines L2C, L3C, L4C, and L6C determined in S322, and in S410, the selected start line is selected. A straight line (reference straight line) is set as the first straight line of interest.

(7)上記実施例の図8のS310では、ハフ変換を用いて、候補直線の傾きおよび位置が決定されている。これに代えて、最小二乗法を用いて、候補直線の傾きおよび位置が決定されてもよい。また、例えば、原稿画像Adは傾いていないことを前提とするならば、S322で決定される4本の参照直線は、読取画像OIの外形の4辺に位置する直線であっても良い。この場合には、図8のS310、S320は省略されても良い。 (7) In S310 of FIG. 8 of the above embodiment, the slope and position of the candidate straight line are determined by using the Hough transform. Alternatively, the least squares method may be used to determine the slope and position of the candidate straight line. Further, for example, assuming that the original image Ad is not tilted, the four reference straight lines determined in S322 may be straight lines located on the four sides of the outer shape of the scanned image OI. In this case, S310 and S320 in FIG. 8 may be omitted.

(6)図2の画像処理のステップは、適宜に省略や変形が可能である。例えば、上記実施例の図2のS15は省略され、縮小画像データは生成されなくても良い。この場合には、図2のS20〜S30の処理は、縮小されていない読取画像データを用いて実行されても良い。 (6) The image processing step of FIG. 2 can be omitted or modified as appropriate. For example, S15 in FIG. 2 of the above embodiment is omitted, and the reduced image data may not be generated. In this case, the processes S20 to S30 of FIG. 2 may be executed using the unreduced scanned image data.

また、S20、S25では、読取画像データを用いて、エッジ二値画像データが生成されるが、これに代えて、単純二値画像データが生成されても良い。単純二値画像データは、例えば、読取画像OI内の複数個の画素を、背景色を有する背景画素と、それ以外の色を有する非背景画素と、に分類して得られる二値画像データである。この場合には、図4の輪郭特定処理のS115では、エッジ画素に代えて、非背景画素が探索され、S120では、最初に探索された非背景画素が輪郭画素として記録される。 Further, in S20 and S25, edge binary image data is generated using the scanned image data, but instead, simple binary image data may be generated. The simple binary image data is, for example, binary image data obtained by classifying a plurality of pixels in the scanned image OI into a background pixel having a background color and a non-background pixel having another color. is there. In this case, in S115 of the contour specifying process of FIG. 4, non-background pixels are searched instead of edge pixels, and in S120, the first searched non-background pixels are recorded as contour pixels.

(8)図10の補修処理は、適宜に変更可能である。例えば、S510〜S530の3個のステップのうち、1個または2個のステップは省略されても良い。また、補修処理に代えて、原稿領域AAの特定結果は、他の画像処理、例えば、トリミング処理のために利用されても良い。 (8) The repair process of FIG. 10 can be changed as appropriate. For example, one or two steps may be omitted out of the three steps S510 to S530. Further, instead of the repair process, the specific result of the document area AA may be used for another image process, for example, a trimming process.

(9)原稿を光学的に読み取る装置は、図1で説明したスキャナ400に代えて、原稿を光学的に読み取ることが可能な他の種々の装置であってよい。例えば、スキャナ400は、原稿を搬送するための自動給紙装置(Auto Document Feeder)を備え、搬送される原稿を、停止したイメージセンサ420で読み取るタイプのスキャナであっても良い。また、原稿を光学的に読み取る装置は、2次元イメージセンサを用いて、原稿を光学的に読み取るデジタルカメラであっても良い。 (9) The device for optically reading the document may be various other devices capable of optically reading the document, instead of the scanner 400 described with reference to FIG. For example, the scanner 400 may be a type of scanner that includes an automatic document feeder for transporting documents and reads the conveyed documents with a stopped image sensor 420. Further, the device that optically reads the document may be a digital camera that optically reads the document by using a two-dimensional image sensor.

また、画像処理装置100のCPU110は、画像処理装置100に接続されたスキャナ400から、読取画像データを取得することに代えて、不揮発性記憶装置130や、画像処理装置100に接続された図示しない外部記憶装置(例えば、USBメモリ)に予め格納された読取画像データを取得してもよい。 Further, the CPU 110 of the image processing device 100 is not shown, which is connected to the non-volatile storage device 130 or the image processing device 100, instead of acquiring the scanned image data from the scanner 400 connected to the image processing device 100. The scanned image data stored in advance in an external storage device (for example, a USB memory) may be acquired.

(10)図2の画像処理は、パーソナルコンピュータとは異なる種類の装置によって実行されても良い。例えば、画像処理は、スキャナ(例えば、スキャナ400)のCPU411によって実行されても良い。画像処理は、ネットワークに接続されたサーバ装置によって実行されても良い。画像処理は、ネットワークを介して互いに通信可能な複数の装置(例えば、コンピュータ)によって、一部ずつ分担して実行されても良い。この場合には、該複数の装置の全体が、画像処理装置に対応する。 (10) The image processing of FIG. 2 may be executed by a device of a type different from that of a personal computer. For example, the image processing may be executed by the CPU 411 of the scanner (for example, the scanner 400). Image processing may be performed by a server device connected to the network. The image processing may be partially shared and executed by a plurality of devices (for example, a computer) capable of communicating with each other via a network. In this case, the entire plurality of devices corresponds to the image processing device.

上記各実施例において、ハードウェアによって実現されていた構成の一部をソフトウェアに置き換えるようにしてもよく、逆に、ソフトウェアによって実現されていた構成の一部あるいは全部をハードウェアに置き換えるようにしてもよい。 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.

また、本発明の機能の一部または全部がコンピュータプログラムで実現される場合には、そのプログラムは、コンピュータ読み取り可能な記録媒体(例えば、一時的ではない記録媒体)に格納された形で提供することができる。プログラムは、提供時と同一または異なる記録媒体(コンピュータ読み取り可能な記録媒体)に格納された状態で、使用され得る。「コンピュータ読み取り可能な記録媒体」は、メモリーカードやCD−ROMのような携帯型の記録媒体に限らず、各種ROM等のコンピュータ内の内部記憶装置や、ハードディスクドライブ等のコンピュータに接続されている外部記憶装置も含み得る。 Further, 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 can be modified and improved without departing from the spirit and claims, and the present invention includes equivalents thereof.

100…画像処理装置、110…CPU、120…揮発性記憶装置、130…不揮発性記憶装置、132…プログラム、140…表示部、150…操作部、190…インタフェース、400…スキャナ、410…制御部、411…CPU、412…揮発性記憶装置、413…不揮発性記憶装置、414…プログラム、419…インタフェース、420…イメージセンサ、430…移動装置、440…原稿台、450…カバー、PXe…エッジ画素、AA…原稿領域、SH…影画像、EI…エッジ二値画像、RI…補修済画像、OI…読取画像、MI…縮小画像、LL…限界位置、NT…ネットワーク、Sa…地色領域、Ab…背景画像、Cc…連続カウント値、Ad…原稿画像、Ob1、Ob2…オブジェクト、OLI…輪郭画像 100 ... image processing device, 110 ... CPU, 120 ... volatile storage device, 130 ... non-volatile storage device, 132 ... program, 140 ... display unit, 150 ... operation unit, 190 ... interface, 400 ... scanner, 410 ... control unit 411 ... CPU, 412 ... Volatile storage device, 413 ... Non-volatile storage device, 414 ... Program, 419 ... Interface, 420 ... Image sensor, 430 ... Mobile device, 440 ... Document stand, 450 ... Cover, PXe ... Edge pixel , AA ... original area, SH ... shadow image, EI ... edge binary image, RI ... repaired image, OI ... scanned image, MI ... reduced image, LL ... limit position, NT ... network, Sa ... ground color area, Ab ... Background image, Cc ... Continuous count value, Ad ... Original image, Ob1, Ob2 ... Object, OLI ... Contour image

Claims (9)

画像処理装置であって、
原稿を光学的に読み取ることによって生成される読取画像データを取得する画像データ取得部と、
前記読取画像データに基づく対象画像データを用いて、前記対象画像データによって示される対象画像内の注目直線を決定する注目直線決定部であって、前記対象画像は、前記原稿を示す原稿画像を含み、前記注目直線は、前記原稿画像の特定の外縁に平行な直線である、前記注目直線決定部と、
前記対象画像データを用いて、前記注目直線に位置する複数個の画素を、それぞれ、前記原稿画像を構成する原稿画素を含むN種類の画素(Nは3以上の整数)に分類する分類部と、
前記N種類の画素のうち、前記原稿画素の個数と、前記原稿画素を含むN1種類の画素(N1は3≦N1≦Nを満たす整数)の個数と、前記原稿画素を含むN2種類の画素(N2は2≦N2<N1を満たす整数)の個数と、を算出する個数算出部と、
前記注目直線が第1の条件を満たすか否かを判断する第1の条件判断部であって、前記第1の条件は、前記注目直線に位置する前記N1種類の画素に占める前記原稿画素の割合が第1の閾値以上であることである、前記第1の条件判断部と、
前記注目直線が前記第1の条件とは異なる第2の条件を満たすか否かを判断する第2の条件判断部であって、前記第2の条件は、前記注目直線に平行で前記注目直線と交差する方向に連続するM本の直線(Mは2以上の整数)のそれぞれが特定条件を満たすことであり、前記M本の直線は、前記注目直線を含み、前記特定条件は、対象の直線に位置する前記N2種類の画素に占める前記原稿画素の割合が第2の閾値以上であることである、前記第2の条件判断部と、
前記注目直線が前記第1の条件を満たす場合に、前記注目直線に基づいて前記原稿画像の外縁に位置する外縁直線を決定する第1の外縁直線決定部と、
前記注目直線が前記第2の条件を満たす場合に、前記注目直線に基づいて前記外縁直線を決定する第2の外縁直線決定部と、
前記外縁直線を用いて、前記対象画像内の前記原稿画像に対応する原稿領域を特定する領域特定部と、
を備える、画像処理装置。
It is an image processing device
An image data acquisition unit that acquires scanned image data generated by optically scanning a document, and an image data acquisition unit.
A focus straight line determining unit that determines a straight line of interest in the target image indicated by the target image data using the target image data based on the scanned image data, and the target image includes a manuscript image showing the manuscript. , The attention straight line is a straight line parallel to a specific outer edge of the original image.
Using the target image data, a classification unit that classifies a plurality of pixels located on the straight line of interest into N types of pixels (N is an integer of 3 or more) including the original pixels constituting the original image. ,
Among the N types of pixels, the number of the manuscript pixels, the number of N1 types of pixels including the manuscript pixels (N1 is an integer satisfying 3 ≦ N1 ≦ N), and N2 types of pixels including the manuscript pixels ( N2 is the number of 2 ≦ N2 <an integer satisfying N1), and the number calculation unit for calculating
A first condition determination unit for determining whether or not the straight line of interest satisfies the first condition, and the first condition is that of the original pixel among the N1 type pixels located on the straight line of interest. The first condition determination unit, wherein the ratio is equal to or higher than the first threshold value.
A second condition determination unit for determining whether or not the line of interest satisfies a second condition different from the first condition, and the second condition is parallel to the straight line of interest and the straight line of interest. Each of the M straight lines (M is an integer of 2 or more) continuous in the direction intersecting with the specific condition is satisfied, the M straight lines include the attention straight line, and the specific condition is the target. The second condition determination unit, wherein the ratio of the original pixel to the N2 types of pixels located in a straight line is equal to or greater than the second threshold value.
When the attention straight line satisfies the first condition, the first outer edge straight line determining unit that determines the outer edge straight line located at the outer edge of the original image based on the attention straight line,
A second outer edge straight line determining unit that determines the outer edge straight line based on the attention straight line when the attention straight line satisfies the second condition.
A region specifying portion that specifies a document region corresponding to the document image in the target image using the outer edge straight line, and a region specifying portion.
An image processing device.
請求項1に記載の画像処理装置であって、
前記対象画像は、前記原稿画像以外の領域を示す画像として、特定の背景色を有する背景画像と、前記特定の背景色とは異なる色を有する異色画像と、を含み、
前記N1種類の画素は、前記原稿画素と、前記背景画像を構成する背景画素と、前記異色画像を構成する異色画素と、を含み、
前記N2種類の画素は、前記原稿画素と、前記異色画素と、を含み、前記背景画素を含まない、画像処理装置。
The image processing apparatus according to claim 1.
The target image includes, as an image showing a region other than the original image, a background image having a specific background color and a different color image having a color different from the specific background color.
The N1 type of pixel includes the original pixel, the background pixel constituting the background image, and the different color pixel constituting the different color image.
An image processing apparatus in which the N2 types of pixels include the original pixel and the different color pixel, and do not include the background pixel.
請求項1に記載の画像処理装置であって、さらに、
前記対象画像は、前記原稿画像以外の領域を示す画像として、特定の背景色を有する背景画像を含み、
前記注目直線決定部は、
前記原稿画像の特定の外縁に沿う参照直線であって、前記原稿画像の前記特定の外縁から前記原稿画像の外側に離れた前記参照直線を特定し、
前記参照直線から前記特定の外縁に向かって、所定条件を満たす直線を探索し、
最初に前記所定条件を満たす直線を最初の前記注目直線として決定し、
前記所定条件は、対象の直線上に連続する特定数の画素であって、前記特定の背景色とは異なる色を有する前記特定数の画素が存在することである、画像処理装置。
The image processing apparatus according to claim 1, further
The target image includes a background image having a specific background color as an image showing a region other than the original image.
The line of interest determination unit
A reference straight line that is a reference straight line along a specific outer edge of the original image and is separated from the specific outer edge of the original image to the outside of the original image is specified.
A straight line satisfying a predetermined condition is searched from the reference straight line toward the specific outer edge.
First, a straight line satisfying the predetermined condition is determined as the first straight line of interest, and then the straight line is determined.
The predetermined condition is an image processing apparatus in which a specific number of pixels are continuous on a straight line of interest, and the specific number of pixels having a color different from the specific background color is present.
請求項1〜3のいずれかに記載の画像処理装置であって、
前記第1の外縁直線決定部は、前記注目直線が前記第1の条件を満たす場合には、前記注目直線を前記外縁直線として決定する、画像処理装置。
The image processing apparatus according to any one of claims 1 to 3.
The first outer edge straight line determining unit is an image processing device that determines the straight line of interest as the outer edge straight line when the straight line of interest satisfies the first condition.
請求項1〜のいずれかに記載の画像処理装置であって、
前記第1の外縁直線決定部は、前記注目直線が前記第1の条件を満たし、かつ、前記注目直線から特定方向に連続するK本の直線(KはM未満の整数)のそれぞれが前記特定条件を満たす場合には、連続する前記K本の直線のうち、前記特定方向の端に位置する直線を前記外縁直線として決定し、
前記特定方向は、前記注目直線と交差する方向であって、前記原稿画像の中心から離れる方向である、画像処理装置。
The image processing apparatus according to any one of claims 1 to 4.
In the first outer edge straight line determination unit, each of the K straight lines (K is an integer less than M) continuous from the attention straight line in a specific direction while the attention straight line satisfies the first condition is specified. When the condition is satisfied, the straight line located at the end in the specific direction among the K continuous straight lines is determined as the outer edge straight line.
An image processing device in which the specific direction intersects the straight line of interest and is away from the center of the original image.
請求項1〜のいずれかに記載の画像処理装置であって、
前記第2の外縁直線決定部は、前記注目直線が前記第2の条件を満たす場合には、連続する前記M本の直線のうち、前記注目直線と交差する方向であって前記原稿画像の中心から離れる方向の端に位置する直線を前記外縁直線として決定する、画像処理装置。
The image processing apparatus according to any one of claims 1 to 5.
When the attention straight line satisfies the second condition, the second outer edge straight line determination unit is in the direction intersecting the attention straight line among the continuous M straight lines and is the center of the manuscript image. An image processing device that determines a straight line located at an end in a direction away from the outer edge straight line as the outer edge straight line.
請求項1〜のいずれかに記載の画像処理装置であって、さらに、
前記読取画像データを用いて画像を縮小する縮小処理を実行して、縮小画像を示す縮小画像データを生成する縮小処理部と、
前記縮小画像データを解析することによって、前記注目直線を決定するための特定するための解析情報を取得する解析部と、
を備え、
前記対象画像は、前記縮小処理が実行されていない前記読取画像データによって示される読取画像であり、
前記注目直線決定部は、前記解析情報を用いて、前記読取画像内に前記注目直線を決定し、
前記第1の外縁直線決定部および前記第2の外縁直線決定部は、前記読取画像内に前記外縁直線を決定する、画像処理装置。
The image processing apparatus according to any one of claims 1 to 6, further comprising.
A reduction processing unit that executes a reduction process for reducing an image using the scanned image data to generate reduced image data indicating the reduced image, and a reduction processing unit.
An analysis unit that acquires analysis information for identification for determining the straight line of interest by analyzing the reduced image data, and an analysis unit.
With
The target image is a scanned image indicated by the scanned image data on which the reduction process has not been executed.
The attention straight line determination unit determines the attention straight line in the read image by using the analysis information.
The first outer edge straight line determining unit and the second outer edge straight line determining unit are image processing devices that determine the outer edge straight line in the scanned image.
請求項1〜のいずれかに記載の画像処理装置であって、さらに、
前記読取画像データを解析することによって、前記対象画像内の前記原稿画像の傾きを特定する傾特定部を備え、
前記注目直線決定部は、特定済の前記原稿画像の傾きに応じた傾きを有する前記注目直線を決定する、画像処理装置。
The image processing apparatus according to any one of claims 1 to 7.
A tilt specifying unit for specifying the tilt of the original image in the target image by analyzing the scanned image data is provided.
The attention straight line determining unit is an image processing device that determines the attention straight line having an inclination corresponding to the inclination of the specified original image.
コンピュータプログラムであって、
原稿を光学的に読み取ることによって生成される読取画像データを取得する画像データ取得機能と、
前記読取画像データに基づく対象画像データを用いて、前記対象画像データによって示される対象画像内の注目直線を決定する注目直線決定機能であって、前記対象画像は、前記原稿を示す原稿画像を含み、前記注目直線は、前記原稿画像の特定の外縁に平行な直線である、前記注目直線決定機能と、
前記対象画像データを用いて、前記注目直線に位置する複数個の画素を、それぞれ、前記原稿画像を構成する原稿画素を含むN種類の画素(Nは3以上の整数)に分類する分類機能と、
前記N種類の画素のうち、前記原稿画素の個数と、前記原稿画素を含むN1種類の画素(N1は3≦N1≦Nを満たす整数)の個数と、前記原稿画素を含むN2種類の画素(N2は2≦N2<N1を満たす整数)の個数と、を算出する個数算出機能と、
前記注目直線が第1の条件を満たすか否かを判断する第1の条件判断機能であって、前記第1の条件は、前記注目直線に位置する前記N1種類の画素に占める前記原稿画素の割合が第1の閾値以上であることである、前記第1の条件判断機能と、
前記注目直線が前記第1の条件とは異なる第2の条件を満たすか否かを判断する第2の条件判断機能であって、前記第2の条件は、前記注目直線に平行で前記注目直線と交差する方向に連続するM本の直線(Mは2以上の整数)のそれぞれが特定条件を満たすことであり、前記M本の直線は、前記注目直線を含み、前記特定条件は、対象の直線に位置する前記N2種類の画素に占める前記原稿画素の割合が第2の閾値以上であることである、前記第2の条件判断機能と、
前記注目直線が前記第1の条件を満たす場合に、前記注目直線に基づいて前記原稿画像の外縁に位置する外縁直線を決定する第1の外縁直線決定機能と、
前記注目直線が前記第2の条件を満たす場合に、前記注目直線に基づいて前記外縁直線を決定する第2の外縁直線決定機能と、
前記外縁直線を用いて、前記対象画像内の前記原稿画像に対応する原稿領域を特定する領域特定機能と、
をコンピュータに実現させる、コンピュータプログラム。
It ’s a computer program,
An image data acquisition function that acquires scanned image data generated by optically scanning a document, and
It is a attention straight line determination function for determining a line of interest in a target image indicated by the target image data using the target image data based on the scanned image data, and the target image includes a manuscript image showing the manuscript. The attention straight line is a straight line parallel to a specific outer edge of the original image.
Using the target image data, a classification function for classifying a plurality of pixels located on the straight line of interest into N types of pixels (N is an integer of 3 or more) including the original pixels constituting the original image. ,
Among the N types of pixels, the number of the manuscript pixels, the number of N1 types of pixels including the manuscript pixels (N1 is an integer satisfying 3 ≦ N1 ≦ N), and N2 types of pixels including the manuscript pixels ( N2 is the number of 2 ≦ N2 <an integer that satisfies N1), and the number calculation function that calculates
It is a first condition determination function for determining whether or not the straight line of interest satisfies the first condition, and the first condition is the original pixel occupying the N1 type of pixel located on the straight line of interest. The first condition determination function that the ratio is equal to or higher than the first threshold value, and
It is a second condition determination function for determining whether or not the attention straight line satisfies a second condition different from the first condition, and the second condition is parallel to the attention straight line and the attention straight line. Each of the M straight lines (M is an integer of 2 or more) continuous in the direction intersecting with the specific condition is satisfied, the M straight lines include the attention straight line, and the specific condition is the target. The second condition determination function, wherein the ratio of the original pixel to the N2 types of pixels located on a straight line is equal to or greater than the second threshold value.
A first outer edge straight line determination function that determines an outer edge straight line located at the outer edge of the original image based on the attention straight line when the attention straight line satisfies the first condition.
A second outer edge straight line determination function that determines the outer edge straight line based on the attention straight line when the attention straight line satisfies the second condition.
An area identification function for specifying a document area corresponding to the document image in the target image using the outer edge straight line, and
A computer program that makes a computer realize.
JP2017151734A 2017-08-04 2017-08-04 Image processing equipment and computer programs Active JP6897405B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017151734A JP6897405B2 (en) 2017-08-04 2017-08-04 Image processing equipment and computer programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017151734A JP6897405B2 (en) 2017-08-04 2017-08-04 Image processing equipment and computer programs

Publications (2)

Publication Number Publication Date
JP2019033318A JP2019033318A (en) 2019-02-28
JP6897405B2 true JP6897405B2 (en) 2021-06-30

Family

ID=65523678

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017151734A Active JP6897405B2 (en) 2017-08-04 2017-08-04 Image processing equipment and computer programs

Country Status (1)

Country Link
JP (1) JP6897405B2 (en)

Family Cites Families (1)

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

Also Published As

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

Similar Documents

Publication Publication Date Title
JP5547243B2 (en) Image processing apparatus, program, and recording medium
JP3883696B2 (en) Method for scanning and detecting multiple photos and removing artificial edges
US9007662B2 (en) Image processing apparatus, image processing method, and image processing program recorded recording medium
CN103198468B (en) Image processing apparatus, image processing method and image processing system
WO2013108727A1 (en) Image-capturing device, captured image processing system, program, and recording medium
JP6426815B2 (en) Image processing apparatus and image processing method
JP6021665B2 (en) Image processing apparatus, image processing method, and computer program
JP5222126B2 (en) Image processing method, image processing apparatus, and program
JP5819378B2 (en) Image determination apparatus, image processing system, program, and recording medium
JP5228705B2 (en) Image reading apparatus, image reading method, image reading program, and storage medium storing image reading program
JP7440821B2 (en) Image processing device, method, and computer program
JP6897405B2 (en) Image processing equipment and computer programs
JP6892625B2 (en) Data processing equipment and computer programs
JP6852618B2 (en) Computer programs and image processing equipment
JP6974791B2 (en) Image processing equipment and computer programs
US8422785B2 (en) Image processing apparatus, image processing method, and program
JP6828463B2 (en) Computer programs and image processing equipment
JP6905210B2 (en) Image processing equipment and computer programs
JP7301529B2 (en) Image processing device, image processing method, and program
JP2022066697A (en) Image processing device, image processing method and computer program
CN116051401B (en) A fisheye image correction method and system based on geometric model and effective region extraction algorithm
JP7667529B2 (en) Computer program, recording medium, and image processing device
US10944877B2 (en) Image processing system, image processing apparatus, and image processing method
JP2008140208A (en) Image processing device, pattern extraction method, and pattern extraction 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: 20210301

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210303

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210414

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: 20210511

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210524

R150 Certificate of patent or registration of utility model

Ref document number: 6897405

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150