JP5854210B2 - Image processing apparatus and image processing program - Google Patents

Image processing apparatus and image processing program Download PDF

Info

Publication number
JP5854210B2
JP5854210B2 JP2011267024A JP2011267024A JP5854210B2 JP 5854210 B2 JP5854210 B2 JP 5854210B2 JP 2011267024 A JP2011267024 A JP 2011267024A JP 2011267024 A JP2011267024 A JP 2011267024A JP 5854210 B2 JP5854210 B2 JP 5854210B2
Authority
JP
Japan
Prior art keywords
color
representative
area
representative color
foreground
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
JP2011267024A
Other languages
Japanese (ja)
Other versions
JP2013120994A (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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co Ltd
Fujifilm Business Innovation Corp
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 Fuji Xerox Co Ltd, Fujifilm Business Innovation Corp filed Critical Fuji Xerox Co Ltd
Priority to JP2011267024A priority Critical patent/JP5854210B2/en
Publication of JP2013120994A publication Critical patent/JP2013120994A/en
Application granted granted Critical
Publication of JP5854210B2 publication Critical patent/JP5854210B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

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

画像処理として、画像中で使用されている色数をいくつかの代表色に限定し、使用されている色を代表色に変換して限定色画像を生成するなどの処理が行われている。例えば特許文献1においても、与えられた画像から代表色を選択し、画像中の各画素の色を代表色へ置換して限定色画像を得ている。   As image processing, processing such as limiting the number of colors used in an image to some representative colors and converting the used colors into representative colors to generate a limited color image is performed. For example, in Patent Document 1, a representative color is selected from a given image, and the color of each pixel in the image is replaced with the representative color to obtain a limited color image.

例えばしわがよっている原稿を光学的に読み取った画像から限定色画像を生成する場合を考える。原稿にしわがよっていると、光の当たり方が場所によって異なることにより、光学的に読み取った画像には、しわによって色の変化(例えば濃度の変化)が生じる。そのため、限定色画像においては濃度の違いによって変換される代表色が異なってしまう場合がある。   For example, consider a case where a limited color image is generated from an image obtained by optically reading a wrinkled document. When the document is wrinkled, the way the light strikes varies depending on the location, so that a color change (for example, density change) occurs due to wrinkles in the optically read image. For this reason, in the limited color image, the representative color to be converted may differ depending on the density.

例えば、ある色の領域が、原稿のしわによって光の反射が他の領域よりも強くなって他のしわの影響を受けていない領域の色よりも色が薄くなってしまう場合がある。このような場合には、その領域について他の領域とは異なる代表色に変換されてしまう場合がある。この場合、背景だけでなく、背景上に描かれている文字や図形などの前景についても他の領域と比べて色が薄くなる。そのため、変換された代表色によっては、前景と背景の色差が他の領域に比べて小さくなり、あるいは前景の色が背景の代表色に変換されて消失する場合もある。   For example, there is a case where an area of a certain color has a light reflection that is stronger than the other areas due to wrinkles of the document and becomes lighter than the color of an area not affected by other wrinkles. In such a case, the area may be converted to a representative color different from other areas. In this case, not only the background but also the foreground such as characters and figures drawn on the background are lighter than other areas. Therefore, depending on the converted representative color, the color difference between the foreground and the background may be smaller than in other regions, or the foreground color may be converted into the background representative color and disappear.

逆に、しわによってもとの色よりも暗い領域が生じることもある。この場合には暗くなった領域については背景も前景も他の領域の色と比べて暗い色となり、他の領域とは異なる代表色に変換されてしまう場合がある。この場合も、変換された代表色によっては、前景と背景の色差が他の領域に比べて小さくなり、あるいは前景の色が背景の代表色に変換されて消失する場合もある。   Conversely, wrinkles can cause darker areas than the original color. In this case, in the darkened area, the background and foreground are darker than the colors of the other areas, and may be converted to a representative color different from the other areas. Also in this case, depending on the converted representative color, the color difference between the foreground and the background may be smaller than in other regions, or the foreground color may be converted into the background representative color and disappear.

このような現象は、原稿のしわに限らず、例えば青焼き原稿等の地肌濃度にむらが生じている場合や、手書きの文字では濃度が均一でない場合などにおいても生じる。これらの場合についても、原稿を画像読取装置で読み取った画像について限定色画像に変換すると、意図しない代表色に変換されて前景と背景の色差が他の領域に比べて小さくなり、あるいは消失してしまう場合がある。   Such a phenomenon occurs not only in the wrinkle of the original but also in the case where the background density of a blue-printed original or the like is uneven, or in the case where the density of handwritten characters is not uniform. In these cases as well, if an image obtained by reading an original with an image reading device is converted into a limited color image, it is converted into an unintended representative color, and the color difference between the foreground and the background becomes smaller or disappears than other areas. May end up.

上述の現象とは異なるが、原稿上の文字の細線を光学的に読み取った場合に文字と背景の境界において文字と背景の色が混ざり合って異なる色になってしまう。特許文献2では、このような場合に、文字部を抽出し、文字部の平均色を算出しておき、また文字部の背景との境界画素数と内部画素数から求めた内部比率に従って文字色と背景色との差を平均色よりも拡大するように文字色を補正して文字領域の代表色としている。また特許文献3では、カラー画像をブロック毎に分割し、ブロック毎に平均色及び代表色を抽出し、境界でないブロックの平均色を背景色としておき、代表色に基づいて境界のブロックを判定し、境界と判定されたブロックでは背景色以外の代表色を選択して符号化し、色の濁りが存在する境界部について、境界が識別されるように処理している。   Unlike the above-mentioned phenomenon, when the thin line of the character on the document is optically read, the character and background colors are mixed at the boundary between the character and the background, resulting in different colors. In Patent Document 2, in such a case, the character portion is extracted, the average color of the character portion is calculated, and the character color is determined according to the internal ratio obtained from the number of boundary pixels with the background of the character portion and the number of internal pixels. The character color is corrected so that the difference between the background color and the background color is larger than the average color, and is used as the representative color of the character area. In Patent Document 3, a color image is divided into blocks, an average color and a representative color are extracted for each block, an average color of non-boundary blocks is set as a background color, and a boundary block is determined based on the representative color. In the block determined as the boundary, a representative color other than the background color is selected and encoded, and processing is performed so that the boundary is identified for the boundary portion where the color turbidity exists.

特開2008−065803号公報JP 2008-0665803 A 特開2009−17247号公報JP 2009-17247 A 特開平1−157185号公報JP-A-1-157185

本発明は、前景と背景が明確に再現された限定色画像を生成することができる画像処理装置および画像処理プログラムを提供することを目的とするものである。   An object of the present invention is to provide an image processing apparatus and an image processing program capable of generating a limited color image in which the foreground and background are clearly reproduced.

本願請求項1に記載の発明は、処理対象画像から代表色を抽出する抽出手段と、前記処理対象画像のうち注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する分離手段と、前記前景領域の色と前記背景領域の色の色差を算出する算出手段と、前記算出手段で算出した色差が予め決められた値より小さい場合に、色空間において前記前景領域に対応する代表色と前記背景領域に対応する代表色を通る直線からの距離に従って前記抽出手段で抽出した代表色の中から色差を大きくする前記前景領域に対応する修正代表色あるいは前記背景領域に対応する修正代表色を選択する選択手段と、前記選択手段で選択した修正代表色に前記注目画素の色を置換する置換手段を有することを特徴とする画像処理装置である。   According to the first aspect of the present invention, an extraction unit that extracts a representative color from a processing target image and a processing region having a predetermined size including a target pixel in the processing target image are separated into a foreground region and a background region. Separating means for calculating the color difference between the color of the foreground area and the color of the background area, and when the color difference calculated by the calculation means is smaller than a predetermined value, Corresponding to the modified representative color or the background area corresponding to the foreground area that increases the color difference from the representative colors extracted by the extracting means according to the distance from the straight line passing through the corresponding representative color and the representative color corresponding to the background area An image processing apparatus comprising: selection means for selecting a corrected representative color to be replaced; and replacement means for replacing the color of the target pixel with the corrected representative color selected by the selection means.

本願請求項2に記載の発明は、処理対象画像から代表色を抽出する抽出手段と、前記処理対象画像のうち注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する分離手段と、前記前景領域の色と前記背景領域の色の色差を算出する算出手段と、前記算出手段で算出した色差が予め決められた値より小さい場合に、色空間において前記前景領域の平均色と前記背景領域の平均色を通る直線からの距離に従って前記抽出手段で抽出した代表色の中から色差を大きくする前記前景領域に対応する修正代表色あるいは前記背景領域に対応する修正代表色を選択する選択手段と、前記選択手段で選択した修正代表色に前記注目画素の色を置換する置換手段を有することを特徴とする画像処理装置である。   The invention according to claim 2 of the present application separates a foreground area and a background area from an extraction means for extracting a representative color from a processing target image, and a processing area of a predetermined size including a target pixel in the processing target image. Separating means for calculating the color difference between the color of the foreground area and the color of the background area, and when the color difference calculated by the calculation means is smaller than a predetermined value, A corrected representative color corresponding to the foreground area or a corrected representative color corresponding to the background area that increases the color difference from the representative colors extracted by the extraction means according to the distance from the straight line passing through the average color and the average color of the background area An image processing apparatus comprising: a selecting unit that selects the color of the target pixel with a corrected representative color selected by the selecting unit.

本願請求項3に記載の発明は、本願請求項2に記載の発明における前記選択手段が、色空間において前記前景領域の平均色と前記背景領域の平均色を通る直線と、前記前景領域に対応する代表色と前記背景領域に対応する代表色を通る直線がなす角度が予め定めた角度よりも大きい場合には、前記算出手段で算出した色差にかかわらず前記修正代表色を選択することを特徴とする画像処理装置である。   According to a third aspect of the present invention, the selecting means according to the second aspect of the invention corresponds to the foreground area corresponding to a straight line passing through an average color of the foreground area and an average color of the background area in a color space. When the angle formed by a straight line passing through the representative color corresponding to the background region and the representative color corresponding to the background region is larger than a predetermined angle, the corrected representative color is selected regardless of the color difference calculated by the calculating means. The image processing apparatus.

本願請求項4に記載の発明は、処理対象画像から代表色を抽出する抽出手段と、前記処理対象画像のうち注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する分離手段と、前記前景領域の色と前記背景領域の色の色差を算出する算出手段と、前記算出手段で算出した色差が予め決められた値より小さい場合に、前記抽出手段で抽出した代表色から得た2つの代表色の組のそれぞれについて該組の代表色の一方と前記前景領域の色との色差及び代表色の他方と前記背景領域の色との色差を誤差として求め、前記誤差とともに2つの代表色の色差を用いた評価関数の値を求め、該評価関数の値により代表色の組を求めて、前記抽出手段で抽出した代表色の中から色差を大きくする前記前景領域に対応する修正代表色及び前記背景領域に対応する修正代表色として選択する選択手段と、前記選択手段で選択した修正代表色に前記注目画素の色を置換する置換手段を有することを特徴とする画像処理装置である。   The invention according to claim 4 of the present application separates an extraction means for extracting a representative color from the processing target image, and a processing area having a predetermined size including the target pixel in the processing target image into a foreground area and a background area. Separating means for calculating the color difference between the foreground area color and the background area color, and the representative extracted by the extraction means when the color difference calculated by the calculation means is smaller than a predetermined value. For each of the two representative color sets obtained from the color, a color difference between one of the representative colors of the set and the color of the foreground area and a color difference between the other of the representative colors and the color of the background area are obtained as errors, and the error In addition, a value of an evaluation function using the color difference between two representative colors is obtained, a set of representative colors is obtained from the value of the evaluation function, and the foreground region in which the color difference is increased from the representative colors extracted by the extraction unit. Corresponding correction fee An image processing apparatus comprising: selection means for selecting a corrected representative color corresponding to a color and the background area; and replacement means for replacing the color of the target pixel with the corrected representative color selected by the selection means. .

本願請求項5に記載の発明は、本願請求項1から請求項4のいずれか1項に記載の発明における前記選択手段が、予め決められた条件を満たす前記修正代表色が存在しない場合に、色空間において前記前景領域の色と前記背景領域の色を通る直線上に前記背景領域に対応する代表色との色差が予め決められた値より大きい代表色あるいは前記前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加し、前記修正代表色として選択することを特徴とする画像処理装置である。   In the invention according to claim 5 of the present application, when the selection representative color in the invention according to any one of claims 1 to 4 does not include the corrected representative color that satisfies a predetermined condition, A representative color in which a color difference between a representative color corresponding to the background area and a representative color corresponding to the background area is larger than a predetermined value on a straight line passing through the color of the foreground area and the color of the background area in a color space; The image processing apparatus is characterized in that a representative color having a color difference larger than a predetermined value is added and selected as the corrected representative color.

本願請求項6に記載の発明は、本願請求項1から請求項5のいずれか1項に記載の発明における前記算出手段が、前記前景領域の色として前記前景領域に対応する代表色を用い、前記背景領域の色として前記背景領域に対応する代表色を用いて色差を算出することを特徴とする画像処理装置である。   The invention according to claim 6 of the present application uses the representative color corresponding to the foreground region as the color of the foreground region by the calculation means according to any one of claims 1 to 5 of the present application, An image processing apparatus that calculates a color difference using a representative color corresponding to the background area as a color of the background area.

本願請求項7に記載の発明は、本願請求項1から請求項5のいずれか1項に記載の発明における前記算出手段が、前記前景領域の色として前記前景領域の各画素の平均色あるいは各画素に対応する代表色の平均色を用い、前記背景領域の色として前記背景領域の各画素の平均色あるいは各画素に対応する代表色の平均色を用いて色差を算出することを特徴とする画像処理装置である。   In the invention according to claim 7 of the present application, the calculation means in the invention according to any one of claims 1 to 5 is characterized in that an average color of each pixel in the foreground area or each color as the color of the foreground area A color difference is calculated using an average color of representative colors corresponding to pixels and using an average color of each pixel in the background area or an average color of representative colors corresponding to each pixel as the color of the background area. An image processing apparatus.

本願請求項8に記載の発明は、本願請求項1から請求項7のいずれか1項に記載の発明の構成に、さらに、前記注目画素が輪郭領域であるか否かを判定する輪郭判定手段を有し、前記置換手段は、前記輪郭判定手段によって輪郭領域であると判定された注目画素について置換を行うことを特徴とする画像処理装置である。   According to an eighth aspect of the present invention, in addition to the configuration of the first aspect of the present invention, a contour determination unit that determines whether or not the pixel of interest is a contour region. And the replacement means replaces the target pixel determined to be a contour region by the contour determination means.

本願請求項9に記載の発明は、本願請求項1から請求項8のいずれか1項に記載の発明の構成に、さらに、前記処理領域の色数を判定する色数判定手段を有し、前記置換手段は、前記色数判定手段によって色数が3以上であると判定された注目画素について置換を行わないことを特徴とする画像処理装置である。   The invention according to claim 9 of the present application further includes color number determination means for determining the number of colors of the processing region in the configuration of the invention according to any one of claims 1 to 8 of the present application, The replacement unit is an image processing apparatus that does not perform replacement on a target pixel that has been determined by the color number determination unit to have a color number of 3 or more.

本願請求項10に記載の発明は、本願請求項1から請求項8のいずれか1項に記載の発明の構成に、さらに、前記処理領域の色数を判定する色数判定手段を有し、前記分離手段は、前記色数判定手段により色数が3以上であると判定された場合には処理領域の大きさを現在の大きさよりも小さく変更して前記前景領域と前記背景領域の分離を行うことを特徴とする画像処理装置である。   The invention according to claim 10 of the present application further includes color number determination means for determining the number of colors of the processing region in the configuration of the invention according to any one of claims 1 to 8 of the present application, The separation unit changes the size of the processing region to be smaller than the current size when the number of colors is determined to be 3 or more by the color number determination unit, and separates the foreground region and the background region. An image processing apparatus characterized by performing the processing.

本願請求項11に記載の発明は、コンピュータに、請求項1から請求項10のいずれか1項に記載の画像処理装置の機能を実行させるものであることを特徴とする画像処理プログラムである。   The invention described in claim 11 is an image processing program for causing a computer to execute the function of the image processing apparatus described in any one of claims 1 to 10.

本願請求項1に記載の発明によれば、前景と背景の色の傾向を保持したまま代表色を変更することができ、本構成を有しない場合に比べて前景と背景が明確に再現された限定色画像を生成することができる。   According to the first aspect of the present invention, the representative color can be changed while maintaining the tendency of the foreground and background colors, and the foreground and the background are clearly reproduced as compared with the case without this configuration. A limited color image can be generated.

本願請求項2に記載の発明によれば、処理対象画像における前景と背景の色の傾向を保持したまま代表色を変更することができ、本構成を有しない場合に比べて前景と背景が明確に再現された限定色画像を生成することができる。   According to the second aspect of the present invention, the representative color can be changed while maintaining the tendency of the foreground and background colors in the processing target image, and the foreground and background are clear as compared with the case where the present configuration is not provided. The limited color image reproduced in the above can be generated.

本願請求項3に記載の発明によれば、処理対象画像で前景と背景に使用されている色とは異なる代表色の選択を防止することができる。   According to the third aspect of the present invention, selection of a representative color different from the colors used for the foreground and the background in the processing target image can be prevented.

本願請求項4に記載の発明によれば、本構成を有しない場合に比べて、最適な代表色を選択して前景と背景が明確に再現された限定色画像を生成することができる。   According to the invention described in claim 4 of the present application, it is possible to select the optimum representative color and generate a limited color image in which the foreground and the background are clearly reproduced as compared with the case without this configuration.

本願請求項5に記載の発明によれば、抽出されている代表色に選択すべき代表色が存在しない場合でも、前景と背景が明確に再現された限定色画像を生成することができる。   According to the fifth aspect of the present invention, it is possible to generate a limited color image in which the foreground and the background are clearly reproduced even when there is no representative color to be selected among the extracted representative colors.

本願請求項6に記載の発明によれば、限定色画像における色の違いに応じて代表色を変更することができる。   According to the sixth aspect of the present invention, the representative color can be changed according to the color difference in the limited color image.

本願請求項7に記載の発明によれば、前景領域、背景領域の色が不均一な場合についても適切な色差を算出することができる。   According to the seventh aspect of the present invention, an appropriate color difference can be calculated even when the foreground region and the background region have non-uniform colors.

本願請求項8に記載の発明によれば、本構成を有しない場合に比べて輪郭における前景と背景が明確に再現された限定色画像を生成することができる。   According to the invention described in claim 8 of the present application, it is possible to generate a limited color image in which the foreground and background in the contour are clearly reproduced as compared with the case where the present configuration is not provided.

本願請求項9に記載の発明によれば、複数色の影響による不所望の代表色の変更を防止することができる。   According to the ninth aspect of the present invention, it is possible to prevent an undesired change in the representative color due to the influence of a plurality of colors.

本願請求項10に記載の発明によれば、複数色の影響による不所望の代表色の変更を防止することができる。   According to the invention described in claim 10 of the present application, it is possible to prevent an undesired change in representative color due to the influence of a plurality of colors.

本願請求項11に記載の発明によれば、本願請求項1から請求項10のいずれか1項に記載の発明の効果を得ることができる。   According to the invention of claim 11 of the present application, the effect of the invention of any one of claims 1 to 10 can be obtained.

本発明の実施の一形態を示す構成図である。It is a block diagram which shows one Embodiment of this invention. 本発明の実施の一形態における動作の一例を示す流れ図である。It is a flowchart which shows an example of the operation | movement in one Embodiment of this invention. 修正代表色の選択処理の第1の例の説明図である。It is explanatory drawing of the 1st example of the selection process of a correction representative color. 修正代表色の選択処理の第1の例における選択範囲の一例の説明図である。It is explanatory drawing of an example of the selection range in the 1st example of the selection process of a correction representative color. 代表色の追加処理の一例の説明図である。It is explanatory drawing of an example of the addition process of a representative color. 修正代表色の選択処理の第2の例の説明図である。It is explanatory drawing of the 2nd example of the selection process of a correction representative color. 修正代表色の選択処理の第3の例の説明図である。It is explanatory drawing of the 3rd example of the selection process of a correction representative color. 修正代表色の選択処理の第3の例における選択範囲の一例の説明図である。It is explanatory drawing of an example of the selection range in the 3rd example of the selection process of a correction representative color. 代表色の追加処理の別の例の説明図である。It is explanatory drawing of another example of the addition process of a representative color. 修正代表色の選択処理の第4の例の説明図である。It is explanatory drawing of the 4th example of the selection process of a correction representative color. 本発明の実施の一形態における変形例を示す構成図である。It is a block diagram which shows the modification in one Embodiment of this invention. 本発明の実施の一形態の変形例における動作の一例を示す流れ図である。It is a flowchart which shows an example of the operation | movement in the modification of one Embodiment of this invention. 本発明の実施の一形態およびその変形例で説明した機能をコンピュータプログラムで実現した場合におけるコンピュータプログラム及びそのコンピュータプログラムを格納した記憶媒体とコンピュータの一例の説明図である。FIG. 16 is an explanatory diagram of an example of a computer program, a storage medium storing the computer program, and a computer when the functions described in the embodiment of the present invention and the modifications thereof are realized by a computer program.

図1は、本発明の実施の一形態を示す構成図である。図中、1は代表色抽出部、2は限定色画像生成部、3は前景背景分離部、4は輪郭判定部、5は色数判定部、6は色差算出部、7は修正代表色選択部、8は色置換部である。   FIG. 1 is a configuration diagram showing an embodiment of the present invention. In the figure, 1 is a representative color extraction unit, 2 is a limited color image generation unit, 3 is a foreground / background separation unit, 4 is a contour determination unit, 5 is a color number determination unit, 6 is a color difference calculation unit, and 7 is a modified representative color selection. Part 8 is a color replacement part.

代表色抽出部1は、与えられた処理対象画像全体から代表色を予め抽出しておく。代表色の抽出方法は限定されず、公知の種々の方法を用いて行えばよい。例えば特許文献1に記載されている方法を用いてもよい。なお、代表色の色数は予め決められた色数に限定される場合がある。   The representative color extraction unit 1 previously extracts representative colors from the entire processing target image. The method for extracting the representative color is not limited, and may be performed using various known methods. For example, a method described in Patent Document 1 may be used. Note that the number of representative colors may be limited to a predetermined number of colors.

限定色画像生成部2は、与えられた処理対象画像の各画素の色を、代表色抽出部1で抽出した代表色のいずれかに変換して限定色画像を予め生成しておく。代表色のいずれかに変換する方法は限定されず、公知の種々の方法を用いて行えばよい。例えば色差が最も小さい代表色に変換する方法や、特許文献1に記載されている方法などを用いてもよい。なお、この限定色画像生成部2の機能を後述する色置換部8に統合してもよい。   The limited color image generation unit 2 converts the color of each pixel of the given processing target image into one of the representative colors extracted by the representative color extraction unit 1 and generates a limited color image in advance. The method for converting to any of the representative colors is not limited, and may be performed using various known methods. For example, a method of converting to a representative color having the smallest color difference or a method described in Patent Document 1 may be used. Note that the function of the limited color image generation unit 2 may be integrated into a color replacement unit 8 described later.

前景背景分離部3は、与えられた処理対象画像のうち、注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する。各画素における前景領域か背景領域かの判定は処理対象画像を用いて行えばよく、その方法は限定されず、公知の種々の方法を用いて行えばよい。なお、処理領域の大きさは色数判定部5によって変更される場合がある。前景領域と背景領域への分離結果は色差算出部6及び色置換部8へ渡される。   The foreground / background separation unit 3 separates a processing area having a predetermined size including the target pixel from the given processing target image into a foreground area and a background area. The determination of the foreground region or the background region in each pixel may be performed using the processing target image, and the method is not limited, and may be performed using various known methods. Note that the size of the processing area may be changed by the color number determination unit 5. The separation result into the foreground area and the background area is passed to the color difference calculation unit 6 and the color replacement unit 8.

輪郭判定部4は、注目画素が輪郭領域であるか否かを判定する。輪郭領域か否かの判定方法は限定されず、例えば輪郭検出フィルタなど、公知の種々の方法を用いて行えばよい。判定結果は色差算出部6及び色置換部8へ渡される。なお、この輪郭判定部4を設けずに構成してもよい。   The contour determination unit 4 determines whether or not the target pixel is a contour region. The method for determining whether or not the region is a contour region is not limited, and may be performed using various known methods such as a contour detection filter. The determination result is passed to the color difference calculation unit 6 and the color replacement unit 8. In addition, you may comprise without providing this outline determination part 4. FIG.

色数判定部5は、前景背景分離部3で用いた処理領域の色数を判定する。判定は、例えば背景領域の色が1色、前景領域の色が1色の2色以下であるか、あるいは3色以上であるかを判定するとよい。判定方法としては、例えば処理領域の各画素の色について主成分分析を行い、予め決められた値よりも大きい色数を計数して、計数値を判定すればよい。あるいは、背景色または前景色の分散値が予め定められた値よりも大きいか否かを判定してもよい。または、図1では図示していないが、例えば限定色画像生成部2で生成した限定色画像を用い、限定色画像において処理領域に使用されている代表色の色数を判定してもよい。判定結果は、図1に示した例では色置換部8に渡している。このほか、色数が3以上であると判定した場合には処理領域の大きさを現在の大きさよりも小さく変更するように構成してもよい。この場合、処理領域を使用する各部において大きさが変更された処理領域を用いて処理を行うことになる。例えば前景背景分離部3は変更された処理領域において前景領域と背景領域の分離を行うことになる。なお、大きさを変更した処理領域において再度の色数の判定を行って処理領域の大きさの変更を繰り返してもよいが、予め決められた大きさより小さく変更しないように限度を設定しておくとよい。この色数判定部5を設けずに構成してもよい。   The color number determination unit 5 determines the number of colors in the processing region used in the foreground / background separation unit 3. The determination may be made, for example, by determining whether the background region color is one color and the foreground region color is two colors or less, or three or more colors. As a determination method, for example, a principal component analysis may be performed on the color of each pixel in the processing region, and the number of colors larger than a predetermined value may be counted to determine the count value. Or you may determine whether the variance value of a background color or a foreground color is larger than a predetermined value. Alternatively, although not illustrated in FIG. 1, for example, the limited color image generated by the limited color image generation unit 2 may be used to determine the number of representative colors used in the processing area in the limited color image. The determination result is passed to the color replacement unit 8 in the example shown in FIG. In addition, when it is determined that the number of colors is 3 or more, the size of the processing area may be changed to be smaller than the current size. In this case, processing is performed using a processing area whose size has been changed in each unit that uses the processing area. For example, the foreground / background separator 3 separates the foreground area and the background area in the changed processing area. Note that it is possible to repeat the determination of the number of colors and repeat the change of the size of the processing region in the processing region whose size has been changed, but a limit is set so as not to change the size smaller than a predetermined size. Good. You may comprise without providing this color number determination part 5. FIG.

色差算出部6は、前景領域の色と背景領域の色の色差を算出する。色差は、色空間における2つの色の距離である。例えばRGB色空間において2つの色の色差ΔEは、2つの色のそれぞれの色成分の差であるΔR、ΔG、ΔBから、
ΔE=(ΔR2 +ΔG2 +ΔB2 1/2
により求めればよい。前景領域の色及び背景領域の色としては、処理対象画像をもとに処理領域中の前景領域の各画素の平均色及び背景領域の各画素の平均色を求めて用いるとよい。あるいは、限定色画像をもとに前景領域に対応する代表色及び背景領域に対応する代表色を取得して用いてもよい。前景領域または背景領域中に類似する代表色が複数存在している場合には、前景領域の各画素に対応する代表色の平均色及び背景領域の各画素に対応する代表色の平均色を用いてもよい。前景領域か背景領域かは、前景背景分離部3による分離結果を使用すればよい。なお、輪郭判定部4で輪郭領域以外であると判定された場合には、この色差算出部6以降の処理を行わないように制御してもよい。
The color difference calculation unit 6 calculates the color difference between the foreground area color and the background area color. The color difference is the distance between two colors in the color space. For example, in the RGB color space, the color difference ΔE between two colors can be calculated from ΔR, ΔG, ΔB, which are differences between the color components of the two colors.
ΔE = (ΔR 2 + ΔG 2 + ΔB 2 ) 1/2
It can be obtained by As the colors of the foreground area and the background area, it is preferable to obtain and use the average color of each pixel in the foreground area and the average color of each pixel in the background area based on the processing target image. Alternatively, the representative color corresponding to the foreground area and the representative color corresponding to the background area may be acquired based on the limited color image. When there are a plurality of similar representative colors in the foreground area or the background area, the average color of the representative color corresponding to each pixel in the foreground area and the average color of the representative color corresponding to each pixel in the background area are used. May be. For the foreground area or the background area, the separation result by the foreground / background separation unit 3 may be used. If the contour determination unit 4 determines that the region is outside the contour region, control may be performed so that the processing after the color difference calculation unit 6 is not performed.

修正代表色選択部7は、色差算出部6で算出した色差が予め決められた値より小さい場合に、代表色抽出部1で抽出した代表色の中から、色差算出部6で算出された色差よりも色差を大きくする前景領域に対応する修正代表色あるいは背景領域に対応する修正代表色を選択する。選択方法の詳細については後述するが、色空間において前景領域の平均色と背景領域の平均色を通る直線からの距離に従って、または、前景領域に対応する代表色と背景領域に対応する代表色を通る直線からの距離に従って、修正代表色を選択するとよい。また、前景領域の平均色と背景領域の平均色を通る直線を用いる場合、さらに前景領域に対応する代表色と背景領域に対応する代表色を通る直線も用い、2直線がなす角度が予め定めた角度よりも大きい場合には、色差算出部6で算出した色差にかかわらず修正代表色を選択するとよい。あるいは、代表色抽出部1で抽出した代表色から得た2つの代表色の組のそれぞれについて、その組の2つの代表色と前景領域の色(例えば平均色)及び背景領域の色(例えば平均色)を用いた評価関数の値を求め、その評価関数の値により代表色の組を求めて修正代表色を選択してもよい。なお、予め決められた条件を満たす修正代表色が存在しない場合には、色空間において前景領域の色と背景領域の色を通る直線上に、背景領域に対応する代表色との色差が予め決められた値より大きい代表色あるいは前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加し、修正代表色として選択してもよい。   The corrected representative color selection unit 7 calculates the color difference calculated by the color difference calculation unit 6 from the representative colors extracted by the representative color extraction unit 1 when the color difference calculated by the color difference calculation unit 6 is smaller than a predetermined value. The corrected representative color corresponding to the foreground area or the corrected representative color corresponding to the background area is selected. Although the details of the selection method will be described later, the representative color corresponding to the foreground area and the representative color corresponding to the background area are selected according to the distance from the straight line passing through the average color of the foreground area and the average color of the background area in the color space. The corrected representative color may be selected according to the distance from the straight line that passes through. When a straight line that passes through the average color of the foreground area and the average color of the background area is used, a straight line that passes through a representative color corresponding to the foreground area and a representative color corresponding to the background area is also used, and an angle formed by the two straight lines is determined in advance. If the angle is larger than the angle, the corrected representative color may be selected regardless of the color difference calculated by the color difference calculation unit 6. Alternatively, for each of the two representative color sets obtained from the representative colors extracted by the representative color extraction unit 1, the two representative colors of the set, the foreground area color (for example, the average color), and the background area color (for example, the average) It is also possible to obtain the value of the evaluation function using the color), obtain a set of representative colors based on the value of the evaluation function, and select the corrected representative color. If there is no corrected representative color that satisfies a predetermined condition, the color difference between the representative color corresponding to the background area is determined in advance on a straight line passing the colors of the foreground area and the background area in the color space. A representative color larger than a predetermined value or a representative color having a color difference with a representative color corresponding to the foreground area larger than a predetermined value may be added and selected as a corrected representative color.

色置換部8は、修正代表色選択部7で選択した修正代表色に注目画素の色を置換する。なお、注目画素が前景領域の画素であって、修正代表色選択部7で背景領域に対応する修正代表色を選択した場合、あるいは、注目画素が背景領域の画素であって、修正代表色選択部7で前景領域に対応する修正代表色を選択した場合については、注目画素の色を変更しなくてもよい。なお、輪郭判定部4で輪郭領域と判定されなかった場合、及び、色数判定部5で色数が3色以上であると判定された場合には、修正代表色への置換は行わないように構成してもよい。また、限定色画像生成部2に代えて、この色置換部8において注目画素の色を修正代表色あるいは他の代表色のいずれかに変換するように構成してもよい。   The color replacement unit 8 replaces the color of the target pixel with the corrected representative color selected by the corrected representative color selection unit 7. When the target pixel is a pixel in the foreground area and the corrected representative color selection unit 7 selects a corrected representative color corresponding to the background area, or when the target pixel is a pixel in the background area and the corrected representative color is selected. When the modified representative color corresponding to the foreground area is selected in the unit 7, the color of the target pixel may not be changed. If the contour determination unit 4 does not determine that the region is an outline region, and if the number of colors determination unit 5 determines that the number of colors is three or more, the replacement with the corrected representative color is not performed. You may comprise. Further, instead of the limited color image generation unit 2, the color replacement unit 8 may be configured to convert the color of the pixel of interest into either a corrected representative color or another representative color.

図2は、本発明の実施の一形態における動作の一例を示す流れ図である。S11において、代表色抽出部1は、与えられた処理対象画像全体から代表色を抽出する。そしてS12において、限定色画像生成部2は、色空間上において処理対象画像の各画素の色に対応する代表色、例えば各画素の色との距離が最も小さい代表色に変換し、限定色画像を生成する。   FIG. 2 is a flowchart showing an example of the operation in the embodiment of the present invention. In S11, the representative color extraction unit 1 extracts a representative color from the entire processing target image. In S12, the limited color image generation unit 2 converts the representative color corresponding to the color of each pixel of the processing target image in the color space, for example, the representative color having the smallest distance from the color of each pixel, to the limited color image. Is generated.

S13において、未処理の画素を注目画素に設定し、S14において、前景背景分離部3は、与えられた処理対象画像のうち、注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する。またS15において、輪郭判定部4は注目画素が輪郭領域であるか否かを判定する。S16において、S15で注目画素が輪郭領域であると判定された場合にはS17へ進み、注目画素が輪郭領域でないと判定された場合には、代表色の修正処理を行わずにS23へ進む。なお、S14及びS15の処理を行わなくてもよい。   In S13, an unprocessed pixel is set as a target pixel. In S14, the foreground / background separation unit 3 selects a foreground region for a processing region of a predetermined size including the target pixel from the given processing target image. Separate into background areas. In S15, the contour determination unit 4 determines whether or not the target pixel is a contour region. In S16, if it is determined in S15 that the pixel of interest is an outline region, the process proceeds to S17. If it is determined that the pixel of interest is not an outline region, the process proceeds to S23 without correcting the representative color. Note that the processing of S14 and S15 may not be performed.

S17において、色差算出部6は、前景領域の色と背景領域の色の色差を算出する。例えば処理対象画像における前景領域の平均色と背景領域の平均色との色差、あるいは、限定色画像における前景領域の代表色と背景領域の代表色との色差を求めるとよい。   In S17, the color difference calculation unit 6 calculates the color difference between the foreground area color and the background area color. For example, the color difference between the average color of the foreground area and the average color of the background area in the processing target image, or the color difference between the representative color of the foreground area and the representative color of the background area in the limited color image may be obtained.

S18において、修正代表色選択部7は、S17で色差算出部6により求めた色差が予め決められた値より小さいか否かを判定する。色差が予め決められた値よりも大きければ、そのままでも前景と背景との色の違いが明確であると判断し、この場合には代表色の変更を行わないのでS23へ進む。   In S18, the corrected representative color selection unit 7 determines whether or not the color difference obtained by the color difference calculation unit 6 in S17 is smaller than a predetermined value. If the color difference is larger than a predetermined value, it is determined that the color difference between the foreground and the background is clear even if it is as it is, and in this case, since the representative color is not changed, the process proceeds to S23.

色差が予め決められた値よりも小さい場合には、前景と背景との色の違いが明確には再現されていないものと判断し、S19において、色差が大きくなるように前景領域に対応する代表色あるいは背景領域に対応する代表色を選択し直して修正代表色とする。なお、予め決められた条件を満たす修正代表色が存在しない場合には代表色を追加し、修正代表色として選択してもよい。   If the color difference is smaller than a predetermined value, it is determined that the color difference between the foreground and the background is not clearly reproduced, and a representative corresponding to the foreground area is set so as to increase the color difference in S19. The representative color corresponding to the color or background area is selected again to be the modified representative color. If there is no modified representative color that satisfies a predetermined condition, a representative color may be added and selected as the modified representative color.

一方、S20において、色数判定部5は処理領域の色数を求め、S21において色数が2色以下であるか否かを判定する。S21で2色以下であると判定された場合にはS22に進み、3色以上であると判定された場合には、S22による修正代表色への置換を行わずにS23へ進む。なお、S20、S21の処理はS13以降、S19以前であってもよく、並行して行ってもよい。   On the other hand, in S20, the color number determination unit 5 obtains the number of colors in the processing region, and determines in S21 whether the number of colors is two or less. If it is determined in S21 that there are two or less colors, the process proceeds to S22, and if it is determined that there are three or more colors, the process proceeds to S23 without replacing with the corrected representative color in S22. Note that the processing of S20 and S21 may be performed after S13 or before S19, or may be performed in parallel.

S22において、色置換部8は、S19で修正代表色選択部7により選択された修正代表色に注目画素の色を置換する。なお、この動作例ではS16、S18、S21の判定により、この修正代表色への置換は、輪郭領域であって、処理領域の色数が2色以下であり、前景領域と背景領域の色差が予め決められた値よりも小さい場合に行われることになる。   In S22, the color replacement unit 8 replaces the color of the target pixel with the corrected representative color selected by the corrected representative color selection unit 7 in S19. In this operation example, the replacement with the corrected representative color is performed in the outline region, the number of colors in the processing region is two or less, and the color difference between the foreground region and the background region is determined based on the determinations in S16, S18, and S21. This is performed when the value is smaller than a predetermined value.

S23において、処理対象画像の各画素について注目画素として処理を終えたか否かを判定し、未処理の画素が残っている場合にS13へ戻り、未処理の画素を注目画素として処理を繰り返す。処理を終えると、S12で生成した限定色画像のうち前景領域と背景領域の色差が予め決められた値より小さい部分について色差を大きく修正した限定色画像が得られることになる。   In S23, it is determined whether or not each pixel of the processing target image has been processed as the target pixel. If there are any unprocessed pixels, the process returns to S13, and the process is repeated using the unprocessed pixels as the target pixel. When the process is completed, a limited color image in which the color difference is largely corrected for a portion where the color difference between the foreground region and the background region is smaller than a predetermined value in the limited color image generated in S12 is obtained.

修正代表色選択部7における修正代表色の選択の処理について、いくつかの例を示す。図3は、修正代表色の選択処理の第1の例の説明図、図4は、修正代表色の選択処理の第1の例における選択範囲の一例の説明図である。この例では、前景領域の平均色と背景領域の平均色を通る直線からの距離に従って修正代表色を選択する例を示している。図3中、Pは前景領域の平均色を、Qは背景領域の平均色を、T1,T2,…は代表色を、それぞれ示している。また、色差算出部6では前景領域の平均色と背景領域の平均色の色差を求めることとし、色Pと色Qの色差は、予め決められた値よりも小さいものとしている。図3(A)では色Qから色差が予め決められた値の範囲を破線で示し、図3(B)では色Pから色差が予め決められた値の範囲を破線で示しており、色Pと色Qはこの範囲に含まれている。   Some examples of the process of selecting the corrected representative color in the corrected representative color selection unit 7 will be described. FIG. 3 is an explanatory diagram of a first example of the corrected representative color selection process, and FIG. 4 is an explanatory diagram of an example of a selection range in the first example of the corrected representative color selection process. In this example, the corrected representative color is selected according to the distance from the straight line passing through the average color of the foreground area and the average color of the background area. In FIG. 3, P indicates the average color of the foreground area, Q indicates the average color of the background area, and T1, T2,... The color difference calculation unit 6 calculates the color difference between the average color of the foreground area and the average color of the background area, and the color difference between the color P and the color Q is smaller than a predetermined value. In FIG. 3A, the range of values for which the color difference is predetermined from the color Q is indicated by a broken line, and in FIG. 3B, the range of values for which the color difference is predetermined from the color P is indicated by a broken line. And the color Q are included in this range.

修正代表色選択部7では、前景領域の平均色Pと背景領域の平均色Qを通る直線を考え、この直線とそれぞれの代表色との距離に従って、色差を大きくする代表色を修正代表色として選択する。まず、背景領域の平均色Qから前景領域の平均色Pへ向かう方向に、背景領域の平均色Qからの色差が予め決められた値よりも大きい代表色の中から直線との距離に応じて修正代表色を選択する。この場合を図3(A)に示している。この場合に選択される修正代表色は、前景領域の代表色を変更するものである。   The corrected representative color selection unit 7 considers a straight line passing through the average color P in the foreground area and the average color Q in the background area, and uses the representative color that increases the color difference as the corrected representative color according to the distance between the straight line and each representative color. select. First, in the direction from the average color Q of the background area to the average color P of the foreground area, the color difference from the average color Q of the background area is larger than a predetermined value according to the distance from the straight line. Select the corrected representative color. This case is shown in FIG. The corrected representative color selected in this case changes the representative color of the foreground area.

例えば、直線からの距離が最も小さい代表色を修正代表色として選択すればよい。あるいは、背景領域の平均色Qとの距離についても考慮し、ある代表色について直線との距離をLt、背景領域の平均色Qとの距離をLuとして
D=αLt+βLu
を算出し、値Dが最小となる代表色を修正代表色として選択してもよい。α、βは予め与える定数である。この場合、直線からの距離が小さいほど選択されやすく、背景領域の平均色からの色差が予め決められた値よりも大きい条件の下で背景領域の平均色に近いほど選択されやすくなる。
For example, the representative color having the shortest distance from the straight line may be selected as the corrected representative color. Alternatively, the distance from the average color Q in the background area is also considered, and the distance from the straight line is set to Lt and the distance from the average color Q in the background area is set to Lu for a certain representative color. D = αLt + βLu
And a representative color having the minimum value D may be selected as a corrected representative color. α and β are constants given in advance. In this case, the smaller the distance from the straight line, the easier it is to select, and the closer to the average color of the background region, the easier it is to select the color difference from the average color of the background region than a predetermined value.

なお、背景領域の平均色Qから前景領域の平均色Pへの色の変化とかけ離れた代表色が選択されないように、代表色の選択の際に条件を付しておくとよい。例えば、直線からの距離に従って代表色を選択する場合、直線からの距離が予め決められた値よりも大きい場合には、色Qから色Pへの方向における修正代表色の選択は行わないようにするとよい。さらに、背景領域の平均色Qからの色差の上限を設け、色差が上限を超える場合には修正代表色の選択は行わないようにするとよい。この場合、色Qからの色差が予め決められた値の範囲を越え、色差の上限以内であって、直線からの距離が予め決められた値以内である代表色の中から選択されることになる。   It should be noted that a condition may be set when selecting a representative color so that a representative color far from the color change from the average color Q of the background area to the average color P of the foreground area is not selected. For example, when the representative color is selected according to the distance from the straight line, if the distance from the straight line is larger than a predetermined value, the correction representative color in the direction from the color Q to the color P is not selected. Good. Furthermore, an upper limit of the color difference from the average color Q in the background region is provided, and when the color difference exceeds the upper limit, the corrected representative color is not selected. In this case, the color difference from the color Q exceeds the predetermined value range, is within the upper limit of the color difference, and is selected from representative colors whose distance from the straight line is within the predetermined value. Become.

あるいは、図4(A)に示す、色Qを底面の中心とする円錐領域内であって、色Qから色差が予め決められた値Luminの範囲を越えている代表色の中から選択してもよい。図4(A)に示す例では、色Qを始点として色Pへ向かう方向に値Luminより長く予め決められた長さを持つベクトルをベクトルTとし、色Qを始点としてベクトルTと交差する方向に値Luminより短く予め決められた長さを持つベクトルの集合をベクトル群Uとし、係数γ、δを0以上1以下の値として、
γ・ベクトルT+δ・(1−γ)・ベクトルU
の範囲が円錐領域となる。この円錐領域であって、色Qから色差が予め決められた値Luminの範囲を越えている代表色の中から選択すればよい。この条件を満たす代表色が存在しない場合には、色Qから色Pへの方向における修正代表色の選択は行わない。
Alternatively, as shown in FIG. 4A, a representative color is selected from representative colors within a conical region having the color Q as the center of the bottom surface, and the color difference from the color Q exceeds a predetermined value Lumin. Also good. In the example shown in FIG. 4A, a vector T having a predetermined length longer than the value Lumin in the direction toward the color P starting from the color Q is defined as a vector T, and the direction intersecting the vector T starting from the color Q. A set of vectors having a predetermined length shorter than the value Lumin is defined as a vector group U, and coefficients γ and δ are values of 0 or more and 1 or less,
γ · vector T + δ · (1−γ) · vector U
Is a conical region. The conical region may be selected from representative colors in which the color difference from the color Q exceeds a predetermined value Lumin. If there is no representative color satisfying this condition, the corrected representative color in the direction from the color Q to the color P is not selected.

上述の値Dを算出する場合には、値Dが予め決められた値よりも大きい場合には、色Qから色Pへの方向における修正代表色の選択は行わないようにすればよい。この場合、値Dが予め決められた値以内の範囲が図4(A)に示す円錐領域に対応することになる。   When calculating the above-mentioned value D, if the value D is larger than a predetermined value, the correction representative color in the direction from the color Q to the color P may not be selected. In this case, the range within which the value D is within a predetermined value corresponds to the conical region shown in FIG.

背景領域の平均色Qから前景領域の平均色Pへ向かう方向に修正代表色が選択されない場合には、前景領域の平均色Pから背景領域の平均色Qへ向かう方向に、前景領域の平均色Pからの色差が予め決められた値よりも大きい代表色の中から直線との距離に応じて修正代表色を選択する。この場合を図3(B)に示している。この場合に選択される修正代表色は、背景領域の代表色を変更するものである。   If the corrected representative color is not selected in the direction from the average color Q of the background area to the average color P of the foreground area, the average color of the foreground area is changed from the average color P of the foreground area to the average color Q of the background area. A corrected representative color is selected from representative colors having a color difference from P larger than a predetermined value according to the distance from the straight line. This case is shown in FIG. The corrected representative color selected in this case changes the representative color of the background area.

例えば、直線からの距離が最も小さい代表色を修正代表色として選択すればよい。あるいは、前景領域の平均色Pとの距離についても考慮し、ある代表色について直線との距離をLt、前景領域の平均色Pとの距離をLvとして
D=αLt+βLv
を算出し、Dが最小となる代表色を修正代表色として選択してもよい。α、βは予め与える定数である。この場合、直線からの距離が小さいほど選択されやすく、前景領域の平均色からの色差が予め決められた値よりも大きい条件の下で前景領域の平均色に近いほど選択されやすくなる。
For example, the representative color having the shortest distance from the straight line may be selected as the corrected representative color. Alternatively, the distance from the average color P in the foreground area is also considered, and the distance from the straight line is Lt and the distance from the average color P in the foreground area is Lv for a certain representative color. D = αLt + βLv
And the representative color that minimizes D may be selected as the corrected representative color. α and β are constants given in advance. In this case, the smaller the distance from the straight line, the easier the selection, and the closer the color to the foreground area is, the easier it is to select the color difference from the average color of the foreground area than a predetermined value.

なお、この場合も前景領域の平均色Pから背景領域の平均色Qへの色の変化とかけ離れた代表色が選択されないように、代表色の選択の際に条件を付しておくとよい。例えば、直線からの距離に従って代表色を選択する場合、直線からの距離が予め決められた値よりも大きい場合には、色Pから色Qへの方向における修正代表色の選択は行わないようにするとよい。さらに、背景領域の平均色Pからの色差の上限を設け、色差が上限を超える場合には修正代表色の選択は行わないようにするとよい。この場合、色Pからの色差が予め決められた値の範囲を越え、色差の上限以内であって、直線からの距離が予め決められた値以内である代表色の中から選択されることになる。   In this case as well, it is preferable to add a condition when selecting a representative color so that a representative color that is far from the color change from the average color P in the foreground area to the average color Q in the background area is not selected. For example, when the representative color is selected according to the distance from the straight line, if the distance from the straight line is larger than a predetermined value, the corrected representative color in the direction from the color P to the color Q is not selected. Good. Furthermore, an upper limit of the color difference from the average color P in the background area is provided, and when the color difference exceeds the upper limit, the corrected representative color is not selected. In this case, the color difference from the color P exceeds the predetermined value range, is within the upper limit of the color difference, and is selected from the representative colors whose distance from the straight line is within the predetermined value. Become.

あるいは、図4(B)に示す、色Pを底面の中心とする円錐領域内であって、色Pから色差が予め決められた値Luminの範囲を越えている代表色の中から選択してもよい。図4(B)に示す例では、色Pを始点として色Qへ向かう方向に値Luminより長く予め決められた長さを持つベクトルをベクトルTとし、色Qを始点としてベクトルTと交差する方向に値Luminより短く予め決められた長さを持つベクトルの集合をベクトル群Uとし、係数γ、δを0以上1以下の値として、
−γ・ベクトルT+δ・(1−γ)・ベクトルU
の範囲が円錐領域となる。この円錐領域であって、色Pから色差が予め決められた値Luminの範囲を越えている代表色の中から選択すればよい。この条件を満たす代表色が存在しない場合には、色Pから色Qへの方向における修正代表色の選択は行わない。
Alternatively, as shown in FIG. 4B, a representative color is selected from representative colors that are within a conical region having the color P as the center of the bottom surface and the color difference from the color P exceeds a predetermined value Lumin. Also good. In the example shown in FIG. 4B, a vector T having a predetermined length longer than the value Lumin in the direction toward the color Q starting from the color P is defined as the vector T, and the direction intersecting the vector T starting from the color Q. A set of vectors having a predetermined length shorter than the value Lumin is defined as a vector group U, and coefficients γ and δ are values of 0 or more and 1 or less,
−γ · vector T + δ · (1−γ) · vector U
Is a conical region. The conical region may be selected from representative colors in which the color difference from the color P exceeds a predetermined value Lumin. If there is no representative color that satisfies this condition, the correction representative color in the direction from the color P to the color Q is not selected.

上述の値Dを算出する場合には、値Dが予め決められた値よりも大きい場合には、色Pから色Qへの方向における修正代表色の選択は行わないようにすればよい。この場合、値Dが予め決められた値以内の範囲が図4(B)に示す円錐領域に対応することになる。   When calculating the above-described value D, if the value D is larger than a predetermined value, the correction representative color in the direction from the color P to the color Q may not be selected. In this case, a range where the value D is within a predetermined value corresponds to the conical region shown in FIG.

図5は、代表色の追加処理の一例の説明図である。背景領域の平均色Qから前景領域の平均色Pへの方向に修正代表色の選択を行ったが選択されず、前景領域の平均色Pから背景領域の平均色Qへの方向に修正代表色の選択を行っても選択されなかった場合には、色置換部8における色の置換を行わないように構成してもよいが、修正代表色選択部7で新たな代表色を追加し、その代表色を修正代表色として選択してもよい。例えば、この修正代表色の選択処理の第1の例では、色空間において前景領域の平均色Pと背景領域の平均色Qを通る直線上に、背景領域の平均色Qまたは背景領域に対応する代表色との色差が予め決められた値より大きい代表色、あるいは、前景領域の平均色Pまたは前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加し、追加した代表色を修正代表色として選択すればよい。   FIG. 5 is an explanatory diagram of an example of the representative color adding process. The corrected representative color is selected in the direction from the average color Q in the background area to the average color P in the foreground area, but is not selected, and the corrected representative color is changed in the direction from the average color P in the foreground area to the average color Q in the background area. If the color replacement unit 8 does not select the color, the color replacement unit 8 may not replace the color. However, the modified representative color selection unit 7 adds a new representative color, The representative color may be selected as the corrected representative color. For example, in the first example of the modified representative color selection process, the average color Q of the background region or the background region corresponds to a straight line passing through the average color P of the foreground region and the average color Q of the background region in the color space. Add a representative color whose color difference from the representative color is larger than a predetermined value, or a representative color whose color difference from the average color P in the foreground area or the representative color corresponding to the foreground area is larger than a predetermined value. The selected representative color may be selected as the corrected representative color.

なお、背景領域の平均色Qまたは背景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加する場合には、前景領域の平均色P又は前景領域に対応する代表色との色差が小さい側に追加する。また、前景領域の平均色Pまたは前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加する場合には、背景領域の平均色Qまたは背景領域に対応する代表色との色差が小さい側に追加する。図5に示した例では、前景領域の平均色Pと背景領域の平均色Qを通る直線上に、背景領域に対応する代表色T2との色差が予め決められた値より大きい代表色Taを追加した例を示している。この追加した代表色Taを修正代表色として選択すればよい。   In addition, when adding a representative color whose color difference from the average color Q of the background area or the representative color corresponding to the background area is larger than a predetermined value, the average color P of the foreground area or the representative color corresponding to the foreground area Add to the side where the color difference is small. In addition, when a representative color having a color difference from the average color P of the foreground area or the representative color corresponding to the foreground area is larger than a predetermined value, the average color Q of the background area or the representative color corresponding to the background area is added. Add to the side where the color difference is small. In the example shown in FIG. 5, a representative color Ta whose color difference from the representative color T2 corresponding to the background area is larger than a predetermined value on a straight line passing through the average color P of the foreground area and the average color Q of the background area. An added example is shown. The added representative color Ta may be selected as the corrected representative color.

もちろん、上述の背景領域または前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加するほか、背景領域に対応する代表色と前景領域に対応する代表色を挟み、色差が予め決められた値より大きくなる2つの代表色を上述の直線上に追加してもよい。   Of course, in addition to adding a representative color whose color difference from the representative color corresponding to the background region or foreground region is larger than a predetermined value, the representative color corresponding to the background region and the representative color corresponding to the foreground region are sandwiched, Two representative colors whose color difference is larger than a predetermined value may be added on the above-mentioned straight line.

限定色画像生成部2で生成した限定色画像においては、前景領域と背景領域が、ある1つの代表色に対応づけられている場合もある。この場合、処理対象画像では背景と前景との色の違いが存在していても、限定色画像では前景領域と背景領域の区別がなくなる。このような場合でも、上述の修正代表色の選択処理の第1の例では、前景領域の平均色と背景領域の平均色を用いて修正代表色を選択すれば、修正代表色を用いた限定色画像では前景領域と背景領域が現出することになる。   In the limited color image generated by the limited color image generation unit 2, the foreground area and the background area may be associated with a certain representative color. In this case, even if there is a color difference between the background and the foreground in the processing target image, there is no distinction between the foreground area and the background area in the limited color image. Even in such a case, in the first example of the modified representative color selection process described above, if the modified representative color is selected using the average color of the foreground area and the average color of the background area, the limitation using the modified representative color is limited. In the color image, a foreground area and a background area appear.

図6は、修正代表色の選択処理の第2の例の説明図である。この例では、前景領域の平均色と背景領域の平均色とともに、前景領域に対応する代表色と背景領域に対応する代表色を用いる例を示している。図中、Pは前景領域の平均色を、Qは背景領域の平均色を、Rは前景領域に対応する代表色を、Sは背景領域に対応する代表色を、T1,T2,…は代表色を、それぞれ示している。また、色Pと色Qの色差は、予め決められた値よりも小さいものとしている。図6(A)では色Qから色差が予め決められた値の範囲を破線で示し、図6(B)では色Pから色差が予め決められた値の範囲を破線で示しており、色Pと色Qはこの範囲に含まれている。   FIG. 6 is an explanatory diagram of a second example of the modified representative color selection process. In this example, a representative color corresponding to the foreground area and a representative color corresponding to the background area are used together with the average color of the foreground area and the average color of the background area. In the figure, P is the average color of the foreground area, Q is the average color of the background area, R is the representative color corresponding to the foreground area, S is the representative color corresponding to the background area, T1, T2,. Each color is shown. Further, the color difference between the colors P and Q is assumed to be smaller than a predetermined value. In FIG. 6A, the range of values for which the color difference is predetermined from the color Q is indicated by a broken line, and in FIG. 6B, the range of values for which the color difference is predetermined from the color P is indicated by a broken line. And the color Q are included in this range.

前景領域、背景領域のそれぞれにおいては、各領域の平均色と各領域に対応する代表色とが異なる場合があり、その場合に前景領域と背景領域の平均色の変化の方向と代表色の変化の方法とが異なってしまうことがある。この場合の例を図6に示している。例えば図6(A)では、背景領域の平均色Qから前景領域の平均色Pへ向かう方向と、背景領域に対応する代表色Sから前景領域に対応する代表色Rへ向かう方向とが、角度θだけ異なっている。また、図6(B)においても、前景領域の平均色Pから背景領域の平均色Qへ向かう方向と、前景領域に対応する代表色Rから背景領域に対応する代表色Sへ向かう方向とが、角度θだけ異なっている。この角度θが予め定めた角度よりも大きい場合には、前景領域に対応する代表色及び背景領域に対応する代表色を用いて生成された限定色画像では、背景領域と前景領域の色の傾向が与えられた処理対象画像とは異なって見えてしまう。そのため、角度θが予め定めた角度よりも大きい場合には、色差算出部6で算出した色差の大きさにかかわらず、修正代表色の選択を行う。なお、修正代表色の選択方法については、上述の修正代表色の選択処理の第1の例で説明したとおりである。前景領域の平均色Pと背景領域の平均色Qを通る直線からの距離に応じて修正代表色を選択するので、前景領域の色と背景領域の色との色の傾向が揃う。そのため、色差が確保されるとともに、限定色化による色の傾向の相違が防止される。   In each of the foreground area and the background area, the average color of each area may be different from the representative color corresponding to each area. In that case, the direction of change in the average color of the foreground area and the background area and the change of the representative color The method may be different. An example of this case is shown in FIG. For example, in FIG. 6A, the direction from the average color Q of the background area to the average color P of the foreground area and the direction from the representative color S corresponding to the background area to the representative color R corresponding to the foreground area are expressed as angles. It differs by θ. Also in FIG. 6B, there are a direction from the average color P in the foreground area to the average color Q in the background area, and a direction from the representative color R corresponding to the foreground area to the representative color S corresponding to the background area. The angle θ is different. When the angle θ is larger than a predetermined angle, the limited color image generated using the representative color corresponding to the foreground area and the representative color corresponding to the background area has a tendency of color in the background area and the foreground area. Appears different from the image to be processed. Therefore, when the angle θ is larger than a predetermined angle, the corrected representative color is selected regardless of the magnitude of the color difference calculated by the color difference calculation unit 6. The method of selecting the corrected representative color is as described in the first example of the corrected representative color selection process described above. Since the corrected representative color is selected according to the distance from the straight line passing through the average color P of the foreground area and the average color Q of the background area, the colors of the foreground area color and the background area color are aligned. For this reason, a color difference is ensured and a difference in color tendency due to the limited color is prevented.

図7は、修正代表色の選択処理の第3の例の説明図、図8は、修正代表色の選択処理の第3の例における選択範囲の一例の説明図である。この例では、前景領域に対応する代表色と背景領域に対応する代表色を通る直線からの距離に従って修正代表色を選択する例を示している。図中、TPは前景領域に対応する代表色を、TQは背景領域に対応する代表色を、T1,T2,…はそのほかの代表色を、それぞれ示している。また、色差算出部6は前景領域に対応する代表色TPと背景領域に対応する代表色TQとの色差を求めることとし、代表色TPと代表色TQの色差は、予め決められた値よりも小さいものとしている。図7(A)では代表色TQから色差が予め決められた値の範囲を破線で示し、図7(B)では代表色TPから色差が予め決められた値の範囲を破線で示しており、代表色TPと代表色TQはこの範囲に含まれている。   FIG. 7 is an explanatory diagram of a third example of the corrected representative color selection process, and FIG. 8 is an explanatory diagram of an example of a selection range in the third example of the corrected representative color selection process. In this example, the corrected representative color is selected according to the distance from a straight line passing through the representative color corresponding to the foreground area and the representative color corresponding to the background area. In the figure, TP represents a representative color corresponding to the foreground area, TQ represents a representative color corresponding to the background area, and T1, T2,... Represent other representative colors. Further, the color difference calculation unit 6 obtains a color difference between the representative color TP corresponding to the foreground area and the representative color TQ corresponding to the background area, and the color difference between the representative color TP and the representative color TQ is larger than a predetermined value. Try to be small. In FIG. 7A, the range of values for which the color difference is predetermined from the representative color TQ is indicated by a broken line, and in FIG. 7B, the range of values for which the color difference is predetermined from the representative color TP is indicated by a broken line. The representative color TP and the representative color TQ are included in this range.

修正代表色選択部7では、前景領域に対応する代表色TPと背景領域に対応する代表色TQを通る直線を考え、この直線とそれぞれの代表色との距離に従って、色差を大きくする代表色を修正代表色として選択する。まず、背景領域に対応する代表色TQから前景領域に対応する代表色TPへ向かう方向に、背景領域に対応する代表色TQからの色差が予め決められた値よりも大きい代表色の中から直線との距離に応じて修正代表色を選択する。この場合を図7(A)に示している。この場合に選択される修正代表色は、前景領域に対応する代表色を変更するものである。   The corrected representative color selection unit 7 considers a straight line that passes through the representative color TP corresponding to the foreground area and the representative color TQ corresponding to the background area, and selects a representative color that increases the color difference according to the distance between the straight line and each representative color. Select as the modified representative color. First, in a direction from the representative color TQ corresponding to the background area to the representative color TP corresponding to the foreground area, a straight line is selected from the representative colors in which the color difference from the representative color TQ corresponding to the background area is larger than a predetermined value. The corrected representative color is selected according to the distance between This case is shown in FIG. The corrected representative color selected in this case changes the representative color corresponding to the foreground area.

例えば、直線からの距離が最も小さい代表色を修正代表色として選択すればよい。あるいは、背景領域に対応する代表色TQとの距離についても考慮し、ある代表色について直線との距離をLt、背景領域に対応する代表色TQとの距離をLuとして
D=αLt+βLu
を算出し、Dが最小となる代表色を修正代表色として選択してもよい。α、βは予め与える定数である。この場合、直線からの距離が小さいほど選択されやすく、背景領域に対応する代表色TQからの色差が予め決められた値よりも大きい条件の下で背景領域に対応する代表色TQに近いほど選択されやすくなる。
For example, the representative color having the shortest distance from the straight line may be selected as the corrected representative color. Alternatively, the distance from the representative color TQ corresponding to the background area is also considered, and the distance from the straight line for a certain representative color is Lt, and the distance from the representative color TQ corresponding to the background area is Lu. D = αLt + βLu
And the representative color that minimizes D may be selected as the corrected representative color. α and β are constants given in advance. In this case, the smaller the distance from the straight line, the easier the selection, and the closer to the representative color TQ corresponding to the background area under the condition that the color difference from the representative color TQ corresponding to the background area is larger than a predetermined value, the selection is made. It becomes easy to be done.

なお、背景領域に対応する代表色TQから前景領域に対応する代表色TPへの色の変化とかけ離れた代表色が選択されないように、代表色の選択の際に条件を付しておくとよい。例えば、直線からの距離に従って代表色を選択する場合、直線からの距離が予め決められた値よりも大きい場合には、代表色TQから代表色TPへの方向における修正代表色の選択は行わないようにするとよい。さらに、背景領域に対応する代表色TQからの色差の上限を設け、色差が上限を超える場合には修正代表色の選択は行わないようにするとよい。この場合、代表色TQからの色差が予め決められた値の範囲を越え、色差の上限以内であって、直線からの距離が予め決められた値以内である代表色の中から選択されることになる。   It should be noted that a condition should be set when selecting a representative color so that a representative color far from a change in color from the representative color TQ corresponding to the background area to the representative color TP corresponding to the foreground area is not selected. . For example, when the representative color is selected according to the distance from the straight line, if the distance from the straight line is larger than a predetermined value, the corrected representative color in the direction from the representative color TQ to the representative color TP is not selected. It is good to do so. Furthermore, an upper limit of the color difference from the representative color TQ corresponding to the background area is provided, and when the color difference exceeds the upper limit, the corrected representative color is not selected. In this case, the color difference from the representative color TQ exceeds the predetermined value range, is within the upper limit of the color difference, and is selected from the representative colors whose distance from the straight line is within the predetermined value. become.

あるいは、図8(A)に示す、代表色TQを底面の中心とする円錐領域内であって、代表色TQから色差が予め決められた値Luminの範囲を越えている代表色の中から選択してもよい。図8(A)に示す例では、代表色TQを始点として代表色TPへ向かう方向に値Luminより長く予め決められた長さを持つベクトルをベクトルTとし、代表色TQを始点としてベクトルTと交差する方向に値Luminより短く予め決められた長さを持つベクトルの集合をベクトル群Uとし、係数γ、δを0以上1以下の値として、
γ・ベクトルT+δ・(1−γ)・ベクトルU
の範囲が円錐領域となる。この円錐領域であって、代表色TQからの色差が予め決められた値Luminの範囲を越えている代表色の中から選択すればよい。この条件を満たす代表色が存在しない場合には、代表色TQから代表色TPへの方向における修正代表色の選択は行わない。
Alternatively, as shown in FIG. 8A, a representative color is selected from representative colors in a conical region having the representative color TQ as the center of the bottom surface, and the color difference from the representative color TQ exceeds a predetermined value Lumin. May be. In the example shown in FIG. 8A, a vector having a predetermined length longer than the value Lumin in the direction toward the representative color TP starting from the representative color TQ is set as the vector T, and the vector T starting from the representative color TQ as the starting point. A set of vectors having a predetermined length shorter than the value Lumin in the intersecting direction is defined as a vector group U, and coefficients γ and δ are set to values of 0 or more and 1 or less.
γ · vector T + δ · (1−γ) · vector U
Is a conical region. This conical region may be selected from representative colors whose color difference from the representative color TQ exceeds the range of a predetermined value Lumin. If there is no representative color satisfying this condition, the corrected representative color is not selected in the direction from the representative color TQ to the representative color TP.

上述の値Dを算出する場合には、値Dが予め決められた値よりも大きい場合には、代表色TQから代表色TPへの方向における修正代表色の選択は行わないようにすればよい。この場合、値Dが予め決められた値以内の範囲が図8(A)に示す円錐領域に対応することになる。   When calculating the above-described value D, if the value D is larger than a predetermined value, the corrected representative color may not be selected in the direction from the representative color TQ to the representative color TP. . In this case, the range within which the value D is within a predetermined value corresponds to the conical region shown in FIG.

背景領域に対応する代表色TQから前景領域に対応する代表色TPへ向かう方向に修正代表色が選択されない場合には、前景領域に対応する代表色TPから背景領域に対応する代表色TQへ向かう方向に、前景領域に対応する代表色TPからの色差が予め決められた値よりも大きい代表色の中から直線との距離に応じて修正代表色を選択する。この場合を図7(B)に示している。この場合に選択される修正代表色は、背景領域に対応する代表色を変更するものである。   If the corrected representative color is not selected in the direction from the representative color TQ corresponding to the background area to the representative color TP corresponding to the foreground area, the direction is changed from the representative color TP corresponding to the foreground area to the representative color TQ corresponding to the background area. In the direction, the corrected representative color is selected from the representative colors having a color difference from the representative color TP corresponding to the foreground area larger than a predetermined value according to the distance from the straight line. This case is shown in FIG. The corrected representative color selected in this case changes the representative color corresponding to the background area.

例えば、直線からの距離が最も小さい代表色を修正代表色として選択すればよい。あるいは、前景領域に対応する代表色TPとの距離についても考慮し、ある代表色について直線との距離をLt、前景領域に対応する代表色TPとの距離をLvとして
D=αLt+βLv
を算出し、Dが最小となる代表色を修正代表色として選択してもよい。α、βは予め与える定数である。この場合、直線からの距離が小さいほど選択されやすく、前景領域に対応する代表色TPからの色差が予め決められた値よりも大きい条件の下で前景領域に対応する代表色TPに近いほど選択されやすくなる。
For example, the representative color having the shortest distance from the straight line may be selected as the corrected representative color. Alternatively, the distance from the representative color TP corresponding to the foreground area is also considered, and the distance from a straight line for a certain representative color is Lt, and the distance from the representative color TP corresponding to the foreground area is Lv. D = αLt + βLv
And the representative color that minimizes D may be selected as the corrected representative color. α and β are constants given in advance. In this case, the smaller the distance from the straight line, the easier the selection, and the closer to the representative color TP corresponding to the foreground area under the condition that the color difference from the representative color TP corresponding to the foreground area is larger than a predetermined value, the selection is made. It becomes easy to be done.

なお、この場合も前景領域に対応する代表色TPから背景領域に対応する代表色TQへの色の変化とかけ離れた代表色が選択されないように、代表色の選択の際に条件を付しておくとよい。例えば、直線からの距離に従って代表色を選択する場合、直線からの距離が予め決められた値よりも大きい場合には、代表色TPから代表色TQへの方向における修正代表色の選択は行わないようにするとよい。さらに、背景領域に対応する代表色TPからの色差の上限を設け、色差が上限を超える場合には修正代表色の選択は行わないようにするとよい。この場合、代表色TPからの色差が予め決められた値の範囲を越え、色差の上限以内であって、直線からの距離が予め決められた値以内である代表色の中から選択されることになる。   In this case as well, a condition is added when selecting a representative color so that a representative color far from the change in color from the representative color TP corresponding to the foreground area to the representative color TQ corresponding to the background area is not selected. It is good to leave. For example, when the representative color is selected according to the distance from the straight line, if the distance from the straight line is larger than a predetermined value, the corrected representative color in the direction from the representative color TP to the representative color TQ is not selected. It is good to do so. Furthermore, an upper limit of the color difference from the representative color TP corresponding to the background region is provided, and when the color difference exceeds the upper limit, the corrected representative color is not selected. In this case, the color difference from the representative color TP exceeds the predetermined value range, and is selected from the representative colors that are within the upper limit of the color difference and the distance from the straight line is within the predetermined value. become.

あるいは、図8(B)に示す、代表色TPを底面の中心とする円錐領域内であって、代表色TPから色差が予め決められた値Luminの範囲を越えている代表色の中から選択してもよい。図8(B)に示す例では、代表色TPを始点として代表色TQへ向かう方向に値Luminより長く予め決められた長さを持つベクトルをベクトルTとし、代表色TQを始点としてベクトルTと交差する方向に値Luminより短く予め決められた長さを持つベクトルの集合をベクトル群Uとし、係数γ、δを0以上1以下の値として、
−γ・ベクトルT+δ・(1−γ)・ベクトルU
の範囲が円錐領域となる。この円錐領域であって、代表色TPから色差が予め決められた値Luminの範囲を越えている代表色の中から選択すればよい。この条件を満たす代表色が存在しない場合には、代表色TPから代表色TQへの方向における修正代表色の選択は行わない。
Alternatively, it is selected from representative colors in a conical region having the representative color TP as the center of the bottom surface as shown in FIG. 8B, and the color difference from the representative color TP exceeds a predetermined value Lumin. May be. In the example shown in FIG. 8B, a vector having a predetermined length longer than the value Lumin in the direction toward the representative color TQ with the representative color TP as the starting point is a vector T, and a vector T with the representative color TQ as the starting point. A set of vectors having a predetermined length shorter than the value Lumin in the intersecting direction is defined as a vector group U, and coefficients γ and δ are set to values of 0 or more and 1 or less.
−γ · vector T + δ · (1−γ) · vector U
Is a conical region. The conical region may be selected from representative colors whose color difference from the representative color TP exceeds a predetermined value Lumin. If there is no representative color that satisfies this condition, the modified representative color is not selected in the direction from the representative color TP to the representative color TQ.

上述の値Dを算出する場合には、値Dが予め決められた値よりも大きい場合には、代表色TPから代表色TQへの方向における修正代表色の選択は行わないようにすればよい。この場合、値Dが予め決められた値以内の範囲が図8(B)に示す円錐領域に対応することになる。   When calculating the above-described value D, if the value D is larger than a predetermined value, the corrected representative color in the direction from the representative color TP to the representative color TQ may not be selected. . In this case, a range where the value D is within a predetermined value corresponds to the conical region shown in FIG.

図9は、代表色の追加処理の別の例の説明図である。背景領域に対応する代表色TQから前景領域に対応する代表色TPへの方向に修正代表色の選択を行ったが選択されず、前景領域に対応する代表色TPから背景領域に対応する代表色TQへの方向に修正代表色の選択を行っても選択されなかった場合には、色置換部8における色の置換を行わないように構成してもよいが、修正代表色選択部7で新たな代表色を追加し、その代表色を修正代表色として選択してもよい。例えば、この修正代表色の選択処理の第3の例では、色空間において前景領域に対応する代表色TPと背景領域に対応する代表色TQを通る直線上に、背景領域に対応する代表色TQまたは背景領域の平均色との色差が予め決められた値より大きい代表色、あるいは、前景領域に対応する代表色TPまたは前景領域の平均色との色差が予め決められた値より大きい代表色を追加し、追加した代表色を修正代表色として選択してもよい。   FIG. 9 is an explanatory diagram of another example of representative color addition processing. The corrected representative color is selected in the direction from the representative color TQ corresponding to the background area to the representative color TP corresponding to the foreground area, but is not selected and the representative color corresponding to the background area is changed from the representative color TP corresponding to the foreground area. If the corrected representative color is selected in the direction toward TQ but is not selected, the color replacement unit 8 may be configured not to replace the color. A representative color may be added, and the representative color may be selected as the corrected representative color. For example, in the third example of the modified representative color selection process, the representative color TQ corresponding to the background region is on a straight line passing through the representative color TP corresponding to the foreground region and the representative color TQ corresponding to the background region in the color space. Alternatively, a representative color whose color difference from the average color of the background area is larger than a predetermined value, or a representative color whose color difference from the representative color TP corresponding to the foreground area or the average color of the foreground area is larger than a predetermined value. The added representative color may be selected as the corrected representative color.

なお、背景領域に対応する代表色TQまたは背景領域の平均色との色差が予め決められた値より大きい代表色を追加する場合には、前景領域に対応する代表色TPまたは前景領域の平均色との色差が小さい側に追加する。また、前景領域に対応する代表色TPとの色差が予め決められた値より大きい代表色を追加する場合には、背景領域に対応する代表色TQまたは背景領域の平均色との色差が小さい側に追加する。図9に示した例では、前景領域に対応する代表色TPと背景領域に対応する代表色TQを通る直線上に、背景領域に対応する代表色TQとの色差が予め決められた値より大きい代表色Taを追加した例を示している。この追加した代表色Taを修正代表色として選択すればよい。   When a representative color having a color difference from the representative color TQ corresponding to the background area or the average color of the background area is larger than a predetermined value, the representative color TP corresponding to the foreground area or the average color of the foreground area is added. Add to the side where the color difference is small. Further, when adding a representative color whose color difference from the representative color TP corresponding to the foreground area is larger than a predetermined value, the color difference from the representative color TQ corresponding to the background area or the average color of the background area is small. Add to. In the example shown in FIG. 9, the color difference between the representative color TQ corresponding to the background region is larger than a predetermined value on a straight line passing through the representative color TP corresponding to the foreground region and the representative color TQ corresponding to the background region. An example in which a representative color Ta is added is shown. The added representative color Ta may be selected as the corrected representative color.

もちろん、上述の背景領域または前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加するほか、背景領域に対応する代表色と前景領域に対応する代表色を挟み、色差が予め決められた値より大きくなる2つの代表色を上述の直線上に追加してもよい。   Of course, in addition to adding a representative color whose color difference from the representative color corresponding to the background region or foreground region is larger than a predetermined value, the representative color corresponding to the background region and the representative color corresponding to the foreground region are sandwiched, Two representative colors whose color difference is larger than a predetermined value may be added on the above-mentioned straight line.

図10は、修正代表色の選択処理の第4の例の説明図である。この例では、代表色抽出部1で抽出されている代表色全体から、評価関数を用いて前景領域に対応する代表色と背景領域に対応する代表色を修正する修正代表色を選択する例を示している。図中、Pは前景領域の平均色を、Qは背景領域の平均色を、T1,T2,…は代表色を、それぞれ示している。また、色差算出部6は前景領域の平均色Pと背景領域の平均色Qとの色差を求めることとし、平均色Pと平均色Qの色差は、予め決められた値よりも小さいものとしている。図10では平均色Qから色差が予め決められた値の範囲を破線で示しており、平均色Pと平均色Qはこの範囲に含まれている。   FIG. 10 is an explanatory diagram of a fourth example of the modified representative color selection process. In this example, an example of selecting a representative color corresponding to the foreground area and a corrected representative color for correcting the representative color corresponding to the background area from the entire representative colors extracted by the representative color extraction unit 1 is used. Show. In the figure, P indicates the average color of the foreground area, Q indicates the average color of the background area, and T1, T2,... Further, the color difference calculation unit 6 obtains the color difference between the average color P in the foreground area and the average color Q in the background area, and the color difference between the average color P and the average color Q is smaller than a predetermined value. . In FIG. 10, a range of values in which the color difference is predetermined from the average color Q is indicated by a broken line, and the average color P and the average color Q are included in this range.

抽出されている代表色から2つの代表色を選択して代表色の組とし、その代表色の組について、前景領域の平均色及び背景領域の平均色を用いた評価関数の値を求める。評価関数Hの一例としては、例えば、代表色の組を構成する2つの代表色をCi、Cjとし、前景領域の平均色P及び背景領域の平均色Qを用い、
H=α(|P−Ci|+|Q−Cj|)−β(|Ci−Cj|)
とするとよい。α、βは予め与える定数である。(|P−Ci|+|Q−Cj|)の項は、当該代表色の組を修正代表色として置換した場合の誤差を示す。この誤差が小さいほどよい。また、(|Ci−Cj|)は代表色の色差である。この色差は大きいほどよい。なお、この代表色の色差(|Ci−Cj|)は、色差算出部6で算出した色差を判定する際に用いた予め決められた値よりも大きいことが条件となる。評価関数Hの値は、誤差が小さく、色差が大きいほど値は小さくなるので、代表色の組のうち評価関数Hの値が最も小さい代表色の組を修正代表色とすればよい。
Two representative colors are selected from the extracted representative colors to obtain a set of representative colors, and the value of the evaluation function using the average color of the foreground area and the average color of the background area is obtained for the set of representative colors. As an example of the evaluation function H, for example, two representative colors constituting a set of representative colors are Ci and Cj, and an average color P in the foreground area and an average color Q in the background area are used.
H = α (| P−Ci | + | Q−Cj |) −β (| Ci−Cj |)
It is good to do. α and β are constants given in advance. The term (| P-Ci | + | Q-Cj |) indicates an error when the representative color set is replaced with a corrected representative color. The smaller this error, the better. Further, (| Ci−Cj |) is a color difference between representative colors. The larger the color difference, the better. The condition is that the color difference (| Ci−Cj |) of the representative color is larger than a predetermined value used when determining the color difference calculated by the color difference calculation unit 6. The value of the evaluation function H is smaller as the error is smaller and the color difference is larger. Therefore, the representative color set having the smallest evaluation function H value among the representative color sets may be used as the corrected representative color.

図10に示した例では、6個の代表色T1,T2,T3,T4,T5,T6を示している。例えば限定色画像生成部2で限定色画像を生成する際に、前景領域及び背景領域の色と最も色差が小さい代表色を選択すると、前景領域に対応する代表色としては代表色T1が、背景領域に対応する代表色としては代表色T2が選択されることになる。しかし、代表色T1と代表色T2の組では、色差が予め決められた値よりも小さいため、この代表値の組は選択されない。   In the example shown in FIG. 10, six representative colors T1, T2, T3, T4, T5, and T6 are shown. For example, when a limited color image is generated by the limited color image generation unit 2, if a representative color having the smallest color difference from the colors of the foreground area and the background area is selected, the representative color T1 is selected as the representative color corresponding to the foreground area. The representative color T2 is selected as the representative color corresponding to the area. However, since the color difference is smaller than a predetermined value in the set of the representative color T1 and the representative color T2, this set of representative values is not selected.

代表色の組は、この代表色T1と代表色T2の組を含め、6個の代表色の順列で30組となる。このうち、上述の通り、代表色T1をCi、代表色T2をCjとする組、及び、代表色T2をCi、代表色T1をCjとする組は、色差が予め決められた値よりも小さいため除外される。例えば代表色T3をCi、代表色T2をCjとした場合に、評価関数の値が最も小さくなる。従って、前景領域に対応する修正代表色を代表色T3、背景領域に対応する修正代表色を代表色T2とすればよい。なお、代表色T2をCi、代表色T3をCjとした場合には、|P−Ci|、|Q−Cj|の値が前述の組よりも大きくなり、評価関数の値も大きくなる。   The set of representative colors includes 30 sets of permutations of six representative colors including the set of representative colors T1 and T2. Among them, as described above, the color difference is smaller than a predetermined value in the set in which the representative color T1 is Ci, the representative color T2 is Cj, and the set in which the representative color T2 is Ci and the representative color T1 is Cj. Therefore, it is excluded. For example, when the representative color T3 is Ci and the representative color T2 is Cj, the value of the evaluation function is the smallest. Therefore, the corrected representative color corresponding to the foreground area may be the representative color T3, and the corrected representative color corresponding to the background area may be the representative color T2. When the representative color T2 is Ci and the representative color T3 is Cj, the values of | P−Ci | and | Q−Cj | are larger than the above-described group, and the value of the evaluation function is also large.

もちろん、上述の評価関数は一例であって、この例に限らず、2つの代表色の組について評価する種々の関数を用いてもよい。また、前景領域の平均色P及び背景領域の平均色Qに代えて、前景領域に対応する代表色及び背景領域に対応する代表色を用いてもよい。   Of course, the above-described evaluation function is an example, and the present invention is not limited to this example, and various functions for evaluating two sets of representative colors may be used. Further, instead of the average color P in the foreground area and the average color Q in the background area, a representative color corresponding to the foreground area and a representative color corresponding to the background area may be used.

なお、評価関数を用いて得られた値に対して条件を付与してもよい。例えば上述の評価関数Hの値に上限を設け、各代表色の組から得られた評価関数Hの最小値が予め決められた上限よりも大きい場合には、条件を満たす代表色が存在しないものとして、修正代表色を選択しないように構成するとよい。修正代表色が選択されなかった場合には、色置換部8における色の置換を行わないように構成すればよい。あるいは、例えば上述の図5または図9で説明した方法によって修正代表色選択部7で新たな代表色を追加し、その代表色を修正代表色として選択してもよい。   In addition, you may provide conditions with respect to the value obtained using the evaluation function. For example, when there is an upper limit for the value of the evaluation function H described above and there is no representative color that satisfies the condition when the minimum value of the evaluation function H obtained from each set of representative colors is greater than a predetermined upper limit As such, it may be configured not to select the corrected representative color. If the corrected representative color is not selected, the color replacement unit 8 may be configured not to perform color replacement. Alternatively, for example, a new representative color may be added by the corrected representative color selection unit 7 by the method described with reference to FIG. 5 or FIG. 9 and the representative color may be selected as the corrected representative color.

上述の各例、あるいはそのほかの種々の方法によって修正代表色の選択処理が行われたら、色置換部8は、注目画素が前景領域の画素であって前景領域に対応する代表色を変更する修正代表色が選択されている場合、あるいは、注目画素が背景領域の画素であって背景領域に対応する代表色を変更する修正代表色が選択されている場合に、注目画素の色を修正代表色へ置換する。修正代表色として前景領域及び背景領域の両方に対応する代表色が選択されている場合には、注目画素が前景領域の画素であるのか、背景領域の画素であるのかに応じて、修正代表色を選択して注目画素の色を置換すればよい。なお、修正代表色が選択されていない場合には、色の置換を行わなくてもよい。   When the modified representative color selection process is performed by the above-described examples or other various methods, the color replacement unit 8 modifies the representative color corresponding to the foreground area when the target pixel is a pixel in the foreground area. If the representative color is selected, or if the target pixel is a pixel in the background area and a modified representative color that changes the representative color corresponding to the background area is selected, the color of the target pixel is corrected. Replace with. If the representative colors corresponding to both the foreground area and the background area are selected as the corrected representative colors, the corrected representative color depends on whether the target pixel is a pixel in the foreground area or a background area. And the color of the pixel of interest may be replaced. Note that when the corrected representative color is not selected, the color replacement may not be performed.

図11は、本発明の実施の一形態における変形例を示す構成図である。この変形例では、処理対象画像として予め決められた色数以下の色しか使用されていない画像や、限定色化の処理が施された画像が与えられた場合を想定している。このような場合には、改めて限定色化の処理を行わなくてもよく、この変形例では限定色画像生成部2を設けていない。また、この場合には前景領域の平均色と前景領域に対応する代表色、背景領域の平均色と背景領域に対応する代表色は等価と考えてもよい。従って、色差算出部6は前景領域に対応する代表色と背景領域に対応する代表色の色差を算出すればよく、修正代表色選択部7は前景領域に対応する代表色と背景領域に対応する代表色を通る直線からの距離に従って修正代表色を選択すればよい。例えば修正代表色の選択処理の第2の例を除く各例や、そのほかの選択方法により修正代表色を選択すればよい。また、色置換部8は与えられた処理対象画像における注目画素の色を修正代表色に置換すればよい。   FIG. 11 is a block diagram showing a modification of the embodiment of the present invention. In this modified example, it is assumed that an image in which only a predetermined number of colors or less is used as a processing target image or an image that has undergone limited color processing is given. In such a case, the limited color process need not be performed again, and the limited color image generation unit 2 is not provided in this modification. In this case, the average color of the foreground area and the representative color corresponding to the foreground area, and the average color of the background area and the representative color corresponding to the background area may be considered equivalent. Therefore, the color difference calculation unit 6 may calculate the color difference between the representative color corresponding to the foreground region and the representative color corresponding to the background region, and the modified representative color selection unit 7 corresponds to the representative color and background region corresponding to the foreground region. The corrected representative color may be selected according to the distance from the straight line passing through the representative color. For example, the corrected representative color may be selected by each example other than the second example of the selection process of the corrected representative color and other selection methods. The color replacement unit 8 may replace the color of the pixel of interest in the given processing target image with the corrected representative color.

図12は、本発明の実施の一形態の変形例における動作の一例を示す流れ図である。S11において、代表色抽出部1は、与えられた処理対象画像全体から代表色を抽出する。S13、S14、S15、S16は図2を用いて上述したとおりである。   FIG. 12 is a flowchart showing an example of the operation in the modification of the embodiment of the present invention. In S11, the representative color extraction unit 1 extracts a representative color from the entire processing target image. S13, S14, S15, and S16 are as described above with reference to FIG.

S17において、色差算出部6は、前景領域の代表色と背景領域の代表色の色差を算出する。S18は図2を用いて上述したとおりである。S18で色差が予め決められた値よりも小さいと判定された場合には、S19において、前景領域に対応する代表色と背景領域に対応する代表色を用い、色差が大きくなるように前景領域に対応する代表色あるいは背景領域に対応する代表色を選択し直して修正代表色とする。なお、予め決められた条件を満たす修正代表色が存在しない場合には代表色を追加し、修正代表色として選択してもよい。   In S17, the color difference calculation unit 6 calculates the color difference between the representative color of the foreground area and the representative color of the background area. S18 is as described above with reference to FIG. If it is determined in S18 that the color difference is smaller than a predetermined value, in S19, the representative color corresponding to the foreground area and the representative color corresponding to the background area are used, and the foreground area is set so that the color difference becomes large. A corresponding representative color or a representative color corresponding to the background area is selected again to be a corrected representative color. If there is no modified representative color that satisfies a predetermined condition, a representative color may be added and selected as the modified representative color.

S20、S21は図2を用いて上述したとおりである。S22において、色置換部8は、処理対象画像の注目画素の色を、S19で修正代表色選択部7により選択された修正代表色に置換する。例えば、注目画素が前景領域の画素であって前景領域に対応する代表色を変更する修正代表色が選択されている場合、あるいは、注目画素が背景領域の画素であって背景領域に対応する代表色を変更する修正代表色が選択されている場合に、注目画素の色を修正代表色へ置換すればよい。S23は図2を用いて上述したとおりである。   S20 and S21 are as described above with reference to FIG. In S22, the color replacement unit 8 replaces the color of the target pixel of the processing target image with the corrected representative color selected by the corrected representative color selection unit 7 in S19. For example, when the target pixel is a pixel in the foreground area and a modified representative color for changing the representative color corresponding to the foreground area is selected, or the representative pixel is a pixel in the background area and corresponding to the background area When the corrected representative color whose color is to be changed is selected, the color of the pixel of interest may be replaced with the corrected representative color. S23 is as described above with reference to FIG.

図13は、本発明の実施の一形態およびその変形例で説明した機能をコンピュータプログラムで実現した場合におけるコンピュータプログラム及びそのコンピュータプログラムを格納した記憶媒体とコンピュータの一例の説明図である。図中、41はプログラム、42はコンピュータ、51は光磁気ディスク、52は光ディスク、53は磁気ディスク、54はメモリ、61はCPU、62は内部メモリ、63は読取部、64はハードディスク、65はインタフェース、66は通信部である。   FIG. 13 is an explanatory diagram of an example of a computer program, a storage medium storing the computer program, and a computer when the functions described in the embodiment of the present invention and the modifications thereof are realized by a computer program. In the figure, 41 is a program, 42 is a computer, 51 is a magneto-optical disk, 52 is an optical disk, 53 is a magnetic disk, 54 is a memory, 61 is a CPU, 62 is an internal memory, 63 is a reading unit, 64 is a hard disk, and 65 is An interface 66 is a communication unit.

上述の本発明の実施の一形態及びその変形例で説明した各部の機能を全部あるいは部分的に、コンピュータが実行するプログラム41によって実現してもよい。その場合、そのプログラム41およびそのプログラムが用いるデータなどは、コンピュータが読み取る記憶媒体に記憶させておけばよい。記憶媒体とは、コンピュータのハードウェア資源に備えられている読取部63に対して、プログラムの記述内容に応じて、磁気、光、電気等のエネルギーの変化状態を引き起こして、それに対応する信号の形式で、読取部63にプログラムの記述内容を伝達するものである。例えば、光磁気ディスク51、光ディスク52(CDやDVDなどを含む)、磁気ディスク53、メモリ54(ICカード、メモリカード、フラッシュメモリなどを含む)等である。もちろんこれらの記憶媒体は、可搬型に限られるものではない。   You may implement | achieve the function of each part demonstrated by one Embodiment and its modification of the above-mentioned this invention entirely or partially with the program 41 which a computer performs. In that case, the program 41 and the data used by the program may be stored in a storage medium read by the computer. The storage medium causes a change state of energy such as magnetism, light, electricity, etc. to the reading unit 63 provided in the hardware resource of the computer according to the description content of the program, and the signal corresponding thereto In this format, the description content of the program is transmitted to the reading unit 63. For example, there are a magneto-optical disk 51, an optical disk 52 (including a CD and a DVD), a magnetic disk 53, a memory 54 (including an IC card, a memory card, a flash memory, and the like). Of course, these storage media are not limited to portable types.

これらの記憶媒体にプログラム41を格納しておき、例えばコンピュータ42の読取部63あるいはインタフェース65にこれらの記憶媒体を装着することによって、コンピュータからプログラム41を読み出し、内部メモリ62またはハードディスク64(磁気ディスクやシリコンディスクなどを含む)に記憶し、CPU61によってプログラム41を実行することによって、上述の本発明の実施の一形態及びその変形例として説明した機能が全部あるいは部分的に実現される。あるいは、通信路を介してプログラム41をコンピュータ42に転送し、コンピュータ42では通信部66でプログラム41を受信して内部メモリ62またはハードディスク64に記憶し、CPU61によってプログラム41を実行することによって実現してもよい。   The program 41 is stored in these storage media, and the program 41 is read from the computer by, for example, mounting these storage media on the reading unit 63 or the interface 65 of the computer 42, and the internal memory 62 or the hard disk 64 (magnetic disk) And the functions described as the embodiment of the present invention and the modifications thereof are realized in whole or in part. Alternatively, the program 41 is transferred to the computer 42 via the communication path, and the computer 42 receives the program 41 by the communication unit 66 and stores it in the internal memory 62 or the hard disk 64, and the program 41 is executed by the CPU 61. May be.

コンピュータ42には、このほかインタフェース65を介して様々な装置と接続してもよい。例えば、画像読取装置がインタフェース65を介して接続され、画像読取装置で読み取った画像あるいは該画像に処理を施した画像を処理対象画像として本発明の実施の一形態及びその変形例で説明した処理を行ってもよい。処理後の限定色画像は、他のプログラムに渡してもよいし、ハードディスク64に記憶させ、またはインタフェース65を介して記憶媒体に記憶させ、あるいは通信部66を通じて外部へ転送してもよい。記憶または転送の際には、限定色画像を圧縮するとよい。記憶または転送する際に、限定色画像としない場合に比べてデータ量が削減される。さらに、画像形成装置がインタフェース65を介して接続されていてもよく、処理後の限定色画像を画像形成装置により形成してもよい。   In addition, the computer 42 may be connected to various devices via an interface 65. For example, the processing described in the embodiment of the present invention and the modification thereof is performed with an image reading device connected via the interface 65 and an image read by the image reading device or an image obtained by processing the image as a processing target image. May be performed. The limited color image after processing may be passed to another program, stored in the hard disk 64, stored in a storage medium via the interface 65, or transferred to the outside through the communication unit 66. When storing or transferring, the limited color image may be compressed. When storing or transferring, the data amount is reduced as compared with the case where the limited color image is not used. Further, an image forming apparatus may be connected via the interface 65, and a limited color image after processing may be formed by the image forming apparatus.

もちろん、部分的にハードウェアによって構成することもできるし、全部をハードウェアで構成してもよい。あるいは、他の構成とともに本発明の実施の一形態及びその変形例で説明した機能の全部あるいは部分的に含めたプログラムとして構成してもよい。もちろん、他の用途に適用する場合には、その用途におけるプログラムと一体化してもよい。   Of course, it may be partially configured by hardware, or all may be configured by hardware. Or you may comprise as a program which included all or one part of the function demonstrated with one Embodiment and its modification of this invention with other structures. Of course, when applied to other purposes, it may be integrated with the program for that purpose.

1…代表色抽出部、2…限定色画像生成部、3…前景背景分離部、4…輪郭判定部、5…色数判定部、6…色差算出部、7…修正代表色選択部、8…色置換部、41…プログラム、42…コンピュータ、51…光磁気ディスク、52…光ディスク、53…磁気ディスク、54…メモリ、61…CPU、62…内部メモリ、63…読取部、64…ハードディスク、65…インタフェース、66…通信部。   DESCRIPTION OF SYMBOLS 1 ... Representative color extraction part, 2 ... Limited color image generation part, 3 ... Foreground / background separation part, 4 ... Contour determination part, 5 ... Color number determination part, 6 ... Color difference calculation part, 7 ... Modified representative color selection part, 8 ... Color replacement unit, 41 ... Program, 42 ... Computer, 51 ... Magneto-optical disk, 52 ... Optical disk, 53 ... Magnetic disk, 54 ... Memory, 61 ... CPU, 62 ... Internal memory, 63 ... Reading unit, 64 ... Hard disk, 65: Interface, 66: Communication unit.

Claims (11)

処理対象画像から代表色を抽出する抽出手段と、前記処理対象画像のうち注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する分離手段と、前記前景領域の色と前記背景領域の色の色差を算出する算出手段と、前記算出手段で算出した色差が予め決められた値より小さい場合に、色空間において前記前景領域に対応する代表色と前記背景領域に対応する代表色を通る直線からの距離に従って前記抽出手段で抽出した代表色の中から色差を大きくする前記前景領域に対応する修正代表色あるいは前記背景領域に対応する修正代表色を選択する選択手段と、前記選択手段で選択した修正代表色に前記注目画素の色を置換する置換手段を有することを特徴とする画像処理装置。   Extraction means for extracting a representative color from the processing target image; separation means for separating a processing area of a predetermined size including the target pixel in the processing target image into a foreground area and a background area; and a color of the foreground area And a calculating means for calculating a color difference between the colors of the background area, and a representative color corresponding to the foreground area in the color space and the background area when the color difference calculated by the calculating means is smaller than a predetermined value. Selecting means for selecting a corrected representative color corresponding to the foreground area or a corrected representative color corresponding to the background area, which increases a color difference from the representative colors extracted by the extracting means according to a distance from a straight line passing through the representative color; An image processing apparatus comprising replacement means for replacing the color of the target pixel with the corrected representative color selected by the selection means. 処理対象画像から代表色を抽出する抽出手段と、前記処理対象画像のうち注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する分離手段と、前記前景領域の色と前記背景領域の色の色差を算出する算出手段と、前記算出手段で算出した色差が予め決められた値より小さい場合に、色空間において前記前景領域の平均色と前記背景領域の平均色を通る直線からの距離に従って前記抽出手段で抽出した代表色の中から色差を大きくする前記前景領域に対応する修正代表色あるいは前記背景領域に対応する修正代表色を選択する選択手段と、前記選択手段で選択した修正代表色に前記注目画素の色を置換する置換手段を有することを特徴とする画像処理装置。   Extraction means for extracting a representative color from the processing target image; separation means for separating a processing area of a predetermined size including the target pixel in the processing target image into a foreground area and a background area; and a color of the foreground area And a calculating means for calculating a color difference between the colors of the background area, and an average color of the foreground area and an average color of the background area in a color space when the color difference calculated by the calculating means is smaller than a predetermined value. Selecting means for selecting a corrected representative color corresponding to the foreground area or a corrected representative color corresponding to the background area, which increases a color difference from the representative colors extracted by the extracting means according to a distance from a straight line passing therethrough; and the selecting means An image processing apparatus comprising: a replacement unit that replaces the color of the target pixel with the corrected representative color selected in step (1). 前記選択手段は、色空間において前記前景領域の平均色と前記背景領域の平均色を通る直線と、前記前景領域に対応する代表色と前記背景領域に対応する代表色を通る直線がなす角度が予め定めた角度よりも大きい場合には、前記算出手段で算出した色差にかかわらず前記修正代表色を選択することを特徴とする請求項2に記載の画像処理装置。   The selection means has an angle formed by a straight line passing through an average color of the foreground area and an average color of the background area in a color space, and a straight line passing through a representative color corresponding to the foreground area and a representative color corresponding to the background area. 3. The image processing apparatus according to claim 2, wherein when the angle is larger than a predetermined angle, the corrected representative color is selected regardless of the color difference calculated by the calculation unit. 処理対象画像から代表色を抽出する抽出手段と、前記処理対象画像のうち注目画素を含む予め決められた大きさの処理領域について前景領域と背景領域に分離する分離手段と、前記前景領域の色と前記背景領域の色の色差を算出する算出手段と、前記算出手段で算出した色差が予め決められた値より小さい場合に、前記抽出手段で抽出した代表色から得た2つの代表色の組のそれぞれについて該組の代表色の一方と前記前景領域の色との色差及び代表色の他方と前記背景領域の色との色差を誤差として求め、前記誤差とともに2つの代表色の色差を用いた評価関数の値を求め、該評価関数の値により代表色の組を求めて、前記抽出手段で抽出した代表色の中から色差を大きくする前記前景領域に対応する修正代表色及び前記背景領域に対応する修正代表色として選択する選択手段と、前記選択手段で選択した修正代表色に前記注目画素の色を置換する置換手段を有することを特徴とする画像処理装置。   Extraction means for extracting a representative color from the processing target image; separation means for separating a processing area of a predetermined size including the target pixel in the processing target image into a foreground area and a background area; and a color of the foreground area And a calculating means for calculating a color difference between the colors of the background region, and a set of two representative colors obtained from the representative color extracted by the extracting means when the color difference calculated by the calculating means is smaller than a predetermined value. The color difference between one of the representative colors of the set and the color of the foreground area and the color difference of the other representative color and the color of the background area are determined as errors, and the color difference between the two representative colors is used together with the error. A value of the evaluation function is obtained, a set of representative colors is obtained from the value of the evaluation function, and the corrected representative color and the background region corresponding to the foreground region that increases the color difference from the representative colors extracted by the extraction unit are obtained. Corresponding The image processing apparatus characterized by comprising selecting means for selecting as a modified representative color, a replacement means for replacing the color of the pixel of interest in the modified representative color selected by the selection means. 前記選択手段は、予め決められた条件を満たす前記修正代表色が存在しない場合に、色空間において前記前景領域の色と前記背景領域の色を通る直線上に前記背景領域に対応する代表色との色差が予め決められた値より大きい代表色あるいは前記前景領域に対応する代表色との色差が予め決められた値より大きい代表色を追加し、前記修正代表色として選択することを特徴とする請求項1から請求項4のいずれか1項に記載の画像処理装置。   The selection means includes a representative color corresponding to the background region on a straight line passing through the color of the foreground region and the color of the background region in a color space when the modified representative color satisfying a predetermined condition does not exist. A representative color having a color difference greater than a predetermined value or a representative color having a color difference with a representative color corresponding to the foreground area greater than a predetermined value is added and selected as the corrected representative color. The image processing apparatus according to any one of claims 1 to 4. 前記算出手段は、前記前景領域の色として前記前景領域に対応する代表色を用い、前記背景領域の色として前記背景領域に対応する代表色を用いて色差を算出することを特徴とする請求項1から請求項5のいずれか1項に記載の画像処理装置。   The calculation means calculates a color difference using a representative color corresponding to the foreground area as a color of the foreground area and using a representative color corresponding to the background area as a color of the background area. The image processing apparatus according to any one of claims 1 to 5. 前記算出手段は、前記前景領域の色として前記前景領域の各画素の平均色あるいは各画素に対応する代表色の平均色を用い、前記背景領域の色として前記背景領域の各画素の平均色あるいは各画素に対応する代表色の平均色を用いて色差を算出することを特徴とする請求項1から請求項5のいずれか1項に記載の画像処理装置。   The calculating means uses an average color of each pixel in the foreground area or an average color of a representative color corresponding to each pixel as a color of the foreground area, and an average color of each pixel in the background area as a color of the background area. The image processing apparatus according to claim 1, wherein a color difference is calculated using an average color of representative colors corresponding to each pixel. さらに、前記注目画素が輪郭領域であるか否かを判定する輪郭判定手段を有し、前記置換手段は、前記輪郭判定手段によって輪郭領域であると判定された注目画素について置換を行うことを特徴とする請求項1から請求項7のいずれか1項に記載の画像処理装置。   Further, the image processing apparatus further comprises contour determination means for determining whether or not the target pixel is a contour area, and the replacement means replaces the target pixel determined to be the contour area by the contour determination means. The image processing apparatus according to any one of claims 1 to 7. さらに、前記処理領域の色数を判定する色数判定手段を有し、前記置換手段は、前記色数判定手段によって色数が3以上であると判定された注目画素について置換を行わないことを特徴とする請求項1から請求項8のいずれか1項に記載の画像処理装置。   Furthermore, it has color number determination means for determining the number of colors in the processing area, and the replacement means does not perform replacement on a pixel of interest for which the number of colors is determined to be 3 or more by the color number determination means. The image processing apparatus according to claim 1, wherein the image processing apparatus is characterized. さらに、前記処理領域の色数を判定する色数判定手段を有し、前記分離手段は、前記色数判定手段により色数が3以上であると判定された場合には処理領域の大きさを現在の大きさよりも小さく変更して前記前景領域と前記背景領域の分離を行うことを特徴とする請求項1から請求項8のいずれか1項に記載の画像処理装置。   Furthermore, it has a color number determination means for determining the number of colors in the processing area, and the separation means determines the size of the processing area when the color number determination means determines that the number of colors is 3 or more. The image processing apparatus according to claim 1, wherein the foreground area and the background area are separated by changing the size to be smaller than a current size. コンピュータに、請求項1から請求項10のいずれか1項に記載の画像処理装置の機能を実行させるものであることを特徴とする画像処理プログラム。   An image processing program for causing a computer to execute the function of the image processing apparatus according to any one of claims 1 to 10.
JP2011267024A 2011-12-06 2011-12-06 Image processing apparatus and image processing program Expired - Fee Related JP5854210B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011267024A JP5854210B2 (en) 2011-12-06 2011-12-06 Image processing apparatus and image processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011267024A JP5854210B2 (en) 2011-12-06 2011-12-06 Image processing apparatus and image processing program

Publications (2)

Publication Number Publication Date
JP2013120994A JP2013120994A (en) 2013-06-17
JP5854210B2 true JP5854210B2 (en) 2016-02-09

Family

ID=48773462

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011267024A Expired - Fee Related JP5854210B2 (en) 2011-12-06 2011-12-06 Image processing apparatus and image processing program

Country Status (1)

Country Link
JP (1) JP5854210B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6779688B2 (en) * 2016-07-25 2020-11-04 キヤノン株式会社 Image processing equipment, image processing method, computer program
JP7206732B2 (en) * 2018-09-19 2023-01-18 富士フイルムビジネスイノベーション株式会社 Information processing device and program

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003324622A (en) * 2002-05-07 2003-11-14 Canon Inc Subtractive color apparatus, image processing method, program and recording medium
JP4868139B2 (en) * 2006-08-07 2012-02-01 富士ゼロックス株式会社 Image processing apparatus and image processing program
JP4835865B2 (en) * 2006-08-08 2011-12-14 富士ゼロックス株式会社 Image processing apparatus and image processing program
JP4973605B2 (en) * 2008-06-13 2012-07-11 コニカミノルタビジネステクノロジーズ株式会社 Image processing method, image processing apparatus, and image processing program

Also Published As

Publication number Publication date
JP2013120994A (en) 2013-06-17

Similar Documents

Publication Publication Date Title
US7949184B2 (en) Image processing apparatus, image processing method, and computer readable medium and computer data signal for processing image
US9569831B2 (en) Image processing apparatus, image processing method, and non-transitory computer-readable storage medium for extracting information embedded in a printed material
US9369610B2 (en) Image processing apparatus and image processing method
JP2008011267A (en) Image processor, image processing method, image processing program, and memory medium
JP6252225B2 (en) Image processing apparatus, image processing method, and image forming apparatus
JP2008301187A (en) Image processor and image processing program
JP5348411B2 (en) Image processing apparatus and image processing program
JP2008310817A (en) Method for detecting line structure from text map and image processor
JP2012105015A (en) Image processing apparatus, image processing method, program, and storage medium
JP5854210B2 (en) Image processing apparatus and image processing program
JP2006217058A (en) Image processing apparatus, image processing method, program, and recording medium
US8744179B2 (en) Image processing apparatus, image processing method, and non-transitory computer readable medium that utilizes representative colors
US20120020552A1 (en) Image processing apparatus, computer readable medium for processing image and method for processing image
JP4748333B2 (en) Image processing apparatus and image processing program
EP3026598B1 (en) Image processing apparatus, image processing method, and program
JP5846357B2 (en) Image processing apparatus and image processing program
JP4996554B2 (en) Image quality improvement device, method and program
JP5365817B2 (en) Image processing apparatus and image processing program
JP4771087B2 (en) Image processing apparatus and image processing program
US10924634B2 (en) Image processing apparatus and image processing method
JP2009164897A (en) Binarizing device and binarization processing program
EP2894841B1 (en) Information processing apparatus, information processing method, and storage medium
JP5867683B2 (en) Image processing apparatus and image processing program
JP5146653B2 (en) Image processing apparatus and image processing program
JP5263010B2 (en) Image processing apparatus and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20141121

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150806

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150909

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20151023

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20151124

R150 Certificate of patent or registration of utility model

Ref document number: 5854210

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees