JP7248942B2 - Image processing device and computer program - Google Patents

Image processing device and computer program Download PDF

Info

Publication number
JP7248942B2
JP7248942B2 JP2018183703A JP2018183703A JP7248942B2 JP 7248942 B2 JP7248942 B2 JP 7248942B2 JP 2018183703 A JP2018183703 A JP 2018183703A JP 2018183703 A JP2018183703 A JP 2018183703A JP 7248942 B2 JP7248942 B2 JP 7248942B2
Authority
JP
Japan
Prior art keywords
pixel
color
pixels
character
specific
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2018183703A
Other languages
Japanese (ja)
Other versions
JP2020052892A (en
Inventor
将也 ▲高▼須
竜司 山田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2018183703A priority Critical patent/JP7248942B2/en
Publication of JP2020052892A publication Critical patent/JP2020052892A/en
Application granted granted Critical
Publication of JP7248942B2 publication Critical patent/JP7248942B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

本明細書は、画像データによって示される画像内の文字と背景との境界を鮮明にするための画像処理に関する。 The present specification relates to image processing for sharpening the boundary between characters and background in an image represented by image data.

特許文献1に開示された画像処理装置は、注目画素が黒エッジであるかの検出と、注目画素が白エッジであるかの検出と、を行う。黒エッジは、注目画素が黒画素であり、かつ、周辺画素との境界濃度が白から黒に変化するエッジを意味する。白エッジは、注目画素が白画素であり、かつ、周辺画素との境界濃度が黒から白に変化するエッジを意味する。画像処理装置は、注目画素が黒エッジである場合には、注目画素の多値レベルを、最大値(完全な黒を示すレベル)に変更し、注目画素が白エッジである場合には、注目画素の多値レベルを、最小値(完全な白を示すレベル)に変更する。これにより適正なエッジ強調処理を実行することができる、とされている。 The image processing apparatus disclosed in Patent Document 1 detects whether the pixel of interest is a black edge and detects whether the pixel of interest is a white edge. A black edge means an edge where the target pixel is a black pixel and the boundary density with the surrounding pixels changes from white to black. A white edge means an edge where the pixel of interest is a white pixel and the boundary density with the surrounding pixels changes from black to white. When the target pixel is a black edge, the image processing apparatus changes the multi-level level of the target pixel to the maximum value (the level indicating complete black). Change the multi-value level of the pixel to the minimum value (the level indicating perfect white). It is said that this enables appropriate edge enhancement processing to be executed.

特開平4-281671号公報JP-A-4-281671

しかしながら、上記技術では、エッジを適切に強調できない可能性があった。例えば、対象画像データが、イメージセンサを用いて生成される画像データ(例えば、スキャンデータ)である場合には、エッジにおける画素の値の変化が緩やかであるので、注目画素が、白エッジであるかの検出や、黒エッジであるかの検出が困難である場合がある。このような場合には、エッジを適切に強調できない可能性があった。このような課題は、黒エッジと白エッジとのエッジの強調に限らず、第1色と第2色との境界を鮮明にする際に共通する課題であった。 However, with the above technique, there is a possibility that edges cannot be emphasized appropriately. For example, if the target image data is image data generated using an image sensor (for example, scan data), the target pixel is the white edge because the pixel value changes slowly at the edge. It may be difficult to detect whether it is a black edge or whether it is a black edge. In such cases, there is a possibility that the edge cannot be emphasized properly. Such a problem is not limited to edge enhancement between a black edge and a white edge, but is a common problem when sharpening a boundary between a first color and a second color.

本明細書は、対象画像内の第1色と第2色との境界が適切に鮮明にされた処理済画像を示す処理済画像データ生成する新たな技術を開示する。 This specification discloses a new technique for generating processed image data that represents a processed image in which the boundaries between the first and second colors in the target image are properly sharpened.

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

[適用例1]画像処理装置であって、イメージセンサを用いて生成され、複数個の画素を含む対象画像を示す対象画像データを取得する取得部と、前記対象画像データを用いて、前記対象画像内の特定の文字に対応する第1色と、前記特定の文字の背景に対応する第2色と、を特定する色特定部と、前記対象画像内の複数個の対象画素の中から、前記対象画素の値を用いて、前記第1色を有するべき複数個の第1画素を特定する第1特定部と、前記複数個の第1画素のそれぞれを第1注目画素として、前記第1注目画素の近傍に位置する複数個の第1周辺画素のそれぞれについて、前記第1画素でないことを含む特定条件を満たすか否かを判断する判断部と、前記第1注目画素の前記複数個の第1周辺画素の中から、前記特定条件を満たす画素を、前記第2色を有するべき第2画素として特定する第2特定部と、前記対象画像データに対して、前記第1特定部により特定された前記第1画素の値を前記第1色に対応する値に置換し、前記第2特定部により特定された前記第2画素の値を前記第2色に対応する値に置換する置換処理を含む特定の画像処理を実行して、処理済画像を示す処理済画像データを生成する生成部と、を備える画像処理装置。 [Application Example 1] An image processing apparatus including: a color specifying unit that specifies a first color corresponding to a specific character in an image and a second color corresponding to a background of the specific character; and from among a plurality of target pixels in the target image, a first identifying unit that identifies a plurality of first pixels that should have the first color using the value of the target pixel; a judgment unit for judging whether or not each of a plurality of first peripheral pixels positioned near a pixel of interest satisfies a specific condition including that the pixel is not the first pixel; and the plurality of pixels of the first pixel of interest. a second identifying unit that identifies a pixel that satisfies the specific condition from among the first peripheral pixels of as the second pixel that should have the second color; replacing the value of the identified first pixel with a value corresponding to the first color, and replacing the value of the second pixel identified by the second identifying unit with a value corresponding to the second color; an image processing apparatus comprising: a generation unit that performs specific image processing including processing to generate processed image data representing a processed image.

上記構成によれば、対象画像内において、複数個の第1画素が特定され、第1画素の複数個の第1周辺画素の中から、第1色とは異なる色を有するべき画素であることを示す特定条件を満たす複数個の第2画素が特定される。そして、複数個の第1画素に対応し、第1色を有する複数個の第1対応画素を含み、複数個の第2画素に対応し、第2色を有する複数個の第2対応画素を含む処理済画像が生成される。この結果、対象画像内の第1色と第2色との境界が適切に鮮明にされた処理済画像を示す処理済画像データを生成することができる。
[適用例2]
適用例1に記載の画像処理装置であって、
前記色特定部は、
前記対象画像内の特定領域を複数個のブロックに分割し、
前記複数個のブロックのそれぞれの複数個の画素の値を用いて、前記複数個のブロックに対応する複数個のブロック色であって対応する前記ブロックの色をそれぞれ示す前記複数個のブロック色を決定し、
前記複数個のブロック色のうち、基準以上の個数の前記ブロックに対応する2以上の前記ブロック色に基づいて前記第1色と前記第2色との少なくとも一方を特定する、画像処理装置。
[適用例3]
適用例1または2に記載の画像処理装置であって、
前記色特定部は、
前記対象画像内の特定領域にて、文字を構成する複数個の文字構成画素と、文字を構成しない複数個の非文字画素とを特定し、
前記複数個の文字構成画素の値を用いて、前記第1色を特定する、画像処理装置。
[適用例4]
適用例3に記載の画像処理装置であって、
前記色特定部は、前記複数個の非文字画素の値を用いて、前記第2色を特定する、画像処理装置。
[適用例5]
適用例2に記載の画像処理装置であって、
前記対象画像データを用いて、前記対象画像内に複数個の前記特定領域を特定し、
前記色特定部は、
前記複数個の特定領域のそれぞれについて、前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2であるか否かを判断し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、前記特定領域の前記第1色と前記第2色を特定し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2とは異なる前記特定領域について、前特定領域の前記第1色と前記第2色とを特定せず、
前記生成部は、
前記第1色と前記第2色とが特定された前記特定領域に対して前記置換処理を含む前記特定の画像処理を実行し、前記第1色と前記第2色とが特定されない前記特定領域に対して前記置換処理を含まない画像処理を実行する、画像処理装置。
[適用例6]
適用例5に記載の画像処理装置であって、
前記色特定部は、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、オブジェクトを構成する複数個のオブジェクト画素と、オブジェクトを構成しない複数個の非オブジェクト画素とを特定し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、前記複数個のオブジェクト画素の値を用いて、前記オブジェクトの色が前記2個のブロック色のいずれかに対応するか否かを判断し、
前記オブジェクトの色が前記2個のブロック色のいずれかに対応する場合に、前記第1色と前記第2色とを特定し、
前記オブジェクトの色が前記2個のブロック色のいずれにも対応しない場合に、前記第1色と前記第2色とを特定しない、画像処理装置。
[適用例7]
適用例5または6に記載の画像処理装置であって、さらに、
前記対象画像データを用いて、前記対象画像内のエッジを構成する複数個のエッジ画素を特定するエッジ特定部を備え、
前記生成部は、
前記第1色と前記第2色とが特定された前記特定領域内の前記複数個のエッジ画素の値に対して、前記置換処理と、前記置換処理の後に前記対象画像内のエッジを鮮鋭化する鮮鋭化処理と、を含む前記特定の画像処理を実行し、
前記第1色と前記第2色とが特定されない前記特定領域内の前記複数個のエッジ画素の値に対して、前記置換処理を実行せず、前記鮮鋭化処理を含む画像処理を実行する、画像処理装置。
[適用例8]
適用例1~7のいずれかに記載の画像処理装置であって、
前記判断部は、前記第1注目画素の複数個の第1周辺画素のうちの特定の画素について、前記特定の画素が前記第1画素でなく、かつ、前記特定の画素が前記第1色よりも前記第2色に近い色を有する場合に、前記特定の画素は、前記特定条件を満たすと判断する、画像処理装置。
[適用例9]
適用例8に記載の画像処理装置であって、
前記特定の画素は、前記第1注目画素から特定方向にM個(Mは、2以上の整数)の画素分だけ離れた画素であり、
前記判断部は、前記複数個の第1周辺画素のうち、前記特定方向に沿って前記第1注目画素と前記特定の画素との間に位置する(M-1)個の中間画素について、前記中間画素が、前記第1画素でない場合に、前記中間画素の値に関わらずに、前記中間画素は、前記特定条件を満たすと判断する、画像処理装置。
[適用例10]
適用例1~9のいずれかに記載の画像処理装置であって、
前記処理済画像データを用いて、印刷データを生成する印刷データ生成部を備える、画像処理装置。


According to the above configuration, a plurality of first pixels are specified in the target image, and the pixels that should have a color different from the first color are selected from among the plurality of first surrounding pixels of the first pixels. A plurality of second pixels that satisfy a specific condition indicating and a plurality of first corresponding pixels having a first color corresponding to the plurality of first pixels, and a plurality of second corresponding pixels having a second color corresponding to the plurality of second pixels. A processed image is generated comprising: As a result, it is possible to generate processed image data representing a processed image in which the boundary between the first color and the second color in the target image is appropriately sharpened.
[Application example 2]
The image processing device according to Application Example 1,
The color specifying unit
dividing a specific region in the target image into a plurality of blocks;
a plurality of block colors corresponding to the plurality of blocks, each indicating a color of the corresponding block, using the values of the plurality of pixels in each of the plurality of blocks; decide and
An image processing device that specifies at least one of the first color and the second color based on two or more of the block colors corresponding to a reference number or more of the blocks among the plurality of block colors.
[Application example 3]
The image processing device according to Application Example 1 or 2,
The color specifying unit
identifying a plurality of character-constituting pixels that form a character and a plurality of non-character pixels that do not form a character in a specific region within the target image;
The image processing device, wherein the first color is specified using the values of the plurality of character-constituting pixels.
[Application example 4]
The image processing device according to Application Example 3,
The image processing device, wherein the color specifying unit specifies the second color using the values of the plurality of non-character pixels.
[Application example 5]
The image processing device according to Application Example 2,
using the target image data to identify a plurality of the specific regions in the target image;
The color specifying unit
determining whether the number of the block colors corresponding to the number of the blocks equal to or greater than the reference number is 2 for each of the plurality of specific regions;
specifying the first color and the second color of the specific region for the specific region in which the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is 2;
not specifying the first color and the second color of the previous specified region for the specified region where the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is different from 2;
The generating unit
performing the specific image processing including the replacement processing on the specific region in which the first color and the second color are specified, and the specific region in which the first color and the second color are not specified An image processing device that executes image processing that does not include the replacement processing for the
[Application example 6]
The image processing device according to Application Example 5,
The color specifying unit
specifying a plurality of object pixels that form an object and a plurality of non-object pixels that do not form an object in the specific region in which the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is 2; ,
For the specific region in which the number of the block colors corresponding to the number of the blocks equal to or larger than the reference number is two, the values of the plurality of object pixels are used to determine whether the color of the object is any one of the two block colors. to determine whether or not to respond to
specifying the first color and the second color when the color of the object corresponds to one of the two block colors;
The image processing device that does not specify the first color and the second color when the color of the object does not correspond to any of the two block colors.
[Application example 7]
The image processing device according to Application Example 5 or 6, further comprising:
an edge identification unit that identifies a plurality of edge pixels forming an edge in the target image using the target image data;
The generating unit
replacing the values of the plurality of edge pixels in the specified region in which the first color and the second color are specified; and sharpening the edges in the target image after the replacement. performing the specific image processing including a sharpening process to
performing image processing including the sharpening process without performing the replacing process on the values of the plurality of edge pixels in the specified area where the first color and the second color are not specified; Image processing device.
[Application example 8]
The image processing device according to any one of Application Examples 1 to 7,
The determination unit determines that, for a specific pixel among a plurality of first surrounding pixels of the first pixel of interest, the specific pixel is not the first pixel, and the specific pixel is more than the first color. image processing device, determining that the specific pixel satisfies the specific condition if the pixel also has a color close to the second color.
[Application example 9]
The image processing device according to Application Example 8,
The specific pixel is a pixel separated by M pixels (M is an integer equal to or greater than 2) in a specific direction from the first pixel of interest,
The determination unit determines, of the plurality of first peripheral pixels, about (M−1) intermediate pixels positioned between the first pixel of interest and the specific pixel along the specific direction. The image processing apparatus, wherein when the intermediate pixel is not the first pixel, the intermediate pixel is determined to satisfy the specific condition regardless of the value of the intermediate pixel.
[Application example 10]
The image processing device according to any one of Application Examples 1 to 9,
An image processing apparatus comprising a print data generation unit that generates print data using the processed image data.


なお、本明細書に開示される技術は、種々の形態で実現することが可能であり、例えば、複合機、スキャナ、プリンタ、画像処理方法、これら装置の機能または上記方法を実現するためのコンピュータプログラム、そのコンピュータプログラムを記録した記録媒体、等の形態で実現することができる。 It should be noted that the technology disclosed in this specification can be implemented in various forms. It can be implemented in the form of a program, a recording medium recording the computer program, or the like.

画像処理装置の一例である複合機200の構成を示すブロック図である。1 is a block diagram showing the configuration of a multi-function peripheral 200, which is an example of an image processing apparatus; FIG. 画像処理のフローチャートである。4 is a flowchart of image processing; 画像処理で用いられる画像の一例を示す第1の図である。FIG. 4 is a first diagram showing an example of an image used in image processing; 膨張処理と収縮処理とを説明する図である。It is a figure explaining expansion processing and contraction processing. 文字・背景色特定処理のフローチャートである。8 is a flowchart of character/background color identification processing; 代表色特定処理のフローチャートである。4 is a flowchart of representative color identification processing; 代表色特定処理の説明図である。FIG. 10 is an explanatory diagram of representative color specifying processing; 文字画素特定処理のフローチャートである。4 is a flowchart of character pixel identification processing; 文字画素特定処理の第1の説明図である。FIG. 11 is a first explanatory diagram of character pixel identification processing; 文字画素特定処理の第2の説明図である。FIG. 11 is a second explanatory diagram of character pixel identification processing; 文字画素特定処理の第3の説明図である。FIG. 11 is a third explanatory diagram of character pixel identification processing; 文字画素特定処理の第4の説明図である。FIG. 14 is a fourth explanatory diagram of character pixel identification processing; 背景画素特定処理のフローチャートである。4 is a flowchart of background pixel identification processing; 背景画素特定処理の第1の説明図である。FIG. 10 is a first explanatory diagram of background pixel identification processing; 背景画素特定処理の第2の説明図である。FIG. 11 is a second explanatory diagram of the background pixel specifying process; 処理済画像の説明図である。FIG. 4 is an explanatory diagram of a processed image;

A.実施例:
A-1:複合機200の構成
次に、実施の形態を実施例に基づき説明する。図1は、画像処理装置の一例である複合機200の構成を示すブロック図である。複合機200は、画像処理装置を制御するプロセッサであるCPU210と、DRAMなどの揮発性記憶装置220と、フラッシュメモリやハードディスクドライブなどの不揮発性記憶装置230と、液晶ディスプレイなどの表示部240と、液晶ディスプレイと重畳されたタッチパネルやボタンを含む操作部250と、ユーザの端末装置100などの外部装置と通信を行うためのインタフェース(通信IF)270と、印刷実行部280と、一次元イメージセンサを備える読取実行部290と、を備えている。
A. Example:
A-1: Configuration of MFP 200 Next, embodiments will be described based on examples. FIG. 1 is a block diagram showing the configuration of a multifunction machine 200, which is an example of an image processing apparatus. The MFP 200 includes a CPU 210 that is a processor that controls an image processing device, a volatile storage device 220 such as a DRAM, a nonvolatile storage device 230 such as a flash memory or a hard disk drive, a display unit 240 such as a liquid crystal display, An operation unit 250 including a touch panel and buttons superimposed on a liquid crystal display, an interface (communication IF) 270 for communicating with an external device such as the user's terminal device 100, a print execution unit 280, and a one-dimensional image sensor. and a read execution unit 290 provided.

読取実行部290は、CPU210の制御に従って、一次元イメージセンサを用いて原稿を光学的に読み取ることによって対象画像データとしてのスキャンデータを生成する。印刷実行部280は、CPU210の制御に従って、複数種類のトナー、具体的には、シアン(C)、マゼンタ(M)、イエロ(Y)、黒(K)のトナーを、色材として用いて、レーザ方式で用紙などの印刷媒体に画像を印刷する。具体的には、印刷実行部280は、感光ドラムを露光して静電潜像を形成し、該静電潜像にトナーを付着させてトナー像を形成する。印刷実行部280は、感光ドラム上に形成されたトナー像を用紙に転写する。なお、変形例では、印刷実行部280は、色材としてのインクを吐出して、用紙上に画像を形成するインクジェット方式の印刷実行部であっても良い。 Under the control of CPU 210 , reading execution unit 290 optically reads a document using a one-dimensional image sensor to generate scan data as target image data. Under the control of the CPU 210, the print execution unit 280 uses a plurality of types of toners, specifically, cyan (C), magenta (M), yellow (Y), and black (K) toners as color materials. An image is printed on a print medium such as paper using a laser method. Specifically, the print execution unit 280 exposes the photosensitive drum to form an electrostatic latent image, and adheres toner to the electrostatic latent image to form a toner image. The print execution unit 280 transfers the toner image formed on the photosensitive drum onto the paper. In a modified example, the print execution unit 280 may be an inkjet print execution unit that forms an image on paper by ejecting ink as a coloring material.

揮発性記憶装置220は、CPU210が処理を行う際に生成される種々の中間データを一時的に格納するバッファ領域を提供する。不揮発性記憶装置230には、コンピュータプログラムPGが格納されている。コンピュータプログラムPGは、CPU210に複合機200の制御を実現させる制御プログラムである。本実施例では、コンピュータプログラムPGは、複合機200の製造時に、不揮発性記憶装置230に予め格納される形態で提供される。これに代えて、コンピュータプログラムPGは、サーバからダウンロードされる形態で提供されても良く、DVD-ROMなどに格納される形態で提供されてもよい。CPU210は、コンピュータプログラムPGを実行することにより、後述する画像処理を実行することができる。 Volatile storage device 220 provides a buffer area for temporarily storing various intermediate data generated when CPU 210 performs processing. A computer program PG is stored in the nonvolatile storage device 230 . The computer program PG is a control program that causes the CPU 210 to control the MFP 200 . In this embodiment, the computer program PG is provided in a form pre-stored in the non-volatile storage device 230 when the MFP 200 is manufactured. Alternatively, the computer program PG may be provided in the form of being downloaded from a server, or may be provided in the form of being stored on a DVD-ROM or the like. The CPU 210 can execute image processing, which will be described later, by executing the computer program PG.

A-2:画像処理
図2は、画像処理のフローチャートである。この画像処理は、例えば、ユーザが、読取実行部290の原稿台に、原稿を載置して、コピーの実行指示を入力した場合に実行される。この画像処理は、原稿を、読取実行部290を用いて読み取ることによって生成されるスキャンデータを取得し、該スキャンデータを用いて、原稿を示す印刷データを生成することで、いわゆる原稿のコピーを実現する処理である。
A-2: Image Processing FIG. 2 is a flowchart of image processing. This image processing is executed, for example, when the user places a document on the document platen of the reading execution unit 290 and inputs a copy execution instruction. This image processing acquires scan data generated by reading a document using the reading execution unit 290, and uses the scan data to generate print data representing the document, thereby making a so-called copy of the document. This is the process to be implemented.

S10では、CPU210は、ユーザが原稿台に設置した原稿を、読取実行部290を用いて読み取ることによって、対象画像データとしてのスキャンデータを生成する。これによって、CPU210は、取得部として、対象画像データを取得する。原稿は、例えば、複合機200、あるいは、図示しないプリンタによって画像が印刷された印刷物である。生成されたスキャンデータは、揮発性記憶装置220(図1)のバッファ領域に格納される。スキャンデータは、複数個の画素の値を含み、複数個の画素の値のそれぞれは、画素の色をRGB表色系の色値(RGB値とも呼ぶ)で表す。すなわち、スキャンデータは、RGB画像データである。1個の画素のRGB値は、例えば、赤(R)と緑(G)と青(B)との3個の色成分の値(以下、R値、G値、B値とも呼ぶ)を含んでいる。本実施例では、各成分値の階調数は、256階調である。なお、各成分値の階調数は、256階調に限らず、3以上の階調数、例えば、64階調、128階調であっても良い。 In S<b>10 , the CPU 210 reads the document placed on the platen by the user using the reading execution unit 290 to generate scan data as target image data. Thereby, the CPU 210 acquires the target image data as an acquisition unit. The document is, for example, a printed matter in which an image is printed by the MFP 200 or a printer (not shown). The generated scan data is stored in a buffer area of volatile storage device 220 (FIG. 1). The scan data includes a plurality of pixel values, and each of the plurality of pixel values represents the color of the pixel with a color value (also called an RGB value) in the RGB color system. That is, the scan data is RGB image data. The RGB value of one pixel includes, for example, three color component values of red (R), green (G), and blue (B) (hereinafter also referred to as R value, G value, and B value). I'm in. In this embodiment, the number of gradations of each component value is 256 gradations. Note that the number of gradations of each component value is not limited to 256 gradations, and may be 3 or more gradations, such as 64 gradations or 128 gradations.

図3は、画像処理で用いられる画像の一例を示す第1の図である。図3(A)には、スキャンデータによって示されるスキャン画像SIの一例が示されている。スキャン画像SIは、複数個の画素を含む。該複数個の画素は、第1方向D1と、第1方向D1と直交する第2方向D2と、に沿って、マトリクス状に配置されている。 FIG. 3 is a first diagram showing an example of an image used in image processing. FIG. 3A shows an example of a scanned image SI represented by scan data. Scan image SI includes a plurality of pixels. The plurality of pixels are arranged in a matrix along a first direction D1 and a second direction D2 orthogonal to the first direction D1.

図3(A)のスキャン画像SIは、原稿の用紙の地色を示す白色の背景Bg1と、3個の文字とは異なるオブジェクトOb1~Ob3と、4個の文字Ob4~Ob7と、2個の文字Ob4、Ob5の背景Bg2と、を含んでいる。文字とは異なるオブジェクトは、例えば、写真や描画である。文字Ob5、Ob6は、黒色の文字である。文字Ob4、Ob7は、黒色とは異なる色、例えば、青色や赤色の文字である。背景Bg2は、白色とは異なる色を有する均一な画像である。 The scanned image SI of FIG. 3A includes a white background Bg1 indicating the background color of the paper of the original, three objects Ob1 to Ob3 different from characters, four characters Ob4 to Ob7, and two characters Ob4 to Ob7. and a background Bg2 of characters Ob4 and Ob5. Objects other than text are, for example, photographs and drawings. Characters Ob5 and Ob6 are black characters. The characters Ob4 and Ob7 are characters in a color different from black, such as blue or red. Background Bg2 is a uniform image having a color different from white.

S15では、CPU210は、スキャンデータに対して、エッジ画素特定処理を実行する。エッジ画素特定処理は、スキャン画像SI内の複数個の画素の中から、スキャン画像SI内のエッジを構成する複数個のエッジ画素を特定する処理である。エッジ画素特定処理によって、例えば、エッジを構成するエッジ画素の値が「1」とされ、エッジを構成しない非エッジ画素の値が「0」とされた二値画像データが生成される。 In S15, the CPU 210 executes edge pixel specifying processing on the scan data. Edge pixel identification processing is processing for identifying a plurality of edge pixels forming an edge in the scan image SI from among the plurality of pixels in the scan image SI. By the edge pixel specifying process, for example, binary image data is generated in which the value of edge pixels that form an edge is set to "1" and the value of non-edge pixels that do not form an edge is set to "0".

具体的には、CPU210は、スキャンデータを用いて、スキャン画像SI内の複数個の画素の輝度を示す輝度画像データを生成する。輝度Yは、各画素のRGB値(R、G、B)を用いて、例えば、Y=0.299×R+0.587×G+0.114×Bの式によって算出される。CPU210は、輝度画像データの各画素の値に、いわゆるソーベルフィルタ(Sobel filter)を適用して、エッジ強度Seを算出する。CPU210は、これらのエッジ強度Seを複数個の画素の値とするエッジ抽出データを生成する。 Specifically, CPU 210 uses the scan data to generate luminance image data indicating the luminance of a plurality of pixels in scan image SI. The luminance Y is calculated using the RGB values (R, G, B) of each pixel by, for example, Y=0.299×R+0.587×G+0.114×B. The CPU 210 applies a so-called Sobel filter to the value of each pixel of the luminance image data to calculate the edge strength Se. The CPU 210 generates edge extraction data in which these edge intensities Se are values of a plurality of pixels.

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

Figure 0007248942000001

…(1)
Figure 0007248942000001

…(1)

CPU210は、エッジ抽出データに対して、二値化処理を実行して、二値画像データを生成する。例えば、CPU210は、エッジ画像データにおいて、画素の値(すなわち、エッジ強度)が閾値(例えば、128)以上である画素を、エッジ画素に分類し、画素の値が閾値未満である画素を、非エッジ画素に分類する。これによって、スキャン画像SI内の複数個のエッジ画素が特定される。 The CPU 210 executes binarization processing on the edge extraction data to generate binary image data. For example, in the edge image data, the CPU 210 classifies pixels whose pixel values (that is, edge strength) are equal to or greater than a threshold (for example, 128) as edge pixels, and classifies pixels whose pixel values are less than the threshold as non-edge pixels. Classify as an edge pixel. This identifies a plurality of edge pixels in the scanned image SI.

図3(B)には、二値画像データによって示される二値画像BIの一例が示されている。この二値画像BIには、スキャン画像SI内のオブジェクトOb1~Ob7のエッジEg1~Eg7を構成する複数個のエッジ画素と、背景Bg1と背景Bg2との間のエッジEg8を構成する複数個のエッジ画素と、が特定されている。このように、エッジは、例えば、主として文字のエッジを含む。また、エッジは、文字とは異なるオブジェクト(例えば、描画や写真)に含まれる細線などのエッジを含む。 FIG. 3B shows an example of a binary image BI represented by binary image data. This binary image BI contains a plurality of edge pixels forming edges Eg1 to Eg7 of objects Ob1 to Ob7 in the scanned image SI, and a plurality of edges forming an edge Eg8 between the background Bg1 and the background Bg2. pixels are specified. Thus, edges include, for example, primarily character edges. Edges include edges such as thin lines included in objects other than characters (for example, drawings and photographs).

S20では、CPU210は、生成された二値画像データに対して、膨張・収縮処理を実行して、膨張・収縮処理済みの二値画像データを生成する。膨張・収縮処理は、二値画像BI内において、特定済みの複数個のエッジ画素によって構成されるエッジを膨張させる膨張処理と、膨張処理済みの該エッジを収縮させる収縮処理と、を含む。なお、膨張処理と収縮処理は、所定回数ずつ(例えば、2回ずつ)実行される。 In S20, the CPU 210 executes expansion/contraction processing on the generated binary image data to generate expansion/contraction-processed binary image data. The dilation/erosion processing includes dilation processing for dilating edges formed by a plurality of specified edge pixels in the binary image BI, and contraction processing for contracting the dilated edges. Note that the expansion process and the contraction process are performed a predetermined number of times (for example, twice each).

図4は、膨張処理と収縮処理とを説明する図である。図4(A)には、二値画像BI(図3(B))の部分画像PI1が示されている。部分画像PI1は、膨張処理前のエッジEgA、EgBを含んでいる。2個のエッジEgA、EgBは、隙間NTによって分離されている。また、エッジEgAには、欠けCRが生じており、エッジEgBには、孤立した非エッジ画素IPが含まれている。また、ある程度太い文字の場合には、文字の内部に非エッジ画素の領域ができる(図3(B))。本来、1個の連続した線や文字に対応するエッジが、このような隙間NT、欠けCR、非エッジ画素IPを含んでいる場合には、詳細は後述するが、S25の文字画素特定処理のために、これらを除去することが好ましい。膨張処理と収縮処理は、これらの隙間NT、欠けCR、非エッジ画素を除去するために、実行される。 FIG. 4 is a diagram for explaining expansion processing and contraction processing. FIG. 4A shows a partial image PI1 of the binary image BI (FIG. 3B). Partial image PI1 includes edges EgA and EgB before dilation processing. Two edges EgA and EgB are separated by a gap NT. Also, the edge EgA has a missing CR, and the edge EgB contains an isolated non-edge pixel IP. In addition, in the case of characters that are thick to some extent, a region of non-edge pixels is formed inside the characters (FIG. 3B). Originally, when an edge corresponding to one continuous line or character includes such a gap NT, a missing CR, and a non-edge pixel IP, the character pixel specifying process of S25 will be described in detail later. Therefore, it is preferable to remove them. Expansion processing and contraction processing are performed to remove these gaps NT, missing CR, and non-edge pixels.

膨張処理は、例えば、所定サイズのフィルタ、図4(A)の例では、縦3画素×横3画素のサイズのフィルタFI1を用いて、二値画像BIを示す二値画像データに対して実行される。具体的には、CPU210は、フィルタFI1を、二値画像データに対して適用して、膨張処理済みの二値画像データを生成する。すなわち、CPU210は、注目画素に、フィルタFI1の中心位置CC1(図4(A)参照)が重なるように、フィルタFI1を、部分画像PI1を含む二値画像BI上に配置する。CPU210は、フィルタFI1の範囲内に、エッジ画素が1個でも存在する場合には、注目画素に対応する膨張処理済みの二値画像(図示省略)内の画素をエッジ画素に設定する。CPU210は、フィルタFI1の範囲内に、エッジ画素が1つもない場合、すなわち、フィルタFI1の範囲内の9個の画素が、非エッジ画素である場合には、注目画素に対応する膨張処理済みの二値画像内の画素を非エッジ画素に設定する。CPU210は、二値画像BIの全ての画素を注目画素として、膨張処理済みの二値画像内の対応する画素を、エッジ画素および非エッジ画素のいずれかに設定することによって、膨張処理済みの二値画像を表す膨張処理済みの二値画像データを生成する。 The dilation process is performed on the binary image data representing the binary image BI using, for example, a filter of a predetermined size, in the example of FIG. be done. Specifically, the CPU 210 applies the filter FI1 to the binary image data to generate dilation-processed binary image data. That is, CPU 210 arranges filter FI1 on binary image BI including partial image PI1 so that the center position CC1 (see FIG. 4A) of filter FI1 overlaps the pixel of interest. If even one edge pixel exists within the range of the filter FI1, the CPU 210 sets the pixel in the dilated binary image (not shown) corresponding to the pixel of interest as the edge pixel. If there is no edge pixel within the range of the filter FI1, i.e., if the nine pixels within the range of the filter FI1 are non-edge pixels, the CPU 210 performs dilation processing corresponding to the pixel of interest. Set the pixels in the binary image to be non-edge pixels. The CPU 210 sets all pixels of the binary image BI as pixels of interest, and sets the corresponding pixels in the binary image BI to be either edge pixels or non-edge pixels, thereby dilating the dilated binary image BI. Generate dilated binary image data representing the value image.

図4(B)には、膨張処理済みの二値画像のうちの、図4(A)の部分画像PI1に対応する膨張処理済みの部分画像PI2が示されている。膨張処理済みの部分画像PI2では、上述の隙間NT、欠けCR、孤立した非エッジ画素IPが除去されていることが解る。また、膨張処理済みの部分画像PI2では、図4(A)の部分画像PI1のエッジEgA、EgBに対応する1個のエッジEgCは、エッジEgA、EgBと比較して、太くなっている(膨張している)。 FIG. 4B shows a dilated partial image PI2 corresponding to the partial image PI1 in FIG. 4A out of the dilated binary image. It can be seen that the above-described gap NT, missing CR, and isolated non-edge pixel IP have been removed from the dilated partial image PI2. In addition, in the partial image PI2 that has been expanded, one edge EgC corresponding to the edges EgA and EgB of the partial image PI1 in FIG. are doing).

収縮処理は、例えば、所定サイズのフィルタ、図4(B)の例では、縦3画素×横3画素のサイズのフィルタFI2を用いて、膨張処理済みの二値画像データに対して実行される。具体的には、CPU210は、フィルタFI2を、膨張処理済みの二値画像を表す二値画像データに対して適用して、収縮処理済みの二値画像データを生成する。すなわち、CPU210は、注目画素に、フィルタFI2の中心位置CC2(図4(B)参照)が重なるように、フィルタFI2を膨張処理済みの二値画像BI上に配置する。CPU210は、フィルタFI2の範囲内に、非エッジ画素が1個でも存在する場合には、注目画素に対応する収縮処理済みの二値画像内の画素を非エッジ画素に設定する。そして、CPU210は、フィルタFI2の範囲内に、非エッジ画素が1つもない場合、すなわち、フィルタFI2の範囲内の9個の画素が、全てエッジ画素である場合には、注目画素に対応する収縮済みの二値画像内の画素をエッジ画素に設定する。CPU210は、膨張処理済みの二値画像の全ての画素を注目画素として、収縮処理済みの二値画像内の対応する画素を、非エッジ画素およびエッジ画素のいずれかに設定することによって、収縮処理済みの二値画像を示す収縮処理済みの二値画像データを生成する。 The erosion process is performed on the dilated binary image data using, for example, a filter of a predetermined size, in the example of FIG. . Specifically, the CPU 210 applies the filter FI2 to the binary image data representing the dilation-processed binary image to generate the contraction-processed binary image data. That is, the CPU 210 arranges the filter FI2 on the dilated binary image BI so that the center position CC2 (see FIG. 4B) of the filter FI2 overlaps the pixel of interest. If even one non-edge pixel exists within the range of the filter FI2, the CPU 210 sets the pixel in the erosion-processed binary image corresponding to the pixel of interest as the non-edge pixel. Then, if there is not a single non-edge pixel within the range of the filter FI2, that is, if all of the nine pixels within the range of the filter FI2 are edge pixels, the CPU 210 performs contraction corresponding to the pixel of interest. Set the pixels in the binary image as edge pixels. The CPU 210 sets all pixels of the dilated binary image as pixels of interest, and sets the corresponding pixels in the eroded binary image to either non-edge pixels or edge pixels, thereby performing the erosion process. Generate eroded binary image data representing the finished binary image.

図4(C)には、収縮済みの二値画像のうちの、図4(A)の部分画像PI1に対応する収縮処理済みの部分画像PI3が示されている。収縮処理済みの部分画像PI3には、上述の隙間NT、欠けCR、孤立した非エッジ画素IPは、現れていない。そして、図4(A)の部分画像PI1のエッジEgA、EgBに対応する1個のエッジEgDは、エッジEgA、EgBと同じ程度の太さまで、収縮している。このような膨張処理と収縮処理が複数回繰り返されると、比較的小さな文字、例えば、12ポイント以下の文字を構成する画素は、概ね全てエッジ画素として特定される。例えば、図3(B)の二値画像BIでは、スキャン画像SI内の文字Ob4~Ob7の内部はエッジ画素として特定されていないが、膨張・縮小処理後には、これらの文字の全体がエッジ画素として特定されるものとする。 FIG. 4(C) shows a shrunk partial image PI3 corresponding to the partial image PI1 of FIG. 4(A) out of the shrunk binary image. The above-described gap NT, missing CR, and isolated non-edge pixel IP do not appear in the contraction-processed partial image PI3. One edge EgD corresponding to the edges EgA and EgB of the partial image PI1 in FIG. 4A is shrunk to the same thickness as the edges EgA and EgB. When such expansion processing and contraction processing are repeated a plurality of times, almost all pixels constituting relatively small characters, such as characters of 12 points or less, are identified as edge pixels. For example, in the binary image BI of FIG. 3B, the insides of the characters Ob4 to Ob7 in the scanned image SI are not specified as edge pixels, but after the dilation/reduction process, these characters as a whole are edge pixels. shall be identified as

なお、上述したフィルタFI1、FI2のサイズ、すなわち、膨張処理による膨張の程度、および、収縮処理による収縮の程度は、一例である。例えば、フィルタFI1、FI2は、例えば、縦5画素×横5画素のフィルタであっても良いし、縦7画素×横7画素のフィルタであっても良い。なお、最終的に生成される膨張・収縮処理済みの二値画像データは、文字などのエッジにおけるぼけた部分を構成する複数個の画素が、漏れなく、エッジ画素として特定されるように、膨張・収縮処理前の二値画像データエッジよりも、エッジが膨張された状態であることが好ましい。 Note that the sizes of the filters FI1 and FI2 described above, that is, the degree of dilation by dilation processing and the degree of contraction by contraction processing are examples. For example, the filters FI1 and FI2 may be filters of vertical 5 pixels×horizontal 5 pixels, or may be filters of vertical 7 pixels×horizontal 7 pixels. Note that the finally generated binary image data that has been subjected to dilation/reduction processing is dilated so that a plurality of pixels that form a blurred portion of an edge of a character or the like can be specified as edge pixels without omission. - It is preferable that the edges are in a dilated state rather than the binary image data edges before the dilation processing.

以上の膨張・収縮処理済みの二値画像データを、以下では、単に、二値画像データと呼び、膨張・収縮処理済みの二値画像データにおいて特定されているエッジ画素を、単に、エッジ画素と呼ぶ。 The binary image data that has undergone the dilation/contraction process is hereinafter simply referred to as binary image data, and the edge pixels specified in the binary image data that has undergone the dilation/contraction process are simply referred to as edge pixels. call.

図2のS25では、CPU210は、二値画像データに対して、二値画像BI内のエッジ領域を特定する領域特定処理を実行する。具体的には、二値画像データに対してラベリング処理が実行される。例えば、CPU210は、連続する一つながりの複数個のエッジ画素を含む画素群に、1個の識別子を割り当て、互いに離れた複数個のエッジ画素をそれぞれ含む複数個の画素群に、互いに異なる識別子を割り当てる。1個の識別子が割り当てられた画素群は、1個のエッジ領域として特定される。図3(B)の例では、二値画像BIにおいて、図3(A)のスキャン画像SI内の7個のオブジェクトOb1~Ob7と、二値画像BI内の8個の符号Eg1~Eg8に対応する8個のエッジ領域が特定される。例えば、文字は、1文字ずつ離れているので、文字ごとに異なるエッジ領域が特定される。 In S25 of FIG. 2, the CPU 210 executes area identification processing for identifying edge areas in the binary image BI on the binary image data. Specifically, labeling processing is performed on the binary image data. For example, the CPU 210 assigns one identifier to a group of pixels including a plurality of continuous edge pixels, and assigns different identifiers to a plurality of pixel groups each including a plurality of edge pixels separated from each other. assign. A group of pixels assigned one identifier is identified as one edge region. In the example of FIG. 3B, the binary image BI corresponds to seven objects Ob1 to Ob7 in the scanned image SI in FIG. 3A and eight codes Eg1 to Eg8 in the binary image BI. Eight edge regions are identified. For example, characters are one character apart, so different edge regions are identified for each character.

S30では、CPU210は、S25にて特定された複数個のエッジ領域から、1個のエッジ領域を注目領域として選択する。 In S30, the CPU 210 selects one edge area from the plurality of edge areas specified in S25 as a target area.

S35では、CPU210は、注目領域に対して、文字・背景色特定処理を実行する。文字・背景色特定処理は、注目領域が文字に対応する場合に、当該文字の色(以下、文字色とも呼ぶ)と、当該文字の背景の色(以下、背景色とも呼ぶ)と、を特定する処理である。注目領域が文字に対応しない場合、例えば、注目領域が描画や写真に対応する場合には、文字色と背景色とは特定されない。文字・背景色特定処理の詳細は、後述する。なお、文字・背景色特定処理は、色特定部により実行される処理の一例である。 In S35, the CPU 210 executes character/background color identification processing on the attention area. Character/background color identification processing identifies the color of the character (hereinafter also referred to as the character color) and the color of the background of the character (hereinafter also referred to as the background color) when the region of interest corresponds to the character. It is a process to When the attention area does not correspond to characters, for example, when the attention area corresponds to a drawing or a photograph, the character color and the background color are not specified. The details of the character/background color specifying process will be described later. Note that the character/background color specifying process is an example of the process executed by the color specifying unit.

S40では、CPU210は、注目領域について、文字色と背景色とを特定できたか否かを判断する。文字色と背景色が特定できた場合には(S40:YES)、CPU210は、文字を鮮明にするためのS45~S55の処理を実行する。文字色と背景色が特定できない場合には(S40:NO)、CPU210は、S45~S55の処理をスキップする。 In S40, the CPU 210 determines whether or not the character color and background color have been specified for the attention area. If the character color and the background color can be specified (S40: YES), the CPU 210 executes the processing of S45 to S55 to make the characters clear. If the character color and background color cannot be specified (S40: NO), the CPU 210 skips the processes of S45 to S55.

S45では、CPU210は、文字画素特定処理を実行する。文字画素特定処理は、注目領域に対応するスキャン画像SI内の複数個の画素から、後述する文字・背景画素置換処理(S55)にて、文字色に置換されるべき文字画素を特定する処理である。文字画素特定処理の詳細は、後述する。 In S45, the CPU 210 executes character pixel identification processing. The character pixel specifying process is a process of specifying character pixels to be replaced with a character color in a character/background pixel replacement process (S55), which will be described later, from a plurality of pixels in the scanned image SI corresponding to the target area. be. Details of the character pixel specifying process will be described later.

S50では、CPU210は、背景画素特定処理を実行する。背景画素特定処理は、注目領域に対応するスキャン画像SI内の複数個の画素から、後述する文字・背景画素置換処理(S55)にて、背景色に置換されるべき背景画素を特定する処理である。例えば、文字画素の周囲のぼけた色を有する画素が背景画素として特定される。背景画素特定処理の詳細は、後述する。なお、背景画素特定処理は、第2特定部により実行される処理の一例である。 In S50, the CPU 210 executes background pixel identification processing. The background pixel specifying process is a process of specifying the background pixels to be replaced with the background color in the character/background pixel replacement process (S55), which will be described later, from a plurality of pixels in the scanned image SI corresponding to the target area. be. For example, pixels having a blurred color around character pixels are identified as background pixels. Details of the background pixel specifying process will be described later. Note that the background pixel specifying process is an example of the process executed by the second specifying unit.

S55では、CPU210は、スキャンデータに対して文字・背景画素置換処理を実行する。具体的には、CPU210は、スキャンデータにおいて、スキャン画像SI内の複数個の画素のうち、S45にて特定済みの文字画素の値を、S35にて特定済みの文字色を示す値に置換し、S50にて特定済みの背景画素の値を、S35にて特定済みの背景色を示す値に置換する。なお、文字・背景画素置換処理は、置換処理の一例である。 In S55, the CPU 210 executes character/background pixel replacement processing on the scan data. Specifically, in the scan data, the CPU 210 replaces the value of the character pixel identified in S45 among the plurality of pixels in the scanned image SI with the value indicating the character color identified in S35. , the value of the background pixel specified in S50 is replaced with a value indicating the background color specified in S35. Note that the character/background pixel replacement process is an example of the replacement process.

S60では、CPU210は、全てのエッジ領域を注目領域として処理したか否かを判断する。未処理のエッジ領域がある場合には(S60:NO)、CPU210は、S30に処理を戻す。全てのエッジ領域が処理された場合には(S60:YES)、CPU210は、S65に処理を進める。 In S60, the CPU 210 determines whether or not all edge regions have been processed as regions of interest. If there is an unprocessed edge area (S60: NO), the CPU 210 returns the process to S30. If all edge regions have been processed (S60: YES), the CPU 210 advances the process to S65.

S65では、CPU210は、文字・背景画素置換処理後のスキャンデータに対して、網点平滑化処理を実行して、平滑化画像を示す平滑化画像データを生成する。具体的には、CPU210は、スキャンデータに含まれる複数個の非エッジ画素の値のそれぞれに対して、ガウスフィルタなどの平滑化フィルタを用いた平滑化処理を実行して、平滑化処理済みの複数個の非エッジ画素の値を算出する。平滑化処理の対象となる非エッジ画素は、S15のエッジ画素特定処理によって生成された二値画像データを参照して特定される。CPU210は、スキャンデータに含まれる複数個のエッジ画素の値と、平滑化処理済みの複数個の非エッジ画素の値と、を含む平滑化画像データを生成する。 In S65, the CPU 210 executes halftone dot smoothing processing on the scan data after the character/background pixel replacement processing to generate smoothed image data representing a smoothed image. Specifically, CPU 210 executes smoothing processing using a smoothing filter such as a Gaussian filter on each of the values of a plurality of non-edge pixels included in the scan data, and performs smoothing processing on each of the values. Calculate the values of a plurality of non-edge pixels. Non-edge pixels to be smoothed are specified by referring to the binary image data generated by the edge pixel specifying process of S15. The CPU 210 generates smoothed image data including the values of a plurality of edge pixels included in the scan data and the values of a plurality of smoothed non-edge pixels.

図3(C)には、平滑化画像データによって示される平滑化画像GIが示されている。平滑化画像GIは、白色の背景Bg1gと、スキャン画像SI内のオブジェクトOb1~Ob7、背景Bg2が平滑化されたオブジェクトOb1g~Ob7g、背景Bg2gを含んでいる。これらのオブジェクトOb1g~Ob7g、背景Bg2gのエッジ以外の部分(非エッジ部分とも呼ぶ)は、スキャン画像SI内のオブジェクトOb1~Ob7、背景Bg2と比較して、平滑化されている。 FIG. 3C shows the smoothed image GI represented by the smoothed image data. The smoothed image GI includes a white background Bg1g, objects Ob1 to Ob7 in the scanned image SI, objects Ob1g to Ob7g obtained by smoothing the background Bg2, and a background Bg2g. Portions other than edges (also called non-edge portions) of these objects Ob1g to Ob7g and background Bg2g are smoothed compared to objects Ob1 to Ob7 and background Bg2 in scan image SI.

S70では、CPU210は、平滑化画像データに対して、エッジ鮮鋭化処理を実行して、処理済画像データを生成する。具体的には、CPU210は、平滑化画像データに含まれる複数個のエッジ画素の値のそれぞれに対して、アンシャープマスク処理や、鮮鋭化フィルタを適用する処理などの鮮鋭化処理を実行して、鮮鋭化処理済みの複数個のエッジ画素の値を算出する。鮮鋭化処理の対象となるエッジ画素は、S15のエッジ画素特定処理によって生成された二値画像データを参照して特定される。CPU210は、平滑化画像データに含まれる複数個の非エッジ画素の値(平滑化処理済みの複数個の非エッジ画素の値)と、鮮鋭化処理済みの複数個のエッジ画素の値と、を含む処理済画像データを生成する。 In S70, the CPU 210 executes edge sharpening processing on the smoothed image data to generate processed image data. Specifically, CPU 210 executes sharpening processing such as unsharp mask processing and processing applying a sharpening filter to each of the values of a plurality of edge pixels included in the smoothed image data. , the values of a plurality of sharpened edge pixels are calculated. The edge pixels to be sharpened are specified by referring to the binary image data generated by the edge pixel specifying process of S15. The CPU 210 converts the values of a plurality of non-edge pixels included in the smoothed image data (the values of a plurality of smoothed non-edge pixels) and the values of a plurality of sharpened edge pixels. Generate processed image data containing:

