JP2017118433A - Image processing device, image processing method and program - Google Patents

Image processing device, image processing method and program Download PDF

Info

Publication number
JP2017118433A
JP2017118433A JP2015254457A JP2015254457A JP2017118433A JP 2017118433 A JP2017118433 A JP 2017118433A JP 2015254457 A JP2015254457 A JP 2015254457A JP 2015254457 A JP2015254457 A JP 2015254457A JP 2017118433 A JP2017118433 A JP 2017118433A
Authority
JP
Japan
Prior art keywords
line drawing
color
line
image
group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2015254457A
Other languages
Japanese (ja)
Other versions
JP6676962B2 (en
Inventor
卓治 鎌田
Takuji Kamata
卓治 鎌田
大内 敏
Satoshi Ouchi
敏 大内
作山 宏幸
Hiroyuki Sakuyama
宏幸 作山
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.)
Ricoh Co Ltd
Original Assignee
Ricoh Co 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 Ricoh Co Ltd filed Critical Ricoh Co Ltd
Priority to JP2015254457A priority Critical patent/JP6676962B2/en
Publication of JP2017118433A publication Critical patent/JP2017118433A/en
Application granted granted Critical
Publication of JP6676962B2 publication Critical patent/JP6676962B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

PROBLEM TO BE SOLVED: To enable the enhancement of a compressibility ratio without damaging the reproducibility of a line image color.SOLUTION: According to an embodiment, an image processing device includes a line image detection part for detecting line images from an input image, a line image color processing part for calculating a line image color being the color of the line image about each of line images detected by the line image detection part, a representative color calculation part 32 for calculating a representative color of a group on the basis of a line image color calculated to remaining line images obtained by excluding line images corresponding to a prescribed condition among line images constituting a group to be a unit for unifying colors, and a line image color change part 33 for changing a line image color of a line image constituting the group to the representative color.SELECTED DRAWING: Figure 6

Description

本発明は、画像処理装置、画像処理方法およびプログラムに関する。   The present invention relates to an image processing apparatus, an image processing method, and a program.

高圧縮と高画質とを両立させる画像圧縮技術として、高圧縮PDF(Portable Document Format)と呼ばれる技術が知られている。高圧縮PDFは、画像を文字などの線画とそれ以外の領域とに分離し、それぞれに適した圧縮処理を施すことで高圧縮と高画質とを両立させる技術である。   As an image compression technique that achieves both high compression and high image quality, a technique called high compression PDF (Portable Document Format) is known. High-compression PDF is a technology that achieves both high compression and high image quality by separating an image into line drawings such as characters and other areas and performing compression processing suitable for each.

高圧縮PDFでは、例えば、線画の色(以下、「線画色」と呼ぶ)を表現するレイヤを持たせたり、線画をその座標と線画色とで表現したりすることで、線画色を再現可能としている。線画色は一般的に線画単位で算出されるが、線画単位で算出された線画色をそのまま用いると、再現しようとする線画色の種類(数)が多くなって圧縮率の低下を招く虞がある。一方で、代表的な線画である文字は文字行を構成することが多く、文字行単位で色を統一することは、圧縮率を高めるだけでなく、文字行内における文字色のばらつきを抑えて文字行としての見栄えをよくする効果がある。このような観点から、文字行を構成する各文字の文字色を平均化して当該文字行の代表色とし、当該文字行を構成する各文字を当該文字行の代表色で再現することが提案されている(例えば、特許文献1を参照)。   With high-compression PDF, for example, a line drawing color can be reproduced by providing a layer that represents the color of the line drawing (hereinafter referred to as “line drawing color”) or by expressing the line drawing with its coordinates and line drawing color. It is said. The line drawing color is generally calculated in units of line drawing. However, if the line drawing color calculated in line drawing unit is used as it is, the type (number) of line drawing colors to be reproduced may increase and the compression rate may be lowered. is there. On the other hand, characters, which are typical line drawings, often form a character line, and unifying the color for each character line not only increases the compression ratio, but also suppresses character color variations in the character line. It has the effect of improving the appearance as a line. From this point of view, it has been proposed to average the character colors of the characters constituting the character line to obtain the representative color of the character line, and to reproduce the characters constituting the character line with the representative color of the character line. (For example, refer to Patent Document 1).

しかし、従来の方法は、文字行を構成する各文字の文字色を単純に平均化して当該文字行の代表色とするため、他の文字とは異なる色の文字が同じ文字行に含まれていると文字行全体が本来の色と異なる色で再現され、文字色の再現性が損なわれる場合がある。   However, the conventional method simply averages the character colors of the characters that make up the character line to obtain the representative color of the character line, so that characters of a color different from other characters are included in the same character line. If this is the case, the entire character line is reproduced in a color different from the original color, and the reproducibility of the character color may be impaired.

上述した課題を解決するために、本発明は、画像から線画を検出する線画検出手段と、前記線画の色である線画色を算出する線画色算出手段と、色を統一する単位となるグループを構成する前記線画のうち、所定の条件に当てはまる前記線画を除外した残りの前記線画に対して算出された前記線画色に基づいて、前記グループの代表色を算出する代表色算出手段と、前記グループを構成する前記線画の前記線画色を前記代表色に変更する変更手段と、を備える。   In order to solve the above-described problems, the present invention provides a line drawing detection unit that detects a line drawing from an image, a line drawing color calculation unit that calculates a line drawing color that is the color of the line drawing, and a group that is a unit for unifying colors. Representative color calculation means for calculating a representative color of the group based on the line drawing color calculated for the remaining line drawing excluding the line drawing that satisfies a predetermined condition among the line drawing constituting the group drawing, and the group Changing means for changing the line drawing color of the line drawing constituting the line to the representative color.

本発明によれば、線画色の再現性を損なうことなく圧縮率を高めることができるという効果を奏する。   According to the present invention, it is possible to increase the compression rate without impairing the reproducibility of the line drawing color.

図1は、高圧縮PDFの処理手順を説明する模式図である。FIG. 1 is a schematic diagram for explaining the processing procedure of a high-compression PDF. 図2は、実施形態の画像処理装置のハードウェア構成例を示すブロック図である。FIG. 2 is a block diagram illustrating a hardware configuration example of the image processing apparatus according to the embodiment. 図3は、実施形態の画像処理装置の機能的な構成例を示すブロック図である。FIG. 3 is a block diagram illustrating a functional configuration example of the image processing apparatus according to the embodiment. 図4は、線画検出部の具体例を示すブロック図である。FIG. 4 is a block diagram illustrating a specific example of the line drawing detection unit. 図5は、線画色処理部の具体例を示すブロック図である。FIG. 5 is a block diagram illustrating a specific example of the line drawing color processing unit. 図6は、色統一処理部の具体例を示すブロック図である。FIG. 6 is a block diagram illustrating a specific example of the color unification processing unit. 図7は、実施形態の画像処理装置による動作の流れを説明するフローチャートである。FIG. 7 is a flowchart illustrating the flow of operations performed by the image processing apparatus according to the embodiment. 図8は、第1の検出部による処理の一例を説明するフローチャートである。FIG. 8 is a flowchart for explaining an example of processing by the first detection unit. 図9は、第2の検出部による処理の一例を説明するフローチャートである。FIG. 9 is a flowchart illustrating an example of processing by the second detection unit. 図10は、線画色処理部による処理の一例を説明するフローチャートである。FIG. 10 is a flowchart illustrating an example of processing performed by the line drawing color processing unit. 図11は、背景色の影響によって線画のエッジ近傍が変色した様子を示す図である。FIG. 11 is a diagram illustrating a state in which the vicinity of the edge of the line drawing has changed color due to the influence of the background color. 図12は、背景色に応じて線画色を補正する処理の具体例を説明する図である。FIG. 12 is a diagram illustrating a specific example of the process of correcting the line drawing color according to the background color. 図13は、背景色に応じて線画色を補正する処理の具体例を説明する図である。FIG. 13 is a diagram illustrating a specific example of processing for correcting a line drawing color according to a background color. 図14は、背景色に応じて線画色を補正する処理の具体例を説明する図である。FIG. 14 is a diagram illustrating a specific example of processing for correcting a line drawing color according to a background color. 図15は、背景色に応じて線画色を補正する処理の具体例を説明する図である。FIG. 15 is a diagram illustrating a specific example of the process of correcting the line drawing color according to the background color. 図16は、色統一処理部による処理の一例を説明するフローチャートである。FIG. 16 is a flowchart illustrating an example of processing by the color unification processing unit. 図17は、線画色を統一する単位となるグループを決定する方法の具体例を説明する図である。FIG. 17 is a diagram for explaining a specific example of a method for determining a group as a unit for unifying line drawing colors. 図18は、グループの代表色を算出する処理の具体例を説明する図である。FIG. 18 is a diagram illustrating a specific example of processing for calculating a representative color of a group.

以下に添付図面を参照しながら、本発明に係る画像処理装置、画像処理方法およびプログラムの具体的な実施形態について詳しく説明する。以下で示す実施形態は、高圧縮PDFファイル(「圧縮画像ファイル」の一態様)を生成する画像処理装置への適用例である。ただし、本発明はこの例に限らず、線画色を適切に算出することが求められる様々な画像処理装置に対して有効に適用可能である。   Hereinafter, specific embodiments of an image processing apparatus, an image processing method, and a program according to the present invention will be described in detail with reference to the accompanying drawings. The embodiment described below is an application example to an image processing apparatus that generates a highly compressed PDF file (one aspect of “compressed image file”). However, the present invention is not limited to this example, and can be effectively applied to various image processing apparatuses that are required to appropriately calculate line drawing colors.

<高圧縮PDF>
まず、本実施形態の具体的な説明に先立ち、高圧縮PDFの概要を説明する。高圧縮PDFは、文字などの線画を含む画像から高圧縮PDFファイルを生成する画像圧縮技術である。ここで線画とは、文字および文字と同様に扱うことが望ましい線で表現されるオブジェクトを指す。線で表現されるオブジェクトであっても、絵柄として扱うことが望ましいオブジェクトは、線画ではなく絵柄に含まれるものとする。絵柄は、線画以外のオブジェクト、つまり、写真などの網点で表現されるオブジェクトや、文字と同様に扱うことが望ましくない図形などのオブジェクトである。
<High compression PDF>
First, prior to specific description of the present embodiment, an outline of high-compression PDF will be described. High-compression PDF is an image compression technique that generates a high-compression PDF file from an image including line drawings such as characters. Here, the line drawing refers to an object represented by a character and a line that should be handled in the same manner as the character. Even if the object is represented by a line, an object that is desirably handled as a picture is included in the picture instead of the line picture. The pattern is an object other than a line drawing, that is, an object represented by a halftone dot such as a photograph, or an object such as a graphic that is not desirable to be handled in the same manner as a character.

図1は、高圧縮PDFの処理手順を説明する模式図である。高圧縮PDFファイルを生成するには、まず、処理対象となる画像(以下、「入力画像」と呼ぶ)Im0から、線画のみからなる2値画像である第1の画像レイヤIm1と、線画色を表現する多値画像である第2の画像レイヤIm2と、線画以外の絵柄および背景を表現する多値画像である第3の画像レイヤIm3とを生成する。そして、第1の画像レイヤIm1および第2の画像レイヤIm2に対しては、線画の圧縮に適した圧縮処理を施し、第3の画像レイヤIm3に対しては、絵柄や背景の圧縮に適した圧縮処理を施す。その後、圧縮処理が施された第1の画像レイヤIm1と、圧縮処理が施された第2の画像レイヤIm2と、圧縮処理が施された第3の画像レイヤIm3とを、例えばPDF形式の1つの画像ファイル上で統合することにより、入力画像Im0に対応する高圧縮PDFファイルFImを生成する。   FIG. 1 is a schematic diagram for explaining the processing procedure of a high-compression PDF. In order to generate a highly compressed PDF file, first, from the image to be processed (hereinafter referred to as “input image”) Im0, the first image layer Im1, which is a binary image consisting only of a line drawing, and the line drawing color are changed. A second image layer Im2 that is a multi-valued image to be expressed and a third image layer Im3 that is a multi-valued image that represents a pattern and background other than a line drawing are generated. Then, the first image layer Im1 and the second image layer Im2 are subjected to a compression process suitable for line drawing compression, and the third image layer Im3 is suitable for image and background compression. Apply compression processing. Thereafter, the first image layer Im1 that has been subjected to the compression process, the second image layer Im2 that has been subjected to the compression process, and the third image layer Im3 that has been subjected to the compression process are, for example, 1 in PDF format. By integrating on one image file, a highly compressed PDF file FIm corresponding to the input image Im0 is generated.

第1の画像レイヤIm1に対して施される圧縮処理は、例えば、2値画像に対するMMRなどの符号化方式による圧縮処理である。第2の画像レイヤIm2に対して施される圧縮処理は、例えば、第3の画像レイヤIm3に対する圧縮処理よりも解像度を落とした、多値画像に対するJPEGなどの符号化方式による圧縮処理である。第1の画像レイヤIm1に対する圧縮処理と第2の画像レイヤIm2に対する圧縮処理は、線画の圧縮に適した圧縮処理である点で共通するため、以下ではこれらの処理を総称して「第1の圧縮処理」と呼ぶ。一方、第3の画像レイヤIm3に対して施される圧縮処理は、例えば、第2の画像レイヤIm2に対する圧縮処理よりも解像度を高めた、多値画像に対するJPEGなどの符号化方式による圧縮処理である。第3の画像レイヤIm3に対する圧縮処理は、絵柄や背景の圧縮に適した圧縮処理であるため、以下では、線画の圧縮に適した第1の圧縮処理と区別して、「第2の圧縮処理」と呼ぶ。なお、上述の符号化方式は一例であり、上述の例とは異なる符号化方式による圧縮処理を行ってもよい。   The compression process performed on the first image layer Im1 is, for example, a compression process using an encoding method such as MMR for a binary image. The compression process performed on the second image layer Im2 is, for example, a compression process using an encoding method such as JPEG with a lower resolution than the compression process on the third image layer Im3. Since the compression processing for the first image layer Im1 and the compression processing for the second image layer Im2 are common in that they are compression processing suitable for line drawing compression, these processings are collectively referred to as “first This is called “compression processing”. On the other hand, the compression process performed on the third image layer Im3 is, for example, a compression process using an encoding method such as JPEG for a multi-valued image with a higher resolution than the compression process for the second image layer Im2. is there. Since the compression process for the third image layer Im3 is a compression process suitable for compression of a picture and a background, hereinafter, the second compression process is distinguished from the first compression process suitable for compression of a line drawing. Call it. Note that the above-described encoding method is an example, and compression processing using an encoding method different from the above-described example may be performed.

高圧縮PDFでは、以上のように、処理対象の入力画像Im0を線画の領域とそれ以外の絵柄や背景の領域とに分離し、線画の領域に対しては第1の圧縮処理を施すとともに、線画以外の絵柄や背景の領域に対しては第2の圧縮処理を施すことで、圧縮の効率を高めている。ここで、圧縮の効率とは、画像を再現したときの画質(再現性)を損なわずに、どれだけ圧縮率を高めることができたかどうかを表し、再現性を維持しながら高い圧縮率が得られれば、効率のよい圧縮が行われたことになる。   In the high-compression PDF, as described above, the input image Im0 to be processed is separated into a line drawing area and a pattern or background area other than that, and the first compression processing is performed on the line drawing area. The compression efficiency is enhanced by applying the second compression process to the pattern and background area other than the line drawing. Here, the compression efficiency represents how much the compression rate could be increased without impairing the image quality (reproducibility) when the image was reproduced. A high compression rate was obtained while maintaining reproducibility. If so, efficient compression has been performed.

上述の高圧縮PDFは様々な変形が可能である。例えば、上述の第1の画像レイヤIm1を、黒の線画のみからなる画像レイヤと、有彩色または白の線画のみからなる画像レイヤとに分けてもよい。また、線画色を表現する第2の画像レイヤIm2を持たずに、線画色を、線画の座標に対応させた別の情報として持たせる構成であってもよい。   The above-described high compression PDF can be variously modified. For example, the first image layer Im1 described above may be divided into an image layer consisting only of a black line drawing and an image layer consisting only of a chromatic color or white line drawing. Alternatively, the second image layer Im2 that expresses the line drawing color may not be provided, but the line drawing color may be provided as other information corresponding to the coordinates of the line drawing.

<実施形態の概要>
高圧縮PDFにおいて、線画色を表現する第2の画像レイヤIm2を高い圧縮率で圧縮するには、線画色の種類をできるだけ限定することが有効となる。例えば、代表的な線画である文字の文字色を文字行単位で統一すれば、文字単位で文字色を持たせる場合と比較して、第2の画像レイヤIm2の圧縮率を高めることができる。また、文字行単位で文字色を統一することにより、文字行内における文字色のばらつきを抑えて文字行としての見栄えをよくする効果も得られる。
<Outline of Embodiment>
In the high compression PDF, it is effective to limit the types of line drawing colors as much as possible in order to compress the second image layer Im2 expressing the line drawing colors at a high compression rate. For example, if the character color of a character which is a representative line drawing is unified in character line units, the compression rate of the second image layer Im2 can be increased as compared with the case where character characters are given in character units. In addition, by unifying the character color for each character line, it is possible to obtain an effect of improving the appearance of the character line by suppressing variations in the character color in the character line.

このような観点から、特許文献1に記載の技術では、文字行を構成する各文字の文字色を平均化して当該文字行の代表色とし、当該文字行を構成する各文字を当該文字行の代表色で再現するようにしている。しかし、この方法では、1つの文字行に他の文字とは文字色が異なる文字が混在している場合に、文字行全体が本来の色と異なる色で再現され、文字色の再現性が損なわれる懸念があり、改善が求められる。   From such a viewpoint, in the technique described in Patent Document 1, the character colors of the characters constituting the character line are averaged to obtain a representative color of the character line, and the characters constituting the character line are changed to the character line. Reproduced with representative colors. However, in this method, when characters with different character colors from other characters are mixed in one character line, the entire character line is reproduced in a color different from the original color, and the reproducibility of the character color is impaired. There is a concern that improvement is required.

そこで、本実施形態では、入力画像Im0から検出された線画を予め定めた任意の基準に従ってグループ化し、グループを構成する線画のうち、所定の条件に当てはまる線画を除外した残りの線画の線画色に基づいてグループの代表色を算出し、グループを構成する線画の線画色をグループの代表色に変更する。ここで、所定の条件とは、例えば、線画が持つ線画色の数を表す色数が2以上であるといった条件や、線画色が予め定めた特定色であるといった条件などである。線画色の代表色への変更は、所定の条件に当てはまるとして除外した線画を含め、グループを構成するすべての線画を対象として行ってもよいし、除外されずに残った線画を対象として行うようにしてもよい。色数が2以上の線画や線画色が特定色の線画は、例えば、書き込みのあるオフィス文書や添削を受けた解答用紙のように黒文字に赤文字または青文字が重なっている部分、あるいはグレーの「印」の文字上に印鑑が押印されている部分など、色自体に意味のある部分が線画として検出されていることも想定されるため、このような線画を線画色の変更の対象としないことで、意味のある色を再現することが可能となる。   Therefore, in the present embodiment, the line drawings detected from the input image Im0 are grouped according to a predetermined arbitrary criterion, and the line drawing colors of the remaining line drawings excluding the line drawing that meets a predetermined condition among the line drawings constituting the group are set. Based on this, the representative color of the group is calculated, and the line drawing color of the line drawing constituting the group is changed to the representative color of the group. Here, the predetermined condition includes, for example, a condition that the number of colors representing the number of line drawing colors of the line drawing is 2 or more, a condition that the line drawing color is a predetermined specific color, and the like. Changing the line drawing color to the representative color may be performed for all line drawings that make up the group, including line drawings that have been excluded if they meet certain conditions, or may be performed for line drawings that remain without being excluded. It may be. A line drawing with two or more colors or a line drawing with a specific line drawing color is, for example, a portion where red or blue characters overlap with black characters, such as written office documents or answer sheets that have been corrected. Since it is also assumed that parts with meaningful color itself, such as the part where the seal is imprinted on the character “mark”, are detected as line drawings, such line drawings are not subject to line drawing color changes. This makes it possible to reproduce meaningful colors.

本実施形態では、以上のように、グループを構成する線画のうち、所定の条件に当てはまる線画を除外した残りの線画の線画色に基づいてグループの代表色を算出し、グループを構成する線画の線画色をグループの代表色に変更するようにしているため、線画色の再現性を損なうことなく第2の画像レイヤIm2の圧縮率を高めることができ、高圧縮PDFにおける圧縮の効率を向上させることができる。   In the present embodiment, as described above, the representative color of the group is calculated based on the line drawing colors of the remaining line drawings excluding the line drawing that satisfies a predetermined condition from among the line drawings constituting the group, and the line drawing constituting the group is calculated. Since the line drawing color is changed to the group representative color, the compression rate of the second image layer Im2 can be increased without impairing the reproducibility of the line drawing color, and the compression efficiency in the high compression PDF is improved. be able to.

<画像処理装置の構成>
次に、本実施形態の画像処理装置について具体的に説明する。図2は、本実施形態の画像処理装置1のハードウェア構成例を示すブロック図である。画像処理装置1は、ハードウェアとして、例えばPC(パーソナルコンピュータ)などのコンピュータシステムを用いることができる。すなわち、画像処理装置1は、例えば図2に示すように、CPU101などのプロセッサと、RAM102、ROM103、HDD104などの記憶装置と、LANなどのネットワークに接続する通信インタフェースであるネットワークI/F105とを備え、これらがバス110を介して接続された構成とされる。
<Configuration of image processing apparatus>
Next, the image processing apparatus of this embodiment will be specifically described. FIG. 2 is a block diagram illustrating a hardware configuration example of the image processing apparatus 1 according to the present embodiment. The image processing apparatus 1 can use a computer system such as a PC (personal computer) as hardware. That is, for example, as shown in FIG. 2, the image processing apparatus 1 includes a processor such as a CPU 101, a storage device such as a RAM 102, a ROM 103, and an HDD 104, and a network I / F 105 that is a communication interface connected to a network such as a LAN. And these are connected via the bus 110.

本実施形態の画像処理装置1は、例えば、ネットワークに接続されたスキャナやホストコンピュータから処理対象の画像(入力画像Im0)をネットワークI/F105を介して取得する。そして、画像処理装置1は、この入力画像Im0を処理することで高圧縮PDFファイルFImを生成し、生成した高圧縮PDFファイルFImをHDD104に蓄積したり、ネットワークI/F105を介してネットワークに接続されたホストコンピュータに送信したりする。入力画像Im0から高圧縮PDFファイルFImを生成する機能は、例えば、CPU101が、RAM102をワークエリアとして利用し、ROM103やHDD104などに格納された所定のプログラムを実行することにより実現される。   For example, the image processing apparatus 1 according to the present embodiment acquires an image to be processed (input image Im0) from a scanner or a host computer connected to a network via the network I / F 105. The image processing apparatus 1 then processes the input image Im0 to generate a high-compression PDF file FIm. The generated high-compression PDF file FIm is stored in the HDD 104 or connected to the network via the network I / F 105. Sent to the designated host computer. The function of generating the highly compressed PDF file FIm from the input image Im0 is realized, for example, when the CPU 101 uses the RAM 102 as a work area and executes a predetermined program stored in the ROM 103, the HDD 104, or the like.

なお、本実施形態の画像処理装置1は、例えばコピー機や複合機など、スキャナを備える画像形成装置の一機能として実現することもできる。この場合、図2に示すようなコンピュータシステムを画像形成装置が備える。そして、例えば、画像形成装置内部のCPU101が、RAM102をワークエリアとして利用し、ROM103やHDD104などに格納された所定のプログラムを実行することにより、スキャナあるいはネットワーク越しに取得した入力画像Im0から高圧縮PDFファイルFImを生成する機能が実現される。なお、入力画像Im0から高圧縮PDFファイルFImを生成するまでの一連の処理のうち、特にハードウェア実装に適する部分については、その機能を例えばASIC(Application Specific Integrated Circuit)などの専用のハードウェアを用いて実現する構成であってもよい。   Note that the image processing apparatus 1 of the present embodiment can also be realized as a function of an image forming apparatus including a scanner, such as a copier or a multifunction peripheral. In this case, the image forming apparatus includes a computer system as shown in FIG. Then, for example, the CPU 101 in the image forming apparatus uses the RAM 102 as a work area and executes a predetermined program stored in the ROM 103, the HDD 104, or the like, thereby performing high compression from the input image Im0 acquired through the scanner or the network. A function of generating the PDF file FIm is realized. Of the series of processes from the input image Im0 to the generation of the high-compression PDF file FIm, a part that is particularly suitable for hardware implementation is provided with dedicated hardware such as an ASIC (Application Specific Integrated Circuit). It may be a configuration realized by using.

図3は、本実施形態の画像処理装置1の機能的な構成例を示すブロック図である。画像処理装置1は、入力画像Im0から高圧縮PDFファイルFImを生成するための機能的な構成要素として、例えば図3に示すように、線画検出部10(「線画検出手段」の一態様)と、線画色処理部20(「線画色算出手段」の一態様)と、色統一処理部30と、ファイル生成部40(「ファイル生成手段」の一態様)とを備える。本実施形態の画像処理装置1では、処理対象として取得された入力画像Im0が線画検出部10、線画色処理部20およびファイル生成部40に入力され、この入力画像Im0に対応する高圧縮PDFファイルFImがファイル生成部40から出力される。   FIG. 3 is a block diagram illustrating a functional configuration example of the image processing apparatus 1 according to the present embodiment. As a functional component for generating a highly compressed PDF file FIm from an input image Im0, the image processing apparatus 1 includes, for example, a line drawing detection unit 10 (one form of “line drawing detection means”) as shown in FIG. The line drawing color processing unit 20 (one mode of “line drawing color calculating means”), the color unification processing unit 30, and the file generation unit 40 (one mode of “file generation means”) are provided. In the image processing apparatus 1 of the present embodiment, the input image Im0 acquired as a processing target is input to the line drawing detection unit 10, the line drawing color processing unit 20, and the file generation unit 40, and a high-compression PDF file corresponding to the input image Im0. FIm is output from the file generation unit 40.

線画検出部10は、処理対象の入力画像Im0から線画を検出する機能モジュールである。図4は、線画検出部10の具体例を示すブロック図である。線画検出部10は、例えば図4に示すように、第1の検出部11(「第1の検出手段」の一態様)と、エッジ強調部12と、第2の検出部13(「第2の検出手段」の一態様)と、第3の検出部14(「第3の検出手段」の一態様)とをサブモジュールとして含む。   The line drawing detection unit 10 is a functional module that detects a line drawing from the input image Im0 to be processed. FIG. 4 is a block diagram illustrating a specific example of the line drawing detection unit 10. For example, as illustrated in FIG. 4, the line drawing detection unit 10 includes a first detection unit 11 (one aspect of “first detection means”), an edge enhancement unit 12, and a second detection unit 13 (“second detection unit”). And a third detection unit 14 (an aspect of the “third detection means”) as submodules.

第1の検出部11は、処理対象の入力画像Im0に対して線画のエッジを検出する処理を行い、その結果(以下、「エッジ検出結果」と呼ぶ)を出力する。この第1の検出部11が行う処理は、例えば特許第3088010号公報に記載された方法と同様に、入力画像Im0の3値化により得られる黒画素や白画素の連続性、パターンを利用して、文字などの線画と網点とを分離することで、線画を構成するエッジを検出する処理である。ここでエッジ検出結果とは、例えば、第1の検出部11により線画のエッジとして検出された画素群の入力画像Im0における座標位置を表す座標データである。このエッジ検出結果は、エッジ強調部12および第3の検出部14に入力される。   The first detection unit 11 performs processing for detecting the edge of the line drawing on the input image Im0 to be processed, and outputs the result (hereinafter referred to as “edge detection result”). The processing performed by the first detection unit 11 uses, for example, the continuity and pattern of black pixels and white pixels obtained by the ternarization of the input image Im0, as in the method described in Japanese Patent No. 3088010. This is a process of detecting edges constituting a line drawing by separating a line drawing such as a character and a halftone dot. Here, the edge detection result is, for example, coordinate data representing the coordinate position of the pixel group detected as the edge of the line drawing by the first detection unit 11 in the input image Im0. The edge detection result is input to the edge enhancement unit 12 and the third detection unit 14.

エッジ強調部12は、第1の検出部11から受け取ったエッジ検出結果を用いて、処理対象の入力画像Im0に含まれる線画のエッジを強調する処理を行い、線画のエッジが強調されたエッジ強調画像を生成する。このエッジ強調部12によるエッジ強調の処理は、第1の検出部11のエッジ検出結果を用いて行われるため、入力画像Im0に含まれる絵柄のエッジを強調してしまう可能性が少ない。このため、エッジ強調の度合いを大きくすることができ、線画のエッジが明確に強調されたエッジ強調画像を生成することができる。エッジ強調部12により生成されたエッジ強調画像は、第2の検出部13に入力される。   The edge enhancement unit 12 uses the edge detection result received from the first detection unit 11 to perform processing for enhancing the edge of the line drawing included in the input image Im0 to be processed, and edge enhancement in which the edge of the line drawing is enhanced Generate an image. Since the edge enhancement processing by the edge enhancement unit 12 is performed using the edge detection result of the first detection unit 11, there is little possibility of enhancing the pattern edge included in the input image Im0. For this reason, the degree of edge enhancement can be increased, and an edge enhanced image in which the edges of the line drawing are clearly enhanced can be generated. The edge enhanced image generated by the edge enhancing unit 12 is input to the second detection unit 13.

第2の検出部13は、エッジ強調部12から受け取ったエッジ強調画像に対して線画の領域を検出する処理を行い、その結果(以下、「領域検出結果」と呼ぶ)を出力する。この第2の検出部13による処理は、例えば特許文献1に記載された方法と同様に、エッジ強調画像を2値化して得られる2値化画像から黒画素や白画素の連結成分を抽出し、連結成分の外接矩形の大きさや位置関係などに基づいて連結成分をグループ化して、グループに含まれる線画の領域を検出する処理である。特許文献1に記載の方法は、代表的な線画である文字が文字行を構成することが多い点に着目し、文字行を構成する連結成分をグループ化して文字行に含まれる文字の領域を検出している。ここで領域検出結果とは、例えば、第2の検出部13により検出された領域に含まれる画素群の入力画像Im0における座標位置を表す座標データである。この領域検出結果は、第3の検出部14に入力される。   The second detection unit 13 performs a process of detecting a line drawing region on the edge enhanced image received from the edge enhancement unit 12 and outputs the result (hereinafter referred to as “region detection result”). The processing by the second detection unit 13 extracts, for example, connected components of black pixels and white pixels from a binarized image obtained by binarizing the edge-enhanced image, similarly to the method described in Patent Document 1. In this process, the connected components are grouped based on the size and positional relationship of the circumscribed rectangle of the connected components, and a line drawing area included in the group is detected. The method described in Patent Document 1 pays attention to the fact that characters, which are representative line drawings, often form a character line, grouping connected components that constitute a character line, and determining the character region included in the character line. Detected. Here, the region detection result is, for example, coordinate data representing the coordinate position of the pixel group included in the region detected by the second detection unit 13 in the input image Im0. The region detection result is input to the third detection unit 14.

