JP2896319B2 - How to make a color image mask - Google Patents
How to make a color image maskInfo
- Publication number
- JP2896319B2 JP2896319B2 JP6275851A JP27585194A JP2896319B2 JP 2896319 B2 JP2896319 B2 JP 2896319B2 JP 6275851 A JP6275851 A JP 6275851A JP 27585194 A JP27585194 A JP 27585194A JP 2896319 B2 JP2896319 B2 JP 2896319B2
- Authority
- JP
- Japan
- Prior art keywords
- color
- vector
- mask
- target
- vectors
- 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
Links
- 239000013598 vector Substances 0.000 claims description 277
- 239000003086 colorant Substances 0.000 claims description 84
- 238000000034 method Methods 0.000 claims description 78
- 238000009826 distribution Methods 0.000 claims description 7
- 238000004519 manufacturing process Methods 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 31
- 239000011159 matrix material Substances 0.000 description 28
- 230000008569 process Effects 0.000 description 15
- 238000012545 processing Methods 0.000 description 12
- 230000008901 benefit Effects 0.000 description 6
- 241000220317 Rosa Species 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000007796 conventional method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000004744 fabric Substances 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 239000000203 mixture Substances 0.000 description 2
- 230000002194 synthesizing effect Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000005520 cutting process Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 238000003860 storage Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
Landscapes
- Image Processing (AREA)
- Color Image Communication Systems (AREA)
- Image Analysis (AREA)
Description
【0001】[0001]
【産業上の利用分野】この発明は、カラー画像内の所望
の色部分の切抜き処理等に使用されるマスクを作成する
方法に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for producing a mask used for cutting out a desired color portion in a color image.
【0002】[0002]
【従来の技術】印刷製版工程においては、写真原稿など
のカラー画像の特定の色の部分に対して色変更や鮮鋭度
強調等の種々の処理を選択的に行ないたい場合がある。
例えば、衣服を着たモデルの衣服の色のみを変更した
り、モデルの肌を除く部分に鮮鋭度強調を行ないたい場
合などがある。このように、カラー画像の特定の色部分
にのみ所望の処理を行なう(または行わない)際には、
その色部分を示す切抜きマスクが作成される。2. Description of the Related Art In a printing plate making process, it is sometimes desired to selectively perform various processes such as color change and sharpness enhancement on a specific color portion of a color image such as a photo original.
For example, there are cases where it is desired to change only the color of the clothes of the model wearing the clothes, or to emphasize the sharpness on the portion excluding the skin of the model. As described above, when the desired processing is performed (or not performed) only on a specific color portion of a color image,
A cutout mask indicating the color portion is created.
【0003】図1は、カラー画像と好ましいマスクの一
例を示す説明図である。図1(A)に示すカラー画像
は、黒色の髪のモデルが、黄色地にバラの花の模様がプ
リントされた衣服を着ている写真である。バラの花は、
白色およびピンク色の花びらと、その周囲にある緑色の
葉とを有している。図1(B)に示すマスクは、衣服の
黄色部分と緑色部分とを示すマスクである。FIG. 1 is an explanatory diagram showing an example of a color image and a preferable mask. The color image shown in FIG. 1A is a photograph in which a black hair model is wearing clothes in which a rose flower pattern is printed on a yellow background. Rose flower
It has white and pink petals and green leaves around it. The mask shown in FIG. 1B is a mask showing a yellow portion and a green portion of the clothes.
【0004】カラー画像の色を分析することによってマ
スクを作成する方法としては、例えば特開平1−298
477号公報に記載されたものがある。この方法は、マ
スク領域となるべき部分(トレーニングエリア)の複数
の画素の色を分析してその色の主成分軸を求める。そし
て、カラー画像内の各画素の色がその主成分軸以外の成
分を多く含む場合(すなわち、その色が主成分軸から遠
い場合)には、その画素をマスク領域から除外する。As a method of creating a mask by analyzing the color of a color image, for example, Japanese Patent Laid-Open No. 1-298
There is one described in Japanese Patent No. 477. According to this method, the colors of a plurality of pixels in a portion (training area) to be a mask region are analyzed to obtain a principal component axis of the color. When the color of each pixel in the color image includes many components other than the principal component axis (that is, when the color is far from the principal component axis), the pixel is excluded from the mask area.
【0005】[0005]
【発明が解決しようとする課題】しかし、上述の従来の
技術では、図1(B)に示すように黄色をマスク領域と
しつつ肌色をマスク領域から除外することは困難であっ
た。これは、肌色が黄色成分をかなり含むので、黄色を
マスク領域の色として指定した場合には、肌色もマスク
領域として認識されてしまうからである。このような問
題は、比較的近い色相を有する2つの色の一方をマスク
領域とし、他方をマスク領域から除外しようとする場合
に共通する問題であった。However, in the above-described conventional technique, it was difficult to exclude the skin color from the mask area while using yellow as the mask area as shown in FIG. 1 (B). This is because the skin color contains a considerable amount of yellow component, and if yellow is specified as the color of the mask area, the skin color is also recognized as the mask area. Such a problem is a common problem when one of two colors having relatively similar hues is used as a mask region and the other is excluded from the mask region.
【0006】この発明は、従来技術における上述の課題
を解決するためになされたものであり、比較的近い色相
の複数の色のうちで、一部の色部分をマスク領域とし、
他の色部分をマスク領域から除外することのできるマス
ク作成方法を提供することを目的とする。SUMMARY OF THE INVENTION The present invention has been made to solve the above-mentioned problems in the prior art, and among a plurality of colors having relatively similar hues, a part of a color portion is used as a mask region.
It is an object of the present invention to provide a mask creating method capable of excluding other color portions from a mask area.
【0007】[0007]
【課題を解決するための手段および作用】上述の課題を
解決するため、この発明の請求項1に記載した方法は、
(a)前記カラー画像内の色の統計的分布に基づいて複
数の代表色を決定し、前記複数の代表色を表示デバイス
に表示する工程と、(b)前記複数の代表色の中から前
記マスクの対象色を指定する工程と、(c)前記複数の
代表色の中から前記マスクの対象外色を指定する工程
と、(d)所定の色空間における前記対象色の第1の色
ベクトルを求める工程と、(e)前記所定の色空間にお
ける前記対象外色の第2の色ベクトルを求める工程と、
(f)前記第1と第2の色ベクトルとは独立の第3の色
ベクトルを求める工程と、(g)前記カラー画像内の各
画素の色を、前記第1ないし第3の色ベクトルの線形結
合で表わすときの前記第1ないし第3の色ベクトルに対
する第1ないし第3の係数をそれぞれ求める工程と、
(h)前記カラー画像内の各画素における前記第1の係
数の値に応じて前記マスクを作成する工程と、を備え
る。In order to solve the above-mentioned problems, a method according to claim 1 of the present invention comprises:
(A) determining a plurality of representative colors based on a statistical distribution of colors in the color image, and displaying the plurality of representative colors on a display device; and (b) selecting the plurality of representative colors from among the plurality of representative colors. Specifying a target color of the mask; (c) specifying a non-target color of the mask from among the plurality of representative colors; and (d) a first color vector of the target color in a predetermined color space. And (e) obtaining a second color vector of the non-target color in the predetermined color space;
(F) obtaining a third color vector independent of the first and second color vectors; and (g) determining a color of each pixel in the color image by calculating a color of the first to third color vectors. Obtaining first to third coefficients for the first to third color vectors when represented by a linear combination;
(H) creating the mask according to the value of the first coefficient for each pixel in the color image.
【0008】上述の方法によれば、対象色に近い色につ
いては第1の係数が大で第2の係数は小さく、一方、対
象外色に近い色については第1の係数が小で第2の係数
が大きくなる。従って、対象色と対象外色の色相が近い
場合にも、第1の係数に応じてマスクを作成すれば、対
象色に近い色部分をマスク領域とし、対象外色に近い色
部分をマスク領域から除外することができる。また、カ
ラー画像の色の統計的分布に基づいて複数の代表色を表
示し、その中から対象色と対象外色とを指定するように
したので、対象色と対象外色とを容易に指定することが
できる。According to the above-described method, the first coefficient is large and the second coefficient is small for a color close to the target color, while the first coefficient is small for the color close to the non-target color. Becomes larger. Therefore, even when the hue of the target color and the non-target color are close to each other, if a mask is created according to the first coefficient, a color part close to the target color is set as a mask area and a color part close to the non-target color is set as a mask area Can be excluded from In addition, multiple representative colors are displayed based on the statistical distribution of colors in the color image, and the target color and the non-target color are specified from among them. Therefore, the target color and the non-target color can be easily specified. can do.
【0009】請求項2に記載した方法では、前記工程
(a)は、色空間を複数の部分空間に区分する工程と、
前記複数の部分空間のそれぞれにおける前記カラー画像
内の色の出現頻度を求める工程と、前記出現頻度に応じ
て、前記複数の部分空間のうちの少なくとも一部の部分
空間を代表する色を前記複数の代表色として表示する工
程と、を備える。In the method according to the second aspect, the step (a) includes a step of dividing the color space into a plurality of subspaces.
Obtaining a frequency of appearance of a color in the color image in each of the plurality of subspaces; and, in accordance with the frequency of appearance, a color representing at least a part of the plurality of subspaces is represented by the plurality of colors. And displaying as a representative color.
【0010】こうすれば、カラー画像内の出現頻度の高
い色を対象色や対象外色として容易に指定できる。[0010] This makes it possible to easily designate a color having a high appearance frequency in the color image as a target color or a non-target color.
【0011】また、請求項3に記載した方法では、前記
色空間を複数の部分空間に区分する工程は、前記カラー
画像内の色に関して、3次元表色系の各成分についての
ヒストグラムを求める工程と、前記各成分のヒストグラ
ムの極小値付近において境界を設定することによって、
前記境界で区分された前記複数の部分空間に前記色空間
を区分する工程と、を備える。In the method according to the third aspect, the step of dividing the color space into a plurality of subspaces includes a step of obtaining a histogram for each component of a three-dimensional color system with respect to colors in the color image. And setting a boundary around the local minimum of the histogram of each component,
Partitioning the color space into the plurality of subspaces partitioned by the boundary.
【0012】こうすれば、カラー画像内の色の出現頻度
に応じて部分空間を区分するので、カラー画像内に存在
する主な色を代表するような複数の代表色を求めること
ができる。In this way, since the subspace is divided according to the frequency of appearance of the colors in the color image, a plurality of representative colors representing the main colors existing in the color image can be obtained.
【0013】請求項4に記載した方法では、前記工程
(h)は、前記第1の係数をしきい値で2値化すること
によって、前記マスクを表わすマスクデータを作成する
工程を含む。According to a fourth aspect of the present invention, the step (h) includes a step of creating mask data representing the mask by binarizing the first coefficient with a threshold value.
【0014】こうすれば、マスク領域のみを示す2値の
マスクデータを容易に作成することができる。This makes it possible to easily create binary mask data indicating only the mask area.
【0015】請求項5に記載した方法では、前記第1の
係数を2値化する工程は、前記第1の係数の出現頻度を
示すヒストグラムを作成する工程と、前記ヒストグラム
の極小値における前記第1の係数を前記しきい値として
設定する工程と、を備える。In the method according to the fifth aspect, the step of binarizing the first coefficient includes the step of creating a histogram indicating the frequency of occurrence of the first coefficient, and the step of binarizing the first coefficient. Setting a coefficient of 1 as the threshold value.
【0016】こうすれば、ヒストグラムに応じて2値化
のしきい値を自動的に決定することができる。This makes it possible to automatically determine the threshold for binarization according to the histogram.
【0017】請求項6に記載した方法では、前記第3の
色ベクトルは白色を表わすベクトルである。In the method described in claim 6, the third color vector is a vector representing white.
【0018】こうすれば、第3の色ベクトルを容易に決
定することができる。In this way, the third color vector can be easily determined.
【0019】請求項7に記載した方法では、前記工程
(f)は、前記第1と第2の色ベクトルを、色相/彩度
/明度空間における第4および第5の色ベクトルにそれ
ぞれ変換する工程と、前記第4と第5の色ベクトルの少
なくとも一方の彩度成分が所定の値を超える場合には、
前記所定の色空間において白色を表わすベクトルを前記
第3の色ベクトルとして選択し、前記第4と第5の色ベ
クトルの少なくとも一方の彩度成分が前記所定の値未満
の場合には、前記第4と第5の色ベクトルのうちで彩度
成分のより大きな色ベクトルについて前記色相/彩度/
明度空間において色相を所定の角度回転した第6の色ベ
クトルを生成し、前記第6の色ベクトルを前記所定の色
空間のベクトルに変換することによって前記第3の色ベ
クトルを生成する工程と、を備える。In the method described in claim 7, the step (f) converts the first and second color vectors into fourth and fifth color vectors in a hue / saturation / brightness space, respectively. And if the saturation component of at least one of the fourth and fifth color vectors exceeds a predetermined value,
A vector representing white in the predetermined color space is selected as the third color vector, and when at least one of the fourth and fifth color vectors has a saturation component less than the predetermined value, the third color vector is selected. Of the fourth and fifth color vectors, for the color vector having a larger saturation component, the hue / saturation /
Generating a sixth color vector obtained by rotating the hue by a predetermined angle in the lightness space, and generating the third color vector by converting the sixth color vector into a vector in the predetermined color space; Is provided.
【0020】こうすれば、第1と第2の色ベクトルとは
独立な第3の色ベクトルを容易に決定することができ
る。また、第1ないし第3の色ベクトルはそれぞれ現実
の色を表わすことになるので、各画素の色に対する第1
の係数が、対象色の成分を実際に表わす指標となる。This makes it possible to easily determine a third color vector independent of the first and second color vectors. In addition, since the first to third color vectors each represent an actual color, the first to third color vectors correspond to the color of each pixel.
Is an index that actually represents the component of the target color.
【0021】請求項8に記載した方法では、前記第1な
いし第3の色ベクトルは単位ベクトルである。In the method described in claim 8, the first to third color vectors are unit vectors.
【0022】こうすれば、第1ないし第3の色ベクトル
が色相のみを表わすベクトルになるので、カラー画像の
各画像の色相に応じてマスクを作成することができる。In this way, the first to third color vectors are vectors representing only the hues, so that a mask can be created according to the hues of each color image.
【0023】[0023]
A.第1の実施例:図2は、この発明の一実施例を適用
して切抜きマスクを作成するマスク作成システムの構成
を示すブロック図である。このマスク作成システムは、
CPU20と、カラー原稿画像を記憶する元画像メモリ
22と、色ベクトルの成分を記憶するベクトル値メモリ
24と、後述するマトリクスの成分を記憶するマトリク
スメモリ26と、多階調マスクデータを記憶する多階調
マスクメモリと、2値マスクデータを記憶する2値マス
クメモリ30とを備えたコンピュータシステムである。
このシステムは、さらに、入力手段または指定手段とし
てのキーボード32およびマウス34と、画像入力手段
としての読取スキャナ36と、表示手段としてのカラー
CRT38と、外部記憶手段としてのハードディスク装
置40とを備えている。A. First Embodiment FIG. 2 is a block diagram showing the configuration of a mask creation system for creating a cutout mask by applying an embodiment of the present invention. This mask making system
A CPU 20, an original image memory 22 for storing a color original image, a vector value memory 24 for storing color vector components, a matrix memory 26 for storing matrix components described later, and a multi-level memory for storing multi-tone mask data. This is a computer system including a gradation mask memory and a binary mask memory 30 for storing binary mask data.
The system further includes a keyboard 32 and a mouse 34 as input means or designation means, a reading scanner 36 as image input means, a color CRT 38 as display means, and a hard disk device 40 as external storage means. I have.
【0024】CPU20は、マトリクス演算部50と、
多階調マスク演算部52と、2値化演算部54としての
機能を有する。これらの各部は、図示しないRAMに記
憶されたソフトウェアプログラムをCPU20が実行す
ることによって実現される。なお、これらの機能につい
ては更に後述する。The CPU 20 includes a matrix operation unit 50,
It has a function as a multi-tone mask calculation unit 52 and a binarization calculation unit 54. These components are realized by the CPU 20 executing a software program stored in a RAM (not shown). Note that these functions will be further described later.
【0025】図3は、実施例における切抜きマスクの作
成の全体手順を示すフローチャートである。ステップS
1では、カラー原稿の画像データを読取スキャナ36で
読み取って、元画像メモリ22に記憶する。このカラー
原稿は、例えば、図1(A)に示すようなカラー写真で
ある。なお、元画像メモリ22はフレームメモリであ
り、元画像メモリ22に記憶された画像はカラーCRT
38に表示される。FIG. 3 is a flowchart showing the overall procedure for producing a cutout mask in the embodiment. Step S
In step 1, the image data of the color original is read by the reading scanner 36 and stored in the original image memory 22. This color original is, for example, a color photograph as shown in FIG. The original image memory 22 is a frame memory, and the image stored in the original image memory 22 is a color CRT.
38 is displayed.
【0026】ステップS1aでは、カラー原稿を読取ス
キャナ36で再びスキャンして色のヒストグラムを作成
し、このヒストグラムから複数の代表色を決定する。そ
して、決定した複数の代表色をカラーCRT38に表示
する。図4は、色のヒストグラムを作成する際に色空間
を部分空間に分割する方法の一例を示す説明図である。
図4の例では、RGB空間が各座標軸に沿って所定の単
位長さLで区切られ、立方体状の単位空間Spに区分さ
れている。ステップS1aでは、まず、各単位空間Sp
におけるカラー原稿内の色の出現頻度を示す3次元配列
のヒストグラムHst(i,j,k)が求められる。ここ
で、i,j,kは、R,G,B座標と方向が等しく、そ
の単位座標値が上記の単位長さLに等しい座標軸であ
る。例えば、R,G,Bの各色がそれぞれ255階調で
表現されている場合に、単位区間Lを5とすれば、i,
j,k座標はそれぞれ0〜51の範囲の値をとる。今、
カラー原稿内のn番目の画素のRGB各色の輝度値(R
n ,Gn ,Bn )が(30,120,200)である場
合には、これに対応するi,j,k座標の値はそれぞれ
6(=30/5),24(=120/5),40(=2
00/5)なので、ヒストグラムの値Hst(6,24,
40)に1が加算される。また、同時に、(i,j,
k)の位置の単位空間内の各色成分の平均値Rave
(i,j,k),Gave (i,j,k),Bave (i,
j,k)が次の数式1に従って更新計算される。In step S1a, the color original is scanned again by the reading scanner 36 to create a color histogram, and a plurality of representative colors are determined from the histogram. Then, the determined representative colors are displayed on the color CRT 38. FIG. 4 is an explanatory diagram showing an example of a method of dividing a color space into subspaces when creating a color histogram.
In the example of FIG. 4, the RGB space is divided by a predetermined unit length L along each coordinate axis, and is divided into a cubic unit space Sp. In step S1a, first, each unit space Sp
Is obtained, a histogram Hst (i, j, k) of a three-dimensional array indicating the frequency of appearance of colors in the color original is obtained. Here, i, j, and k are coordinate axes whose directions are equal to the R, G, and B coordinates, and whose unit coordinate value is equal to the unit length L. For example, if each of the colors R, G, and B is expressed in 255 gradations, and the unit section L is 5, i,
The j and k coordinates take values in the range of 0 to 51, respectively. now,
The luminance value (R) of each of the RGB colors of the nth pixel in the color original
When n, Gn, Bn) is (30, 120, 200), the corresponding i, j, and k coordinate values are 6 (= 30/5), 24 (= 120/5), 40 (= 2
00/5), the histogram value Hst (6, 24,
1 is added to 40). At the same time, (i, j,
Average value Rave of each color component in unit space at position k)
(I, j, k), Gave (i, j, k), Bave (i,
j, k) is updated and calculated according to the following equation 1.
【0027】[0027]
【数1】 (Equation 1)
【0028】上記の処理を、カラー原稿の全画素に対し
て行なうことによって、各単位空間内の色の出現頻度を
示す3次元ヒストグラムHst(i,j,k)と、各単位
空間の色の平均値Rave (i,j,k),Gave (i,
j,k),Bave (i,j,k)とが求められる。By performing the above-described processing for all the pixels of the color original, a three-dimensional histogram Hst (i, j, k) indicating the frequency of appearance of the color in each unit space and the color of each unit space are obtained. Average values Rave (i, j, k), Gave (i,
j, k) and Bave (i, j, k).
【0029】なお、単位空間を区分する際の単位長さL
の値は、5に限らず、任意の値を採用することができ
る。但し、単位長さLを2の累乗の値とすれば、複数ビ
ットで表現されたRGBの各座標軸の上位の数ビットが
ヒストグラムの座標値(i,j,k)となるので、ヒス
トグラムを求め易いという利点がある。The unit length L for dividing the unit space
Is not limited to 5, and any value can be adopted. However, if the unit length L is a value of a power of 2, the upper few bits of each coordinate axis of RGB represented by a plurality of bits become the coordinate values (i, j, k) of the histogram. There is an advantage that it is easy.
【0030】また、上述の処理をカラー原稿の全画素に
対して行なう必要はなく、カラー原稿の画像を間引きし
て、数画素おきに上述の処理を行なうようにしてもよ
い。この場合に、ステップS1aにおけるプレスキャン
は、カラー原稿を再度走査することによって実現しても
よく、また、ステップS1で読み取られた画像データを
間引きすることによって実現することもできる。Further, it is not necessary to perform the above-described processing for all the pixels of the color original, and the above-described processing may be performed every few pixels by thinning out the image of the color original. In this case, the pre-scan in step S1a may be realized by scanning the color original again, or may be realized by thinning out the image data read in step S1.
【0031】カラー原稿の全体についてヒストグラムH
stと平均色Rave ,Gave ,Baveとが得られると、出
現頻度(画素数)が所定のしきい値以上である位置
(i,j,k)の平均色(Rave ,Gave ,Bave )が
代表色と決定される。こうして決定された複数の代表色
は、出現頻度の高い順番にカラーCRT38に表示され
る。図5は、複数の代表色の表示例を示す説明図であ
る。モニタ画面の右半分には複数の代表色を示すカラー
パッチが配列されており、左半分には代表色で塗られた
カラー原稿の間引き画像が表示されている。Histogram H for the entire color original
When st and the average colors Rave, Gave, Bave are obtained, the average color (Rave, Gave, Bave) at the position (i, j, k) where the appearance frequency (the number of pixels) is equal to or more than a predetermined threshold value is representative. Color is determined. The plurality of representative colors determined in this way are displayed on the color CRT 38 in the order of appearance frequency. FIG. 5 is an explanatory diagram illustrating a display example of a plurality of representative colors. On the right half of the monitor screen, color patches indicating a plurality of representative colors are arranged, and on the left half, a thinned-out image of a color document painted with the representative color is displayed.
【0032】なお、出現頻度が所定のしきい値以上であ
るか否かを判断せず、単位空間の平均色を、出現頻度が
高い順に代表色として表示するだけでもよい。この場合
にも、ユーザは出現頻度の高い代表色を対象色や対象外
色として容易に選択することができる。The average color of the unit space may be simply displayed as the representative color in the descending order of the appearance frequency without determining whether the appearance frequency is equal to or higher than the predetermined threshold value. Also in this case, the user can easily select the representative color having a high appearance frequency as the target color or the non-target color.
【0033】ステップS2およびS3では、ユーザがカ
ラーCRT38に表示された複数の代表色の中から、切
抜きの対象色と対象外色とをそれぞれ指定する。例え
ば、図1(A)における衣服の地の色である黄色を対象
色として指定し、モデルの肌色を対象外色として指定す
る。色の指定は、マウス34などのポインティングデバ
イスを用いて、カラーCRT38に表示された代表色パ
ッチを選択することによって行なわれる。このように、
複数の代表色のカラーパッチと、代表色で塗られたカラ
ー画像とを同時に表示するようにすれば、対象色と対象
外色とを指定する作業に熟練を要することなく、容易に
対象色と対象外色を指定することができる。また、代表
色はカラー画像に含まれている色なので、対象色や対象
外色の指定を間違える可能性が低いという利点もある。
さらに、対象色と対象外色の指定の際には、代表色で塗
られた間引き画像を表示すればよく、間引きしない実画
像をそのまま表示する必要がないという利点もある。In steps S2 and S3, the user designates a target color to be clipped and a non-target color from a plurality of representative colors displayed on the color CRT 38, respectively. For example, yellow as the background color of the clothes in FIG. 1A is designated as the target color, and the skin color of the model is designated as the non-target color. The designation of a color is performed by selecting a representative color patch displayed on the color CRT 38 using a pointing device such as the mouse 34. in this way,
By simultaneously displaying the color patches of a plurality of representative colors and the color image painted with the representative colors, the task of designating the target color and the non-target color can be easily performed without requiring skill. Non-target colors can be specified. In addition, since the representative color is a color included in the color image, there is an advantage that the possibility of mistakenly specifying the target color or the non-target color is low.
Furthermore, when designating the target color and the non-target color, it is sufficient to display the thinned image painted with the representative color, and there is an advantage that it is not necessary to display the actual image without thinning as it is.
【0034】なお、各単位空間の平均色を求める代わり
に、各単位空間の所定の位置に対応する色を、各単位空
間を代表する色として用いても良い。例えば、各単位空
間の中心に相当する色や、各単位空間の所定のコーナー
部に相当する色をその単位空間を代表する色として用い
ることができる。但し、各単位空間の平均色を算出する
ようにすれば、カラー原稿に含まれる正しい色を代表色
として求めることができるという利点がある。Instead of calculating the average color of each unit space, a color corresponding to a predetermined position in each unit space may be used as a color representative of each unit space. For example, a color corresponding to the center of each unit space or a color corresponding to a predetermined corner of each unit space can be used as a color representing the unit space. However, if the average color of each unit space is calculated, there is an advantage that a correct color included in a color document can be obtained as a representative color.
【0035】なお、ステップS1a〜S9のルーチンは
繰り返し実行されるので、このルーチンの各サイクルに
おける対象色と対象外色とを特に区別する必要がある場
合には、第1回目のサイクルで指定された対象色と対象
外色をそれぞれ「第1回対象色」、「第1回対象外色」
と呼ぶ。Since the routines of steps S1a to S9 are repeatedly executed, if it is necessary to distinguish between the target color and the non-target color in each cycle of this routine, it is specified in the first cycle. "1st target color" and "1st non-target color"
Call.
【0036】図6は、マンセルの色相環上における対象
色と対象外色の位置を示す説明図である。第1回対象色
として指定された黄色と、第1回対象外色として指定さ
れた肌色は色相環上で近接した位置にある。この発明で
は、このように2つの色の色相が近接している場合で
も、一方の色をマスクの対象色とし、他方の色をマスク
の対象外色とすることが可能である。なお、以下におい
ては、特に言及しない限り、対象色および対象外色とし
て黄色および肌色を指定した場合に特定せず、一般的に
説明する。FIG. 6 is an explanatory diagram showing the positions of target colors and non-target colors on the Munsell hue circle. The yellow specified as the first target color and the skin color specified as the first non-target color are located close to each other on the hue circle. According to the present invention, even when the hues of two colors are close to each other, it is possible to set one color as a target color of the mask and the other color as a non-target color of the mask. In the following, unless otherwise specified, the case where yellow and flesh color are designated as target colors and non-target colors will not be specified, and will be generally described.
【0037】ステップS4では、マトリクス演算部50
(図2)が対象色と対象外色の色ベクトルをそれぞれ算
出するとともに、後述するマトリクス(行列)を求める
処理を行なう。In step S4, the matrix operation unit 50
(FIG. 2) calculates the color vector of the target color and the color vector of the non-target color, and performs a process of obtaining a matrix (matrix) described later.
【0038】図7は、ステップS4の詳細手順を示すフ
ローチャートである。ステップS11では、対象色の色
ベクトルを正規化することによって、第1の色ベクトル
を求める。図8は、第1と第2の色ベクトルを示すグラ
フである。対象色Csub のRGBの各成分を(R1 ,G
1 ,B1 )とすると、対象色Csub を表わすベクトルは
Vsub (R1 ,G1 ,B1 )と表わされる。なお、図8
では図示の便宜上、RGB空間のG軸を省略している。
ステップS11においては、マトリクス演算部50がこ
の色ベクトルVsub の単位ベクトルV1(r1 ,g1 ,
b1 )を求め、その成分(r1 ,g1 ,b1 )をベクト
ル値メモリ24に記憶する。ここで、単位ベクトルとは
長さ1のベクトルである。ステップS12においても同
様に、対象外色の色ベクトルVnsub(R2 ,G2 ,B2
)の単位ベクトルV2(r2 ,g2 ,b2 )を求め、
その成分をベクトル値メモリ24に記憶する。FIG. 7 is a flowchart showing a detailed procedure of step S4. In step S11, a first color vector is obtained by normalizing the color vector of the target color. FIG. 8 is a graph showing the first and second color vectors. Each of the RGB components of the target color Csub is represented by (R1, G
1, B1), the vector representing the target color Csub is represented as Vsub (R1, G1, B1). FIG.
For simplicity of illustration, the G axis in the RGB space is omitted.
In step S11, the matrix operation unit 50 determines that the unit vector V1 (r1, g1,
b1), and the components (r1, g1, b1) are stored in the vector value memory 24. Here, the unit vector is a vector having a length of one. Similarly, in step S12, the color vector Vnsub (R2, G2, B2
) Is determined, and a unit vector V2 (r2, g2, b2)
The component is stored in the vector value memory 24.
【0039】こうして得られた第1と第2の色ベクトル
V1,V2は、RGB空間内の色を表現するための基底
を構成する3つのベクトルのうちの2つを構成する。基
底を構成するための第3の色ベクトルV3としては、第
1と第2の色ベクトルV1,V2とは独立な単位ベクト
ルが選択される。すなわち、第3の色ベクトルは、第1
と第2の色ベクトルV1,V2の線形結合では表わせな
い単位ベクトルである。例えば、第3の色ベクトルV3
として、白色を表わす単位ベクトルVWHが選択される。
白色の単位ベクトルVWHの成分は、(1/√3,1/√
3,1/√3)である。The first and second color vectors V1 and V2 obtained in this manner constitute two of the three vectors constituting the basis for expressing the color in the RGB space. As the third color vector V3 for forming the basis, a unit vector independent of the first and second color vectors V1 and V2 is selected. That is, the third color vector is the first color vector.
Is a unit vector that cannot be expressed by a linear combination of the second color vector V1 and the second color vector V2. For example, the third color vector V3
Is selected as the unit vector VWH representing white.
The component of the white unit vector VWH is (1 / {3,1 / √)
3,1 / √3).
【0040】図9は、第1ないし第3の色ベクトルV
1,V2,V3とRGB空間の関係を示す説明図であ
る。この実施例では、次の数式2に示すように、一次独
立な3つの色ベクトルV1,V2,V3を基底として用
い、RGB空間内の任意の色E(Re,Ge,Be)
を、3つの色ベクトルV1,V2,V3の線形結合(一
次結合)で表現する。FIG. 9 shows the first to third color vectors V
FIG. 3 is an explanatory diagram illustrating a relationship between 1, V2, and V3 and an RGB space. In this embodiment, as shown in the following equation 2, three linearly independent color vectors V1, V2, and V3 are used as a basis, and an arbitrary color E (Re, Ge, Be) in the RGB space is used.
Is represented by a linear combination (linear combination) of three color vectors V1, V2, and V3.
【0041】[0041]
【数2】 (Equation 2)
【0042】後述するように、マスクを表わすマスクデ
ータは、第1の色ベクトルV1(すなわち、対象色に関
する色ベクトル)に対する係数k1に基づいて作成され
る。ところで、第1と第2の色ベクトルV1,V2のい
ずれか一方が第3の色ベクトルV3に一致している場合
には、3つの色ベクトルが一次独立ではなくなるので、
任意の色を3つのベクトルV1〜V3で表現することは
できなくなる。また、第1と第2の色ベクトルV1,V
2のいずれか一方が第3の色ベクトルV3に十分に近接
している場合にも、第1の色ベクトルV1に対する係数
k1が過度に大きくなったり小さくなったりすることが
ある。そこで、図7のステップS13では、第1と第2
の色ベクトルV1,V2のいずれか一方が白色の単位ベ
クトルVWH(1/√3,1/√3,1/√3)に十分に
近接しているか否かを調べる。そして、十分に近接して
いる場合には、ステップS14において、第3の色ベク
トルV3として白色の単位ベクトルVWH以外のベクトル
を設定する。As will be described later, mask data representing a mask is created based on a coefficient k1 for a first color vector V1 (ie, a color vector for a target color). By the way, when one of the first and second color vectors V1 and V2 coincides with the third color vector V3, the three color vectors are not linearly independent.
An arbitrary color cannot be represented by the three vectors V1 to V3. Also, the first and second color vectors V1, V
Even when one of the two is sufficiently close to the third color vector V3, the coefficient k1 for the first color vector V1 may become excessively large or small. Therefore, in step S13 of FIG.
It is checked whether one of the color vectors V1 and V2 is sufficiently close to the white unit vector VWH (1 / √3, 1 / √3, 1 / √3). If they are sufficiently close, in step S14, a vector other than the white unit vector VWH is set as the third color vector V3.
【0043】まず、ステップS13では、次の数式3に
従って、第1と第2の色ベクトルV1,V2をHSV座
標系(色相/彩度/明度座標系)に変換する。First, in step S13, the first and second color vectors V1 and V2 are converted into an HSV coordinate system (hue / saturation / lightness coordinate system) according to the following equation (3).
【0044】[0044]
【数3】 (Equation 3)
【0045】数式3において、演算子「max」と「m
in」は、括弧内の値の最大値と最小値をそれぞれ取る
演算を示す。数式3によって、第1の色ベクトルV1
(r1,g1 ,b1 )と第2の色ベクトルV2(r2 ,
g2 ,b2 )のそれぞれの色相値H,明度値V,彩度値
Sが求められる。In equation 3, the operators “max” and “m”
"in" indicates an operation that takes the maximum value and the minimum value of the values in parentheses, respectively. According to Equation 3, the first color vector V1
(R1, g1, b1) and the second color vector V2 (r2,
g2, b2), the hue value H, lightness value V, and saturation value S are obtained.
【0046】図10は、HSV空間を示す説明図であ
る。図10から解るように、白色の単位ベクトルVWHは
明度Vの座標軸上に存在する。換言すれば、白色の単位
ベクトルVWHは彩度Sと色相Hとを持たないベクトルで
ある。なお、HSV空間は円筒座標系(zrθ座標系)
であり、明度Vが垂直座標zに、彩度Sが径rに、色相
Hが角度θに相当する。FIG. 10 is an explanatory diagram showing the HSV space. As can be seen from FIG. 10, the white unit vector VWH exists on the coordinate axis of the lightness V. In other words, the white unit vector VWH is a vector having no saturation S and no hue H. The HSV space is a cylindrical coordinate system (zrθ coordinate system)
Where the lightness V corresponds to the vertical coordinate z, the saturation S corresponds to the diameter r, and the hue H corresponds to the angle θ.
【0047】彩度値Sが小さい色ベクトルは、白色の単
位ベクトルVWH(1/√3,1/√3,1/√3)に近
接している。従って、第1と第2の色ベクトルV1,V
2の少なくとも一方の彩度値Sが所定の値以下の場合に
は、その色ベクトルが白色の単位ベクトルVWHに十分に
近接していると判断できる。この所定の値としては、例
えば、各成分が8ビットのデータ、すなわち0〜255
の範囲の値で表わされる場合には10(16進数で0A
h)程度が適当である。A color vector having a small saturation value S is close to a white unit vector VWH (1 / √3, 1 / √3, 1 / √3). Accordingly, the first and second color vectors V1, V
If at least one of the saturation values S is equal to or less than a predetermined value, it can be determined that the color vector is sufficiently close to the white unit vector VWH. As the predetermined value, for example, each component is 8-bit data, that is, 0 to 255
10 (0A in hexadecimal)
h) The degree is appropriate.
【0048】上述の方法の代わりに、彩度値Sと明度値
Vとの比S/Vが一定値以下の場合に、その色ベクトル
が白色の単位ベクトルVWHに十分近接しているものと判
断するようにしてもよい。Instead of the above method, when the ratio S / V between the saturation value S and the lightness value V is equal to or less than a predetermined value, it is determined that the color vector is sufficiently close to the white unit vector VWH. You may make it.
【0049】第1と第2の色ベクトルV1,V2の少な
くとも一方が白色の単位ベクトルVWHに十分に近接して
いる場合には、ステップS14において、第3の色ベク
トルV3として、白色の単位ベクトルVWH以外のベクト
ルが求められる。図11は、白色の単位ベクトルVWH以
外のベクトルを第3の色ベクトルV3として設定する方
法を示す説明図である。まず、第1と第2の色ベクトル
V1,V2のうちで、白色の単位ベクトルからより遠い
方の色ベクトルを選択する。図11の例では、彩度値S
が比較的大きい第1の色ベクトルV1が選択される。そ
して、選択された色ベクトルV1の色相値Hから90を
減算する。すなわち、HSV空間内で色ベクトルV2を
時計廻りに90°回転する。こうして得られたベクトル
(H−90,S,V)をRGB座標系に逆変換し、その
RGB成分を正規化することによって、単位ベクトルで
ある第3の色ベクトルV3が得られる。図11には、こ
のような演算によって得られた第3の色ベクトルV3が
描かれている。なお、回転角度は90°以外の任意の角
度とすることも可能である。If at least one of the first and second color vectors V1 and V2 is sufficiently close to the white unit vector VWH, the white unit vector V3 is set as the third color vector V3 in step S14. Vectors other than VWH are determined. FIG. 11 is an explanatory diagram showing a method of setting a vector other than the white unit vector VWH as the third color vector V3. First, a color vector farther from the white unit vector is selected from the first and second color vectors V1 and V2. In the example of FIG. 11, the saturation value S
Is selected, the first color vector V1 is relatively large. Then, 90 is subtracted from the hue value H of the selected color vector V1. That is, the color vector V2 is rotated clockwise by 90 ° in the HSV space. The vector (H-90, S, V) obtained in this way is inversely transformed into an RGB coordinate system, and the RGB components are normalized, whereby a third color vector V3 as a unit vector is obtained. FIG. 11 illustrates the third color vector V3 obtained by such an operation. Note that the rotation angle can be set to any angle other than 90 °.
【0050】上述の手順によって得られた第3の色ベク
トルV3は、第1と第2の色ベクトルV1,V2から独
立なので、3つの色ベクトルV1〜V3を基底として用
いることができる。換言すれば、RGB色空間内の任意
の色が、上述の数式2のように、3つの色ベクトルV1
〜V3の線形結合によって表わされる。また、第3の色
ベクトルV3は第1または第2の色ベクトルの色相を回
転したものなので、現実に存在する色を示すベクトルで
ある。3つの色ベクトルV1〜V3はいずれも現実の色
を示すベクトルなので、各色ベクトルに対する係数k1
〜k3の値が、3つの色の混合比を表わす現実的な意味
を有することになる。Since the third color vector V3 obtained by the above procedure is independent of the first and second color vectors V1 and V2, the three color vectors V1 to V3 can be used as a basis. In other words, any color in the RGB color space is represented by the three color vectors V1
VV3. The third color vector V3 is a vector indicating a color that actually exists because the third color vector V3 is obtained by rotating the hue of the first or second color vector. Since all three color vectors V1 to V3 are vectors indicating actual colors, the coefficient k1 for each color vector
The value of ~ k3 will have a realistic meaning representing the mixture ratio of the three colors.
【0051】第3の色ベクトルとしては、第1と第2の
色ベクトルV1,V2とは独立なベクトルを選択すれば
よいので、上記以外の種々の方法で第3の色ベクトルを
設定することができる。例えば、第1と第2の色ベクト
ルV1,V2の外積V1×V2を第3の色ベクトルV3
として使用することも可能である。しかし、この外積V
1×V2は現実の色を表わさない場合があり、この場合
には各色ベクトルに対する係数k1〜k3の値が現実的
な意味を有さなくなる。従って、上述したように、第1
と第2の色ベクトルの色相を回転することによって第3
の色ベクトルを求める方が好ましい。Since a vector independent of the first and second color vectors V1 and V2 may be selected as the third color vector, the third color vector may be set by various methods other than those described above. Can be. For example, the outer product V1 × V2 of the first and second color vectors V1 and V2 is converted to the third color vector V3.
It is also possible to use as. However, this cross product V
In some cases, 1 × V2 does not represent a real color. In this case, the values of the coefficients k1 to k3 for each color vector have no practical meaning. Therefore, as described above, the first
And by rotating the hue of the second color vector
It is preferable to obtain the color vector of
【0052】こうして第3の色ベクトルV3が決定され
ると、ステップS15(図7)において3つの色ベクト
ルV1〜V3の成分で構成される3×3マトリクスM
(数式2参照)が作成され、マトリクスメモリ26に記
憶される。When the third color vector V3 is determined in this way, in step S15 (FIG. 7), a 3 × 3 matrix M composed of three color vectors V1 to V3 is used.
(See Equation 2) is created and stored in the matrix memory 26.
【0053】任意の色E(Re,Ge,Be)に対する
係数K(k1,k2,k3)は、次の数式4で与えられ
る。The coefficient K (k1, k2, k3) for an arbitrary color E (Re, Ge, Be) is given by the following equation (4).
【0054】[0054]
【数4】 (Equation 4)
【0055】従って、マトリクスMの逆行列M-1を求め
ておけば、任意の色E(Re,Ge,Be)にこの逆行
列M-1を乗ずることによって、係数K(k1,k2,k
3)を求めることができる。そこで、ステップS16で
は、マトリクス演算部50がこの逆行列M-1を演算し、
マトリクスメモリ26に格納する。Therefore, if the inverse matrix M -1 of the matrix M is obtained, the coefficient K (k1, k2, k) can be obtained by multiplying the arbitrary color E (Re, Ge, Be) by the inverse matrix M -1.
3) can be obtained. Therefore, in step S16, the matrix calculation unit 50 calculates the inverse matrix M −1 ,
It is stored in the matrix memory 26.
【0056】こうして、図3のステップS4の処理が終
了すると、ステップS5において多階調マスクが作成さ
れる。図12は、多階調マスクの作成手順を示すフロー
チャートである。ステップS21では、多階調マスク演
算部52が元画像メモリ22内のカラー画像の各画素の
画素値E(Re,Ge,Be)を読出し、数式4の右辺
に代入してその係数K(k1,k2,k3)を求める。
ステップS22では、得られた係数K(k1,k2,k
3)の中から第1の色ベクトルV1の係数k1を抽出
し、ステップS23で多階調マスクメモリ28に格納す
る。When the processing in step S4 of FIG. 3 is completed, a multi-tone mask is created in step S5. FIG. 12 is a flowchart showing a procedure for creating a multi-tone mask. In step S21, the multi-tone mask calculation unit 52 reads out the pixel value E (Re, Ge, Be) of each pixel of the color image in the original image memory 22, substitutes the value into the right side of Expression 4 to obtain its coefficient K (k1 , K2, k3).
In step S22, the obtained coefficient K (k1, k2, k
The coefficient k1 of the first color vector V1 is extracted from 3) and stored in the multi-tone mask memory 28 in step S23.
【0057】第1の係数k1は、各画素の色における第
1の色ベクトルV1の強度を示している。換言すれば、
各画素の色が第1の色ベクトルV1の成分を多く含むほ
ど第1の係数k1の値が大きい。従って、カラー画像内
の全画素についての第1の係数k1を表わすビットマッ
プデータは、対象色に近似した色の領域を示す多階調マ
スクとして使用できる。The first coefficient k1 indicates the intensity of the first color vector V1 in the color of each pixel. In other words,
The value of the first coefficient k1 increases as the color of each pixel includes more components of the first color vector V1. Therefore, the bitmap data representing the first coefficient k1 for all the pixels in the color image can be used as a multi-tone mask indicating a color region similar to the target color.
【0058】なお、第1の係数k1の値が負の場合に
は、その画素は切抜きの対象色とは正反対の色を有する
ので、その係数k1の値を0に置換してもよい。When the value of the first coefficient k1 is negative, the value of the coefficient k1 may be replaced with 0 because the pixel has a color opposite to the color to be clipped.
【0059】また、各画素の第1の係数k1を、対象色
に対する第1の係数k1a(=R1/r1 =G1 /g1
=B1 /b1 )で除算して得られた値kk(=k1/k
1a)を、多階調マスクとして使用することも可能であ
る。この際、kkの値が1以上の場合にはこれを1に置
き換え、また、負の値を0に置き換えても良い。こうす
れば、多階調マスクを表わすビットマップデータの値を
0〜1の範囲内に納めることができるので、後述する2
値化処理におけるしきい値の設定が容易になる。The first coefficient k1 of each pixel is set to the first coefficient k1a (= R1 / r1 = G1 / g1) for the target color.
= B1 / b1) divided by kk (= k1 / k)
It is also possible to use 1a) as a multi-tone mask. At this time, if the value of kk is 1 or more, it may be replaced with 1, and a negative value may be replaced with 0. By doing so, the value of the bitmap data representing the multi-tone mask can be contained in the range of 0 to 1, so that 2
Setting of the threshold value in the binarization process is facilitated.
【0060】あるいは、各画素における3つの係数k
1,k2,k3の値を次の数式5に従って正規化し、正
規化された係数ku1のビットマップデータを多階調マ
スクとして用いるようにしてもよい。Alternatively, three coefficients k for each pixel
The values of 1, k2, and k3 may be normalized according to the following Expression 5, and the bitmap data of the normalized coefficient ku1 may be used as a multi-tone mask.
【0061】[0061]
【数5】 (Equation 5)
【0062】なお、係数ku1に関しても、負の値を0
にすることが好ましい。こうして得られた係数ku1も
0〜1の範囲内に納めることができるので、後述する2
値化処理におけるしきい値の設定が容易になる。Note that the coefficient ku1 also has a negative value of 0
Is preferable. The coefficient ku1 obtained in this way can also be set within the range of 0 to 1, so that
Setting of the threshold value in the binarization process is facilitated.
【0063】多階調マスクの用途としては、例えば、透
かし合成処理が挙げられ、この場合には、対象色の強度
を合成比率として利用することができる。また、多階調
マスクの階調値を参照することで、切抜き対象部分に施
す画像処理の強弱あるいは重み付けが可能となる。例え
ば、画像の対象部分に輪郭強調処理を施す場合、マスク
の階調値が高い部分には強い輪郭強調、階調値が低い部
分には弱い輪郭強調をかけることができる。An application of the multi-tone mask is, for example, a watermark synthesizing process. In this case, the intensity of the target color can be used as a synthesizing ratio. In addition, by referring to the gradation value of the multi-tone mask, it is possible to weight or weaken the image processing performed on the cutout target portion. For example, when performing a contour emphasis process on a target portion of an image, a strong contour emphasis can be applied to a portion having a high tone value of the mask, and a weak contour emphasis can be applied to a portion having a low tone value.
【0064】こうして多階調マスクが作成されると、図
3のステップS6において、2値化演算部54が多階調
マスクを2値化することによって2値マスクが作成され
る。2値化に用いられるしきい値を設定する方法として
は、以下のような種々のものが考えられる。When the multi-tone mask is created in this way, in step S6 in FIG. 3, the binarization calculation section 54 binarizes the multi-tone mask to create a binary mask. As a method of setting a threshold value used for binarization, the following various methods can be considered.
【0065】図13は、マニュアルでしきい値を入力し
つつ2値マスクを作成する手順を示すフローチャートで
ある。ユーザが対話処理によってしきい値を入力すると
(ステップS31)、そのしきい値を用いて2値化演算
部54が多階調マスクを2値化することにより2値マス
クを作成する(ステップS32)。ユーザは、カラーC
RT38に表示された2値化マスクを観察し、満足のい
くものであるか否かを判断する(ステップS33,S3
4)。なお、2値マスクの表示の際には、図1(A),
1(B)のように、カラー画像と2値マスクとを並べて
表示するのが好ましい。2値マスクが満足のいくもので
ない場合には、ステップS31に戻って新たなしきい値
を入力し、2値化処理を再度実行する。一方、2値マス
クが満足のいくものであれば、2値化処理を終了する。
図13の手順に従って2値マスクを作成すれば、ユーザ
が欲するマスクを作成しやすいという利点がある。FIG. 13 is a flowchart showing a procedure for creating a binary mask while manually inputting a threshold value. When the user inputs a threshold value through the interactive processing (step S31), the binarization calculation unit 54 binarizes the multi-tone mask using the threshold value to create a binary mask (step S32). ). The user has access to color C
Observe the binarized mask displayed on the RT 38 and determine whether or not the mask is satisfactory (steps S33 and S3).
4). Note that when displaying the binary mask, FIG.
It is preferable to display a color image and a binary mask side by side as in 1 (B). If the binary mask is not satisfactory, the process returns to step S31, inputs a new threshold value, and executes the binarization process again. On the other hand, if the binary mask is satisfactory, the binarization process ends.
Creating a binary mask according to the procedure of FIG. 13 has an advantage that a mask desired by a user can be easily created.
【0066】多階調マスクの分布に基づいて2値化のし
きい値を自動的に設定することも可能である。図14
は、多階調マスクデータのヒストグラムである。図14
の横軸における値Kstは、対象色の多階調マスク値であ
る。通常のカラー画像では、切抜きの対象色に近い色を
有する画素がかなり多い場合が普通であるので、対象色
のマスク値の付近にヒストグラムのピークが現われる。
また、画像の背景部分は暗い色を有しているので、マス
ク値が小さい部分にもピークが現われる。このような場
合には、図14に示すように、対象色のマスク値Kstよ
りも小さな値xにおいて出現頻度が極小値を示す。従っ
て、対象色に対するマスク値Kstよりも小さく、かつ、
出現頻度が極小値を示すマスク値xを求めてこれを2値
化のしきい値とすれば、対象色に近い色の部分を表わす
2値マスクを作成することができる。It is also possible to automatically set the threshold for binarization based on the distribution of the multi-tone mask. FIG.
Is a histogram of multi-tone mask data. FIG.
Is the multi-tone mask value of the target color. In a normal color image, the number of pixels having a color close to the target color to be clipped is usually quite large, and therefore, a peak of the histogram appears near the mask value of the target color.
Further, since the background portion of the image has a dark color, a peak also appears in a portion where the mask value is small. In such a case, as shown in FIG. 14, the appearance frequency shows the minimum value at a value x smaller than the mask value Kst of the target color. Therefore, it is smaller than the mask value Kst for the target color, and
If a mask value x whose appearance frequency indicates a minimum value is obtained and used as a threshold value for binarization, a binary mask representing a color portion close to the target color can be created.
【0067】なお、図15に示すように、多階調マスク
値の最大値を所定の値Kmax とし、Kmax 以上の値をす
べてKmax で置き換えるようにすれば、出現頻度が極小
値となるマスク値xを、より容易に求めることが可能で
ある。この値Kmax としては、多階調マスク値が8ビッ
トデータで表わされる場合には、128程度の値が適当
である。As shown in FIG. 15, when the maximum value of the multi-tone mask value is set to a predetermined value Kmax and all values above Kmax are replaced by Kmax, the mask value with which the appearance frequency becomes the minimum value is obtained. x can be determined more easily. When the multi-tone mask value is represented by 8-bit data, a value of about 128 is appropriate as the value Kmax.
【0068】2値化のしきい値を求める方法としては、
多階調マスク値のヒストグラムに基づいて、いわゆる非
階層的クラスタリング法(再配置法、k−mean法と
も呼ばれる)を用いて決定することができる。この方法
によってヒストグラム内のクラスタを求め、対象色のク
ラスタの下限値をしきい値として使用すれば、対象色に
近似する色部分を示す2値マスクを得ることができる。As a method for obtaining the threshold value for binarization,
Based on the histogram of the multi-tone mask values, it can be determined using a so-called non-hierarchical clustering method (also called a rearrangement method or k-mean method). If a cluster in the histogram is obtained by this method and the lower limit value of the cluster of the target color is used as a threshold value, a binary mask indicating a color portion similar to the target color can be obtained.
【0069】図16は、2値マスクで切り抜かれる色の
領域を示すグラフである。領域(Ra+Rb)内の色
は、第1の色ベクトルV1の係数k1の値がTa以上と
なる色である。また、領域Rb内の色は、第1の色ベク
トルV1の係数k1の値がTb以上となる色である。従
って、2値化のしきい値をTaに設定すれば、領域(R
a+Rb)内の色の部分を示す2値マスクを作成するこ
とができる。この際、領域Raの左側に隣接する領域R
c内の色は、対象色の成分が小さいのでマスク領域から
は除外されることになる。なお、2値化のしきい値をT
bに設定すれば、領域Rb内の色の部分を示す2値マス
クを作成することができる。FIG. 16 is a graph showing a color region cut out by the binary mask. The color in the region (Ra + Rb) is a color in which the value of the coefficient k1 of the first color vector V1 is equal to or greater than Ta. The color in the region Rb is a color in which the value of the coefficient k1 of the first color vector V1 is equal to or larger than Tb. Therefore, if the binarization threshold is set to Ta, the region (R
It is possible to create a binary mask indicating the color portion in (a + Rb). At this time, the region R adjacent to the left side of the region Ra
The color in c is excluded from the mask area because the component of the target color is small. Note that the threshold value for binarization is T
If it is set to b, a binary mask indicating the color portion in the region Rb can be created.
【0070】図17は、図3のステップS1a〜S7を
1回実行することによって作成された第1回マスクの効
果を示す説明図である。図17における多数の丸は、カ
ラー画像内における色の分布を示している。このカラー
画像は、対象色Csub に近い色の画素の第1の集合Ob1
と、対象外色Cnsubに近い色の画素の第2の集合Ob2と
を含んでいる。第1の集合Ob1には、写真撮影時に光線
が反射して光った部分(いわゆるハイライト領域)の色
が存在する。例えば、図1(A)のカラー原稿におい
て、黄色い服地の光った部分などがこのハイライト領域
に対応している。上述の実施例によれば、しきい値を図
中のTaに設定することによって、ハイライト領域を含
む第1の集合Ob1を含み、第2の集合Ob2を除外するよ
うな2値マスクを得ることができる。第1の集合Ob1内
のハイライト領域と第2の集合Ob2とは、どちらもB成
分が大きいので、RGB空間における色ベクトルを使用
する従来の方法では、このハイライト領域と第2の集合
Ob2とを分離することは不可能である。これに対して、
この実施例による方法では、対象色に近いハイライト領
域を、第2の集合Ob2から容易に分離することができ
る。FIG. 17 is an explanatory diagram showing the effect of the first mask created by executing steps S1a to S7 of FIG. 3 once. Many circles in FIG. 17 indicate the color distribution in the color image. This color image has a first set Ob1 of pixels of a color close to the target color Csub.
And a second set Ob2 of pixels of colors close to the non-target color Cnsub. The first set Ob1 has a color of a portion (so-called highlight area) where light rays are reflected and shined during photographing. For example, in the color original shown in FIG. 1A, a shining portion of yellow clothing corresponds to the highlight area. According to the above-described embodiment, by setting the threshold value to Ta in the figure, a binary mask including the first set Ob1 including the highlight region and excluding the second set Ob2 is obtained. be able to. Since both the highlight region in the first set Ob1 and the second set Ob2 have a large B component, the conventional method using the color vector in the RGB space uses the highlight region and the second set Ob2. It is impossible to separate On the contrary,
In the method according to this embodiment, the highlight area close to the target color can be easily separated from the second set Ob2.
【0071】なお、図1(A)のカラー画像において、
服地の色である黄色を第1回対象色Csub として指定
し、モデルの肌色を第1回対象外色Cnsubとして指定す
れば、服地の黄色部分を示す図1(B)のマスクを得る
ことができる。なお、図6に示すマンセルの色相環から
も解るように、緑色は第1回対象色から見て第1回対象
外色とは反対側の色相である。従って、第1回対象色C
sub を黄色と指定し、第1回対象外色Cnsubを肌色と指
定すると、緑色の葉の部分もマスク領域に含まれること
になる。すなわち、図1(B)に示すように、黄色と緑
色の部分をマスク領域とする2値マスクを得ることがで
きる。In the color image shown in FIG.
If the color yellow of the cloth is specified as the first target color Csub and the skin color of the model is specified as the first non-target color Cnsub, the mask shown in FIG. 1B showing the yellow portion of the cloth can be obtained. it can. As can be seen from the Munsell hue circle shown in FIG. 6, green is a hue on the opposite side of the first non-target color when viewed from the first target color. Therefore, the first target color C
If sub is designated as yellow and the first non-target color Cnsub is designated as skin color, the green leaf portion is also included in the mask area. That is, as shown in FIG. 1B, a binary mask having the yellow and green portions as mask regions can be obtained.
【0072】以上のように、図3のステップS1a〜S
9のルーチンの最初のサイクルでは、第1回対象色Csu
b と第1回対象外色Cnsubとを指定することによって、
第1回対象色Csub に近い色部分を含み、かつ、第1回
対象外色Cnsubに近い色を含まないマスクを容易に得る
ことができる。As described above, steps S1a to S1 in FIG.
9, the first cycle of the target color Csu
b and the first non-target color Cnsub,
A mask that includes a color portion close to the first target color Csub and does not include a color close to the first non-target color Cnsub can be easily obtained.
【0073】こうして第1回マスクが作成されると、ス
テップS7において、カラー原稿の画像データと2値マ
スクデータとを合成することによって、切抜き対象領域
がカラーCRT38に表示される。図18(A)は、切
抜き対象領域と切抜き対象外の領域とが区別して表示さ
れたカラー画像を示す説明図である。図18(A)にお
いて、破線でハッチングされた領域はグレーで表示され
ており、この例では、図1(A)のカラー原稿の中で第
1回マスクの領域(切抜き対象領域)のみがカラーで表
示され、他の領域は多階調のグレーで表示されている。
なお、第1回マスクの領域は、図1(B)に示すよう
に、黄色と緑色の領域である。切抜き対象領域(マスク
領域)と切抜き対象外の領域とを区別する方法として
は、上記以外にも種々の方法が考えられる。例えば、切
抜き対象外の領域を白黒の2値で表示するようにしても
よい。When the first mask has been created in this way, in step S7, the image data of the color document and the binary mask data are combined to display the cutout target area on the color CRT 38. FIG. 18A is an explanatory diagram showing a color image in which a cutout target area and a non-cutout target area are displayed separately. In FIG. 18A, the area hatched by a broken line is displayed in gray. In this example, only the area of the first mask (the area to be cut out) in the color original shown in FIG. , And other areas are displayed in multi-tone gray.
Note that the first mask region is a yellow and green region as shown in FIG. Various methods other than those described above can be considered as a method for distinguishing the cutout target area (mask area) from the cutout target area. For example, an area that is not to be clipped may be displayed in black and white binary.
【0074】ユーザは、カラーCRT38に表示された
切抜き対象領域を観察し、所望のマスクが得られている
か否かを判断する。所望のマスクが得られていない場合
には、図3のステップS8からステップS1aに戻り、
上記ステップS1a〜S7のルーチンを繰り返す。この
際、ステップS1aにおける代表色の決定は、切抜き対
象領域内のカラー画像部分において行なわれ、ステップ
S2,S3における第2回対象色と第2回対象外色の指
定やステップS4〜S7の処理も切抜き対象領域内のカ
ラー画像部分に関して実行される。例えば、図6に示す
ように、第2回対象色として第1回対象色と同じ黄色を
指定し、第2回対象外色として緑色を指定する。第1回
マスクは、図18(A)に示すように黄色と緑色の領域
なので、このマスク領域の中で緑色を対象外色と指定す
ることによって、図18(B)に示すように黄色の領域
のみを含んだ第2回マスクが得られる。なお、第2回マ
スクが所望のマスクでない場合には、ステップS1a〜
S8を再度繰り返し実行すれば、所望の対象色に近い色
のみを含むようなマスクを生成することができる。The user observes the cutout target area displayed on the color CRT 38 and determines whether or not a desired mask has been obtained. If the desired mask has not been obtained, the process returns from step S8 in FIG. 3 to step S1a,
The routine of steps S1a to S7 is repeated. At this time, the determination of the representative color in step S1a is performed on the color image portion in the cutout target area, the designation of the second target color and the second non-target color in steps S2 and S3, and the processing in steps S4 to S7 Is also executed for the color image portion in the cutout target area. For example, as shown in FIG. 6, the same yellow as the first target color is designated as the second target color, and green is designated as the second non-target color. Since the first mask is a yellow and green area as shown in FIG. 18A, by specifying green as a non-target color in this mask area, a yellow color is obtained as shown in FIG. A second mask containing only the region is obtained. If the second mask is not the desired mask, steps S1a to S1a are performed.
By repeatedly executing S8, a mask including only colors close to the desired target color can be generated.
【0075】なお、ステップS1aを再度実行する場合
には、カラー原稿を再度スキャンする必要はなく、予め
得られている画像データのうちで、切抜き対象領域内の
カラー画像部分の画像データのみを用いて代表色を決定
する。When step S1a is executed again, it is not necessary to scan the color original again, and only the image data of the color image portion in the cutout target area among the image data obtained in advance is used. To determine the representative color.
【0076】こうして所望のマスクが得られると、ステ
ップS8からステップS9に移行して、マスク(2値マ
スクと多階調マスクの少なくともいずれか一方)が出力
される。When a desired mask is obtained in this manner, the process proceeds from step S8 to step S9, and a mask (at least one of a binary mask and a multi-tone mask) is output.
【0077】B.第1の実施例の変形例: (1)上記の第1の実施例では、色空間としてRGB座
標系を用いたが、CIE−XYZ座標系,YMC座標
系,YUV座標系などの他の色空間を用いてもよい。B. Modifications of First Embodiment: (1) In the first embodiment, the RGB coordinate system is used as the color space, but other colors such as the CIE-XYZ coordinate system, the YMC coordinate system, and the YUV coordinate system are used. A space may be used.
【0078】(2)前述の数式4または5で得られた第
1の係数k1またはku1をそのまま多階調マスクデー
タとして使用し、多階調マスクデータが正の画素につい
ては2値マスクの値を1とし、負の画素については2値
マスクの値を0としてもよい。すなわち、しきい値とし
て0を用いても良い。特に、カラー画像の色を変更する
ための2値マスクを作成する場合には、このような方法
によっても良好なマスクを得ることができる。(2) The first coefficient k1 or ku1 obtained by the above formula 4 or 5 is used as it is as the multi-tone mask data, and the value of the binary mask is set for the pixel where the multi-tone mask data is positive. May be set to 1, and the value of the binary mask may be set to 0 for a negative pixel. That is, 0 may be used as the threshold. In particular, when creating a binary mask for changing the color of a color image, a good mask can be obtained by such a method.
【0079】(3)第1ないし第3の色ベクトルは、単
位ベクトルでなくてもよい。ただし、第1ないし第3の
色ベクトルを単位ベクトルとすれば、各色ベクトルが色
相のみを表わすベクトルになる。従って、上述のように
第1の係数に応じてマスクを作成すれば、カラー画像の
各画素の色相に応じてマスク領域を決定することが可能
である。(3) The first to third color vectors need not be unit vectors. However, if the first to third color vectors are unit vectors, each color vector is a vector representing only the hue. Therefore, if a mask is created according to the first coefficient as described above, it is possible to determine the mask area according to the hue of each pixel of the color image.
【0080】(4)上記実施例では、第2回対象色とし
て第1回対象色と同じ色を指定していたが、第2回対象
色を指定することなく、対象色は常に同一であるものと
仮定してもよい。また、ステップS1a〜S8の各サイ
クルにおいて異なる色を対象色として指定できるように
してもよい。(4) In the above embodiment, the same color as the first target color is specified as the second target color. However, the target color is always the same without specifying the second target color. May be assumed. Further, a different color may be designated as a target color in each cycle of steps S1a to S8.
【0081】(5)代表色を求める際に色空間を部分空
間に区分する方法としては、上述の方法の他に種々のも
のが考えられる。図19は、部分空間の他の分割方法を
示す説明図である。図19のR軸上のグラフHR は、カ
ラー原稿のR成分のヒストグラムである。同様に、G軸
上のグラフHG ,B軸上のグラフHB はそれぞれG成分
とB成分のヒストグラムである。代表色を決定する際
に、R成分に関してはヒストグラムHR の谷間(極小
値)において色空間を区分する。この結果、図19の例
ではR軸が3つの領域RR1,RR2,RR3に区分されてい
る。同様に、G成分、B成分に関しても、それぞれのヒ
ストグラムHG ,HB の谷間で区分される。なお、例え
ば、R成分のヒストグラムが作成された後、G成分のヒ
ストグラムを作成する場合には、R軸上の各領域によっ
て区分される色空間において、それぞれG成分のヒスト
グラムが作成され、さらにB成分のヒストグラムを作成
する場合には、R軸及びG軸上の各領域によって区分さ
れる色空間内において、それぞれB成分のヒストグラム
が作成される。また、ヒストグラムのピークが1つしか
存在しない場合には、その色成分の座標軸を区分する必
要はない。こうして、各色成分の座標軸を区分すること
によって、3次元の色空間が複数の部分空間に区分され
る。各部分空間の色の出現頻度とその平均色は、上記第
1の実施例と同様にして算出される。そして、出現頻度
が所定のしきい値以上の部分空間の平均色が代表色とし
て決定される。(5) As a method of dividing a color space into subspaces when obtaining a representative color, various methods can be considered in addition to the above method. FIG. 19 is an explanatory diagram showing another division method of the subspace. The graph HR on the R axis in FIG. 19 is a histogram of the R component of the color original. Similarly, a graph HG on the G axis and a graph HB on the B axis are histograms of the G component and the B component, respectively. When determining the representative color, the color space is divided at the valley (minimum value) of the histogram HR for the R component. As a result, in the example of FIG. 19, the R axis is divided into three regions RR1, RR2, and RR3. Similarly, the G component and the B component are also divided by the valleys of the histograms HG and HB. For example, when a histogram of the G component is created after the histogram of the R component is created, a histogram of the G component is created in a color space divided by each region on the R axis, and a histogram of the B component is further created. When a histogram of components is created, a histogram of B components is created in a color space partitioned by regions on the R axis and the G axis. If there is only one peak in the histogram, there is no need to classify the coordinate axis of the color component. Thus, by dividing the coordinate axes of each color component, the three-dimensional color space is divided into a plurality of subspaces. The appearance frequency of each subspace color and its average color are calculated in the same manner as in the first embodiment. Then, the average color of the partial space whose appearance frequency is equal to or higher than the predetermined threshold value is determined as the representative color.
【0082】このようにして、各色成分のヒストグラム
の谷間(極小値)付近で色空間を区分することによっ
て、代表色を求める際の部分空間を決定するようにすれ
ば、色空間を適切な境界で区分することができるという
利点がある。As described above, by dividing the color space near the valley (minimum value) of the histogram of each color component to determine the subspace for obtaining the representative color, the color space can be set to an appropriate boundary. There is an advantage that it can be divided by.
【0083】なお、図19に示すように色空間を区分す
る際には、RGB軸以外の任意の一次独立な3つの座標
軸を用いることができる。例えば、カラー画像の色の主
成分を求め、3つの主成分軸において図19と同様に色
空間を区分することも可能である。When the color space is divided as shown in FIG. 19, any three linearly independent coordinate axes other than the RGB axes can be used. For example, it is also possible to determine the main components of the color of the color image and divide the color space along three main component axes in the same manner as in FIG.
【0084】C.第2の実施例:図3のステップS1a
〜S8の各サイクルにおいて、n個の対象色とm個の対
象外色とを指定するようにすることも可能である。な
お、この場合にも、マスク作成の手順は図3に示す第1
の実施例の手順と同じである。C. Second embodiment: Step S1a in FIG.
In each cycle of S8 to S8, it is also possible to specify n target colors and m non-target colors. In this case as well, the procedure for creating the mask is the same as the procedure shown in FIG.
The procedure is the same as that of the embodiment.
【0085】ステップS2およびS3では、ユーザがカ
ラーCRT38に表示された複数の代表色の中から、n
個の切抜きの対象色とm個の対象外色とをそれぞれ指定
する。ここで、nとmは整数であり、いずれか一方は少
なくとも2以上である。例えば、図1(A)における衣
服の地の色である黄色を対象色として指定し、バラの葉
の色である緑色とモデルの肌色を対象外色として指定す
る。この場合には、n=1,m=2である。色の指定
は、マウス34などのポインティングデバイスを用い
て、カラーCRT38に表示された代表色パッチ(図
5)を選択することによって行なわれる。図20は、第
2の実施例において指定された対象色と対象外色の位置
を示す説明図である。In steps S 2 and S 3, the user selects n from a plurality of representative colors displayed on the color CRT 38.
The target color of the cutout and the m non-target colors are specified. Here, n and m are integers, and either one is at least 2 or more. For example, yellow as the background color of the clothes in FIG. 1A is designated as a target color, and green as a rose leaf color and a skin color of a model are designated as non-target colors. In this case, n = 1 and m = 2. The designation of the color is performed by selecting a representative color patch (FIG. 5) displayed on the color CRT 38 using a pointing device such as the mouse 34. FIG. 20 is an explanatory diagram showing the positions of the target color and the non-target color specified in the second embodiment.
【0086】ステップS4では、マトリクス演算部50
(図2)が対象色と対象外色の色ベクトルをそれぞれ算
出するとともに、後述するマトリクス(行列)を求める
処理を行なう。In step S4, the matrix operation unit 50
(FIG. 2) calculates the color vector of the target color and the color vector of the non-target color, and performs a process of obtaining a matrix (matrix) described later.
【0087】ステップS4の詳細手順は、図7に示す第
1の実施例における手順と同じである。ステップS11
では、n個の対象色の色ベクトルを正規化することによ
って、n個の第1の色ベクトルを求める。図21(A)
と図21(B)は、第1の色ベクトルと第2の色ベクト
ルをそれぞれ示すグラフである。対象色Csub1のRGB
の各成分を(RA1,GA1,BA1)とすると、対象色Csu
b1を表わすベクトルはVsub1(RA1,GA1,BA1)と表
わされる。なお、図21(A),(B)では図示の便宜
上、RGB空間のG軸を省略している。ステップS11
においては、マトリクス演算部50がこの色ベクトルV
sub1の単位ベクトルVA1(rA1,gA1,bA1)を求め、
その成分(rA1,gA1,bA1)をベクトル値メモリ24
に記憶する。ここで、単位ベクトルとは長さ1のベクト
ルである。The detailed procedure of step S4 is the same as the procedure in the first embodiment shown in FIG. Step S11
Then, n first color vectors are obtained by normalizing the color vectors of the n target colors. FIG. 21 (A)
FIG. 21B is a graph showing a first color vector and a second color vector, respectively. RGB of target color Csub1
Let (RA1, GA1, BA1) be each component of the target color Csu
The vector representing b1 is represented as Vsub1 (RA1, GA1, BA1). In FIGS. 21A and 21B, for convenience of illustration, the G axis in the RGB space is omitted. Step S11
, The matrix operation unit 50 calculates the color vector V
The unit vector VA1 (rA1, gA1, bA1) of sub1 is obtained,
The components (rA1, gA1, bA1) are stored in a vector value memory 24.
To memorize. Here, the unit vector is a vector having a length of one.
【0088】ステップS12においても同様に、2つの
対象外色の色ベクトルVnsub1 (RB1,GB1,BB1),
Vnsub2 (RB2,GB2,BB2)の単位ベクトルVB1(r
B1,gB1,bB1),VB2(rB2,gB2,bB2)を求め、
その成分をベクトル値メモリ24に記憶する。Similarly, in step S12, the color vectors Vnsub1 (RB1, GB1, BB1) of the two non-target colors,
Vnsub2 (RB2, GB2, BB2) unit vector VB1 (r
B1, gB1, bB1) and VB2 (rB2, gB2, bB2),
The component is stored in the vector value memory 24.
【0089】こうして得られたn個の第1の色ベクトル
VAi(i=1〜n)と、m個の第2の色ベクトルVBj
(j=1〜m)とのn×m個の組み合わせは、RGB空
間内の色を表現するためのn×m組の基底を構成する。
各組の基底の第3の色ベクトルVCij としては、第1と
第2の色ベクトルVAi,VBjとは独立な単位ベクトルが
選択される。すなわち、第3の色ベクトルは、第1と第
2の色ベクトルVAi,VBjの線形結合では表わせない単
位ベクトルである。例えば、第3の色ベクトルVCij と
して、白色を表わす単位ベクトルVWHが選択される。白
色の単位ベクトルVWHの成分は、(1/√3,1/√
3,1/√3)である。The thus obtained n first color vectors VAi (i = 1 to n) and m second color vectors VBj
The n × m combinations of (j = 1 to m) form n × m sets of bases for expressing colors in the RGB space.
As the third color vector VCij of the basis of each set, a unit vector independent of the first and second color vectors VAi and VBj is selected. That is, the third color vector is a unit vector that cannot be expressed by a linear combination of the first and second color vectors VAi and VBj. For example, a unit vector VWH representing white is selected as the third color vector VCij. The component of the white unit vector VWH is (1 / {3,1 / √)
3,1 / √3).
【0090】図22は、第1ないし第3の色ベクトルV
Ai,VBj,VCij とRGB空間の関係を示す説明図であ
る。第2の実施例では、次の数式6に示すように、一次
独立な3つの色ベクトルVAi,VBj,VCijで構成され
るn×m組の基底のそれぞれを用いて、RGB空間内の
任意の色E(Re,Ge,Be)を、各組の3つの色ベ
クトルVAi,VBj,VCij の線形結合(一次結合)で表
現する。FIG. 22 shows the first to third color vectors V
FIG. 4 is an explanatory diagram showing a relationship between Ai, VBj, VCij and an RGB space. In the second embodiment, as shown in the following Expression 6, using each of n × m sets of bases composed of three linearly independent color vectors VAi, VBj, and VCij, an arbitrary color space in the RGB space is used. The color E (Re, Ge, Be) is represented by a linear combination (linear combination) of the three color vectors VAi, VBj, VCij of each set.
【0091】[0091]
【数6】 (Equation 6)
【0092】後述するように、マスクを表わすマスクデ
ータは、第1の色ベクトルVAi(すなわち、対象色に関
する色ベクトル)に対する係数k1(i,j)に基づい
て作成される。ところで、第1と第2の色ベクトルVA
i,VBjのいずれか一方が第3の色ベクトルVCij に一
致している場合には、3つの色ベクトルが一次独立では
なくなるので、任意の色を3つのベクトルVAi,VBj,
VCij で表現することはできなくなる。また、第1と第
2の色ベクトルVAi,VBjのいずれか一方が第3の色ベ
クトルVCij に十分に近接している場合にも、第1の色
ベクトルVAiに対する係数k1(i,j)が過度に大き
くなったり小さくなったりすることがある。そこで、図
7のステップS13では、第1と第2の色ベクトルVA
i,VBjのいずれか一方が白色の単位ベクトルVWH(1
/√3,1/√3,1/√3)に十分に近接しているか
否かを調べる。そして、十分に近接している場合には、
ステップS14において、第3の色ベクトルVCij とし
て白色の単位ベクトルVWH以外のベクトルを設定する。As will be described later, mask data representing a mask is created based on the coefficient k1 (i, j) for the first color vector VAi (that is, the color vector for the target color). By the way, the first and second color vectors VA
If any one of i and VBj matches the third color vector VCij, the three colors are no longer linearly independent, so any color can be assigned to the three vectors VAi, VBj,
It cannot be represented by VCij. Further, even when one of the first and second color vectors VAi and VBj is sufficiently close to the third color vector VCij, the coefficient k1 (i, j) for the first color vector VAi is not changed. May be too large or too small. Therefore, in step S13 of FIG. 7, the first and second color vectors VA
i or VBj is a white unit vector VWH (1
/ √3,1 / √3,1 / √3). And if they are close enough,
In step S14, a vector other than the white unit vector VWH is set as the third color vector VCij.
【0093】まず、ステップS13では、上述した数式
3に従って、第1と第2の色ベクトルVAi,VBjをHS
V座標系(色相/彩度/明度座標系)に変換する。First, in step S13, the first and second color vectors VAi and VBj are converted to HS
It is converted into a V coordinate system (hue / saturation / lightness coordinate system).
【0094】数式3によって、第1の色ベクトルVAi
(rAi,gAi,bAi)と第2の色ベクトルVBj(rBj,
gBj,bBj)のそれぞれの色相値H,明度値V,彩度値
Sが求められる。According to Equation 3, the first color vector VAi
(RAi, gAi, bAi) and the second color vector VBj (rBj,
gBj, bBj), the hue value H, lightness value V, and saturation value S are obtained.
【0095】第1と第2の色ベクトルVAi,VBjの少な
くとも一方が白色の単位ベクトルVWHに十分に近接して
いる場合には、ステップS14において、第3の色ベク
トルVCij として、白色の単位ベクトルVWH以外のベク
トルが求められる。If at least one of the first and second color vectors VAi and VBj is sufficiently close to the white unit vector VWH, in step S14, the white unit vector is set as the third unit color vector VCij. Vectors other than VWH are determined.
【0096】上述の手順によって得られた第3の色ベク
トルVCij は、第1と第2の色ベクトルVAi,VBjから
独立なので、3つの色ベクトルVAi,VBj,VCij を基
底として用いることができる。換言すれば、RGB色空
間内の任意の色が、上述の数式2のように、3つの色ベ
クトルVAi,VBj,VCij の線形結合によって表わされ
る。また、第3の色ベクトルVCij は第1または第2の
色ベクトルの色相を回転したものなので、現実に存在す
る色を示すベクトルである。3つの色ベクトルVAi,V
Bj,VCij はいずれも現実の色を示すベクトルなので、
各色ベクトルに対する係数k1(i,j),k2
((i,j),k3(i,j)の値が、3つの色の混合
比を表わす現実的な意味を有することになる。The third color vector VCij obtained by the above-described procedure is independent of the first and second color vectors VAi and VBj, so that the three color vectors VAi, VBj and VCij can be used as a basis. In other words, an arbitrary color in the RGB color space is represented by a linear combination of the three color vectors VAi, VBj, and VCij, as in Equation (2). Further, the third color vector VCij is a vector indicating a color that actually exists, since the third color vector VCij is obtained by rotating the hue of the first or second color vector. Three color vectors VAi, V
Since Bj and VCij are both vectors indicating the actual color,
Coefficient k1 (i, j), k2 for each color vector
(The values of ((i, j), k3 (i, j) will have a realistic meaning representing the mixture ratio of the three colors.)
【0097】第3の色ベクトルとしては、第1と第2の
色ベクトルVAi,VBjとは独立なベクトルを選択すれば
よいので、上記以外の種々の方法で第3の色ベクトルを
設定することができる。例えば、第1と第2の色ベクト
ルVAi,VBjの外積VAi×VBjを第3の色ベクトルVCi
j として使用することも可能である。しかし、この外積
VAi×VBjは現実の色を表わさない場合があり、この場
合には各色ベクトルに対する係数k1,k2,k3の値
が現実的な意味を有さなくなる。従って、上述したよう
に、第1と第2の色ベクトルの色相を回転することによ
って第3の色ベクトルを求める方が好ましい。As the third color vector, a vector independent of the first and second color vectors VAi and VBj may be selected. Therefore, the third color vector may be set by various methods other than those described above. Can be. For example, the cross product VAi × VBj of the first and second color vectors VAi, VBj is converted to the third color vector VCi.
It can be used as j. However, the outer product VAi × VBj may not represent an actual color, and in this case, the values of the coefficients k1, k2, and k3 for each color vector have no practical meaning. Therefore, as described above, it is preferable to determine the third color vector by rotating the hues of the first and second color vectors.
【0098】なお、以下では3つの色ベクトルVAi,V
Bj,VCij で構成される基底を、「基底BB(i,
j)」と呼ぶ。In the following, three color vectors VAi, V
A base composed of Bj and VCij is referred to as a “base BB (i,
j) ".
【0099】こうして第3の色ベクトルVCij が決定さ
れると、ステップS15(図7)において各基底BB
(i,j)の3つの色ベクトルVAi,VBj,VCij の成
分で構成される3×3マトリクスM(i,j)(数式6
参照)が作成され、マトリクスメモリ26に記憶され
る。When the third color vector VCij is determined in this way, in step S15 (FIG. 7), each base BB
A 3 × 3 matrix M (i, j) (Equation 6) composed of components of three color vectors VAi, VBj, VCij of (i, j)
Is created and stored in the matrix memory 26.
【0100】任意の色E(Re,Ge,Be)に対する
係数K(i,j)は、次の数式7で与えられる。The coefficient K (i, j) for an arbitrary color E (Re, Ge, Be) is given by the following equation (7).
【0101】[0101]
【数7】 (Equation 7)
【0102】従って、各基底BB(i,j)のマトリク
スM(i,j)の逆行列M(i,j)-1を求めておけ
ば、任意の色E(Re,Ge,Be)にこの逆行列M
(i,j)-1を乗ずることによって、係数K(i,j)
を求めることができる。そこで、ステップS16では、
マトリクス演算部50がn×m組の基底BB(i,j)
に対する逆行列M(i,j)-1を演算し、マトリクスメ
モリ26に格納する。Accordingly, if the inverse matrix M (i, j) -1 of the matrix M (i, j) of each base BB (i, j) is obtained, an arbitrary color E (Re, Ge, Be) can be obtained. This inverse matrix M
By multiplying by (i, j) −1 , the coefficient K (i, j)
Can be requested. Therefore, in step S16,
The matrix calculation unit 50 calculates n × m sets of bases BB (i, j)
Is computed, and the result is stored in the matrix memory 26.
【0103】こうして、図3のステップS4の処理が終
了すると、ステップS5において多階調マスクが作成さ
れる。図23は、第2の実施例における多階調マスクの
作成手順を示すフローチャートである。ステップS41
では、パラメータi,jが0にイニシャライズされ、ス
テップS42,S43においてjとiがそれぞれ1ずつ
インクリメントされる。When the processing in step S4 in FIG. 3 is completed, a multi-tone mask is created in step S5. FIG. 23 is a flowchart showing a procedure for creating a multi-tone mask in the second embodiment. Step S41
Then, the parameters i and j are initialized to 0, and in steps S42 and S43, j and i are each incremented by one.
【0104】ステップS44では、多階調マスク演算部
52が元画像メモリ22内のカラー画像の各画素の画素
値E(Re,Ge,Be)を読出し、数式7の右辺に代
入してi×1番目の基底BB(i,1)に対する係数K
(i,1)を求める。そして、ステップS45において
パラメータiがn未満であればステップS43,S44
を繰り返す。こうして、同一の第2の色ベクトルVB1に
ついてのn組の基底BB(i,1)についてのn組の係
数K(i,1)(i=1〜n)が得られる。図24は、
1つの画素値について多階調マスクデータを求める手順
を示す説明図である。j=1におけるステップS43〜
S45の処理によって、n個の係数k1(1,1)〜k
1(n,1)が得られる。In step S44, the multi-tone mask calculating section 52 reads out the pixel value E (Re, Ge, Be) of each pixel of the color image in the original image memory 22, substitutes it into the right side of Equation 7 to obtain i × Coefficient K for the first base BB (i, 1)
(I, 1) is obtained. If the parameter i is smaller than n in step S45, steps S43 and S44
repeat. Thus, n sets of coefficients K (i, 1) (i = 1 to n) for n sets of bases BB (i, 1) for the same second color vector VB1 are obtained. FIG.
FIG. 9 is an explanatory diagram showing a procedure for obtaining multi-tone mask data for one pixel value. Steps S43 to j = 1
By the processing of S45, the n coefficients k1 (1,1) to k
1 (n, 1) is obtained.
【0105】ステップS46では、得られたn組の係数
K(i,1)(i=1〜n)の中から第1の色ベクトル
VAiの係数k1(1,1)〜k1(n,1)を抽出し、
その中の最大値km(i)=max{k1(i,1)}
を求める。In step S46, the coefficients k1 (1,1) to k1 (n, 1 of the first color vector VAi are selected from the obtained n sets of coefficients K (i, 1) (i = 1 to n). )
The maximum value km (i) = max {k1 (i, 1)}
Ask for.
【0106】図25は、最大値km(i)=max{k
1(i,1)}を求める理由を示す説明図である。第1
の係数k1(i,j)は、各画素の色Eを基底BB
(i,j)で表現した場合の第1の色ベクトルVAiの強
度を示している。換言すれば、画素の色Eが第1の色ベ
クトルVAiの成分を多く含むほど第1の係数k1(i,
1)の値が大きい。図25では、同一の第2の色ベクト
ルVB1対する2つの係数k1(1,1),k1(2,
1)を示している。2つの第1の色ベクトルVA1,VA2
のうちで、より大きな係数k1(1,1)を有する第1
の色ベクトルVA1は、他の第1の色ベクトルVA2よりも
画素の色Eに近い。従って、複数の対象色が指定されて
いる場合に、同一の第2の色ベクトルVB1に対するn個
の係数k1(i,1)(i=1〜n)のうちの最大値k
m(i)=max{k1(i,1)}を求めるようにす
れば、画素の色Eに最も近い対象色を表わす色ベクトル
を含む基底によって、その色Eを表現した場合の係数k
1を得ることができる。FIG. 25 shows that the maximum value km (i) = max {k
FIG. 4 is an explanatory diagram showing a reason for obtaining 1 (i, 1)}. First
The coefficient k1 (i, j) of the color
The intensity of the first color vector VAi when represented by (i, j) is shown. In other words, as the color E of the pixel includes more components of the first color vector VAi, the first coefficient k1 (i, i,
The value of 1) is large. In FIG. 25, two coefficients k1 (1,1) and k1 (2,1) for the same second color vector VB1
1) is shown. Two first color vectors VA1, VA2
Of the first with the larger coefficient k1 (1,1)
Is closer to the pixel color E than the other first color vector VA2. Therefore, when a plurality of target colors are specified, the maximum value k among n coefficients k1 (i, 1) (i = 1 to n) for the same second color vector VB1
By calculating m (i) = max {k1 (i, 1)}, the coefficient k when the color E is represented by the basis including the color vector representing the target color closest to the color E of the pixel.
1 can be obtained.
【0107】こうして、j=1についての第1の係数の
最大値km(1)が得られると、図23のステップS4
7においてパラメータjがm未満か否かが判断される。
jがm未満の場合には、ステップS50においてパラメ
ータiが0にリセットされ、上述したステップS42〜
S47が繰り返される。As described above, when the maximum value km (1) of the first coefficient for j = 1 is obtained, step S4 in FIG.
At 7, it is determined whether the parameter j is less than m.
If j is less than m, the parameter i is reset to 0 in step S50, and the above-described steps S42 to S42 are performed.
S47 is repeated.
【0108】こうして、パラメータj(j=1〜m)の
各値について第1の係数の最大値km(j)(j=1〜
m)が得られると、ステップS48において、これらm
個の最大値km(j)の中の最小値min{km
(j)}が求められ、この最小値が多階調マスクデータ
kmaskとして多階調マスクメモリ28に格納される(図
24参照)。Thus, for each value of the parameter j (j = 1 to m), the maximum value km (j) (j = 1 to 1) of the first coefficient
When m) is obtained, in step S48, these m
Value min {km of the maximum values km (j)
(J)} is obtained, and this minimum value is stored in the multi-tone mask memory 28 as multi-tone mask data kmask (see FIG. 24).
【0109】図26は、最小値min{km(j)}を
多階調マスク値kmaskとして採用する理由を示す説明図
である。図26の例では、同一の第1の色ベクトルVA1
に2つの第2の色ベクトルVB1,VB2をそれぞれ組み合
わせた場合の2つの係数k1(1,1),k1(1,
2)を示している。これらの係数k1(1,1),k1
(1,2)は、ステップS46で得られた最大値km
(1),km(2)であると仮定する。図26から解る
ように、画素の色Eは、左側の第2の色ベクトルVB2よ
りも右側の第2の色ベクトルVB1で示される色に近い。
このような場合には、より近い色を示す右側の第2の色
ベクトルVB1を用いた場合の係数k1(1,1)の方が
小さくなる。また、右側の第2の色ベクトルよりも更に
色Eに近い第2の色ベクトルが存在すると、その係数k
1は更に小さくなる。このように、第2の色ベクトルが
画素の色Eに近づくほど、係数k1の値が小さくなる。
ところで、第2の色ベクトルに近い色は、マスク領域の
対象外として認識したい色である。従って、複数の第2
の色ベクトルVB1,VB2を用いた場合に得られる複数の
第1の係数k1(1,1),k1(1,2)の中の最小
値を多階調マスク値kmaskとして採用することによっ
て、複数の対象外色のいずれかに近い色は、マスク領域
には含まれないものとすることができる。FIG. 26 is an explanatory diagram showing the reason why the minimum value min {km (j)} is adopted as the multi-tone mask value kmask. In the example of FIG. 26, the same first color vector VA1
And two coefficients k1 (1,1) and k1 (1,2) when two second color vectors VB1 and VB2 are combined, respectively.
2) is shown. These coefficients k1 (1,1), k1
(1, 2) is the maximum value km obtained in step S46.
(1), km (2). As can be seen from FIG. 26, the color E of the pixel is closer to the color indicated by the second color vector VB1 on the right side than the second color vector VB2 on the left side.
In such a case, the coefficient k1 (1,1) when the right second color vector VB1 indicating a closer color is used becomes smaller. If there is a second color vector that is closer to the color E than the second color vector on the right, its coefficient k
1 becomes smaller. As described above, the value of the coefficient k1 decreases as the second color vector approaches the color E of the pixel.
By the way, a color close to the second color vector is a color that is desired to be recognized as being out of the target of the mask area. Therefore, a plurality of second
By using the minimum value among a plurality of first coefficients k1 (1,1) and k1 (1,2) obtained when the color vectors VB1 and VB2 of the above are used as the multi-tone mask value kmask, A color close to any of the plurality of non-target colors may not be included in the mask area.
【0110】このように、同一の第2の色ベクトルに対
するn個の第1の係数k1の中の最大値kmを求め、こ
うして得られたm個の最大値kmの中の最小値を求めて
多階調マスク値kmaskとすれば、n個の対象色に近い色
の部分をマスク領域とし、m個の対象外色に近い色の部
分をマスク領域から除外することができる。As described above, the maximum value km of the n first coefficients k1 for the same second color vector is obtained, and the minimum value of the m maximum values km obtained in this manner is obtained. With the multi-tone mask value kmask, it is possible to set a portion of a color close to n target colors as a mask region and exclude a portion of a color close to m non-target colors from the mask region.
【0111】カラー画像の各画素について図23の手順
をそれぞれ実行することによって、各画素についての多
階調マスクデータkmaskが得られる。この多階調マスク
データkmaskは、m個の対象外色に近似せず、かつ、n
個の対象色に近似した色の領域を示すビットマップデー
タである。By executing the procedure shown in FIG. 23 for each pixel of the color image, multi-tone mask data kmask for each pixel can be obtained. This multi-tone mask data kmask does not approximate to m non-target colors and n
It is bitmap data indicating an area of a color similar to the number of target colors.
【0112】なお、多階調マスク値kmaskが負の場合に
は、その画素は切抜きの対象色とは正反対の色を有する
ので、その多階調マスク値kmaskを0に置換してもよ
い。When the multi-tone mask value kmask is negative, the pixel has a color directly opposite to the color to be clipped, so that the multi-tone mask value kmask may be replaced with zero.
【0113】また、上記のようにして得られた各画素の
多階調マスク値kmaskを対象色に対する多階調マスク値
kmaska (=R1 /r1 =G1 /g1 =B1 /b1 )で
除算して得られた値kka(=k1/kmaska )を、最
終的な多階調マスク値として使用することも可能であ
る。この際、kkaの値が1以上の場合にはこれを1に
置き換え、また、負の値を0に置き換えても良い。こう
すれば、多階調マスクを表わすビットマップデータの値
を0〜1の範囲内に納めることができるので、後述する
2値化処理におけるしきい値の設定が容易になる。The multi-tone mask value kmask of each pixel obtained as described above is divided by the multi-tone mask value kmaska (= R1 / r1 = G1 / g1 = B1 / b1) for the target color. The obtained value kka (= k1 / kmaska) can be used as a final multi-tone mask value. At this time, if the value of kka is 1 or more, it may be replaced with 1, and a negative value may be replaced with 0. This allows the value of the bitmap data representing the multi-tone mask to be within the range of 0 to 1, thereby facilitating the setting of the threshold value in the binarization processing described later.
【0114】あるいは、各画素における3つの係数k
1,k2,k3の値を上述した数式5に従って正規化
し、正規化された係数ku1のビットマップデータを多
階調マスクとして用いるようにしてもよい。Alternatively, three coefficients k for each pixel
The values of 1, k2, and k3 may be normalized according to the above-described Expression 5, and the bitmap data of the normalized coefficient ku1 may be used as a multi-tone mask.
【0115】なお、係数ku1に関しても、負の値を0
にすることが好ましい。こうして得られた係数ku1も
0〜1の範囲内に納めることができるので、後述する2
値化処理におけるしきい値の設定が容易になる。Incidentally, also for the coefficient ku1, a negative value is set to 0.
Is preferable. The coefficient ku1 obtained in this way can also be set within the range of 0 to 1, so that
Setting of the threshold value in the binarization process is facilitated.
【0116】数式5による正規化は、図23のステップ
S44において基底BB(i,j)に対する係数k1,
k2,k3が得られる度に実行してもよく、ステップS
48において各画素の多階調マスク値kmaskを決定した
後に実行してもよい。The normalization according to Equation 5 is performed in step S44 in FIG. 23 by using the coefficients k1, k2 for the base BB (i, j).
It may be executed each time k2 and k3 are obtained.
It may be executed after the multi-tone mask value kmask of each pixel is determined in 48.
【0117】こうして多階調マスクが作成されると、図
3のステップS6において2値マスクが作成され、ステ
ップS7において切抜き対象領域がカラーで表示され
る。When the multi-tone mask is created in this way, a binary mask is created in step S6 in FIG. 3, and the cutout target area is displayed in color in step S7.
【0118】そして、所望のマスクが得られていない場
合には、ステップS8からステップS1aに戻り、上述
したステップS1a〜S8にルーチンが繰り返される。
この点は、上述した第1の実施例と同じである。If the desired mask has not been obtained, the process returns from step S8 to step S1a, and the routine is repeated in steps S1a to S8 described above.
This is the same as in the first embodiment described above.
【0119】第1の実施例では肌色のみを第1回対象外
色Cnsubと指定し、黄色を第1回対象色Cnsubとして指
定したので、緑色の葉の部分も第1回マスク(図1
(A))に含まれていた。これに対して、第2の実施例
では、第1回対象外色として肌色と緑色とを指定するこ
とができるので、黄色部分のみを第1回マスクとして得
ることができる。また、ステップS1a〜S8を複数回
実行すれば、極めて多数の色を含むカラー画像について
も対象色に極めて近い色のみを含むようなマスクを作成
することができる。In the first embodiment, since only the skin color is designated as the first non-target color Cnsub and yellow is designated as the first target color Cnsub, the green leaf portion is also designated by the first mask (FIG. 1).
(A)). On the other hand, in the second embodiment, since skin color and green can be designated as the first non-target color, only the yellow portion can be obtained as the first mask. Further, if steps S1a to S8 are executed a plurality of times, it is possible to create a mask including only a color very close to the target color even for a color image including an extremely large number of colors.
【0120】以上のように、第2の実施例では、n個の
対象色Csub とm個の対象外色Cnsubとを指定すること
によって、n個の対象色Csub に近い色部分を含み、か
つ、m個の対象外色Cnsubに近い色を含まないマスクを
容易に得ることができる。As described above, in the second embodiment, by specifying n target colors Csub and m non-target colors Cnsub, a color portion close to the n target colors Csub is included, and , M non-target colors Cnsub can be easily obtained.
【0121】なお、第2の実施例の処理は、次の工程
(a)〜(g)を含むものと考えることができる。 (a)カラー画像内の色の統計的分布に基づいて複数の
代表色を決定し、前記複数の代表色を表示デバイスに表
示する工程と、(b)前記複数の代表色の中から前記マ
スクのn個の対象色とm個の対象外色(nとmの少なく
とも一方は2以上)を指定する工程。(c)所定の色空
間における前記n個の対象色の第1の色ベクトルをそれ
ぞれ求める工程。(d)前記所定の色空間における前記
m個の対象外色の第2の色ベクトルをそれぞれ求める工
程。(e)前記第1と第2の色ベクトルのn×m個の組
み合わせのそれぞれについて、前記第1と第2の色ベク
トルとは独立の第3の色ベクトルを求め、第1ないし第
3の色ベクトルを組み合わせることによってn×m組の
基底を作成する工程。(f)前記n×m組の基底のそれ
ぞれについて、前記カラー画像内の各画素の色を前記第
1ないし第3の色ベクトルの線形結合で表わすときの前
記第1ないし第3の色ベクトルに対する第1ないし第3
の係数をそれぞれ求める工程。(g)前記カラー画像内
の各画素において、前記n×m組の基底のそれぞれにつ
いて得られた前記第1の係数の値に応じて前記マスクを
作成する工程。The processing of the second embodiment can be considered to include the following steps (a) to (g). (A) determining a plurality of representative colors based on a statistical distribution of colors in a color image and displaying the plurality of representative colors on a display device; and (b) the mask from among the plurality of representative colors. A step of designating n target colors and m non-target colors (at least one of n and m is 2 or more). (C) obtaining a first color vector of each of the n target colors in a predetermined color space; (D) obtaining a second color vector of each of the m non-target colors in the predetermined color space; (E) For each of the n × m combinations of the first and second color vectors, a third color vector independent of the first and second color vectors is obtained, and the first to third color vectors are obtained. Creating n × m sets of bases by combining the color vectors. (F) For each of the n × m sets of bases, the color of each pixel in the color image is represented by a linear combination of the first to third color vectors with respect to the first to third color vectors. 1st to 3rd
A step of obtaining the coefficients of (G) creating, for each pixel in the color image, the mask according to the value of the first coefficient obtained for each of the n × m sets of bases;
【0122】なお、上記の工程(a),(b)を再度実
行し、前記マスクで覆われたマスク領域内のカラー画像
部分においてn’個の対象色とm’個の対象外色の組を
新たに指定して、前記カラー画像部分について前記工程
(c)ないし(g)を実行することが可能である。Note that the above steps (a) and (b) are executed again, and a set of n ′ target colors and m ′ non-target colors in the color image portion in the mask area covered by the mask Can be newly specified, and the steps (c) to (g) can be executed for the color image portion.
【0123】また、上記工程(a)〜(f)において、
対象色の個数nと対象外色の個数mをいずれも1以上の
整数とすることもできる。この時、第1の実施例はn=
m=1の特殊な場合に相当する。In the above steps (a) to (f),
Each of the number n of target colors and the number m of non-target colors can be an integer of 1 or more. At this time, in the first embodiment, n =
This corresponds to a special case where m = 1.
【0124】なお、この発明は上記実施例に限られるも
のではなく、その要旨を逸脱しない範囲において種々の
態様において実施することが可能である。The present invention is not limited to the above-described embodiment, but can be implemented in various modes without departing from the gist of the invention.
【0125】[0125]
【発明の効果】以上説明したように、請求項1に記載し
た発明によれば、対象色と対象外色の色相が近い場合に
も、対象色に近い色部分をマスク領域とし、対象外色に
近い色部分をマスク領域から除外することができる。ま
た、カラー画像の色の統計的分布に基づいて複数の代表
色を求め、その中から対象色と対象外色とを指定するよ
うにしたので、対象色と対象外色とを容易に指定するこ
とができる。As described above, according to the first aspect of the present invention, even when the target color and the non-target color have similar hues, a color portion close to the target color is used as a mask area, and Can be excluded from the mask area. In addition, since a plurality of representative colors are obtained based on the statistical distribution of the colors of the color image, and the target color and the non-target color are designated from among them, the target color and the non-target color are easily specified. be able to.
【0126】請求項2に記載した発明によれば、カラー
画像内の出現頻度の高い色を対象色や対象外色として容
易に指定できる。According to the second aspect of the present invention, colors having a high appearance frequency in a color image can be easily designated as target colors or non-target colors.
【0127】請求項3に記載した発明によれば、カラー
画像内の色の出現頻度に応じて部分空間を区分するの
で、カラー画像内に存在する主な色を代表するような複
数の代表色を求めることができる。According to the third aspect of the present invention, since the subspace is divided according to the frequency of appearance of the color in the color image, a plurality of representative colors representing the main colors existing in the color image are obtained. Can be requested.
【0128】請求項4に記載した発明によれば、マスク
領域のみを示す2値のマスクデータを容易に作成するこ
とができる。According to the fourth aspect of the present invention, it is possible to easily generate binary mask data indicating only a mask area.
【0129】請求項5に記載した発明によれば、ヒスト
グラムに応じて2値化のしきい値を自動的に決定するこ
とができる。According to the invention described in claim 5, the threshold value for binarization can be automatically determined according to the histogram.
【0130】請求項6に記載した発明によれば、第3の
色ベクトルを容易に決定することができる。According to the invention described in claim 6, the third color vector can be easily determined.
【0131】請求項7に記載した発明によれば、第1と
第2の色ベクトルとは独立な第3の色ベクトルを容易に
決定することができる。また、第1ないし第3の色ベク
トルはそれぞれ現実の色を表わすことになるので、各画
素の色に対する第1の係数を、対象色の成分を実際に表
わす指標とすることができる。According to the invention described in claim 7, the third color vector independent of the first and second color vectors can be easily determined. In addition, since the first to third color vectors each represent an actual color, the first coefficient for the color of each pixel can be used as an index that actually represents the component of the target color.
【0132】請求項8に記載した発明によれば、第1な
いし第3の色ベクトルが色相のみを表わすベクトルにな
るので、カラー画像の各画像の色相に応じてマスクを作
成することができる。According to the invention described in claim 8, since the first to third color vectors are vectors representing only hues, a mask can be created according to the hues of each color image.
【図1】カラー写真原稿とそのマスクを示す説明図。FIG. 1 is an explanatory view showing a color photographic document and its mask.
【図2】この発明の一実施例を適用して切抜きマスクを
作成するマスク作成システムの構成を示すブロック図。FIG. 2 is a block diagram showing a configuration of a mask creating system that creates a cutout mask by applying an embodiment of the present invention.
【図3】実施例における切抜きマスクの作成の全体手順
を示すフローチャート。FIG. 3 is a flowchart showing an overall procedure for creating a cutout mask in the embodiment.
【図4】ヒストグラムの作成に用いられる色空間の分割
方法を示す説明図。FIG. 4 is an explanatory diagram showing a color space division method used for creating a histogram.
【図5】代表色の表示例を示す説明図。FIG. 5 is an explanatory diagram showing a display example of a representative color.
【図6】マンセルの色相環上における対象色(黄色)と
対象外色(肌色)の位置を示す説明図。FIG. 6 is an explanatory diagram showing positions of a target color (yellow) and a non-target color (skin color) on a Munsell hue circle.
【図7】ステップS4の詳細手順を示すフローチャー
ト。FIG. 7 is a flowchart showing a detailed procedure of step S4.
【図8】第1と第2の色ベクトルV1,V2を示すグラ
フ。FIG. 8 is a graph showing first and second color vectors V1 and V2.
【図9】第1ないし第3の色ベクトルV1,V2,V3
とRGB空間の関係を示す説明図。FIG. 9 shows first to third color vectors V1, V2, and V3.
FIG. 4 is an explanatory diagram showing the relationship between the RGB space.
【図10】HSV空間を示す説明図。FIG. 10 is an explanatory diagram showing an HSV space.
【図11】白色の単位ベクトルVWH以外のベクトルを第
3の色ベクトルV3として設定する方法を示す説明図。FIG. 11 is an explanatory diagram showing a method of setting a vector other than a white unit vector VWH as a third color vector V3.
【図12】多階調マスクの作成手順を示すフローチャー
ト。FIG. 12 is a flowchart showing a procedure for creating a multi-tone mask.
【図13】2値マスクの作成手順を示すフローチャー
ト。FIG. 13 is a flowchart showing a procedure for creating a binary mask.
【図14】多階調マスクデータのヒストグラム。FIG. 14 is a histogram of multi-tone mask data.
【図15】多階調マスクデータのヒストグラム。FIG. 15 is a histogram of multi-tone mask data.
【図16】2値マスクで切り抜かれる色の領域を示すグ
ラフ。FIG. 16 is a graph showing a color region cut out by a binary mask.
【図17】実施例によって作成されたマスクの効果を示
す説明図。FIG. 17 is an explanatory diagram showing the effect of the mask created by the example.
【図18】第1回マスク領域の表示と第2回マスクを示
す説明図。FIG. 18 is an explanatory diagram showing a first mask region display and a second mask.
【図19】部分空間の他の分割方法を示す説明図。FIG. 19 is an explanatory diagram showing another division method of a subspace.
【図20】第2の実施例における対象色(黄色)と対象
外色(肌色)の位置を示す説明図。FIG. 20 is an explanatory diagram showing positions of a target color (yellow) and a non-target color (skin color) in the second embodiment.
【図21】第2の実施例における第1と第2の色ベクト
ルVAi,VBjを示すグラフ。FIG. 21 is a graph showing first and second color vectors VAi and VBj in the second embodiment.
【図22】第2の実施例における第1ないし第3の色ベ
クトルVAi,VBj,VCij とRGB空間の関係を示す説
明図。FIG. 22 is an explanatory diagram showing a relationship between first to third color vectors VAi, VBj, VCij and an RGB space in the second embodiment.
【図23】第2の実施例における多階調マスクの作成手
順を示すフローチャート。FIG. 23 is a flowchart showing a procedure for creating a multi-tone mask in the second embodiment.
【図24】第2の実施例において1つの画素値について
多階調マスクデータを求める手順を示す説明図。FIG. 24 is an explanatory diagram showing a procedure for obtaining multi-tone mask data for one pixel value in the second embodiment.
【図25】第2の実施例において最大値km(i)=m
ax{k1(i,1)}を求める理由を示す説明図。FIG. 25 shows the maximum value km (i) = m in the second embodiment.
FIG. 4 is an explanatory diagram showing the reason for obtaining ax {k1 (i, 1)}.
【図26】第2の実施例において最小値min{km
(j)}を多階調マスクデータとする理由を示す説明
図。FIG. 26 shows a minimum value min {km in the second embodiment.
(J) Explanatory diagram showing the reason why} is multi-tone mask data.
20…CPU 22…元画像メモリ 24…ベクトル値メモリ 26…マトリクスメモリ 28…多階調マスクメモリ 32…キーボード 34…マウス 36…読取スキャナ 38…カラーCRT 40…ハードディスク装置 50…マトリクス演算部 52…多階調マスク演算部 Cnsub…対象外色 Csub …対象色 DESCRIPTION OF SYMBOLS 20 ... CPU 22 ... Original image memory 24 ... Vector value memory 26 ... Matrix memory 28 ... Multi-tone mask memory 32 ... Keyboard 34 ... Mouse 36 ... Reading scanner 38 ... Color CRT 40 ... Hard disk drive 50 ... Matrix computing unit 52 ... Many Tone mask calculation unit Cnsub: Non-target color Csub: Target color
───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平4−61558(JP,A) 特開 平8−153201(JP,A) 特開 平5−197804(JP,A) 特開 平8−7106(JP,A) 特開 平8−7107(JP,A) 特開 平8−96114(JP,A) 特開 平8−115431(JP,A) 特開 平8−272942(JP,A) 富永外,「カラー画像の色分類とその 応用」,日本色彩学会誌,1991年,第15 巻,第1号,p.55−56 (58)調査した分野(Int.Cl.6,DB名) G06T 7/00 ────────────────────────────────────────────────── ─── Continuation of the front page (56) References JP-A-4-61558 (JP, A) JP-A-8-153201 (JP, A) JP-A-5-197804 (JP, A) JP-A-8-183 7106 (JP, A) JP-A-8-7107 (JP, A) JP-A 8-96114 (JP, A) JP-A 8-115431 (JP, A) JP-A 8-272942 (JP, A) Tominaga, G., "Color Classification of Color Images and Its Applications," Journal of the Japan Society of Color Science, 1991, Vol. 15, No. 1, p. 55-56 (58) Field surveyed (Int. Cl. 6 , DB name) G06T 7/00
Claims (8)
クを作成する方法であって、(a)前記カラー画像内の
色の統計的分布に基づいて複数の代表色を決定し、前記
複数の代表色を表示デバイスに表示する工程と、(b)
前記複数の代表色の中から前記マスクの対象色を指定す
る工程と、(c)前記複数の代表色の中から前記マスク
の対象外色を指定する工程と、(d)所定の色空間にお
ける前記対象色の第1の色ベクトルを求める工程と、
(e)前記所定の色空間における前記対象外色の第2の
色ベクトルを求める工程と、(f)前記第1と第2の色
ベクトルとは独立の第3の色ベクトルを求める工程と、
(g)前記カラー画像内の各画素の色を、前記第1ない
し第3の色ベクトルの線形結合で表わすときの前記第1
ないし第3の色ベクトルに対する第1ないし第3の係数
をそれぞれ求める工程と、(h)前記カラー画像内の各
画素における前記第1の係数の値に応じて前記マスクを
作成する工程と、を備えることを特徴とするカラー画像
のマスク作成方法。1. A method for creating a mask indicating a desired color portion in a color image, comprising: (a) determining a plurality of representative colors based on a statistical distribution of colors in the color image; (B) displaying a representative color on a display device;
Specifying a target color of the mask from the plurality of representative colors; (c) specifying a non-target color of the mask from the plurality of representative colors; Obtaining a first color vector of the target color;
(E) obtaining a second color vector of the non-target color in the predetermined color space; (f) obtaining a third color vector independent of the first and second color vectors;
(G) the first pixel when the color of each pixel in the color image is represented by a linear combination of the first to third color vectors;
And (h) creating the mask according to the value of the first coefficient at each pixel in the color image. A method for producing a mask for a color image, comprising:
内の色の出現頻度を求める工程と、 前記出現頻度に応じて、前記複数の部分空間のうちの少
なくとも一部の部分空間を代表する色を前記複数の代表
色として表示する工程と、を備えるカラー画像のマスク
作成方法。2. The method according to claim 1, wherein said step (a) comprises: dividing a color space into a plurality of subspaces; and determining a color in the color image in each of the plurality of subspaces. A mask for a color image, comprising: a step of calculating an appearance frequency; and a step of displaying, as the plurality of representative colors, a color representing at least a part of the plurality of partial spaces according to the occurrence frequency. How to make.
についてのヒストグラムを求める工程と、 前記各成分のヒストグラムの極小値付近において境界を
設定することによって、前記境界で区分された前記複数
の部分空間に前記色空間を区分する工程と、を備えるカ
ラー画像のマスク作成方法。3. The method according to claim 2, wherein the step of dividing the color space into a plurality of subspaces comprises: obtaining a histogram for each component of a three-dimensional color system with respect to a color in the color image. And a step of setting a boundary near a local minimum value of the histogram of each component to divide the color space into the plurality of subspaces divided by the boundary.
法であって、 前記工程(h)は、 前記第1の係数をしきい値で2値化することによって、
前記マスクを表わすマスクデータを作成する工程を含
む、カラー画像のマスク作成方法。4. The method according to claim 1, wherein said step (h) comprises: binarizing said first coefficient with a threshold value;
A method for creating a mask for a color image, comprising creating mask data representing the mask.
方法であって、 前記第1の係数を2値化する工程は、 前記第1の係数の出現頻度を示すヒストグラムを作成す
る工程と、 前記ヒストグラムの極小値における前記第1の係数を前
記しきい値として設定する工程と、を備える、カラー画
像のマスク作成方法。5. The color image mask creating method according to claim 4, wherein the step of binarizing the first coefficient includes the step of creating a histogram indicating an appearance frequency of the first coefficient; Setting the first coefficient at the minimum value of the histogram as the threshold value.
ラー画像のマスク作成方法であって、前記第3の色ベク
トルは白色を表わすベクトルである、カラー画像のマス
ク作成方法。6. The color image mask creating method according to claim 1, wherein said third color vector is a vector representing white.
ラー画像のマスク作成方法であって、 前記工程(f)は、 前記第1と第2の色ベクトルを、色相/彩度/明度空間
における第4および第5の色ベクトルにそれぞれ変換す
る工程と、 前記第4と第5の色ベクトルの少なくとも一方の彩度成
分が所定の値を超える場合には、前記所定の色空間にお
いて白色を表わすベクトルを前記第3の色ベクトルとし
て選択し、前記第4と第5の色ベクトルの少なくとも一
方の彩度成分が前記所定の値未満の場合には、前記第4
と第5の色ベクトルのうちで彩度成分のより大きな色ベ
クトルについて前記色相/彩度/明度空間において色相
を所定の角度回転した第6の色ベクトルを生成し、前記
第6の色ベクトルを前記所定の色空間のベクトルに変換
することによって前記第3の色ベクトルを生成する工程
と、を備える、カラー画像のマスク作成方法。7. The method for producing a mask for a color image according to claim 1, wherein said step (f) comprises: converting said first and second color vectors into hue / saturation / brightness. Converting the color components into fourth and fifth color vectors in a space, respectively, if at least one of the saturation components of the fourth and fifth color vectors exceeds a predetermined value, the white color in the predetermined color space Is selected as the third color vector, and when the saturation component of at least one of the fourth and fifth color vectors is less than the predetermined value, the fourth color vector is selected.
And a sixth color vector obtained by rotating the hue by a predetermined angle in the hue / saturation / brightness space for a color vector having a larger saturation component among the fifth color vector and the sixth color vector. Generating the third color vector by converting to a vector in the predetermined color space.
ラー画像のマスク作成方法であって、 前記第1ないし第3の色ベクトルは単位ベクトルであ
る、カラー画像のマスク作成方法。8. The color image mask creating method according to claim 1, wherein the first to third color vectors are unit vectors.
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP6275851A JP2896319B2 (en) | 1994-10-14 | 1994-10-14 | How to make a color image mask |
| EP95108520A EP0693738A3 (en) | 1994-06-23 | 1995-06-02 | Device and method for producing colored masks |
| US08/466,598 US5659490A (en) | 1994-06-23 | 1995-06-06 | Method and apparatus for generating color image mask |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP6275851A JP2896319B2 (en) | 1994-10-14 | 1994-10-14 | How to make a color image mask |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH08115430A JPH08115430A (en) | 1996-05-07 |
| JP2896319B2 true JP2896319B2 (en) | 1999-05-31 |
Family
ID=17561326
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP6275851A Expired - Fee Related JP2896319B2 (en) | 1994-06-23 | 1994-10-14 | How to make a color image mask |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2896319B2 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4735170B2 (en) * | 2005-09-30 | 2011-07-27 | オムロン株式会社 | Image processing apparatus and image processing method |
| KR100791380B1 (en) | 2006-01-17 | 2008-01-07 | 삼성전자주식회사 | Method and apparatus for enhancing an image using complementary color contrast |
-
1994
- 1994-10-14 JP JP6275851A patent/JP2896319B2/en not_active Expired - Fee Related
Non-Patent Citations (1)
| Title |
|---|
| 富永外,「カラー画像の色分類とその応用」,日本色彩学会誌,1991年,第15巻,第1号,p.55−56 |
Also Published As
| Publication number | Publication date |
|---|---|
| JPH08115430A (en) | 1996-05-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5659490A (en) | Method and apparatus for generating color image mask | |
| JP3400888B2 (en) | How to change the color of a color image | |
| US8553285B2 (en) | Image processing apparatus, an image processing method, a medium on which an image processing control program is recorded, an image evaluation device, an image evaluation method and a medium on which an image evaluation program is recorded | |
| US7064864B2 (en) | Method and apparatus for compressing reproducible color gamut | |
| JPH04227585A (en) | Method and apparatus for forming improved control-data line | |
| JP2004030670A (en) | Enhancement method for color tone feature of digital image | |
| CN110248242B (en) | Image processing and live broadcasting method, device, equipment and storage medium | |
| JPH06225329A (en) | Method and device for chromakey processing | |
| JP3873477B2 (en) | Image processing apparatus and image processing method | |
| JP2896319B2 (en) | How to make a color image mask | |
| US5682505A (en) | Method and apparatus for generating an image | |
| JP2896317B2 (en) | How to make a color image mask | |
| JP2896320B2 (en) | How to make a color image mask | |
| JP2004350212A (en) | Image processing system and image processing method | |
| JP2896311B2 (en) | How to make a color image mask | |
| JP2896310B2 (en) | How to make a color image mask | |
| JPH06301773A (en) | Method and device for color reduction picture processing | |
| JP3306964B2 (en) | Limited color determining method and apparatus | |
| JP2973710B2 (en) | Limited color determination method and limited color determination device | |
| JP2557537B2 (en) | Device for setting density signal conversion characteristics | |
| KR102639691B1 (en) | Composite image generation method, apparatus performing the same, and computer program for executing the same | |
| JPH11296672A (en) | Image color information extraction method | |
| JP2005094452A (en) | Method, system, and program for processing image | |
| Kayalvizhi et al. | A Quantitative and Qualitative Evaluation of Image Enhancement Techniques Using Histogram Methods | |
| Pastushenko | Fractally-Colorimetric Approach to Evaluating the Quality of Gamified Images |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| LAPS | Cancellation because of no payment of annual fees |