図3(D)には、処理済画像データによって示される処理済画像FIが示されている。処理済画像FIは、白色の背景Bg1fと、スキャン画像SI内のオブジェクトOb1~Ob7、背景Bg2に対応するオブジェクトOb1f~Ob7f、背景Bg2fを含んでいる。これらのオブジェクトOb1f~Ob7f、背景Bg2fのエッジは、スキャン画像SI内のオブジェクトOb1~Ob7、背景Bg2のエッジや、平滑化画像GI内のオブジェクトOb1g~Ob7g、背景Bg2gのエッジと比較して、鮮鋭化されている、すなわち、シャープになっている。なお、S55からS70の処理済画像データを生成する処理は、生成部により実行される処理の一例である。 FIG. 3D shows the processed image FI indicated by the processed image data. The processed image FI includes a white background Bg1f, objects Ob1 to Ob7 in the scanned image SI, objects Ob1f to Ob7f corresponding to the background Bg2, and a background Bg2f. The edges of these objects Ob1f to Ob7f and the background Bg2f are sharper than the edges of the objects Ob1 to Ob7 and the background Bg2 in the scan image SI and the edges of the objects Ob1g to Ob7g and the background Bg2g in the smoothed image GI. sharpened, i.e. sharpened. Note that the process of generating processed image data from S55 to S70 is an example of the process executed by the generation unit.

S75では、CPU210は、処理済画像データを用いて印刷データを生成する印刷データ生成処理を実行する。具体的には、RGB画像データである処理済画像データに対して色変換処理が実行されて、印刷に用いられる色材に対応する色成分(C、M、Y、Kの成分)を有する色値であるCMYK値で画素ごとの色を示すCMYK画像データが生成される。色変換処理は、例えば、公知のルックアップテーブルを参照して実行される。CMYK値画像データに対して、ハーフトーン処理が実行されて、印刷に用いられる色材ごと、かつ、画素ごとに、ドットの形成状態を示すドットデータが生成される。ドットの形成状態は、例えば、ドット有、ドット無の2種類の状態や、大ドット、中ドット、小ドット、ドット無の4種類の状態を取り得る。ハーフトーン処理は、例えば、ディザ法や、誤差拡散法に従って実行される。該ドットデータは、印刷時に用いられる順に並べ替えられ、該ドットデータに、印刷コマンドが付加されることによって、印刷データが生成される。 In S75, the CPU 210 executes print data generation processing for generating print data using the processed image data. Specifically, color conversion processing is performed on the processed image data, which is RGB image data, to obtain a color having color components (components of C, M, Y, and K) corresponding to the color materials used for printing. CMYK image data is generated that indicates the color of each pixel with the CMYK values. Color conversion processing is executed, for example, with reference to a known lookup table. Halftone processing is performed on the CMYK value image data to generate dot data indicating the state of dot formation for each color material used for printing and for each pixel. The dot formation state can take, for example, two types of dot states and no dot states, and four types of states of large dots, medium dots, small dots, and no dots. Halftone processing is performed, for example, according to a dither method or an error diffusion method. The dot data are rearranged in order of use at the time of printing, and print data is generated by adding a print command to the dot data.

S80では、CPU210は、印刷処理を実行して、画像処理を終了する。具体的には、CPU210は、印刷データを印刷実行部280に供給して、印刷実行部280に処理済画像を印刷させる。 In S80, the CPU 210 executes print processing and ends the image processing. Specifically, CPU 210 supplies print data to print execution unit 280 and causes print execution unit 280 to print the processed image.

以上説明した画像処理によれば、S55では、CPU210は、スキャンデータに対して、文字・背景画素置換処理が実行されるので、文字色と背景色との境界を鮮明にすることができる。例えば、文字・背景画素置換処理によって、図3(A)のスキャン画像SI内の文字Ob4~Ob7のうちの背景とのエッジ部分の画素の色が、その文字の色に変更される。また、スキャン画像SIの背景Bg1、Bg2うち、文字Ob4~Ob7のエッジ部分に位置する画素の色が、その背景の色に変更される。この結果、最終的に印刷される処理済み画像FIにおいて、これらの文字色と背景色との境界が鮮明になる。この結果、処理済み画像FIにおいて文字の見栄えを向上できる。 According to the image processing described above, in S55, the CPU 210 executes character/background pixel replacement processing on the scan data, so that the boundary between the character color and the background color can be made clear. For example, the character/background pixel replacement process changes the color of the pixels at the edges of the characters Ob4 to Ob7 in the scan image SI of FIG. 3A to the color of the character. Also, in the backgrounds Bg1 and Bg2 of the scanned image SI, the color of the pixels positioned at the edge portions of the characters Ob4 to Ob7 is changed to the color of the background. As a result, the boundary between the character color and the background color becomes clear in the processed image FI that is finally printed. As a result, the appearance of characters in the processed image FI can be improved.

例えば、スキャン画像SI内の文字Ob4~Ob7を構成する画素は、原稿上では、均一な色を有するので、該所定の色を有するべき画素である。また、これらの文字の背景Bg1、Bg2の色は、原稿上では、均一な色を有する。しかしながら、スキャンデータのようにイメージセンサを用いて生成される画像データによって示される画像では、特に、エッジの部分に、いわゆる「ぼけ」が発生する。このために、スキャン画像SI上では、例えば、文字Ob4~Ob7を構成する複数個の画素のうち、特に、エッジに位置する画素は、原稿上の色ではなく、例えば、原稿上の文字の色より明るく、原稿上の背景の色よりも暗い別の色を有し得る。本実施例では、処理済み画像FIにおいて、そのような文字のエッジのぼけが低減され、これらの文字色と背景色との境界が鮮明になる。 For example, the pixels forming the characters Ob4 to Ob7 in the scanned image SI have a uniform color on the original, so they should have the predetermined color. Also, the colors of the backgrounds Bg1 and Bg2 of these characters have a uniform color on the original. However, in an image represented by image data generated using an image sensor, such as scan data, so-called "blurring" occurs particularly in edge portions. For this reason, on the scanned image SI, for example, among the plurality of pixels forming the characters Ob4 to Ob7, the pixels located at the edges in particular do not have the color of the characters on the original, but the color of the characters on the original. It may have another color that is lighter and darker than the background color on the original. In this embodiment, in the processed image FI, the edge blurring of such characters is reduced, and the boundary between the character color and the background color is sharpened.

また、処理済画像データでは、背景Bg2fなどの均一な部分や、オブジェクトのエッジとは異なる部分を構成する非エッジ画素の値には、平滑化処理済みの値が用いられている。この結果、処理済画像のエッジとは異なる部分に、例えば、モアレの原因となる網点が表れることを抑制できるので、印刷される処理済画像にモアレなどの不具合が発生することを抑制できる。この結果、印刷される処理済画像の見栄えを向上することができる。 In the processed image data, smoothed values are used for the values of non-edge pixels forming a uniform portion such as the background Bg2f and a portion different from the edge of the object. As a result, it is possible to prevent, for example, halftone dots that cause moire from appearing in portions other than the edges of the processed image, so that defects such as moire in the processed image to be printed can be suppressed. As a result, the appearance of the printed processed image can be improved.

例えば、スキャンデータの生成に用いられた原稿は、画像が印刷された印刷物である。このため、例えば、原稿内の白とは異なる色を有する背景Bg2などの均一な部分は、画像を形成するドットレベルでみると、網点を形成している。網点は、複数個のドットと、ドットが配置されていない部分(原稿の地色を示す部分)と、を含む。このために、スキャン画像SI内の背景Bg2を示す領域には、画素レベルでみると、網点が示されている。網点内のドットは、原稿の印刷時に用いられるディザマトリクスなどの影響によって、周期性を持って並んでいる。このためにスキャンデータを用いて印刷を行うと、ハーフトーン処理前の元画像(スキャン画像SI)内に存在している網点のドットの周期成分と、印刷画像を構成する網点のドットの周期成分と、が干渉して、モアレが表れやすい。本実施例の処理済画像では、平滑化処理によって、元画像(スキャン画像SI)内のエッジとは異なる部分のドットの周期成分が低減される。この結果、処理済画像データを用いて、処理済画像を印刷する場合に、例えば、印刷される処理済画像にモアレが発生することを抑制できる。 For example, a document used to generate scan data is a printed matter on which an image is printed. Therefore, for example, a uniform portion such as the background Bg2 having a color different from white in the document forms a halftone dot when viewed at the dot level for forming an image. A halftone dot includes a plurality of dots and a portion where no dots are arranged (portion indicating the background color of the document). For this reason, when viewed at the pixel level, halftone dots are shown in the area indicating the background Bg2 in the scan image SI. Dots in halftone dots are arranged with periodicity due to the influence of a dither matrix used when printing an original. For this reason, when printing is performed using scan data, the halftone dot periodic component existing in the original image (scanned image SI) before halftone processing and the halftone dot dot composing the printed image Moire tends to appear due to interference between periodic components and . In the processed image of the present embodiment, the smoothing process reduces periodic components of dots in portions different from edges in the original image (scanned image SI). As a result, when the processed image is printed using the processed image data, for example, it is possible to suppress the occurrence of moire in the printed processed image.

さらに、スキャンデータの複数個のエッジ画素の値に対して、エッジ鮮鋭化処理が実行され(S70)、複数個のエッジ画素とは異なる複数個の画素に対して、網点平滑化処理(S65)が実行される。この結果、エッジを構成しない部分が平滑化され、かつ、文字色と背景色との境界が適切に鮮明にされ、かつ、他のエッジ(例えば、オブジェクトOb1f~Ob3fのエッジ)が強調された処理済み画像FIを示す処理済画像データを生成することができる。エッジ鮮鋭化処理は、文字・背景画素置換処理によって、文字色と背景色との境界を鮮明にした後に実行されるため、より処理済み画像FIにおいて文字の見栄えを向上できる。また、文字・背景色特定処理により、注目領域において文字色と背景色とが特定されない場合であっても、エッジ鮮鋭化処理は実行されるため、複数の背景色上の文字(例えば写真の中の文字)に対してもエッジが強調された処理済み画像データを生成することができる。 Furthermore, edge sharpening processing is performed on the values of a plurality of edge pixels in the scan data (S70), and halftone dot smoothing processing is performed on a plurality of pixels different from the plurality of edge pixels (S65). ) is executed. As a result, a process that smoothes portions that do not form edges, appropriately sharpens boundaries between character colors and background colors, and emphasizes other edges (for example, edges of objects Ob1f to Ob3f). Processed image data representing the finished image FI can be generated. Since the edge sharpening process is executed after the boundary between the character color and the background color has been sharpened by the character/background pixel replacement process, the appearance of the characters in the processed image FI can be further improved. In addition, even if the character/background color identification process does not identify the character color and the background color in the region of interest, the edge sharpening process is executed. ) can also generate edge-enhanced processed image data.

A-3.文字・背景色特定処理
図2のS35の文字・背景色特定処理について説明する。図5は、文字・背景色特定処理のフローチャートである。S120では、CPU210は、代表色特定処理を実行する。代表色特定処理は、シアン(C)、マゼンタ(M)、イエロ(Y)、赤(R)、緑(G)、青(B)、黒(K)、白(W)の8個の基本色の中から、注目領域の2つの代表色を特定する処理である。注目領域が文字に対応する場合には、文字色と背景色に対応する2つの代表色を決定できる。
A-3. Character/Background Color Specifying Process The character/background color specifying process in S35 of FIG. 2 will be described. FIG. 5 is a flowchart of character/background color identification processing. At S120, the CPU 210 executes representative color identification processing. Eight basic colors of cyan (C), magenta (M), yellow (Y), red (R), green (G), blue (B), black (K), and white (W) are used for representative color identification processing. This is a process of specifying two representative colors of the region of interest from among the colors. If the attention area corresponds to a character, two representative colors corresponding to the character color and the background color can be determined.

図6は、代表色特定処理のフローチャートである。図7は、代表色特定処理の説明図である。S200では、CPU210は、注目領域に外接する矩形領域SA(特定領域の一例)を設定する。図7(A)には、スキャン画像SIの文字Ob7(図3(A))に対応するエッジ画素Eg7(図3(B))によって構成されるエッジ領域EAが注目領域である場合の例が示されている。図7(A)にてクロスハッチングされている領域がエッジ領域EAを示している。図7(A)に示すように、図2のS20の膨張・収縮処理によって、スキャン画像SIの文字Ob7の内部を含めた全体に対応する領域がエッジ領域EA(エッジ画素Eg7)として特定されている。図7(A)には、エッジ領域EAに外接する矩形領域SAが図示されている。 FIG. 6 is a flowchart of representative color identification processing. FIG. 7 is an explanatory diagram of representative color identification processing. In S200, the CPU 210 sets a rectangular area SA (an example of a specific area) circumscribing the attention area. FIG. 7A shows an example in which the edge area EA formed by edge pixels Eg7 (FIG. 3B) corresponding to the character Ob7 (FIG. 3A) of the scan image SI is the target area. It is shown. The cross-hatched area in FIG. 7A indicates the edge area EA. As shown in FIG. 7A, an area corresponding to the entirety of the scanned image SI including the inside of the character Ob7 is specified as an edge area EA (edge pixel Eg7) by the expansion/contraction processing in S20 of FIG. there is FIG. 7A shows a rectangular area SA circumscribing the edge area EA.

S210では、CPU210は、二値画像BIにおいて、注目領域に外接する矩形領域SAを複数個のブロックBLに分割する。例えば、図7(A)の例では、矩形領域SAは、横8×縦10のマトリクス状に配置された80個のBLに分割されている。1個のブロックBLは、例えば、縦m×横n個の(m×n)個の画素を含んでいる(m、nは2以上の整数)。 In S210, the CPU 210 divides the rectangular area SA circumscribing the attention area in the binary image BI into a plurality of blocks BL. For example, in the example of FIG. 7A, the rectangular area SA is divided into 80 BLs arranged in a matrix of 8 horizontal×10 vertical. One block BL includes, for example, (m×n) pixels (m in length×n in width) (m and n are integers equal to or greater than 2).

S220では、CPU210は、二値画像BIにおいて設定された複数個のブロックBLから、1個の注目ブロックを選択する。 In S220, the CPU 210 selects one target block from a plurality of blocks BL set in the binary image BI.

S230では、CPU210は、注目ブロック内の複数個の画素を8個の基本色のいずれかに分類する。図7(B)には、RGB色空間CPが示されている。立法体のRGB色空間CCの8個の頂点は、8個の基本色に対応している。すなわち、8個の頂点は、K点Vk(0,0,0)、R点Vr(255,0,0)、G点Vg(0,255,0)、B点Vb(0,0,255)、C点Vc(0,255,255)、M点Vm(255,0,255)、Y点Vy(255,255,0)、W点Vw(255,255,255))である。括弧内の数字は、(R、G、B)の各色成分の値である。RGB色空間CPは、3枚の平面F1~F3によって、8個の基本色C、M、Y、R、G、B、K、Wに対応する8個の立方体の空間CSc、CSm、CSy、CSr、CSg、CSb、CSk、CSwに分割できる。平面F1は、R軸AXrと垂直で、R軸AXrの中点Mr(128、0、0)を通る平面である。平面F2は、G軸AXgと垂直で、G軸AXgの中点Mg(0、128、0)を通る平面である。平面F3は、B軸AXbと垂直で、B軸AXbの中点Mb(0、0、128)を通る平面である。例えば、図7(B)でハッチングされた空間CScは、シアン(C)に対応する空間である。例えば、注目ブロック内の複数個の画素のうち、スキャン画像SI内の対応するRGB値がCに対応する空間CSc内に位置する画素は、Cに分類される。 At S230, the CPU 210 classifies a plurality of pixels in the block of interest into one of eight basic colors. FIG. 7B shows the RGB color space CP. The 8 vertices of the cube RGB color space CC correspond to the 8 basic colors. That is, the eight vertices are K point Vk (0,0,0), R point Vr (255,0,0), G point Vg (0,255,0), B point Vb (0,0,255 ), C point Vc (0, 255, 255), M point Vm (255, 0, 255), Y point Vy (255, 255, 0), W point Vw (255, 255, 255)). The numbers in parentheses are the values of each color component (R, G, B). The RGB color space CP is defined by three planes F1-F3 into eight cubic spaces CSc, CSm, CSy, corresponding to the eight basic colors C, M, Y, R, G, B, K, W; It can be divided into CSr, CSg, CSb, CSk and CSw. The plane F1 is a plane perpendicular to the R-axis AXr and passing through the midpoint Mr (128, 0, 0) of the R-axis AXr. The plane F2 is a plane perpendicular to the G-axis AXg and passing through the midpoint Mg (0, 128, 0) of the G-axis AXg. A plane F3 is a plane perpendicular to the B-axis AXb and passing through the midpoint Mb (0, 0, 128) of the B-axis AXb. For example, the hatched space CSc in FIG. 7B is the space corresponding to cyan (C). For example, among the plurality of pixels in the block of interest, pixels located in the space CSc whose corresponding RGB values in the scanned image SI correspond to C are classified as C.

S240では、CPU210は、注目ブロックの最頻色を、注目ブロックのブロック色に決定する。注目ブロックの最頻色は、8個の基本色のうち、S230にて最も多数の画素が分類された色である。S250では、CPU210は、8個の基本色のうち、決定された注目ブロックに対応する基本色の頻度を1だけ加算する。 In S240, the CPU 210 determines the most frequent color of the block of interest as the block color of the block of interest. The most frequent color of the block of interest is the color for which the largest number of pixels are classified in S230 among the eight basic colors. In S250, the CPU 210 adds 1 to the frequency of the basic color corresponding to the determined target block among the eight basic colors.

S260では、CPU210は、注目領域に外接する矩形領域SA内の全てのブロックBLを注目ブロックとして処理したか否かを判断する。未処理のブロックBLがある場合には(S260:NO)、CPU210は、S220に処理を戻す。全てのブロックBLが処理された場合には(S260:YES)、CPU210は、S270に処理を進める。 In S260, the CPU 210 determines whether or not all the blocks BL within the rectangular area SA circumscribing the attention area have been processed as the attention block. If there is an unprocessed block BL (S260: NO), the CPU 210 returns the process to S220. When all blocks BL have been processed (S260: YES), the CPU 210 advances the process to S270.

S270では、CPU210は、閾値TH以上の頻度を有する1以上の基本色を注目領域の代表色として決定する。図7(C)には、8個の基本色のそれぞれの頻度を示すヒストグラムである。図7(C)の例では、8個の基本色C、M、Y、R、G、B、K、Wのうち、C(シアン)とB(青)との頻度が閾値TH1以上である。このために、図7(C)の例では、CとBとが注目領域の代表色として決定される。決定される代表色の数は、2色に限らず、1色あるいは3色以上である場合がある。閾値TH1は、例えば、注目領域に外接する矩形領域SAに設定されたブロックBLの総数の20%程度に設定される。 In S270, the CPU 210 determines one or more basic colors having frequencies equal to or higher than the threshold TH as representative colors of the region of interest. FIG. 7(C) is a histogram showing the frequency of each of the eight basic colors. In the example of FIG. 7C, among the eight basic colors C, M, Y, R, G, B, K, and W, the frequency of C (cyan) and B (blue) is equal to or higher than the threshold TH1. . Therefore, in the example of FIG. 7C, C and B are determined as the representative colors of the attention area. The number of determined representative colors is not limited to two, but may be one or three or more. The threshold TH1 is set to, for example, about 20% of the total number of blocks BL set in the rectangular area SA circumscribing the attention area.

代表色特定処理が終了すると、図5のS130では、CPU210は、決定された注目領域の代表色の数は、2色であるか否かを判断する。一般的に、原稿上の1個の文字は1色で表現され、文字の背景も1色である可能性が高いために、注目領域が文字に対応する場合には、代表色の数は、文字色と背景色とに対応する2色である。注目領域が文字とは異なるオブジェクト(例えば、写真)に対応する場合には、当該オブジェクトは文字より多数の色を含み得るので、代表色の数は、2色とは異なる数になり得る。 When the representative color specifying process ends, in S130 of FIG. 5, the CPU 210 determines whether or not the determined number of representative colors in the attention area is two. In general, one character on a document is expressed in one color, and it is highly possible that the background of the character is also one color. There are two colors corresponding to the character color and the background color. If the region of interest corresponds to an object (for example, a photograph) that is different from text, the object may contain more colors than text, so the number of representative colors may differ from two.

注目領域の代表色の数が2色でない場合には(S130:NO)、注目領域が文字とは異なるオブジェクトに対応する可能性が高いため、注目領域は、図2のS45~S55の対象とする必要がない。このために、この場合には、CPU210は、文字色や背景色を決定することなく、文字・背景色特定処理を終了する。 If the number of representative colors in the attention area is not two (S130: NO), there is a high possibility that the attention area corresponds to an object different from characters. you don't have to. Therefore, in this case, the CPU 210 terminates the character/background color specifying process without determining the character color and the background color.

注目領域の代表色の数が2色である場合には(S130:YES)、S140にて、CPU210は、注目領域を構成する複数個のエッジ画素(オブジェクト画素の一例)を、8個の基本色のいずれかに分類する。分類の方法には、図6のS230にて説明した方法が用いられる。 If the number of representative colors in the region of interest is two (S130: YES), in S140 the CPU 210 divides a plurality of edge pixels (an example of object pixels) forming the region of interest into eight basic colors. Categorize by color. As the classification method, the method described in S230 of FIG. 6 is used.

S150では、エッジ画素の最頻色は、S120にて決定された2個の代表色の一方と一致するか否かを判断する。エッジ画素の最頻色は、8個の基本色のうち、S140にて最も多数のエッジ画素が分類された色である。注目領域が文字に対応する場合には、エッジ画素の大部分はスキャン画像SI内の文字を構成する画素に対応するので、エッジ画素の最頻色は文字色に対応する。上述のように、注目領域が文字に対応する場合には、2個の代表色は、文字色と背景色とに対応する2色である。したがって、注目領域が文字に対応する場合には、エッジ画素の最頻色は2個の代表色の一方と一致する。注目領域が文字とは異なるオブジェクトに対応する場合には、エッジ画素の最頻色は、2個の代表色のいずれとも一致しない場合がある。 At S150, it is determined whether or not the most frequent color of the edge pixel matches one of the two representative colors determined at S120. The most frequent color of edge pixels is the color for which the largest number of edge pixels are classified in S140 among the eight basic colors. When the region of interest corresponds to a character, most of the edge pixels correspond to the pixels forming the character in the scanned image SI, so the most frequent color of the edge pixels corresponds to the character color. As described above, when the attention area corresponds to a character, the two representative colors are two colors corresponding to the character color and the background color. Therefore, when the region of interest corresponds to a character, the most frequent color of edge pixels matches one of the two representative colors. If the region of interest corresponds to an object other than characters, the most frequent color of edge pixels may not match any of the two representative colors.

エッジ画素の最頻色が2個の代表色のいずれとも一致しない場合には(S150:NO)、注目領域が文字とは異なるオブジェクトに対応する可能性が高いため、注目領域は、図2のS45~S55の対象とする必要がない。このために、この場合には、CPU210は、文字色や背景色を決定することなく、文字・背景色特定処理を終了する。 If the most frequent color of the edge pixels does not match any of the two representative colors (S150: NO), there is a high possibility that the region of interest corresponds to an object different from characters. There is no need to make it the object of S45 to S55. Therefore, in this case, the CPU 210 terminates the character/background color specifying process without determining the character color and the background color.

エッジ画素の最頻色が2個の代表色の一方と一致する場合には(S150:YES)、S160にて、CPU210は、複数個のエッジ画素の平均色を文字色として特定する。具体的には、CPU210は、複数個のエッジ画素のR値の平均値Rav1と、G値の平均値Gav1と、B値の平均値Bav1と、から成るRGB値(Rav1、Bav1、Bav1)を、文字色を示すRGB値として算出する。このように、矩形領域SAにて特定される文字を構成する複数個のエッジ画素の値を用いて、文字色が特定される。この結果、精度良く文字色を特定することができる。変形例としては、CPU210は、エッジ画素の最頻色を文字色として特定しても良い。この場合には、C、M、Y、R、G、B、K、Wの8個の基本色のいずれかが文字色として特定される。 If the most frequent color of the edge pixels matches one of the two representative colors (S150: YES), in S160 the CPU 210 specifies the average color of the plurality of edge pixels as the character color. Specifically, the CPU 210 calculates the RGB values (Rav1, Bav1, Bav1) consisting of the average R value Rav1, the average G value Gav1, and the average B value Bav1 of a plurality of edge pixels. , are calculated as RGB values indicating the character color. In this way, the character color is specified using the values of the plurality of edge pixels forming the character specified in the rectangular area SA. As a result, the character color can be specified with high accuracy. As a modification, the CPU 210 may specify the most frequent color of edge pixels as the character color. In this case, one of the eight basic colors C, M, Y, R, G, B, K, and W is specified as the character color.

S170では、CPU210は、注目領域に外接する矩形領域SA内の複数個の画素のうち、エッジ画素を除いた複数個の画素(非エッジ画素)の平均色を背景色として特定する。具体的には、CPU210は、複数個の非エッジ画素のR値の平均値Rav2と、G値の平均値Gav2と、B値の平均値Bav2と、から成るRGB値(Rav2、Bav2、Bav2)を、背景色を示すRGB値として算出する。このように、矩形領域SAにて特定される文字を構成しない複数個の非エッジ画素の値を用いて、背景色が特定される。この結果、精度良く背景色を特定することができる。変形例としては、CPU210は、上述した2個の代表色のうち、エッジ画素の最頻色とは異なる色を背景色として特定しても良い。この場合には、8個の基本色のうちの文字色とは異なるいずれかの色が、背景色として特定される。文字色と背景色とが特定されると、CPU210は、文字・背景色特定処理を終了する。 In S170, the CPU 210 specifies, as the background color, the average color of a plurality of pixels (non-edge pixels) excluding edge pixels among the plurality of pixels in the rectangular area SA circumscribing the target area. Specifically, the CPU 210 generates RGB values (Rav2, Bav2, Bav2) consisting of an average value Rav2 of R values, an average value Gav2 of G values, and an average value Bav2 of B values of a plurality of non-edge pixels. are calculated as RGB values indicating the background color. In this way, the background color is specified using the values of a plurality of non-edge pixels that do not constitute the characters specified in the rectangular area SA. As a result, the background color can be specified with high accuracy. As a modification, the CPU 210 may specify, as the background color, a color that is different from the most frequent color of the edge pixels, among the two representative colors described above. In this case, one of the eight basic colors that is different from the character color is specified as the background color. After specifying the character color and the background color, the CPU 210 terminates the character/background color specifying process.

以上説明した文字・背景色特定処理によれば、スキャン画像SI内の特定の文字(例えば、文字Ob7)に対応する矩形領域SAが複数個のブロックBLに分割される(図6のS210)。該複数個のブロックBLのそれぞれの複数個の画素の値を用いて、複数個のブロックBLに対応する複数個のブロック色が代表色として決定される(図6のS230、S240)。閾値TH以上の個数のブロックBLに対応するブロック色に基づいて文字色と背景色とが特定される(図6のS270、図5のS140~S170)。この結果、複数個のブロック色を用いて、文字色と背景色とを適切に特定できる。 According to the character/background color identification process described above, the rectangular area SA corresponding to a specific character (for example, character Ob7) in the scan image SI is divided into a plurality of blocks BL (S210 in FIG. 6). A plurality of block colors corresponding to the plurality of blocks BL are determined as representative colors using the values of the plurality of pixels of each of the plurality of blocks BL (S230, S240 in FIG. 6). The character color and the background color are identified based on the block colors corresponding to the number of blocks BL equal to or greater than the threshold TH (S270 in FIG. 6, S140 to S170 in FIG. 5). As a result, the character color and the background color can be appropriately specified using a plurality of block colors.

さらに、CPU210は、複数個のエッジ領域に対応する矩形領域SAのそれぞれについて、閾値TH以上の個数のブロックBLに対応するブロック色(代表色)の個数が2であるか否かを判断する(図5のS130)。CPU210は、代表色の個数が2である矩形領域SAについて文字色と背景色とを決定し(図5のS160、S170)、代表色の個数が2とは異なる矩形領域SAについて文字色と背景色とを特定しない。この結果、オブジェクトが文字である場合には、文字色が特定され、オブジェクトが文字でない場合には、文字色が特定され難い。したがって、オブジェクトが文字である場合に、該文字において文字色と背景色とを鮮明にすることができ、オブジェクトが文字でない場合には、該オブジェクトに文字のための処理(例えば、図2のS45~S55の処理)が誤って実行されることを抑制できる。 Further, the CPU 210 determines whether or not the number of block colors (representative colors) corresponding to the number of blocks BL equal to or greater than the threshold TH is 2 for each of the rectangular areas SA corresponding to the plurality of edge areas ( S130 in FIG. 5). The CPU 210 determines the character color and the background color for the rectangular area SA with two representative colors (S160 and S170 in FIG. 5), and determines the character color and the background color for the rectangular area SA with the different number of representative colors. Do not specify colors. As a result, when the object is a character, the character color is identified, and when the object is not a character, the character color is difficult to identify. Therefore, when the object is a character, the character color and the background color can be made clear in the character, and when the object is not a character, processing for the character (for example, S45 in FIG. 2) can be performed on the object. to S55) can be prevented from being erroneously executed.

さらに、矩形領域SA内の複数個のエッジ画素の値を用いて、矩形領域SA内のオブジェクト(例えば、文字、写真)の色が、2個の代表色のいずれかに対応(実施例では一致)するか否かが判断される(図5のS150)。オブジェクトの色が2個の代表色のいずれかに対応する場合には、文字色が特定され、オブジェクトの色が2個の代表色のいずれにも対応しない場合には、文字色が特定されない(図5のS150、160)。同様に、オブジェクトの色が2個の代表色のいずれかに対応する場合には、背景色が特定され、オブジェクトの色が2個の代表色のいずれにも対応しない場合には、背景色が特定されない(図5のS150、170)。この結果、オブジェクトが文字である場合には、文字色が特定でき、オブジェクトが文字でない場合には、文字色がより特定され難い。したがって、オブジェクトが文字である場合に、該文字において文字色と背景色とを鮮明にすることができ、オブジェクトが文字でない場合には、該オブジェクトに文字のための処理(例えば、図2のS45~S55の処理)が誤って実行されることをさらに抑制することができる。 Furthermore, by using the values of the plurality of edge pixels in the rectangular area SA, the color of the object (eg, text, photo) in the rectangular area SA corresponds to one of the two representative colors (matching in the embodiment). ) is determined (S150 in FIG. 5). If the color of the object corresponds to one of the two representative colors, the character color is identified, and if the object color does not correspond to any of the two representative colors, the character color is not identified ( S150, 160 in FIG. 5). Similarly, if the object color corresponds to one of the two representative colors, the background color is identified, and if the object color does not correspond to any of the two representative colors, the background color is identified. Not specified (S150, 170 in FIG. 5). As a result, when the object is a character, the character color can be identified, and when the object is not a character, the character color is more difficult to identify. Therefore, when the object is a character, the character color and the background color can be made clear in the character, and when the object is not a character, processing for the character (for example, S45 in FIG. 2) can be performed on the object. to S55) can be further suppressed from being erroneously executed.

A-4:文字画素特定処理
図2のS45の文字画素特定処理について説明する。図8は、文字画素特定処理のフローチャートである。S400では、CPU210は、フラグデータを初期化する。初期化されたフラグデータの複数個のフラグの値は、初期値、具体的には、文字画素でも背景画素でもないことを示す値(本実施例では、「0」)を有する。
A-4: Character Pixel Identification Processing The character pixel identification processing of S45 in FIG. 2 will be described. FIG. 8 is a flowchart of character pixel identification processing. In S400, the CPU 210 initializes flag data. The values of the plurality of flags in the initialized flag data have an initial value, specifically, a value ("0" in this embodiment) indicating that the pixel is neither a character pixel nor a background pixel.

S405では、CPU210は、注目領域に対応するスキャン画像SI内の複数個のエッジ画素の中から、所定の処理順序で1個の注目画素を選択する。本実施例の処理順では、例えば、図7(A)の第1方向D1と平行な複数本のラスタラインのうち、第2方向D2の上流側(図7(A)の上側)から下流側に向かって順次に処理対象となる。そして、1本のラスタライン上の複数個のエッジ画素の中では、第1方向D1の上流側(図7(A)の左側)から下流側に向かって順次に処理対象となる。すなわち、第1方向D1の位置が同じ複数個のエッジ画素は、第2方向D2の上流側のエッジ画素が、下流側のエッジ画素よりも先に選択される。また、第2方向D2の位置が同じ複数個のエッジ画素は、第1方向D1の上流側のエッジ画素が、下流側のエッジ画素よりも先に選択される。第1方向D1(図3(A)の左から右に向かう方向)、および、第2方向D2(図3(A)の上から下に向かう方向)を、処理方向とも呼ぶ。 In S405, the CPU 210 selects one pixel of interest in a predetermined processing order from among the plurality of edge pixels in the scanned image SI corresponding to the region of interest. In the processing order of this embodiment, for example, among a plurality of raster lines parallel to the first direction D1 in FIG. are processed sequentially. Among a plurality of edge pixels on one raster line, the edge pixels are sequentially processed from the upstream side (the left side in FIG. 7A) in the first direction D1 toward the downstream side. That is, among a plurality of edge pixels having the same position in the first direction D1, edge pixels on the upstream side in the second direction D2 are selected before edge pixels on the downstream side. In addition, among a plurality of edge pixels having the same position in the second direction D2, edge pixels on the upstream side in the first direction D1 are selected before edge pixels on the downstream side. The first direction D1 (from left to right in FIG. 3A) and the second direction D2 (from top to bottom in FIG. 3A) are also called processing directions.

CPU210は、図2のS15の膨張・収縮処理後の二値画像データを参照して、注目領域内の複数個のエッジ画素から、上述した処理順で順次に注目画素を選択する。 The CPU 210 refers to the binary image data after the expansion/contraction processing in S15 of FIG. 2, and sequentially selects pixels of interest from the plurality of edge pixels in the region of interest in the above-described order of processing.

S415では、CPU210は、注目画素の値(RGB値)は、第1文字色範囲内であるか否かを判断する。第1文字色範囲は、図2のS35の文字・背景色特定処理によって特定された文字色を含む予め定められた範囲であり、文字色を示すRGB値を(Rt、Gt、Bt)とする場合に、RGBの各成分値(R、G、B)が、以下の式(2)を満たす範囲である。
|R-Rt|≦TH1、かつ、|G-Gt|≦TH1、かつ、|B-Bt|≦TH1
…(2)
閾値TH1は、各成分値が、0~255の範囲の階調値である場合に、例えば、50である。注目画素の値が、第1文字色範囲内である場合は、注目画素は、背景色よりも文字色に近い色を有すると考えられる。以下では、S415にて判断される条件、すなわち、「注目画素の値が、第1文字色範囲内であること」を、判断条件Aと呼ぶ。
In S415, the CPU 210 determines whether the value (RGB value) of the target pixel is within the first character color range. The first character color range is a predetermined range including the character color specified by the character/background color specifying process in S35 of FIG. 2, and the RGB values indicating the character color are (Rt, Gt, Bt) In this case, each RGB component value (R, G, B) is a range that satisfies the following formula (2).
|R−Rt|≦TH1, |G−Gt|≦TH1, and |B−Bt|≦TH1
…(2)
The threshold TH1 is 50, for example, when each component value is a gradation value in the range of 0-255. If the value of the pixel of interest is within the first text color range, the pixel of interest is considered to have a color closer to the text color than the background color. Hereinafter, the condition determined in S415, that is, "the value of the pixel of interest is within the first character color range" will be referred to as determination condition A.

判断条件Aが満たされる場合には(S415:YES)、CPU210は、S420に処理を進める。判断条件Aが満たされない場合には(S415:NO)、CPU210は、S450に処理を進める。 If judgment condition A is satisfied (S415: YES), CPU 210 advances the process to S420. If the determination condition A is not satisfied (S415: NO), the CPU 210 advances the process to S450.

S420では、CPU210は、注目画素の値が第2文字色範囲内であり、かつ、周囲領域内の複数個の画素の値の平均値が第3文字色範囲内であるか否かを判断する。第2文字色範囲は、文字色を含む予め定められた範囲であり、第1文字色範囲より狭い範囲である。具体的には、第2文字色範囲は、RGBの各成分値(R、G、B)が、以下の式(3)を満たす範囲である。
|R-Rt|≦TH2、かつ、|G-Gt|≦TH2、かつ、|B-Bt|≦TH2
…(3)
閾値TH2は、閾値TH1より小さな値であり、各成分値が、0~255の範囲の階調値である場合に、例えば、10である。
In S420, the CPU 210 determines whether the value of the target pixel is within the second character color range and the average value of the values of the plurality of pixels within the surrounding area is within the third character color range. . The second character color range is a predetermined range that includes the character color and is narrower than the first character color range. Specifically, the second character color range is a range in which each RGB component value (R, G, B) satisfies the following formula (3).
|R−Rt|≦TH2, |G−Gt|≦TH2, and |B−Bt|≦TH2
…(3)
The threshold TH2 is a value smaller than the threshold TH1, and is 10, for example, when each component value is a gradation value in the range of 0-255.

周囲領域は、本実施例では、注目画素を中心とした縦5画素×横5画素の矩形の領域である。CPU210は、該周囲領域内の25個の画素のRGB値の平均値(Rav、Gav、Bav)を算出する。第3文字色範囲は、文字色を示すRGB値を(Rt、Gt、Bt)とする場合に、RGB値の平均値(Rav、Gav、Bav)が、以下の式(4)を満たす範囲である。
|Rav-Rt|≦TH3、かつ、|Gav-Gt|≦TH3、|Gav-Gt|≦TH3 …(4)
閾値TH3は、例えば、20である。該平均値が、第3文字色範囲内である場合は、周囲領域内の画素の色は、文字色に比較的近い色であると考えられる。以下では、S420にて判断される条件、すなわち、「注目画素の値が第2文字色範囲内であり、かつ、周囲領域内の複数個の画素の値の平均値が第3文字色範囲内であること」を、判断条件Bと呼ぶ。
In this embodiment, the surrounding area is a rectangular area of 5 vertical pixels×5 horizontal pixels centered on the pixel of interest. The CPU 210 calculates average values (Rav, Gav, Bav) of RGB values of 25 pixels in the surrounding area. The third character color range is a range in which the average value of the RGB values (Rav, Gav, Bav) satisfies the following formula (4), where (Rt, Gt, Bt) are the RGB values indicating the character color. be.
|Rav-Rt|≤TH3, and |Gav-Gt|≤TH3, |Gav-Gt|≤TH3 (4)
The threshold TH3 is 20, for example. If the average value is within the third character color range, the color of pixels in the surrounding area is considered to be relatively close to the character color. Below, the conditions determined in S420, that is, "the value of the pixel of interest is within the second character color range and the average value of the values of a plurality of pixels in the surrounding area is within the third character color range" is called a judgment condition B.

判断条件Bが満たされる場合には(S420:YES)、CPU210は、S445に処理を進める。判断条件Bが満たされない場合には(S420:NO)、CPU210は、S425に処理を進める。 If judgment condition B is satisfied (S420: YES), CPU 210 advances the process to S445. If the determination condition B is not satisfied (S420: NO), the CPU 210 advances the process to S425.

S425では、CPU210は、注目画素の上側に隣接する画素が文字画素であり、かつ、注目画素の2個下の画素の値が背景色範囲内であるか否かを判断する。フラグデータにおいて、注目画素の上側に隣接する画素に対応するフラグが、文字画素を示す値である場合には、該隣接する画素は、文字画素であると判断される。 In S425, the CPU 210 determines whether the pixel adjacent to the pixel of interest on the upper side is a character pixel and the value of the pixel two pixels below the pixel of interest is within the background color range. In the flag data, when the flag corresponding to the pixel adjacent above the target pixel has a value indicating a character pixel, the adjacent pixel is determined to be a character pixel.

背景色範囲は、図2のS35の文字・背景色特定処理によって特定された背景色を含む予め定められた範囲である。背景色範囲は、例えば、図2のS35にて特定された背景色を示すRGB値を(Rb、Gb、Bb)とする場合に、以下の式(5)を満たす範囲である。
|R-Rb|≦TH4、かつ、|G-Gb|≦TH4、かつ、|B-Bb|≦TH4
…(5)
閾値TH4は、例えば、0~255の範囲の階調値である場合に、例えば、20である。注目画素の値が、背景色範囲内である場合には、注目画素は、背景色に近い色を有すると考えられる。以下では、S425にて判断される条件、すなわち、「注目画素の上側に隣接する画素が文字画素であり、かつ、注目画素の2個下の画素の値が背景色範囲内であること」を、判断条件Cと呼ぶ。
The background color range is a predetermined range including the background color specified by the character/background color specifying process in S35 of FIG. The background color range is, for example, a range that satisfies the following formula (5), where (Rb, Gb, Bb) are the RGB values indicating the background color identified in S35 of FIG.
|R-Rb|≤TH4, |G-Gb|≤TH4, and |B-Bb|≤TH4
…(5)
The threshold TH4 is, for example, 20 when the tone value is in the range of 0 to 255, for example. If the value of the pixel of interest is within the background color range, the pixel of interest is considered to have a color close to the background color. In the following, the conditions determined in S425, that is, "the pixel adjacent to the pixel on the upper side of the pixel of interest is a text pixel and the value of the pixel two pixels below the pixel of interest is within the background color range" will be described. , is called a judgment condition C.

判断条件Cが満たされる場合には(S425:YES)、CPU210は、S445に処理を進める。判断条件Cが満たされない場合には(S425:NO)、CPU210は、S430に処理を進める。 If judgment condition C is satisfied (S425: YES), CPU 210 advances the process to S445. If the determination condition C is not satisfied (S425: NO), the CPU 210 advances the process to S430.

S430では、CPU210は、注目画素の左側に隣接する画素が文字画素であり、かつ、注目画素の2個右の画素の値が背景色範囲内であるか否かを判断する。左側に隣接する画素が文字画素であるか否かは、S425と同様に、フラグデータを参照して判断される。背景色範囲は、S425で用いられる背景色範囲と同じである。以下では、S430にて判断される条件、すなわち、「注目画素の左側に隣接する画素が文字画素であり、かつ、注目画素の2個右の画素の値が背景色範囲内であること」を、判断条件Dと呼ぶ。 In S430, the CPU 210 determines whether the pixel adjacent to the left side of the pixel of interest is a character pixel and the value of the pixel two pixels to the right of the pixel of interest is within the background color range. Whether or not the pixel adjacent to the left side is a character pixel is determined by referring to the flag data, as in S425. The background color range is the same as the background color range used at S425. In the following, the conditions determined in S430, that is, "the pixel adjacent to the left of the pixel of interest is a text pixel and the value of the pixel two pixels to the right of the pixel of interest is within the background color range" will be described. , is called a judgment condition D.

判断条件Dが満たされる場合には(S430:YES)、CPU210は、S445に処理を進める。判断条件Dが満たされない場合には(S430:NO)、CPU210は、S435に処理を進める。 If the determination condition D is satisfied (S430: YES), the CPU 210 advances the process to S445. If the determination condition D is not satisfied (S430: NO), the CPU 210 advances the process to S435.

S435では、CPU210は、注目画素の下側に隣接する画素の値が第2文字色範囲内であり、かつ、該下側に隣接する画素の周囲領域内の複数個の画素の値の平均値が第3文字色範囲内であるか否かを判断する。第2文字色範囲は、上記式(3)を満たす範囲である。周囲領域は、上述した注目画素の周囲領域と同様に、該下側に隣接する画素を中心とする縦5画素×横5画素の矩形の領域である。第3文字色範囲は、上記式(4)を満たす範囲である。以下では、S435にて判断される条件、すなわち、「注目画素の下側に隣接する画素の値が第2文字色範囲内であり、かつ、該下側に隣接する画素の周囲領域内の複数個の画素の値の平均値が第3文字色範囲内であること」を、判断条件Eと呼ぶ。 In S435, the CPU 210 determines that the value of the pixel adjacent to the pixel of interest on the lower side is within the second character color range, and the average value of the values of a plurality of pixels in the surrounding area of the pixel adjacent to the pixel on the lower side. is within the third character color range. The second character color range is a range that satisfies the above formula (3). The surrounding area is a rectangular area of 5 vertical pixels×5 horizontal pixels centered on the pixel adjacent to the pixel of interest as described above. The third character color range is a range that satisfies the above formula (4). In the following, the conditions determined in S435, that is, "the value of the pixel adjacent to the lower side of the pixel of interest is within the second character color range, and a plurality of The average value of the pixel values is within the third character color range.

判断条件Eが満たされる場合には(S435:YES)、CPU210は、S445に処理を進める。判断条件Eが満たされない場合には(S435:NO)、CPU210は、S440に処理を進める。 If the determination condition E is satisfied (S435: YES), the CPU 210 advances the process to S445. If the determination condition E is not satisfied (S435: NO), the CPU 210 advances the process to S440.

S440では、CPU210は、注目画素の右側に隣接する画素の値が第2文字色範囲内であり、かつ、該右側に隣接する画素の周囲領域内の複数個の画素の値の平均値が第3文字色範囲内であるか否かを判断する。第2文字色範囲は、上記式(3)を満たす範囲である。周囲領域は、上述した注目画素の周囲領域と同様に、該右側に隣接する画素を中心とする縦5画素×横5画素の矩形の領域である。第3文字色範囲は、上記式(4)を満たす範囲である。以下では、S440にて判断される条件、すなわち、「注目画素の右側に隣接する画素の値が第2文字色範囲内であり、かつ、該右側に隣接する画素の周囲領域内の複数個の画素の値の平均値が第3文字色範囲内であること」を、判断条件Fと呼ぶ。 In S440, the CPU 210 determines that the value of the pixel adjacent to the right side of the pixel of interest is within the second character color range, and that the average value of the values of a plurality of pixels in the surrounding area of the pixel adjacent to the right side is the second character color range. It is determined whether or not it is within the 3-character color range. The second character color range is a range that satisfies the above formula (3). The surrounding area is a rectangular area of 5 vertical pixels×5 horizontal pixels centered on the pixel adjacent to the right side, similarly to the above-described surrounding area of the pixel of interest. The third character color range is a range that satisfies the above formula (4). In the following, the conditions determined in S440, that is, "the value of the pixel adjacent to the right of the pixel of interest is within the second character color range, and a plurality of The average value of the pixel values is within the third character color range" is called a judgment condition F.

判断条件Fが満たされる場合には(S440:YES)、CPU210は、S445に処理を進める。判断条件Fが満たされない場合には(S440:NO)、CPU210は、S450に処理を進める。 If the determination condition F is satisfied (S440: YES), the CPU 210 advances the process to S445. If the determination condition F is not satisfied (S440: NO), the CPU 210 advances the process to S450.

S445では、CPU210は、注目画素を文字画素として特定する。このために、この場合には、CPU210は、フラグデータにおいて、注目画素に対応するフラグの値を、文字画素を示す値(本実施例では、「1」)に更新する。 In S445, the CPU 210 identifies the pixel of interest as a character pixel. Therefore, in this case, the CPU 210 updates the value of the flag corresponding to the pixel of interest in the flag data to the value indicating the character pixel (“1” in this embodiment).

S450では、CPU210は、注目領域を構成する全てのエッジ画素を注目画素として処理したか否かを判断する。未処理のエッジ画素がある場合には(S450:NO)、CPU210は、S405に戻って、未処理のエッジ画素を注目画素として選択する。全てのエッジ画素が処理された場合には(S450:YES)、CPU210は、文字画素特定処理を終了する。 In S450, the CPU 210 determines whether or not all the edge pixels forming the target area have been processed as the target pixel. If there is an unprocessed edge pixel (S450: NO), the CPU 210 returns to S405 and selects the unprocessed edge pixel as the target pixel. When all edge pixels have been processed (S450: YES), the CPU 210 terminates the character pixel identification process.

以上の説明から解るように、文字画素特定処理において、注目画素が、膨張・収縮処理後の二値画像データにおいて、エッジ画素として特定されている場合、すなわち、注目画素は、判断条件A~Fの少なくとも一部の判断対象とされる。そして、判断条件A~Fについて、以下の(1)~(5)の場合に、該注目画素は、文字画素として特定される。 As can be seen from the above description, in the character pixel specifying process, if the pixel of interest is specified as an edge pixel in the binary image data after the dilation/contraction process, that is, the pixel of interest meets the determination conditions A to F subject to at least a part of the determination of Then, in the following cases (1) to (5) with respect to judgment conditions A to F, the pixel of interest is identified as a character pixel.

(1)判断条件Bを少なくとも満たす場合
(2)判断条件A、Cの両方を少なくとも満たす場合
(3)判断条件A、Dの両方を少なくとも満たす場合
(4)判断条件A、Eの両方を少なくとも満たす場合
(5)判断条件A、Fの両方を少なくとも満たす場合
なお、第2文字色範囲は、第1文字色範囲より狭いので、判断条件Bを満たす場合には、判断条件Aは、必ず満たされる。また、判断条件Aが満たされない場合には、判断条件Bも満たされない。したがって、判断条件Aが満たされない場合には、上記(1)~(5)のいずれにも該当しない。
(1) When at least the judgment condition B is satisfied (2) When at least both the judgment conditions A and C are satisfied (3) When at least both the judgment conditions A and D are satisfied (4) When at least both the judgment conditions A and E are satisfied (5) When at least both of the judgment conditions A and F are satisfied: Since the second character color range is narrower than the first character color range, if the judgment condition B is satisfied, the judgment condition A must be satisfied. be Moreover, when the judgment condition A is not satisfied, the judgment condition B is also not satisfied. Therefore, if the judgment condition A is not satisfied, none of the above (1) to (5) apply.

以下、具体例を説明する。図9は、文字画素特定処理の第1の説明図である。図9(A)には、特定された背景色を有する背景上に位置する特定された文字色を有する文字(例えば、図3(A)の文字Ob6)を構成する左右方向(第1方向D1)に延びる線の下側のエッジ(下エッジとも呼ぶ)の拡大図が示されている。下エッジの近傍の領域は、内側領域TAと、外側領域BAと、中間領域MAと、を含んでいる。内側領域TAは、文字側の領域である。外側領域BAは、背景側の領域である。中間領域MAは、内側領域TAと外側領域BAとの間の領域である。内側領域TA内の画素は、文字色に近似した色を有している。外側領域BA内の画素は、背景色に近似した色を有している。中間領域MA内の画素は、文字色と背景色との中間の色を有している。中間領域MAは、いわゆる「ぼけ」が生じている領域である。これらの領域TA、BA、MA内の複数個の画素は、膨張・収縮済みの二値画像データにおいて、エッジ画素として特定されている。このために、これらの領域TA、BA、MA内の複数個のエッジ画素に対応するエッジ領域が注目領域である場合には、これらのエッジ画素が、注目画素として順次に選択される(S405)。 A specific example will be described below. FIG. 9 is a first explanatory diagram of character pixel identification processing. FIG. 9A shows the left-right direction (first direction D1) of a character having a specified character color located on a background having a specified background color (for example, character Ob6 in FIG. 3A). ) is shown an enlarged view of the lower edge (also referred to as the bottom edge) of the line extending from . The area near the bottom edge includes an inner area TA, an outer area BA and a middle area MA. The inner area TA is a character side area. The outer area BA is an area on the background side. The middle area MA is an area between the inner area TA and the outer area BA. Pixels in the inner area TA have a color that approximates the character color. Pixels in the outer area BA have a color that approximates the background color. Pixels in the intermediate area MA have a color intermediate between the character color and the background color. The intermediate area MA is an area where so-called "blurring" occurs. A plurality of pixels within these areas TA, BA, MA are identified as edge pixels in the dilated/shrinked binary image data. For this reason, when edge regions corresponding to a plurality of edge pixels in these regions TA, BA, and MA are target regions, these edge pixels are sequentially selected as target pixels (S405). .

内側領域TA内の画素TP1の色は、文字色に近似している。このために、画素TP1が注目画素である場合には、画素TP1の値は、第1文字色範囲内であると判断される(S415:YES)。そして、画素TP1の値は、第2文字色範囲内であると判断される。また、周囲範囲AA1は内側領域TAの画素を多く含むので、周囲範囲AA1の複数個の画素の値の平均値は文字色に近い。このために、該平均値は、第3文字色範囲内であると判断される(S420:YES)。したがって、画素TP1は、上記判断条件Bを満たすので、文字画素として特定される(S445)。 The color of the pixel TP1 within the inner area TA approximates the character color. Therefore, when the pixel TP1 is the pixel of interest, it is determined that the value of the pixel TP1 is within the first character color range (S415: YES). Then, the value of pixel TP1 is determined to be within the second character color range. Also, since the surrounding area AA1 includes many pixels of the inner area TA, the average value of the values of the plurality of pixels in the surrounding area AA1 is close to the character color. Therefore, the average value is determined to be within the third character color range (S420: YES). Therefore, since the pixel TP1 satisfies the determination condition B, it is identified as a character pixel (S445).

中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素TP2の色は、背景色よりも文字色に近いが、内側領域TA内の画素の色ほど文字色に近くない。このために、画素TP2が注目画素である場合には、画素TP2の値は、第1文字色範囲内であると判断される(S415:YES)が、第2文字色範囲内ではないと判断される(S420:NO)。すなわち、画素TP2の値は、判断条件Aを満たすが、判断条件Bを満たさない。 In the middle area MA, the color of the pixels TP2 closer to the inner area TA than the outer area BA is closer to the text color than the background color, but not as close to the text color as the color of the pixels in the inner area TA. Therefore, when the pixel TP2 is the pixel of interest, the value of the pixel TP2 is determined to be within the first character color range (S415: YES), but not within the second character color range. (S420: NO). That is, the value of the pixel TP2 satisfies the criterion A, but does not satisfy the criterion B.

画素TP2の上側に隣接する画素SP1は、内側領域TA内の画素である。画素SP1は、画素TP2が注目画素として選択される前に、注目画素として選択されて文字画素として特定される。画素TP2の2個下の画素SP2は、外側領域BA内の画素である。外側領域BA内の画素SP2の色は、背景色に近似している。このために、画素SP2の上側に隣接する画素は、文字画素であり、かつ、注目画素の2個下の画素の値は、背景色範囲内であると判断される(S425:YES)。したがって、画素TP1は、上記判断条件A、Cの両方を満たすので、文字画素として特定される(S445)。 A pixel SP1 adjacent to the upper side of the pixel TP2 is a pixel within the inner area TA. Pixel SP1 is selected as a target pixel and specified as a character pixel before pixel TP2 is selected as a target pixel. A pixel SP2 two pixels below the pixel TP2 is a pixel in the outer area BA. The color of the pixel SP2 within the outer area BA approximates the background color. Therefore, it is determined that the pixel adjacent to the pixel SP2 on the upper side is a character pixel, and the value of the pixel two pixels below the pixel of interest is within the background color range (S425: YES). Accordingly, since the pixel TP1 satisfies both the judgment conditions A and C, it is identified as a character pixel (S445).

中間領域MAのうち、内側領域TAよりも外側領域に近い画素TP3の色は、文字色よりも背景色に近い。このために、画素TP3が注目画素である場合には、画素TP2の値は、第1文字色範囲内でないと判断される(S415:NO)。したがって、画素TP3は、上記判断条件Aを満たさないので、文字画素として特定されない。 In the intermediate area MA, the color of the pixel TP3 closer to the outer area than the inner area TA is closer to the background color than the character color. Therefore, when the pixel TP3 is the pixel of interest, it is determined that the value of the pixel TP2 is not within the first character color range (S415: NO). Therefore, since the pixel TP3 does not satisfy the determination condition A, it is not identified as a character pixel.

外側領域BA内の画素TP4は、背景色に近似している。このために、画素TP4が注目画素である場合には、画素TP4の値は、第1文字色範囲内でないと判断される(S415:NO)。したがって、画素TP4は、上記判断条件Aを満たさないので、文字画素として特定されない。 Pixel TP4 in the outer area BA approximates the background color. Therefore, when the pixel TP4 is the pixel of interest, it is determined that the value of the pixel TP4 is not within the first character color range (S415: NO). Therefore, since the pixel TP4 does not satisfy the determination condition A, it is not identified as a character pixel.

図9(B)には、図9(A)に示すスキャン画像SI内の領域に対応するフラグデータが示されている。このフラグデータは、文字画素特定処理が終了した時点におけるフラグデータである。図9(B)に示すように、下エッジの近傍では、文字画素特定処理によって、内側領域TA内の画素(例えば、画素TP1)と、中間領域MAのうち、外側領域BAよりも内側領域TAに近い領域内の画素(例えば、画素TP2)と、が文字画素として特定される。中間領域MAのうち、内側領域TAよりも外側領域BAに近い領域内の画素(例えば、画素TP3)と、外側領域BA内の画素(例えば、画素TP4)と、は、文字画素として特定されない。 FIG. 9B shows flag data corresponding to the area in the scanned image SI shown in FIG. 9A. This flag data is the flag data at the time when the character pixel specifying process is completed. As shown in FIG. 9B, in the vicinity of the lower edge, pixels in the inner area TA (for example, pixels TP1) and pixels in the inner area TA in the intermediate area MA are more likely than the outer area BA by the character pixel specifying process. (for example, pixel TP2) in a region close to is identified as a character pixel. Pixels in the middle area MA that are closer to the outer area BA than the inner area TA (for example, pixels TP3) and pixels in the outer area BA (for example, pixels TP4) are not specified as character pixels.

図10は、文字画素特定処理の第2の説明図である。図10(A)には、文字色を有する文字を構成する上下方向(第2方向D2)に延びる線の右側のエッジ(右エッジとも呼ぶ)の拡大図が示されている。右エッジの近傍の領域は、図9(A)の下エッジと同様に、内側領域TAと、外側領域BAと、中間領域MAと、を含んでいる。これらの領域TA、BA、MA内の複数個のエッジ画素に対応するエッジ領域が注目領域である場合には、これらのエッジ画素が順次に注目画素として選択される(S405)。 FIG. 10 is a second explanatory diagram of the character pixel specifying process. FIG. 10A shows an enlarged view of the right edge (also referred to as the right edge) of the line extending in the vertical direction (second direction D2) forming the character having the character color. The area near the right edge includes an inner area TA, an outer area BA, and an intermediate area MA, like the lower edge of FIG. 9A. When edge regions corresponding to a plurality of edge pixels in these regions TA, BA, and MA are target regions, these edge pixels are sequentially selected as target pixels (S405).

内側領域TA内の画素TP5の色は、文字色に近似している。また、画素TP5の周囲範囲AA2は、内側領域TAの画素を多く含むので、周囲範囲AA2の複数個の画素の値の平均値は、文字色に近い。このために、画素TP5は、図9(A)の画素TP1と同様に、判断条件Bを満たす(S415:YES、かつ、S420:YES)ので、文字画素として特定される(S445)。 The color of the pixel TP5 in the inner area TA approximates the character color. Also, since the surrounding area AA2 of the pixel TP5 includes many pixels of the inner area TA, the average value of the values of the plurality of pixels in the surrounding area AA2 is close to the character color. For this reason, the pixel TP5 satisfies the determination condition B (S415: YES and S420: YES) similarly to the pixel TP1 in FIG. 9A, so it is identified as a character pixel (S445).

中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素TP6の色は、背景色よりも文字色に近いが、内側領域TA内の画素の色ほど文字色に近くない。このために、画素TP6は、図9(A)の画素TP2と同様に、判断条件Aを満たす(S415:YES)が、判断条件Bを満たさない(S420:NO)。 The color of the pixel TP6 in the intermediate area MA, which is closer to the inner area TA than the outer area BA, is closer to the character color than the background color, but is not as close to the character color as the color of the pixels in the inner area TA. For this reason, the pixel TP6 satisfies the determination condition A (S415: YES), but does not satisfy the determination condition B (S420: NO), like the pixel TP2 in FIG. 9A.

画素TP6の上側に隣接する画素SP3は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP3は、画素TP6が注目画素として選択される前に、注目画素として選択されて文字画素として特定される。そして、画素TP6の2個下の画素SP4は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP4の色は、背景色に近似していない。このために、画素TP6は、判断条件Cを満たさないと判断される(S425:NO)。 A pixel SP3 adjacent to the upper side of the pixel TP6 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. For this reason, pixel SP3 is selected as a target pixel and specified as a character pixel before pixel TP6 is selected as a target pixel. A pixel SP4 two pixels below the pixel TP6 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. Because of this, the color of pixel SP4 does not approximate the background color. Therefore, it is determined that the pixel TP6 does not satisfy the determination condition C (S425: NO).

さらに、画素TP6の左側に隣接する画素SP5は、内側領域TA内の画素である。画素SP5は、画素TP6が注目画素として選択される前に、注目画素として選択されて文字画素として特定される。画素TP6の2個右の画素SP6は、外側領域BA内の画素である。外側領域BA内の画素SP6の色は、背景色に近似している。このために、画素SP6は、判断条件Dを満たすと判断される(S430:YES)。したがって、画素TP6は、判断条件A、Dの両方を満たすので、文字画素として特定される(S445)。 Furthermore, the pixel SP5 adjacent to the left side of the pixel TP6 is a pixel within the inner area TA. Pixel SP5 is selected as a target pixel and specified as a character pixel before pixel TP6 is selected as a target pixel. A pixel SP6 two pixels to the right of the pixel TP6 is a pixel in the outer area BA. The color of pixel SP6 in outer area BA approximates the background color. Therefore, it is determined that the pixel SP6 satisfies the determination condition D (S430: YES). Accordingly, since pixel TP6 satisfies both of judgment conditions A and D, it is identified as a character pixel (S445).

中間領域MAのうち、内側領域TAよりも外側領域に近い画素TP7の色は、文字色よりも背景色に近い。また、外側領域BA内の画素TP8は、背景色に近似している。このために、図9(A)の画素TP3、TP4と同様に、これらの画素TP7、TP8は、判断条件Aを満たさないので(S415:NO)、文字画素として特定されない。 The color of the pixel TP7, which is closer to the outer area than the inner area TA in the intermediate area MA, is closer to the background color than the character color. Also, the pixel TP8 in the outer area BA approximates the background color. For this reason, like the pixels TP3 and TP4 in FIG. 9A, these pixels TP7 and TP8 do not satisfy the determination condition A (S415: NO), so they are not specified as character pixels.

図10(B)には、図10(A)に示すスキャン画像SI内の領域に対応するフラグデータが示されている。このフラグデータは、文字画素特定処理が終了した時点におけるフラグデータである。図10(B)に示すように、右エッジの近傍では、下エッジの近傍と同様に、文字画素特定処理によって、内側領域TA内の画素(例えば、画素TP5)と、中間領域MAのうち、外側領域BAよりも内側領域TAに近い領域内の画素(例えば、画素TP6)と、が文字画素として特定される。中間領域MAのうち、内側領域TAよりも外側領域BAに近い領域内の画素(例えば、画素TP7)と、外側領域BA内の画素(例えば、画素TP8)と、は、文字画素として特定されない。 FIG. 10B shows flag data corresponding to the area in the scanned image SI shown in FIG. 10A. This flag data is the flag data at the time when the character pixel specifying process is completed. As shown in FIG. 10B, in the vicinity of the right edge, similarly to the vicinity of the lower edge, the character pixel specifying process performs pixels in the inner area TA (for example, pixels TP5) and pixels in the intermediate area MA. Pixels in an area closer to the inner area TA than the outer area BA (for example, pixel TP6) are identified as character pixels. Pixels in the middle area MA that are closer to the outer area BA than the inner area TA (for example, pixel TP7) and pixels in the outer area BA (for example, pixel TP8) are not identified as character pixels.

図11は、文字画素特定処理の第3の説明図である。図11(A)には、文字色の文字を構成する左右方向(第1方向D1)に延びる線の上側のエッジ(上エッジとも呼ぶ)の拡大図が示されている。上エッジの近傍の領域は、図9(A)の下エッジと同様に、内側領域TAと、外側領域BAと、中間領域MAと、を含んでいる。これらの領域TA、BA、MA内の複数個のエッジ画素に対応するエッジ領域が注目領域である場合には、これらのエッジ画素が順次に注目画素として選択される(S405)。 FIG. 11 is a third explanatory diagram of character pixel identification processing. FIG. 11A shows an enlarged view of an upper edge (also referred to as an upper edge) of a line extending in the left-right direction (first direction D1) forming a character in a character color. The area near the upper edge includes an inner area TA, an outer area BA, and an intermediate area MA, like the lower edge in FIG. 9A. When edge regions corresponding to a plurality of edge pixels in these regions TA, BA, and MA are target regions, these edge pixels are sequentially selected as target pixels (S405).

内側領域TA内の画素TP9の色は、文字色に近似している。また、画素TP9の周囲範囲AA3は、内側領域TAの画素を多く含むので、周囲範囲AA3の複数個の画素の値の平均値は、文字色に近い。このために、画素TP9は、図9(A)の画素TP1と同様に、判断条件Bを満たす(S415:YES、かつ、S420:YES)ので、文字画素として特定される(S445)。 The color of the pixel TP9 in the inner area TA approximates the character color. Also, since the surrounding area AA3 of the pixel TP9 includes many pixels of the inner area TA, the average value of the values of the plurality of pixels in the surrounding area AA3 is close to the character color. Therefore, the pixel TP9 satisfies the determination condition B (S415: YES and S420: YES), similarly to the pixel TP1 in FIG. 9A, and is identified as a character pixel (S445).

中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素TP10の色は、背景色よりも文字色に近いが、内側領域TA内の画素の色ほど文字色に近くない。このために、画素TP10は、図9(A)の画素TP2と同様に、判断条件Aを満たす(S415:YES)が、判断条件Bを満たさない(S420:NO)。 In the middle area MA, the color of the pixel TP10 closer to the inner area TA than the outer area BA is closer to the text color than the background color, but not as close to the text color as the color of the pixels in the inner area TA. For this reason, the pixel TP10 satisfies the determination condition A (S415: YES), but does not satisfy the determination condition B (S420: NO), like the pixel TP2 in FIG. 9A.

画素TP10の上側に隣接する画素SP7は、中間領域MAのうち、内側領域TAよりも外側領域BAに近い画素である。このために、画素SP7は、画素TP10が注目画素として選択される前に、注目画素として選択されているが、文字画素として特定されていない。このために、画素TP10は、判断条件Cを満たさないと判断される(S425:NO)。 A pixel SP7 adjacent to the upper side of the pixel TP10 is a pixel closer to the outer area BA than to the inner area TA in the intermediate area MA. For this reason, the pixel SP7 is selected as the pixel of interest before the pixel TP10 is selected as the pixel of interest, but is not specified as a character pixel. Therefore, it is determined that the pixel TP10 does not satisfy the determination condition C (S425: NO).

そして、画素TP10の左側に隣接する画素SP8は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP8は、画素TP10が注目画素として選択される前に、注目画素として選択されて文字画素として特定される。画素TP10の2個右の画素SP9は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP9の色は、背景色に近似していない。このために、画素TP10は、判断条件Dを満たさないと判断される(S430:NO)。 A pixel SP8 adjacent to the left side of the pixel TP10 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. For this reason, pixel SP8 is selected as a target pixel and specified as a character pixel before pixel TP10 is selected as a target pixel. A pixel SP9 two pixels to the right of the pixel TP10 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. Because of this, the color of pixel SP9 does not approximate the background color. Therefore, it is determined that the pixel TP10 does not satisfy the determination condition D (S430: NO).

画素TP10の下側に隣接する画素SP10は、内側領域TA内の画素である。このために、画素SP10の色は、文字色に近似している。また、画素TP10の周囲範囲AA4は、内側領域TAの画素を多く含むので、周囲範囲AA4の複数個の画素の値の平均値は、文字色に近い。このために、画素TP10は、判断条件Eを満たすと判断される(S435:YES)。したがって、画素TP10は、判断条件A、Eの両方を満たすので、文字画素として特定される(S445)。 A pixel SP10 adjacent to the lower side of the pixel TP10 is a pixel in the inner area TA. Therefore, the color of the pixel SP10 approximates the character color. Also, since the surrounding area AA4 of the pixel TP10 includes many pixels of the inner area TA, the average value of the values of the plurality of pixels in the surrounding area AA4 is close to the character color. Therefore, it is determined that the pixel TP10 satisfies the determination condition E (S435: YES). Accordingly, since the pixel TP10 satisfies both the judgment conditions A and E, it is identified as a character pixel (S445).

中間領域MAのうち、内側領域TAよりも外側領域に近い画素TP11の色は、文字色よりも背景色に近い。また、外側領域BA内の画素TP12は、背景色に近似している。このために、図9(A)の画素TP3、TP4と同様に、これらの画素TP11、TP12の値は、判断条件Aを満たさないので(S415:NO)、文字画素として特定されない。 In the intermediate area MA, the color of the pixel TP11 closer to the outer area than the inner area TA is closer to the background color than the character color. Also, the pixel TP12 in the outer area BA approximates the background color. For this reason, like the pixels TP3 and TP4 in FIG. 9A, the values of these pixels TP11 and TP12 do not satisfy the determination condition A (S415: NO), so they are not identified as character pixels.

図11(B)には、図11(A)に示すスキャン画像SI内の領域に対応するフラグデータが示されている。このフラグデータは、文字画素特定処理が終了した時点におけるフラグデータである。図11(B)に示すように、上エッジの近傍では、下エッジの近傍と同様に、文字画素特定処理によって、内側領域TA内の画素(例えば、画素TP9)と、中間領域MAのうち、外側領域BAよりも内側領域TAに近い領域内の画素(例えば、画素TP10)と、が文字画素として特定される。中間領域MAのうち、内側領域TAよりも外側領域BAに近い領域内の画素(例えば、画素TP11)と、外側領域BA内の画素(例えば、画素TP12)と、は、文字画素として特定されない。 FIG. 11B shows flag data corresponding to the area in the scanned image SI shown in FIG. 11A. This flag data is the flag data at the time when the character pixel specifying process is completed. As shown in FIG. 11(B), in the vicinity of the upper edge, similarly to the vicinity of the lower edge, the character pixel specifying process performs pixels in the inner area TA (for example, pixels TP9) and pixels in the intermediate area MA. Pixels in an area closer to the inner area TA than the outer area BA (for example, the pixel TP10) are identified as character pixels. Pixels in the intermediate area MA that are closer to the outer area BA than the inner area TA (for example, pixel TP11) and pixels in the outer area BA (for example, pixel TP12) are not identified as character pixels.

図12は、文字画素特定処理の第4の説明図である。図12(B)には、文字色の文字を構成する上下方向(第2方向D2)に延びる線の左側のエッジ(左エッジとも呼ぶ)の拡大図が示されている。左エッジの近傍の領域は、図9(A)の下エッジと同様に、内側領域TAと、外側領域BAと、中間領域MAと、を含んでいる。これらの領域TA、BA、MA内の複数個の画素のいずれかが、注目画素である場合には、S410にて、該注目画素は、エッジ画素であると判断される(S410:YES)。 FIG. 12 is a fourth explanatory diagram of character pixel identification processing. FIG. 12B shows an enlarged view of the left edge (also referred to as the left edge) of the line extending in the vertical direction (second direction D2) forming the character of the character color. The area near the left edge includes an inner area TA, an outer area BA, and an intermediate area MA, like the lower edge of FIG. 9A. If any of the plurality of pixels in these areas TA, BA, MA is the pixel of interest, it is determined in S410 that the pixel of interest is the edge pixel (S410: YES).

内側領域TA内の画素TP13の色は、文字色に近似している。また、画素TP13の周囲範囲AA5は、内側領域TAの画素を多く含むので、周囲範囲AA5の複数個の画素の値の平均値は、文字色に近い。このために、画素TP13は、図9(A)の画素TP1と同様に、判断条件Bを満たす(S415:YES、かつ、S420:YES)ので、文字画素として特定される(S445)。 The color of the pixel TP13 in the inner area TA approximates the character color. Also, since the surrounding area AA5 of the pixel TP13 includes many pixels of the inner area TA, the average value of the values of the plurality of pixels in the surrounding area AA5 is close to the character color. Therefore, the pixel TP13 satisfies the determination condition B (S415: YES and S420: YES), similarly to the pixel TP1 in FIG. 9A, and is identified as a character pixel (S445).

中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素TP14の色は、背景色よりも文字色に近いが、内側領域TA内の画素の色ほど文字色に近くない。このために、画素TP14は、図9(A)の画素TP2と同様に、判断条件Aを満たす(S415:YES)が、判断条件Bを満たさないと判断される(S420:NO)。 The color of the pixel TP14 in the intermediate area MA, which is closer to the inner area TA than the outer area BA, is closer to the character color than the background color, but is not as close to the character color as the color of the pixels in the inner area TA. Therefore, it is determined that the pixel TP14 satisfies the determination condition A (S415: YES) but does not satisfy the determination condition B (S420: NO), like the pixel TP2 in FIG. 9A.

画素TP14の上側に隣接する画素SP11は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP11は、画素TP14が注目画素として選択される前に、注目画素として選択されて文字画素として特定される。そして、画素TP10の2個下の画素SP12は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP12の色は、背景色に近似していない。このために、画素TP14は、判断条件Cを満たさないと判断される(S425:NO) The pixel SP11 adjacent to the upper side of the pixel TP14 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. For this reason, the pixel SP11 is selected as a target pixel and specified as a character pixel before the pixel TP14 is selected as a target pixel. A pixel SP12 two pixels below the pixel TP10 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. For this reason, the color of pixel SP12 does not approximate the background color. Therefore, it is determined that the pixel TP14 does not satisfy the determination condition C (S425: NO).

そして、画素TP14の左側に隣接する画素SP13は、中間領域MAのうち、内側領域TAよりも外側領域BAに近い画素である。このために、画素SP13は、画素TP10が注目画素として選択される前に、注目画素として選択されるが、文字画素として特定されない。このために、画素TP14は、判断条件Dを満たさないと判断される(S430:NO)。 A pixel SP13 adjacent to the left side of the pixel TP14 is a pixel closer to the outer area BA than to the inner area TA in the intermediate area MA. For this reason, the pixel SP13 is selected as the pixel of interest before the pixel TP10 is selected as the pixel of interest, but is not identified as a character pixel. Therefore, it is determined that the pixel TP14 does not satisfy the determination condition D (S430: NO).

画素TP14の下側に隣接する画素SP14は、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素である。このために、画素SP14の色は、背景色よりも文字色に近いが、内側領域TA内の画素の色ほど文字色に近くない。このために、画素TP14は、判断条件Eを満たさないと判断される(S435:NO)。 A pixel SP14 adjacent to the lower side of the pixel TP14 is a pixel closer to the inner area TA than to the outer area BA in the intermediate area MA. For this reason, the color of the pixel SP14 is closer to the text color than the background color, but not as close to the text color as the color of the pixels in the inner area TA. Therefore, it is determined that the pixel TP14 does not satisfy the determination condition E (S435: NO).

画素TP14の右側に隣接する画素SP15は、内側領域TA内の画素である。このために、画素SP15の色は、文字色に近似している。また、画素TP15の周囲範囲AA6は、内側領域TAの画素を多く含むので、周囲範囲AA6の複数個の画素の値の平均値は、文字色に近い。このために、画素TP14は、判断条件Fを満たすと判断される(S440:YES)。したがって、画素TP14は、判断条件A、Fの両方を満たすので、文字画素として特定される(S445)。 A pixel SP15 adjacent to the right side of the pixel TP14 is a pixel within the inner area TA. Therefore, the color of the pixel SP15 approximates the character color. Also, since the surrounding area AA6 of the pixel TP15 includes many pixels of the inner area TA, the average value of the values of the plurality of pixels in the surrounding area AA6 is close to the character color. Therefore, it is determined that the pixel TP14 satisfies the determination condition F (S440: YES). Accordingly, since pixel TP14 satisfies both of judgment conditions A and F, it is identified as a character pixel (S445).

図12(B)には、図12(A)に示すスキャン画像SI内の領域に対応するフラグデータが示されている。このフラグデータは、文字画素特定処理が終了した時点におけるフラグデータである。図12(B)に示すように、上エッジの近傍では、下エッジの近傍と同様に、文字画素特定処理によって、内側領域TA内の画素(例えば、画素TP13)と、中間領域MAのうち、外側領域BAよりも内側領域TAに近い領域内の画素(例えば、画素TP14)と、が文字画素として特定される。中間領域MAのうち、内側領域TAよりも外側領域BAに近い領域内の画素(例えば、画素TP15)と、外側領域BA内の画素(例えば、画素TP16)と、は、文字画素として特定されない。 FIG. 12(B) shows flag data corresponding to the area in the scanned image SI shown in FIG. 12(A). This flag data is the flag data at the time when the character pixel specifying process is completed. As shown in FIG. 12(B), in the vicinity of the upper edge, similarly to the vicinity of the lower edge, the character pixel specifying process performs pixels in the inner area TA (for example, the pixel TP13) and pixels in the intermediate area MA. Pixels in an area closer to the inner area TA than the outer area BA (for example, pixel TP14) are identified as character pixels. Pixels in the middle area MA that are closer to the outer area BA than the inner area TA (for example, pixel TP15) and pixels in the outer area BA (for example, pixel TP16) are not specified as character pixels.

以上の図9~図12の説明から解るように、背景色を有する背景上に位置する文字色を有する文字において、内側領域TA内の画素、および、中間領域MAのうち、外側領域BAよりも内側領域TAに近い画素は、上記(1)~(5)の場合のうちのいずれかに該当するために、文字画素として特定される。また、外側領域BA内の画素、および、中間領域MA、内側領域TAよりも外側領域BAに近い画素は、上記(1)~(5)の場合のうちのいずれかにも該当しないために、文字画素として特定されない。この結果、文字画素を適切に特定することができる。なお、文字色以外の文字のエッジ近傍の画素は、第1文字色範囲、および、第2文字色範囲内の画素の値を有さないので、判断条件A、Bを満たさないので、文字画素として特定されない。また、文字色の文字であっても、背景が背景色でない文字のエッジ近傍の画素は、周囲領域の画素の平均値が文字色に近似しない、あるいは、外側に2個離れた画素の色が背景色に近似しない。このために、当該エッジ近傍の画素は、文字画素として特定されない。 As can be seen from the above descriptions of FIGS. 9 to 12, in a character having a character color positioned on a background having a background color, pixels in the inner area TA and the pixels in the intermediate area MA are larger than the pixels in the outer area BA. Pixels close to the inner area TA are specified as character pixels because they correspond to any of the above cases (1) to (5). In addition, since the pixels in the outer area BA and the pixels closer to the outer area BA than the intermediate area MA and the inner area TA do not correspond to any of the above cases (1) to (5), Not identified as a character pixel. As a result, character pixels can be appropriately specified. Pixels in the vicinity of the edge of a character other than the character color do not have pixel values within the first character color range and the second character color range. not specified as Also, even if the character has a character color, for pixels near the edge of the character whose background is not the background color, the average value of the pixels in the surrounding area does not approximate the character color, or the color of the pixels two pixels away from the outside is different. Do not match the background color. For this reason, pixels near the edge are not identified as character pixels.

以上説明した図8の文字画素特定処理によれば、第1方向D1に並ぶ画素SP5、TP6、SPa(図10(A))についての処理、および、第1方向D1に並ぶ画素SP13、TP14、SP15(図12(A))についての処理から解るように、対象画素A(例えば、画素SP5、SP13)が、対象画素Aに対して第1方向D1に隣接する対象画素B(例えば、画素TP6、TP14)や、対象画素Bに対して第1方向D1に隣接する対象画素C(例えば、画素SPa、SP15)よりも先に注目画素とされる。このため、先ず、CPU210は、対象画素A(例えば、画素SP5、SP13)が文字画素であるか否かを特定する(S415~S445)。そして、その後に、対象画素B(例えば、画素TP6、TP14)が注目画素とされた際に、CPU210は、対象画素Aが文字画素として特定されたことを含む判断条件Dを満たすか否かを判断し(S430)、判断条件Dが満たされる場合に(S430:YES、図10(A))、対象画素B(例えば、画素TP6)を文字画素として特定する(S445、図10(A))。そして、判断条件Dが満たされない場合に(S430:NO)、CPU210は、対象画素C(例えば、画素SP15)の値が、第2文字色範囲内であることを含む判断条件Fを満たすか否かを判断する(S440)。CPU210は、判断条件Fが満たされる場合に(S440:YES)、対象画素B(例えば、画素TP14)を、文字画素として特定する(S445)。この結果、判断条件Dが満たされる場合には、判断条件Fについて判断することなく、対象画素Bを文字画素として特定できる。この結果、対象画素Aが文字画素として特定された場合には、対象画素Aが文字画素として特定されたことに基づいて、対象画素Bを、文字画素として効率良く特定することができる。換言すれば、既に文字画素であるか否かを判断済みの対象画素A(例えば、画素SP5)の特定結果を用いて、対象画素B(例えば、画素TP6)を文字画素として特定可能である場合には、未判断の対象画素C(例えば、画素SPa)について、何ら条件を判断することなく、対象画素Bを文字画素として特定可能であるので、対象画素Bを、文字画素として効率良く特定することができる。 According to the character pixel specifying process of FIG. 8 described above, the pixels SP5, TP6, and SPa (FIG. 10A) aligned in the first direction D1 are processed, and the pixels SP13, TP14, As can be seen from the processing of SP15 (FIG. 12A), the target pixel A (eg, pixels SP5 and SP13) is adjacent to the target pixel B (eg, pixel TP6) adjacent to the target pixel A in the first direction D1. , TP14) and the target pixel C adjacent to the target pixel B in the first direction D1 (for example, the pixels SPa and SP15). Therefore, the CPU 210 first identifies whether or not the target pixel A (eg, pixels SP5 and SP13) is a character pixel (S415 to S445). After that, when the target pixel B (for example, the pixels TP6 and TP14) is set as the target pixel, the CPU 210 determines whether or not the determination condition D including that the target pixel A is specified as a character pixel is satisfied. If the determination condition D is satisfied (S430: YES, FIG. 10A), the target pixel B (for example, pixel TP6) is identified as a character pixel (S445, FIG. 10A). . Then, if the determination condition D is not satisfied (S430: NO), the CPU 210 determines whether the value of the target pixel C (for example, the pixel SP15) satisfies the determination condition F including that the value is within the second character color range. (S440). When the determination condition F is satisfied (S440: YES), the CPU 210 identifies the target pixel B (for example, the pixel TP14) as a character pixel (S445). As a result, when the determination condition D is satisfied, the target pixel B can be identified as a character pixel without determining the determination condition F. As a result, when the target pixel A is specified as a character pixel, the target pixel B can be efficiently specified as a character pixel based on the fact that the target pixel A is specified as a character pixel. In other words, the target pixel B (for example, pixel TP6) can be identified as a character pixel using the identification result of target pixel A (for example, pixel SP5) for which it has already been determined whether or not it is a character pixel. Since it is possible to specify the target pixel B as a character pixel without judging any conditions for the undetermined target pixel C (for example, the pixel SPa), the target pixel B can be efficiently specified as a character pixel. be able to.

同様にして、第2方向D2に並ぶ画素SP1、TP2、SPb(図9(A))についての処理、および、第2方向D2に並ぶ画素SP7、TP10、SP10(図11(A))についての処理から解るように、対象画素D(例えば、画素SP1、SP7)が、対象画素Dに対して第2方向D2に隣接する対象画素E(例えば、画素TP2、TP10)や、対象画素Eに対して第2方向D2に隣接する対象画素F(例えば、画素SPb、SP10)よりも先に注目画素とされる。このため、先ず、CPU210は、対象画素D(例えば、画素SP1、SP7)が文字画素であるか否かを特定する(S4150~S145)。そして、その後に、対象画素E(例えば、画素TP2、TP10)が注目画素とされた際に、CPU210は、対象画素Dが文字画素として特定されたことを含む判断条件Cを満たすか否かを判断し(S425)、判断条件Cが満たされる場合に(S425:YES、図9(A))、対象画素E(例えば、画素TP2)を文字画素として特定する(S445、図9(A))。そして、判断条件Cが満たされない場合に(S425:NO)、CPU210は、対象画素F(例えば、画素SP10)の値が、第2文字色範囲内であることを含む判断条件Eを満たすか否かを判断する(S435)。CPU210は、判断条件Eが満たされる場合に(S435:YES)、対象画素E(例えば、画素TP10)を、文字画素として特定する(S445)。この結果、判断条件Cが満たされる場合には、判断条件Eについて判断することなく、対象画素Eを文字画素として特定できる。この結果、対象画素Dが文字画素として特定された場合には、対象画素Dが文字画素として特定されたことに基づいて、対象画素Eを、文字画素として効率良く特定することができる。換言すれば、既に文字画素であるか否かを判断済みの対象画素D(例えば、画素SP1)の特定結果を用いて、対象画素E(例えば、画素TP2)を文字画素として特定可能である場合には、未判断の対象画素C(例えば、画素SPb)について、何ら条件を判断することなく、対象画素Eを文字画素として特定可能であるので、対象画素Eを、文字画素として効率良く特定することができる。 Similarly, pixels SP1, TP2, and SPb (FIG. 9A) aligned in the second direction D2 are processed, and pixels SP7, TP10, and SP10 aligned in the second direction D2 (FIG. 11A) are processed. As can be seen from the processing, the target pixel D (for example, pixels SP1 and SP7) is adjacent to the target pixel D in the second direction D2, and the target pixel E (for example, pixels TP2 and TP10) is adjacent to the target pixel E. Therefore, the target pixel F (for example, the pixels SPb and SP10) adjacent in the second direction D2 is selected as the target pixel. Therefore, the CPU 210 first identifies whether or not the target pixel D (eg, pixels SP1 and SP7) is a character pixel (S4150 to S145). After that, when the target pixel E (for example, the pixels TP2 and TP10) is set as the target pixel, the CPU 210 determines whether or not the determination condition C including that the target pixel D is specified as a character pixel is satisfied. If judgment is made (S425), and judgment condition C is satisfied (S425: YES, FIG. 9A), target pixel E (for example, pixel TP2) is identified as a character pixel (S445, FIG. 9A). . Then, if the determination condition C is not satisfied (S425: NO), the CPU 210 determines whether the value of the target pixel F (for example, the pixel SP10) satisfies the determination condition E including that the value is within the second character color range. (S435). When the determination condition E is satisfied (S435: YES), the CPU 210 identifies the target pixel E (for example, the pixel TP10) as a character pixel (S445). As a result, when the judgment condition C is satisfied, the target pixel E can be specified as a character pixel without judging the judgment condition E. As a result, when the target pixel D is specified as a character pixel, the target pixel E can be efficiently specified as a character pixel based on the fact that the target pixel D is specified as a character pixel. In other words, the target pixel E (for example, pixel TP2) can be specified as a character pixel using the result of specifying the target pixel D (for example, pixel SP1) for which it has already been determined whether or not it is a character pixel. Since the target pixel E can be identified as a character pixel without judging any conditions for the target pixel C (for example, the pixel SPb) that has not yet been determined, the target pixel E can be efficiently identified as a character pixel. be able to.

さらに、上記文字画素特定処理によれば、CPU210は、複数個のエッジ画素のそれぞれを注目画素として、該注目画素の値が、第1文字色範囲内であることを含む判断条件Aを満たすか否かを判断する(図8のS415)。CPU210は、該注目画素が、判断条件Aを満たす場合に(S415:YES)、周囲領域内の画素などの周辺画素の値に基づく条件を含む判断条件B~Fの少なくとも1つを満たすか否かを判断する(S420~S440)。CPU210は、該注目画素が、判断条件B~Fの少なくとも1つを満たす場合に(S420~S440のいずれかにてYES)、該注目画素を、文字画素として特定する(S445)。CPU210は、該注目画素が、判断条件Aを満たさない場合に(S415:NO)、判断条件B~Fのいずれも判断しない。判断条件Aを満たさない場合、すなわち、注目画素の値が、第1文字色範囲内でない場合には、注目画素は、文字画素として特定すべきでないことは明らかである。このために、上述のように、判断条件Aを、他の判断条件B~Fよりも先に判断して、該判断条件Aを満たさない場合には、他の判断条件B~Fについては、何ら判断を行うことなく、文字画素として特定しないことによって、効率良く、文字画素を特定できる。 Furthermore, according to the character pixel specifying process, the CPU 210 determines whether each of the plurality of edge pixels is a pixel of interest and whether the value of the pixel of interest satisfies the determination condition A including that the value of the pixel of interest is within the first character color range. It is determined whether or not (S415 in FIG. 8). When the target pixel satisfies the determination condition A (S415: YES), the CPU 210 determines whether at least one of the determination conditions B to F including the conditions based on the values of the surrounding pixels such as the pixels in the surrounding area is satisfied. (S420-S440). When the pixel of interest satisfies at least one of determination conditions B to F (YES in any one of S420 to S440), CPU 210 identifies the pixel of interest as a character pixel (S445). When the target pixel does not satisfy the determination condition A (S415: NO), the CPU 210 does not determine any of the determination conditions B to F. If the determination condition A is not satisfied, that is, if the value of the pixel of interest is not within the first character color range, it is clear that the pixel of interest should not be specified as a character pixel. For this reason, as described above, the judgment condition A is judged before the other judgment conditions B to F, and if the judgment condition A is not satisfied, the other judgment conditions B to F are: Character pixels can be efficiently identified by not identifying them as character pixels without making any judgments.

A-5.背景画素特定処理
図2のS30の背景画素特定処理について説明する。図13は、背景画素特定処理のフローチャートである。S500では、CPU210は、スキャンデータの第1方向D1および第2方向D2の読取解像度(単位は、dpi(dot per inch))に応じて、確認画素数Mの値を設定する。確認画素数Mは、注目画素から、確認方向に向かって、背景画素として特定するか否かの確認を行う画素の個数であり、1以上の自然数である。本実施例では、第1方向D1の読取解像度に応じた確認画素数M1と、第2方向D2の読取解像度に応じた確認画素数M2と、をそれぞれ設定する。確認画素数Mは、読取解像度が高いほど、大きな値に設定される。例えば、確認画素数Mは、読取解像度をR(単位は、dpi)とした場合に、(R/300)の値の小数点以下を切り捨てた値に決定される。例えば、確認画素数Mは、読取解像度が600dpiである場合には、「2」に設定され、読取解像度が1200dpiである場合には、「4」に設定される。
A-5. Background Pixel Specifying Process The background pixel specifying process of S30 in FIG. 2 will be described. FIG. 13 is a flowchart of background pixel identification processing. In S500, the CPU 210 sets the value of the confirmation pixel number M according to the reading resolution (unit: dpi (dot per inch)) in the first direction D1 and the second direction D2 of the scan data. The confirmation pixel count M is the number of pixels for which it is confirmed whether or not to specify them as background pixels in the confirmation direction from the pixel of interest, and is a natural number of 1 or more. In this embodiment, the confirmed pixel number M1 corresponding to the reading resolution in the first direction D1 and the confirmed pixel number M2 corresponding to the reading resolution in the second direction D2 are set. The confirmation pixel number M is set to a larger value as the reading resolution is higher. For example, when the reading resolution is R (unit: dpi), the confirmed pixel number M is determined by truncating the value of (R/300) after the decimal point. For example, the confirmed pixel number M is set to "2" when the reading resolution is 600 dpi, and is set to "4" when the reading resolution is 1200 dpi.

S505では、CPU210は、注目領域を構成する複数個のエッジ画素のうち、文字画素特定処理において特定された2以上の文字画素から、1個の注目画素を選択する。 In S505, the CPU 210 selects one pixel of interest from the two or more character pixels specified in the character pixel specifying process, among the plurality of edge pixels forming the region of interest.

文字画素であるか否かは、文字画素特定処理で作成されたフラグデータを参照して判断される。 Whether or not it is a character pixel is determined by referring to the flag data created by the character pixel specifying process.

S515では、CPU210は、上下左右の4方向の中から、1つの確認方向を選択する。S530では、CPU210は、注目画素から確認方向にM個先の画素は、文字画素であるか否かを判断する。M個先の画素が文字画素であるか否かは、文字画素特定処理で作成されたフラグデータを参照して判断される。 In S515, the CPU 210 selects one confirmation direction from the four directions of up, down, left, and right. In S530, the CPU 210 determines whether or not the pixel M pixels ahead in the confirmation direction from the pixel of interest is a character pixel. Whether or not the pixel M pixels ahead is a character pixel is determined by referring to the flag data created in the character pixel specifying process.

図14は、背景画素特定処理の第1の説明図である。図14(A)には、図9(A)と同様の下エッジの拡大図が示されている。図14(B)には、図14(A)に示すスキャン画像SI内の領域に対応するフラグデータが示されている。このフラグデータは、背景画素特定処理が終了した時点におけるフラグデータである。 FIG. 14 is a first explanatory diagram of the background pixel specifying process. FIG. 14(A) shows an enlarged view of the bottom edge similar to FIG. 9(A). FIG. 14B shows flag data corresponding to the area in the scanned image SI shown in FIG. 14A. This flag data is the flag data at the time when the background pixel specifying process is completed.

確認方向が図14(A)の左方向(第1方向D1の反対方向)または右方向(第1方向D1)である場合には、確認画素数Mの値は、第1方向D1の確認画素数M1である。確認方向が図14(A)の上方向(第2方向D2の反対方向)または下方向(第2方向D2)である場合には、確認画素数Mの値は、第2方向D2の確認画素数M2である。ここでは、図14(A)には、確認画素数M1、M2の両方が、「2」である場合を示している。 When the checking direction is the left direction (opposite direction of the first direction D1) or the right direction (the first direction D1) in FIG. number M1. When the confirmation direction is the upward direction (the direction opposite to the second direction D2) or the downward direction (the second direction D2) in FIG. number M2. Here, FIG. 14A shows a case where both of the confirmed pixel numbers M1 and M2 are "2".

注目画素が、画素TP17であり、確認方向が上方向である場合には、画素SP16が文字画素であるか否かが判断される。同様に、注目画素が、画素TP17であり、確認方向が下方向、左方向、右方向である場合には、それぞれ、画素SP17、SP18、SP19が文字画素であるか否かが判断される。図14(A)の例では、注目画素が、画素TP17であり、確認方向が上方向、左方向、右方向である場合には、M個(図14(A)の例では2個)先の画素SP16、SP18、SP19は、それぞれ、文字画素であると判断される。注目画素が、画素TP17であり、確認方向が下方向である場合に、M個先の画素SP17は、文字画素でないと判断される。 If the target pixel is the pixel TP17 and the confirmation direction is upward, it is determined whether or not the pixel SP16 is a character pixel. Similarly, when the pixel of interest is pixel TP17 and the confirmation direction is downward, leftward, or rightward, it is determined whether or not pixels SP17, SP18, and SP19 are character pixels. In the example of FIG. 14A, when the pixel of interest is the pixel TP17 and the confirmation direction is upward, leftward, or rightward, M (two in the example of FIG. 14A) first pixels SP16, SP18, and SP19 are determined to be character pixels. If the pixel of interest is the pixel TP17 and the confirmation direction is downward, the pixel SP17 Mth ahead is determined not to be a character pixel.

M個先の画素は、文字画素である場合には(S530:YES)、CPU210は、S555に処理を進める。M個先の画素が、文字画素でない場合には(S530:NO)、CPU210は、S535に処理を進める。 If the M pixel ahead is a character pixel (S530: YES), the CPU 210 advances the process to S555. If the M pixel ahead is not a character pixel (S530: NO), the CPU 210 advances the process to S535.

S535では、CPU210は、注目画素から確認方向にM個先の画素の値は、背景色範囲内であるか否かを判断する。背景色範囲は、上述した式(5)を満たす範囲である。該画素SP17は、外側領域BA内の画素であるので、背景色に近似している。このために、M個先の画素が、図14(A)の画素SP17である場合には、該画素SP17の値は、背景色範囲内であると判断される。 In S535, the CPU 210 determines whether or not the value of the pixel M pixels ahead in the confirmation direction from the pixel of interest is within the background color range. The background color range is a range that satisfies Equation (5) above. Since the pixel SP17 is a pixel within the outer area BA, it approximates the background color. For this reason, when the M pixels ahead is the pixel SP17 in FIG. 14A, the value of the pixel SP17 is determined to be within the background color range.

M個先の画素の値が、背景色範囲内である場合には(S535:YES)、CPU210は、S540に処理を進める。M個先の画素の値が、背景色範囲内でない場合には(S535:NO)、CPU210は、S555に処理を進める。 If the value of the pixel after M is within the background color range (S535: YES), the CPU 210 advances the process to S540. If the value of the pixel after M is not within the background color range (S535: NO), the CPU 210 advances the process to S555.

S540では、CPU210は、注目画素から確認方向にM個先の画素を背景画素として特定する。このために、この場合には、CPU210は、フラグデータにおいて、注目画素に対応するフラグの値を、背景画素を示す値(本実施例では、「2」)に更新する。M個先の画素が、図14(A)の画素SP17である場合には、画素SP17は、背景画素として特定される。 In S540, the CPU 210 identifies M pixels ahead of the pixel of interest in the checking direction as background pixels. Therefore, in this case, the CPU 210 updates the value of the flag corresponding to the pixel of interest in the flag data to the value indicating the background pixel (“2” in this embodiment). If the M pixels ahead is the pixel SP17 in FIG. 14A, the pixel SP17 is identified as the background pixel.

S545では、CPU210は、注目画素と、注目画素から確認方向にM個先の画素と、の間に、文字画素とは異なる画素があるか否かを判断する。注目画素が、図14(A)の画素TP17であり、M個先の画素が、画素SP17である場合には、該画素TP17と画素SP17との間には、1個の画素SP20がある。画素SP20は、文字画素として特定されていない(図14(B))ので、文字画素とは異なる画素があると判断される。仮に、確認画素数Mが「4」である場合には、注目画素と、4個先の画素と、の間には、3個の画素がある。一般的には、注目画素と、確認方向にM個先の画素と、の間には、確認方向に沿って並ぶ(M-1)個の画素がある。本ステップでは、該(M-1)個の画素に、少なくとも1個の文字画素とは異なる画素があるか否かが判断される。 In S545, the CPU 210 determines whether or not there is a pixel different from the character pixel between the pixel of interest and the pixel M-th ahead from the pixel of interest in the checking direction. When the pixel of interest is the pixel TP17 in FIG. 14A and the pixel M pixels ahead is the pixel SP17, there is one pixel SP20 between the pixel TP17 and the pixel SP17. Since the pixel SP20 is not specified as a character pixel (FIG. 14B), it is determined that there is a pixel different from the character pixel. If the confirmed pixel number M is "4", there are three pixels between the pixel of interest and the pixel four pixels ahead. In general, there are (M−1) pixels arranged along the confirmation direction between the pixel of interest and the pixel that is M pixels ahead in the confirmation direction. In this step, it is determined whether or not the (M-1) pixels include at least one pixel different from the character pixel.

注目画素とM個先の画素との間に、文字画素とは異なる画素がある場合には(S545:YES)、CPU210は、S550に処理を進める。注目画素とM個先の画素との間に、文字画素とは異なる画素がない場合には(S545:NO)、S555に処理を進める。 If there is a pixel different from the character pixel between the pixel of interest and the pixel M pixels ahead (S545: YES), the CPU 210 advances the process to S550. If there is no pixel different from the character pixel between the pixel of interest and the pixels Mth ahead (S545: NO), the process proceeds to S555.

S550では、CPU210は、注目画素とM個先の画素との間の文字画素とは異なる画素を背景画素として特定する。このために、この場合には、CPU210は、フラグデータにおいて、注目画素とM個先の画素との間の文字画素とは異なる画素に対応するフラグの値を、背景画素を示す値(本実施例では、「2」)に更新する。M個先の画素が、図14(A)の画素SP17である場合には、画素SP17は、背景画素として特定される。注目画素が、図14(A)の画素TP17であり、M個先の画素が、画素SP17である場合には、該画素TP17と画素SP17との間の1個の画素SP20が、背景画素として特定される。 In S550, the CPU 210 identifies, as background pixels, pixels that are different from character pixels between the pixel of interest and M pixels ahead. Therefore, in this case, in the flag data, the CPU 210 changes the value of the flag corresponding to the pixel different from the character pixel between the pixel of interest and the pixel M pixels ahead to the value indicating the background pixel (this embodiment In the example, it is updated to "2"). If the M pixels ahead is the pixel SP17 in FIG. 14A, the pixel SP17 is identified as the background pixel. When the pixel of interest is the pixel TP17 in FIG. 14A and the pixel M pixels ahead is the pixel SP17, one pixel SP20 between the pixel TP17 and the pixel SP17 is used as a background pixel. identified.

S555では、CPU210は、上下左右の4方向を全て確認したか否かを判断する。未確認の方向がある場合には(S555:NO)、CPU210は、S515に戻って、未確認の方向を確認方向に設定する。4方向を確認した場合には(S555:YES)、CPU210は、S560に処理を進める。 In S555, the CPU 210 determines whether or not all four directions of up, down, left, and right have been confirmed. If there is an unconfirmed direction (S555: NO), the CPU 210 returns to S515 and sets the unconfirmed direction as the confirmed direction. If four directions have been confirmed (S555: YES), the CPU 210 advances the process to S560.

S560では、CPU210は、注目領域内の全ての文字画素を注目画素として処理したか否かを判断する。未処理の文字画素がある場合には(S560:NO)、CPU210は、S505に戻って、未処理の文字画素を注目画素として選択する。全ての文字画素が処理された場合には(S560:YES)、CPU210は、背景画素特定処理を終了する。 In S560, the CPU 210 determines whether or not all the character pixels in the target area have been processed as target pixels. If there is an unprocessed character pixel (S560: NO), the CPU 210 returns to S505 and selects the unprocessed character pixel as the target pixel. When all the character pixels have been processed (S560: YES), the CPU 210 terminates the background pixel specifying process.

以上の説明から解るように、背景画素特定処理において、文字画素から所定の確認方向にM個先の画素(例えば、図14(A)の画素SP17)が、文字画素でなく、かつ、その値が背景色範囲内である場合に、背景画素として特定される(S530~S540)。換言すれば、M個先の画素が、文字画素とは異なる色を有するべき画素であり、かつ、文字色よりも背景色に近い色を有する場合に、該M個先の画素は、背景画素として特定される。この結果、文字画素の周辺の画素の中から適切に背景画素を特定することができる。例えば、文字のエッジ上の文字画素の周辺の背景を示す画素を適切に背景画素として特定することができる。 As can be seen from the above description, in the background pixel specifying process, the pixel M pixels ahead of the character pixel in the predetermined confirmation direction (for example, the pixel SP17 in FIG. 14A) is not a character pixel, and its value is is within the background color range, it is identified as a background pixel (S530-S540). In other words, if the M-th pixel ahead is a pixel that should have a different color from the character pixel and has a color closer to the background color than the character color, then the M-th pixel ahead is the background pixel. identified as As a result, the background pixels can be appropriately specified from among the pixels surrounding the character pixels. For example, pixels representing the background around character pixels on the edge of the character can be appropriately identified as background pixels.

文字画素と、背景画素と、の間の画素が、背景画素とも文字画素とも異なる画素であると、文字色と背景色との境界が鮮明にならない可能性がある。本実施例では、文字画素からM個先の画素、すなわち、文字画素から特定方向にM個(Mは、2以上の整数)の画素分だけ離れた画素が背景画素として特定された場合には、該特定方向に沿って該文字画素と、該M個の画素分だけ離れた画素と、の間に位置する(M-1)個の中間画素は、その画素が、文字画素でない場合に、該中間画素の値に関わらずに、背景画素として特定される(S545、S550)。この結果、文字画素と、背景画素と、の間の画素が、背景画素とも文字画素とも異なる画素であると判断されることを抑制できる。したがって、文字色と背景色との境界をより効果的に強調できる。 If the pixels between the character pixels and the background pixels are different from the background pixels and the character pixels, there is a possibility that the boundary between the character color and the background color will not be clear. In this embodiment, when a pixel M pixels ahead of a character pixel, that is, a pixel separated by M pixels (M is an integer equal to or greater than 2) in a specific direction from a character pixel is specified as a background pixel, , and the (M−1) intermediate pixels located between the character pixel and the pixel separated by M pixels along the specific direction, if the pixel is not a character pixel, Regardless of the value of the intermediate pixel, it is identified as a background pixel (S545, S550). As a result, it is possible to prevent the pixels between the character pixels and the background pixels from being determined to be pixels different from the background pixels and the character pixels. Therefore, the boundary between the character color and the background color can be emphasized more effectively.

このように、文字画素の周辺画素、具体的には、文字画素との距離がM画素以内の画素は、該画素が文字画素でないことを含む特定条件を満たすか否かが判断され、該特定条件を満たす場合には、背景画素として特定される。一方、文字画素に対して上記周辺画素よりも離れた位置にある複数個の遠方画素(例えば、図14(A)の画素SP21)、具体的には、文字画素との距離がM画素を超える画素は、該特定条件については判断されない。 In this way, it is determined whether or not peripheral pixels of a character pixel, specifically, pixels within a distance of M pixels from a character pixel, satisfy a specific condition including that the pixel is not a character pixel, and the specific condition is determined. If the condition is satisfied, it is specified as a background pixel. On the other hand, a plurality of distant pixels (for example, pixel SP21 in FIG. 14A) located further away from the character pixel than the surrounding pixels, specifically, the distance from the character pixel exceeds M pixels. Pixels are not judged for that particular condition.

この結果、図14(B)に示すように、中間領域MAのうち、内側領域TAより外側領域BAに近い複数個の画素(例えば、図14(A)の画素SP20)が、背景画素として特定される(対応するフラグ=2)。これらの画素は、中間領域MA内の複数個の画素のうち、文字画素に隣接する画素であって、文字画素として特定されていない画素である。また、外側領域BAのうち、中間領域MAと隣接する複数個の画素(例えば、図14(A)の画素SP17)が、背景画素として特定される(対応するフラグ=2)。また、外側領域BAのうち、文字画素から3画素以上離れた複数個の画素(例えば、図14(A)の画素SP21)は、背景画素にも文字画素にも特定されない(対応するフラグ=0)。 As a result, as shown in FIG. 14B, a plurality of pixels closer to the outer area BA than the inner area TA in the intermediate area MA (for example, the pixel SP20 in FIG. 14A) are identified as background pixels. (corresponding flag=2). These pixels are pixels adjacent to the character pixels among the plurality of pixels in the intermediate area MA and are not specified as character pixels. Also, in the outer area BA, a plurality of pixels adjacent to the intermediate area MA (for example, pixel SP17 in FIG. 14A) are identified as background pixels (corresponding flag=2). In the outer area BA, a plurality of pixels that are three pixels or more away from the character pixels (for example, the pixel SP21 in FIG. 14A) are specified neither as background pixels nor as character pixels (corresponding flag=0). ).

図15を参照して、さらに、具体例を説明する。図15は、背景画素特定処理の第2の説明図である。図15(A)には、図11(A)と同様の下エッジの拡大図が示されている。図15(B)には、図16(A)に示すスキャン画像SI内の領域に対応するフラグデータが示されている。下エッジについても同様に、例えば、文字画素である画素TP18が注目画素である場合には、4方向にM個(図15(A)では2個)先の画素SP22~SP25のうち、文字画素でなく、かつ、その値が背景色範囲内である画素SP22が、背景画素として特定される(S530~S540)。そして、画素TP18と、画素SP22と、の間に位置する画素SP26は、文字画素ではないので、背景画素として特定される。画素TP18から3画素離れた画素SP27は、遠方画素であるので、上記特定条件について判断されずに、背景画素として特定されない。したがって、図15(B)に示すように、中間領域MAのうち、内側領域TAより外側領域BAに近い複数個の画素(例えば、図15(A)の画素SP22)が、背景画素として特定される(対応するフラグ=2)。また、外側領域BAのうち、中間領域MAと隣接する複数個の画素(例えば、図15(A)の画素SP26)が、背景画素として特定される(対応するフラグ=2)。また、外側領域BAのうち、文字画素から3画素以上離れた複数個の画素(例えば、図15(A)の画素SP27)は、背景画素にも文字画素にも特定されない(対応するフラグ=0)。 A specific example will be further described with reference to FIG. FIG. 15 is a second explanatory diagram of the background pixel specifying process. FIG. 15(A) shows an enlarged view of the lower edge similar to FIG. 11(A). FIG. 15B shows flag data corresponding to the area in the scanned image SI shown in FIG. 16A. Similarly for the lower edge, for example, when the pixel TP18, which is a character pixel, is the pixel of interest, among the pixels SP22 to SP25 ahead of M (two in FIG. 15A) in the four directions, character pixels A pixel SP22 whose value is not within the background color range and whose value is within the background color range is specified as a background pixel (S530 to S540). A pixel SP26 located between the pixel TP18 and the pixel SP22 is not a character pixel, and thus is specified as a background pixel. The pixel SP27, which is three pixels away from the pixel TP18, is a distant pixel, so it is not identified as a background pixel without being judged with respect to the specific condition. Therefore, as shown in FIG. 15B, a plurality of pixels closer to the outer area BA than the inner area TA (for example, the pixel SP22 in FIG. 15A) in the intermediate area MA are identified as background pixels. (corresponding flag=2). Also, in the outer area BA, a plurality of pixels adjacent to the intermediate area MA (for example, pixel SP26 in FIG. 15A) are identified as background pixels (corresponding flag=2). In the outer area BA, a plurality of pixels (for example, pixel SP27 in FIG. 15A) that are three pixels or more away from the character pixels are specified neither as background pixels nor as character pixels (corresponding flag=0). ).

図示は省略するが、右エッジ(図10(A))および左エッジ(図12(A))においても、中間領域MAのうち、内側領域TAより外側領域BAに近い複数個の画素と、外側領域BAのうち、中間領域MAと隣接する複数個の画素と、が背景画素として特定される。文字画素から3画素以上離れた複数個の画素は、背景画素にも文字画素にも特定されない。 Although not shown, in the right edge (FIG. 10A) and the left edge (FIG. 12A), a plurality of pixels closer to the outer area BA than the inner area TA in the middle area MA, and a plurality of pixels closer to the outer area BA than the inner area TA In the area BA, the intermediate area MA and a plurality of adjacent pixels are specified as background pixels. A plurality of pixels that are three or more pixels away from a text pixel are not identified as background pixels or text pixels.

図16は、処理済画像の説明図である。図16(A)、(B)には、それぞれ、図14(A)の下エッジ、図15(A)の上エッジに対応する処理済画像OIの拡大図が示されている。上述した文字画素および背景画素の特定結果を用いて、図2のS45の文字・背景画素置換処理が実行された場合には、図16(A)、(B)の処理済画像OIを示す処理済画像データが生成される。この処理済画像OIにおいて、黒い画素は、スキャン画像SI内の特定済みの文字画素に対応する画素であり、文字色に置換された画素(文字色置換画素とも呼ぶ)である。処理済画像OIにおいて、丸印が付された白い画素は、特定済みの背景画素に対応する画素であり、背景色に置換された画素(背景色置換画素とも呼ぶ)である。処理済画像OIにおいて、丸印が付されていない白い画素は、遠方画素(背景画素にも文字画素にも特定されていない画素)に対応する対応遠方画素である。このように、処理済画像OIは、複数個の文字色置換画素と、複数個の背景色置換画素と、を含む。この結果、処理済画像OIにおいて、文字色と背景色との境界を鮮明にすることができる。さらに、図2のS35にて、スキャンデータを用いて、文字色と背景色が特定され、特定された文字色と背景色についてS55の文字・背景画素置換処理が行われる。この結果、例えば、白背景上の黒文字に限らず、様々な文字色および背景色の組み合わせについて、文字色と背景色との境界を鮮明にすることができる。 FIG. 16 is an explanatory diagram of a processed image. FIGS. 16A and 16B show enlarged views of the processed image OI corresponding to the lower edge of FIG. 14A and the upper edge of FIG. 15A, respectively. When the character/background pixel replacement process of S45 in FIG. 2 is executed using the character pixel and background pixel identification results described above, the process showing the processed image OI in FIGS. finished image data is generated. In this processed image OI, the black pixels are pixels corresponding to the specified text pixels in the scanned image SI, and are pixels replaced with text color (also called text color replacement pixels). In the processed image OI, the circled white pixels are pixels corresponding to the background pixels that have already been specified, and are pixels that have been replaced with the background color (also called background color replaced pixels). In the processed image OI, the white pixels that are not circled are corresponding distant pixels that correspond to distant pixels (those that are neither identified as background pixels nor character pixels). Thus, the processed image OI includes a plurality of text color-substituted pixels and a plurality of background color-substituted pixels. As a result, the boundary between the character color and the background color can be sharpened in the processed image OI. Further, in S35 of FIG. 2, the scan data is used to identify the character color and the background color, and the character/background pixel replacement process of S55 is performed for the identified character color and background color. As a result, for example, the boundary between the character color and the background color can be made clear not only for black characters on a white background, but also for various combinations of character colors and background colors.

さらに、印刷画像OIは、複数個の対応遠方画素と、を含む。複数個の遠方画素は、処理済画像FI(図3(D))の対応する画素の値を有するので、背景色とも文字色とも異なる色を有し得る。この結果、文字色と背景色との境界を鮮明にするために、文字色と背景色との境界から離れた遠方の部分が、過度に影響を受けることを抑制できる。例えば、スキャン画像SIにおいて、背景Bg1が、完全な白色でなく、例えば、薄い模様や薄い色を含んでいる場合に、処理済画像OIにおいて、背景Bg1の模様や色が失われて画質が低下することを抑制できる。また、スキャン画像SIにおいて、文字の近傍に、例えば、薄い色のオブジェクト(例えば、描画など)が含まれる場合に、該オブジェクトの一部が背景色に置換されて該オブジェクトの見栄えが低下することを抑制できる。 Further, the printed image OI includes a plurality of corresponding distant pixels. Since the plurality of distant pixels have the values of the corresponding pixels of the processed image FI (FIG. 3(D)), they can have colors different from both the background color and the character color. As a result, in order to make the boundary between the character color and the background color clearer, it is possible to suppress the excessive influence of the distant portion away from the boundary between the character color and the background color. For example, in the scanned image SI, if the background Bg1 is not completely white and includes, for example, a light pattern or light color, the pattern and color of the background Bg1 are lost in the processed image OI, resulting in deterioration of image quality. can be suppressed. In addition, if the scan image SI includes, for example, a light-colored object (for example, a drawing) near the characters, part of the object is replaced with the background color, and the appearance of the object deteriorates. can be suppressed.

さらに、上記実施例では、二値画像データによって特定される複数個のエッジ画素の中から文字画素が特定される(図8のS405)。すなわち、図2のS15のエッジ画素特定処理にて特定されたスキャン画像SI内の複数個のエッジ画素を含み、かつ、複数個のエッジ画素とは異なる複数個の画素の少なくとも一部を含まない画素群の中から文字画素が特定される。この結果、エッジと異なる部分、例えば、スキャン画像SI内の均一な色を有する部分の色を変更することなく、文字色と背景色との境界を構成するエッジを鮮明にすることができる。例えば、スキャン画像SI内のエッジとは異なる部分の色が変更されてしまうことに起因する画質の低下を抑制できる。 Furthermore, in the above embodiment, character pixels are identified from among the plurality of edge pixels identified by the binary image data (S405 in FIG. 8). That is, it includes the plurality of edge pixels in the scanned image SI identified in the edge pixel identification processing of S15 in FIG. 2, and does not include at least a portion of the plurality of pixels different from the plurality of edge pixels. Character pixels are identified from the group of pixels. As a result, the edge forming the boundary between the character color and the background color can be sharpened without changing the color of a portion different from the edge, for example, a portion having a uniform color in the scan image SI. For example, it is possible to suppress deterioration in image quality caused by changing the color of a portion different from the edge in the scan image SI.

さらには、図2のS20にて膨張・収縮処理が実行され、膨張・収縮処理後の二値データによって特定される複数個のエッジ画素の中から、文字画素が特定される。この結果、さらに適切な複数個のエッジ画素の中から、文字画素が特定されるので、文字色と背景色との境界をより適切に鮮明にできる。例えば、図4を参照して説明したように、特定されたエッジに欠けCRや隙間NTなどがあると、文字画素として特定すべき画素が特定できない可能性があるが、膨張・収縮処理が実行されることで、このような不都合を抑制できるので、文字色と背景色との境界をより適切に鮮明にできる。 Further, expansion/contraction processing is executed in S20 of FIG. 2, and character pixels are identified from a plurality of edge pixels identified by the binary data after the expansion/contraction processing. As a result, character pixels are identified from a plurality of more appropriate edge pixels, so that the boundary between the character color and the background color can be made more appropriate and sharp. For example, as described with reference to FIG. 4, if there is a missing CR or gap NT in the specified edge, there is a possibility that the pixel to be specified as a character pixel cannot be specified, but the expansion/contraction process is executed. By doing so, such inconvenience can be suppressed, so that the boundary between the character color and the background color can be made more appropriately clear.

一般に、解像度が高いほど、文字の周囲において、ぼけた領域の画素数が増加すると考えられる。このために、解像度が高いほど、文字の周囲において多数の画素を背景色に置換することが好ましいと考えられる。上記実施例によれば、確認画素数Mの値は、スキャンデータの特定方向の解像度が、第1解像度(例えば、600dpi)である場合には、第1値(例えば、「2」)に決定され、該特定方向の解像度が、第1解像度よりも高い第2解像度(例えば、1200dpi)である場合には、第1値よりも大きな第2値(例えば、「4」)に決定される(S500)。この結果、スキャンデータの解像度に応じて、文字色と背景色との境界を構成するエッジを適切に強調できる。 In general, it is thought that the higher the resolution, the more pixels there are in the blurred area around the characters. For this reason, the higher the resolution, the more preferable it is to replace a large number of pixels around the character with the background color. According to the above embodiment, the value of the confirmed pixel number M is determined to be the first value (eg, "2") when the resolution in the specific direction of the scan data is the first resolution (eg, 600 dpi). and if the resolution in the specific direction is a second resolution (eg, 1200 dpi) higher than the first resolution, it is determined as a second value (eg, "4") greater than the first value ( S500). As a result, the edge forming the boundary between the character color and the background color can be appropriately emphasized according to the resolution of the scan data.

B.変形例: B. Variant:

(1)印刷を前提とする場合には、第1色と第2色との組み合わせは、印刷に用いられる複数種類の色材の色と、印刷に用いられる用紙の地色と、の中から選択される2色であることが好ましい。例えば、第1色と第2色との組み合わせは、印刷に用いられる色材の色であるシアン、マゼンタ、イエロ、黒と、用紙の地色である白と、から成る5色の中から選択される2色であることが好ましい。この場合には、処理済画像データに対してハーフトーン処理を実行して得られる印刷画像(網点画像)においても、第1色と第2色との境界は、鮮明のままで維持される。 (1) Assuming printing, the combination of the first color and the second color is selected from among the colors of multiple types of coloring materials used for printing and the ground color of the paper used for printing. Preferably there are two colors selected. For example, the combination of the first color and the second color is selected from five colors consisting of cyan, magenta, yellow, and black, which are the colors of the color materials used for printing, and white, which is the ground color of the paper. preferably two colors that In this case, even in a printed image (halftone image) obtained by executing halftone processing on the processed image data, the boundary between the first color and the second color is kept sharp. .

(2)図9の文字画素特定処理では、二値画像データによって特定される複数個のエッジ画素の中から、文字画素が特定される(図8のS405)。これに代えて、例えば、非エッジ画素を含む全ての画素の中から、文字画素が特定されても良い。例えば、図9のS405では、注目領域に外接する矩形領域SA内の全ての画素が注目画素として選択されても良い。110は省略されても良い。 (2) In the character pixel identification process of FIG. 9, character pixels are identified from among a plurality of edge pixels identified by the binary image data (S405 of FIG. 8). Alternatively, for example, character pixels may be identified from among all pixels including non-edge pixels. For example, in S405 of FIG. 9, all pixels within the rectangular area SA circumscribing the target area may be selected as target pixels. 110 may be omitted.

(3)図9の文字画素特定処理において、文字画素として特定するための条件は、一例であり、これに限られない。例えば、実施例の第2文字色範囲よりも狭く、かつ、文字色を含む範囲内の画素の値を有する画素は、全て文字画素として特定されても良い。 (3) In the character pixel identifying process of FIG. 9, the conditions for identifying as character pixels are an example and are not limited to this. For example, all pixels having pixel values within a range that is narrower than the second text color range of the embodiment and that includes the text color may be specified as text pixels.

(4)図13の背景画素特定処理において、背景画素として特定するための条件は、一例であり、これに限られない。例えば、文字画素の4方向に隣接する画素のうち、文字画素でなく、かつ、最も背景に近い画素を、背景画素として特定しても良い。また、上記実施例の確認画素数Mの値は、スキャンデータの読取解像度に関わらずに、一定の値(例えば、2)であっても良い。 (4) In the background pixel identification process of FIG. 13, the conditions for identifying pixels as background pixels are an example and are not limited to this. For example, among the pixels adjacent to the character pixel in four directions, the pixel that is not the character pixel and is closest to the background may be specified as the background pixel. Also, the value of the confirmed pixel number M in the above embodiment may be a constant value (for example, 2) regardless of the reading resolution of the scan data.

(5)上記実施例では、スキャンデータの各画素の値は、RGB値であるが、他の表色系の色値であっても良い。例えば、スキャンデータの各画素の値は、C、M、Yの3個の成分値を含むCMY表色系の色値であっても良い。 (5) In the above embodiment, each pixel value of the scan data is an RGB value, but it may be a color value of another color system. For example, the value of each pixel of the scan data may be a color value of the CMY color system including three component values of C, M, and Y.

(6)上記実施例では、エッジ画素に対して、エッジ鮮鋭化処理が実行され(図2のS70)、非エッジ画素に対して、網点平滑化処理が実行される(図2のS65)。これに代えて、エッジ画素に対しては、文字の見栄えを向上するためのアンチエイリアス処理が実行されても良い。また、非エッジ画素に対しては、例えば、印刷時の色材の使用量を減らすために、色を飛ばす処理(白に変換する処理)が実行されても良い。一般的には、エッジ画素と、エッジ画素と、に互いに異なる画像処理が実行されることが好ましい。あるいは、エッジ画素と非エッジ画素のいずれか一方に対して、特定の画像処理が実行され、他方に対して、該特定の画像処理が実行されなくても良い。 (6) In the above embodiment, edge sharpening processing is performed on edge pixels (S70 in FIG. 2), and halftone dot smoothing processing is performed on non-edge pixels (S65 in FIG. 2). . Alternatively, edge pixels may be subjected to anti-aliasing to improve the appearance of characters. For non-edge pixels, for example, a process of skipping colors (a process of converting to white) may be performed in order to reduce the amount of color material used during printing. In general, it is preferable that edge pixels and edge pixels are subjected to different image processing. Alternatively, specific image processing may be performed on one of edge pixels and non-edge pixels, and the specific image processing may not be performed on the other.

(7)上記実施例では、対象画像データは、スキャンデータであるが、これに限られない。対象画像データは、2次元イメージセンサを備えるデジタルカメラによって印刷物を読み取ることによって生成されても良い。 (7) In the above embodiments, the target image data is scan data, but is not limited to this. The target image data may be generated by reading printed matter with a digital camera equipped with a two-dimensional image sensor.

(8)上記実施例では、処理済画像データは、処理済画像を印刷するために用いられている(図2のS75、S80)。これに限らず、処理済画像データは、処理済画像を液晶ディスプレイなどの表示部に表示するために用いられても良い。 (8) In the above embodiment, the processed image data is used to print the processed image (S75, S80 in FIG. 2). Not limited to this, the processed image data may be used to display the processed image on a display unit such as a liquid crystal display.

(9)図2の画像処理を実現する画像処理装置は、複合機200に限らず、種々の装置であってよい。例えば、スキャナやデジタルカメラが、自身で生成された対象画像データを用いて、プリンタに供給するための印刷データを生成するために、図2の画像処理を実行しても良い。また、例えば、スキャナやプリンタと通信可能な接続される端末装置(例えば、端末装置100)やサーバ(図示省略)が、スキャナから取得したスキャンデータを用いて、図2の画像処理を実行して、印刷データを生成し、該印刷データをプリンタに供給しても良い。また、ネットワークを介して互いに通信可能な複数個のコンピュータ(例えば、クラウドサーバ)が、画像処理に要する機能を一部ずつ分担して、全体として、画像処理を実行してもよい。この場合、複数個のコンピュータの全体が、画像処理装置の例である。 (9) The image processing apparatus that implements the image processing in FIG. 2 is not limited to the multifunction machine 200, and may be various apparatuses. For example, the image processing of FIG. 2 may be executed by a scanner or digital camera to generate print data to be supplied to a printer using target image data generated by itself. Further, for example, a terminal device (for example, the terminal device 100) or a server (not shown) connected to be able to communicate with a scanner or printer executes the image processing of FIG. 2 using the scan data acquired from the scanner. may generate print data and supply the print data to the printer. Also, a plurality of computers (for example, a cloud server) that can communicate with each other via a network may share functions required for image processing, and execute image processing as a whole. In this case, the entirety of a plurality of computers is an example of an image processing device.

(10)上記各実施例において、ハードウェアによって実現されていた構成の一部をソフトウェアに置き換えるようにしてもよく、逆に、ソフトウェアによって実現されていた構成の一部あるいは全部をハードウェアに置き換えるようにしてもよい。例えば、図2のS55の文字・背景画素置換処理や、S70のエッジ鮮鋭化処理は、ASICなどの専用のハードウェアによって、実行されても良い。 (10) In each of the above embodiments, part of the configuration implemented by hardware may be replaced with software, or conversely, part or all of the configuration implemented by software may be replaced with hardware. You may do so. For example, the character/background pixel replacement process of S55 in FIG. 2 and the edge sharpening process of S70 may be executed by dedicated hardware such as ASIC.

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

100…端末装置、200…複合機、210…CPU、220…揮発性記憶装置、230…不揮発性記憶装置、240…表示部、250…操作部、270…通信IF、280…印刷実行部、290…読取実行部、D1…第1方向、D2…第2方向、TA…内側領域、BA…外側領域、MA…中間領域、PG…コンピュータプログラム、BI…二値画像、OI…処理済画像、GI…平滑化画像、FI…処理済画像、SI…スキャン画像 DESCRIPTION OF SYMBOLS 100... Terminal device, 200... MFP, 210... CPU, 220... Volatile memory device, 230... Non-volatile memory device, 240... Display part, 250... Operation part, 270... Communication IF, 280... Print execution part, 290 ... reading execution part, D1 ... first direction, D2 ... second direction, TA ... inner area, BA ... outer area, MA ... intermediate area, PG ... computer program, BI ... binary image, OI ... processed image, GI ... smoothed image, FI ... processed image, SI ... scanned image

Claims (10)

画像処理装置であって、
イメージセンサを用いて生成され、複数個の画素を含む対象画像を示す対象画像データを取得する取得部と、
前記対象画像データを用いて、前記対象画像内の特定の文字に対応する第1色と、前記特定の文字の背景に対応する第2色と、を特定する色特定部と、
前記対象画像内の複数個の対象画素の中から、前記対象画素の値を用いて、前記第1色を有するべき複数個の第1画素を特定する第1特定部と、
前記複数個の第1画素のそれぞれを第1注目画素として、前記第1注目画素の近傍に位置する複数個の第1周辺画素のそれぞれについて、前記第1画素でないことを含む特定条件を満たすか否かを判断する判断部と、
前記第1注目画素の前記複数個の第1周辺画素の中から、前記特定条件を満たす画素を、前記第2色を有するべき第2画素として特定する第2特定部と、
前記対象画像データに対して、前記第1特定部により特定された前記第1画素の値を前記第1色に対応する値に置換し、前記第2特定部により特定された前記第2画素の値を前記第2色に対応する値に置換する置換処理を含む特定の画像処理を実行して、処理済画像を示す処理済画像データを生成する生成部と、
を備え
前記色特定部は、
前記対象画像データを用いて、前記対象画像内に複数個の特定領域を特定し、
前記複数個の特定領域のそれぞれを複数個のブロックに分割し、
前記複数個のブロックのそれぞれの複数個の画素の値を用いて、前記複数個のブロックに対応する複数個のブロック色であって対応する前記ブロックの色をそれぞれ示す前記複数個のブロック色を決定し、
前記複数個の特定領域のそれぞれについて、基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2であるか否かを判断し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、前記基準以上の個数の前記ブロックに対応する前記ブロック色に基づいて、前記特定領域の前記第1色と前記第2色を特定し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2とは異なる前記特定領域について、前特定領域の前記第1色と前記第2色とを特定せず、
前記生成部は、
前記第1色と前記第2色とが特定された前記特定領域に対して前記置換処理を含む前記特定の画像処理を実行し、前記第1色と前記第2色とが特定されない前記特定領域に対して前記置換処理を含まない画像処理を実行す画像処理装置。
An image processing device,
an acquisition unit that acquires target image data that is generated using an image sensor and indicates a target image that includes a plurality of pixels;
a color identifying unit that uses the target image data to identify a first color corresponding to specific characters in the target image and a second color corresponding to the background of the specific characters;
a first identifying unit that identifies a plurality of first pixels that should have the first color from among a plurality of target pixels in the target image using the values of the target pixels;
With each of the plurality of first pixels as the first pixel of interest, each of the plurality of first peripheral pixels positioned in the vicinity of the first pixel of interest satisfies a specific condition including being not the first pixel. a determination unit that determines whether
a second identifying unit that identifies a pixel that satisfies the specific condition from among the plurality of first peripheral pixels of the first pixel of interest as a second pixel that should have the second color;
replacing the value of the first pixel specified by the first specifying unit with a value corresponding to the first color in the target image data, and replacing the value of the second pixel specified by the second specifying unit with the value corresponding to the first color; a generation unit that performs specific image processing including a replacement process for replacing values with values corresponding to the second color to generate processed image data representing a processed image;
with
The color specifying unit
using the target image data to specify a plurality of specific regions in the target image;
dividing each of the plurality of specific regions into a plurality of blocks;
a plurality of block colors corresponding to the plurality of blocks, each indicating a color of the corresponding block, using the values of the plurality of pixels in each of the plurality of blocks; decide and
for each of the plurality of specific regions, determining whether the number of the block colors corresponding to a reference number or more of the blocks is 2;
For the specific region in which the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is two, the first identifying a color and said second color;
not specifying the first color and the second color of the previous specified region for the specified region where the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is different from 2;
The generating unit
performing the specific image processing including the replacement processing on the specific region in which the first color and the second color are specified, and the specific region in which the first color and the second color are not specified An image processing device that executes image processing that does not include the replacement processing for the
請求項に記載の画像処理装置であって、
前記色特定部は、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、オブジェクトを構成する複数個のオブジェクト画素と、オブジェクトを構成しない複数個の非オブジェクト画素とを特定し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、前記複数個のオブジェクト画素の値を用いて、前記オブジェクトの色が前記2個のブロック色のいずれかに対応するか否かを判断し、
前記オブジェクトの色が前記2個のブロック色のいずれかに対応する場合に、前記第1色と前記第2色とを特定し、
前記オブジェクトの色が前記2個のブロック色のいずれにも対応しない場合に、前記第1色と前記第2色とを特定しない、画像処理装置。
The image processing device according to claim 1 ,
The color specifying unit
specifying a plurality of object pixels that form an object and a plurality of non-object pixels that do not form an object in the specific region in which the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is 2; ,
For the specific region in which the number of the block colors corresponding to the number of the blocks equal to or larger than the reference number is two, the values of the plurality of object pixels are used to determine whether the color of the object is any one of the two block colors. to determine whether or not to respond to
specifying the first color and the second color when the color of the object corresponds to one of the two block colors;
The image processing device that does not specify the first color and the second color when the color of the object does not correspond to any of the two block colors.
請求項またはに記載の画像処理装置であって、さらに、
前記対象画像データを用いて、前記対象画像内のエッジを構成する複数個のエッジ画素を特定するエッジ特定部を備え、
前記生成部は、
前記第1色と前記第2色とが特定された前記特定領域内の前記複数個のエッジ画素の値に対して、前記置換処理と、前記置換処理の後に前記対象画像内のエッジを鮮鋭化する鮮鋭化処理と、を含む前記特定の画像処理を実行し、
前記第1色と前記第2色とが特定されない前記特定領域内の前記複数個のエッジ画素の値に対して、前記置換処理を実行せず、前記鮮鋭化処理を含む画像処理を実行する、画像処理装置。
The image processing device according to claim 1 or 2 , further comprising:
an edge identification unit that identifies a plurality of edge pixels forming an edge in the target image using the target image data;
The generating unit
replacing the values of the plurality of edge pixels in the specified region in which the first color and the second color are specified; and sharpening the edges in the target image after the replacement. performing the specific image processing including a sharpening process to
performing image processing including the sharpening process without performing the replacing process on the values of the plurality of edge pixels in the specified area where the first color and the second color are not specified; Image processing device.
画像処理装置であって、
イメージセンサを用いて生成され、複数個の画素を含む対象画像を示す対象画像データを取得する取得部と、
前記対象画像データを用いて、前記対象画像内の特定の文字に対応する第1色と、前記特定の文字の背景に対応する第2色と、を特定する色特定部と、
前記対象画像内の複数個の対象画素の中から、前記対象画素の値を用いて、前記第1色を有するべき複数個の第1画素を特定する第1特定部と、
前記複数個の第1画素のそれぞれを第1注目画素として、前記第1注目画素の近傍に位置する複数個の第1周辺画素のそれぞれについて、前記第1画素でないことを含む特定条件を満たすか否かを判断する判断部と、
前記第1注目画素の前記複数個の第1周辺画素の中から、前記特定条件を満たす画素を、前記第2色を有するべき第2画素として特定する第2特定部と、
前記対象画像データに対して、前記第1特定部により特定された前記第1画素の値を前記第1色に対応する値に置換し、前記第2特定部により特定された前記第2画素の値を前記第2色に対応する値に置換する置換処理を含む特定の画像処理を実行して、処理済画像を示す処理済画像データを生成する生成部と、
を備え
前記判断部は、前記第1注目画素の複数個の第1周辺画素のうちの特定の画素について、前記特定の画素が前記第1画素でなく、かつ、前記特定の画素が前記第1色よりも前記第2色に近い色を有する場合に、前記特定の画素は、前記特定条件を満たすと判断す画像処理装置。
An image processing device,
an acquisition unit that acquires target image data that is generated using an image sensor and indicates a target image that includes a plurality of pixels;
a color identifying unit that uses the target image data to identify a first color corresponding to specific characters in the target image and a second color corresponding to the background of the specific characters;
a first identifying unit that identifies a plurality of first pixels that should have the first color from among a plurality of target pixels in the target image using the values of the target pixels;
With each of the plurality of first pixels as the first pixel of interest, each of the plurality of first peripheral pixels positioned in the vicinity of the first pixel of interest satisfies a specific condition including being not the first pixel. a determination unit that determines whether
a second identifying unit that identifies a pixel that satisfies the specific condition from among the plurality of first peripheral pixels of the first pixel of interest as a second pixel that should have the second color;
replacing the value of the first pixel specified by the first specifying unit with a value corresponding to the first color in the target image data, and replacing the value of the second pixel specified by the second specifying unit with the value corresponding to the first color; a generation unit that performs specific image processing including a replacement process for replacing values with values corresponding to the second color to generate processed image data representing a processed image;
with
The determination unit determines that, for a specific pixel among a plurality of first surrounding pixels of the first pixel of interest, the specific pixel is not the first pixel, and the specific pixel is more than the first color. image processing device , determining that the specific pixel satisfies the specific condition if the pixel also has a color close to the second color .
請求項に記載の画像処理装置であって、
前記特定の画素は、前記第1注目画素から特定方向にM個(Mは、2以上の整数)の画素分だけ離れた画素であり、
前記判断部は、前記複数個の第1周辺画素のうち、前記特定方向に沿って前記第1注目画素と前記特定の画素との間に位置する(M-1)個の中間画素について、前記中間画素が、前記第1画素でない場合に、前記中間画素の値に関わらずに、前記中間画素は、前記特定条件を満たすと判断する、画像処理装置。
The image processing device according to claim 4 ,
The specific pixel is a pixel separated by M pixels (M is an integer equal to or greater than 2) in a specific direction from the first pixel of interest,
The determination unit determines, of the plurality of first peripheral pixels, about (M−1) intermediate pixels located between the first pixel of interest and the specific pixel along the specific direction. The image processing apparatus, wherein when the intermediate pixel is not the first pixel , the intermediate pixel is determined to satisfy the specific condition regardless of the value of the intermediate pixel.
請求項またはに記載の画像処理装置であって、
前記色特定部は、
前記対象画像内の特定領域にて、文字を構成する複数個の文字構成画素と、文字を構成しない複数個の非文字画素とを特定し、
前記複数個の文字構成画素の値を用いて、前記第1色を特定する、画像処理装置。
The image processing device according to claim 4 or 5 ,
The color specifying unit
identifying a plurality of character-constituting pixels that form a character and a plurality of non-character pixels that do not form a character in a specific region within the target image;
The image processing device, wherein the first color is specified using the values of the plurality of character-constituting pixels.
請求項に記載の画像処理装置であって、
前記色特定部は、前記複数個の非文字画素の値を用いて、前記第2色を特定する、画像処理装置。
The image processing device according to claim 6 ,
The image processing device, wherein the color specifying unit specifies the second color using the values of the plurality of non-character pixels.
請求項1~のいずれかに記載の画像処理装置であって、
前記処理済画像データを用いて、印刷データを生成する印刷データ生成部を備える、画像処理装置。
The image processing device according to any one of claims 1 to 7 ,
An image processing apparatus comprising a print data generation unit that generates print data using the processed image data.
コンピュータプログラムであって、
イメージセンサを用いて生成され、複数個の画素を含む対象画像を示す対象画像データを取得する取得機能と、
前記対象画像データを用いて、前記対象画像内の特定の文字に対応する第1色と、前記特定の文字の背景に対応する第2色と、を特定する色特定機能と、
前記対象画像内の複数個の対象画素の中から、前記対象画素の値を用いて、前記第1色を有するべき複数個の第1画素を特定する第1特定機能と、
前記複数個の第1画素のそれぞれを第1注目画素として、前記第1注目画素の近傍に位置する複数個の第1周辺画素のそれぞれについて、前記第1画素でないことを含む特定条件を満たすか否かを判断する判断機能と、
前記第1注目画素の前記複数個の第1周辺画素の中から、前記特定条件を満たす画素を、前記第2色を有するべき第2画素として特定する第2特定機能と、
前記対象画像データに対して、前記第1特定機能により特定された前記第1画素の値を前記第1色に対応する値に置換し、前記第2特定機能により特定された前記第2画素の値を前記第2色に対応する値に置換する置換処理を含む特定の画像処理を実行して、処理済画像を示す処理済画像データを生成する生成機能と、
をコンピュータに実現させ
前記色特定機能は、
前記対象画像データを用いて、前記対象画像内に複数個の特定領域を特定し、
前記複数個の特定領域のそれぞれを複数個のブロックに分割し、
前記複数個のブロックのそれぞれの複数個の画素の値を用いて、前記複数個のブロックに対応する複数個のブロック色であって対応する前記ブロックの色をそれぞれ示す前記複数個のブロック色を決定し、
前記複数個の特定領域のそれぞれについて、基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2であるか否かを判断し、
前記基準以上の個数の前記ブロックに対応する前記ブロック色の個数が2である前記特定領域について、前記基準以上の個数の前記ブロックに対応する前記ブロック色に基づいて、前記特定領域の前記第1色と前記第2色を特定し、
前記基準以上の個数の前記ブロックに対応するブロック色の個数が2とは異なる前記特定領域について、前特定領域の前記第1色と前記第2色とを特定せず、
前記生成機能は、
前記第1色と前記第2色とが特定された前記特定領域に対して前記置換処理を含む前記特定の画像処理を実行し、前記第1色と前記第2色とが特定されない前記特定領域に対して前記置換処理を含まない画像処理を実行すコンピュータプログラム。
A computer program,
an acquisition function for acquiring target image data generated using an image sensor and representing a target image including a plurality of pixels;
a color specifying function for specifying a first color corresponding to a specific character in the target image and a second color corresponding to a background of the specific character using the target image data;
a first specifying function for specifying a plurality of first pixels that should have the first color from among a plurality of target pixels in the target image using the values of the target pixels;
With each of the plurality of first pixels as the first pixel of interest, each of the plurality of first peripheral pixels positioned in the vicinity of the first pixel of interest satisfies a specific condition including being not the first pixel. a judgment function for judging whether or not
a second specifying function of specifying, from among the plurality of first surrounding pixels of the first pixel of interest, a pixel satisfying the specified condition as a second pixel to have the second color;
replacing the value of the first pixel specified by the first specifying function with the value corresponding to the first color, and replacing the value of the second pixel specified by the second specifying function with respect to the target image data; a generation function that performs specific image processing including a replacement process for replacing values with values corresponding to the second color to generate processed image data representing a processed image;
is realized on a computer ,
The color specifying function is
using the target image data to specify a plurality of specific regions in the target image;
dividing each of the plurality of specific regions into a plurality of blocks;
a plurality of block colors corresponding to the plurality of blocks, each indicating a color of the corresponding block, using the values of the plurality of pixels in each of the plurality of blocks; decide and
for each of the plurality of specific regions, determining whether the number of the block colors corresponding to a reference number or more of the blocks is 2;
For the specific region in which the number of the block colors corresponding to the number of the blocks equal to or greater than the reference is two, the first identifying a color and said second color;
without specifying the first color and the second color of the previous specified region for the specified region where the number of block colors corresponding to the number of blocks equal to or greater than the reference is different from 2;
The generating function is
performing the specific image processing including the replacement processing on the specific region in which the first color and the second color are specified, and the specific region in which the first color and the second color are not specified A computer program for performing image processing that does not include the replacement processing on
コンピュータプログラムであって、
イメージセンサを用いて生成され、複数個の画素を含む対象画像を示す対象画像データを取得する取得機能と、
前記対象画像データを用いて、前記対象画像内の特定の文字に対応する第1色と、前記特定の文字の背景に対応する第2色と、を特定する色特定機能と、
前記対象画像内の複数個の対象画素の中から、前記対象画素の値を用いて、前記第1色を有するべき複数個の第1画素を特定する第1特定機能と、
前記複数個の第1画素のそれぞれを第1注目画素として、前記第1注目画素の近傍に位置する複数個の第1周辺画素のそれぞれについて、前記第1画素でないことを含む特定条件を満たすか否かを判断する判断機能と、
前記第1注目画素の前記複数個の第1周辺画素の中から、前記特定条件を満たす画素を、前記第2色を有するべき第2画素として特定する第2特定機能と、
前記対象画像データに対して、前記第1特定機能により特定された前記第1画素の値を前記第1色に対応する値に置換し、前記第2特定機能により特定された前記第2画素の値を前記第2色に対応する値に置換する置換処理を含む特定の画像処理を実行して、処理済画像を示す処理済画像データを生成する生成機能と、
をコンピュータに実現させ
前記判断機能は、前記第1注目画素の複数個の第1周辺画素のうちの特定の画素について、前記特定の画素が前記第1画素でなく、かつ、前記特定の画素が前記第1色よりも前記第2色に近い色を有する場合に、前記特定の画素は、前記特定条件を満たすと判断すコンピュータプログラム。
A computer program,
an acquisition function for acquiring target image data generated using an image sensor and representing a target image including a plurality of pixels;
a color specifying function for specifying a first color corresponding to a specific character in the target image and a second color corresponding to a background of the specific character using the target image data;
a first specifying function for specifying a plurality of first pixels that should have the first color from among a plurality of target pixels in the target image using the values of the target pixels;
With each of the plurality of first pixels as the first pixel of interest, each of the plurality of first peripheral pixels positioned in the vicinity of the first pixel of interest satisfies a specific condition including being not the first pixel. a judgment function for judging whether or not
a second specifying function of specifying, from among the plurality of first surrounding pixels of the first pixel of interest, a pixel satisfying the specified condition as a second pixel to have the second color;
replacing the value of the first pixel specified by the first specifying function with the value corresponding to the first color, and replacing the value of the second pixel specified by the second specifying function with respect to the target image data; a generation function that performs specific image processing including a replacement process for replacing values with values corresponding to the second color to generate processed image data representing a processed image;
is realized on a computer ,
The determination function is such that, for a specific pixel among a plurality of first surrounding pixels of the first pixel of interest, the specific pixel is not the first pixel and the specific pixel is more than the first color. computer program , determining that the particular pixel satisfies the particular condition if also has a color close to the second color .
JP2018183703A 2018-09-28 2018-09-28 Image processing device and computer program Active JP7248942B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018183703A JP7248942B2 (en) 2018-09-28 2018-09-28 Image processing device and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018183703A JP7248942B2 (en) 2018-09-28 2018-09-28 Image processing device and computer program

Publications (2)

Publication Number Publication Date
JP2020052892A JP2020052892A (en) 2020-04-02
JP7248942B2 true JP7248942B2 (en) 2023-03-30

Family

ID=69997368

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018183703A Active JP7248942B2 (en) 2018-09-28 2018-09-28 Image processing device and computer program

Country Status (1)

Country Link
JP (1) JP7248942B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013210817A (en) 2012-03-30 2013-10-10 Brother Ind Ltd Image processing device and image processing program
JP2017156852A (en) 2016-02-29 2017-09-07 ブラザー工業株式会社 Image processing device and computer program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09186858A (en) * 1996-01-08 1997-07-15 Canon Inc Method and device for image processing and computer controller

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013210817A (en) 2012-03-30 2013-10-10 Brother Ind Ltd Image processing device and image processing program
JP2017156852A (en) 2016-02-29 2017-09-07 ブラザー工業株式会社 Image processing device and computer program

Also Published As

Publication number Publication date
JP2020052892A (en) 2020-04-02

Similar Documents

Publication Publication Date Title
JP6781406B2 (en) Image processing equipment and computer programs
JP7248943B2 (en) Image processing device and computer program
JP6127877B2 (en) Image processing apparatus and computer program
US10529058B2 (en) Image processing apparatus that smooths image using classification result of pixels included therein
US10565465B2 (en) Image processing apparatus that identifies character pixel in target image using first and second candidate character pixels
JP7248942B2 (en) Image processing device and computer program
US10339636B2 (en) Image processing apparatus that specifies edge pixel in target image by calculating edge strength
JP6944127B2 (en) Image processing equipment, computer programs, and image processing methods
US9036212B2 (en) Halftone screen generation mechanism
JP6852665B2 (en) Image processing equipment, computer programs, and image processing methods
JP6908879B2 (en) Image processing equipment and computer programs
JP3952188B2 (en) Image interpolation apparatus, image interpolation method, and image interpolation program
JP5878167B2 (en) How to restore raster image edges
US10389909B2 (en) Image processing apparatus that specifies edge pixel in target image using minimum and maximum component values of pixel value in target image data
JP7248944B2 (en) Image processing device and computer program
JP7205689B2 (en) Image processing device and computer program
JP6879465B2 (en) Image processing equipment and computer programs
JP6841254B2 (en) Image processing equipment and computer programs
JP7205693B2 (en) Image processing device and computer program
JP6867609B2 (en) Image processing equipment and computer programs
JP2010191931A (en) Image processing apparatus, image forming apparatus, computer program, recording medium and image processing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210806

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220712

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220831

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20221019

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230228

R150 Certificate of patent or registration of utility model

Ref document number: 7248942

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150