JP2019016897A - Image processing system, and computer program - Google Patents

Image processing system, and computer program Download PDF

Info

Publication number
JP2019016897A
JP2019016897A JP2017132294A JP2017132294A JP2019016897A JP 2019016897 A JP2019016897 A JP 2019016897A JP 2017132294 A JP2017132294 A JP 2017132294A JP 2017132294 A JP2017132294 A JP 2017132294A JP 2019016897 A JP2019016897 A JP 2019016897A
Authority
JP
Japan
Prior art keywords
image
pixels
image data
document
pixel
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.)
Granted
Application number
JP2017132294A
Other languages
Japanese (ja)
Other versions
JP6905210B2 (en
Inventor
長谷川 智彦
Tomohiko Hasegawa
智彦 長谷川
鑑地 吉田
Akiji Yoshida
鑑地 吉田
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 JP2017132294A priority Critical patent/JP6905210B2/en
Publication of JP2019016897A publication Critical patent/JP2019016897A/en
Application granted granted Critical
Publication of JP6905210B2 publication Critical patent/JP6905210B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Editing Of Facsimile Originals (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

To identify the document area in a read image accurately.SOLUTION: An image processing system includes an image data acquisition part for acquiring read image data indicating a read image, generated by reading a document optically, and including a first image showing the document and a second image showing the area other than the document, a first image generation part for identifying multiple pixels satisfying specific conditions as multiple first pixels, and identifying multiple pixels not satisfying specific conditions as multiple second pixels, thus generating first image data showing multiple first pixels and second pixels, a second image generation part generating second image data showing multiple edge pixels in the read image, and an identification part for identifying the document area in the read image by using at least the first and second image data. The identification conditions include brilliance within a specific brilliance range, and the specific brilliance range is a range including the brilliance of pixels corresponding to the second image.SELECTED DRAWING: Figure 4

Description

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

従来から、スキャナなどの画像読取装置を用いて、原稿を含む読取画像(例えば、文書画像)を表す読取画像データが生成されている。例えば、特許文献1に開示されたコンピュータは、R、G、Bの3個のチャンネルを有するカラー文書画像から、既存のエッジ抽出方法を用いて、エッジ画像を取得する。コンピュータは、カラー文書画像から、R、G、Bの3個のチャンネルの値の差異が比較的小さな画素と、R、G、Bの3個の成分の値の差異が比較的大きな画素と、を示す二値化画像を取得する。コンピュータは、エッジ画像と、二値化画像と、を合併して得られる画像を用いて、カラー文書内の所定領域を特定する。   Conventionally, read image data representing a read image including a document (for example, a document image) is generated using an image reading device such as a scanner. For example, the computer disclosed in Patent Document 1 acquires an edge image from a color document image having three channels of R, G, and B using an existing edge extraction method. From the color document image, the computer has a pixel having a relatively small difference in values of the three channels R, G, and B, and a pixel having a relatively large difference in values of the three components R, G, and B; A binarized image indicating is obtained. The computer specifies a predetermined area in the color document using an image obtained by merging the edge image and the binarized image.

特開2016−167810号公報Japanese Patent Laid-Open No. 2006-167810

しかしながら、上記技術では、例えば、所定領域外に対応する画素の色味と所定領域に対応する画素の色味とが比較的近い場合には精度良く所定領域を特定できない可能性があった。   However, in the above technique, for example, there is a possibility that the predetermined area cannot be accurately identified when the color of the pixel corresponding to outside the predetermined area is relatively close to the color of the pixel corresponding to the predetermined area.

本明細書は、読取画像内の原稿領域を精度良く特定できる技術を開示する。   This specification discloses a technique that can accurately specify a document area in a read image.

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

[適用例1]画像処理装置であって、原稿を光学的に読み取ることによって生成される読取画像データを取得する画像データ取得部であって、前記読取画像データは、前記原稿を示す第1の画像と前記原稿以外の領域を示す第2の画像とを含む読取画像を示す、前記画像データ取得部と、前記読取画像データを用いて、特定条件を満たす複数個の画素を、前記複数個の第1の画素として特定し、前記特定条件を満たさない複数個の画素を、前記複数個の第2の画素として特定することによって、前記複数個の第1の画素と前記複数個の第2の画素と示す第1画像データを生成する第1画像生成部であって、前記特定条件は、特定輝度範囲内の輝度を有することを含み、前記特定輝度範囲は、前記第2の画像に対応する画素の輝度を含む範囲である、前記第1画像生成部と、前記読取画像データを用いて、前記読取画像内のエッジを示す複数個のエッジ画素を示す第2画像データを生成する第2画像生成部と、少なくとも前記第1画像データと前記第2画像データとを用いて、前記読取画像内の前記原稿に対応する原稿領域を特定する特定部と、を備える、画像処理装置。 Application Example 1 An image processing apparatus, an image data acquisition unit that acquires read image data generated by optically reading a document, wherein the read image data is a first indicating the document. A plurality of pixels satisfying a specific condition using the image data acquisition unit and the read image data, each of which represents a read image including an image and a second image indicating a region other than the document. The plurality of first pixels and the plurality of second pixels are identified as the first pixels and a plurality of pixels that do not satisfy the specific condition are identified as the plurality of second pixels. A first image generation unit configured to generate first image data indicating a pixel, wherein the specific condition includes a luminance within a specific luminance range, and the specific luminance range corresponds to the second image; In the range including pixel brightness A first image generation unit, a second image generation unit for generating second image data indicating a plurality of edge pixels indicating edges in the read image using the read image data, and at least the first image generation unit. An image processing apparatus comprising: a specifying unit that specifies a document area corresponding to the document in the read image using one image data and the second image data.

上記構成によれば、第2の画像内の複数個の画素の輝度を含む輝度の範囲である特定輝度範囲内の輝度を有することを含む特定条件を満たす複数個の第1画素と、特定条件を満たさない複数個の第2画素と、を示す第1画像データと、複数個のエッジ画素を示す第2画像データとを用いて、読取画像内の原稿領域を特定する。この結果、読取画像内の原稿領域の特定精度を向上できる。   According to the above configuration, the plurality of first pixels that satisfy the specific condition including having the luminance within the specific luminance range that is the luminance range including the luminance of the plurality of pixels in the second image, and the specific condition A document region in the read image is specified using first image data indicating a plurality of second pixels not satisfying the above and second image data indicating a plurality of edge pixels. As a result, the accuracy of specifying the document area in the read image can be improved.

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

画像処理システムの構成を示す図である。It is a figure which shows the structure of an image processing system. 本実施例の画像処理のフローチャートである。It is a flowchart of the image processing of a present Example. 画像処理で用いられる画像の一例を示す図である。It is a figure which shows an example of the image used by image processing. 原稿画素特定処理のフローチャートである。It is a flowchart of an original pixel specifying process. 原稿画素特定処理で用いられる画像の一例を示す図である。6 is a diagram illustrating an example of an image used in document pixel specifying processing. FIG. 縮小画像MIのヒストグラムの一例を示す図である。It is a figure which shows an example of the histogram of the reduced image MI. 探索範囲決定処理のフローチャートである。It is a flowchart of a search range determination process. 探索範囲決定処理の説明図である。It is explanatory drawing of a search range determination process. 輪郭特定処理のフローチャートである。It is a flowchart of an outline specific process. 輪郭特定処理の説明図である。It is explanatory drawing of an outline specific process. 原稿領域特定処理のフローチャートである。It is a flowchart of a document area specifying process. 補修処理のフローチャートである。It is a flowchart of a repair process.

A.第1実施例:
A−1.画像処理システムの構成
図1は、一実施例としての画像処理システムの構成を示す図である。この画像処理システムは、画像処理装置100と、スキャナ400と、を含んでいる。画像処理装置100とスキャナ400とは、ネットワークNTに接続されており、互いに通信可能である。
A. First embodiment:
A-1. Configuration of Image Processing System FIG. 1 is a diagram illustrating a configuration of an image processing system as an embodiment. This image processing system includes an image processing apparatus 100 and a scanner 400. The image processing apparatus 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 apparatus 100 is, for example, a personal computer (for example, a desktop computer or a tablet computer). The image processing apparatus 100 includes a CPU 110 as a controller of the image processing apparatus 100, a volatile storage device 120, a nonvolatile storage device 130, a display unit 140 that displays an image, an operation unit 150 that receives an operation by a user, Interface 190. 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 device (processor) that performs data processing. The volatile storage device 120 is, for example, a DRAM, and the nonvolatile storage device 130 is, for example, a flash memory. The nonvolatile storage device 130 stores a program 132. The CPU 110 executes the program 132 to cause the scanner 400 to read a document and generate output image data representing the read document (details will be described later). The program 132 may be a scanner driver for controlling the scanner 400, for example. The CPU 110 temporarily stores various intermediate data used for executing the program 132 in a storage device (for example, one of the volatile storage device 120 and the nonvolatile storage device 130). The program 132 is provided by the manufacturer of the scanner 400, for example.

表示部140は、画像を表示する装置であり、例えば、液晶ディスプレイである。これに代えて、LEDディスプレイ、有機ELディスプレイなどの、画像を表示する他の種類の装置を採用してもよい。操作部150は、ユーザによる操作を受け取る装置であり、例えば、表示部140上に重ねて配置されたタッチパネルである。これに代えて、ボタン、レバーなどの、ユーザによって操作される他の種類の装置を採用してもよい。ユーザは、操作部150を操作することによって、種々の指示を画像処理装置100に入力可能である。   The display unit 140 is a device that displays an image, and is, for example, a liquid crystal display. Instead of this, other types of devices that display images, such as LED displays and organic EL displays, may be employed. The operation unit 150 is a device that receives an operation by a user, and is, for example, a touch panel arranged 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 apparatus 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, an IEEE802.11 wireless interface). In the present 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とも呼ぶ。   A perspective view of the scanner 400 is shown in FIG. In the figure, a first direction Dp1 and a second direction Dp2 indicate horizontal directions, and a third direction Dp3 indicates a vertically upward direction. The first direction Dp1 and the second direction Dp2 are perpendicular to each other. 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 image reading apparatus. The scanner 400 includes a main body 490 and a cover 450 attached to the upper direction Dp3 side of the main body 490 so as to be openable and closable. FIG. 1 shows the scanner 400 with the cover 450 opened in the upward direction Dp3.

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

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

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

移動装置430は、動力源(例えば、電気モータ)を含んでいる。移動装置430は、該動力源を用いて、イメージセンサ420を、原稿台440の載置面Usに沿う方向(図1の第1方向Dp1と平行な方向)に移動させる。   The moving device 430 includes a power source (for example, an electric motor). Using the power source, the moving device 430 moves the image sensor 420 in a direction along the placement surface Us of the document table 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, a DRAM), a nonvolatile 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 nonvolatile storage device 413 stores a program 414 in advance. The CPU 411 controls the image sensor 420 and the moving device 430 by executing the program 414. The interface 419 is an interface for communicating with other devices (for example, USB interface, wired LAN interface, IEEE802.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 document table 440 from the position on the opposite side of the document table 440 to the first direction Dp1 to the position on the first direction Dp1 side. To move. The CPU 411 controls the image sensor 420 while moving the image sensor 420 so as to optically read the document placed on the document table 440. The CPU 411 generates read image data indicating a read image based on a signal output from the image sensor 420. The CPU 411 transmits the generated read image data to the image processing apparatus 100.

A−2.画像処理の概要
図2は、本実施例の画像処理のフローチャートである。本実施例では、画像処理装置100のCPU110は、スキャナドライバとして、画像処理を実行する。この画像処理では、スキャナ400に原稿を読み取らせることによって読取画像データが取得され、取得された読取画像データを用いて、傾き補正や欠落の補修などがなされた補修済画像(後述)を表す補修済画像データが生成される。ユーザは、操作部150を操作することによって、画像処理の開始指示を入力する。CPU110は、入力された開始指示に応じて、図2の処理を開始する。
A-2. Overview of Image Processing FIG. 2 is a flowchart of image processing according to this embodiment. In this embodiment, the CPU 110 of the image processing apparatus 100 executes image processing as a scanner driver. In this image processing, read image data is acquired by causing the scanner 400 to read a document, and a repair that represents a repaired image (described later) that has been subjected to tilt correction, missing correction, or the like using the acquired read image data. Completed image data is generated. The user inputs an instruction to start image processing by operating the operation unit 150. CPU110 starts the process of FIG. 2 according 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 read image data. Specifically, CPU 110 transmits an instruction to read a document to scanner 400. The CPU 411 of the control unit 410 of the scanner 400 generates read image data by reading a document placed on the document table 440 in response to an instruction from the image processing apparatus 100, and generates the read image data as an image. It transmits to the processing apparatus 100. CPU 110 acquires read image data transmitted from scanner 400. The data format of the read image data may be various formats. In this embodiment, the read image data is RGB image data including RGB values of a plurality of pixels or monochrome image data including luminance values of a plurality of pixels. The RGB value of one pixel indicates the color of the pixel. For example, three component values of red (R), green (G), and blue (B) (hereinafter, R value, G value, 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 by, for example, a value of 256 gradations.

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

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

原稿画像Adの形状は、原稿の矩形の右上の角に対応する領域Daと、左下の角に対応する領域Dbと、が欠けた不完全な略矩形である。右上の領域Daの欠けは、原稿の対応する部分が、原稿台440上の読取可能領域からはみ出した状態で、原稿の読み取りが行われたことに起因する。左下の領域Dbの欠けは、原稿台440上において、原稿の対応する角が折り曲げられた状態で、原稿の読取が行われたことに起因する。また、原稿画像Adの略矩形は、読取画像OIの外形の矩形に対して、傾いている。この傾きは、原稿台440上において、原稿が傾いた状態で、原稿の読取が行われたことに起因する。   The shape of the document image Ad is an incomplete substantially rectangular shape lacking a region Da corresponding to the upper right corner of the document rectangle and a region Db corresponding to the lower left corner. The lack of the upper right area Da is caused by reading the document in a state where the corresponding part of the document protrudes from the readable area on the document table 440. The lack of the lower left area Db is caused by reading the document on the document table 440 with the corresponding corner of the document folded. The substantially rectangular shape of the document image Ad is inclined with respect to the rectangular shape of the outer shape of the read image OI. This inclination is caused by the reading of the original on the original table 440 with the original inclined.

原稿画像Adは、文字や描画などのオブジェクトOb1、Ob2と、背景Bgと、を含んでいる。背景Bgは、原稿の地色の領域である。   The document image Ad includes objects Ob1 and Ob2 such as characters and drawings, and a background Bg. The background Bg is a background color area of the document.

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

S20では、CPU110は、縮小画像データを用いて、原稿画素特定処理を実行する。原稿画素特定処理は、縮小画像MI内の原稿画像Adを構成する複数個の原稿画素PXaを特定して、原稿画素特定画像CIを示す原稿画素特定画像データを生成する処理である。縮小画像MI内の各画素は、読取画像OIの1個以上の画素と対応しているので、縮小画像MI内の原稿画素PXaを特定することは、読取画像OI内の対応する原稿画素を特定することに等しい。縮小画像データを用いて、原稿領域特定処理(例えば、後述する単純二値画像データやエッジ二値画像データの生成)を行うので、例えば、読取画像データを用いる場合と比較して、処理する画素数を低減できる。したがって、原稿領域特定処理に要する処理時間やメモリ容量を低減できる。   In S20, the CPU 110 executes document pixel specifying processing using the reduced image data. The document pixel specifying process is a process of specifying a plurality of document pixels PXa constituting the document image Ad in the reduced image MI and generating document pixel specifying image data indicating the document pixel specifying image CI. Since each pixel in the reduced image MI corresponds to one or more pixels in the read image OI, specifying the document pixel PXa in the reduced image MI specifies the corresponding document pixel in the read image OI. Is equivalent to Since the document area specifying process (for example, generation of simple binary image data or edge binary image data described later) is performed using the reduced image data, for example, pixels to be processed as compared with the case of using the read image data The number can be reduced. Accordingly, the processing time and memory capacity required for the document area specifying process can be reduced.

図3(B)には、原稿画素特定画像CIの一例が示されている。原稿画素特定画像CIは、縮小画像MIの複数個の画素と一対一で対応する複数個の画素で構成された画像である。原稿画素特定画像データは、二値データであり、原稿画素特定画像データの各画素の値は、縮小画像MIの対応する画素が、原稿画素PXaであるか、原稿画素PXa1とは異なる非原稿画素PXbであるかを示す。原稿画素特定処理の詳細は、後述する。図3(B)において、黒色で示す領域は、複数個の原稿画素PXaが位置する領域であり、白色で示す領域は、非原稿画素PXbが位置する領域である。   FIG. 3B shows an example of the document pixel specifying image CI. The document pixel specifying image CI is an image composed of a plurality of pixels corresponding one-to-one with a plurality of pixels of the reduced image MI. The original pixel specific image data is binary data, and the value of each pixel of the original pixel specific image data is a non-original pixel that is different from the original pixel PXa1 in that the corresponding pixel of the reduced image MI is the original pixel PXa. Indicates whether it is PXb. Details of the document pixel specifying process will be described later. In FIG. 3B, a black region is a region where a plurality of document pixels PXa is located, and a white region is a region where non-document pixels PXb are located.

S25では、CPU110は、原稿画素特定画像データを用いて、探索範囲決定処理を実行する。探索範囲決定処理は、原稿画素特定画像CI内にて、後述する輪郭特定処理で用いられる探索範囲SAを決定する処理である。上述したように、原稿画素特定画像CIと、読取画像OIおよび縮小画像MIとは、対応しているので、原稿画素特定画像CI内の探索範囲SAを決定することは、読取画像OIおよび縮小画像MIにおいて対応する探索範囲を決定することに等しい。なお、縮小画像データを用いて生成される原稿画素特定画像データを用いて、探索範囲決定処理を行うので、例えば、読取画像データと同じ画素数の原稿特定画像データを用いる場合と比較して、処理する画素数を低減できる。したがって、探索範囲決定処理に要する処理時間やメモリ容量を低減できる。   In S25, the CPU 110 executes search range determination processing using the document pixel specifying image data. The search range determination process is a process for determining a search range SA used in the contour specifying process described later in the document pixel specifying image CI. As described above, since the document pixel specifying image CI corresponds to the read image OI and the reduced image MI, determining the search range SA in the document pixel specifying image CI is not limited to the read image OI and the reduced image. Equivalent to determining the corresponding search range in MI. In addition, since the search range determination process is performed using the document pixel specific image data generated using the reduced image data, for example, compared to the case where the document specific image data having the same number of pixels as the read image data is used, The number of pixels to be processed can be reduced. Therefore, the processing time and memory capacity required for the search range determination process can be reduced.

図3(B)には、原稿画素特定画像CI内に決定された探索範囲SAが図示されている。探索範囲SAは、4個の端TU、TB、TL、TRを有する矩形の範囲である。探索範囲決定処理の詳細は、後述する。   FIG. 3B shows the search range SA determined in the document pixel specifying image CI. The search range SA is a rectangular range having four ends TU, TB, TL, TR. Details of the search range determination process will be described later.

S30では、CPU110は、輪郭特定処理を実行する。輪郭特定処理は、決定された探索範囲SA内にて、複数個の原稿画素PXaの中から、原稿画像の輪郭を構成する複数個の輪郭画素PXoを特定することによって、原稿画像Adの輪郭を示す輪郭画像OLIを示す輪郭画像データを生成する処理である。   In S30, the CPU 110 executes a contour specifying process. In the contour specifying process, the contour of the document image Ad is identified by specifying a plurality of contour pixels PXo constituting the contour of the document image from the plurality of document pixels PXa within the determined search range SA. It is a process which produces | generates the contour image data which shows the contour image OLI to show.

図3(C)には、輪郭画像OLIの一例が示されている。この例では、輪郭画像OLI内に、6本の直線L1〜L6によって示される原稿画像Adの輪郭を構成する複数個の輪郭画素PXoが特定されている。輪郭画像OLIは、縮小画像MIの複数個の画素と一対一で対応する複数個の画素で構成された画像である。輪郭画像データは、二値データであり、輪郭画像データの各画素の値は、縮小画像MIの対応する画素が、原稿構成画素であるか否かを示す。縮小画像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 document 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 one-to-one with a plurality of pixels of the reduced image MI. 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 a document constituent pixel. Since each pixel in the reduced image MI corresponds to one or more pixels in the read image OI, specifying the contour pixel PXo in the reduced image MI specifies the corresponding contour pixel in the read image OI. Is equivalent to Details of the contour specifying process will be described later.

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

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

S45では、CPU110は、補修済画像データを出力する。本実施例では、CPU110は、補修済画像データを、画像処理装置100の内部の記憶装置(例えば、不揮発性記憶装置130)に格納する。これに代えて、CPU110は、画像処理装置100に接続された外部記憶装置(例えば、図示しないUSBメモリ)に、補修済画像データを格納してもよい。また、CPU110は、例えば、補修済画像データをプリンタに送信することによって、該プリンタに補修済画像RIを印刷させる形態で、補修済画像データを出力しても良い。補修済画像データのデータ形式としては、任意の形式を採用可能である。本実施例では、CPU110は、JPEG形式の補修済画像データを出力する。   In S45, 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, the nonvolatile storage device 130) inside the image processing apparatus 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 apparatus 100. Further, the CPU 110 may output the repaired image data in such a manner that the repaired image data is transmitted to the printer, and the repaired image RI is printed by the printer. An arbitrary format can be adopted as the data format of the repaired image data. In this embodiment, the CPU 110 outputs repaired image data in JPEG format.

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

A−3.原稿画素特定処理
図2のS20の原稿画素特定処理について説明する。原稿画素特定処理は、上述したように、図3(B)の原稿画素特定画像CIを示す原稿画素特定画像データを生成する処理である。図4は、原稿画素特定処理のフローチャートである。図5は、原稿画素特定処理で用いられる画像の一例を示す図である。
A-3. Document Pixel Identification Process The document pixel identification process in S20 of FIG. 2 will be described. As described above, the document pixel specifying process is a process of generating document pixel specifying image data indicating the document pixel specifying image CI in FIG. FIG. 4 is a flowchart of the document pixel specifying process. FIG. 5 is a diagram illustrating an example of an image used in the document pixel specifying process.

図4のS110では、CPU110は、縮小画像データがモノクロ画像データであるかカラー画像データであるかを判断する。例えば、モノクロ画像データは、1個の成分値(例えば、輝度)のみを含む画像データであり、カラー画像データは、複数個の成分値(例えば、R、G、B)を含む画像データである。上述したように、本実施例では、読取画像データは、カラー画像データであるRGB画像データと、モノクロ画像データと、のうちのいずれかであるので、縮小画像データも、これらのうちのいずれかである。縮小画像データが、モノクロ画像データである場合には(S110:YES)、S120にて、CPU110は、輝度Yに基づいて、縮小画像データを二値化して、単純二値画像BIを示す単純二値画像データを生成する。具体的には、CPU110は、縮小画像MI内の複数個の画素のうち、特定輝度範囲YR内の輝度を有する複数個の画素を、複数個の第1画素PX1として特定する。CPU110は、縮小画像MI内の複数個の画素のうち、特定輝度範囲YR外の輝度を有する複数個の画素を、複数個の第2画素PX2として特定する。なお、単純二値画像データでは、第1画素PX1の値は、「0」とされ、第2画素PX2の値は、「1」とされる。   In S110 of FIG. 4, the CPU 110 determines whether the reduced image data is monochrome image data or color image data. For example, monochrome image data is image data including only one component value (for example, luminance), and color image data is image data including a plurality of component values (for example, R, G, B). . As described above, in the present embodiment, the read image data is either RGB image data that is color image data or monochrome image data. Therefore, the reduced image data is any one of these. It is. When the reduced image data is monochrome image data (S110: YES), in S120, the CPU 110 binarizes the reduced image data based on the luminance Y and displays the simple binary image BI. Value image data is generated. Specifically, the CPU 110 specifies a plurality of pixels having luminance within the specific luminance range YR among the plurality of pixels in the reduced image MI as the plurality of first pixels PX1. The CPU 110 identifies a plurality of pixels having luminance outside the specific luminance range YR among the plurality of pixels in the reduced image MI as the plurality of second pixels PX2. In the simple binary image data, the value of the first pixel PX1 is “0”, and the value of the second pixel PX2 is “1”.

特定輝度範囲YRは、予め定められた輝度Yの範囲である。特定輝度範囲YRは、カバー450の対向面Bs(図1)の色の輝度Ybsを中心とする範囲である。特定輝度範囲YRは、(Ybs−ΔY)≦Y≦(Ybs+ΔY)を満たす輝度Yの範囲である。ΔYは、例えば、輝度Yが0〜255の256階調で表される場合に、32である。白(輝度255)および黒(輝度0)は、特定輝度範囲YR外である。   The specific luminance range YR is a predetermined luminance Y range. The specific luminance range YR is a range centered on the luminance Ybs of the color of the facing surface Bs (FIG. 1) of the cover 450. The specific luminance range YR is a range of luminance Y that satisfies (Ybs−ΔY) ≦ Y ≦ (Ybs + ΔY). For example, ΔY is 32 when the luminance Y is expressed by 256 gradations of 0 to 255. White (luminance 255) and black (luminance 0) are outside the specific luminance range YR.

縮小画像データが、カラー画像データである場合には(S110:NO)、S115にて、CPU110は、輝度Yと彩度Cとに基づいて、縮小画像データを二値化して、単純二値画像データを生成する。具体的には、CPU110は、上述した特定輝度範囲YR内の輝度Yを有し、かつ、特定彩度範囲CR内の彩度Cを有する複数個の画素を、複数個の第1画素PX1として特定する。CPU110は、特定輝度範囲YR外の輝度Yを有する複数個の画素と、特定彩度範囲CR外の彩度Cを有する複数個の画素を、複数個の第2画素PX2として特定する。この結果、特定輝度範囲YRと特定彩度範囲CRとを用いて、単純二値画像データを適切に生成できる。例えば、原稿画像Adの背景Bgの輝度と、カバー450の対向面Bsの輝度Ybsと、が近似していても、原稿画像Adの背景Bgの彩度と、カバー450の対向面Bsの彩度Cbsと、が十分に異なっていれば、原稿画像Adと外側画像Abとの境界が現れるような単純二値画像BIを示す単純二値画像データが生成される。   When the reduced image data is color image data (S110: NO), in S115, the CPU 110 binarizes the reduced image data based on the luminance Y and the saturation C, thereby obtaining a simple binary image. Generate data. Specifically, the CPU 110 sets a plurality of pixels having the luminance Y in the specific luminance range YR and the saturation C in the specific saturation range CR as the plurality of first pixels PX1. Identify. The CPU 110 identifies a plurality of pixels having luminance Y outside the specific luminance range YR and a plurality of pixels having saturation C outside the specific saturation range CR as a plurality of second pixels PX2. As a result, simple binary image data can be appropriately generated using the specific luminance range YR and the specific saturation range CR. For example, even if the brightness of the background Bg of the document image Ad is similar to the brightness Ybs of the facing surface Bs of the cover 450, the saturation of the background Bg of the document image Ad and the saturation of the facing surface Bs of the cover 450 are similar. If Cbs is sufficiently different, simple binary image data indicating a simple binary image BI in which a boundary between the document image Ad and the outer image Ab appears is generated.

特定彩度範囲CRは、予め定められた彩度Cの範囲である。特定彩度範囲CRは、カバー450の対向面Bsの色の彩度Cbsを含む範囲である。本実施例では、対向面Bsの色は、無彩色(彩度Cbs=0)であるので、特定彩度範囲CRは、C≦Cthを満たす彩度Cの範囲である。閾値Cthは、例えば、彩度Cが0〜255の256階調で表される場合に、32である。   The specific saturation range CR is a predetermined saturation C range. The specific saturation range CR is a range including the saturation Cbs of the color of the facing surface Bs of the cover 450. In the present embodiment, since the color of the facing surface Bs is an achromatic color (saturation Cbs = 0), the specific saturation range CR is a range of saturation C that satisfies C ≦ Cth. The threshold value Cth is 32, for example, when the saturation C is expressed by 256 gradations of 0 to 255.

図5(A)には、単純二値画像BIの一例として、単純二値画像BIsが示されている。図5(A)にて、黒色で示す部分は、第1画素PX1で構成される部分であり、白色で示す部分は、第2画素PX2で構成される部分である。図5(A)に示すように、縮小画像MIの外側画像Abを構成する画素は、特定輝度範囲YRの輝度を有し、かつ、特定彩度範囲CR内の彩度を有する。このために、外側画像Abを構成する画素は、第1画素PX1として特定される。このように、特定輝度範囲YRは、外側画像Ab内の複数個の画素の輝度(例えば、輝度Ybs)を含む輝度Yの範囲であり、特定彩度範囲CRは、外側画像Ab内の複数個の画素の彩度(例えば、彩度Cbs)を含む彩度Cの範囲である、と言うことができる。   FIG. 5A shows a simple binary image BIs as an example of the simple binary image BI. In FIG. 5A, a black portion is a portion constituted by the first pixel PX1, and a white portion is a portion constituted by the second pixel PX2. As shown in FIG. 5A, the pixels constituting the outer image Ab of the reduced image MI have a luminance within the specific luminance range YR and have a saturation within the specific saturation range CR. For this reason, the pixels constituting the outer image Ab are specified as the first pixel PX1. As described above, the specific luminance range YR is a range of the luminance Y including the luminances (for example, luminance Ybs) of a plurality of pixels in the outer image Ab, and the specific saturation range CR is a plurality of specific luminance ranges CR in the outer image Ab. It can be said that it is the range of the saturation C including the saturation (for example, the saturation Cbs) of the pixels.

原稿画像Adは、カバー450の対向面Bsの色と比較的大きく異なる色を有する部分を含み得る。縮小画像MIの原稿画像Adのうち、当該部分を構成する画素は、第2画素PX2として特定される。原稿画像Adは、カバー450の対向面Bsの色と近似する色を有する部分を含み得る。縮小画像MIの原稿画像Adのうち、当該部分を構成する画素は、第1画素PX1として特定される。   The document image Ad may include a portion having a color that is relatively different from the color of the facing surface Bs of the cover 450. Of the original image Ad of the reduced image MI, the pixel constituting the portion is specified as the second pixel PX2. The document image Ad may include a portion having a color that approximates the color of the facing surface Bs of the cover 450. Of the original image Ad of the reduced image MI, the pixel constituting the portion is specified as the first pixel PX1.

例えば、図5(A)の単純二値画像BIsは、原稿画像Adの背景Bgの色が、カバー450の対向面Bsの色と比較的大きく異なる場合の例である。この例では、縮小画像MI(図3(A))のうち、背景Bgの全体と、オブジェクトOb1の全体と、オブジェクトOb2の一部と、を構成する画素は、第2画素PX2として特定されている。そして、縮小画像MIのうち、外側画像Abの全体と、オブジェクトOb2の他の一部と、を構成する画素は、第1画素PX1として特定されている。図5(A)の例では、単純二値画像BIsに、原稿画像Adと外側画像Abとの境界が現れていることが解る。   For example, the simple binary image BIs in FIG. 5A is an example in which the color of the background Bg of the document image Ad is relatively different from the color of the facing surface Bs of the cover 450. In this example, in the reduced image MI (FIG. 3A), the pixels constituting the entire background Bg, the entire object Ob1, and a part of the object Ob2 are specified as the second pixel PX2. Yes. In the reduced image MI, the pixels constituting the entire outer image Ab and the other part of the object Ob2 are specified as the first pixel PX1. In the example of FIG. 5A, it can be seen that the boundary between the document image Ad and the outer image Ab appears in the simple binary image BIs.

図5(B)には、単純二値画像BIの他の例として、単純二値画像BImが示されている。この単純二値画像BImは、原稿画像Adの背景Bgの色が、カバー450の対向面Bsの色に近似している場合の例である。この例では、縮小画像MIのうち、オブジェクトOb1の全体と、オブジェクトOb2の一部と、を構成する画素は、第2画素PX2として特定されている。そして、縮小画像MIのうち、外側画像Abの全体と、背景Bgの全体と、オブジェクトOb2の他の一部と、を構成する画素は、第1画素PX1として特定されている。図5(B)の例では、単純二値画像BImに、原稿画像Adと外側画像Abとの境界が現れていないことが解る。   FIG. 5B shows a simple binary image BIm as another example of the simple binary image BI. This simple binary image BIm is an example in the case where the color of the background Bg of the document image Ad approximates the color of the facing surface Bs of the cover 450. In this example, in the reduced image MI, the pixels constituting the entire object Ob1 and a part of the object Ob2 are specified as the second pixel PX2. In the reduced image MI, the pixels constituting the entire outer image Ab, the entire background Bg, and the other part of the object Ob2 are specified as the first pixel PX1. In the example of FIG. 5B, it can be seen that the boundary between the document image Ad and the outer image Ab does not appear in the simple binary image BIm.

S125では、CPU110は、第1画素PX1の個数M1と、第2画素PX2の個数M2と、をそれぞれ算出する。S130では、CPU110は、第2画素PX2の個数M2が、第1画素PX1の個数M1よりも多いか否か、すなわち、(M1<M2)が満たされるか否かを判断する。図5(A)の単純二値画像BIsのように、原稿画像Adと外側画像Abとの境界が現れるような適切な二値化に成功する場合には、比較的多数の第2画素PX2が特定されるので、第2画素PX2の個数M2が、第1画素PX1の個数M1よりも多くなる。これに対して、図5(B)の単純二値画像BImのように、原稿画像Adと外側画像Abとの境界が現れない場合、すなわち、適切な二値化に失敗する場合には、比較的少数の第2画素PX2しか特定されないので、第2画素PX2の個数M2が、第1画素PX1の個数M1以下になる。   In S125, the CPU 110 calculates the number M1 of the first pixels PX1 and the number M2 of the second pixels PX2. In S130, the CPU 110 determines whether or not the number M2 of the second pixels PX2 is larger than the number M1 of the first pixels PX1, that is, whether (M1 <M2) is satisfied. As in the case of the simple binary image BIs in FIG. 5A, when the appropriate binarization in which the boundary between the document image Ad and the outer image Ab appears is successful, a relatively large number of second pixels PX2 exist. Therefore, the number M2 of the second pixels PX2 is larger than the number M1 of the first pixels PX1. On the other hand, when the boundary between the original image Ad and the outer image Ab does not appear as in the simple binary image BIm in FIG. 5B, that is, when the appropriate binarization fails, the comparison is performed. Since only a small number of second pixels PX2 are specified, the number M2 of second pixels PX2 is equal to or less than the number M1 of first pixels PX1.

第2画素PX2の個数M2が、第1画素PX1の個数M1よりも多い場合には(S130:YES)、CPU110は、後述するS135〜S145の処理をスキップして、処理をS150に進める。第2画素PX2が、第1画素PX1以下である場合には(S130:NO)、CPU110は、S135〜S145の処理を実行する。   When the number M2 of the second pixels PX2 is larger than the number M1 of the first pixels PX1 (S130: YES), the CPU 110 skips the processes of S135 to S145 described later and advances the process to S150. When the second pixel PX2 is equal to or smaller than the first pixel PX1 (S130: NO), the CPU 110 executes the processes of S135 to S145.

S135では、CPU110は、縮小画像MIの各画素を、その画素の色(輝度および彩度)に応じて、複数個のクラスに分類することによって、縮小画像MIの色の分布を示すヒストグラムを生成する。具体的には、輝度のヒストグラムと、彩度のヒストグラムと、がそれぞれ生成される。   In S135, the CPU 110 generates a histogram indicating the color distribution of the reduced image MI by classifying each pixel of the reduced image MI into a plurality of classes according to the color (luminance and saturation) of the pixel. To do. Specifically, a luminance histogram and a saturation histogram are generated, respectively.

図6は、縮小画像MIのヒストグラムの一例を示す図である。図6(A)の輝度のヒストグラムには、縮小画像MIの外側画像Abに対応する輝度Ybsのピークと、原稿画像Adの背景Bgに対応する輝度Ymのピークと、が現れている。このヒストグラムは、原稿画像Adの背景Bgの色が、カバー450の対向面Bsの色に近似している場合の例である。このために、このヒストグラムでは、外側画像Abに対応する輝度Ybsのピークと、原稿画像Adの背景Bgに対応する輝度Ymのピークと、が比較的近い。この結果、図6(A)に示すように、予め定められた特定輝度範囲YRを用いた二値化(S115、S120)では、適切に二値化することができず、例えば、図5(B)の単純二値画像BImを示す単純二値画像データが生成される。   FIG. 6 is a diagram illustrating an example of a histogram of the reduced image MI. In the luminance histogram of FIG. 6A, a peak of luminance Ybs corresponding to the outer image Ab of the reduced image MI and a peak of luminance Ym corresponding to the background Bg of the document image Ad appear. This histogram is an example when the color of the background Bg of the document image Ad is close to the color of the facing surface Bs of the cover 450. For this reason, in this histogram, the peak of the luminance Ybs corresponding to the outer image Ab and the peak of the luminance Ym corresponding to the background Bg of the document image Ad are relatively close. As a result, as shown in FIG. 6A, binarization (S115, S120) using a predetermined specific luminance range YR cannot be performed appropriately, and for example, FIG. Simple binary image data indicating the simple binary image BIm of B) is generated.

同様に、図6(B)の彩度のヒストグラムには、縮小画像MIの外側画像Abに対応する彩度Cbsのピークと、原稿画像Adの背景Bgに対応する彩度Cmのピークと、が現れている。そして、このヒストグラムでは、外側画像Abに対応する彩度Cbsのピークと、原稿画像Adの背景Bgに対応する彩度Cmのピークと、が比較的近い。この結果、図6(B)に示すように、予め定められた特定彩度範囲CRを用いた二値化(S115)では、適切に二値化することができない。   Similarly, the saturation histogram of FIG. 6B includes a peak of saturation Cbs corresponding to the outer image Ab of the reduced image MI and a peak of saturation Cm corresponding to the background Bg of the document image Ad. Appears. In this histogram, the peak of saturation Cbs corresponding to the outer image Ab and the peak of saturation Cm corresponding to the background Bg of the document image Ad are relatively close. As a result, as shown in FIG. 6B, binarization (S115) using a predetermined specific saturation range CR cannot be appropriately binarized.

S140では、CPU110は、これらのヒストグラムに基づいて、新たな二値化閾値、具体的には、新たな特定輝度範囲YRaおよび特定彩度範囲CRaを決定する。なお、縮小画像データが、モノクロ画像データである場合には、特定輝度範囲YRaだけが決定される。   In S140, the CPU 110 determines a new binarization threshold, specifically, a new specific luminance range YRa and a specific saturation range CRa based on these histograms. If the reduced image data is monochrome image data, only the specific luminance range YRa is determined.

特定輝度範囲YRaは、例えば、以下のように決定される。CPU110は、図6(A)のヒストグラムのピークを特定することで、原稿画像Adの背景Bgに対応する輝度Ymを特定する。CPU110は、輝度Ybsと輝度Ymとの中央の値が、閾値Ythとなるように、YthおよびΔYaを、以下の式(1)、(2)に従って決定する。
Yth={(Ybs+Ym)/2))…(1)
ΔYa=(Yth−Ybs)…(2)
そして、CPU110は、新たなΔYaに基づいて、(Ybs−ΔY)≦Y≦(Ybs+ΔY)を満たす輝度Yの範囲を、新たな特定輝度範囲YRaとして決定する。
The specific luminance range YRa is determined as follows, for example. The CPU 110 specifies the luminance Ym corresponding to the background Bg of the document image Ad by specifying the peak of the histogram in FIG. CPU 110 determines Yth and ΔYa according to the following equations (1) and (2) so that the central value of luminance Ybs and luminance Ym is equal to threshold value Yth.
Yth = {(Ybs + Ym) / 2)) (1)
ΔYa = (Yth−Ybs) (2)
Then, based on the new ΔYa, the CPU 110 determines a range of luminance Y that satisfies (Ybs−ΔY) ≦ Y ≦ (Ybs + ΔY) as a new specific luminance range YRa.

特定彩度範囲CRaは、例えば、以下のように決定される。CPU110は、図6(B)のヒストグラムのピークを特定することで、原稿画像Adの背景Bgに対応する彩度Cmを特定する。CPU110は、彩度Cbsと彩度Cmとの中央の値を、あらたな閾値Cthaとして決定する。CPU110は、Y≦Cthaを満たす彩度Cの範囲を、新たな特定彩度範囲CRaとして決定する。   The specific saturation range CRa is determined as follows, for example. The CPU 110 specifies the saturation Cm corresponding to the background Bg of the document image Ad by specifying the peak of the histogram in FIG. The CPU 110 determines the central value of the saturation Cbs and the saturation Cm as a new threshold value Ctha. The CPU 110 determines a saturation C range that satisfies Y ≦ Ctha as a new specific saturation range CRa.

S145では、CPU110は、決定された特定輝度範囲YRaおよび特定彩度範囲CRaを用いて、縮小画像データを二値化して、単純二値画像BIを示す単純二値画像データを、再度、生成する。これにより、S115またはS120にて最初に生成される単純二値画像データによって示される単純二値画像BIが、図5(B)に示す不適切な単純二値画像BImである場合であっても、本ステップにて2回目に生成される単純二値画像データによって示される単純二値画像BIは、図5(A)に示す適切な単純二値画像BIsとなる可能性を高くすることができる。   In S145, the CPU 110 binarizes the reduced image data using the determined specific luminance range YRa and specific saturation range CRa, and again generates simple binary image data indicating the simple binary image BI. . Thus, even if the simple binary image BI indicated by the simple binary image data generated first in S115 or S120 is an inappropriate simple binary image BIm shown in FIG. 5B. The simple binary image BI indicated by the simple binary image data generated for the second time in this step can be highly likely to be an appropriate simple binary image BIs shown in FIG. .

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

以下に、エッジ強度の算出式(3)を示す。式(3)の階調値P(x,y)は、スキャン画像SI内の特定の画素位置(x,y)の階調値を表している。位置xは、方向D1(縦方向)の画素位置を示し、位置yは、方向D2(横方向)の画素位置を示している。スキャン画像SI内の画素位置(x,y)におけるエッジ強度Se(x,y)は、その画素位置(x,y)を中心とし隣り合う3行3列の9つの画素の値を用いて算出される。算出式の第1項および第2項は、9つの位置の画素の階調値に、対応する係数をそれぞれ乗じた値の和の絶対値である。第1項は、方向D1の階調値の微分(すなわち、横方向の微分)であり、第2項は、方向D2の階調値の微分(すなわち、縦方向の微分)である。算出されるエッジ強度Se(x,y)は、0〜255の範囲の256階調の値に正規化される。   The calculation formula (3) of edge strength is shown below. The gradation value P (x, y) in Expression (3) represents the gradation value at a specific pixel position (x, y) in the scan image SI. A position x indicates a pixel position in the direction D1 (vertical direction), and a position y indicates a pixel position in the direction D2 (horizontal direction). The edge intensity Se (x, y) at the pixel position (x, y) in the scan image SI is calculated using the values of nine pixels in 3 rows and 3 columns adjacent to the pixel position (x, y). Is done. The first and second terms of the calculation formula are absolute values of the sum of values obtained by multiplying the gradation values of the pixels at nine positions by the corresponding coefficients. The first term is the differentiation of the gradation value in the direction D1 (that is, the differentiation in the horizontal direction), and the second term is the differentiation of the gradation value in the direction D2 (that is, the differentiation 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 2019016897

…(2)
Figure 2019016897

... (2)

生成されるエッジ抽出データによって示されるエッジ抽出画像では、縮小画像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 document image Ad and the outer image Ab in the reduced image MI in FIG. Or, the value of the pixel corresponding to the contours of the objects Ob1 and Ob2 is larger than the values of the pixels at other positions.

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

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

S160では、CPU110は、2個の二値画像データ、すなわち、単純二値画像データとエッジ二値画像データとを合成して、上述した原稿画素特定画像CI(図3(B)、図5(D))を示す原稿画素特定画像データを生成する。具体的には、CPU110は、単純二値画像データとエッジ二値画像データとの各画素の論理和を取ることによって、原稿画素特定画像データを生成する。この結果、単純二値画像データを用いて特定される複数個の第2画素PX2と、エッジ二値画像データを用いて特定される複数個のエッジ画素PXeと、を含む画素群であって、第2画素PX2ともエッジ画素PXeとも異なる画素を含まない画素群を、複数個の原稿画素PXaとして特定する。第2画素PX2ともエッジ画素PXeとも異なる画素群は、複数個の非原稿画素PXbとして特定される。   In S160, the CPU 110 synthesizes the two binary image data, that is, the simple binary image data and the edge binary image data, and the above-described original pixel specifying image CI (FIG. 3B, FIG. 5). D)) original pixel specific image data is generated. Specifically, the CPU 110 generates document pixel specifying image data by calculating the logical sum of each pixel of simple binary image data and edge binary image data. As a result, a pixel group including a plurality of second pixels PX2 specified using simple binary image data and a plurality of edge pixels PXe specified using edge binary image data, A pixel group not including pixels different from the second pixel PX2 and the edge pixel PXe is specified as a plurality of document pixels PXa. A pixel group different from the second pixel PX2 and the edge pixel PXe is specified as a plurality of non-original pixels PXb.

以上の説明から解るように、本実施例の原稿画素特定処理では、読取画像データを用いて生成される縮小画像データを用いて、特定輝度範囲YR(または特定輝度範囲YRa)内の輝度を有することを含む特定条件を満たす複数個の画素が、複数個の第1画素PX1として特定され、特定条件を満たさない複数個の画素が、複数個の第2画素PX2として特定されることによって、単純二値画像データが生成される(図4のS110〜S145)。さらに、縮小画像データを用いて、エッジ画素PXeを示すエッジ二値画像データが生成される(図4のS150〜S155)。そして、本実施例の画像処理では、単純二値画像データとエッジ二値画像データとを用いて、読取画像OI内の原稿画像Adに対応する原稿領域AA(図3(C))が特定される(図4のS160、図2のS25〜S35)。この結果、読取画像OI内の原稿領域AAの特定精度を向上できる。   As can be understood from the above description, in the original pixel specifying process of this embodiment, the reduced image data generated using the read image data is used to have a luminance within the specific luminance range YR (or the specific luminance range YRa). A plurality of pixels that satisfy a specific condition including the above are specified as a plurality of first pixels PX1, and a plurality of pixels that do not satisfy the specific condition are specified as a plurality of second pixels PX2. Binary image data is generated (S110 to S145 in FIG. 4). Further, edge binary image data indicating the edge pixel PXe is generated using the reduced image data (S150 to S155 in FIG. 4). In the image processing of this embodiment, the document area AA (FIG. 3C) corresponding to the document image Ad in the read image OI is specified using the simple binary image data and the edge binary image data. (S160 in FIG. 4, S25 to S35 in FIG. 2). As a result, the accuracy of specifying the document area AA in the read image OI can be improved.

仮に、エッジ二値画像データだけを用いて、原稿領域AAを特定しようとする場合を考える。エッジ二値画像データによって示されるエッジ二値画像EIには、図5(C)に示すように、原稿画像Adの輪郭を示す線を構成するエッジ画素PXeが特定される。しかしながら、エッジ二値画像EIにおいて、原稿画像Adの輪郭を示す線のような細線には、断線した部分が発生しやすい。すなわち、エッジ二値画像データを用いて特定される複数個のエッジ画素PXeには、原稿画像Adの輪郭を構成する複数個の輪郭画素PXo(図3(C))の一部が含まれない可能性がある。この場合には、図2のS30の輪郭特定処理において、原稿画像Adの一部の輪郭が特定できず、その結果、原稿領域AAが適切に特定できない可能性がある。本実施例の原稿画素特定処理で生成される原稿画素特定画像CI(図5(D))では、原稿画像Adの輪郭を示す細線だけでなく、その内側の原稿画像Adの背景Bgを構成する画素も、原稿画素PXaとして特定される。したがって、本実施例では、エッジ二値画像データだけを用いて、原稿領域AAを特定しようとする場合と比較して、精度良く原稿領域AAを特定することができる。   Assume that the document area AA is to be specified using only the edge binary image data. In the edge binary image EI indicated by the edge binary image data, as shown in FIG. 5C, the edge pixel PXe constituting the line indicating the outline of the document image Ad is specified. However, in the edge binary image EI, a broken portion is likely to occur in a thin line such as a line indicating the outline of the document image Ad. That is, the plurality of edge pixels PXe specified by using the edge binary image data do not include a part of the plurality of contour pixels PXo (FIG. 3C) constituting the contour of the document image Ad. there is a possibility. In this case, in the contour specifying process in S30 of FIG. 2, the contour of a part of the document image Ad cannot be specified, and as a result, the document area AA may not be specified appropriately. In the original pixel specifying image CI (FIG. 5D) generated by the original pixel specifying process of the present embodiment, not only the fine line indicating the outline of the original image Ad but also the background Bg of the original original image Ad is formed. The pixel is also specified as the document pixel PXa. Therefore, in this embodiment, it is possible to specify the document area AA with higher accuracy than when attempting to specify the document area AA using only the edge binary image data.

仮に、単純二値画像データだけを用いて、原稿領域AAを特定しようとする場合を考える。単純二値画像データによって示される単純二値画像BIには、特に、原稿画像Adの背景Bgの色が、カバー450の対向面Bsの色に近似している場合には、図5(B)に示す単純二値画像BIsのように、原稿画像Adの輪郭を構成する複数個の輪郭画素PXoの一部または全部が、第2画素PX2として特定されない可能性がある。この場合には、図2のS30の輪郭特定処理において、原稿画像Adの一部の輪郭が特定できず、その結果、原稿領域AAが適切に特定できない可能性がある。本実施例の原稿画素特定処理では、例えば、単純二値画像BIにて、複数個の輪郭画素PXoの一部または全部が、第2画素PX2として特定されていなくても、エッジ二値画像EIにて、複数個の輪郭画素PXoが、エッジ画素PXeとして特定されていれば、複数個の輪郭画素PXoは、原稿画素特定画像CIにて特定される原稿画素PXaに含まれる。したがって、本実施例では、単純二値画像データだけを用いて、原稿領域AAを特定しようとする場合と比較して、精度良く原稿領域AAを特定することができる。   Consider a case where the original area AA is to be specified using only simple binary image data. In the simple binary image BI indicated by the simple binary image data, in particular, when the color of the background Bg of the document image Ad approximates the color of the facing surface Bs of the cover 450, FIG. Like the simple binary image BIs shown in FIG. 5, there is a possibility that some or all of the plurality of contour pixels PXo constituting the contour of the document image Ad are not specified as the second pixel PX2. In this case, in the contour specifying process in S30 of FIG. 2, the contour of a part of the document image Ad cannot be specified, and as a result, the document area AA may not be specified appropriately. In the document pixel specifying process of the present embodiment, for example, even if some or all of the plurality of contour pixels PXo are not specified as the second pixel PX2 in the simple binary image BI, the edge binary image EI is used. If the plurality of contour pixels PXo are specified as the edge pixels PXe, the plurality of contour pixels PXo are included in the document pixel PXa specified by the document pixel specifying image CI. Therefore, in this embodiment, it is possible to specify the document area AA with higher accuracy than when attempting to specify the document area AA using only simple binary image data.

より具体的には、上記原稿画素特定処理では、上述したように、単純二値画像データと、エッジ二値画像データと、の各画素の論理和を取ることによって、原稿画素特定画像データが生成される(図4のS160)。換言すれば、CPU110は、複数個の第2画素PX2と、複数個のエッジ画素PXeと、を含む画素群を示す合成画像データを、原稿画素特定画像データとして生成する。この結果、原稿画素特定画像データを用いて、読取画像OI内の原稿領域AAの特定精度をより向上できる。   More specifically, in the document pixel specifying process, as described above, document pixel specifying image data is generated by taking the logical sum of each pixel of simple binary image data and edge binary image data. (S160 in FIG. 4). In other words, the CPU 110 generates composite image data indicating a pixel group including a plurality of second pixels PX2 and a plurality of edge pixels PXe as document pixel specifying image data. As a result, the accuracy of specifying the document area AA in the read image OI can be further improved using the document pixel specifying image data.

さらに、上記原稿領域特定処理では、特定輝度範囲YRを用いて特定される複数個の第2の画素の複数個の第2画素PX2の個数M2が、基準以下(具体的には、第1画素PX1の個数M1以下)である場合には(図4のS130:NO)、CPU110は、特定輝度範囲YRとは異なる特定輝度範囲YRaを用いて、複数個の第1画素PX1と複数個の第2画素PX2とを、再度、特定することによって、単純二値画像データを、再度、生成する(図4のS145)。上述したように、第2画素PX2の個数M2が、基準以下である場合には、複数個の第1画素PX1と複数個の第2画素PX2とを適切に特定できていない可能性が高い(例えば、図5(B))。上記構成によれば、このような場合に、特定輝度範囲YRaを用いて、複数個の第1画素PX1と複数個の第2画素PX2とが、再度特定されるので、単純二値画像データをより適切に生成できる。また、1回目は、予め定められた特定輝度範囲YRを用いて、単純二値画像データが生成されるので、1回目の単純二値画像データが適切であると判断できる場合には、ヒストグラムを用いた特定輝度範囲YRaの決定を行う必要がない。この結果、単純二値画像データの生成に要する処理時間を低減できる。   Further, in the document area specifying process, the number M2 of the plurality of second pixels PX2 of the plurality of second pixels specified by using the specific luminance range YR is less than the reference (specifically, the first pixel If the number of pixels PX1 is equal to or less than M1 (S130 in FIG. 4: NO), the CPU 110 uses a specific luminance range YRa different from the specific luminance range YR, and uses a plurality of first pixels PX1 and a plurality of first pixels. By specifying the two pixels PX2 again, simple binary image data is generated again (S145 in FIG. 4). As described above, when the number M2 of the second pixels PX2 is equal to or less than the reference, there is a high possibility that the plurality of first pixels PX1 and the plurality of second pixels PX2 are not properly specified ( For example, FIG. 5 (B)). According to the above configuration, in such a case, the plurality of first pixels PX1 and the plurality of second pixels PX2 are specified again using the specific luminance range YRa. It can be generated more appropriately. In the first time, simple binary image data is generated using a predetermined specific luminance range YR. If it can be determined that the first simple binary image data is appropriate, a histogram is displayed. It is not necessary to determine the used specific luminance range YRa. As a result, the processing time required to generate simple binary image data can be reduced.

以上の説明から解るように、上記原稿画素特定処理における単純二値画像データは、第1画像データの例であり、エッジ二値画像データは、第2画像データの例であり、特定輝度範囲YRは、第1の特定輝度範囲の例であり、特定輝度範囲YRaは、第2の特定輝度範囲の例である。   As can be understood from the above description, the simple binary image data in the document pixel specifying process is an example of the first image data, and the edge binary image data is an example of the second image data, and the specific luminance range YR. Is an example of the first specific luminance range, and the specific luminance range YRa is an example of the second specific luminance range.

A−4.探索範囲決定処理
図2のS25の探索範囲決定処理について説明する。探索範囲決定処理は、上述したように、原稿画素特定画像データを用いて、原稿画素特定画像CI内にて、探索範囲SA(図3(B))を決定する処理である。図7は、探索範囲決定処理のフローチャートである。図8は、探索範囲決定処理の説明図である。図8には、原稿画素特定画像CIが示されている。図8では、図の見やすさのために、図5(D)にて黒で塗られている領域をハッチングで示している。
A-4. Search Range Determination Process The search range determination process in S25 of FIG. 2 will be described. As described above, the search range determination process is a process of determining the search range SA (FIG. 3B) in the document pixel specific image CI using the document pixel specific image data. FIG. 7 is a flowchart of the search range determination process. FIG. 8 is an explanatory diagram of the search range determination process. FIG. 8 shows a document pixel specifying image CI. In FIG. 8, for the sake of easy viewing, the area painted in black in FIG. 5D is indicated by hatching.

図7のS205では、CPU110は、原稿画素特定画像CIの外形の4個の辺に対応する4個の端、すなわち、上端UE、下端BE、左端LE、右端REから、1個の注目端を選択する。   In S205 of FIG. 7, the CPU 110 selects one target end from the four ends corresponding to the four sides of the outer shape of the document pixel specifying image CI, that is, the upper end UE, the lower end BE, the left end LE, and the right end RE. select.

S210では、CPU110は、注目端から特定量ΔWだけ離れた位置を、探索位置として設定する。例えば、図8の上端UEが注目端である場合には、上端UEから特定量ΔWだけ離れた方向D1の位置、すなわち、図8のラインP1U上の位置が、探索位置に設定される。同様に、下端BEが注目端である場合には、下端BEから特定量ΔWだけ離れた方向D1の位置、すなわち、ラインP1B上の位置が、探索位置に設定される。右端RE、左端LEが注目端である場合には、それぞれ、下端BE、右端RE、左端LEからΔWだけ離れた方向D2の位置、すなわわち、ラインP1B、PIL上の位置が、探索位置に設定される。特定量ΔWは、予め設定された量であり、例えば、原稿における3mmの長さに相当する画素数である。   In S210, the CPU 110 sets a position away from the target end by a specific amount ΔW as a search position. For example, when the upper end UE in FIG. 8 is the target end, the position in the direction D1 away from the upper end UE by the specific amount ΔW, that is, the position on the line P1U in FIG. 8 is set as the search position. Similarly, when the lower end BE is the target end, the position in the direction D1 away from the lower end BE by the specific amount ΔW, that is, the position on the line P1B is set as the search position. When the right end RE and the left end LE are the target ends, the lower end BE, the right end RE, and the position in the direction D2 away from the left end LE by ΔW, that is, the positions on the lines P1B and PIL are the search positions, respectively. Set to The specific amount ΔW is a preset amount, for example, the number of pixels corresponding to a length of 3 mm in the document.

S215では、CPU110は、設定された探索位置に、注目端に沿う方向にM個以上連続する原稿画素PXaが存在するか否かを判断する。Mは、2以上の整数であり、例えば、20である。例えば、図8の上端UEが注目端である場合には、探索位置であるラインP1U上に、M個以上の原稿画素PXaが連続して並んでいるか否かが判断される。図8の例では、上端UEが注目端である場合には、探索位置(ラインP1U上の位置)には、M個以上の原稿画素PXaが並んでいると判断される。例えば、図8の左端LEが注目端である場合には、探索位置であるラインP1L上に、M個以上の原稿画素PXaが連続して並んでいるか否かが判断される。図8の例では、左端LEが注目端である場合には、探索位置(ラインP1L上の位置)には、M個以上の原稿画素PXaが並んでいないと判断される。   In S215, the CPU 110 determines whether there are M or more continuous document pixels PXa in the direction along the target end at the set search position. M is an integer of 2 or more, and is 20, for example. For example, when the upper end UE in FIG. 8 is the target end, it is determined whether or not M or more document pixels PXa are continuously arranged on the line P1U that is the search position. In the example of FIG. 8, when the upper end UE is the target end, it is determined that M or more document pixels PXa are arranged at the search position (position on the line P1U). For example, when the left end LE in FIG. 8 is the target end, it is determined whether or not M or more document pixels PXa are continuously arranged on the line P1L that is the search position. In the example of FIG. 8, when the left end LE is the target end, it is determined that M or more document pixels PXa are not arranged at the search position (position on the line P1L).

探索位置にM個以上連続する原稿画素PXaが存在しない場合には(S215:NO)、CPU110は、探索位置を、注目端から離れる方向に向かって1画素ずつずらしながら探索を行う。具体的には、注目端から離れる方向は、注目端と垂直な方向であって、かつ、注目端と向かい合う原稿画素特定画像CIの他の端に向かう方向である。   When there are no M or more consecutive original pixels PXa at the search position (S215: NO), the CPU 110 performs a search while shifting the search position by one pixel toward the direction away from the target end. Specifically, the direction away from the target end is a direction perpendicular to the target end and toward the other end of the document pixel specifying image CI facing the target end.

具体的には、S220では、CPU110は、探索位置を、現在の位置よりも1画素だけ注目端から離れた位置に設定する。S225では、CPU110は、新たな探索位置に、注目端に沿う方向にM個以上連続する原稿画素PXaが存在するか否かを判断する。探索位置にM個以上連続する原稿画素PXaが存在しない場合には(S225:NO)、CPU110は、S220に戻って、探索位置を、さらに、1画素だけ注目端から離れた位置に設定する。探索位置にM個以上連続する原稿画素PXaが存在する場合には(S225:YES)、S230にて、CPU110は、現在の探索位置を、注目端に対応する探索範囲SAの端の位置として決定して、処理をS260に進める。   Specifically, in S220, CPU 110 sets the search position to a position away from the current end by one pixel from the current position. In S225, the CPU 110 determines whether or not there are M or more consecutive document pixels PXa in the direction along the target end at the new search position. If there are no M or more consecutive original pixels PXa at the search position (S225: NO), the CPU 110 returns to S220 and sets the search position to a position further away from the target end by one pixel. When there are M or more consecutive original pixels PXa at the search position (S225: YES), in S230, the CPU 110 determines the current search position as the position of the end of the search range SA corresponding to the target end. Then, the process proceeds to S260.

図8の例では、注目端が左端LEである場合には、最初の探索位置は、ラインP1L上の位置である(S210、S215)。探索位置は、ラインP1L上の位置から1画素ずつ右方向(方向D2)にずらされて、探索が繰り返される(S220、S225)。例えば、図8のラインP2La、P2Lb、P2Lc上の位置が、順次に、探索位置として設定される。そして、探索位置が、図8のラインP2Lcであるときに、探索位置にM個以上連続する原稿画素PXaが存在すると判断され(S225:YES)、ラインP2Lc上の位置が、探索範囲SAの左端TLの位置として決定される(S230)。   In the example of FIG. 8, when the target end is the left end LE, the first search position is a position on the line P1L (S210, S215). The search position is shifted rightward (direction D2) by one pixel from the position on the line P1L, and the search is repeated (S220, S225). For example, positions on the lines P2La, P2Lb, and P2Lc in FIG. 8 are sequentially set as search positions. Then, when the search position is the line P2Lc in FIG. 8, it is determined that there are M or more continuous document pixels PXa at the search position (S225: YES), and the position on the line P2Lc is the left end of the search range SA. The TL position is determined (S230).

注目端が右端REである場合には、ラインP1R上の位置から、左方向(方向D2の反対方向)に、順次に探索が行われて、図8に示す探索範囲SAの右端TRの位置が決定される(S210〜S230)。   When the target end is the right end RE, the search is sequentially performed from the position on the line P1R in the left direction (the direction opposite to the direction D2), and the position of the right end TR in the search range SA illustrated in FIG. It is determined (S210-S230).

S215にて、探索位置にM個以上連続する原稿画素PXaが存在する場合には(S215:YES)、CPU110は、探索位置を、注目端に向かって1画素ずつずらしながら探索を行う。   In S215, when there are M or more consecutive document pixels PXa at the search position (S215: YES), the CPU 110 performs a search while shifting the search position by one pixel toward the target end.

具体的には、S235では、CPU110は、探索位置を、現在の位置よりも1画素だけ注目端側の位置に設定する。S240では、CPU110は、新たな探索位置に、注目端に沿う方向にM個以上連続する原稿画素PXaが存在するか否かを判断する。探索位置にM個以上連続する原稿画素PXaが存在しない場合には(S240:NO)、S245にて、CPU110は、現在の探索位置より1画素だけ注目端から離れた位置を、注目端に対応する探索範囲SAの端の位置として決定して、処理をS260に進める。   Specifically, in S235, CPU 110 sets the search position to a position on the attention end side by one pixel from the current position. In S240, the CPU 110 determines whether there are M or more consecutive document pixels PXa in the direction along the target end at the new search position. If there are no M or more consecutive original pixels PXa at the search position (S240: NO), in S245, the CPU 110 corresponds to the position that is one pixel away from the target end from the current search position as the target end. The end position of the search range SA to be determined is determined, and the process proceeds to S260.

探索位置にM個以上連続する原稿画素PXaが存在する場合には(S240:YES)、S250にて、CPU110は、現在の探索位置が注目端の位置であるか否かを判断する。現在の探索位置が注目端の位置でない場合には(S240:NO)、CPU110は、S235に戻って、探索位置を、さらに、1画素だけ注目端側の位置に設定する。現在の探索位置が注目端の位置である場合には(S240:YES)、S255にて、CPU110は、注目端の位置を、注目端に対応する探索範囲SAの端の位置として決定して、処理をS260に進める。   When there are M or more consecutive original pixels PXa at the search position (S240: YES), in S250, the CPU 110 determines whether or not the current search position is the position of the target end. If the current search position is not the position of the target end (S240: NO), the CPU 110 returns to S235, and further sets the search position to the position of the target end side by one pixel. If the current search position is the position of the target end (S240: YES), in S255, the CPU 110 determines the position of the target end as the position of the end of the search range SA corresponding to the target end, The process proceeds to S260.

図8の例では、注目端が上端UEである場合には、例えば、最初の探索位置は、ラインP1U上の位置である(S210、S215)。探索位置は、ラインP1U上の位置から1画素ずつ上方向に(方向D1の反対方向)にずらされて、探索が繰り返される(S235、S240、S250)。例えば、図8のラインP3Ua、P3Ub、P3Uc上の位置が、順次に、探索位置として設定される。そして、探索位置が、図8のラインP3Ucであるときに、ラインP3Ucの位置は、上端UEの位置であるので(S250:YES)、原稿画素特定画像CIの上端UEの位置が、探索範囲SAの上端TUの位置として決定される(S255)。   In the example of FIG. 8, when the target end is the upper end UE, for example, the first search position is a position on the line P1U (S210, S215). The search position is shifted by one pixel upward from the position on the line P1U (the direction opposite to the direction D1), and the search is repeated (S235, S240, S250). For example, positions on the lines P3Ua, P3Ub, and P3Uc in FIG. 8 are sequentially set as search positions. Since the position of the line P3Uc is the position of the upper end UE when the search position is the line P3Uc in FIG. 8 (S250: YES), the position of the upper end UE of the document pixel specific image CI is within the search range SA. Is determined as the position of the upper end TU of (S255).

注目端が下端BEである場合には、ラインP1B上の位置、ラインP3Ba、P3Bb、P3Bc上の位置が、順次に探索位置とされて、探索が行われる(S235、S240、S250)。そして、探索位置が、図8に示す探索範囲SAの下端TBの位置よりも1画素だけ下側のラインP3Bcであるときに、探索位置にM個以上連続する原稿画素PXaが存在しないと判断され(S240:NO)、ラインP3Bcよりも1画素だけ上側の位置が、探索範囲SAの下端TBとして決定される(S245)。   When the target end is the lower end BE, the position on the line P1B and the positions on the lines P3Ba, P3Bb, and P3Bc are sequentially set as the search positions, and the search is performed (S235, S240, and S250). Then, when the search position is a line P3Bc one pixel lower than the position of the lower end TB of the search range SA shown in FIG. 8, it is determined that there are no M or more consecutive original pixels PXa at the search position. (S240: NO), a position one pixel above the line P3Bc is determined as the lower end TB of the search range SA (S245).

S260では、CPU110は、全ての端UE、BE、LE、REを、注目端として処理したか否かを判断する。未処理の端がある場合には(S260:NO)、CPU110は、S205に処理を戻す。全ての端が処理された場合には(S260:YES)、S265にて、CPU110は、探索範囲SAを規定する範囲情報を生成して、探索範囲決定処理を終了する。範囲情報は、例えば、原稿画素特定画像CIの4個の端UE、BE、LE、REのそれぞれと、探索範囲SAの対応する端TU、TB、TL、TRと、の間の距離DU、DB、DL、DRを示す情報である。   In S260, the CPU 110 determines whether or not all the terminals UE, BE, LE, and RE have been processed as the target ends. If there is an unprocessed end (S260: NO), the CPU 110 returns the process to S205. If all ends have been processed (S260: YES), in S265, CPU 110 generates range information that defines search range SA, and ends the search range determination process. The range information is, for example, the distances DU, DB between the four ends UE, BE, LE, RE of the document pixel specific image CI and the corresponding ends TU, TB, TL, TR of the search range SA. , DL and DR.

以上説明した本実施例の探索範囲決定処理では、例えば、注目端が左端LEである場合には、左端LEから特定量ΔWだけ離れたラインP1L上の位置に、左端LEに沿う方向に連続するM個の原稿画素PXaが存在するか否かが判断される(S210、S215)。ラインP1L上の位置に複数個の原稿画素PXaが存在しない場合に(S215:NO)、ラインP2La〜P2Lc上の位置について、特定の端から離れる方向に向かって順次に、複数個の原稿画素PXaが存在するか否かが判断される(S220)。そして、ラインP2Lc上の位置に複数個の原稿画素PXaが存在すると判断される場合に(S225:YES)、ラインP2Lc上の位置に基づいて、左端LEの端に対応する探索範囲SAの左端TLの位置が決定される(S230)。そして、本実施例の画像処理では、このように決定される探索範囲SA内にて、原稿画像Adの輪郭を構成する複数個の輪郭画素PXoが特定される(図2のS30)。   In the search range determination process of the present embodiment described above, for example, when the target end is the left end LE, the position on the line P1L that is separated from the left end LE by the specific amount ΔW continues in the direction along the left end LE. It is determined whether or not there are M document pixels PXa (S210, S215). When a plurality of document pixels PXa does not exist at the position on the line P1L (S215: NO), the plurality of document pixels PXa are sequentially arranged in the direction away from the specific end with respect to the positions on the lines P2La to P2Lc. Is determined (S220). If it is determined that there are a plurality of document pixels PXa at the position on the line P2Lc (S225: YES), the left end TL of the search range SA corresponding to the end of the left end LE based on the position on the line P2Lc. Is determined (S230). In the image processing of this embodiment, a plurality of contour pixels PXo constituting the contour of the document image Ad are specified within the search range SA determined in this way (S30 in FIG. 2).

読取画像OIの端部には、読取時に光の照射が不均一になりやすいこと等に起因して影が生じやすい。特に、スキャナ400のようなフラットベッド式の読取装置では、ガラス製の原稿台440(プラテンガラスとも呼ぶ)の側端面部で光りが反射することや、原稿の原稿台440からの浮き上がりなどによって、原稿の端部に照射される光量が減少しやすいため、このような影が生じやすい。このような影が生じている部分では、読取画像OIにおいて画素の濃度が高くなるので、当該部分には、原稿画素PXaが存在しない場合であっても、誤って原稿画素PXaが特定されてしまう場合がある。上記実施例の探索範囲決定処理によれば、上述したように、左端LEから離れたラインP1L上の位置に、M個の原稿画素PXaが存在するか否かが判断され(S210、S215)、ラインP1L上の位置にM個の原稿画素PXaが存在しない場合に(S215:NO)、ラインP2La〜P2Lc上の位置について、順次に、M個の原稿画素PXaが存在するか否かが判断される(S220)。この結果、例えば、図3、図8の例のように、原稿画像Adが、左端LEから離れた位置にある場合には、探索範囲SAの左端TLは、読取画像OI(原稿画素特定画像CI)の左端LEから離れた位置に決定される。そして、このように決定された探索範囲SA内にて、複数個の輪郭画素PXoが特定される。したがって、読取画像OIの左端LEの近傍に影が生じているために、左端LEの近傍に、複数個の原稿画素PXaが存在しないにも関わらずに、誤って複数個の原稿画素PXaが存在すると判断された場合でも、原稿画像Adの輪郭を精度良く特定することができる。   Shadows are likely to occur at the end of the read image OI due to the non-uniformity of light irradiation during reading. In particular, in a flat-bed type reading device such as the scanner 400, light is reflected from the side end surface portion of a glass document table 440 (also referred to as platen glass), or the document is lifted from the document table 440. Such a shadow is likely to occur because the amount of light applied to the edge of the document tends to decrease. In such a shadowed portion, the pixel density in the read image OI is high, so that even if the original pixel PXa does not exist in the portion, the original pixel PXa is erroneously specified. There is a case. According to the search range determination process of the above embodiment, as described above, it is determined whether or not there are M document pixels PXa at a position on the line P1L far from the left end LE (S210, S215). When M document pixels PXa are not present at positions on the line P1L (S215: NO), it is determined whether or not M document pixels PXa are present sequentially at positions on the lines P2La to P2Lc. (S220). As a result, when the document image Ad is at a position away from the left end LE as in the examples of FIGS. 3 and 8, for example, the left end TL of the search range SA is the read image OI (document pixel specifying image CI). ) At a position away from the left end LE. Then, a plurality of contour pixels PXo are specified within the search range SA determined in this way. Accordingly, since a shadow is generated in the vicinity of the left end LE of the read image OI, a plurality of document pixels PXa are erroneously present even though the plurality of document pixels PXa are not present in the vicinity of the left end LE. Even in such a case, the contour of the document image Ad can be specified with high accuracy.

さらに、本実施例の探索範囲決定処理では、例えば、注目端が下端BEである場合には、ラインP1B上の位置に、下端BEに沿う方向に連続するM個の原稿画素PXaが存在するか否かが判断される(S210、S215)。ラインP1B上の位置にM個の原稿画素PXaが存在する場合に(S215:YES)、ラインP1B上の位置よりも下端BE側の複数個のラインP3Ba〜P3Bc上の位置について、順次に、M個の原稿画素PXaが存在するか否かが判断される(S235、S240、S250)。そして、複数個のラインP3Ba〜P3Bc上の位置についての判断結果に基づいて、探索範囲SAの下端TBの位置が決定される(S245、S255)。したがって、図3、図8の例のように、ラインP1B上の位置よりも下端BE側に複数個の原稿画素PXaが存在する場合であっても、適切な探索範囲SAを規定できるので、原稿画像Adの輪郭をより精度良く特定することができる。   Further, in the search range determination process of the present embodiment, for example, when the target end is the lower end BE, is there any M document pixels PXa continuous in the direction along the lower end BE at the position on the line P1B? It is determined whether or not (S210, S215). When M document pixels PXa are present at the position on the line P1B (S215: YES), the positions on the plurality of lines P3Ba to P3Bc on the lower end BE side from the position on the line P1B are sequentially M. It is determined whether or not there are original document pixels PXa (S235, S240, S250). Then, the position of the lower end TB of the search range SA is determined based on the determination result about the positions on the plurality of lines P3Ba to P3Bc (S245, S255). Therefore, as shown in FIGS. 3 and 8, even when there are a plurality of document pixels PXa on the lower end BE side with respect to the position on the line P1B, an appropriate search range SA can be defined. The contour of the image Ad can be specified with higher accuracy.

さらに、本実施例の探索範囲決定処理では、例えば、注目端が下端BEである場合には、複数個のラインP3Ba〜P3Bc上の位置について、ラインP1B上の位置から下端BEに向かって順次に、M個の原稿画素PXaが存在するか否かが判断される(S235、S240、S250)。そして、ラインP3Bc上の位置にM個の原稿画素PXaが存在しないと判断される場合に(S240:NO)、ラインP3Bc上の位置に基づいて、探索範囲SAの下端TBの位置が決定される。この結果、例えば、読取画像OIの下端BEに影が生じている場合であっても、下端BEとラインP1B上の位置との間に、探索範囲SAの下端BEを適切に決定できる。したがって、原稿画像Adの輪郭をさらに精度良く特定することができる。   Further, in the search range determination process of the present embodiment, for example, when the target end is the lower end BE, the positions on the plurality of lines P3Ba to P3Bc are sequentially increased from the position on the line P1B toward the lower end BE. It is determined whether or not there are M document pixels PXa (S235, S240, S250). When it is determined that there are no M original pixels PXa at the position on the line P3Bc (S240: NO), the position of the lower end TB of the search range SA is determined based on the position on the line P3Bc. . As a result, for example, even when a shadow is generated at the lower end BE of the read image OI, the lower end BE of the search range SA can be appropriately determined between the lower end BE and the position on the line P1B. Therefore, the contour of the document image Ad can be specified with higher accuracy.

さらに、本実施例の探索範囲決定処理では、読取画像OIおよび原稿画素特定画像CIの4個の辺に対応する4個の端UE、BE、LE、REのそれぞれを注目端として、S210〜S255の処理が実行されて、4個の辺に対応する探索範囲SAの4個の端TU、TB、TL、TRが決定される(S205、S260)。したがって、矩形の読取画像OIに対して適切な探索範囲を規定できるので、矩形の読取画像OI内の原稿画像Adの輪郭を精度良く特定することができる。   Further, in the search range determination process of the present embodiment, the four ends UE, BE, LE, and RE corresponding to the four sides of the read image OI and the document pixel specifying image CI are used as the target ends, and S210 to S255. The four processes TU, TB, TL, TR of the search range SA corresponding to the four sides are determined (S205, S260). Therefore, since an appropriate search range can be defined for the rectangular read image OI, the contour of the document image Ad in the rectangular read image OI can be specified with high accuracy.

さらに、本実施例では、読取画像データは、フラットベッド式のスキャナ400を用いて生成されるので、端部に影が生じやすい読取画像において、原稿画像Adの輪郭を精度良く特定することができる。   Furthermore, in the present embodiment, the read image data is generated using the flatbed scanner 400, so that the outline of the document image Ad can be accurately identified in the read image in which a shadow is likely to occur at the end. .

さらに、本実施例では、読取画像データを用いて生成される原稿画素特定画像データを用いて、S210〜S255の処理が実行される。すなわち、原稿画素特定画像CI上にて探索範囲SAを決定することによって、間接的に、原稿画素特定画像CI上の探索範囲に対応する読取画像OI上の範囲が、読取画像OI上の探索範囲として決定される。したがって、原稿画素特定画像データを生成することなく、読取画像OI上にて、直接的に、探索範囲を決定する場合と比較して、効率良く、探索範囲を決定できる。   Further, in the present embodiment, the processes of S210 to S255 are executed using the document pixel specifying image data generated using the read image data. That is, by determining the search range SA on the document pixel specific image CI, the range on the read image OI corresponding to the search range on the document pixel specific image CI indirectly becomes the search range on the read image OI. As determined. Therefore, the search range can be determined more efficiently than the case where the search range is determined directly on the read image OI without generating document pixel specific image data.

以上の説明から解るように、上記探索範囲決定処理における原稿画素特定画像CI内のラインP1U、P1B、P1R、P1Lの位置に対応する読取画像OI内の位置は、第1の位置の例であり、原稿画素特定画像CI内のラインP2La〜P2Lcの位置に対応する読取画像OI内の位置は、第2の位置の例であり、原稿画素特定画像CI内のラインP3Ua〜P3Uc、P3Ba〜P3Bcの位置に対応する読取画像OI内の位置は、第3の位置の例である。また、上記実施例における原稿画像Adは、第1の画像の例であり、外側画像Abは、第2の画像の例である。   As can be understood from the above description, the positions in the read image OI corresponding to the positions of the lines P1U, P1B, P1R, and P1L in the document pixel specifying image CI in the search range determination process are examples of the first position. The positions in the read image OI corresponding to the positions of the lines P2La to P2Lc in the document pixel specific image CI are examples of the second position, and the lines P3Ua to P3Uc and P3Ba to P3Bc in the document pixel specific image CI are examples. The position in the read image OI corresponding to the position is an example of the third position. The document image Ad in the above embodiment is an example of the first image, and the outer image Ab is an example of the second image.

A−5.輪郭特定処理
図2のS30の輪郭特定処理について説明する。輪郭特定処理は、上述したように、原稿画素特定画像データを用いて、探索範囲SA内にて、輪郭画素PXoを特定する処理である。図9は、輪郭特定処理のフローチャートである。図10は、輪郭特定処理の説明図である。
A-5. Outline Specifying Process The outline specifying process in S30 of FIG. 2 will be described. As described above, the contour specifying process is a process of specifying the contour pixel PXo within the search range SA using the document pixel specifying image data. FIG. 9 is a flowchart of the contour specifying process. FIG. 10 is an explanatory diagram of the contour specifying process.

図9のS300では、CPU110は、輪郭画像OLIを示す輪郭画像データの初期データを、揮発性記憶装置120内に準備する。初期データは、縮小画像MIや原稿画素特定画像CIと同じサイズの画像を示す二値画像データであり、全ての画素の値が、初期値として、「0」に設定されている。   In S300 of FIG. 9, the CPU 110 prepares initial data of 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 original pixel specifying image CI, and the values of all the pixels are set to “0” as initial values.

S305では、CPU110は、原稿画素特定画像CIにおいて、探索範囲SAの外形の4個の辺に対応する4個の端、すなわち、上端TU、下端TB、左端TL、右端TR(図10)から、1個の注目端を選択する。S305では、CPU110は、注目端上の複数個の画素の中から、1個の注目画素を選択する。   In S305, the CPU 110, from the four ends corresponding to the four sides of the outer shape of the search range SA, that is, the upper end TU, the lower end TB, the left end TL, and the right end TR (FIG. 10) in the document pixel specific image CI. One attention end is selected. In S305, the CPU 110 selects one target pixel from among a plurality of pixels on the target end.

S315では、CPU110は、注目画素を始点として、注目端から探索範囲SAの内側に向かって探索して、最初に探索される原稿画素PXaを特定する。探索範囲SAの内側に向かう方向は、具体的には、注目端と垂直な方向であって、かつ、注目端とは向かい合う探索範囲SAの他の端に向かう方向である。図10に示すように、上端TU上に位置する画素PXt1が注目画素である場合には、下側に向かって検索が行われ、最初に探索される原稿画素PXa1が特定される。同様にして、右端TR、下端TB、左端TL上にそれぞれ位置する画素PXt2、PXt3、PXt4が注目画素である場合には、それぞれ、左側、上側、右側に向かって検索が行われ、最初に探索される原稿画素PXa2、PXa3、PXa4が特定される。   In S315, the CPU 110 searches from the target end to the inside of the search range SA using the target pixel as a starting point, and specifies the original pixel PXa to be searched first. Specifically, the direction toward the inside of the search range SA is a direction perpendicular to the target end and a direction toward the other end of the search range SA facing the target end. As shown in FIG. 10, when the pixel PXt1 positioned on the upper end TU is the target pixel, the search is performed downward, and the document pixel PXa1 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 target pixels, the search is performed toward the left side, the upper side, and the right side, respectively. Document pixels PXa2, PXa3, and PXa4 to be processed are specified.

S320では、CPU110は、特定された原稿画素PXaを、輪郭画素PXoとして、輪郭画像データに記録する。具体的には、特定された原稿画素PXaに対応する輪郭画像データにおける画素の値を「1」に変更する。   In S320, the CPU 110 records the specified document pixel PXa in the contour image data as the contour pixel PXo. Specifically, the value of the pixel in the contour image data corresponding to the specified document pixel PXa is changed to “1”.

S325では、CPU110は、注目端上の全ての画素を注目画素として処理したか否かを判断する。未処理の画素がある場合には(S325:NO)、CPU110は、S305に処理を戻す。全ての画素が処理された場合(S325:YES)、CPU110は、S330に処理を進める。   In S325, the CPU 110 determines whether all the pixels on the target end have been processed as the target pixel. When there is an unprocessed pixel (S325: NO), the CPU 110 returns the process to S305. When all the pixels have been processed (S325: YES), the CPU 110 advances the process to S330.

S335では、CPU110は、全ての探索範囲SAの端TU、TB、TL、TRを、注目端として処理したか否かを判断する。未処理の端がある場合には(S335:NO)、CPU110は、S305に処理を戻す。全ての端が処理された場合には(S335:YES)、CPU110は、輪郭特定処理を終了する。輪郭特定処理によって、図3(C)に示す輪郭画像OLIを示す輪郭画像データが生成される。   In S335, the CPU 110 determines whether or not the ends TU, TB, TL, and TR of all the search ranges SA have been processed as attention ends. If there is an unprocessed end (S335: NO), the CPU 110 returns the process to S305. When all edges have been processed (S335: YES), the CPU 110 ends the contour specifying process. By the contour specifying process, contour image data indicating the contour image OLI shown in FIG. 3C is generated.

本実施例の輪郭特定処理によれば、探索範囲SAの端から探索範囲SAの内側に向かって原稿画素PXaが探索され、最初に探索される特定の原稿画素PXa(例えば、PXa1〜PXa4)が、輪郭画素PXoとして特定される。したがって、探索範囲SA内において、原稿画像Adの輪郭を、容易、かつ、適切に特定することができる。   According to the contour specifying process of the present embodiment, the original pixel PXa is searched from the end of the search range SA toward the inside of the search range SA, and the specific original pixel PXa (for example, PXa1 to PXa4) to be searched first is determined. , Identified as a contour pixel PXo. Therefore, the outline of the document image Ad can be easily and appropriately specified within the search range SA.

A−6.原稿領域特定処理
図2のS35の原稿領域特定処理について説明する。原稿領域特定処理は、上述したように、輪郭画像データを用いて、原稿画像Adに対応する原稿領域AAを特定する処理である。図11は、原稿領域特定処理のフローチャートである。
A-6. Document Area Specifying Process The document area specifying process in S35 of FIG. 2 will be described. As described above, the document area specifying process is a process for specifying the document area AA corresponding to the document image Ad using the contour image data. FIG. 11 is a flowchart of the document area specifying process.

図11のS310では、輪郭画像データを用いて、原稿の縁を示す直線の候補である複数個の候補直線を特定する。具体的には、輪郭画素PXoによって表される直線が、候補直線として採用される。候補直線を特定する方法としては、輪郭画素PXoを用いるハフ変換が用いられる。ハフ変換は、公知の処理であるので、その説明を省略する。ハフ変換の結果、図3(C)の例では、原稿画像Adの輪郭を示す6本の候補直線L1〜L6が特定される。   In S310 of FIG. 11, a plurality of candidate straight lines that are straight line candidates indicating the edge of the document are specified using the contour image data. Specifically, a straight line represented by the contour pixel PXo is adopted as a candidate straight line. As a method for specifying the candidate straight line, Hough transform using the contour pixel PXo is used. Since the Hough transform is a known process, its description is omitted. As a result of the Hough transform, in the example of FIG. 3C, six candidate straight lines L1 to L6 indicating the contour of the document image Ad are specified.

S320では、CPU110は、6本の候補直線L1〜L6から、原稿の縁を示す直線を選択する。具体的には、CPU110は、6本の候補直線L1〜L6から、輪郭画像OLIの外形の4個の端(辺)に位置する直線を除外する。例えば、図3(A)の例では、輪郭画像OLIの上端に位置する候補直線L2が除外される。輪郭画像OLIの4個の端に位置する直線(例えば、L2)は、読取画像OIの対応する端に位置している。このような直線L2は、図3(A)に示すように、読取時において、読取可能領域からはみ出した原稿上の領域Daに対応しており、原稿の縁を示していないと考えられる。CPU110は、残りの候補直線L1、L3〜L6から、互いに平行な2本の直線の組を、2組抽出する。図3(A)の例では、直線L3とL6の組と、直線L2とL4の組と、が抽出される。これらの4本の直線L2、L3、L4、L6が、原稿の縁を示す直線として選択される。   In S320, the CPU 110 selects a straight line indicating the edge of the document from the six candidate straight lines L1 to L6. Specifically, the CPU 110 excludes the straight lines located at the four ends (sides) of the outline 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. Straight lines (for example, L2) positioned at the four ends of the contour image OLI are positioned at corresponding ends of the read image OI. As shown in FIG. 3A, such a straight line L2 corresponds to the area Da on the document that protrudes from the readable area at the time of reading, and is considered not to indicate the edge of the document. The CPU 110 extracts two sets of two straight lines parallel to each other from the remaining candidate straight lines L1, L3 to L6. In the example of FIG. 3A, a set of straight lines L3 and L6 and a set of straight lines L2 and L4 are extracted. These four straight lines L2, L3, L4, and L6 are selected as straight lines indicating the edge of the original.

S330では、CPU110は、原稿の縁を示す直線群で形成される矩形の内部領域を原稿領域AAとして特定する。具体的には、原稿の縁を示す4本の直線L2、L3、L4、L6の4個の交点CP1〜CP4を特定することで、該4個の交点CP1〜CP4によって定義される原稿領域AAが特定される。   In S330, the CPU 110 identifies a rectangular internal area formed by a group of straight lines indicating the edge of the document as the document area AA. Specifically, by specifying the four intersection points CP1 to CP4 of the four straight lines L2, L3, L4, and L6 indicating the edge of the document, the document area AA defined by the four intersection points CP1 to CP4. Is identified.

以上の説明から解るように、本実施例の原稿領域特定処理では、原稿画素特定画像データを用いて生成された輪郭画像データを用いて、原稿画像Adの輪郭のうち、原稿の縁を表す直線の候補である複数の候補直線L1〜L6が特定され(S310)、これらのうちの一部の直線L2、L3、L4、L6を用いて規定される原稿領域AAが決定される(S320、S330)。したがって、原稿画素特定画像データに基づいて、具体的には、原稿画素特定画像データを用いて生成された輪郭画像データを用いて、特定済みの原稿画像Adの輪郭から、適切な原稿領域AAを特定することができる。   As can be understood from the above description, in the document area specifying process of the present embodiment, a straight line representing the edge of the document in the contour of the document image Ad is used using the contour image data generated using the document pixel specifying image data. A plurality of candidate straight lines L1 to L6 are identified (S310), and a document area AA defined using a part of these straight lines L2, L3, L4, and L6 is determined (S320, S330). ). Therefore, based on the document pixel specific image data, specifically, using the contour image data generated using the document pixel specific image data, an appropriate document area AA is defined from the contour of the specified document image Ad. Can be identified.

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

図12のS410では、読取画像データに対して、原稿画像Adの傾きを補正する傾き補正処理が実行される。具体的には、輪郭画像OLIにて特定された直線L3の輪郭画像OLIの縦方向に対する角度が算出される。そして、該角度分だけ読取画像OIを回転させることによって、直線L3に対応する読取画像OI内の原稿画像Adの輪郭線を、読取画像OIの縦方向と平行にする回転処理が実行される。   In S410 of FIG. 12, an inclination correction process for correcting the inclination of the document image Ad is performed on the read image data. Specifically, the angle of the straight line L3 specified in the contour image OLI with respect to the vertical direction of the contour image OLI is calculated. Then, by rotating the read image OI by the angle, a rotation process is performed in which the contour line of the document image Ad in the read image OI corresponding to the straight line L3 is parallel to the vertical direction of the read image OI.

S420では、CPU110は、傾き補正済みの読取画像OIにおいて、原稿画像Adの欠落部分を描画する。具体的には、傾き補正済みの読取画像OIにおいて、輪郭画像OLIを用いて特定される原稿画像Adの輪郭よりも外側であって、かつ、原稿領域AAよりも内側の領域、具体的には、図3(A)の領域Da、Dbが特定される。傾き補正済みの読取画像OIにおいて、領域Da、Db内の複数個の画素の値が、原稿画像Adの背景Bgの色を示す値に置換される。背景Bgの色を示す値には、例えば、輪郭画像OLIを用いて特定される原稿画像Adの輪郭に沿い、かつ、原稿画像Ad内に位置する複数個の画素の値の平均値が用いられる。   In S420, the CPU 110 draws a missing portion of the document image Ad in the read image OI whose inclination has been corrected. Specifically, in the read image OI whose inclination has been corrected, an area outside the outline of the document image Ad specified using the outline image OLI and inside the document area AA, specifically, The areas Da and Db in FIG. 3A are specified. In the read image OI whose inclination has been corrected, the values of a plurality of pixels in the areas Da and Db are replaced with values indicating the color of the background Bg of the document image Ad. For the value indicating the color of the background Bg, for example, the average value of the values of a plurality of pixels located along the contour of the document image Ad specified using the contour image OLI and located in the document image Ad is used. .

S430では、CPU110は、欠落部分が描画済の読取画像OIにおいて、外側画像Abの色を、指定色に変更する。具体的には、傾き補正済みの読取画像OIにおいて、輪郭画像OLIを用いて特定される原稿画像Adの輪郭の外側に位置する複数個の画素の値が、予め指定された色(例えば、白)を示す値に置換される。これによって、図3(D)の補修済画像RIを示す補修済画像データが生成される。   In S430, the CPU 110 changes the color of the outer image Ab to the designated color in the read image OI in which the missing part has been drawn. Specifically, in the read image OI whose inclination has been corrected, the values of a plurality of pixels located outside the contour of the document image Ad specified using the contour image OLI are in a predetermined color (for example, white Is replaced with a value indicating). As a result, repaired image data indicating the repaired image RI in FIG. 3D is generated.

B.変形例:
(1)上記実施例では、単純二値画像データと、エッジ画像データと、の論理和を取ることによって、原稿画素特定画像データが生成される(図4のS160)。これに代えて、単純二値画像データと、エッジ画像データと、別の二値画像データと、の論理和を取ることによって、最終的な原稿画素特定画像データが生成されても良い。別の二値画像データには、例えば、読取画像データに含まれる各画素のR値を、所定の閾値で二値化して得られるR成分の二値画像データが用いられ得る。
B. Variation:
(1) In the above embodiment, document pixel specific image data is generated by taking the logical sum of simple binary image data and edge image data (S160 in FIG. 4). Instead of this, final original pixel specific image data may be generated by performing a logical sum of simple binary image data, edge image data, and another binary image data. As another binary image data, for example, binary image data of an R component obtained by binarizing the R value of each pixel included in the read image data with a predetermined threshold value can be used.

(2)上記実施例では、第2画素PX2の個数M2が、第1画素PX1の個数M1以下である場合に(図4のS130:NO)、単純二値画像データを、再度、生成している(図4のS135〜S145)。単純二値画像データの生成を再度行うか否かの判断基準は、これに限られない。例えば、第2画素PX2の個数M2が、縮小画像MIの画素の総数の60%以下である場合に、単純二値画像データを、再度、生成しても良い。 (2) In the above embodiment, when the number M2 of the second pixels PX2 is less than or equal to the number M1 of the first pixels PX1 (S130: NO in FIG. 4), the simple binary image data is generated again. (S135 to S145 in FIG. 4). The criterion for determining whether to generate simple binary image data again is not limited to this. For example, when the number M2 of the second pixels PX2 is 60% or less of the total number of pixels of the reduced image MI, the simple binary image data may be generated again.

(3)図4の原稿領域特定処理では、複数個の候補直線L1〜L6を用いて、原稿領域AAを特定している(図11のS310〜S330)が、これに限られない。例えば、原稿画像Adの傾きが発生し難い場合などには、輪郭画像OLI内に特定される複数個の輪郭画素PXoに対する外接矩形を、原稿領域AAとして特定しても良い。 (3) In the document area specifying process of FIG. 4, the document area AA is specified using a plurality of candidate straight lines L1 to L6 (S310 to S330 of FIG. 11), but is not limited thereto. For example, when the inclination of the document image Ad is difficult to occur, a circumscribed rectangle for the plurality of contour pixels PXo specified in the contour image OLI may be specified as the document area AA.

(4)図2の画像処理のステップは、適宜、省略が可能である。例えば、図2のS15の縮小画像データの生成は、省略されても良い。この場合には、S20の原稿画素特定処理において、読取画像データを用いて、読取画像データと同じ画素数の単純二値画像データおよびエッジ二値画像データが生成される。 (4) The image processing step in FIG. 2 can be omitted as appropriate. For example, the generation of the reduced image data in S15 of FIG. 2 may be omitted. In this case, in the original pixel specifying process of S20, simple binary image data and edge binary image data having the same number of pixels as the read image data are generated using the read image data.

(5)図4の原稿画素特定処理のステップは、適宜、省略が可能である。例えば、図4のS110およびS115は省略されても良い。この場合には、読取画像データが、モノクロ画像データであるかカラー画像データであるかに関わらずに、S120にて特定輝度範囲YRだけを用いて、彩度を考慮することなく、単純二値画像データが生成される。 (5) The steps of the original pixel specifying process in FIG. 4 can be omitted as appropriate. For example, S110 and S115 in FIG. 4 may be omitted. In this case, regardless of whether the read image data is monochrome image data or color image data, simple binary processing is performed using only the specific luminance range YR in S120 without considering saturation. Image data is generated.

また、図4のS125〜S145は、省略されても良い。この場合には、予め定められた特定輝度範囲YRや特定彩度範囲CRを用いて、S115またはS120にて生成される単純二値画像データが、最終的な単純二値画像データとして用いられても良い。また、図4のS110〜S130は、省略されても良い。この場合には、常に、S130〜S145が実行されて、ヒストグラムに基づく特定輝度範囲YRaや特定彩度範囲CRaを用いて、S145にて生成される単純二値画像データが、常に、最終的な単純二値画像データとして用いられても良い。   Further, S125 to S145 in FIG. 4 may be omitted. In this case, the simple binary image data generated in S115 or S120 using the predetermined specific luminance range YR or specific saturation range CR is used as the final simple binary image data. Also good. Further, S110 to S130 in FIG. 4 may be omitted. In this case, S130 to S145 are always executed, and the simple binary image data generated in S145 using the specific luminance range YRa or the specific saturation range CRa based on the histogram is always final. It may be used as simple binary image data.

(6)図7の探索範囲決定処理では、探索範囲SAを規定する範囲情報として、原稿画素特定画像CIの4個の端のそれぞれと、探索範囲SAの対応する端と、の間の距離DU、DB、DL、DRを示す情報が生成される(S265)。これに限らず、範囲情報は、例えば、矩形の探索範囲SAの4個の角の座標情報であっても良いし、探索範囲SAの上端および下端を示す縦方向の2個の座標と、左端および右端を示す横方向の2個の座標と、を示す情報であっても良い。 (6) In the search range determination process of FIG. 7, distance DU between each of the four ends of the document pixel specific image CI and the corresponding end of the search range SA as range information defining the search range SA. , DB, DL, and DR are generated (S265). For example, the range information may be coordinate information of four corners of the rectangular search range SA, two vertical coordinates indicating the upper end and the lower end of the search range SA, and the left end. And information indicating two horizontal coordinates indicating the right end.

(7)図7の探索範囲決定処理のステップは、適宜、省略が可能である。例えば、図7のS235〜S255の処理を省略して、ラインP1U、P1B、P1L、P1Rよりも注目端側の探索を行わなくても良い。ラインP1U、P1B、P1L、P1R上の位置に、連続するM個の原稿画素PXaが存在する場合には(S215:YES)、注目端の位置を、注目端に対応する探索範囲SAの端として決定しても良い。 (7) The step of the search range determination process in FIG. 7 can be omitted as appropriate. For example, the processing of S235 to S255 in FIG. When there are M consecutive document pixels PXa at positions on the lines P1U, P1B, P1L, and P1R (S215: YES), the position of the target end is set as the end of the search range SA corresponding to the target end. You may decide.

また、原稿画素特定画像CIの4個の端の全てについて、S210〜S255の処理を行わなくても良い。例えば、スキャナ400の構造などから影が生じやすい読取画像OIの1以上3以下の端が解っている場合には、読取画像OIの当該1以上3以下の端に対応する端について、S210〜S255の処理を行い、残りの端については、その端から内側に向かって、連続するM個の原稿画素PXaが存在するか否かを探索しても良い。   Further, it is not necessary to perform the processing of S210 to S255 for all four edges of the document pixel specifying image CI. For example, when the end of 1 to 3 or less of the read image OI that is likely to cause a shadow is known from the structure of the scanner 400, the end corresponding to the end of 1 to 3 or less of the read image OI is S210 to S255. The remaining edge may be searched for whether there are M document pixels PXa continuous from the edge toward the inside.

(8)図7の探索範囲決定処理では、ラインP1U、P1B、P1L、P1R上の位置に、連続するM個の原稿画素PXaが存在する場合には(S215:YES)、ラインP1U、P1B、P1L、P1Rから注目端に向かって、順次に、連続するM個の原稿画素PXaが存在するか否かを探索している(S235、S240、S250)。これに代えて、この場合には、注目端からラインP1U、P1B、P1L、P1Rに向かって、順次に、連続するM個の原稿画素PXaが存在するか否かを探索しても良い。この場合には、連続するM個の原稿画素PXaが存在する最初のライン上の位置が、探索範囲SAの端の位置に決定される。 (8) In the search range determination process of FIG. 7, when there are M consecutive document pixels PXa at positions on the lines P1U, P1B, P1L, P1R (S215: YES), the lines P1U, P1B, Whether or not there are M document pixels PXa continuous from P1L and P1R toward the target end is sequentially searched (S235, S240, and S250). Instead, in this case, it may be searched whether there are M document pixels PXa successively from the target end toward the lines P1U, P1B, P1L, and P1R. In this case, the position on the first line where M consecutive document pixels PXa exist is determined as the end position of the search range SA.

(9)図7の探索範囲決定処理は、原稿画素特定画像データを用いて、原稿画素特定画像CIを解析することによって、間接的に、読取画像OI上に探索範囲を決定している。これに代えて、原稿画素特定画像データを用いることなく、読取画像データまたは縮小画像データを直接解析することによって、探索範囲SAを決定しても良い。例えば、読取画像OI上に、ラインP1U、P1B、P1L、P1Rに対応するラインを設定して、該ライン上に連続するM個の画素が存在するか否かを、読取画像データの画素の値を用いて決定しても良い。 (9) The search range determination process in FIG. 7 indirectly determines the search range on the read image OI by analyzing the document pixel specific image CI using the document pixel specific image data. Alternatively, the search range SA may be determined by directly analyzing the read image data or the reduced image data without using the document pixel specifying image data. For example, a line corresponding to the lines P1U, P1B, P1L, and P1R is set on the read image OI, and whether or not there are M consecutive pixels on the line is determined by the pixel value of the read image data. You may decide using.

(10)図9の輪郭特定処理とは異なる方法で、複数個の輪郭画素PXoが特定されても良い。例えば、探索範囲SAの端上に位置する原稿画素PXaを始点として、非原稿画素PXbと隣接する原稿画素PXaを辿ることによって、複数個の輪郭画素PXoが特定されても良い。 (10) A plurality of contour pixels PXo may be specified by a method different from the contour specifying process of FIG. For example, the plurality of contour pixels PXo may be specified by tracing the document pixel PXa adjacent to the non-document pixel PXb, starting from the document pixel PXa located on the end of the search range SA.

(11)図11の原稿領域特定処理は、適宜に変更可能である。例えば、候補直線を特定する処理(S310)は、ハフ変換を用いる処理に代えて、原稿の縁を表し得る直線を特定する他の種々の処理であってよい。例えば、CPU110は、最小二乗法を用いて、複数の輪郭画素の配置を近似する候補直線を特定してもよい。また、S320では、互いに平行な直線の組に、代えて、互いに垂直な直線の組が、2組特定されても良い。また、最も長い1本の直線だけが原稿の縁を示す直線として特定されても良い。この場合には、例えば、該1本の直線を基準に、例えば、ユーザによって指定された用紙サイズに対応する大きさの矩形が原稿領域AAとして特定されても良い。 (11) The document area specifying process in FIG. 11 can be changed as appropriate. For example, the process of specifying the candidate straight line (S310) may be other various processes of specifying a straight line that can represent the edge of the document, instead of the process using the Hough transform. For example, the CPU 110 may specify a candidate straight line that approximates the arrangement of a plurality of contour pixels using the least square method. In S320, two sets of straight lines perpendicular to each other may be specified instead of the set of straight lines parallel to each other. Further, only the longest straight line may be specified as a straight line indicating the edge of the document. In this case, for example, a rectangle having a size corresponding to the paper size designated by the user may be specified as the document area AA with reference to the one straight line.

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

(13)図7の探索範囲決定処理は、省略されても良く、例えば、原稿画素特定画像CIの全体を探索範囲として、図10の輪郭特定処理が行われても良い。 (13) The search range determination process in FIG. 7 may be omitted. For example, the contour specifying process in FIG. 10 may be performed using the entire original pixel specifying image CI as the search range.

(14)図10の輪郭特定処理は省略されても良い。この場合には、例えば、原稿画素特定画像CIを用いて、原稿領域AAが特定されても良い。輪郭特定処理の後に、例えば、特定された原稿画像Adの輪郭に沿って、画像をトリミングする処理や、原稿画像Adの輪郭内の画像を補正する処理が行われても良い。例えば、原稿画像Adの傾きが発生し難い場合などには、原稿画素特定画像CIのうち、外縁の近傍で孤立した原稿画素PXaをノイズとして除去した後に、原稿画素特定画像CI内に特定される複数個の原稿画素PXa1に対する外接矩形を、原稿領域AAとして特定しても良い。 (14) The contour specifying process in FIG. 10 may be omitted. In this case, for example, the document area AA may be specified using the document pixel specifying image CI. After the contour specifying process, for example, a process of trimming an image along the specified contour of the document image Ad or a process of correcting an image in the contour of the document image Ad may be performed. For example, when it is difficult for the original image Ad to be inclined, the original pixel PXa isolated in the vicinity of the outer edge of the original pixel specific image CI is removed as noise and then specified in the original pixel specific image CI. A circumscribed rectangle for a plurality of document pixels PXa1 may be specified as the document area AA.

(15)原稿を光学的に読み取る装置は、図1で説明したスキャナ400に代えて、原稿を光学的に読み取ることが可能な他の種々の装置であってよい。例えば、スキャナ400は、原稿を搬送するための自動給紙装置(Auto Document Feeder)を備え、搬送される原稿を、停止したイメージセンサ420で読み取るタイプのスキャナであっても良い。また、画像処理装置100のCPU110は、画像処理装置100に接続されたスキャナ400から、読取画像データを取得することに代えて、不揮発性記憶装置130や、画像処理装置100に接続された図示しない外部記憶装置(例えば、USBメモリ)に予め格納された読取画像データを取得してもよい。 (15) The apparatus for optically reading an original may be various other apparatuses capable of optically reading an original instead of the scanner 400 described in FIG. For example, the scanner 400 may be a scanner that includes an automatic document feeder (Auto Document Feeder) for transporting a document and reads the transported document with the stopped image sensor 420. The CPU 110 of the image processing apparatus 100 replaces the acquisition of read image data from the scanner 400 connected to the image processing apparatus 100, and is not shown connected to the nonvolatile storage device 130 or the image processing apparatus 100. The read image data stored in advance in an external storage device (for example, a USB memory) may be acquired.

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

上記各実施例において、ハードウェアによって実現されていた構成の一部をソフトウェアに置き換えるようにしてもよく、逆に、ソフトウェアによって実現されていた構成の一部あるいは全部をハードウェアに置き換えるようにしてもよい。   In each of the above embodiments, a part of the configuration realized by hardware may be replaced with software, and conversely, part or all of the configuration realized by software may be replaced with hardware. Also good.

また、本発明の機能の一部または全部がコンピュータプログラムで実現される場合には、そのプログラムは、コンピュータ読み取り可能な記録媒体(例えば、一時的ではない記録媒体)に格納された形で提供することができる。プログラムは、提供時と同一または異なる記録媒体(コンピュータ読み取り可能な記録媒体)に格納された状態で、使用され得る。「コンピュータ読み取り可能な記録媒体」は、メモリーカードやCD−ROMのような携帯型の記録媒体に限らず、各種ROM等のコンピュータ内の内部記憶装置や、ハードディスクドライブ等のコンピュータに接続されている外部記憶装置も含み得る。   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 can be used in a state where it is stored in the same or different recording medium (computer-readable recording medium) as 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 a computer such as various ROMs or a computer such as a hard disk drive. An external storage device may also be included.

以上、実施例、変形例に基づき本発明について説明してきたが、上記した発明の実施の形態は、本発明の理解を容易にするためのものであり、本発明を限定するものではない。本発明は、その趣旨並びに特許請求の範囲を逸脱することなく、変更、改良され得ると共に、本発明にはその等価物が含まれる。   As mentioned above, although this invention was demonstrated based on the Example and the modification, Embodiment mentioned above is for making an understanding of this invention easy, and does not limit this invention. The present invention can be changed and improved without departing from the spirit and scope of the claims, and equivalents thereof are included in the present invention.

100…画像処理装置、110…CPU、120…揮発性記憶装置、130…不揮発性記憶装置、132…プログラム、140…表示部、150…操作部、190…インタフェース、255…輝度、400…スキャナ、410…制御部、411…CPU、412…揮発性記憶装置、413…不揮発性記憶装置、414…プログラム、419…インタフェース、420…イメージセンサ、430…移動装置、440…原稿台、450…カバー、490…本体部、SA…探索範囲、AA…原稿領域、EI…エッジ二値画像、SI…スキャン画像、OI…読取画像、MI…縮小画像、CI…原稿画素特定画像、RI…補修済画像、BI、BIm、BIs…単純二値画像、YR、YRa…特定輝度範囲、CR、CRa…特定彩度範囲、NT…ネットワーク、Ab…外側画像、Ad…原稿画像、PXa…原稿画素、PXb…非原稿画素、PXe…エッジ画素、PXn…非エッジ画素、PXo…輪郭画素     DESCRIPTION OF SYMBOLS 100 ... Image processing apparatus, 110 ... CPU, 120 ... Volatile memory device, 130 ... Nonvolatile memory device, 132 ... Program, 140 ... Display part, 150 ... Operation part, 190 ... Interface, 255 ... Luminance, 400 ... Scanner, 410: control unit, 411 ... CPU, 412 ... volatile storage device, 413 ... nonvolatile storage device, 414 ... program, 419 ... interface, 420 ... image sensor, 430 ... moving device, 440 ... document table, 450 ... cover, 490 ... Main body, SA ... Search range, AA ... Original area, EI ... Edge binary image, SI ... Scanned image, OI ... Scanned image, MI ... Reduced image, CI ... Original pixel specific image, RI ... Repaired image, BI, BIm, BIs ... simple binary image, YR, YRa ... specific luminance range, CR, CRa ... specific saturation range, NT ... network Click, Ab ... outside image, Ad ... original image, PXa ... original pixel, PXb ... non original pixel, PXe ... edge pixel, PXn ... non-edge pixel, PXO ... contour pixels

Claims (7)

画像処理装置であって、
原稿を光学的に読み取ることによって生成される読取画像データを取得する画像データ取得部であって、前記読取画像データは、前記原稿を示す第1の画像と前記原稿以外の領域を示す第2の画像とを含む読取画像を示す、前記画像データ取得部と、
前記読取画像データを用いて、特定条件を満たす複数個の画素を、前記複数個の第1の画素として特定し、前記特定条件を満たさない複数個の画素を、前記複数個の第2の画素として特定することによって、前記複数個の第1の画素と前記複数個の第2の画素と示す第1画像データを生成する第1画像生成部であって、前記特定条件は、特定輝度範囲内の輝度を有することを含み、前記特定輝度範囲は、前記第2の画像に対応する画素の輝度を含む範囲である、前記第1画像生成部と、
前記読取画像データを用いて、前記読取画像内のエッジを示す複数個のエッジ画素を示す第2画像データを生成する第2画像生成部と、
少なくとも前記第1画像データと前記第2画像データとを用いて、前記読取画像内の前記原稿に対応する原稿領域を特定する特定部と、
を備える、画像処理装置。
An image processing apparatus,
An image data acquisition unit for acquiring read image data generated by optically reading a document, wherein the read image data includes a first image indicating the document and a second region indicating a region other than the document. The image data acquisition unit showing a read image including an image;
Using the read image data, a plurality of pixels that satisfy a specific condition are specified as the plurality of first pixels, and a plurality of pixels that do not satisfy the specific condition are specified as the plurality of second pixels. A first image generation unit that generates first image data indicating the plurality of first pixels and the plurality of second pixels, wherein the specific condition is within a specific luminance range. The first image generation unit, wherein the specific luminance range is a range including the luminance of pixels corresponding to the second image;
A second image generation unit configured to generate second image data indicating a plurality of edge pixels indicating edges in the read image using the read image data;
A specifying unit that specifies a document area corresponding to the document in the read image using at least the first image data and the second image data;
An image processing apparatus comprising:
請求項1に記載の画像処理装置であって、
前記特定部は、
前記第1画像データを用いて特定される前記複数個の第2画素と、前記第2画像データを用いて特定される前記複数個のエッジ画素と、を含む特定画素群を示す合成画像データを生成し、
前記合成画像データを用いて、前記読取画像内の前記原稿領域を特定する、画像処理装置。
The image processing apparatus according to claim 1,
The specific part is:
Composite image data indicating a specific pixel group including the plurality of second pixels specified using the first image data and the plurality of edge pixels specified using the second image data. Generate
An image processing apparatus that identifies the document area in the read image using the composite image data.
請求項1または2に記載の画像処理装置であって、
前記第1画像生成部は、前記特定輝度範囲内の輝度を有し、かつ、前記第2の画像の彩度を含む特定彩度範囲内の彩度を有する複数個の画素を、前記複数個の第1の画素として特定し、前記特定輝度範囲外の輝度を有する複数個の画素と、前記特定彩度範囲外の彩度を有する複数個の画素と、を前記複数個の第2の画素として特定することによって、前記第1画像データを生成する、画像処理装置。
The image processing apparatus according to claim 1, wherein:
The first image generation unit includes a plurality of pixels having a luminance within the specific luminance range and having a saturation within a specific saturation range including a saturation of the second image. A plurality of pixels having a luminance outside the specific luminance range and a plurality of pixels having a saturation outside the specific saturation range are identified as the first pixels of the plurality of second pixels. An image processing apparatus that generates the first image data by specifying as follows.
請求項1〜3のいずれかに記載の画像処理装置であって、
前記第1画像生成部は、
第1の前記特定輝度範囲を用いて、前記複数個の第1の画素と前記複数個の第2の画素とを特定し、
前記第1の特定輝度範囲を用いて特定される前記複数個の第2の画素の個数が、基準以下であるか否かを判断し、
前記第1の特定輝度範囲を用いて特定される前記複数個の第2の画素の個数が、基準以下である場合には、前記第1の特定輝度範囲とは異なる第2の前記特定輝度範囲を用いて、前記複数個の第1の画素と前記複数個の第2の画素とを、再度特定することによって、前記第1画像データを生成する、画像処理装置。
The image processing apparatus according to any one of claims 1 to 3,
The first image generator is
Identifying the plurality of first pixels and the plurality of second pixels using the first specific luminance range;
Determining whether the number of the plurality of second pixels specified by using the first specific luminance range is equal to or less than a reference;
The second specific luminance range different from the first specific luminance range when the number of the plurality of second pixels specified using the first specific luminance range is equal to or less than a reference. An image processing apparatus that generates the first image data by re-identifying the plurality of first pixels and the plurality of second pixels by using.
請求項1〜4のいずれかに記載の画像処理装置であって、さらに、
前記特定部は、
前記第1画像データと前記第2画像データを用いて、合成画像を示す合成画像データを生成し、
前記合成画像データを解析することによって、前記合成画像にて、前記原稿の縁を表す直線の候補である複数の候補直線を特定し、
前記複数の候補直線のうちの少なくとも一本の直線を用いて規定される前記原稿領域を特定する、画像処理装置。
The image processing apparatus according to claim 1, further comprising:
The specific part is:
Using the first image data and the second image data to generate composite image data indicating a composite image;
By analyzing the composite image data, in the composite image, a plurality of candidate straight lines that are candidates for straight lines representing edges of the document are specified,
An image processing apparatus that identifies the document area defined using at least one straight line of the plurality of candidate straight lines.
請求項1〜5のいずれかに記載の画像処理装置であって、
前記第1画像生成部は、
前記読取画像データを用いて、前記読取画像を縮小して得られる縮小画像を示す縮小画像データを生成し、
前記縮小画像データを用いて、前記第1画像データを生成する、画像処理装置。
An image processing apparatus according to any one of claims 1 to 5,
The first image generator is
Using the read image data, generate reduced image data indicating a reduced image obtained by reducing the read image,
An image processing apparatus that generates the first image data using the reduced image data.
コンピュータプログラムであって、
原稿を光学的に読み取ることによって生成される読取画像データを取得する画像データ取得機能であって、前記読取画像データは、前記原稿を示す第1の画像と前記原稿以外の領域を示す第2の画像とを含む読取画像を示す、前記画像データ取得機能と、
前記読取画像データを用いて、特定条件を満たす複数個の画素を、前記複数個の第1の画素として特定し、前記特定条件を満たさない複数個の画素を、前記複数個の第2の画素として特定することによって、前記複数個の第1の画素と前記複数個の第2の画素と示す第1画像データを生成する第1画像生成機能であって、前記特定条件は、特定輝度範囲内の輝度を有することを含み、前記特定輝度範囲は、前記第2の画像に対応する画素の輝度を含む範囲である、前記第1画像生成機能と、
前記読取画像データを用いて、前記読取画像内のエッジを示す複数個のエッジ画素を示す第2画像データを生成する第2画像生成機能と、
少なくとも前記第1画像データと前記第2画像データとを用いて、前記読取画像内の前記原稿に対応する原稿領域を特定する特定機能と、
をコンピュータに実現させる、コンピュータプログラム。
A computer program,
An image data acquisition function for acquiring read image data generated by optically reading a document, wherein the read image data includes a first image indicating the document and a second region indicating a region other than the document. The image data acquisition function showing a read image including an image;
Using the read image data, a plurality of pixels that satisfy a specific condition are specified as the plurality of first pixels, and a plurality of pixels that do not satisfy the specific condition are specified as the plurality of second pixels. A first image generation function for generating first image data indicating the plurality of first pixels and the plurality of second pixels, wherein the specific condition is within a specific luminance range. The first image generation function, wherein the specific luminance range is a range including the luminance of a pixel corresponding to the second image;
A second image generation function for generating second image data indicating a plurality of edge pixels indicating edges in the read image using the read image data;
A specifying function for specifying a document area corresponding to the document in the read image using at least the first image data and the second image data;
A computer program that causes a computer to realize
JP2017132294A 2017-07-05 2017-07-05 Image processing equipment and computer programs Active JP6905210B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017132294A JP6905210B2 (en) 2017-07-05 2017-07-05 Image processing equipment and computer programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017132294A JP6905210B2 (en) 2017-07-05 2017-07-05 Image processing equipment and computer programs

Publications (2)

Publication Number Publication Date
JP2019016897A true JP2019016897A (en) 2019-01-31
JP6905210B2 JP6905210B2 (en) 2021-07-21

Family

ID=65356594

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017132294A Active JP6905210B2 (en) 2017-07-05 2017-07-05 Image processing equipment and computer programs

Country Status (1)

Country Link
JP (1) JP6905210B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002016801A (en) * 2000-06-30 2002-01-18 Seiko Epson Corp Method for selecting threshold of binarization of digital image
US20080137157A1 (en) * 2006-12-11 2008-06-12 Canon Kabushiki Kaisha Image processing apparatus and method of controlling same
JP2012209908A (en) * 2011-03-30 2012-10-25 Brother Ind Ltd Reader
JP2013251779A (en) * 2012-06-01 2013-12-12 Canon Inc Image processing apparatus and image processing method
CN104079750A (en) * 2013-03-28 2014-10-01 株式会社Pfu Image processing apparatus and region determining method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002016801A (en) * 2000-06-30 2002-01-18 Seiko Epson Corp Method for selecting threshold of binarization of digital image
US20080137157A1 (en) * 2006-12-11 2008-06-12 Canon Kabushiki Kaisha Image processing apparatus and method of controlling same
JP2008148072A (en) * 2006-12-11 2008-06-26 Canon Inc Image processor and its control method
JP2012209908A (en) * 2011-03-30 2012-10-25 Brother Ind Ltd Reader
JP2013251779A (en) * 2012-06-01 2013-12-12 Canon Inc Image processing apparatus and image processing method
CN104079750A (en) * 2013-03-28 2014-10-01 株式会社Pfu Image processing apparatus and region determining method
JP2014195148A (en) * 2013-03-28 2014-10-09 Pfu Ltd Image processing apparatus, region determination method, and computer program

Also Published As

Publication number Publication date
JP6905210B2 (en) 2021-07-21

Similar Documents

Publication Publication Date Title
US9179035B2 (en) Method of editing static digital combined images comprising images of multiple objects
JP6781406B2 (en) Image processing equipment and computer programs
US10373030B2 (en) Image processing apparatus that executes halftone process on target image data including edge pixel
US8929663B2 (en) Image processing device identifying region in image as one of uniform region and nonuniform region
US8369614B2 (en) Edge control in a digital color image via tone and size dependent dilation of pixels
JP6122988B1 (en) Image processing apparatus, image processing method, and program
KR20180127913A (en) Image processing apparatus, image processing method, and storage medium
US9277074B2 (en) Image processing apparatus, method, and medium determining whether image data of a page to be processed is blank and contains a foreground object and transmitting the foreground object obtained by removing a background object
JP6974791B2 (en) Image processing equipment and computer programs
US8000555B2 (en) Defective image detection method and storage medium storing program
JP6338234B2 (en) Region dividing method, region dividing program and image processing system
US10424051B2 (en) Image analyzing apparatus and non-transitory storage medium storing instructions executable by the image analyzing apparatus
JP6905210B2 (en) Image processing equipment and computer programs
JP6852618B2 (en) Computer programs and image processing equipment
JP2018147199A (en) Image processing device, and computer program
JP7301529B2 (en) Image processing device, image processing method, and program
RU2520407C1 (en) Method and system of text improvement at digital copying of printed documents
JP6897405B2 (en) Image processing equipment and computer programs
JP2018148378A (en) Image processing device and computer program
JP2013065164A (en) Image processing device, image processing method, and image processing program
JP7205689B2 (en) Image processing device and computer program
JP6331772B2 (en) Image processing apparatus and computer program
US10430927B2 (en) Image analyzing apparatus and non-transitory storage medium storing instructions executable by the image analyzing apparatus
JP2023132586A (en) Image processing device, image processing method, and program
JP2021117622A (en) Image processing apparatus and computer 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: 20210225

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210303

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210428

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210608

R150 Certificate of patent or registration of utility model

Ref document number: 6905210

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150