JP6056309B2 - Image processing apparatus, image processing method, and program - Google Patents

Image processing apparatus, image processing method, and program Download PDF

Info

Publication number
JP6056309B2
JP6056309B2 JP2012204850A JP2012204850A JP6056309B2 JP 6056309 B2 JP6056309 B2 JP 6056309B2 JP 2012204850 A JP2012204850 A JP 2012204850A JP 2012204850 A JP2012204850 A JP 2012204850A JP 6056309 B2 JP6056309 B2 JP 6056309B2
Authority
JP
Japan
Prior art keywords
color
main
image
colors
line segment
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.)
Expired - Fee Related
Application number
JP2012204850A
Other languages
Japanese (ja)
Other versions
JP2014059759A (en
Inventor
美佐子 宗
美佐子 宗
堀田 悦伸
悦伸 堀田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2012204850A priority Critical patent/JP6056309B2/en
Publication of JP2014059759A publication Critical patent/JP2014059759A/en
Application granted granted Critical
Publication of JP6056309B2 publication Critical patent/JP6056309B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)
  • Image Analysis (AREA)

Description

本発明は、画像からパターンを抽出するための処理を行う画像処理装置、画像処理方法及びプログラムに関する。   The present invention relates to an image processing apparatus, an image processing method, and a program for performing processing for extracting a pattern from an image.

表示された画面をキャプチャしたキャプチャ画像では、文字などのパターンを滑らかに見せるためのアンチエイリアシングによって、パターンと背景の境界近辺にパターンと背景色との中間色が発生する。   In the captured image obtained by capturing the displayed screen, an intermediate color between the pattern and the background color is generated in the vicinity of the boundary between the pattern and the background by anti-aliasing for making a pattern such as a character appear smoothly.

また、画像をスキャンしたスキャン画像では、パターンと背景(紙部分)の境界にボケによる中間色が発生する。   In a scanned image obtained by scanning an image, an intermediate color due to blur occurs at the boundary between the pattern and the background (paper portion).

キャプチャ画像やスキャン画像から、例えば指定色の文字を抽出する場合、アンチエイリアシングやボケによる中間色部分の画素が、文字領域から過剰に落とされたり過剰に組み込まれたりする場合がある。その結果、抽出した文字画像は、掠れたりつぶれたりした画像となる。   For example, when a character of a specified color is extracted from a captured image or a scanned image, pixels in an intermediate color portion due to anti-aliasing or blur may be excessively dropped or incorporated excessively from the character area. As a result, the extracted character image becomes a drowned or crushed image.

図1は、中間色が発生した文字画像の一例を示す図である。図1に示すように、例えばアンチエイリアシングやボケによって中間色部a1が発生している。図1に示す黒い部分がもともとの文字色部a2、白い部分が背景部a3、灰色が中間色部a1となっている。   FIG. 1 is a diagram illustrating an example of a character image in which an intermediate color is generated. As shown in FIG. 1, the intermediate color portion a1 occurs due to, for example, anti-aliasing or blur. The black portion shown in FIG. 1 is the original character color portion a2, the white portion is the background portion a3, and the gray portion is the intermediate color portion a1.

図2は、図1に示す文字色部a2のみを抽出した図である。図2に示すように、中間色部a1は消去されてしまうので、文字の一部が消去されてしまい、元の文字が分からなくなる。   FIG. 2 is a diagram in which only the character color part a2 shown in FIG. 1 is extracted. As shown in FIG. 2, since the intermediate color portion a1 is erased, a part of the character is erased and the original character is not understood.

図3は、図1に示す中間色部a1を適切に振り分けた例を示す図である。図3に示すように、中間色部a1を、文字か背景かを適切に振り分けることによって、元の文字の形状を生成することができる。つまり、アンチエイリアシングやボケにより中間色になった画素を、パターンか背景かに適切に振り分けることが重要になる。   FIG. 3 is a diagram illustrating an example in which the intermediate color portion a1 illustrated in FIG. 1 is appropriately distributed. As shown in FIG. 3, the shape of the original character can be generated by appropriately assigning the intermediate color portion a1 to the character or the background. In other words, it is important to appropriately assign pixels that have become intermediate colors due to anti-aliasing or blur to the pattern or the background.

中間色の振り分けの方法として、例えば、次のような技術がある。この手法では、まず入力されたカラー画像の出現頻度の高い色が主要色として複数抽出され、それ以外の中間色の画素が次の手順で主要色に振り分けられる。   For example, the following technique is used as a method for assigning intermediate colors. In this method, first, a plurality of colors with a high appearance frequency of an input color image are extracted as main colors, and other intermediate pixels are assigned to the main colors in the following procedure.

まず、対象とする中間色画素の、色空間において任意の2つの主要色を結ぶ全線分に対し、対象の中間画素を投影して2つの主要色と投影点との距離が計算される。更に、対象の中間色画素と各線分の両端の主要色に属する画素中で画像上の最短距離、又は線分との距離を考慮して対象画素の属する前景色と背景色の組が決定される。中間色は、決定された組のどちらかの色に振り分けられる(例えば特許文献1参照)。   First, the target intermediate pixel is projected on all the line segments connecting any two main colors in the color space of the target intermediate color pixel, and the distance between the two main colors and the projection point is calculated. Further, the foreground color and background color group to which the target pixel belongs is determined in consideration of the shortest distance on the image or the distance from the line segment among the pixels belonging to the main color at both ends of each line segment. . The intermediate color is assigned to one of the determined sets of colors (see, for example, Patent Document 1).

また、中間色を主要色に振り分ける際、2次元の平面上に中間色点を投影し、平面上で距離が閾値以内の主要色のみを振り分け対象とする技術がある(例えば特許文献2参照)。   Further, there is a technique for projecting an intermediate color point on a two-dimensional plane and distributing only the main color whose distance is within a threshold on the plane when distributing the intermediate color to the main color (see, for example, Patent Document 2).

特開2003−16444号公報JP 2003-16444 A WO2006/030891号公報WO2006 / 030891

しかしながら、特許文献1では、画像から抽出される全ての主要色の組み合わせを用いるため、主要色が増加するにつれて処理時間が大幅に増加するという問題があった。また、特許文献1では、主要色間に中間色が発生していない場合でも、上記の線分処理がなされ、無駄な処理が行われていた。   However, Patent Document 1 uses a combination of all the main colors extracted from the image, so that there is a problem that the processing time increases significantly as the main colors increase. Further, in Patent Document 1, even when no intermediate color is generated between main colors, the above-described line segment processing is performed and wasteful processing is performed.

また、特許文献2では、主要色間の平面上での距離が閾値以上の組み合わせを対象としないことで、主要色の組み合わせを絞り込むことができる。しかし、この方法は、閾値以上に対象とすべき主要色が含まれる場合があり、必ずしも適切な絞込み方法ではなかった。   Further, in Patent Document 2, combinations of main colors can be narrowed down by not targeting combinations whose distance on the plane between the main colors is greater than or equal to the threshold. However, this method may include a main color to be targeted beyond a threshold value, and is not necessarily an appropriate narrowing-down method.

例えば、画像中の文字に、一部の文字線が他の文字線より細くなっている文字(例えば明朝やTimesのフォントの文字)が含まれる場合で、かつ解像度が低い場合、文字線の芯まで中間色となっていることがある(図1参照)。この場合、特許文献2による絞込みを行うと、真の主要色がその絞込みによって判定対象から外れてしまう場合があり、対象画素の色の判定を誤ってしまうという問題があった。   For example, if the characters in the image contain characters that are partly thinner than others (for example, characters in the Mincho or Times font) and the resolution is low, The core may be an intermediate color (see FIG. 1). In this case, when narrowing down according to Patent Document 2, the true main color may be excluded from the determination target due to the narrowing down, and there is a problem that the determination of the color of the target pixel is erroneous.

よって、従来技術では、中間色の振り分け対象となる主要色の組み合わせを適切に求めつつ、処理速度を向上させることができなかった。   Therefore, in the prior art, it has been impossible to improve the processing speed while appropriately obtaining a combination of main colors to be assigned to intermediate colors.

そこで、開示の技術は、中間色の振り分け対象となる主要色の組み合わせを適切に求めつつ、処理速度を向上させることができる画像処理装置、画像処理方法及びプログラムを提供することを目的とする。   Therefore, an object of the disclosed technique is to provide an image processing apparatus, an image processing method, and a program capable of improving the processing speed while appropriately obtaining a combination of main colors to be assigned to intermediate colors.

開示の一態様における画像処理装置は、画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出する主要色抽出部と、前記主要色抽出部により抽出された主要色のうち、異なる2つの主要色の組み合わせを求めて該2つの主要色間の線分を算出し、算出した該線分から各主要色の間に前記色空間で中間色が発生しいない線分を削除して、該2つの主要色間で該中間色が発生している線分を取得する線分算出部と、前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定する決定部と、前記画像中の各中間色を前記決定部により決定された主要色に置換した画像を生成する生成部とを備える。 An image processing apparatus according to an aspect of the disclosure includes a main color extraction unit that extracts a main color including a foreground color and a background color of the image based on a result of associating color information of each pixel of the image with a region of a color space. , Among the main colors extracted by the main color extraction unit, a combination of two different main colors is obtained to calculate a line segment between the two main colors, and the calculated line segment between the main colors remove the line segments that are not neutral occurs in the color space, and the line segment calculation unit that acquires a segment the intermediate color is generated between the two main colors, for each intermediate color in the image, Determining two principal colors having a minimum distance between the intermediate color and the line segment in the color space, determining which of the two main colors the intermediate color belongs to; and each intermediate color in the image Is generated by replacing the principal color determined by the determination unit with And a generation unit.

開示の技術によれば、中間色の振り分け対象となる主要色の組み合わせを適切に求めつつ、処理速度を向上させることができる。   According to the disclosed technology, it is possible to improve the processing speed while appropriately obtaining a combination of main colors to be assigned to intermediate colors.

中間色が発生した文字画像の一例を示す図。The figure which shows an example of the character image which the intermediate color generate | occur | produced. 図1に示す文字色部のみを抽出した図。The figure which extracted only the character color part shown in FIG. 図1に示す中間色部を適切に振り分けた例を示す図。The figure which shows the example which distributed the intermediate color part shown in FIG. 1 appropriately. 実施例1における画像処理装置のハードウェアの一例を示すブロック図。FIG. 2 is a block diagram illustrating an example of hardware of the image processing apparatus according to the first embodiment. 実施例1における画像処理装置の機能の一例を示すブロック図。FIG. 3 is a block diagram illustrating an example of functions of the image processing apparatus according to the first embodiment. 入力画像の一例を示す図。The figure which shows an example of an input image. 投票後の色空間の一例を示す図。The figure which shows an example of the color space after voting. 線分削除を説明するための図。The figure for demonstrating line segment deletion. 線分情報の一例を示す図。The figure which shows an example of line segment information. 主要色の組の決定を説明する図。The figure explaining determination of the group of main colors. 画像上の最短距離を説明するための図。The figure for demonstrating the shortest distance on an image. 実施例1における画像処理の一例を示すフローチャート。5 is a flowchart illustrating an example of image processing in the first embodiment. 実施例2における画像処理装置の機能の一例を示すブロック図。FIG. 9 is a block diagram illustrating an example of functions of an image processing apparatus according to a second embodiment. 実施例2における画像処理の一例を示すフローチャート。10 is a flowchart illustrating an example of image processing according to the second embodiment.

以下、画像処理装置、画像処理方法及びプログラムの実施例について、添付図面を参照しながら説明する。   Hereinafter, embodiments of an image processing apparatus, an image processing method, and a program will be described with reference to the accompanying drawings.

[実施例1]
<ハードウェア>
図4は、実施例1における画像処理装置10のハードウェアの一例を示すブロック図である。図4に示す例では、画像処理装置10は、読取部20と、表示部30とに接続される。
[Example 1]
<Hardware>
FIG. 4 is a block diagram illustrating an example of hardware of the image processing apparatus 10 according to the first embodiment. In the example illustrated in FIG. 4, the image processing apparatus 10 is connected to a reading unit 20 and a display unit 30.

読取部20は、例えばスキャナ装置であり、紙面上の画像をスキャンして二次元に配置されたx,y座標に対して一つずつ画素値を読み込む。読み込まれる画素値がカラー画像の場合、画素値はR(赤色)、G(緑色)、B(青色)の3色の組で表される。   The reading unit 20 is, for example, a scanner device, and scans an image on a paper surface and reads pixel values one by one with respect to x and y coordinates arranged two-dimensionally. When the pixel value to be read is a color image, the pixel value is represented by a set of three colors of R (red), G (green), and B (blue).

読み込まれる画像がグレイ画像の場合、画素値は明度値を表すことが多い。RGBの3色のカラー画素値は、例えば明度値=0.299×R+0.587×G+0.114×Bの変換式を用いて明度値へ変換することができる。読取部20は、読み込んだ画像を画像処理装置10に送信する。   When the image to be read is a gray image, the pixel value often represents a brightness value. The color pixel values of the three colors RGB can be converted into lightness values using, for example, a lightness value = 0.299 × R + 0.587 × G + 0.114 × B. The reading unit 20 transmits the read image to the image processing apparatus 10.

表示部30は、例えばLCD(Liquid Crystal Display)等であり、画像処理装置10から表示要求された画面を表示する。また、表示部30で表示された画面は、画像処理装置10でキャプチャされてもよい。   The display unit 30 is, for example, an LCD (Liquid Crystal Display) or the like, and displays a screen requested to be displayed by the image processing apparatus 10. In addition, the screen displayed on the display unit 30 may be captured by the image processing apparatus 10.

画像処理装置10は、例えば、読取部20により読み取られたスキャン画像又は表示部30に表示された画面のキャプチャ画像を入力する。画像処理装置10は、入力された画像に対し、文字や図形を含むパターンに現れるアンチエイリアシングやボケによる中間色を、主要色に適切に振り分けた画像を生成する。主要色とは、画像内に所定値以上に多く出現している色であり、例えばパターンの色や背景色である。中間色とは、例えば主要色以外の色である。画像処理装置10は、中間色を主要色に振り分けた画像に基づき、パターン(例えば文字)を抽出する。   The image processing apparatus 10 inputs, for example, a scanned image read by the reading unit 20 or a captured image of a screen displayed on the display unit 30. The image processing apparatus 10 generates an image in which an intermediate color due to anti-aliasing or blur appearing in a pattern including characters and graphics is appropriately assigned to the main color with respect to the input image. The main color is a color that appears more than a predetermined value in the image, for example, a pattern color or a background color. The intermediate color is, for example, a color other than the main color. The image processing apparatus 10 extracts a pattern (for example, a character) based on an image in which intermediate colors are assigned to main colors.

画像処理装置10は、ハードウェアとして、例えば制御部101、主記憶部102、補助記憶部103、通信部104、ドライブ装置105を有する。各部は、バスを介して相互にデータ送受信可能に接続されている。   The image processing apparatus 10 includes, for example, a control unit 101, a main storage unit 102, an auxiliary storage unit 103, a communication unit 104, and a drive device 105 as hardware. Each unit is connected via a bus so that data can be transmitted / received to / from each other.

制御部101は、コンピュータの中で、各装置の制御やデータの演算、加工を行うCPU(Central Processing Unit)である。また、制御部101は、主記憶部102や補助記憶部103に記憶されたプログラムを実行する演算装置であり、入力装置や記憶装置からデータを受け取り、演算、加工した上で、出力装置や記憶装置に出力する。   The control unit 101 is a CPU (Central Processing Unit) that performs control of each device, calculation of data, and processing in a computer. The control unit 101 is an arithmetic device that executes a program stored in the main storage unit 102 or the auxiliary storage unit 103. The control unit 101 receives data from the input device or the storage device, calculates, processes the output device, the storage device, and the like. Output to the device.

主記憶部102は、例えば、ROM(Read Only Memory)やRAM(Random Access Memory)などである。主記憶部102は、制御部101が実行する基本ソフトウェアであるOSやアプリケーションソフトウェアなどのプログラムやデータを記憶又は一時保存する記憶装置である。   The main storage unit 102 is, for example, a ROM (Read Only Memory) or a RAM (Random Access Memory). The main storage unit 102 is a storage device that stores or temporarily stores programs and data such as an OS and application software that are basic software executed by the control unit 101.

補助記憶部103は、例えばHDD(Hard Disk Drive)などであり、アプリケーションソフトウェアなどに関連するデータを記憶する記憶装置である。補助記憶部103は、例えば読取部20から取得した画像や、表示部30に表示された画面をキャプチャした画像などを記憶する。   The auxiliary storage unit 103 is, for example, an HDD (Hard Disk Drive) or the like, and is a storage device that stores data related to application software. The auxiliary storage unit 103 stores, for example, an image acquired from the reading unit 20 or an image obtained by capturing a screen displayed on the display unit 30.

通信部104は、有線又は無線で周辺機器とデータ通信を行う。通信部104は、例えばネットワークを介して、パターンを含む画像を取得し、補助記憶部103に記憶する。   The communication unit 104 performs data communication with peripheral devices by wire or wireless. The communication unit 104 acquires an image including a pattern via a network, for example, and stores it in the auxiliary storage unit 103.

ドライブ装置105は、記録媒体106、例えばフレキシブルディスクやCD(Compact Disc)から所定のプログラムを読み出し、記憶装置にインストールする。   The drive device 105 reads a predetermined program from the recording medium 106, for example, a flexible disk or a CD (Compact Disc), and installs it in the storage device.

また、記録媒体106に、所定のプログラムを格納し、この記録媒体106に格納されたプログラムは、ドライブ装置105を介して画像処理装置10にインストールされる。インストールされた所定のプログラムは、画像処理装置10により実行可能となる。   A predetermined program is stored in the recording medium 106, and the program stored in the recording medium 106 is installed in the image processing apparatus 10 via the drive device 105. The installed predetermined program can be executed by the image processing apparatus 10.

なお、画像処理装置10は、読取部20及び表示部30を別構成としたが、どちらか一方、又は両方を含む構成としてもよい。   In addition, although the image processing apparatus 10 has the reading unit 20 and the display unit 30 as separate configurations, it may be configured to include either one or both.

<機能>
図5は、実施例1における画像処理装置10の機能の一例を示すブロック図である。図5に示す例では、画像処理装置10は、画像入力部201、主要色抽出部202、線分算出部203、主要色決定部204、画像生成部205、パターン抽出部206を備える。図5に示す各部は、例えば制御部101が、補助記憶部103に記憶される抽出処理プログラムを主記憶部102にロードし、実行することで機能する。図5に示す各部は、例えば制御部101及びワークメモリとしての主記憶部102により実現されうる。また、図5に示す各部は、例えばハードウェア的に実現されてもよい。
<Function>
FIG. 5 is a block diagram illustrating an example of functions of the image processing apparatus 10 according to the first embodiment. In the example illustrated in FIG. 5, the image processing apparatus 10 includes an image input unit 201, a main color extraction unit 202, a line segment calculation unit 203, a main color determination unit 204, an image generation unit 205, and a pattern extraction unit 206. Each unit illustrated in FIG. 5 functions, for example, when the control unit 101 loads and executes the extraction processing program stored in the auxiliary storage unit 103 in the main storage unit 102. Each unit illustrated in FIG. 5 can be realized by, for example, the control unit 101 and the main storage unit 102 as a work memory. Further, each unit illustrated in FIG. 5 may be realized by hardware, for example.

画像入力部201は、例えばスクリーンキャプチャによるキャプチャ画像や、読取部20による文書のスキャン等によって生成されたスキャン画像を入力する。以降では、キャプチャ画像やスキャン画像をまとめて画像とも称す。画像入力部201は、入力された画像を主記憶部102に記憶する。   The image input unit 201 inputs, for example, a captured image by screen capture or a scan image generated by scanning a document by the reading unit 20. Hereinafter, the captured image and the scanned image are collectively referred to as an image. The image input unit 201 stores the input image in the main storage unit 102.

主要色抽出部202は、画像入力部201により入力された画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、この画像の前景色、背景色を含む主要色を抽出する。前景色とは、パターンに属する元々の色を表し、背景色とは、パターン以外の背景となる色を表す。主要色抽出部202は、例えば次のような公知の手法を使って主要色を抽出し、また主要色の数を計算する。   The main color extraction unit 202 extracts the main color including the foreground color and the background color of the image based on the result of associating the color information of each pixel of the image input by the image input unit 201 with the area of the color space. . The foreground color represents the original color belonging to the pattern, and the background color represents the color that becomes the background other than the pattern. The main color extraction unit 202 extracts a main color using the following known method, for example, and calculates the number of main colors.

主要色抽出部202は、入力された画像の各画素の色情報を基に、色空間内で、画素の色情報に対応する領域に投票し、全画素数に対する投票数の割合が所定の閾値以上でかつ極大となっている色空間の対応領域の中心座標を主要色とする。主要色抽出部202は、抽出した主要色を線分算出部203に出力する。   Based on the color information of each pixel of the input image, the main color extraction unit 202 votes for the area corresponding to the color information of the pixel in the color space, and the ratio of the number of votes to the total number of pixels is a predetermined threshold value. The central coordinates of the corresponding region of the color space which is the above and the maximum are used as the main color. The main color extraction unit 202 outputs the extracted main color to the line segment calculation unit 203.

主要色抽出について、具体例を用いて説明する。図6は、入力画像の一例を示す図である。図6に示す画像では、主要色は、c1、c2、c3、c4の4色である。例えば、主要色c4は、主要色c1と主要色c2とを混合した色であり、パターンに使われている色である。   The main color extraction will be described using a specific example. FIG. 6 is a diagram illustrating an example of an input image. In the image shown in FIG. 6, the main colors are four colors c1, c2, c3, and c4. For example, the main color c4 is a color obtained by mixing the main color c1 and the main color c2, and is a color used in the pattern.

図7は、投票後の色空間の一例を示す図である。図7に示す例は、図6に示す画像に対し、色空間上の領域に投票を行った例である。図7に示すように、主要色c1、c2、c3、c4の領域は、多くの投票がなされている。なお、円の半径が投票数を表す。主要色抽出部202は、例えば、図7に示す半径が所定の値以上であれば、主要色として、この円の中心色を抽出する。   FIG. 7 is a diagram illustrating an example of a color space after voting. The example shown in FIG. 7 is an example in which the image shown in FIG. 6 is voted on an area on the color space. As shown in FIG. 7, many votings are made in the areas of the main colors c1, c2, c3, and c4. The radius of the circle represents the number of votes. For example, if the radius shown in FIG. 7 is equal to or greater than a predetermined value, the main color extraction unit 202 extracts the center color of this circle as the main color.

図5に戻り、線分算出部203は、主要色抽出部202により抽出された主要色のうち、色空間において任意の2つの主要色間の線上にこの主要色以外の色を示す中間色が存在する線分を算出する。例えば、線分算出部203は、主要色間の線上に中間色が存在しなければ、その線分の式を算出せず、線分情報に保存もしない。この線分は、中間色が発生していないため、その後の処理を不要とする線分である。   Returning to FIG. 5, the line segment calculation unit 203 has an intermediate color indicating a color other than the main color on the line between any two main colors in the color space among the main colors extracted by the main color extraction unit 202. The line segment to be calculated is calculated. For example, if there is no intermediate color on the line between the main colors, the line segment calculation unit 203 does not calculate the line segment formula and does not store the line segment information. This line segment is a line segment that does not require subsequent processing because no intermediate color is generated.

線分算出部203は、例えば以下の手法を使って線分を算出する。線分算出部203は、全ての主要色のうち、異なる2つの主要色の組み合わせを全て求めて、その2つの主要色間の線分(直線)の方程式を求める。   The line segment calculation unit 203 calculates a line segment using, for example, the following method. The line segment calculation unit 203 calculates all combinations of two different main colors among all the main colors, and calculates an equation of a line segment (straight line) between the two main colors.

線分算出部203は、線分の方程式を求めた後、各主要色の間に色空間で中間色が発生しているか否かを判定し、中間色が発生していない場合はこの線分を削除する。これにより、線分算出部203は、最終的に主要色間を結ぶ線分に中間色が発生している線分だけを決定・記録する。   After calculating the line segment equation, the line segment calculation unit 203 determines whether an intermediate color is generated in the color space between the main colors, and deletes the line segment if no intermediate color is generated. To do. Thereby, the line segment calculation unit 203 determines and records only the line segment in which the intermediate color is finally generated in the line segment connecting the main colors.

線分算出部203は、例えば、次のようにして不要線分を削除する。線分算出部203は、任意の異なる2つの主要色の組に対し、色空間で主要色間を結ぶ線分が通過する立方体領域数をKaとし、線分が通過する立方体領域の中で投票数が0でない領域数をKnとする。このとき、線分算出部203は、Kn/Kaが閾値Kth以上の場合に主要色間に中間色が生じていると判定し、この線分を登録し、そうでない場合は、この線分を削除する。   The line segment calculation unit 203 deletes unnecessary line segments as follows, for example. The line segment calculation unit 203 sets Ka as the number of cubic regions through which a line segment connecting the main colors passes in the color space, and vote among the cube regions through which the line segment passes. The number of areas where the number is not 0 is defined as Kn. At this time, the line segment calculation unit 203 determines that an intermediate color has occurred between the main colors when Kn / Ka is equal to or greater than the threshold value Kth, registers this line segment, and deletes this line segment otherwise. To do.

以下、具体例を用いて線分削除を説明する。図8は、線分削除を説明するための図である。図8に示す例では、3次元の色空間を分かり易くするために2次元で表す。また、図8に示す色空間は、矩形で示すような等体積の領域に分割され、矩形内の数字は、画素の色を投票した場合の投票数を示す。画像は、図6に示す画像を用いる。   Hereinafter, line segment deletion will be described using a specific example. FIG. 8 is a diagram for explaining line segment deletion. In the example shown in FIG. 8, the three-dimensional color space is represented in two dimensions for easy understanding. Further, the color space shown in FIG. 8 is divided into equal-volume regions as shown by rectangles, and the numbers in the rectangles indicate the number of votes when voting the color of the pixel. The image shown in FIG. 6 is used.

図6に示す画像において、主要色c1、c2、c3、c4は4色あるが、ここでは説明を簡単のために、主要色c1、c2、c3のみが用いられる。図8に示す濃い網点の矩形が、主要色を表す。図8に示す薄い網点の矩形が、線分が通過する領域を表す。   In the image shown in FIG. 6, there are four main colors c1, c2, c3, and c4, but only the main colors c1, c2, and c3 are used here for simplicity of explanation. A dark halftone dot rectangle shown in FIG. 8 represents a main color. A thin halftone dot rectangle shown in FIG. 8 represents a region through which a line segment passes.

線分算出部203は、まず、任意の2つの主要色間の線分を全て求めると、図8(A)に示すように、3本の線分が求められる。線分算出部203は、3本の線分の中で、それぞれKn/Kaを計算し、Kthで閾値判定を行う。例えば、Kth=0.8とする。
線分L1 Kn1/Ka1 = 5/6>Kth
線分L2 Kn2/Ka1 = 4/4>Kth
線分L5 Kn5/Ka5 = 1/3<Kth
線分算出部203は、線分L1とL2とを残し、残した線分の式を算出し、線分L5を削除する。また、線分算出部203は、残した線分に対し、線分を識別するための情報である番号、ラベル、端点の主要色、算出した式(線分)のパラメータを線分情報として主記憶部102などに記憶する。ここで、Knは、全画素数に対する投票数の比が閾値以上の領域の数としてもよい。
When the line segment calculation unit 203 first obtains all the line segments between any two main colors, three line segments are obtained as shown in FIG. The line segment calculation unit 203 calculates Kn / Ka for each of the three line segments, and performs threshold determination using Kth. For example, Kth = 0.8.
Line segment L1 Kn1 / Ka1 = 5/6> Kth
Line segment L2 Kn2 / Ka1 = 4/4> Kth
Line L5 Kn5 / Ka5 = 1/3 <Kth
The line segment calculation unit 203 leaves the line segments L1 and L2, calculates the expression of the remaining line segments, and deletes the line segment L5. In addition, the line segment calculation unit 203 uses the number, label, main color of the end point, and parameters of the calculated formula (line segment) as the line segment information as information for identifying the line segment with respect to the remaining line segment. Store in the storage unit 102 or the like. Here, Kn may be the number of regions where the ratio of the number of votes to the total number of pixels is equal to or greater than a threshold value.

図9は、線分情報の一例を示す図である。図9に示す例は、図7に示す色空間に基づいて線分情報が求められている。図9に示すように、主要色c1とc2の組、主要色c2とc3の組、主要色c2とc4の組、主要色c4とc1の組で線分が、線分算出部203により算出されている。算出された線分について、線分パラメータとして、例えば直線の式のパラメータである傾きと切片が保持される。   FIG. 9 is a diagram illustrating an example of line segment information. In the example shown in FIG. 9, line segment information is obtained based on the color space shown in FIG. As shown in FIG. 9, a line segment is calculated by a line segment calculation unit 203 with a set of primary colors c1 and c2, a set of primary colors c2 and c3, a set of primary colors c2 and c4, and a set of primary colors c4 and c1. Has been. For the calculated line segment, as a line segment parameter, for example, a slope and an intercept that are parameters of a straight line equation are held.

また、線分算出部203は、例えば、主要色のうち、前景色と背景色とを見分けることができれば、前景色と背景色との組み合わせでできる線分に対して、線分算出を行うこともできる。前景色と背景色との見分け方は、例えば、上述した色空間上の主要色の投票数が、画像全体の画素の例えば80%以上などの場合は、背景色である可能性が高いので、この主要色を背景色とみなしてもよい。特に文字画像の場合は、背景色の投票数が多くなる。この場合、背景色以外の主要色が前景色となる。なお、この決め方は背景色が1つの場合に有効である。   For example, if the foreground color and the background color can be distinguished from the main colors, the line segment calculation unit 203 performs line segment calculation for a line segment formed by a combination of the foreground color and the background color. You can also. For example, when the number of votes of the main color in the color space described above is, for example, 80% or more of the pixels of the entire image, the background color is likely to be a background color. You may consider this main color as a background color. Particularly in the case of a character image, the number of votes for the background color increases. In this case, the main color other than the background color is the foreground color. This determination method is effective when there is one background color.

図5に戻り、主要色決定部204は、例えば、画像中の各中間色に対し、この中間色と線分との距離が最小となる2つの主要色を求め、この中間色がこの2つの主要色のいずれに属するかを決定する。   Returning to FIG. 5, for example, for each intermediate color in the image, the main color determination unit 204 obtains two main colors that minimize the distance between the intermediate color and the line segment. Decide which one to belong to.

主要色決定部204は、例えば、画像の各画素の色と、各主要色との色の距離を求めて色の距離が閾値以下の場合はその画素の色が主要色に属すと決定する。主要色決定部204は、主要色のいずれにも属していない画素を中間色画素とする。   For example, the main color determination unit 204 obtains the color distance between each pixel of the image and each main color, and determines that the color of the pixel belongs to the main color when the color distance is equal to or smaller than the threshold. The primary color determination unit 204 sets pixels that do not belong to any of the primary colors as intermediate color pixels.

主要色決定部204は、中間色画素が存在する場合、各中間色画素に対して前景色、背景色を含む主要色の組を決定する。   When there are intermediate color pixels, the main color determination unit 204 determines a set of main colors including the foreground color and the background color for each intermediate color pixel.

主要色決定部204は、中間色画素の主要色組が決定された後に、中間色画素が主要色組のどちらの主要色(前景色と背景色を含む)に属するかを決定する。主要色決定部204は、中間色画素に対する主要色の組の決定について、具体的には次のように行う。   After the main color set of the intermediate color pixels is determined, the main color determination unit 204 determines which main color (including the foreground color and the background color) of the main color set belongs to the intermediate color pixel. Specifically, the main color determination unit 204 determines the set of main colors for the intermediate color pixels as follows.

図10は、主要色の組の決定を説明する図である。図10に示すように、主要色決定部204は、中間色画素pkに対し、この中間色画素pkから各線分に下した垂直線分の長さを求め、垂直線分の長さが最も短い線分Lnを求める。   FIG. 10 is a diagram for explaining determination of a set of main colors. As shown in FIG. 10, the main color determination unit 204 obtains the length of the vertical line segment drawn from the intermediate color pixel pk to each line segment with respect to the intermediate color pixel pk, and the line segment with the shortest vertical line segment length is obtained. Ln is obtained.

(1)線分Lnが一意に決まる場合
図10(A)は、線分Lnが一意に決まる例を示す。図10(A)に示すように、中間色画素p1は、最も近い線分が1つ(線分L2)である場合、主要色決定部204は、線分L2の両端の主要色c2、c3の何れかに中間色が属すると決定する。
(1) When the line segment Ln is uniquely determined FIG. 10A shows an example in which the line segment Ln is uniquely determined. As shown in FIG. 10A, when the intermediate color pixel p1 has one closest line segment (line segment L2), the main color determination unit 204 sets the main colors c2 and c3 at both ends of the line segment L2. It is determined that the intermediate color belongs to one of them.