第3の検出部14は、第1の検出部11から受け取ったエッジ検出結果と、第2の検出部13から受け取った領域検出結果とを用いて、入力画像Im0から線画を検出する処理を行い、その結果(以下、「線画検出結果」と呼ぶ)を出力する。具体的には、第3の検出部14は、第1の検出部11によるエッジ検出結果と、第2の検出部13による領域検出結果とのOR演算により、第1の検出部11により検出されたエッジで囲まれた領域と第2の検出部13により検出された領域との双方を、入力画像Im0からそれぞれ線画として検出する。ここで線画検出結果とは、例えば、第3の検出部14により検出された線画を構成する画素群の入力画像Im0における座標位置を表す座標データである。この線画検出結果は、線画色処理部20に入力される。   The third detection unit 14 performs a process of detecting a line drawing from the input image Im0 using the edge detection result received from the first detection unit 11 and the region detection result received from the second detection unit 13. The result (hereinafter referred to as “line drawing detection result”) is output. Specifically, the third detection unit 14 is detected by the first detection unit 11 by OR operation of the edge detection result by the first detection unit 11 and the region detection result by the second detection unit 13. Both the region surrounded by the edges and the region detected by the second detection unit 13 are detected as line drawings from the input image Im0. Here, the line drawing detection result is, for example, coordinate data representing the coordinate position in the input image Im0 of the pixel group constituting the line drawing detected by the third detection unit 14. The line drawing detection result is input to the line drawing color processing unit 20.

線画色処理部20は、背景色の影響を除去した線画色を算出する機能モジュールである。図5は、線画色処理部20の具体例を示すブロック図である。線画色処理部20は、例えば図5に示すように、線画色算出部21と、背景色算出部22と、線幅算出部23と、線画色補正部24とをサブモジュールとして含む。   The line drawing color processing unit 20 is a functional module that calculates a line drawing color from which the influence of the background color is removed. FIG. 5 is a block diagram illustrating a specific example of the line drawing color processing unit 20. As shown in FIG. 5, for example, the line drawing color processing unit 20 includes a line drawing color calculation unit 21, a background color calculation unit 22, a line width calculation unit 23, and a line drawing color correction unit 24 as submodules.

線画色算出部21は、線画検出部10の第3の検出部14から受け取った線画検出結果を用いて、処理対象の入力画像Im0に含まれるすべての線画の位置を特定する。そして、線画色算出部21は、入力画像Im0から抽出した各線画のそれぞれについて、色数および線画色を算出する。また、背景色算出部22は、入力画像Im0から抽出された各線画の背景色を算出する。   The line drawing color calculation unit 21 uses the line drawing detection result received from the third detection unit 14 of the line drawing detection unit 10 to specify the positions of all line drawings included in the input image Im0 to be processed. The line drawing color calculation unit 21 calculates the number of colors and the line drawing color for each line drawing extracted from the input image Im0. In addition, the background color calculation unit 22 calculates the background color of each line drawing extracted from the input image Im0.

ここで、本実施形態における色の算出方法の具体例について説明する。画像における色の算出は様々な方法で実現できるが、本実施形態では、一例として、入力画像Im0のRGBデータから変換されるHSVデータを用いるものとする。HSVは、色相(H)、彩度(S)および明度(V)により色を表現する色空間である。ここでは、入力画像Im0のRGBデータがRGB各色8ビット(値域:0〜255)で表現されるものとする。また、HSVデータのSおよびVの値域は、RGBデータと同じく0〜255であるものとする。HSVデータのHは色相を表すため、2πの範囲の値(値域:0〜359)をとる。   Here, a specific example of the color calculation method in the present embodiment will be described. Although the calculation of the color in the image can be realized by various methods, in the present embodiment, HSV data converted from the RGB data of the input image Im0 is used as an example. HSV is a color space that expresses a color by hue (H), saturation (S), and lightness (V). Here, it is assumed that the RGB data of the input image Im0 is represented by 8 bits (value range: 0 to 255) for each color of RGB. Further, it is assumed that the S and V value ranges of the HSV data are 0 to 255 as in the RGB data. Since H in the HSV data represents a hue, it takes a value in the range of 2π (value range: 0 to 359).

RGBデータのR,G,Bの最大値をMAX、最小値をMINとすると、下記式(1)〜(5)を用いてRGBデータをHSVデータに変換することができる。
MAX=Rのとき:H=60×((G−B)÷(MAX−MIN)) ・・・(1)
MAX=Gのとき:H=60×((B−R)÷(MAX−MIN))+120 ・・・(2)
MAX=Bのとき:H=60×((R−G)÷(MAX−MIN))+240 ・・・(3)
ただし、H<0の場合は360を加算する。また、R=G=Bの場合はHの値を不定とする。
S=((MAX−MIN)÷MAX)×255 ・・・(4)
ただし、R=G=Bの場合はS=0とする。
V=MAX ・・・(5)
If the maximum value of R, G, B of RGB data is MAX and the minimum value is MIN, RGB data can be converted into HSV data using the following equations (1) to (5).
When MAX = R: H = 60 × ((GB) ÷ (MAX−MIN)) (1)
When MAX = G: H = 60 × ((BR) ÷ (MAX−MIN)) + 120 (2)
When MAX = B: H = 60 × ((RG) ÷ (MAX−MIN)) + 240 (3)
However, 360 is added when H <0. When R = G = B, the value of H is undefined.
S = ((MAX−MIN) ÷ MAX) × 255 (4)
However, S = 0 when R = G = B.
V = MAX (5)

本実施形態では、例えば、有彩色については、色相(H)の値に応じた赤、黄、緑、シアン、青、マゼンタの6種類の分類と、明度(V)の値に応じた11種類(等間隔)の分類とを組み合わせた66種類に色を分類するものとする。また、無彩色については、明度(V)の値に応じた11種類(黒、白とその間を等間隔)に色を分類するものとする。なお、この分類はあくまで一例であり、色の分類数などは任意に設定することができる。また、有彩色は明度(V)の値を用いずに色相(H)の値のみで分類してもよい。有彩色か無彩色かは、例えば彩度(S)の値を用いて判定できる。例えば、S≦5であれば無彩色、S>5であれば有彩色と判定する。また、既存のACS(Auto Color Selection)と呼ばれる技術を用いて入力画像Im0がカラー画像かモノクロ画像かを判定し、入力画像Im0がモノクロ画像の場合はすべての色を無彩色と判定するようにしてもよい。   In the present embodiment, for example, for chromatic colors, there are six types of red, yellow, green, cyan, blue, and magenta according to the hue (H) value, and 11 types according to the value of brightness (V). It is assumed that the colors are classified into 66 types in combination with (equal intervals) classification. As for achromatic colors, the colors are classified into 11 types (black, white and equal intervals between them) according to the value of brightness (V). Note that this classification is merely an example, and the number of color classifications can be arbitrarily set. Further, the chromatic colors may be classified only by the hue (H) value without using the lightness (V) value. Whether it is a chromatic color or an achromatic color can be determined using, for example, the value of saturation (S). For example, if S ≦ 5, an achromatic color is determined, and if S> 5, a chromatic color is determined. In addition, it is determined whether the input image Im0 is a color image or a monochrome image using a technique called existing ACS (Auto Color Selection). If the input image Im0 is a monochrome image, all colors are determined to be achromatic colors. May be.

線画色算出部21は、例えば、以下のように線画の色数を算出することができる。まず、線画を構成する各画素(例えば2×2画素といった所定単位の画素ブロックでもよい)のRGBデータをHSVデータに変換し、HSVデータの平均値を算出する。そして、この平均値との差分(例えばHSV色空間におけるユークリッド距離)が所定値以上の画素(以下、「離散画素」と呼ぶ)が線画内に存在するか否かを確認し、離散画素が存在する場合は、線画全体の画素数に対する離散画素の画素数の割合をさらに算出する。そして、線画内に離散画素が存在しない場合、あるいは、線画全体の画素数に対する離散画素の画素数の割合が所定値未満の場合は、線画の色数を1とする。一方、線画内に離散画素があり、かつ、線画全体の画素数に対する離散画素の画素数の割合が所定値以上である場合は、線画の色数を2以上であると推定する。そして、線画の色数が2以上と推定した場合は、例えば、離散画素のHSV色空間における分布を表すヒストグラムを算出し、このヒストグラムに現れるピークの数に基づいて線画の色数を算出する。   The line drawing color calculation unit 21 can calculate the number of line drawing colors as follows, for example. First, RGB data of each pixel constituting a line drawing (for example, a pixel block of a predetermined unit such as 2 × 2 pixels) is converted into HSV data, and an average value of the HSV data is calculated. Then, it is confirmed whether or not a pixel (hereinafter referred to as “discrete pixel”) having a difference from the average value (for example, Euclidean distance in the HSV color space) equal to or larger than a predetermined value exists in the line drawing, and there is a discrete pixel. In this case, the ratio of the number of pixels of the discrete pixels to the number of pixels of the entire line drawing is further calculated. Then, when there are no discrete pixels in the line drawing, or when the ratio of the number of discrete pixels to the total number of pixels in the line drawing is less than a predetermined value, the number of colors of the line drawing is set to 1. On the other hand, when there are discrete pixels in the line drawing and the ratio of the number of pixels of the discrete pixels to the total number of pixels in the line drawing is a predetermined value or more, the number of colors of the line drawing is estimated to be two or more. When it is estimated that the number of colors of the line drawing is 2 or more, for example, a histogram representing the distribution of discrete pixels in the HSV color space is calculated, and the number of colors of the line drawing is calculated based on the number of peaks appearing in the histogram.

また、線画色算出部21は、例えば、以下のように線画色を算出することができる。すなわち、線画の色数が1であれば、その線画を構成する各画素のHSVデータの平均値を、その線画の線画色として算出する。また、線画の色数が2以上であれば、各色のそれぞれについてHSVデータの平均値を線画色として算出する。なお、平均値の代わりにヒストグラムのピークの色や最も明度が高い色を線画色とするといった方法でもよい。こうして算出された線画色は、有彩色であれば上述の66種類のいずれか、無彩色であれば上述の11種類のいずれかに分類することができる。例えば、線画色が有彩色の場合の色相(H)の値について、0≦H<30または330≦H<360であれば赤、30≦H<90であれば黄、90≦H<150であれば緑、150≦H<210であればシアン、210≦H<270であれば青、270≦H<330であればマゼンタといったように、線画色を分類できる。   Moreover, the line drawing color calculation part 21 can calculate a line drawing color as follows, for example. That is, if the number of colors of the line drawing is 1, the average value of HSV data of each pixel constituting the line drawing is calculated as the line drawing color of the line drawing. If the number of colors of the line drawing is 2 or more, the average value of HSV data is calculated as the line drawing color for each color. Instead of the average value, a method may be used in which the peak color of the histogram or the color with the highest brightness is used as the line drawing color. The line drawing colors calculated in this way can be classified into any one of the above 66 types if they are chromatic colors, and any one of the above 11 types if they are achromatic colors. For example, when the line drawing color is a chromatic color, the hue (H) value is red if 0 ≦ H <30 or 330 ≦ H <360, yellow if 30 ≦ H <90, and 90 ≦ H <150. Line drawing colors can be classified as green if there is 150, cyan if 150 ≦ H <210, blue if 210 ≦ H <270, and magenta if 270 ≦ H <330.

背景色算出部22は、例えば、以下のように線画の背景色を算出することができる。すなわち、線画に隣接(1画素程度の隙間があってもよい)する所定の大きさおよび形状の領域を選択し、この領域内の各画素のRGBデータをHSVデータに変換して、その平均値を線画の背景色とする。この背景色についても、線画色と同様に、有彩色であれば上述の66種類のいずれか、無彩色であれば上述の11種類のいずれかに分類することができる。また、入力画像Im0が原稿をスキャナで読み取った画像であり、画像処理装置1が原稿の地肌色(原稿の本来の色)を検出する機能を持つ場合、検出された原稿の地肌色を線画候補の背景色としてもよい。   For example, the background color calculation unit 22 can calculate the background color of a line drawing as follows. That is, a region having a predetermined size and shape adjacent to the line drawing (which may have a gap of about one pixel) is selected, and RGB data of each pixel in this region is converted into HSV data, and an average value thereof Is the background color of the line drawing. Similarly to the line drawing color, this background color can be classified into any of the above-mentioned 66 types if it is a chromatic color and any of the above-mentioned 11 types if it is an achromatic color. When the input image Im0 is an image obtained by reading a document with a scanner and the image processing apparatus 1 has a function of detecting the background color of the document (original color of the document), the detected background color of the document is used as a line drawing candidate. The background color may be used.

背景色が有彩色もしくは灰色の場合、この背景色の映り込みによって線画色算出部21により算出された色数が増えている場合がある。そこで、線画色算出部21は、色数が2以上の線画に対して、背景色算出部22により算出された背景色を用いて、色数を再計算する。例えば、線画色算出部21は、線画を構成する画素のうち、背景色算出部22により算出された背景色から所定のユークリッド距離内にある色を持つ画素を除いた上で、上述した方法により線画の色数を再計算する。また、線画色算出部21は、算出した線画色と背景色算出部22により算出された背景色との平均値から中間色を予測して、その中間色に近い色を持つ画素を除いた上で、上述した方法により線画の色数を再計算してもよい。線画色と背景色との中間色は、平均値以外にも、別の表色系に変換して求めた両者の中点などを使って予測してもよい。また、線画色算出部21は、最初に算出した色数から1を減算するといった単純な方法により、色数の再計算を行ってもよい。このように、線画色算出部21は、背景色の影響を除去した線画の色数を算出する。   When the background color is chromatic or gray, the number of colors calculated by the line drawing color calculation unit 21 may increase due to the reflection of the background color. Therefore, the line drawing color calculation unit 21 recalculates the number of colors using the background color calculated by the background color calculation unit 22 for the line drawing having two or more colors. For example, the line drawing color calculation unit 21 removes pixels having a color within a predetermined Euclidean distance from the background color calculated by the background color calculation unit 22 among the pixels constituting the line drawing, and then performs the above-described method. Recalculate the number of colors in the line drawing. Further, the line drawing color calculation unit 21 predicts an intermediate color from the average value of the calculated line drawing color and the background color calculated by the background color calculation unit 22, and after excluding pixels having a color close to the intermediate color, The number of colors of the line drawing may be recalculated by the method described above. The intermediate color between the line drawing color and the background color may be predicted by using the midpoint of both obtained by conversion to another color system other than the average value. Further, the line drawing color calculation unit 21 may recalculate the number of colors by a simple method such as subtracting 1 from the number of colors calculated first. As described above, the line drawing color calculation unit 21 calculates the number of colors of the line drawing from which the influence of the background color is removed.

なお、以上説明した例は、線画の色数や線画色、背景色などを算出する方法の一例であり、他の方法により線画の色数や線画色、背景色などを算出してもよい。例えば、入力画像Im0のRGBデータをテーブル変換などによりマンセル表色系にマッピングし、マンセル表色系での色相と明度を用いて線画の色数や線画色、背景色などを算出してもよい。   The example described above is an example of a method for calculating the number of line drawing colors, the line drawing color, the background color, and the like. The number of line drawing colors, the line drawing color, the background color, and the like may be calculated by other methods. For example, the RGB data of the input image Im0 may be mapped to the Munsell color system by table conversion or the like, and the number of line drawings, the line drawing color, the background color, etc. may be calculated using the hue and brightness in the Munsell color system. .

線幅算出部23は、入力画像Im0から検出された各線画の線幅を算出する。線画の線幅は、例えば、線画のエッジ間の距離(画素数)などから算出できる。また、線画の外接矩形の総画素数に対する線画の領域内の画素数の割合などから、線画の線幅(太文字かどうか)を算出してもよい。   The line width calculation unit 23 calculates the line width of each line drawing detected from the input image Im0. The line width of the line drawing can be calculated from the distance (number of pixels) between the edges of the line drawing, for example. Further, the line width of the line drawing (whether bold or not) may be calculated from the ratio of the number of pixels in the line drawing area to the total number of pixels of the circumscribed rectangle of the line drawing.

線画色補正部24は、線画色算出部21により算出された各線画の線画色を、背景色算出部22により算出された背景色に応じて補正する。例えば、線画色補正部24は、線幅算出部23により算出された線画の線幅が所定値以上(例えば太文字の場合)であれば、線画を構成する画素のうち、背景色から所定のユークリッド距離内にある色を持つ画素を除いた残りの画素の色の平均値を線画色とするように、線画色算出部21により算出された線画色を補正する。一方、線幅算出部23により算出された線画の線幅が所定値未満(例えば細文字の場合)であれば、線画色算出部21により算出された線画色を背景色から視覚特性的に遠ざける色に補正する。なお、線幅算出部23により算出された線画の線幅が所定値以上の場合は、線画のエッジ近傍のみを補正の対象としてもよい。   The line drawing color correction unit 24 corrects the line drawing color of each line drawing calculated by the line drawing color calculation unit 21 according to the background color calculated by the background color calculation unit 22. For example, if the line width of the line drawing calculated by the line width calculation unit 23 is equal to or larger than a predetermined value (for example, in the case of bold characters), the line drawing color correction unit 24 determines a predetermined value from the background color among the pixels constituting the line drawing. The line drawing color calculated by the line drawing color calculation unit 21 is corrected so that the average value of the colors of the remaining pixels excluding the pixels having colors within the Euclidean distance is set as the line drawing color. On the other hand, if the line width of the line drawing calculated by the line width calculation unit 23 is less than a predetermined value (for example, in the case of fine characters), the line drawing color calculated by the line drawing color calculation unit 21 is visually separated from the background color. Correct to color. If the line width of the line drawing calculated by the line width calculation unit 23 is equal to or larger than a predetermined value, only the vicinity of the edge of the line drawing may be corrected.

また、線画色補正部24は、線画の線幅に関わらず、線画を構成する画素のうち、背景色から所定のユークリッド距離内にある色を持つ画素を除いた残りの画素の色の平均値を線画色とするように補正する方法と、線画色を背景色から視覚特性的に遠ざける色に補正する方法とのいずれか一方を実施する構成であってもよい。この場合、線幅算出部23は不要となる。   In addition, the line drawing color correction unit 24, regardless of the line width of the line drawing, among the pixels constituting the line drawing, the average value of the colors of the remaining pixels excluding the pixels having the color within the predetermined Euclidean distance from the background color It may be configured to implement either one of a method for correcting the line drawing color to be a line drawing color or a method for correcting the line drawing color to a color far from the background color in terms of visual characteristics. In this case, the line width calculation unit 23 becomes unnecessary.

また、線画色補正部24は、例えば線画色算出部21により算出された線画色と背景色算出部22により算出された背景色とが同相の成分を含む場合に、線画色が黒に近い色であれば黒に補正し、白に近い色であれば白に補正するといった方法で線画色を補正してもよい。   In addition, the line drawing color correction unit 24 is a color whose line drawing color is close to black when the line drawing color calculated by the line drawing color calculation unit 21 and the background color calculated by the background color calculation unit 22 include in-phase components, for example. If so, the line drawing color may be corrected by correcting to black and correcting to white if the color is close to white.

また、線画色補正部24は、線画色算出部21により算出された色数が2以上の線画については、それぞれの線画色に対して個別に背景色に応じた補正を行う。例えば、線画色補正部24は、色数が2以上の線画に対して線画色に応じたクラスタリングを行い、クラスタリングの結果ごとに、上述のいずれかの方法によって線画色の補正を行う。   In addition, the line drawing color correction unit 24 performs correction according to the background color individually for each line drawing color for the line drawing having two or more colors calculated by the line drawing color calculation unit 21. For example, the line drawing color correction unit 24 performs clustering according to the line drawing color on the line drawing having two or more colors, and corrects the line drawing color by any of the methods described above for each clustering result.

線画色補正部24は、以上のように、入力画像Im0から検出された各線画の線画色を背景色に応じて補正した結果を、線画データ(1)として出力する。この線画データ(1)には、入力画像Im0から検出された各線画のそれぞれについて、線画を構成する画素群の入力画像Im0における座標位置を表す座標データと、線画色と色数とが含まれる。この線画データ(1)は、色統一処理部30およびファイル生成部40に入力される。   As described above, the line drawing color correction unit 24 outputs, as line drawing data (1), the result of correcting the line drawing color of each line drawing detected from the input image Im0 according to the background color. The line drawing data (1) includes, for each line drawing detected from the input image Im0, coordinate data representing the coordinate position of the pixel group constituting the line drawing in the input image Im0, the line drawing color, and the number of colors. . The line drawing data (1) is input to the color unification processing unit 30 and the file generation unit 40.

色統一処理部30は、所定のグループ単位で線画色を統一する処理を行う機能モジュールである。図6は、色統一処理部30の具体例を示すブロック図である。色統一処理部30は、例えば図6に示すように、統一対象決定部31と、代表色算出部32(「代表色算出手段」の一態様)と、線画色変更部33(「変更手段」の一態様)とをサブモジュールとして含む。   The color unification processing unit 30 is a functional module that performs a process of unifying line drawing colors in predetermined group units. FIG. 6 is a block diagram illustrating a specific example of the color unification processing unit 30. For example, as shown in FIG. 6, the color unification processing unit 30 includes a unification target determination unit 31, a representative color calculation unit 32 (an aspect of “representative color calculation unit”), and a line drawing color change unit 33 (“change unit”). Of the above) as a submodule.

統一対象決定部31は、線画色を統一する対象となる線画のグループを決定する。線画色を統一する対象となる線画のグループの例としては、代表的な線画である文字により構成される文字行が挙げられる。つまり、入力画像Im0に含まれる1つの文字行を1つのグループとする。ただし、線画色を統一するグループはこれに限らず、予め定めた任意の基準に従ってグループを決定すればよい。例えば、1つの文字行を1つのグループとするのではなく、文字が横方向に並ぶ横文字行のすべてを1つのグループとしてもよいし、文字が縦方向に並ぶ縦文字行のすべてを1つのグループとしてもよい。また、入力画像Im0に含まれる文字行全体を1つのグループとしてもよい。さらに、文字行を構成する文字に限らず、入力画像Im0における位置が近い所定数の線画の集合を1つのグループとしてもよいし、入力画像Im0において密集している線画の集合を1つのグループとしてもよい。   The unification target determination unit 31 determines a group of line drawings that are targets for unifying line drawing colors. An example of a group of line drawings that is a target for unifying line drawing colors is a character line composed of characters that are representative line drawings. That is, one character line included in the input image Im0 is set as one group. However, the group that unifies the line drawing colors is not limited to this, and the group may be determined according to a predetermined criterion. For example, instead of making one character line into one group, all horizontal character lines in which characters are arranged in the horizontal direction may be made into one group, or all vertical character lines in which characters are arranged in the vertical direction are made into one group. It is good. Further, the entire character lines included in the input image Im0 may be made into one group. Further, not only the characters constituting the character line but also a set of a predetermined number of line drawings whose positions in the input image Im0 are close may be set as one group, or a set of line drawings that are densely arranged in the input image Im0 is set as one group. Also good.

統一対象決定部31は、線画データ(1)に含まれる各線画の座標データを用いて、入力画像Im0における線画のグループを決定することができる。また、統一対象決定部31は、線画検出部10の第2の検出部13によるグループ化の結果を用いて、入力画像Im0における線画のグループを決定してもよい。   The unification object determining unit 31 can determine a group of line drawings in the input image Im0 using the coordinate data of each line drawing included in the line drawing data (1). Further, the unification target determining unit 31 may determine a group of line drawings in the input image Im0 using the result of grouping by the second detection unit 13 of the line drawing detection unit 10.

代表色算出部32は、線画色処理部20の線画色補正部24から受け取った線画データ(1)を用いて、統一対象決定部31が決定したグループのそれぞれについて代表色を決定する。このとき、代表色算出部32は、グループを構成する線画のうち、所定の条件に当てはまる線画を除外した残りの線画の線画色に基づいて、グループの代表色を算出する。ここで、所定の条件とは、例えば、線画色が予め定めた特定色であるといった条件や、線画の色数が2以上であるという条件である。   The representative color calculation unit 32 determines a representative color for each of the groups determined by the unification target determination unit 31 using the line drawing data (1) received from the line drawing color correction unit 24 of the line drawing color processing unit 20. At this time, the representative color calculation unit 32 calculates the representative color of the group based on the line drawing colors of the remaining line drawings excluding the line drawing that satisfies a predetermined condition among the line drawings constituting the group. Here, the predetermined condition is, for example, a condition that the line drawing color is a predetermined specific color or a condition that the number of colors of the line drawing is two or more.

すなわち、代表色算出部32は、グループを構成する線画のうち、線画色が予め定めた特定色(例えば赤色や青色など)の線画と、色数が2以上の線画を除外する。ここで、線画色が特定色であるか否かは、例えば、上述した方法で算出された線画色の色相(H)の値が特定色の色相(H)の値から±30(度)の範囲にある場合に特定色とするといった方法で判定することができる。なお、この判定方法は一例であり、別の方法で線画色が特定色であるか否かを判定してもよい。線画の色数は、線画色処理部20の線画色補正部24から受け取った線画データ(1)から特定できる。   That is, the representative color calculation unit 32 excludes a line drawing of a specific color (for example, red or blue) whose line drawing color is predetermined and a line drawing having two or more colors from among the line drawings constituting the group. Here, whether or not the line drawing color is a specific color is determined by, for example, the value of the hue (H) of the line drawing color calculated by the above-described method being ± 30 (degrees) from the value of the hue (H) of the specific color. When it is within the range, it can be determined by a method of setting a specific color. This determination method is an example, and it may be determined whether the line drawing color is a specific color by another method. The number of colors of the line drawing can be specified from the line drawing data (1) received from the line drawing color correction unit 24 of the line drawing color processing unit 20.

次に、代表色算出部32は、グループを構成する線画のうち、除外されずに残った線画の線画色の平均値を算出する。そして、代表色算出部32は、算出した平均値に対して色差が基準値を超える線画色の線画をさらに除外し、残った線画の線画色の平均値をさらに算出して、これをグループの代表色とする。なお、線画色の平均値を算出する際に、代表色算出部32は、画素数が大きい線画の線画色ほど重みが大きくなるような重み付けを行って、線画色の平均値を算出することが望ましい。また、線画色の平均値が無彩色で明度が低い場合はグループの代表色を黒、線画色の平均値が無彩色で明度が低い場合はグループの代表色を白としてもよい。   Next, the representative color calculation unit 32 calculates the average value of the line drawing colors of the line drawings that remain without being excluded from the line drawings that form the group. Then, the representative color calculation unit 32 further excludes the line drawing of the line drawing color whose color difference exceeds the reference value with respect to the calculated average value, further calculates the average value of the line drawing colors of the remaining line drawing, and calculates this as the group value. The representative color. When calculating the average value of the line drawing colors, the representative color calculating unit 32 performs weighting such that the weight of the line drawing color of the line drawing having a larger number of pixels increases, thereby calculating the average value of the line drawing colors. desirable. In addition, when the average value of the line drawing colors is an achromatic color and the lightness is low, the representative color of the group may be black, and when the average value of the line drawing colors is an achromatic color and the lightness is low, the representative color of the group may be white.

線画色変更部33は、グループを構成する線画の線画色を、代表色算出部32により算出された代表色に変更する。このとき、線画色変更部33は、線画色の平均値を算出する前に上述の条件に当てはまるとして除外された線画を含め、グループを構成するすべての線画の線画色をグループの代表色に変更してもよいし、グループを構成する線画のうち、上述の条件に当てはまるとして除外された線画を除いた残りの線画の線画色をグループの代表色に変更してもよい。また、線画色を単純に平均値に変更すると線画が見にくくなる可能性があるので、グループの代表色の濃度を背景色に応じて調整した上で、線画色をグループの代表色に変更するといった対策を行ってもよい。   The line drawing color changing unit 33 changes the line drawing color of the line drawing constituting the group to the representative color calculated by the representative color calculating unit 32. At this time, the line drawing color changing unit 33 changes the line drawing colors of all the line drawings constituting the group to the representative color of the group including the line drawing excluded as the above-mentioned condition before calculating the average value of the line drawing colors. Alternatively, the line drawing colors of the remaining line drawings excluding the line drawing that is excluded when the above-described conditions are satisfied among the line drawings constituting the group may be changed to the group representative color. In addition, if the line drawing color is simply changed to the average value, it may be difficult to see the line drawing. Therefore, after adjusting the density of the representative color of the group according to the background color, the line drawing color is changed to the representative color of the group. Countermeasures may be taken.

また、上述の条件に当てはまるとして除外された線画の線画色をグループの代表色に変更しない場合、例えば、除外された線画同士で線画色の平均値を算出し、平均値との色差が所定値以上となる線画色を持つ線画を除外して平均値を算出するといった処理を繰り返して除外された線画の線画色を変更することにより、除外された線画同士で線画色の統一を図るようにしてもよい。   In addition, when the line drawing color of an excluded line drawing is not changed to the group representative color when the above conditions are met, for example, an average value of line drawing colors is calculated between the excluded line drawings, and the color difference from the average value is a predetermined value. By changing the line drawing color of the excluded line drawing by repeating the process of calculating the average value by excluding the line drawing having the line drawing color as described above, the line drawing color is unified among the excluded line drawing. Also good.

線画色変更部33は、以上のように、グループを構成する線画の線画色をグループごとに変更した結果を、線画データ(2)として出力する。この線画データ(2)には、入力画像Im0から検出された線画のうち、グループを構成する線画の変更後の線画色が含まれている。この線画データ(2)は、ファイル生成部40に入力される。   As described above, the line drawing color changing unit 33 outputs the result of changing the line drawing color of the line drawing constituting the group for each group as line drawing data (2). This line drawing data (2) includes the line drawing color after changing the line drawing constituting the group among the line drawings detected from the input image Im0. The line drawing data (2) is input to the file generation unit 40.

ファイル生成部40は、線画色処理部20の線画色補正部24から受け取った線画データ(1)と、色統一処理部30の線画色変更部33から受け取った線画データ(2)とを用いて、処理対象の入力画像Im0から、線画のみからなる2値画像である第1の画像レイヤIm1と、線画色を表現する多値画像である第2の画像レイヤIm2と、線画以外の絵柄および背景を表現する多値画像である第3の画像レイヤIm3とを生成する。このとき、特に線画色を表現する第2の画像レイヤIm2は、グループを構成する線画については線画データ(2)に含まれる線画色を用い、それ以外の線画については線画データ(1)に含まれる線画色を用いて生成される。   The file generation unit 40 uses the line drawing data (1) received from the line drawing color correction unit 24 of the line drawing color processing unit 20 and the line drawing data (2) received from the line drawing color change unit 33 of the color unification processing unit 30. From the input image Im0 to be processed, a first image layer Im1, which is a binary image consisting only of line drawings, a second image layer Im2, which is a multi-value image expressing line drawing colors, and a pattern and background other than line drawings And a third image layer Im3 that is a multi-valued image that expresses. At this time, in particular, the second image layer Im2 expressing the line drawing color uses the line drawing color included in the line drawing data (2) for the line drawing constituting the group, and the other line drawing is included in the line drawing data (1). Generated using the line drawing color.

そして、ファイル生成部40は、第1の画像レイヤIm1および第2の画像レイヤIm2に対しては、線画の圧縮に適した第1の圧縮処理を施すとともに、第3の画像レイヤIm3に対しては、絵柄や背景の圧縮に適した第2の圧縮処理を施す。そして、ファイル生成部40は、圧縮した第1の画像レイヤIm1、第2の画像レイヤIm2および第3の画像レイヤIm3をPDF形式の1つの画像ファイル上で統合し、入力画像Im0に対応する高圧縮PDFファイルFImを生成する。   Then, the file generation unit 40 performs a first compression process suitable for line drawing compression on the first image layer Im1 and the second image layer Im2, and also applies to the third image layer Im3. Performs a second compression process suitable for compression of a pattern and a background. Then, the file generation unit 40 integrates the compressed first image layer Im1, second image layer Im2, and third image layer Im3 on one image file in the PDF format, and generates a high-level image corresponding to the input image Im0. A compressed PDF file FIm is generated.

なお、圧縮の方式は特に限定されるものではなく、第1の画像レイヤIm1と第2の画像レイヤIm2に対しては線画の圧縮に適した方式、第3の画像レイヤIm3に対しては絵柄や背景の圧縮に適した方式で圧縮処理が行われればよい。また、第1の画像レイヤIm1、第2の画像レイヤIm2および第3の画像レイヤIm3を統合する画像ファイルの形式はPDF形式に限定されるものではなく、例えばJPM形式など、複数の画像レイヤを重ね合わせて1つの画像とする様々な形式を利用することができる。ファイル生成部40により生成された高圧縮PDFファイルFImは、上述したように、例えば、HDD104に蓄積される、あるいは、ネットワークI/F105を介してネットワークに接続されたホストコンピュータなどに送信される。   The compression method is not particularly limited, and a method suitable for line drawing compression is used for the first image layer Im1 and the second image layer Im2, and a pattern is used for the third image layer Im3. It is only necessary that the compression process is performed by a method suitable for compression of the background. In addition, the format of the image file that integrates the first image layer Im1, the second image layer Im2, and the third image layer Im3 is not limited to the PDF format. For example, a plurality of image layers such as JPM format can be displayed. Various formats can be used in which one image is superimposed. As described above, the highly compressed PDF file FIm generated by the file generation unit 40 is stored in, for example, the HDD 104 or transmitted to the host computer connected to the network via the network I / F 105.

<画像処理装置の動作>
次に、以上のように構成される本実施形態の画像処理装置1の動作の概要を説明する。図7は、本実施形態の画像処理装置1による動作の流れを説明するフローチャートである。
<Operation of Image Processing Device>
Next, an outline of the operation of the image processing apparatus 1 of the present embodiment configured as described above will be described. FIG. 7 is a flowchart for explaining the flow of operations performed by the image processing apparatus 1 according to the present embodiment.

本実施形態の画像処理装置1の動作が開始されると、まず、ステップS1において、処理対象となる入力画像Im0が取得される。この入力画像Im0は、線画検出部10、線画色処理部20およびファイル生成部40に入力される。   When the operation of the image processing apparatus 1 of the present embodiment is started, first, in step S1, an input image Im0 to be processed is acquired. The input image Im0 is input to the line drawing detection unit 10, the line drawing color processing unit 20, and the file generation unit 40.

次に、ステップS2において、ステップS1で取得した入力画像Im0に対して、線画検出部10の第1の検出部11による処理が行われる。そして、第1の検出部11が出力するエッジ検出結果が、エッジ強調部12と第3の検出部14とに入力される。   Next, in step S2, the process by the first detection unit 11 of the line drawing detection unit 10 is performed on the input image Im0 acquired in step S1. Then, the edge detection result output from the first detection unit 11 is input to the edge enhancement unit 12 and the third detection unit 14.

次に、ステップS3において、エッジ強調部12により、ステップS2のエッジ検出結果を用いて、ステップS1で取得した入力画像Im0に含まれる線画のエッジを強調する処理が行われ、エッジ強調画像が生成される。このエッジ強調画像は、第2の検出部13に入力される。   Next, in step S3, the edge enhancement unit 12 performs a process of enhancing the edge of the line drawing included in the input image Im0 acquired in step S1, using the edge detection result in step S2, and generates an edge enhanced image. Is done. This edge enhanced image is input to the second detection unit 13.

次に、ステップS4において、ステップS3で生成されたエッジ強調画像に対して、第2の検出部13による処理が行われる。そして、第2の検出部13が出力する領域検出結果が、第3の検出部14に入力される。   Next, in step S4, processing by the second detection unit 13 is performed on the edge enhanced image generated in step S3. Then, the region detection result output by the second detection unit 13 is input to the third detection unit 14.

次に、ステップS5において、第3の検出部14により、ステップS2のエッジ検出結果とステップS4の領域検出結果とを用いて、ステップS1で取得した入力画像Im0から線画が検出される。そして、第3の検出部14が出力する線画検出結果が、線画色処理部20に入力される。   Next, in step S5, the third detector 14 detects a line drawing from the input image Im0 acquired in step S1, using the edge detection result in step S2 and the region detection result in step S4. Then, the line drawing detection result output from the third detection unit 14 is input to the line drawing color processing unit 20.

次に、ステップS6において、ステップS5の線画検出結果を用いて、ステップS1で取得した入力画像Im0に含まれる各線画に対して、線画色処理部20による処理が行われる。そして、線画色処理部20が出力する線画データ(1)が、色統一処理部30とファイル生成部40とに入力される。   Next, in step S6, the line drawing color processing unit 20 performs processing on each line drawing included in the input image Im0 acquired in step S1, using the line drawing detection result in step S5. The line drawing data (1) output from the line drawing color processing unit 20 is input to the color unification processing unit 30 and the file generation unit 40.

次に、ステップS7において、ステップS6の線画データ(1)を用いて、色統一処理部30による処理が行われる。そして、色統一処理部30が出力する線画データ(2)が、ファイル生成部40に入力される。   Next, in step S7, the color unification processing unit 30 performs processing using the line drawing data (1) in step S6. Then, the line drawing data (2) output from the color unification processing unit 30 is input to the file generation unit 40.

次に、ステップS8において、ファイル生成部40により、ステップS6の線画データ(1)とステップS7の線画データ(2)とを用いて、ステップS1で取得した入力画像Im0から第1の画像レイヤIm1、第2の画像レイヤIm2および第3の画像レイヤIm3が生成される。そして、各画像レイヤに対して個別の圧縮処理を施した後に1つの画像ファイルへ統合する処理が行われ、入力画像Im0に対応する高圧縮PDFファイルFImが生成される。   Next, in step S8, the file generation unit 40 uses the line drawing data (1) in step S6 and the line drawing data (2) in step S7 to input the first image layer Im1 from the input image Im0 acquired in step S1. A second image layer Im2 and a third image layer Im3 are generated. Then, after performing individual compression processing on each image layer, processing for integration into one image file is performed, and a highly compressed PDF file FIm corresponding to the input image Im0 is generated.

そして最後に、ステップS9において、ステップS8で生成された高圧縮PDFファイルFImがファイル生成部40から出力され、例えばHDD104に蓄積される、あるいは、ネットワークI/F105を介してネットワークに接続されたホストコンピュータなどに送信される。   Finally, in step S9, the highly compressed PDF file FIm generated in step S8 is output from the file generation unit 40 and stored in, for example, the HDD 104 or connected to the network via the network I / F 105. Sent to a computer etc.

<第1の検出部による処理の具体例>
次に、第1の検出部11による処理の具体例について、図8を参照して説明する。第1の検出部11による処理は、上述したように、入力画像Im0の3値化により得られる黒画素や白画素の連続性、パターンを利用して、文字などの線画と網点とを分離することで、線画を構成するエッジを検出する処理である。図8は、第1の検出部11による処理の一例を説明するフローチャートである。
<Specific Example of Processing by First Detection Unit>
Next, a specific example of processing by the first detection unit 11 will be described with reference to FIG. As described above, the processing by the first detection unit 11 separates line images such as characters from halftone dots using the continuity and pattern of black pixels and white pixels obtained by ternization of the input image Im0. By doing so, it is a process of detecting edges constituting the line drawing. FIG. 8 is a flowchart for explaining an example of processing by the first detection unit 11.

第1の検出部11は、まず、処理対象の入力画像Im0に対して、フィルタリングによるMTF補正を行う(ステップS101)。MTF補正は、次の3値化の精度を高めるために実施される前処理である。このMTF補正用のフィルタには、例えば特許第3088010号公報に記載のものを用いることができる。   First, the first detection unit 11 performs MTF correction by filtering on the input image Im0 to be processed (step S101). The MTF correction is a preprocessing performed to increase the accuracy of the next ternarization. As this MTF correction filter, for example, the filter described in Japanese Patent No. 3088010 can be used.

次に、第1の検出部11は、MTF補正された入力画像Im0に対し3値化を実施して(ステップS102)、入力画像Im0を黒画素、白画素、灰色画素に分ける。   Next, the first detection unit 11 performs ternarization on the MTF-corrected input image Im0 (step S102), and divides the input image Im0 into black pixels, white pixels, and gray pixels.

次に、第1の検出部11は、例えば特許第3088010号公報に記載されているように、黒連結画素や白連結画素のパターンマッチングにより入力画像Im0から黒線画や白線画を抽出することで、入力画像Im0に含まれる線画のエッジを検出する(ステップS103)。   Next, as described in, for example, Japanese Patent No. 3088010, the first detection unit 11 extracts a black line image and a white line image from the input image Im0 by pattern matching of black connected pixels and white connected pixels. Then, the edge of the line drawing included in the input image Im0 is detected (step S103).

そして、第1の検出部11は、ステップS103の処理結果をエッジ検出結果として出力し(ステップS104)、一連の処理を終了する。   Then, the first detection unit 11 outputs the processing result of step S103 as an edge detection result (step S104), and ends a series of processing.

<第2の検出部による処理の具体例>
次に、第2の検出部13による処理の具体例について、図9を参照して説明する。第2の検出部13による処理は、上述したように、エッジ強調部12により生成されたエッジ強調画像を2値化して得られる2値化画像から黒画素や白画素の連結成分を抽出し、連結成分の外接矩形の大きさや位置関係などに基づいて連結成分をグループ化して、グループに含まれる線画の領域を検出する処理である。図9は、第2の検出部13による処理の一例を説明するフローチャートである。
<Specific Example of Processing by Second Detection Unit>
Next, a specific example of processing by the second detection unit 13 will be described with reference to FIG. As described above, the processing by the second detection unit 13 extracts the connected components of black pixels and white pixels from the binarized image obtained by binarizing the edge enhanced image generated by the edge enhancing unit 12, This is a process for grouping connected components based on the size of the circumscribed rectangle of the connected components, the positional relationship, and the like, and detecting a line drawing area included in the group. FIG. 9 is a flowchart illustrating an example of processing by the second detection unit 13.

第2の検出部13は、まず、エッジ強調部12により生成されたエッジ強調画像に対して2値化を実施する(ステップS201)。ここでの2値化は背景よりも低輝度のオブジェクトを抽出するための処理であり、低輝度のオブジェクトを背景と区別できる適切な閾値が設定される。また、背景との分離精度を高めるために動的閾値2値化を用いてもよい。   First, the second detection unit 13 performs binarization on the edge enhanced image generated by the edge enhancing unit 12 (step S201). The binarization here is a process for extracting an object having a lower luminance than the background, and an appropriate threshold value that can distinguish the low luminance object from the background is set. Also, dynamic threshold binarization may be used to increase the separation accuracy from the background.

次に、第2の検出部13は、例えば特許文献1に記載されているように、ステップS201で得られた2値化画像から、水平方向に並ぶ黒画素のランと垂直方向に並ぶ黒画素のランを連結して連結成分を取得する(ステップS202)。   Next, as described in, for example, Patent Document 1, the second detection unit 13 uses, from the binarized image obtained in step S201, a black pixel line arranged in the vertical direction and a black pixel line arranged in the horizontal direction. Are connected to obtain a connected component (step S202).

次に、第2の検出部13は、ステップS202で取得した連結成分のうち、サイズが小さい連結成分を除去する(ステップS203)。この処理は、次のグループ化における計算量を削減するための処理である。   Next, the second detection unit 13 removes a connected component having a small size from the connected components acquired in Step S202 (Step S203). This process is a process for reducing the amount of calculation in the next grouping.

次に、第2の検出部13は、ステップS202で取得され、ステップS203で除去されなかった連結成分を、連結成分の外接矩形の大きさや位置関係などに基づいて結合し、グループ化する(ステップS204)。ここでのグループ化は、代表的な線画である文字を行単位でグループ化するなど、予め定めた規則に従う。したがって、グループ化されない連結成分も存在する。   Next, the second detection unit 13 combines and groups the connected components acquired in step S202 and not removed in step S203 based on the size and positional relationship of the circumscribed rectangle of the connected components (step S202). S204). The grouping here follows a predetermined rule such as grouping characters that are representative line drawings in line units. Therefore, there are connected components that are not grouped.

次に、第2の検出部13は、エッジ強調部12により生成されたエッジ強調画像に対して、再度、2値化を実施する(ステップS205)。ここでの2値化は背景よりも高輝度のオブジェクトを抽出するための処理であり、高輝度のオブジェクトを背景と区別できる適切な閾値が設定される。また、背景との分離精度を高めるために動的閾値2値化を用いてもよい。   Next, the second detection unit 13 performs binarization again on the edge enhanced image generated by the edge enhancing unit 12 (step S205). The binarization here is a process for extracting an object having a higher luminance than the background, and an appropriate threshold value that can distinguish the high luminance object from the background is set. Also, dynamic threshold binarization may be used to increase the separation accuracy from the background.

次に、第2の検出部13は、例えば特許文献1に記載されているように、ステップS205で得られた2値化画像から、水平方向に並ぶ白画素のランと垂直方向に並ぶ白画素のランを連結して連結成分を取得する(ステップS206)。   Next, as described in Patent Document 1, for example, the second detection unit 13 uses white pixels arranged in the vertical direction and white pixels arranged in the horizontal direction from the binarized image obtained in step S205. Are connected to obtain a connected component (step S206).

次に、第2の検出部13は、ステップS206で取得された連結成分を、連結成分の外接矩形の大きさや位置関係などに基づいて結合し、グループ化する(ステップS207)。ここでのグループ化も、ステップS204と同様、代表的な線画である文字を行単位でグループ化するなど、予め定めた規則に従う。したがって、グループ化されない連結成分も存在する。   Next, the second detection unit 13 combines and groups the connected components acquired in step S206 based on the size and positional relationship of the circumscribed rectangle of the connected components (step S207). The grouping here also follows a predetermined rule such as grouping characters that are representative line drawings in units of lines, as in step S204. Therefore, there are connected components that are not grouped.

次に、第2の検出部13は、ステップS204で結合した連結成分のグループと、ステップS207で結合した連結成分のグループとで、エッジ強調画像における位置が重なるグループがあるかどうかを判断する(ステップS208)。そして、重なるグループがあれば(ステップS208:Yes)、それらのグループの外接矩形のサイズを比較して、外接矩形のサイズが小さい方のグループを削除する(ステップS209)。   Next, the second detection unit 13 determines whether or not there is a group in which the positions in the edge-enhanced image overlap between the group of connected components combined in step S204 and the group of connected components combined in step S207 ( Step S208). If there are overlapping groups (step S208: Yes), the sizes of the circumscribed rectangles of these groups are compared, and the group with the smaller size of the circumscribed rectangle is deleted (step S209).

次に、第2の検出部13は、以上の処理によりエッジ強調画像から抽出されたグループに含まれる連結成分の領域を、入力画像Im0に含まれる線画の領域として検出する(ステップS210)。そして、第2の検出部13は、ステップS210の処理結果を領域検出結果として出力し(ステップS211)、一連の処理を終了する。   Next, the second detection unit 13 detects a connected component area included in the group extracted from the edge-enhanced image by the above processing as a line drawing area included in the input image Im0 (step S210). And the 2nd detection part 13 outputs the process result of step S210 as an area | region detection result (step S211), and complete | finishes a series of processes.

<線画色処理部による処理の具体例>
次に、線画色処理部20による処理の具体例について、図10を参照して説明する。図10は、線画色処理部20による処理の一例を説明するフローチャートである。
<Specific Example of Processing by Line Drawing Color Processing Unit>
Next, a specific example of processing by the line drawing color processing unit 20 will be described with reference to FIG. FIG. 10 is a flowchart illustrating an example of processing performed by the line drawing color processing unit 20.

線画検出部10から線画色処理部20に対して線画検出結果が入力されると、まず、線画色算出部21が、線画検出部10から受け取った線画検出結果に基づいて、処理対象の入力画像Im0に含まれる線画のうちの1つを取り出す(ステップS301)。   When a line drawing detection result is input from the line drawing detection unit 10 to the line drawing color processing unit 20, the line drawing color calculation unit 21 first inputs an input image to be processed based on the line drawing detection result received from the line drawing detection unit 10. One of the line drawings included in Im0 is extracted (step S301).

次に、線画色算出部21は、ステップS301で取り出した線画を構成する各画素のRGBデータをHSVデータに変換し、例えば上述した方法により、この線画の線画色と色数を算出する(ステップS302)。   Next, the line drawing color calculation unit 21 converts the RGB data of each pixel constituting the line drawing extracted in step S301 into HSV data, and calculates the line drawing color and the number of colors of this line drawing by, for example, the method described above (step). S302).

次に、背景色算出部22が、ステップS301で取り出された線画に隣接(1画素程度の隙間があってもよい)する所定の大きさおよび形状の領域を選択し、この領域内の各画素のRGBデータをHSVデータに変換して、例えば上述した方法により背景色を算出する(ステップS303)。   Next, the background color calculation unit 22 selects a region having a predetermined size and shape that is adjacent to the line drawing extracted in step S301 (there may be a gap of about one pixel), and each pixel in this region The RGB data is converted into HSV data, and the background color is calculated, for example, by the method described above (step S303).

次に、線画色算出部21が、ステップS302で算出した線画の色数が1かどうかを確認し(ステップS304)、線画の色数が2以上の場合は(ステップS304:No)、ステップS303で算出された背景色に基づいて、例えば上述した方法により、ステップS301で取り出された線画の色数を再計算する(ステップS305)。   Next, the line drawing color calculation unit 21 checks whether or not the line drawing color number calculated in step S302 is 1 (step S304). If the line drawing color number is 2 or more (step S304: No), step S303 is executed. Based on the background color calculated in step 1, the number of colors of the line drawing extracted in step S301 is recalculated by the method described above, for example (step S305).

一方、ステップS302で算出された線画の色数が1の場合(ステップS304:Yes)、あるいは、ステップS305で再計算された線画の色数が1の場合は(ステップS306:Yes)、線画色補正部24が、例えば上述した方法により、ステップS302で算出された線画色を、ステップS303で算出された背景色に応じて補正する(ステップS307)。   On the other hand, when the number of colors of the line drawing calculated in step S302 is 1 (step S304: Yes), or when the number of colors of the line drawing recalculated in step S305 is 1 (step S306: Yes), the line drawing color. The correction unit 24 corrects the line drawing color calculated in step S302 according to the background color calculated in step S303, for example, by the method described above (step S307).

一方、ステップS305で再計算された線画の色数が2以上の場合には(ステップS306:No)、線画色補正部24は、それぞれの線画色に応じて線画を構成する各画素のクラスタリングを行う(ステップS308)。そして、線画色補正部24は、ステップS308のクラスタリングの結果ごとに、線画色を背景色に応じて補正する(ステップS309)。   On the other hand, when the number of colors of the line drawing recalculated in step S305 is 2 or more (step S306: No), the line drawing color correction unit 24 performs clustering of each pixel constituting the line drawing according to each line drawing color. This is performed (step S308). Then, the line drawing color correction unit 24 corrects the line drawing color according to the background color for each clustering result in step S308 (step S309).

次に、線画色補正部24は、未処理の線画があるか否かを判定する(ステップS310)。そして、未処理の線画があれば(ステップS310:Yes)、ステップS301に戻って以降の処理が繰り返される。一方、すべての線画に対して処理が終了すると(ステップS310:No)、線画色補正部24は、入力画像Im0に含まれる各線画の座標データ、線画色および色数を含む線画データ(1)を出力し(ステップS311)、一連の処理を終了する。   Next, the line drawing color correction unit 24 determines whether there is an unprocessed line drawing (step S310). If there is an unprocessed line drawing (step S310: Yes), the process returns to step S301 and the subsequent processing is repeated. On the other hand, when the processing is completed for all the line drawings (step S310: No), the line drawing color correction unit 24 performs line drawing data (1) including the coordinate data, line drawing colors, and the number of colors of each line drawing included in the input image Im0. Is output (step S311), and the series of processing ends.

本実施形態の画像処理装置1では、以上のように、線画色処理部20による処理によって、入力画像Im0に含まれる各線画の線画色が背景色に応じて補正されるので、線画が背景色の影響を受けている場合であっても、その背景色の影響を排除した適切な線画色を算出することができる。そして、この線画色を用いて第2の画像レイヤIm2を生成することにより、高画質の線画を再現可能な高圧縮PDFファイルFImを生成することができる。   In the image processing apparatus 1 according to the present embodiment, as described above, the line drawing color of each line drawing included in the input image Im0 is corrected according to the background color by the processing by the line drawing color processing unit 20, so that the line drawing is the background color. Even if it is influenced by the above, it is possible to calculate an appropriate line drawing color excluding the influence of the background color. Then, by generating the second image layer Im2 using this line drawing color, it is possible to generate a highly compressed PDF file FIm that can reproduce a high-quality line drawing.

図11は、背景色の影響によって線画のエッジ近傍が変色した様子を示す図である。例えばスキャナによる原稿の読み取りなどによって取得された入力画像Im0に含まれる線画は、図11に示すように、背景色の影響によってエッジ近傍が変色する場合がある。図11の例では、黒色の線画である「黒」という文字のエッジ近傍に背景色の青色が写り込んで変色した様子を示している。   FIG. 11 is a diagram illustrating a state in which the vicinity of the edge of the line drawing has changed color due to the influence of the background color. For example, the line drawing included in the input image Im0 acquired by reading a document with a scanner or the like may change the vicinity of the edge due to the influence of the background color, as shown in FIG. The example of FIG. 11 shows a state in which the blue color of the background color is reflected near the edge of the character “black” which is a black line drawing.

図12は、背景色に応じて線画色を補正する処理の具体例を説明する図であり、(a)は元の原稿に含まれる線画を表し、(b)は背景色の影響によりエッジ近傍が変色した線画を表し、(c)は線画色が補正された線画を表している。この図12の例では、青色を背景色とする黒色の「黒」という太文字を補正対象の線画の例として示している。   12A and 12B are diagrams for explaining a specific example of processing for correcting the line drawing color according to the background color. FIG. 12A shows the line drawing included in the original document, and FIG. 12B shows the vicinity of the edge due to the influence of the background color. Represents a line drawing in which the color has changed, and (c) represents a line drawing in which the line drawing color has been corrected. In the example of FIG. 12, a thick black character “black” with blue as a background color is shown as an example of a line drawing to be corrected.

図12(a)に示すような黒色の太文字は、背景色である青色の影響によって、図12(b)に示すように、エッジ近傍が青色に近い色に変色する場合がある。この場合、例えば、この太文字を構成する画素のうち、背景色から所定のユークリッド距離内にある色を持つ画素、つまり、背景色である青色に近いエッジ近傍の画素を除いた残りの画素の色の平均値を線画色とするように補正することによって、図12(c)のように、背景色の影響を排除して図12(a)に示す黒色の太文字を再現できる。   A black bold character as shown in FIG. 12A may change its color near the edge to a color close to blue, as shown in FIG. 12B, due to the influence of blue as the background color. In this case, for example, among the pixels constituting the bold character, the pixels having a color within a predetermined Euclidean distance from the background color, that is, the pixels other than the pixels near the edge close to the blue background color are excluded. By correcting the average value of the colors so as to be a line drawing color, as shown in FIG. 12C, the influence of the background color can be eliminated and the black thick character shown in FIG. 12A can be reproduced.

図13は、背景色に応じて線画色を補正する処理の具体例を説明する図であり、図12の例と同様に、(a)は元の原稿に含まれる線画を表し、(b)は背景色の影響によりエッジ近傍が変色した線画を表し、(c)は線画色が補正された線画を表している。この図13の例では、青色を背景色とする黒色の水平ラインを補正対象の線画の例として示している。図13に例示する水平ラインのような線で表現されるオブジェクトは文字の範疇からは外れるが、圧縮の際に文字と同様に扱うことが望ましいオブジェクトであるため、本実施形態では、文字と同様に扱われる線画として入力画像Im0から検出される。   FIG. 13 is a diagram for explaining a specific example of the process of correcting the line drawing color in accordance with the background color. Like the example of FIG. 12, (a) represents a line drawing included in the original document, and (b) Represents a line drawing in which the vicinity of the edge is discolored due to the influence of the background color, and (c) represents a line drawing with the line drawing color corrected. In the example of FIG. 13, a black horizontal line with blue as a background color is shown as an example of a line drawing to be corrected. Although an object represented by a line such as a horizontal line illustrated in FIG. 13 is out of the category of characters, it is an object that should be handled in the same way as characters during compression. Are detected from the input image Im0.

図13(a)に示すような黒色の水平ラインは、背景色である青色の影響によって、図13(b)に示すように、エッジ近傍が青色に近い色に変色する場合がある。この場合、例えば、この水平ラインを構成する画素のうち、背景色から所定のユークリッド距離内にある色を持つ画素、つまり、背景色である青色に近いエッジ近傍の画素を除いた残りの画素の色の平均値を線画色とするように補正することで、図13(c)のように、背景色の影響を排除して図13(a)に示す黒色の水平ラインを再現できる。   A black horizontal line as shown in FIG. 13A may be changed to a color close to blue as shown in FIG. 13B due to the influence of blue as the background color. In this case, for example, of the pixels constituting the horizontal line, the pixels having a color within a predetermined Euclidean distance from the background color, that is, the remaining pixels excluding the pixels near the edge that is close to the blue background color are excluded. By correcting the average value of the colors so as to be the line drawing color, it is possible to eliminate the influence of the background color and reproduce the black horizontal line shown in FIG. 13A as shown in FIG.

図14は、背景色に応じて線画色を補正する処理の具体例を説明する図であり、(a)は元の原稿に含まれる線画を表し、(b)は背景色の影響により全体が変色した線画を表し、(c)は線画色が補正された線画を表している。この図14の例では、青色を背景色とする黒色の「黒文字」という細文字の文字列を補正対象の線画の例として示している。   FIG. 14 is a diagram for explaining a specific example of the process of correcting the line drawing color according to the background color. FIG. 14A shows a line drawing included in the original document, and FIG. 14B shows the whole due to the influence of the background color. The line drawing which changed color is represented, (c) represents the line drawing in which the line drawing color was corrected. In the example of FIG. 14, a character string of a black character “black character” with a blue background is shown as an example of a line drawing to be corrected.

図14(a)に示すような黒色の細文字は、背景色である青色の影響によって、図14(b)に示すように、文字全体が青色に近い色に変色する場合がある。この場合、例えば、青色に近い変色した細文字の色を、背景色である青色から視覚特性的に遠ざける色に補正することで、図14(c)に示すように、背景色の影響を排除して図14(a)に示す黒色の細文字を再現できる。   A black fine character as shown in FIG. 14A may be discolored to a color close to blue as shown in FIG. 14B due to the influence of blue as the background color. In this case, for example, the influence of the background color is eliminated as shown in FIG. 14C by correcting the color of the fine character discolored close to blue to a color that is visually separated from the background color blue. Thus, the black thin characters shown in FIG. 14A can be reproduced.

なお、以上の図12乃至図14の例のように、背景色の影響により変色した線画色が黒色に近いと判断できる場合、つまり、線画色が背景色と同相の成分を含み、かつ、明度が所定値よりも低い場合には、この線画色を単純に黒色に補正するようにしても同様の効果を得ることができる。また、背景色の影響により変色した線画色が白色に近いと判断できる場合、つまり、線画色が背景色と同相の成分を含み、かつ、明度が所定値よりも高い場合には、この線画色を単純に白色に補正するようにしても同様の効果を得ることができる。   Note that, as in the examples of FIGS. 12 to 14 described above, when it can be determined that the line drawing color changed due to the influence of the background color is close to black, that is, the line drawing color includes a component in phase with the background color, and brightness If is lower than a predetermined value, the same effect can be obtained even if the line drawing color is simply corrected to black. In addition, when it can be determined that the line drawing color changed due to the influence of the background color is close to white, that is, when the line drawing color includes a component in phase with the background color and the lightness is higher than a predetermined value, this line drawing color. The same effect can be obtained by simply correcting the color to white.

図15は、背景色に応じて線画色を補正する処理の具体例を説明する図であり、(a)は元の原稿に含まれる線画を表し、(b)は背景色の影響によりエッジ近傍が変色した線画を表し、(c)は線画色に応じたクラスタリングを行わずに線画色が補正された線画を表し、(d)は線画色に応じたクラスタリングの結果ごとに線画色が補正された線画を表している。この図15の例は、黒色の「印」という文字の上に赤色の印鑑が押印された部分が1つの線画として検出された場合に、この部分の線画色を補正する例であり、線画の背景色は白色であるものとする。この例は、色数が2以上の線画に対して線画色を補正する処理の具体例である。   FIG. 15 is a diagram for explaining a specific example of the process of correcting the line drawing color according to the background color. (A) shows the line drawing included in the original document, and (b) shows the vicinity of the edge due to the influence of the background color. (C) shows a line drawing in which the line drawing color is corrected without performing clustering according to the line drawing color, and (d) shows a line drawing color corrected for each result of clustering according to the line drawing color. Represents a line drawing. The example in FIG. 15 is an example of correcting the line drawing color of a line drawing when a portion where a red stamp is stamped on a black character “mark” is detected as one line drawing. The background color is assumed to be white. This example is a specific example of processing for correcting a line drawing color for a line drawing having two or more colors.

図15(a)に示すような線画は、背景色である白色の影響によって、図15(b)に示すように、黒色の「印」の文字が灰色、赤色の印鑑の部分が薄い赤色に変色する場合がある。この場合、線画の色数は2であるが、線画色に応じたクラスタリングをせずに線画全体に対して一律に線画色の補正を行うと、図15(c)に示すように、黒色の「印」の文字と赤色の印鑑の部分の双方が共通の濃い赤色で表現されることになり、図15(a)に示す正しい線画を再現できない。これに対して、線画色に応じたクラスタリングを行い、クラスタリングの結果ごとに、それぞれの線画色を背景色である白から視覚的に遠ざける色に補正することによって、図15(d)に示すように、背景色の影響を排除して、図15(a)に示す正しい線画を再現できる。   The line drawing as shown in FIG. 15 (a) has the effect of white as the background color, so that the black “mark” character is gray and the red stamp part is light red as shown in FIG. 15 (b). It may change color. In this case, although the number of colors of the line drawing is 2, if the line drawing color is uniformly corrected for the entire line drawing without performing clustering according to the line drawing color, as shown in FIG. Both the character “mark” and the red stamp part are expressed in a common dark red color, and the correct line drawing shown in FIG. 15A cannot be reproduced. On the other hand, clustering according to the line drawing color is performed, and for each clustering result, the line drawing color is corrected to a color visually away from the white background color as shown in FIG. In addition, the correct line drawing shown in FIG. 15A can be reproduced without the influence of the background color.

<色統一処理部による処理の具体例>
次に、色統一処理部30による処理の具体例について、図16を参照して説明する。図16は、色統一処理部30による処理の一例を説明するフローチャートである。
<Specific Example of Processing by Color Unification Processing Unit>
Next, a specific example of processing by the color unification processing unit 30 will be described with reference to FIG. FIG. 16 is a flowchart for explaining an example of processing by the color unification processing unit 30.

線画色処理部20から色統一処理部30に対して線画データ(1)が入力されると、まず、統一対象決定部31が、この線画データ(1)に含まれる各線画の座標データを用いて、入力画像Im0における線画のグループを決定する(ステップS401)。   When the line drawing data (1) is input from the line drawing color processing unit 20 to the color unification processing unit 30, first, the unification target determination unit 31 uses the coordinate data of each line drawing included in the line drawing data (1). Thus, a group of line drawings in the input image Im0 is determined (step S401).

次に、代表色算出部32が、ステップS401で決定されたグループのうちの1つを取り出す(ステップS402)。そして、代表色算出部32は、ステップS402で取り出したグループを構成する線画のうち、線画色が予め定めた特定色(例えば赤色や青色など)の線画を除外する(ステップS403)。さらに、代表色算出部32は、ステップS402で取り出したグループを構成する線画のうち、色数が2以上の線画を除外する(ステップS404)。そして、代表色算出部32は、ステップS403およびステップS404で除外されずに残った線画の線画色の平均値を算出する(ステップS405)。   Next, the representative color calculation unit 32 extracts one of the groups determined in step S401 (step S402). Then, the representative color calculation unit 32 excludes a line drawing of a specific color (for example, red or blue) having a predetermined line drawing color from the line drawing configuring the group extracted in step S402 (step S403). Further, the representative color calculation unit 32 excludes line drawings having two or more colors from among the line drawings constituting the group extracted in step S402 (step S404). Then, the representative color calculation unit 32 calculates the average value of the line drawing colors of the line drawings that remain without being excluded in Step S403 and Step S404 (Step S405).

次に、代表色算出部32は、ステップS402で取り出したグループを構成する線画のうち、ステップS405で算出した平均値に対して色差が基準値を超える線画色の線画をさらに除外する(ステップS406)。そして、代表色算出部32は、ステップS406でも除外されずに残った線画の線画色の平均値を、ステップS402で取り出したグループの代表色として算出する(ステップS407)。   Next, the representative color calculation unit 32 further excludes the line drawing of the line drawing color in which the color difference exceeds the reference value with respect to the average value calculated in step S405 from the line drawing configuring the group extracted in step S402 (step S406). ). Then, the representative color calculation unit 32 calculates the average value of the line drawing colors of the line drawings that remain without being excluded in step S406 as the group representative color extracted in step S402 (step S407).

次に、線画色変更部33が、ステップS403、ステップS404およびステップS406で除外されずに残った線画の線画色を、ステップS407で算出された代表色に変更する(ステップS408)。そして、線画色変更部33は、未処理のグループがあるか否かを判定する(ステップS409)。そして、未処理のグループがあれば(ステップS409:Yes)、ステップS402に戻って以降の処理が繰り返される。一方、すべてのグループに対して処理が終了すると(ステップS409:No)、線画色変更部33は、入力画像Im0から検出された線画のうち、グループを構成する線画の変更後の線画色を含む線画データ(2)を出力し(ステップS410)、一連の処理を終了する。   Next, the line drawing color changing unit 33 changes the line drawing color of the line drawing that remains without being excluded in Step S403, Step S404, and Step S406 to the representative color calculated in Step S407 (Step S408). The line drawing color changing unit 33 determines whether there is an unprocessed group (step S409). If there is an unprocessed group (step S409: Yes), the process returns to step S402 and the subsequent processing is repeated. On the other hand, when the processing is completed for all the groups (step S409: No), the line drawing color changing unit 33 includes the line drawing color after changing the line drawing configuring the group among the line drawings detected from the input image Im0. The line drawing data (2) is output (step S410), and the series of processing ends.

本実施形態の画像処理装置1では、以上のように、色統一処理部30による処理によって、色を統一する単位となるグループを構成する線画のうち、所定の条件に当てはまる線画を除外した残りの線画の線画色に基づいてグループの代表色が算出され、グループを構成する線画の線画色がグループの代表色に変更される。したがって、この線画色を用いて第2の画像レイヤIm2を生成することにより、線画の色の再現性を損なうことなく圧縮率を高めることができる。   In the image processing apparatus 1 according to the present embodiment, as described above, by the processing performed by the color unification processing unit 30, the remaining line drawings excluding line drawings that meet a predetermined condition from among line drawings that form a group that is a unit for unifying colors. A group representative color is calculated based on the line drawing color of the line drawing, and the line drawing color of the line drawing constituting the group is changed to the group representative color. Therefore, by generating the second image layer Im2 using this line drawing color, the compression ratio can be increased without impairing the color reproducibility of the line drawing.

図17は、線画色を統一する単位となるグループを決定する方法の具体例を説明する図であり、代表的な線画である文字により構成される文字行を1つのグループとする場合の例を示している。入力画像Im0において、縦方向と横方向とに文字が並んでいる場合、これらの文字をグループ化したときに、1つの文字が縦行と横行の両方に所属することがある。この場合には、例えば図17(a)に示すように、縦方向と横方向の文字間隔を比べたり、図17(b)に示すように、縦方向と横方向の行間隔を比べたりすることにより、入力画像Im0に含まれる各文字を適切に文字行としてグループ化することができる。図17(a)および(b)の例では、それぞれの文字が横行を構成する文字としてグループ化される。   FIG. 17 is a diagram for explaining a specific example of a method for determining a group that is a unit for unifying line drawing colors, and an example in which a character line composed of characters that are representative line drawings is set as one group. Show. When characters are arranged in the vertical direction and the horizontal direction in the input image Im0, when these characters are grouped, one character may belong to both the vertical row and the horizontal row. In this case, for example, the vertical and horizontal character spacings are compared as shown in FIG. 17A, or the vertical and horizontal line spacings are compared as shown in FIG. 17B. Thus, the characters included in the input image Im0 can be appropriately grouped as character lines. In the example of FIGS. 17A and 17B, each character is grouped as a character constituting a horizontal line.

図18は、グループの代表色を算出する処理の具体例を説明する図である。この例では、図18(a)に示すように、「あいうえおかきくけこ」という文字列がグループを構成しており、このうち、文字「う」は赤色、文字「け」は青色であり、ほかの文字は黒色であるとする。また、文字「お」には緑色の「裏」という文字が重なっており、さらに、文字「お」と「か」の間に緑色の「※1」という記号および数字が挿入されているものとする。   FIG. 18 is a diagram illustrating a specific example of processing for calculating a representative color of a group. In this example, as shown in FIG. 18 (a), the character string "Aiue Okeki Kekko" constitutes a group, of which the character "U" is red and the character "KE" is blue. The other characters are assumed to be black. In addition, the letter “O” is overlapped with the letter “O” in green, and the symbol “# 1” and the number “green” are inserted between the letters “O” and “ka”. To do.

まず、図18(a)に示す文字列から、特定色である赤色の文字「う」と、特定色である青色の文字「け」が除外される。その結果、残った文字列は、図18(b)のようになる。   First, from the character string shown in FIG. 18A, the red character “U” as a specific color and the blue character “K” as a specific color are excluded. As a result, the remaining character string is as shown in FIG.

次に、図18(b)に示す文字列から、色数が2となる部分、つまり緑色の「裏」という文字が重なった黒色の文字「お」が除外される。その結果、残った文字列は、図18(c)のようになる。   Next, from the character string shown in FIG. 18B, the portion where the number of colors is 2, that is, the black character “o” where the green “back” character overlaps is excluded. As a result, the remaining character string is as shown in FIG.

次に、図18(c)に示す文字列の色の平均値が算出され、この平均値に対して色差が基準値を超える緑色の「※1」という記号および数字が、図18(c)に示す文字列から除外される。その結果、残った文字列は、図18(d)のようになる。   Next, the average value of the color of the character string shown in FIG. 18 (c) is calculated, and the green “* 1” symbol and number whose color difference exceeds the reference value with respect to this average value are shown in FIG. 18 (c). It is excluded from the character string shown in. As a result, the remaining character string is as shown in FIG.

最後に、図18(d)に示す文字列の色の平均値が、このグループの代表色として算出される。そして、図18(d)に示す文字列に含まれる各文字の色が、グループの代表色に変更される。なお、グループの代表色による色の変更は、図18(a)に示す文字列の全体を対象として行ってもよい。   Finally, the average color value of the character string shown in FIG. 18D is calculated as the representative color of this group. Then, the color of each character included in the character string shown in FIG. 18D is changed to the group representative color. Note that the color change by the representative color of the group may be performed on the entire character string shown in FIG.

<実施形態の効果>
以上、具体的な例を挙げながら詳細に説明したように、本実施形態の画像処理装置1は、処理対象の入力画像Im0から検出した線画をグループ化し、グループを構成する線画のうち、所定の条件に当てはまる線画を除外した残りの線画の線画色に基づいて、グループの代表色を算出している。そして、グループを構成する線画の線画色を代表色に変更して、線画色を表現する第2の画像レイヤIm2を生成している。したがって、線画色の再現性を損なうことなく第2の画像レイヤIm2の圧縮率を高めることができ、高圧縮PDFにおける圧縮の効率を向上させることができる。
<Effect of embodiment>
As described above in detail with specific examples, the image processing apparatus 1 according to the present embodiment groups the line drawings detected from the input image Im0 to be processed, and among the line drawings constituting the group, The representative color of the group is calculated based on the line drawing colors of the remaining line drawings excluding the line drawing that meets the conditions. Then, the line drawing color of the line drawing constituting the group is changed to the representative color to generate the second image layer Im2 expressing the line drawing color. Therefore, the compression rate of the second image layer Im2 can be increased without impairing the reproducibility of the line drawing color, and the compression efficiency in the high compression PDF can be improved.

また、所定の条件に当てはまる線画として、色数が2以上の線画や、線画色が赤色や青色などの特定色である線画を除外した場合、これらの線画は色自体に意味があることが想定されるので、このような線画を除外した残りの線画を対象として線画色の変更を行うことにより、第2の画像レイヤIm2の圧縮率を高めながら、意味のある色を再現することができる。   In addition, when line drawings satisfying a predetermined condition are excluded from line drawings having two or more colors, or line drawings having a specific color such as red or blue, the colors themselves are assumed to be meaningful. Therefore, by changing the line drawing color for the remaining line drawing excluding such a line drawing, a meaningful color can be reproduced while increasing the compression rate of the second image layer Im2.

<第1変形例>
なお、以上説明した実施形態においては、線画色を統一するグループを予め定めた任意の基準に従って決定するようにしているが、要求される処理速度に応じて、グループを構成する線画の数を切り替える構成としてもよい。具体的には、要求される処理速度が高速であるほど、グループを構成する線画の数を少なくする。例えば、代表的な線画である文字の文字色統一を図る場合、要求される処理速度が高速であれば、文字行全体で文字色の統一を図るのではなく、処理速度に応じた文字数で文字をグループ化して、このグループ単位で文字色を代表色に変更する。これにより、要求される処理速度を実現できる範囲内で線画色の統一による圧縮率の向上を図ることができ、処理速度が低下することによるユーザの不満を解消することができる。
<First Modification>
In the embodiment described above, the group for unifying the line drawing color is determined according to a predetermined arbitrary standard, but the number of line drawings constituting the group is switched according to the required processing speed. It is good also as a structure. Specifically, the higher the required processing speed, the smaller the number of line drawings constituting the group. For example, when trying to unify the character color of characters that are typical line drawings, if the required processing speed is high, the character color is not unified across the entire character line, but with the number of characters according to the processing speed. Are grouped, and the character color is changed to the representative color for each group. As a result, the compression rate can be improved by unifying the line drawing colors within a range in which the required processing speed can be realized, and user dissatisfaction due to the reduction in processing speed can be eliminated.

<第2変形例>
また、線画色変更部33による線画色の変更を実施するか否か、つまり、色統一処理部30による線画色の統一を行うか否かを、要求される圧縮率に応じて切り替える構成としてもよい。すなわち、色統一処理部30による線画色の統一を行わなくても、要求される圧縮率が達成できる場合は、色統一処理部30による線画色の統一を行わないようにして、線画単位で算出された線画色を用いて第2の画像レイヤIm2を生成する。これにより、要求される圧縮率を確保しながら線画色の再現性をより高めることができるとともに、処理速度の低下を抑制することができる。
<Second Modification>
Further, a configuration may be adopted in which whether to change the line drawing color by the line drawing color changing unit 33, that is, whether to unify the line drawing color by the color unification processing unit 30, is switched according to the required compression ratio. Good. That is, if the required compression rate can be achieved without performing line drawing color unification by the color unification processing unit 30, the line unification processing unit 30 does not unify the line drawing colors and calculates in line drawing units. A second image layer Im2 is generated using the line drawing color that has been set. As a result, the reproducibility of the line drawing color can be further improved while ensuring the required compression rate, and a decrease in the processing speed can be suppressed.

<第3変形例>
また、以上説明した実施形態では、処理対象の入力画像Im0から線画を検出する方法の具体的な一例を説明したが、入力画像Im0から線画を検出する方法はこの例に限らない。例えば、第3の検出部14が、第1の検出部11のエッジ検出結果から色地上の線画のエッジや白色の線画のエッジを除去した後に、第1の検出部11のエッジ検出結果と第2の検出部13の領域検出結果とのOR演算を行って、入力画像Im0から線画を検出する構成としてもよい。また、第1の検出部11のエッジ検出結果は、エッジ強調部12によるエッジ強調画像の生成のみに利用してもよい。また、これとは逆に、第1の検出部11のエッジ検出結果を第3の検出部14による線画の検出のみに利用し、第2の検出部13がエッジ強調画像から線画の領域を検出する代わりに入力画像Im0から線画の領域を検出する構成としてもよい。また、第2の検出部13は、サイズの小さい連結成分を除去する処理を行わずに、抽出したすべての連結成分を対象として連結成分のグループ化を行う構成としてもよい。そのほか、処理対象の入力画像Im0から線画を検出する方法としては、上述の例に限らず、画像から文字などの線画を検出する既存の方法をいずれも利用することができる。
<Third Modification>
In the embodiment described above, a specific example of the method for detecting a line drawing from the input image Im0 to be processed has been described. However, the method for detecting a line drawing from the input image Im0 is not limited to this example. For example, after the third detection unit 14 removes the edge of the line drawing on the color ground or the edge of the white line drawing from the edge detection result of the first detection unit 11, the edge detection result of the first detection unit 11 Alternatively, a line drawing may be detected from the input image Im0 by performing an OR operation with the area detection result of the second detection unit 13. Further, the edge detection result of the first detection unit 11 may be used only for the generation of an edge enhanced image by the edge enhancement unit 12. On the contrary, the edge detection result of the first detection unit 11 is used only for the detection of the line drawing by the third detection unit 14, and the second detection unit 13 detects the area of the line drawing from the edge enhanced image. Instead of this, the line drawing area may be detected from the input image Im0. Moreover, the 2nd detection part 13 is good also as a structure which groups the connection component for all the extracted connection components as an object, without performing the process which removes the connection component with a small size. In addition, the method for detecting a line drawing from the input image Im0 to be processed is not limited to the above example, and any existing method for detecting a line drawing such as a character from the image can be used.

<補足説明>
上述した実施形態および変形例において説明した画像処理装置1の機能的な構成要素(線画検出部10(第1の検出部11、エッジ強調部12、第2の検出部13および第3の検出部14)、線画色処理部20(線画色算出部21、背景色算出部22、線幅算出部23および線画色補正部24)、色統一処理部30(統一対象決定部31、代表色算出部32および線画色変更部33)およびファイル生成部40)は、上述したように、例えば図1に示したハードウェアとソフトウェア(プログラム)との協働により実現することができる。この場合、上記プログラムは、画像処理装置1にインストール可能な形式または実行可能な形式のファイルでCD−ROM、フレキシブルディスク(FD)、CD−R、DVDなどのコンピュータで読み取り可能な記録媒体に記録して提供される。また、上記プログラムを、インターネットなどのネットワークに接続されたコンピュータ上に格納し、ネットワーク経由で画像処理装置1にダウンロードさせることにより提供するように構成してもよい。さらに、上記プログラムを、インターネットなどのネットワーク経由で提供または配布するように構成してもよい。また、上記プログラムを、例えば画像処理装置1内のROM103やHDD104などに予め組み込んで提供するようにしてもよい。
<Supplementary explanation>
Functional components of the image processing apparatus 1 described in the above-described embodiments and modifications (line image detection unit 10 (first detection unit 11, edge enhancement unit 12, second detection unit 13, and third detection unit) 14), line drawing color processing unit 20 (line drawing color calculation unit 21, background color calculation unit 22, line width calculation unit 23 and line drawing color correction unit 24), color unification processing unit 30 (unification target determination unit 31, representative color calculation unit) 32, the line drawing color changing unit 33), and the file generating unit 40) can be realized, for example, by the cooperation of the hardware and software (program) shown in FIG. In this case, the program is recorded in a computer-readable recording medium such as a CD-ROM, a flexible disk (FD), a CD-R, or a DVD in a format that can be installed in the image processing apparatus 1 or an executable format. Provided. Further, the program may be provided by being stored on a computer connected to a network such as the Internet and downloaded to the image processing apparatus 1 via the network. Furthermore, the program may be configured to be provided or distributed via a network such as the Internet. Further, the program may be provided by being incorporated in advance in, for example, the ROM 103 or the HDD 104 in the image processing apparatus 1.

また、上述した実施形態および変形例において説明した画像処理装置1の機能的な構成要素は、その一部または全部を、例えばASIC(Application Specific Integrated Circuit)やFPGA(Field-Programmable Gate Array)などの専用のハードウェアを用いて実現することもできる。   In addition, the functional components of the image processing apparatus 1 described in the above-described embodiments and modifications are partly or entirely such as, for example, an ASIC (Application Specific Integrated Circuit) or an FPGA (Field-Programmable Gate Array). It can also be realized using dedicated hardware.

また、上述した実施形態および変形例では、画像処理装置1を単体の装置として実現する例を想定したが、画像処理装置1の機能的な構成要素を物理的に分離した複数の装置に分散して設け、これら複数の装置の連携により、画像処理装置1としての動作が実現されるように構成してもよい。   In the embodiment and the modification described above, the example in which the image processing device 1 is realized as a single device is assumed. However, the functional components of the image processing device 1 are distributed to a plurality of physically separated devices. The operation as the image processing apparatus 1 may be realized by cooperation of the plurality of apparatuses.

以上、本発明の具体的な実施形態および変形例について説明したが、上述した実施形態は本発明の一適用例を示したものである。本発明は、上述した実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で様々な変形や変更を加えて具体化することができる。   Although specific embodiments and modifications of the present invention have been described above, the above-described embodiments show one application example of the present invention. The present invention is not limited to the above-described embodiment as it is, and can be embodied with various modifications and changes without departing from the scope of the invention in the implementation stage.

1 画像処理装置
10 線画検出部
11 第1の検出部
13 第2の検出部
14 第3の検出部
20 線画色処理部
30 色統一処理部
31 統一対象決定部
32 代表色算出部
33 線画色変更部
40 ファイル生成部
Im0 入力画像
FIm 高圧縮PDFファイル
DESCRIPTION OF SYMBOLS 1 Image processing apparatus 10 Line drawing detection part 11 1st detection part 13 2nd detection part 14 3rd detection part 20 Line drawing color processing part 30 Color unification processing part 31 Unification object determination part 31 Representative color calculation part 33 Line drawing color change 40 File generator Im0 Input image FIm High compression PDF file

特許第4471202号公報Japanese Patent No. 4471202

Claims (10)

画像から線画を検出する線画検出手段と、
前記線画の色である線画色を算出する線画色算出手段と、
色を統一する単位となるグループを構成する前記線画のうち、所定の条件に当てはまる前記線画を除外した残りの前記線画に対して算出された前記線画色に基づいて、前記グループの代表色を算出する代表色算出手段と、
前記グループを構成する前記線画の前記線画色を前記代表色に変更する変更手段と、を備える画像処理装置。
A line drawing detecting means for detecting a line drawing from the image;
Line drawing color calculation means for calculating a line drawing color which is the color of the line drawing;
A representative color of the group is calculated based on the line drawing color calculated for the remaining line drawing excluding the line drawing that satisfies a predetermined condition among the line drawing constituting a group that is a unit for unifying colors. Representative color calculating means for
An image processing apparatus comprising: changing means for changing the line drawing color of the line drawing constituting the group to the representative color.
前記変更手段は、前記グループを構成する前記線画のうち、前記所定の条件に当てはまる前記線画を除外した残りの前記線画の前記線画色を前記代表色に変更する、請求項1に記載の画像処理装置。   The image processing according to claim 1, wherein the changing unit changes the line drawing color of the remaining line drawing excluding the line drawing satisfying the predetermined condition from the line drawing configuring the group to the representative color. apparatus. 前記所定の条件は、前記線画の色数が2以上であるという条件を含む、請求項1または2に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the predetermined condition includes a condition that the number of colors of the line drawing is two or more. 前記所定の条件は、前記線画色が予め定めた特定色であるという条件を含む、請求項1乃至3のいずれか一項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the predetermined condition includes a condition that the line drawing color is a predetermined specific color. 要求される処理速度に応じて、前記グループを構成する前記線画の数を切り替える、請求項1乃至4のいずれか一項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the number of line drawings constituting the group is switched according to a required processing speed. 要求される前記線画の圧縮率に応じて、前記変更手段による前記線画色の変更を実施するか否かを切り替える、請求項1乃至5のいずれか一項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein whether or not to change the line drawing color by the changing unit is switched according to a required compression rate of the line drawing. 前記線画検出手段は、
前記画像から前記線画のエッジを検出する第1の検出手段と、
前記第1の検出手段の検出結果を用いて前記線画のエッジが強調された前記画像から前記線画の領域を検出する第2の検出手段と、
前記第1の検出手段の検出結果と、前記第2の検出手段の検出結果とを用いて、前記画像から前記線画を検出する第3の検出手段と、を含む、請求項1乃至6のいずれか一項に記載の画像処理装置。
The line drawing detection means includes:
First detecting means for detecting an edge of the line drawing from the image;
Second detection means for detecting an area of the line drawing from the image in which an edge of the line drawing is emphasized using a detection result of the first detection means;
7. A third detection unit that detects the line drawing from the image using the detection result of the first detection unit and the detection result of the second detection unit. 8. An image processing apparatus according to claim 1.
前記線画色に基づいて、前記画像に対応する圧縮画像ファイルを生成するファイル生成手段をさらに備える、請求項1乃至7のいずれか一項に記載の画像処理装置。   The image processing apparatus according to claim 1, further comprising: a file generation unit that generates a compressed image file corresponding to the image based on the line drawing color. 画像から線画を検出するステップと、
前記線画の色である線画色を算出するステップと、
色を統一する単位となるグループを構成する前記線画のうち、所定の条件に当てはまる前記線画を除外した残りの前記線画に対して算出された前記線画色に基づいて、前記グループの代表色を算出するステップと、
前記グループを構成する前記線画の前記線画色を前記代表色に変更するステップと、を含む画像処理方法。
Detecting a line drawing from the image;
Calculating a line drawing color which is a color of the line drawing;
A representative color of the group is calculated based on the line drawing color calculated for the remaining line drawing excluding the line drawing that satisfies a predetermined condition among the line drawing constituting a group that is a unit for unifying colors. And steps to
Changing the line drawing color of the line drawing constituting the group to the representative color.
コンピュータに、
画像から線画を検出する機能と、
前記線画の色である線画色を算出する機能と、
色を統一する単位となるグループを構成する前記線画のうち、所定の条件に当てはまる前記線画を除外した残りの前記線画に対して算出された前記線画色に基づいて、前記グループの代表色を算出する機能と、
前記グループを構成する前記線画の前記線画色を前記代表色に変更する機能と、を実現させるためのプログラム。
On the computer,
A function to detect line drawings from images,
A function of calculating a line drawing color which is the color of the line drawing;
A representative color of the group is calculated based on the line drawing color calculated for the remaining line drawing excluding the line drawing that satisfies a predetermined condition among the line drawing constituting a group that is a unit for unifying colors. Function to
And a function for changing the line drawing color of the line drawing constituting the group to the representative color.
JP2015254457A 2015-12-25 2015-12-25 Image processing apparatus, image processing method, and program Active JP6676962B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015254457A JP6676962B2 (en) 2015-12-25 2015-12-25 Image processing apparatus, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015254457A JP6676962B2 (en) 2015-12-25 2015-12-25 Image processing apparatus, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2017118433A true JP2017118433A (en) 2017-06-29
JP6676962B2 JP6676962B2 (en) 2020-04-08

Family

ID=59234689

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015254457A Active JP6676962B2 (en) 2015-12-25 2015-12-25 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP6676962B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9948824B2 (en) 2016-03-18 2018-04-17 Ricoh Company, Ltd. Image compressing device, image forming apparatus, image compressing method, and recording medium
US10523843B2 (en) 2017-11-14 2019-12-31 Ricoh Company, Ltd. Image processing apparatus, image processing method, and non-transitory computer-readable storage medium
JP2021010117A (en) * 2019-07-01 2021-01-28 株式会社リコー Information processing apparatus, image processing apparatus, method, and program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9948824B2 (en) 2016-03-18 2018-04-17 Ricoh Company, Ltd. Image compressing device, image forming apparatus, image compressing method, and recording medium
US10523843B2 (en) 2017-11-14 2019-12-31 Ricoh Company, Ltd. Image processing apparatus, image processing method, and non-transitory computer-readable storage medium
JP2021010117A (en) * 2019-07-01 2021-01-28 株式会社リコー Information processing apparatus, image processing apparatus, method, and program

Also Published As

Publication number Publication date
JP6676962B2 (en) 2020-04-08

Similar Documents

Publication Publication Date Title
KR100994644B1 (en) Image processing apparatus and method thereof
US7382915B2 (en) Color to grayscale conversion method and apparatus
US10115011B2 (en) Document type recognition apparatus, image forming apparatus, document type recognition method, and computer program product
JP4498233B2 (en) Image processing apparatus and image processing method
EP1871088A2 (en) Method and appparatus for image processing
US9773319B2 (en) Image processing apparatus, method, and medium
JP2018121226A (en) Image processing device, image processing method, and program
JP6740612B2 (en) Image processing apparatus, image processing method and program
JP6923037B2 (en) Image processing equipment, image processing methods and programs
US8620081B2 (en) Image processing apparatus, method, and storage medium for determining attributes
JP2019092027A (en) Image processing apparatus, image processing method, and image processing program
US9948824B2 (en) Image compressing device, image forming apparatus, image compressing method, and recording medium
JP6676962B2 (en) Image processing apparatus, image processing method, and program
JP6882083B2 (en) Image processing device, image forming device, image processing method and program
JP6486082B2 (en) Image processing apparatus, image processing method, and program
JP6641982B2 (en) Image processing apparatus, image processing method, and program
JP4047356B2 (en) Image processing device
JP3965647B2 (en) Image processing apparatus, image processing method, program for executing the method, and recording medium storing the program
JPH11136505A (en) Picture processor and picture processing method
JP7413751B2 (en) Image processing systems and programs
JP2008271131A (en) Method and device for image processing, and image forming apparatus
JP2009105808A (en) Image processing apparatus, image processing method, program for executing image processing method, and storage medium
JPH05268467A (en) Color picture processing unit
JP2006094042A (en) Image processor and image processing method
JP2002171416A (en) Image processing apparatus applying processing to color image

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20181108

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20190723

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20190730

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190927

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200225

R151 Written notification of patent or utility model registration

Ref document number: 6676962

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151