(2)線分Lnが一意に決まらない場合
図10(B)は、線分Lnが一意に決まらない例を示す。図10(B)に示すように、3色以上の主要色が一直線に並んでいる場合、主要色決定部204は、色空間での複数の線分との距離が等しくなるため、実空間(画像上)での距離を考慮する。
(2) When the line segment Ln is not uniquely determined FIG. 10B illustrates an example in which the line segment Ln is not uniquely determined. As shown in FIG. 10B, when three or more main colors are arranged in a straight line, the main color determination unit 204 is equal in distance to a plurality of line segments in the color space. Consider the distance on the image.

図10(B)に示す例の場合、距離の等しい線分の両端の主要色cs、ctを持つ画素と、p2との画像上の最短距離dks,dktを算出する。主要色決定部204は、例えば、dks+dktが最小となる主要色の組ci,cjを両端に持つ線分上に存在し、ci,cjの何れかにp2が属すると決定する。   In the case of the example shown in FIG. 10B, the shortest distances dks and dkt on the image between the pixels having the main colors cs and ct at both ends of the line segment having the same distance and p2 are calculated. The primary color determination unit 204 determines that, for example, the primary color group 204 exists on a line segment having both ends of the primary color set ci and cj that minimizes dks + dkt, and p2 belongs to either ci or cj.

図11は、画像上の最短距離を説明するための図である。図11に示すように、主要色決定部204は、中間色p2と、主要色c1、c2、c4との最短距離dk1、dk2、dk4を算出する。図11に示す例では、dks+dktで最小となるのは、c1とc2の組(dk1+dk2)である。よって、主要色決定部204は、中間色p2に対し、主要色c1、c2の組を決定する。   FIG. 11 is a diagram for explaining the shortest distance on the image. As shown in FIG. 11, the main color determination unit 204 calculates the shortest distances dk1, dk2, and dk4 between the intermediate color p2 and the main colors c1, c2, and c4. In the example shown in FIG. 11, the minimum of dks + dkt is a set of c1 and c2 (dk1 + dk2). Therefore, the primary color determination unit 204 determines a set of primary colors c1 and c2 for the intermediate color p2.

なお、主要色決定部204は、中間色に対して、いずれの主要色に属するかを決定する際、実画像上での距離や、色空間上での距離などを用いて決定すればよい。主要色決定部204は、例えば中間色から色空間上でより距離が近い主要色に決定したり、中間色から実空間上でより距離が近い主要色に決定したりすればよい。   Note that the main color determination unit 204 may determine which primary color the intermediate color belongs to using the distance on the actual image, the distance on the color space, or the like. The primary color determination unit 204 may determine, for example, a primary color that is closer in the color space from the intermediate color, or a primary color that is closer in the real space from the intermediate color.

また、主要色決定部204は、実空間上での距離を用いる場合、中間色と主要色との最短距離を用いたり、中間色と、連結された主要色の重心との距離を用いたりしてもよい。主要色決定部204、上記の通り、予め設定された決定方法で、中間色をいずれかの主要色に決定すればよい。   In addition, when using the distance in the real space, the main color determination unit 204 may use the shortest distance between the intermediate color and the main color, or use the distance between the intermediate color and the center of gravity of the connected main color. Good. The primary color determination unit 204, as described above, may determine the intermediate color as one of the primary colors by a predetermined determination method.

図5に戻り、画像生成部205は、入力された画像中の各中間色又は全画素を、主要色決定部204により決定された主要色に置換した画像を生成する。これにより、例えば図3に示すような画像を生成することができる。   Returning to FIG. 5, the image generation unit 205 generates an image in which each intermediate color or all pixels in the input image are replaced with the main color determined by the main color determination unit 204. Thereby, for example, an image as shown in FIG. 3 can be generated.

パターン抽出部206は、以上のように画像生成部205により生成された、画像の全画素又は各中間色を主要色に置き換えた画像から、背景色を除く各主要色に属すパターンを色別に抽出してもよい。パターン抽出部206は、抽出する画像に対し、カラー画像でもよいし、色ごとに2値画像を作成してもよい。   The pattern extraction unit 206 extracts, for each color, a pattern belonging to each main color excluding the background color from the image generated by the image generation unit 205 as described above, in which all pixels of the image or each intermediate color is replaced with the main color. May be. The pattern extraction unit 206 may be a color image for the image to be extracted, or may create a binary image for each color.

以上の構成を有することで、画像処理装置10は、中間色の振り分け対象となる主要色の組み合わせを適切に求めつつ、処理速度を向上させることができる。また、上記構成を有していれば、従来技術と精度は同等であり、無駄な線分を削除したことで処理速度が向上する。さらに、上記構成を有していれば、実空間上での距離も必要なときにだけ処理するので、処理負荷を軽減することができる。   With the above configuration, the image processing apparatus 10 can improve the processing speed while appropriately obtaining a combination of main colors to be assigned to intermediate colors. Moreover, if it has the said structure, a precision is equivalent to a prior art and a processing speed improves by deleting a useless line segment. Furthermore, if it has the said structure, since it processes only when the distance in real space is also required, a processing load can be reduced.

<動作>
次に、実施例1における画像処理装置10の動作について説明する。図12は、実施例1における画像処理の一例を示すフローチャートである。図12に示すステップS101で、画像入力部201は、キャプチャ画像又はスキャン画像を入力する。
<Operation>
Next, the operation of the image processing apparatus 10 in the first embodiment will be described. FIG. 12 is a flowchart illustrating an example of image processing according to the first embodiment. In step S101 illustrated in FIG. 12, the image input unit 201 inputs a capture image or a scan image.

ステップS102で、主要色抽出部202は、入力された画像の各画素の色情報に基づき色空間の領域に対応付けした結果を用いて、主要色を抽出する。   In step S102, the main color extraction unit 202 extracts a main color using a result associated with the area of the color space based on the color information of each pixel of the input image.

ステップS103で、線分算出部203は、画像内に主要色以外の中間色を有する画素(中間色画素)があるか否かを判定する。中間色画素があれば(ステップS103−YES)ステップS113に進み、中間色画素がなければ(ステップS103−NO)ステップS104に進む。   In step S <b> 103, the line segment calculation unit 203 determines whether there is a pixel (an intermediate color pixel) having an intermediate color other than the main color in the image. If there is an intermediate color pixel (step S103-YES), the process proceeds to step S113, and if there is no intermediate color pixel (step S103-NO), the process proceeds to step S104.

ステップS104で、線分算出部203は、まずは色空間において、2つの主要色を結ぶ線分を算出する。   In step S104, the line segment calculation unit 203 first calculates a line segment connecting two main colors in the color space.

ステップS105で、線分算出部203は、算出した線分の中で、不要な線分があるか否かを判定する。不要線分の判定は、例えば線分上に中間色がどれだけあるかにより判定される。不要線分があれば(ステップS105−YES)ステップS106に進み、不要線分がなければ(ステップS105−NO)ステップS107に進む。   In step S105, the line segment calculation unit 203 determines whether there is an unnecessary line segment in the calculated line segments. The unnecessary line segment is determined by, for example, how many intermediate colors are on the line segment. If there is an unnecessary line segment (step S105-YES), the process proceeds to step S106, and if there is no unnecessary line segment (step S105-NO), the process proceeds to step S107.

ステップS106で、線分算出部203は、線上に中間色が発生していない線分を削除する。   In step S106, the line segment calculation unit 203 deletes a line segment in which no intermediate color is generated on the line.

ステップS107で、主要色決定部204は、中間色に最も近い線分Lを算出する。例えば、主要色決定部204は、中間色から線分上に垂線をひき、その垂線の長さを用いて判定する。   In step S107, the primary color determination unit 204 calculates the line segment L closest to the intermediate color. For example, the main color determination unit 204 draws a perpendicular line from the intermediate color on the line segment, and determines using the length of the perpendicular line.

ステップS108で、主要色決定部204は、線分が一意に決定されるか否かを判定する。一意に決定されるとは、最も近い線分Lが1つの場合であり、一意に決定されないとは、最も近い線分Lが複数ある場合である。一意に決定されれば(ステップS108−YES)ステップS110に進み、一意に決定されなければ(ステップS108−NO)ステップS109に進む。   In step S108, the main color determination unit 204 determines whether the line segment is uniquely determined. “Uniquely determined” means that the closest line segment L is one, and “not uniquely determined” means that there are a plurality of closest line segments L. If it is uniquely determined (step S108—YES), the process proceeds to step S110. If it is not uniquely determined (step S108—NO), the process proceeds to step S109.

ステップS109で、主要色決定部204は、画像上の距離を考慮して、複数の線分の中から1つの線分Lを決定する。   In step S109, the main color determination unit 204 determines one line segment L from the plurality of line segments in consideration of the distance on the image.

ステップS110で、主要色決定部204は、中間色に対し、線分Lの両端の主要色のどちらに属するかを決定する。どちらに属するかの判断は、色空間上での距離や、実画像上での距離などを用いて決定することができる。   In step S110, the main color determination unit 204 determines which of the main colors at both ends of the line segment L belongs to the intermediate color. The determination of which one belongs can be made by using a distance on a color space, a distance on an actual image, or the like.

ステップS111で、主要色決定部204は、全ての中間色画素を処理したか否かを判定する。全ての中間色画素を処理していれば(ステップS111−YES)ステップS112に進み、全ての中間色画素を処理していなければ(ステップS111−NO)他の中間色画素が選択されてステップS107に戻る。   In step S111, the primary color determination unit 204 determines whether all intermediate color pixels have been processed. If all the intermediate color pixels have been processed (step S111—YES), the process proceeds to step S112. If all the intermediate color pixels have not been processed (step S111—NO), another intermediate color pixel is selected and the process returns to step S107.

ステップS112で、画像生成部205は、画像内の各画素(又は各中間色画素)を、主要色決定部204により決定された主要色で置換した画像を生成する。画像生成部205は、処理を高速化しつつ、アンチエイリアシングやボケにより中間色になった画素を適切な主要色にすることができる。   In step S <b> 112, the image generation unit 205 generates an image in which each pixel (or each intermediate color pixel) in the image is replaced with the main color determined by the main color determination unit 204. The image generation unit 205 can set the pixels that have become an intermediate color due to anti-aliasing or blurring to an appropriate main color while speeding up the processing.

ステップS113で、パターン抽出部206は、生成された画像から、全色のパターン(例えば文字)を抽出したり、色別のパターンを抽出したりする。どのパターンを抽出するかは、予めユーザに設定されていればよい。   In step S113, the pattern extraction unit 206 extracts a pattern of all colors (for example, characters) from the generated image or extracts a pattern for each color. Which pattern is to be extracted may be set in advance by the user.

以上、実施例1によれば、中間色の振り分け対象となる主要色の組み合わせを適切に求めつつ、処理速度を向上させることができる。例えば、実施例1では、主要色間の中間色の発生の有無を判定し、主要色間に中間色が発生している場合にだけ、主要色間を結ぶ色空間での線分と中間色画素との距離を計算することで、処理量を削減することができる。また、実施例1では、対象の中間色画素と色空間での線分の距離の最短の線分が一意に決まらない場合にだけ、実画像上での距離を考慮すればよい。また、実施例1では、処理量を削減する際に、中間色に対する真の主要色を判定対象から外すことはないので、中間色を適切に主要色に振り分けることができる。   As described above, according to the first embodiment, it is possible to improve the processing speed while appropriately obtaining a combination of main colors to be assigned to intermediate colors. For example, in the first embodiment, whether or not an intermediate color between main colors is generated is determined, and only when an intermediate color is generated between main colors, a line segment in the color space connecting the main colors and the intermediate color pixels are connected. By calculating the distance, the amount of processing can be reduced. In the first embodiment, the distance on the actual image may be considered only when the shortest line segment between the target intermediate color pixel and the line segment in the color space is not uniquely determined. In the first embodiment, when the processing amount is reduced, since the true main color for the intermediate color is not excluded from the determination target, the intermediate color can be appropriately assigned to the main color.

[実施例2]
次に、実施例2における画像処理装置について説明する。実施例2では、指定色が入力された場合、この指定色に対するパターンが抽出される。
[Example 2]
Next, an image processing apparatus according to the second embodiment will be described. In the second embodiment, when a designated color is input, a pattern for the designated color is extracted.

<ハードウェア>
実施例2における画像処理装置のハードウェアは、実施例1における画像処理装置10のハードウェアと同様であるため、以降の説明では、図4に示す符号と同じ符号を用いて説明する。
<Hardware>
Since the hardware of the image processing apparatus in the second embodiment is the same as the hardware of the image processing apparatus 10 in the first embodiment, the following description will be made using the same reference numerals as those shown in FIG.

<機能>
図13は、実施例2における画像処理装置40の機能の一例を示すブロック図である。図13に示す画像処理装置40における構成で、図5に示す構成と同様のものは同じ符号を付す。以下、実施例1と異なる構成である指定色入力部301、画像生成部302、パターン抽出部303を主に説明する。指定色入力部301、画像生成部302、パターン抽出部303は、例えば制御部101やワークメモリとしての主記憶部102などにより実現されうる。
<Function>
FIG. 13 is a block diagram illustrating an example of functions of the image processing apparatus 40 according to the second embodiment. In the configuration of the image processing apparatus 40 shown in FIG. 13, the same components as those shown in FIG. Hereinafter, the designated color input unit 301, the image generation unit 302, and the pattern extraction unit 303, which are different from the first embodiment, will be mainly described. The designated color input unit 301, the image generation unit 302, and the pattern extraction unit 303 can be realized by, for example, the control unit 101 or the main storage unit 102 as a work memory.

指定色入力部301は、ユーザ等により指定色が入力される。指定色は、ユーザにより抽出された主要色の中から選択されてもよいし、抽出処理前に予め設定されていてもよい。指定色は、画像生成部302及び/又はパターン抽出部303に出力される。   The designated color input unit 301 is inputted with a designated color by a user or the like. The designated color may be selected from the main colors extracted by the user, or may be set in advance before the extraction process. The designated color is output to the image generation unit 302 and / or the pattern extraction unit 303.

画像生成部302は、指定色入力部301から指定色を取得した場合、指定色と同一色の主要色、又は指定色と最も類似する色の主要色を前景色とし、この前景色だけの画像を生成する。画像生成部302は、指定色入力部301から指定色を入力されなければ、実施例1と同様の処理を行う。   When the specified color is acquired from the specified color input unit 301, the image generation unit 302 sets the main color of the same color as the specified color or the main color of the color most similar to the specified color as the foreground color, and an image of only this foreground color Is generated. If the designated color is not input from the designated color input unit 301, the image generation unit 302 performs the same processing as in the first embodiment.

パターン抽出部303は、指定色入力部301から指定色を取得した場合、指定色同一色の主要色、又は指定色と最も類似する色の主要色のパターンを、生成された画像から抽出する。抽出されたパターン画像は、カラー(多値)画像でもよいし、二値画像でもよい。   When the specified color is acquired from the specified color input unit 301, the pattern extraction unit 303 extracts a main color pattern of the same color as the specified color or a pattern of a main color of the color most similar to the specified color from the generated image. The extracted pattern image may be a color (multi-value) image or a binary image.

以上の構成を有することで、画像処理装置40は、実施例1における効果を保持しつつ、指定色の入力を可能とし、この指定色に対するパターンを抽出することができる。   With the above configuration, the image processing apparatus 40 can input a designated color and extract a pattern for the designated color while maintaining the effects of the first embodiment.

<動作>
次に、実施例2における画像処理装置40の動作について説明する。図14は、実施例2における画像処理の一例を示すフローチャートである。図14に示すステップS201で、指定色入力部301は、指定色の入力を受け付ける。なお、ステップS201は、ステップS203の後に行われてもよい。
<Operation>
Next, the operation of the image processing apparatus 40 in the second embodiment will be described. FIG. 14 is a flowchart illustrating an example of image processing according to the second embodiment. In step S201 shown in FIG. 14, the designated color input unit 301 accepts an input of the designated color. Note that step S201 may be performed after step S203.

ステップS202〜S212の処理は、図12に示すステップS101〜S111の処理と同様であるため、その説明を省略する。   The processing in steps S202 to S212 is the same as the processing in steps S101 to S111 shown in FIG.

ステップS213で、画像生成部302は、指定色を取得した場合は指定色のパターンを含む画像を生成する。   In step S213, the image generation unit 302 generates an image including the pattern of the designated color when the designated color is acquired.

ステップS214で、パターン抽出部303は、指定色を取得し、この指定色のパターンを抽出する。   In step S214, the pattern extraction unit 303 acquires the designated color and extracts the pattern of the designated color.

以上、実施例2によれば、実施例1における効果を保持しつつ、指定色の入力を可能とし、この指定色に対するパターンを抽出することができる。   As described above, according to the second embodiment, it is possible to input a designated color while extracting the pattern for the designated color while maintaining the effects of the first embodiment.

なお、上記各実施例は、文字を含むキャプチャ画像やスキャン画像から文字を抽出する処理において好適に機能する。また、画像中の文字が、一部の文字線が他の文字線より細くなっている文字(例えば明朝やTimesのフォントの文字)である場合で、かつ解像度が低い場合に、上記各実施例は好適に機能する。   In addition, each said Example functions suitably in the process which extracts a character from the capture image and scanning image containing a character. In addition, when the character in the image is a character in which some character lines are thinner than other character lines (for example, characters in the Mincho or Times font) and the resolution is low, The example works well.

なお、前述した各実施例で説明した画像処理を実現するためのプログラムを記録媒体に記録することで、各実施例での画像処理をコンピュータに実施させることができる。例えば、このプログラムを記録媒体に記録し、このプログラムが記録された記録媒体をコンピュータに読み取らせて、前述した画像処理を実現させることも可能である。   In addition, by recording a program for realizing the image processing described in each of the above-described embodiments on a recording medium, the image processing in each of the embodiments can be performed by a computer. For example, it is possible to record the program on a recording medium and cause the computer to read the recording medium on which the program is recorded, thereby realizing the above-described image processing.

なお、各実施例における画像処理装置は、コンピュータ(Personal Computer)や、タブレット端末、スマートフォンなどのプロセッサとメモリとデータを取得するインタフェースを有する処理装置であれば適用可能である。また、スキャナ装置でも上記画像処理を実行することができるように実装してもよい。   The image processing apparatus in each embodiment can be applied to any processing apparatus having a processor, a memory, and an interface for acquiring data, such as a computer (Personal Computer), a tablet terminal, and a smartphone. Further, the scanner device may be mounted so that the image processing can be executed.

なお、記録媒体は、CD−ROM、フレキシブルディスク、光磁気ディスク等の様に情報を光学的、電気的或いは磁気的に記録する記録媒体、ROM、フラッシュメモリ等の様に情報を電気的に記録する半導体メモリ等、様々なタイプの記録媒体を用いることができる。この記録媒体には、搬送波は含まれない。   The recording medium is a recording medium that records information optically, electrically, or magnetically, such as a CD-ROM, flexible disk, magneto-optical disk, etc., and information is electrically recorded such as ROM, flash memory, etc. Various types of recording media such as a semiconductor memory can be used. This recording medium does not include a carrier wave.

以上、各実施例について詳述したが、特定の実施例に限定されるものではなく、特許請求の範囲に記載された範囲内において、種々の変形及び変更が可能である。また、前述した実施例の構成要素を全部又は複数を組み合わせることも可能である。   Although each embodiment has been described in detail above, it is not limited to a specific embodiment, and various modifications and changes can be made within the scope described in the claims. It is also possible to combine all or a plurality of the components of the above-described embodiments.

なお、以上の実施例に関し、さらに以下の付記を開示する。
(付記1)
画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出する主要色抽出部と、
前記主要色抽出部により抽出された主要色のうち、前記色空間において任意の2つの主要色間の線上に前記主要色以外の色を示す中間色が存在する線分を算出する線分算出部と、
前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定する決定部と、
前記画像中の各中間色を前記決定部により決定された主要色に置換した画像を生成する生成部と
を備える画像処理装置。
(付記2)
前記線分算出部は、
前記色空間において任意の2つの主要色間の線分を全て算出し、該線分の線上に前記中間色が存在しない線分を削除する付記1記載の画像処理装置。
(付記3)
前記決定部は、
前記距離が最小となる2つの主要色の組が複数ある場合に、前記中間色の画素と、前記線分の両端にある主要色の画素との画像上での距離に基づいて、前記複数の主要色の組から1つの組を決定する付記1又は2記載の画像処理装置。
(付記4)
指定色を入力する入力部と、
前記生成部により生成された画像から、前記指定色に対応するパターンを抽出するパターン抽出部と
をさらに備える付記1乃至3いずれか一項に記載の画像処理装置。
(付記5)
画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出し、
前記抽出された主要色のうち、前記色空間において任意の2つの主要色間の線上に前記主要色以外の色を示す中間色が存在する線分を算出し、
前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定し、
前記画像中の各中間色を前記決定された主要色に置換した画像を生成する
処理をコンピュータが実行する画像処理方法。
(付記6)
前記線分を算出する処理は、
前記色空間において任意の2つの主要色間の線分を全て算出し、該線分の線上に前記中間色が存在しない線分を削除する付記5記載の画像処理方法。
(付記7)
画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出し、
前記抽出された主要色のうち、前記色空間において任意の2つの主要色間の線上に前記主要色以外の色を示す中間色が存在する線分を算出し、
前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定し、
前記画像中の各中間色を前記決定された主要色に置換した画像を生成する
処理をコンピュータに実行させるプログラム。
(付記8)
前記線分を算出する処理は、
前記色空間において任意の2つの主要色間の線分を全て算出し、該線分の線上に前記中間色が存在しない線分を削除する付記7記載のプログラム。
In addition, the following additional remarks are disclosed regarding the above Example.
(Appendix 1)
A main color extraction unit that extracts the main colors including the foreground color and the background color of the image based on the result of associating the color information of each pixel of the image with the area of the color space;
A line segment calculation unit that calculates a line segment in which an intermediate color indicating a color other than the main color exists on a line between any two main colors in the color space among the main colors extracted by the main color extraction unit; ,
For each intermediate color in the image, a determination is made to determine two primary colors that minimize the distance between the intermediate color and the line segment in the color space, and determine which of the two primary colors the intermediate color belongs to And
An image processing apparatus comprising: a generation unit configured to generate an image in which each intermediate color in the image is replaced with a main color determined by the determination unit.
(Appendix 2)
The line segment calculation unit
The image processing apparatus according to appendix 1, wherein all line segments between any two main colors in the color space are calculated, and line segments where the intermediate color does not exist on the line segments are deleted.
(Appendix 3)
The determination unit
When there are a plurality of sets of two main colors having the minimum distance, the plurality of main colors are determined based on the distance on the image between the intermediate color pixels and the main color pixels at both ends of the line segment. The image processing apparatus according to attachment 1 or 2, wherein one set is determined from the set of colors.
(Appendix 4)
An input section for inputting a specified color;
The image processing apparatus according to any one of supplementary notes 1 to 3, further comprising: a pattern extraction unit that extracts a pattern corresponding to the specified color from the image generated by the generation unit.
(Appendix 5)
Based on the result of associating the color information of each pixel of the image with the area of the color space, the main colors including the foreground color and background color of the image are extracted,
Among the extracted main colors, calculate a line segment in which an intermediate color indicating a color other than the main color exists on a line between any two main colors in the color space;
For each intermediate color in the image, find two primary colors that minimize the distance between the intermediate color and the line segment in the color space, determine which of the two primary colors the intermediate color belongs to,
An image processing method in which a computer executes processing for generating an image in which each intermediate color in the image is replaced with the determined main color.
(Appendix 6)
The process of calculating the line segment is as follows:
The image processing method according to appendix 5, wherein all line segments between any two main colors in the color space are calculated, and line segments that do not have the intermediate color on the line segments are deleted.
(Appendix 7)
Based on the result of associating the color information of each pixel of the image with the area of the color space, the main colors including the foreground color and background color of the image are extracted,
Among the extracted main colors, calculate a line segment in which an intermediate color indicating a color other than the main color exists on a line between any two main colors in the color space;
For each intermediate color in the image, find two primary colors that minimize the distance between the intermediate color and the line segment in the color space, determine which of the two primary colors the intermediate color belongs to,
A program that causes a computer to execute processing for generating an image in which each intermediate color in the image is replaced with the determined main color.
(Appendix 8)
The process of calculating the line segment is as follows:
The program according to appendix 7, wherein all line segments between any two main colors in the color space are calculated, and line segments that do not have the intermediate color on the line segments are deleted.

10、40 画像処理装置
20 読取部
30 表示部
10 電子ペン
101 制御部
102 主記憶部
103 補助記憶部
104 通信部
105 ドライブ装置
201 画像入力部
202 主要色算出部
203 線分算出部
204 主要色決定部
205、302 画像生成部
206、303 パターン抽出部
301 指定色入力部
DESCRIPTION OF SYMBOLS 10, 40 Image processing apparatus 20 Reading part 30 Display part 10 Electronic pen 101 Control part 102 Main memory part 103 Auxiliary memory part 104 Communication part 105 Drive apparatus 201 Image input part 202 Main color calculation part 203 Line segment calculation part 204 Main color determination Sections 205 and 302 Image generation sections 206 and 303 Pattern extraction section 301 Designated color input section

Claims (6)

画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出する主要色抽出部と、
前記主要色抽出部により抽出された主要色のうち、異なる2つの主要色の組み合わせを求めて該2つの主要色間の線分を算出し、算出した該線分から各主要色の間に前記色空間で中間色が発生しいない線分を削除して、該2つの主要色間で該中間色が発生している線分を取得する線分算出部と、
前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定する決定部と、
前記画像中の各中間色を前記決定部により決定された主要色に置換した画像を生成する生成部と
を備える画像処理装置。
A main color extraction unit that extracts the main colors including the foreground color and the background color of the image based on the result of associating the color information of each pixel of the image with the area of the color space;
Of the main colors extracted by the main color extraction unit, a combination of two different main colors is obtained, a line segment between the two main colors is calculated, and the color between the main colors is calculated from the calculated line segment. a line segment calculation unit to delete a line segment intermediate color does not occur, to obtain the segment to which the intermediate color is generated between the two major color space,
For each intermediate color in the image, a determination is made to determine two primary colors that minimize the distance between the intermediate color and the line segment in the color space, and determine which of the two primary colors the intermediate color belongs to And
An image processing apparatus comprising: a generation unit configured to generate an image in which each intermediate color in the image is replaced with a main color determined by the determination unit.
前記決定部は、
前記距離が最小となる2つの主要色の組が複数ある場合に、前記中間色の画素と、前記線分の両端にある主要色の画素との画像上での距離に基づいて、前記複数の主要色の組から1つの組を決定する請求項1記載の画像処理装置。
The determination unit
When there are a plurality of sets of two main colors having the minimum distance, the plurality of main colors are determined based on the distance on the image between the intermediate color pixels and the main color pixels at both ends of the line segment. The image processing apparatus according to claim 1, wherein one set is determined from the set of colors.
指定色を入力する入力部と、
前記生成部により生成された画像から、前記指定色同一色の主要色、又は該指定色と最も類似する色の主要色のパターンを抽出するパターン抽出部と
をさらに備える請求項1又は2記載の画像処理装置。
An input section for inputting a specified color;
The pattern extraction part which extracts from the image produced | generated by the said production | generation part the pattern of the principal color of the same color of the said designated color, or the principal color of the color most similar to this designated color, These are provided. Image processing device.
画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出し、
抽出された前記主要色のうち、異なる2つの主要色の組み合わせを求めて該2つの主要色間の線分を算出し、算出した該線分から各主要色の間に前記色空間で中間色が発生しいない線分を削除して、該2つの主要色間で該中間色が発生している線分を取得し、
前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定し、
前記画像中の各中間色を前記決定された主要色に置換した画像を生成する
処理をコンピュータが実行する画像処理方法。
Based on the result of associating the color information of each pixel of the image with the area of the color space, the main colors including the foreground color and background color of the image are extracted,
Among the extracted main colors, a combination of two different main colors is obtained to calculate a line segment between the two main colors, and an intermediate color is generated in the color space between the calculated main line and each main color. delete was non line, obtains a line segment the intermediate color is generated between the two main colors,
For each intermediate color in the image, find two primary colors that minimize the distance between the intermediate color and the line segment in the color space, determine which of the two primary colors the intermediate color belongs to,
An image processing method in which a computer executes processing for generating an image in which each intermediate color in the image is replaced with the determined main color.
画像の各画素の色情報を色空間の領域に対応付けた結果に基づき、前記画像の前景色、背景色を含む主要色を抽出し、
前記抽出された主要色のうち、異なる2つの主要色の組み合わせを求めて該2つの主要色間の線分を算出し、算出した該線分から各主要色の間に前記色空間で中間色が発生しいない線分を削除して、該2つの主要色間で該中間色が発生している線分を取得し、
前記画像中の各中間色に対し、前記色空間における該中間色と前記線分との距離が最小となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定し、
前記画像中の各中間色を前記決定された主要色に置換した画像を生成する
処理をコンピュータに実行させるプログラム。
Based on the result of associating the color information of each pixel of the image with the area of the color space, the main colors including the foreground color and background color of the image are extracted,
Among the extracted main colors, a combination of two different main colors is obtained to calculate a line segment between the two main colors, and an intermediate color is generated in the color space between the calculated main line and each main color. delete was non line, obtains a line segment the intermediate color is generated between the two main colors,
For each intermediate color in the image, find two primary colors that minimize the distance between the intermediate color and the line segment in the color space, determine which of the two primary colors the intermediate color belongs to,
A program that causes a computer to execute processing for generating an image in which each intermediate color in the image is replaced with the determined main color.
前記決定部は、
3色以上の主要色が色空間で一直線に並ぶ場合、前記画像上での中間色と各主要色との距離のうち、最短距離となる2つの主要色を求め、該中間色が該2つの主要色のいずれに属するかを決定する請求項1記載の画像処理装置。
The determination unit
When three or more main colors are arranged in a straight line in the color space, the two main colors having the shortest distance are obtained from the distances between the intermediate colors and the main colors on the image, and the intermediate colors are the two main colors. The image processing apparatus according to claim 1, wherein the image processing apparatus determines which one of them belongs.
JP2012204850A 2012-09-18 2012-09-18 Image processing apparatus, image processing method, and program Expired - Fee Related JP6056309B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012204850A JP6056309B2 (en) 2012-09-18 2012-09-18 Image processing apparatus, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012204850A JP6056309B2 (en) 2012-09-18 2012-09-18 Image processing apparatus, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2014059759A JP2014059759A (en) 2014-04-03
JP6056309B2 true JP6056309B2 (en) 2017-01-11

Family

ID=50616170

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012204850A Expired - Fee Related JP6056309B2 (en) 2012-09-18 2012-09-18 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP6056309B2 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001291097A (en) * 2000-02-01 2001-10-19 Ricoh Co Ltd Image processing method, image processor, image processing program and computer readable recording medium
JP4756436B2 (en) * 2001-07-03 2011-08-24 日本電気株式会社 Pattern recognition apparatus, pattern recognition method, and pattern recognition program
JP4314866B2 (en) * 2003-04-08 2009-08-19 セイコーエプソン株式会社 Image processing apparatus, image processing method, and program
US7664318B2 (en) * 2004-09-17 2010-02-16 Nec Software Chubu, Ltd. Figure reading apparatus, method and program
JP5348411B2 (en) * 2009-07-15 2013-11-20 富士ゼロックス株式会社 Image processing apparatus and image processing program

Also Published As

Publication number Publication date
JP2014059759A (en) 2014-04-03

Similar Documents

Publication Publication Date Title
JP4646797B2 (en) Image processing apparatus, control method therefor, and program
JP4366011B2 (en) Document processing apparatus and method
JP5854802B2 (en) Image processing apparatus, image processing method, and computer program
CN110400362B (en) ABAQUS two-dimensional crack modeling method and system based on image and computer readable storage medium
JP5838984B2 (en) Image processing apparatus and computer program
CN110766068A (en) Verification code identification method and computing device
US20140320527A1 (en) Hardware glyph cache
JP5335581B2 (en) Image processing apparatus, image processing method, and program
JP5067882B2 (en) Image processing apparatus, image processing method, and program
JP2008040557A (en) Image display apparatus, image display method, and image display program
JP6546385B2 (en) IMAGE PROCESSING APPARATUS, CONTROL METHOD THEREOF, AND PROGRAM
JP2013029982A (en) Image processing system and image processing program
JP6056309B2 (en) Image processing apparatus, image processing method, and program
JP2004199622A (en) Apparatus and method for image processing, recording media, and program
JP4825888B2 (en) Document image processing apparatus and document image processing method
JP2008158847A (en) Image distribution device and image distribution method
JP6107270B2 (en) Image processing apparatus and computer program
JP5005633B2 (en) Image search apparatus, image search method, information processing program, and recording medium
JP2003046746A (en) Method and apparatus for processing image
JP5277750B2 (en) Image processing program, image processing apparatus, and image processing system
JP7508212B2 (en) Image processing device, image processing method, and program
JP5046119B2 (en) Program, Inter-image change location interpretation support video generation method, and Inter-image change location interpretation support video generation device
JP6870247B2 (en) Image analyzer
JP5001231B2 (en) Region extraction method, region extraction device, and program
JP2014194659A (en) Image processing apparatus and computer program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150512

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160525

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160531

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160801

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160830

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160901

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20161121

R150 Certificate of patent or registration of utility model

Ref document number: 6056309

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees