JP2000151982A - Image compositor, image compositing method image generating device, image generating method and served medium - Google Patents
Image compositor, image compositing method image generating device, image generating method and served mediumInfo
- Publication number
- JP2000151982A JP2000151982A JP10326455A JP32645598A JP2000151982A JP 2000151982 A JP2000151982 A JP 2000151982A JP 10326455 A JP10326455 A JP 10326455A JP 32645598 A JP32645598 A JP 32645598A JP 2000151982 A JP2000151982 A JP 2000151982A
- Authority
- JP
- Japan
- Prior art keywords
- image
- area
- mat
- matte
- value
- 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.)
- Withdrawn
Links
Landscapes
- Image Processing (AREA)
- Image Generation (AREA)
- Studio Circuits (AREA)
- Editing Of Facsimile Originals (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、画像合成装置およ
び画像合成方法、画像生成装置および画像生成方法、並
びに提供媒体に関し、特に、マット値による画像どうし
の合成を、効率良く行うことができるようにする画像合
成装置および画像合成方法、画像生成装置および画像生
成方法、並びに提供媒体に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image synthesizing apparatus, an image synthesizing method, an image generating apparatus, an image generating method, and a providing medium, and more particularly, to an image synthesizing method using mat values. The present invention relates to an image synthesizing apparatus and an image synthesizing method, an image generating apparatus and an image generating method, and a providing medium.
【0002】[0002]
【従来の技術】近年におけるディジタル信号処理技術の
進歩、発展により、例えば、映画やテレビジョン放送番
組等の制作においては、背景となる風景等の画像上に、
その背景とは別に撮影した登場人物の画像を合成するよ
うな、画像のディジタル合成が行われることが多くなっ
てきている。2. Description of the Related Art In recent years, with the progress and development of digital signal processing technology, for example, in the production of movies, television broadcast programs, etc.
Digital synthesis of images, such as combining images of characters taken separately from the background, has been increasingly performed.
【0003】画像のディジタル合成には、その合成の対
象となる前景の画像(前景画像)を構成する各画素ごと
に設定されたマット値(キー信号やα(アルファ)値な
どとも呼ばれる)が用いられる。In digitally synthesizing an image, a mat value (also called a key signal or α (alpha) value) set for each pixel constituting a foreground image (foreground image) to be synthesized is used. Can be
【0004】即ち、マット値は、所定の範囲の値によっ
て、前景画像の各画素の不透明度を表すもので、一般
に、所定の範囲の最小のマット値は、前景画像の画素
が、完全に透明な状態に対応し、最大のマット値は、前
景画像の画素が、完全に不透明な状態に対応する。[0004] That is, the mat value represents the opacity of each pixel of the foreground image by a value in a predetermined range. Generally, the minimum mat value in the predetermined range is such that the pixels of the foreground image are completely transparent. The maximum mat value corresponds to a state where the pixels of the foreground image are completely opaque.
【0005】ここで、マット値を用いた画像合成を行う
場合においては、一般に、マット値が取りうる値の範囲
の最小値は0に、最大値は1に、それぞれ正規化される
ため、以下では、マット値の最小値または最大値が、そ
れぞれ0または1であるとして、説明を行う。Here, in the case of performing image synthesis using mat values, the minimum value of the range of possible values of the mat value is generally normalized to 0, and the maximum value is normalized to 1, respectively. In the following, a description will be given assuming that the minimum value or the maximum value of the mat value is 0 or 1, respectively.
【0006】マット値は、上述したように、前景画像の
各画素の不透明度を表すから、前景画像を構成する画素
それぞれについて存在し、そのようなマット値を、画素
値とする画像は、マット画像と呼ばれることがある。マ
ット画像は、それ自体単独で与えられる場合もあるが、
前景画像とともに(前景画像の一部として)与えられる
場合もある。[0006] As described above, the mat value represents the opacity of each pixel of the foreground image, and therefore exists for each pixel constituting the foreground image. Sometimes called an image. The matte image may be given by itself,
It may be provided with the foreground image (as part of the foreground image).
【0007】マット値を用いた画像合成は、例えば、次
のように行われる。即ち、いま、前景画像および背景の
画像(背景画像)の画素の画素値が、RGB(Red, Gre
en,Bule)の各成分からなり、前景画像の画素のR,
G,B成分を、Fr,Fg,Fbと表すとともに、背景
画像の画素のR,G,B成分を、Br,Bg,Bbと表
すこととする。さらに、前景画像の画素に対するマット
値をMと表し、前景画像と背景画像とを合成した合成画
像の画素のR,G,B成分を、Cr,Cg,Cbと表す
こととする。この場合、合成画像の画素のR,G,B成
分は、次式で求められる。Image synthesis using mat values is performed, for example, as follows. That is, the pixel values of the pixels of the foreground image and the background image (background image) are RGB (Red, Gre
en, Bule), and R,
The G and B components are represented as Fr, Fg and Fb, and the R, G and B components of the pixels of the background image are represented as Br, Bg and Bb. Further, the mat value for the pixel of the foreground image is represented by M, and the R, G, B components of the pixel of the combined image obtained by combining the foreground image and the background image are represented by Cr, Cg, Cb. In this case, the R, G, and B components of the pixels of the composite image are obtained by the following equations.
【0008】 Cr=M×Fr+(1−M)×Br Cg=M×Fg+(1−M)×Bg Cb=M×Fb+(1−M)×Bb ・・・(1)Cr = M × Fr + (1-M) × Br Cg = M × Fg + (1-M) × Bg Cb = M × Fb + (1-M) × Bb (1)
【0009】なお、式(1)による画像合成について
は、例えば、T.Porter and T.Duff, "Compositing Digi
tal Images", Computer Graphics Vol.18, No.3(1984),
pp.253-259などに、その詳細が開示されている。[0009] The image synthesis according to the equation (1) is described in, for example, T. Porter and T. Duff, "Compositing Digi.
tal Images ", Computer Graphics Vol.18, No.3 (1984),
The details are disclosed in pp. 253-259 and the like.
【0010】式(1)から、マット値Mは、前景画像の
画素の、合成画像に対する寄与の程度を表しており、マ
ット値Mが1の画素(合成画像の画素)では、前景画像
だけが現れる。また、マット値Mが1未満でかつ0より
大きい画素では、そのマット値Mに応じて、前景画像と
背景とが混合され、さらに、マット値Mが0の画素で
は、背景画像だけが現れる。From equation (1), the matte value M represents the degree of contribution of the pixels of the foreground image to the composite image. For a pixel having a matte value M of 1 (pixels of the composite image), only the foreground image appear. For a pixel whose mat value M is less than 1 and larger than 0, the foreground image and the background are mixed in accordance with the mat value M, and for a pixel whose mat value M is 0, only the background image appears.
【0011】[0011]
【発明が解決しようとする課題】ところで、式(1)の
演算には、乗算と加算(減算)が含まれるが、乗算は、
一般に、加算に比較して時間を要する。特に、高解像度
の画像(画素数の多い画像)について合成を行う場合に
は、画素数が多いために、乗算の回数が莫大になり、そ
の結果、処理の低速化を招くことになる。The operation of the equation (1) includes multiplication and addition (subtraction).
Generally, it takes more time than the addition. In particular, when synthesizing a high-resolution image (an image having a large number of pixels), since the number of pixels is large, the number of multiplications becomes enormous, resulting in a reduction in processing speed.
【0012】このような処理の低速化を低減するには、
演算量を少なくする必要があり、演算量の少なくする方
法としては、例えば、J.Foley, et al., Computer Grap
hics: Principles and Practice, Addison-Wesley, sec
ond edition, 1990.などに記載されている、いわゆるバ
ウンディングボックス(外接矩形の概念)を使用して演
算の対象とする領域(演算対象領域)を限定するものが
知られている。[0012] In order to reduce such slowing of processing,
It is necessary to reduce the amount of calculation, and as a method of reducing the amount of calculation, for example, J. Foley, et al., Computer Grap
hics: Principles and Practice, Addison-Wesley, sec
Ond edition, 1990., etc., which limit a region to be calculated (calculation target region) using a so-called bounding box (concept of a circumscribed rectangle) is known.
【0013】バウンディングボックスを使用して、画像
合成における演算量を少なくする場合には、図11に示
すように、マット画像に対して、0でないマット値に外
接する矩形の領域(図11において、点線で囲んである
領域)を設定し、その矩形の領域の内部だけを対象に、
式(1)の演算を行うようにすれば良い。即ち、この矩
形がバウンディングボックスと呼ばれるが、バウンディ
ングボックスの外部の領域のマット値は0であるから、
合成画像において、背景画像がそのまま現れる。従っ
て、バウンディングボックスの外部の領域に対応する背
景画像は、そのまま合成画像にコピーし、バウンディン
グボックスの内部の領域に対応する前景画像および背景
画像についてだけ、式(1)の演算を行えば良い。When the amount of calculation in image synthesis is reduced by using a bounding box, as shown in FIG. 11, a rectangular area circumscribing a non-zero mat value (see FIG. Area enclosed by a dotted line), and only within the rectangular area,
What is necessary is just to perform the calculation of Formula (1). That is, although this rectangle is called a bounding box, since the mat value of an area outside the bounding box is 0,
In the composite image, the background image appears as it is. Therefore, the background image corresponding to the area outside the bounding box may be copied as it is to the composite image, and the calculation of Equation (1) may be performed only on the foreground image and the background image corresponding to the area inside the bounding box.
【0014】ここで、図11のマット画像において(後
述する図3においても同様)、影を付していない領域は
マット値が0の領域(以下、適宜、透明領域という)
を、薄い影を付してある部分は、マット値が0より大き
く、1より小さい領域(以下、適宜、半透明領域とい
う)を、濃い影を付してある部分は、マット値が1の領
域(以下、適宜、完全不透明領域という)を、それぞれ
表している。Here, in the matte image of FIG. 11 (similarly in FIG. 3 described later), an area without a shadow is an area having a matte value of 0 (hereinafter, appropriately referred to as a transparent area).
Is a region where the mat value is larger than 0 and smaller than 1 (hereinafter referred to as a semi-transparent region as appropriate), and a portion where the matte value is 1 Each region (hereinafter, referred to as a completely opaque region as appropriate) is shown.
【0015】なお、合成画像を、前景画像および背景画
像とは別に生成する場合は、上述のように、バウンディ
ングボックスの外部の領域に対応する背景画像を、合成
画像にコピーする必要があるが、背景画像に上書きする
形で合成画像を生成する場合には、バウンディングボッ
クスの外部の領域に対応する背景画像については、特に
処理を行う必要はない。When the composite image is generated separately from the foreground image and the background image, it is necessary to copy the background image corresponding to the area outside the bounding box to the composite image as described above. When a composite image is generated by overwriting the background image, no special processing is required for the background image corresponding to the area outside the bounding box.
【0016】また、バウンディングボックスは、0でな
いマット値すべてを包含する形状であれば良く、矩形で
ある必要はないが、バウンディングボックスの内外の判
定が容易なため、一般に、矩形のバウンディングボック
スが用いられることが多い。The bounding box may have any shape as long as it includes all non-zero mat values, and need not be rectangular. However, since it is easy to determine the inside and outside of the bounding box, a rectangular bounding box is generally used. Is often done.
【0017】さらに、図11において、バウンディング
ボックスは、半透明領域に外接するように設定されてい
るが、必ずしも接する必要はない。Furthermore, in FIG. 11, the bounding box is set so as to circumscribe the translucent area, but it is not always necessary to make contact.
【0018】次に、図12のフローチャートを参照し
て、バウンディングボックスを用いた従来の画像合成処
理について説明する。なお、ここでは、背景画像に上書
きする形で合成画像を生成するものとする(従って、こ
の場合、上述したように、バウンディングボックスの外
部の領域に対応する背景画像については、特に処理を行
う必要はない)。Next, a conventional image synthesizing process using a bounding box will be described with reference to a flowchart of FIG. Here, it is assumed that the composite image is generated by overwriting the background image (therefore, in this case, as described above, it is necessary to perform particularly processing on the background image corresponding to the area outside the bounding box. No).
【0019】まず最初に、ステップS81において、バ
ウンディングボックスが設定される。即ち、ステップS
81では、ユーザによって、バウンディングボックス
の、例えば、左下の頂点と右上の頂点が指定される。First, in step S81, a bounding box is set. That is, step S
At 81, the user designates, for example, the lower left vertex and the upper right vertex of the bounding box.
【0020】なお、ここでは、図11に示すように、マ
ット画像の左下の頂点を原点(0,0)とし、左から右
方向、または下から上方向に、x軸またはy軸をとった
座標系を用い、ユーザによって指定されたバウンディン
グボックスの左下または右上の頂点の座標を、それぞれ
(Xmin1,Ymin1)または(Xmax1,Ymax1)と表す
(Xmin1<Xmax1,Ymin1<Ymax1)。また、マット画
像の横または縦の画素数を、それぞれWまたはHとす
る。Here, as shown in FIG. 11, the lower left vertex of the matte image is set to the origin (0, 0), and the x-axis or the y-axis is taken from left to right or from bottom to upward. Using the coordinate system, the coordinates of the lower left or upper right vertex of the bounding box specified by the user are expressed as (X min1 , Y min1 ) or (X max1 , Y max1 ), respectively (X min1 <X max1 , Y min1 < Y max1 ). Also, the number of horizontal or vertical pixels of the mat image is W or H, respectively.
【0021】ユーザによって、点(Xmin1,Ymin1)お
よび(Xmax1,Ymax1)が指定されると、それぞれの点
を、左下の頂点または右上の頂点とする矩形が求めら
れ、ステップS81では、その矩形がバウンディングボ
ックスとして設定される。When the points (X min1 , Y min1 ) and (X max1 , Y max1 ) are specified by the user, a rectangle is determined with each point as the lower left vertex or the upper right vertex. , The rectangle is set as the bounding box.
【0022】バウンディングボックスが設定されると、
以下、そのバウンディングボックスの内部(Xmin1≦x
≦Xmax1,Ymin1≦y≦Ymax1)に対応する前景画像お
よび背景画像のみを対象に処理が行われる。When the bounding box is set,
Hereinafter, the inside of the bounding box (X min1 ≦ x
≦ X max1 , Y min1 ≦ y ≦ Y max1 ) Only the foreground image and the background image are processed.
【0023】即ち、ステップS82において、画素のy
座標を表す変数yが、Ymin1に初期化され、ステップS
83に進み、変数yが、Ymax1以下であるかどうかが判
定される。ステップS83において、変数yが、Ymax1
以下であると判定された場合、即ち、変数yが、バウン
ディングボックス内の画素のy座標を表すものである場
合、ステップS84に進み、後述する一行計算サブルー
チン(例えば、関数やオブジェクト)が呼び出され、こ
れにより、一行計算処理が行われる。なお、一行計算サ
ブルーチンは、変数y、並びにバウンディングボックス
の左右の境界のx座標Xmin1およびXmax1を引数として
呼び出される。That is, in step S82, the pixel y
A variable y representing coordinates is initialized to Y min1 and step S
Proceeding to 83, it is determined whether the variable y is equal to or less than Ymax1 . In step S83, the variable y is set to Y max1
If it is determined to be the following, that is, if the variable y represents the y coordinate of the pixel in the bounding box, the process proceeds to step S84, and a one-line calculation subroutine (for example, a function or an object) to be described later is called. Thus, a one-line calculation process is performed. The one-line calculation subroutine is called using the variable y and the x-coordinates X min1 and X max1 of the left and right boundaries of the bounding box as arguments.
【0024】一行計算処理が終了すると、ステップS8
5に進み、変数yが1だけインクリメントされ、ステッ
プS83に戻る。そして、ステップS83において、変
数yが、Ymax1以下でないと判定されると、処理を終了
する。When the one-line calculation process is completed, step S8
Proceeding to 5, the variable y is incremented by 1 and the process returns to step S83. Then, in step S83, when it is determined that the variable y is not smaller than or equal to Ymax1 , the process ends.
【0025】次に、図13のフローチャートを参照し
て、図12の一行計算処理について説明する。なお、図
12のステップS84において、一行計算サブルーチン
は、上述したように、変数y、並びにバウンディングボ
ックスの左右の境界のx座標Xmin1およびXmax1を引数
として呼び出されるが、図13では、そのうちの、Xmi
n1またはXmax1を、それぞれXLまたはXRと表してあ
る。Next, the one-line calculation process of FIG. 12 will be described with reference to the flowchart of FIG. As described above, in step S84 of FIG. 12, the one-line calculation subroutine is called with the variable y and the x-coordinates X min1 and X max1 of the left and right boundaries of the bounding box as arguments, but in FIG. , X mi
n1 or X max1 is designated as XL or XR, respectively.
【0026】一行計算処理では、まず最初に、ステップ
S91において、x座標を表す変数xが、XLに初期化
され、ステップS92に進み、変数xが、XR以下であ
るかどうかが判定される。ステップS92において、変
数xが、XR以下であると判定された場合、即ち、変数
xが、バウンディングボックス内の画素のx座標を表す
ものである場合、ステップS93に進み、変数Mに、座
標(画素)(x,y)のマット値matte[x,y]
がセットされる。ここで、配列変数matte[x,
y]には、座標(x,y)のマット値が記憶されている
ものとする。In the one-line calculation process, first, in step S91, a variable x representing the x coordinate is initialized to XL, and the flow advances to step S92 to determine whether the variable x is equal to or smaller than XR. In step S92, when it is determined that the variable x is equal to or smaller than XR, that is, when the variable x represents the x coordinate of the pixel in the bounding box, the process proceeds to step S93, and the variable M is set to the coordinates ( Pixel) (x, y) matte value [x, y]
Is set. Here, the array variable matte [x,
[y] stores a mat value of the coordinates (x, y).
【0027】そして、ステップS94に進み、マット値
Mが0であるかどうかが判定され、0でないと判定され
た場合、ステップS95に進み、マット値Mが1である
かどうかが判定される。ステップS95において、マッ
ト値Mが1であると判定された場合、即ち、マット画像
の座標(x,y)の画素が、バウンディングボックス内
の完全不透明領域(図11において、濃い影を付してあ
る部分)の画素である場合、ステップS96に進み、背
景画像の画素(x,y)の画素値B[x,y]に、前景
画像の画素(x,y)の画素値F[x,y]がコピーさ
れ、ステップS98に進む。Then, the process proceeds to step S94, in which it is determined whether or not the mat value M is 0. If it is determined that the value is not 0, the process proceeds to step S95, in which it is determined whether or not the mat value M is 1. In step S95, when it is determined that the mat value M is 1, that is, the pixel at the coordinates (x, y) of the mat image is completely opaque in the bounding box (in FIG. 11, a dark shadow is added. If it is a pixel of a certain part), the process proceeds to step S96, and the pixel value B [x, y] of the pixel (x, y) of the background image is replaced with the pixel value F [x, y] of the pixel (x, y) of the foreground image. y] is copied and the process proceeds to step S98.
【0028】ここで、背景画像の画素(x,y)のR,
G,B成分が、構造体とされた配列変数B[x,y].
r,B[x,y].g,B[x,y].bで、前景画像
の画素(x,y)のR,G,B成分が、構造体とされた
配列変数F[x,y].r,F[x,y].g,F
[x,y].bで、それぞれ表されるものとすると、ス
テップS96では、次式で示す演算が行われる。Here, R, R of pixel (x, y) of the background image
G and B components are array variables B [x, y].
r, B [x, y]. g, B [x, y]. b, the R, G, and B components of the pixel (x, y) of the foreground image are represented by array variables F [x, y]. r, F [x, y]. g, F
[X, y]. In step S96, the calculation represented by the following equation is performed.
【0029】 B[x,y].r=F[x,y].r B[x,y].g=F[x,y].g B[x,y].b=F[x,y].b ・・・(2)B [x, y]. r = F [x, y]. r B [x, y]. g = F [x, y]. g B [x, y]. b = F [x, y]. b ... (2)
【0030】また、ステップS95において、マット値
Mが1でないと判定された場合、即ち、マット画像の座
標(x,y)の画素が、バウンディングボックス内の半
透明領域(図11において、薄い影を付してある部分)
の画素である場合、ステップS97に進み、前景画像の
画素(x,y)と、背景画像の画素(x,y)とを用い
て、式(1)の演算に相当する次式で示す演算が行わ
れ、ステップS98に進む。If it is determined in step S95 that the matte value M is not 1, that is, if the pixel at the coordinates (x, y) of the matte image is in the semi-transparent area in the bounding box (in FIG. Part marked with)
In step S97, the process proceeds to step S97, using the pixel (x, y) of the foreground image and the pixel (x, y) of the background image, and calculating the following equation corresponding to the equation (1). Is performed, and the process proceeds to step S98.
【0031】 B[x,y].r=M×F[x,y].r+(1−M)×B[x,y].r B[x,y].g=M×F[x,y].g+(1−M)×B[x,y].g B[x,y].b=M×F[x,y].b+(1−M)×B[x,y].b ・・・(3)B [x, y]. r = M × F [x, y]. r + (1-M) * B [x, y]. r B [x, y]. g = M × F [x, y]. g + (1-M) * B [x, y]. g B [x, y]. b = M × F [x, y]. b + (1-M) * B [x, y]. b ... (3)
【0032】一方、ステップS94において、マット値
Mが0であると判定された場合、即ち、マット画像の座
標(x,y)の画素が、バウンディングボックス内の透
明領域(図11において、影を付していない部分)の画
素である場合、ステップS98に進み、変数xが1だけ
インクリメントされ、ステップS92に戻り、以下、同
様の処理が繰り返される。On the other hand, if it is determined in step S94 that the mat value M is 0, that is, if the pixel at the coordinates (x, y) of the mat image is in the transparent region (in FIG. If it is a pixel of a part (not attached), the process proceeds to step S98, the variable x is incremented by 1, the process returns to step S92, and the same processing is repeated thereafter.
【0033】そして、ステップS92において、変数x
が、XR以下でないと判定された場合、即ち、変数yで
y座標が表されるラインを構成する画素のうち、バウン
ディングボックス内にあるものすべてを対象に処理を行
った場合、リターンする。Then, in step S92, the variable x
Is determined not to be equal to or smaller than XR, that is, when the processing is performed on all of the pixels constituting the line whose y coordinate is represented by the variable y and which are within the bounding box, the process returns.
【0034】なお、式(2)および(3)から分かるよ
うに、合成画像は、背景画像がセットされていた変数B
[x,y]にセットされる。As can be seen from equations (2) and (3), the composite image is a variable B in which the background image is set.
Set to [x, y].
【0035】以上のように、バウンディングボックスを
用いた場合には、そのバウンディングボックスの外部の
領域に対応する画素については、加算や乗算を施す必要
がないから、演算対象を少なくすることができる。しか
しながら、バウンディングボックス内の画素は、基本的
に、式(1)の演算の対象とする必要がある。As described above, when a bounding box is used, it is not necessary to perform addition or multiplication on pixels corresponding to an area outside the bounding box, so that the number of calculation targets can be reduced. However, pixels in the bounding box basically need to be subjected to the operation of the equation (1).
【0036】そこで、図13に示した一行計算処理で
は、バウンディングボックス内の画素について、画素ご
とに、マット値Mを判定し(ステップS94,S9
5)、その値が0または1のいずれか場合には、式
(1)の演算の対象から除外するようにしているが、こ
の場合、バウンディングボックス内の画素すべてについ
て、マット値Mの判定を行う必要があり、効率的である
とはいえない。Therefore, in the one-line calculation process shown in FIG. 13, the mat value M is determined for each pixel in the bounding box (steps S94 and S9).
5) If the value is either 0 or 1, it is excluded from the calculation of Expression (1). In this case, the mat value M is determined for all the pixels in the bounding box. Must be done and is not efficient.
【0037】ここで、例えば、特開平8−115413
号公報には、ページ記述言語における図形画像合成処理
において、領域抽出演算に用いられるマット値が、完全
に不透明であることを表しているときには、本来行うべ
き演算操作を、それにより短時間で行うことができるク
リッピング処理操作に置き換える方法が開示されてお
り、クリッピング処理操作というのは、コピーに等しい
から、この方法によれば、処理を、高速に行うことがで
きる。Here, for example, Japanese Patent Application Laid-Open No. 8-115413
Japanese Patent Application Laid-Open Publication No. H11-157556 discloses that in a graphic image synthesizing process in a page description language, when a mat value used for a region extraction operation indicates that it is completely opaque, an operation operation that should be performed is performed in a short time. There is disclosed a method of replacing the clipping operation with a clipping operation that can be performed. Since the clipping operation is equivalent to copying, the method can perform the processing at high speed.
【0038】しかしながら、この方法は、マット値が0
または1の2値のみ取り得ることを前提としている。However, in this method, the mat value is 0
Alternatively, it is assumed that only two values of 1 can be taken.
【0039】一方、映画等の制作では、合成画像の自然
さを確保するため(不自然さを低減するため)、マット
値として、0と1の2値だけでなく、その間の中間値も
取り得る、いわゆるソフトキーと呼ばれるものが用いら
れるのが一般的である。On the other hand, in the production of a movie or the like, in order to ensure the naturalness of the composite image (to reduce unnaturalness), not only two values of 0 and 1 but also an intermediate value between them are taken as mat values. Generally, what is called a so-called soft key is used.
【0040】従って、映画等の制作においては、特開平
8−115413号公報に開示されている方法を適用す
るのは、合成画像の画質等の面から困難である。Therefore, in producing a movie or the like, it is difficult to apply the method disclosed in Japanese Patent Application Laid-Open No. Hei 8-115413 from the viewpoint of the image quality of a composite image and the like.
【0041】本発明は、このような状況に鑑みてなされ
たものであり、画像の合成を、効率良く行うことができ
るようにするものである。The present invention has been made in view of such a situation, and it is an object of the present invention to efficiently combine images.
【0042】[0042]
【課題を解決するための手段】請求項1に記載の画像合
成装置は、マット画像に対して、所定の範囲の最小値で
ないマット値すべてを包含する第1の領域と、所定の範
囲の最大値のマット値のみからなる第2の領域とを設定
する設定手段と、第1の領域の外部の領域、第1の領域
のうちの第2の領域でない領域、および第2の領域の3
つの領域それぞれに対応する第1および第2の画像につ
いて、画像合成のための合成処理を施す処理手段とを備
えることを特徴とする。According to a first aspect of the present invention, there is provided an image synthesizing apparatus, comprising: a first area including all mat values which are not a minimum value in a predetermined range; Setting means for setting a second area consisting only of a value mat value, an area outside the first area, an area other than the second area of the first area, and a third area.
Processing means for performing synthesis processing for image synthesis on the first and second images corresponding to each of the three regions.
【0043】請求項8に記載の画像合成方法は、マット
画像に対して、所定の範囲の最小値でないマット値すべ
てを包含する第1の領域と、所定の範囲の最大値のマッ
ト値のみからなる第2の領域とを設定する設定ステップ
と、第1の領域の外部の領域、第1の領域のうちの第2
の領域でない領域、および第2の領域の3つの領域それ
ぞれに対応する第1および第2の画像について、画像合
成のための合成処理を施す処理ステップとを備えること
を特徴とする。In the image synthesizing method according to the present invention, the matte image includes only a first area including all non-minimum mat values in a predetermined range and a maximum mat value in a predetermined range. A setting step of setting a second area of the first area, an area outside the first area, and a second area of the first area.
And a processing step of performing synthesis processing for image synthesis on the first and second images corresponding to the three areas of the non-area and the second area, respectively.
【0044】請求項9に記載の提供媒体は、マット画像
に対して、所定の範囲の最小値でないマット値すべてを
包含する第1の領域と、所定の範囲の最大値のマット値
のみからなる第2の領域とを設定する設定ステップと、
第1の領域の外部の領域、第1の領域のうちの第2の領
域でない領域、および第2の領域の3つの領域それぞれ
に対応する第1および第2の画像について、画像合成の
ための合成処理を施す処理ステップとを備える制御情報
を提供することを特徴とする。According to a ninth aspect of the present invention, the provision medium includes only a first area including all non-minimum mat values in a predetermined range and a maximum mat value in a predetermined range. A setting step of setting a second area;
For the first and second images corresponding to the three areas of the area outside the first area, the area other than the second area of the first area, and the second area, respectively, Control information comprising a processing step of performing a combining process.
【0045】請求項10に記載の画像生成装置は、マッ
ト画像に対して、所定の範囲の最小値でないマット値す
べてを包含する第1の領域と、所定の範囲の最大値のマ
ット値のみからなる第2の領域とを設定する設定手段を
備えることを特徴とする。According to a tenth aspect of the present invention, for the mat image, only the first area including all non-minimum mat values in the predetermined range and the maximum mat value in the predetermined range are used. And setting means for setting the second area.
【0046】請求項14に記載の画像生成方法は、マッ
ト画像に対して、所定の範囲の最小値でないマット値す
べてを包含する第1の領域と、所定の範囲の最大値のマ
ット値のみからなる第2の領域とを設定する設定ステッ
プを備えることを特徴とする。According to a fourteenth aspect of the present invention, in the image generation method according to the first aspect, only a first area including all non-minimum mat values in a predetermined range and a maximum mat value in a predetermined range are obtained. And a setting step of setting a second area.
【0047】請求項15に記載の提供媒体は、マット画
像に対して、所定の範囲の最小値でないマット値すべて
を包含する第1の領域と、所定の範囲の最大値のマット
値のみからなる第2の領域とを設定する設定ステップを
備える制御情報を提供することを特徴とする。According to a fifteenth aspect of the present invention, for a mat image, only a first area including all non-minimum mat values within a predetermined range and a maximum mat value within a predetermined range are provided. It is characterized by providing control information including a setting step of setting a second area.
【0048】請求項16に記載の提供媒体は、マット画
像における、所定の範囲の最小値でないマット値すべて
を包含する第1の領域と、所定の範囲の最大値のマット
値のみからなる第2の領域とを特定するための特定情報
とともに、マット画像を提供することを特徴とする。A providing medium according to a sixteenth aspect of the present invention comprises a first area in a mat image that includes all mat values that are not the minimum value in a predetermined range, and a second area that includes only a mat value having a maximum value in a predetermined range. It is characterized in that a mat image is provided together with specific information for specifying an area of the image.
【0049】請求項1に記載の画像合成装置において
は、設定手段は、マット画像に対して、所定の範囲の最
小値でないマット値すべてを包含する第1の領域と、所
定の範囲の最大値のマット値のみからなる第2の領域と
を設定し、処理手段は、第1の領域の外部の領域、第1
の領域のうちの第2の領域でない領域、および第2の領
域の3つの領域それぞれに対応する第1および第2の画
像について、画像合成のための合成処理を施すようにな
されている。[0049] In the image synthesizing apparatus according to the first aspect, the setting means may include, for the mat image, a first area including all mat values which are not the minimum value in the predetermined range, and a maximum area in the predetermined range. And a second area consisting of only the mat value of
The first and second images corresponding to the three regions of the region other than the second region and the second region are subjected to a combining process for combining images.
【0050】請求項8に記載の画像合成方法において
は、マット画像に対して、所定の範囲の最小値でないマ
ット値すべてを包含する第1の領域と、所定の範囲の最
大値のマット値のみからなる第2の領域とを設定し、第
1の領域の外部の領域、第1の領域のうちの第2の領域
でない領域、および第2の領域の3つの領域それぞれに
対応する第1および第2の画像について、画像合成のた
めの合成処理を施すようになされている。In the image synthesizing method according to the present invention, only the first area including all the non-minimum mat values in the predetermined range and the maximum mat value in the predetermined range are provided for the mat image. And a first area corresponding to the three areas of the first area, the area outside the first area, the area other than the second area, and the second area. The second image is subjected to synthesis processing for image synthesis.
【0051】請求項9に記載の提供媒体においては、マ
ット画像に対して、所定の範囲の最小値でないマット値
すべてを包含する第1の領域と、所定の範囲の最大値の
マット値のみからなる第2の領域とを設定し、第1の領
域の外部の領域、第1の領域のうちの第2の領域でない
領域、および第2の領域の3つの領域それぞれに対応す
る第1および第2の画像について、画像合成のための合
成処理を施す処理を、情報処理装置に行わせるための制
御情報を提供するようになされている。According to a ninth aspect of the present invention, in the provision medium, only the first area including all the non-minimum mat values in the predetermined range and the maximum mat value in the predetermined range are provided for the mat image. The first and second regions corresponding to the three regions of the region outside the first region, the region other than the second region of the first region, and the second region are set. The control information for causing the information processing apparatus to perform the process of performing the synthesis process for the image synthesis on the second image is provided.
【0052】請求項10に記載の画像生成装置において
は、設定手段が、マット画像に対して、所定の範囲の最
小値でないマット値すべてを包含する第1の領域と、所
定の範囲の最大値のマット値のみからなる第2の領域と
を設定するようになされている。In the image generating apparatus according to the tenth aspect, the setting means includes, for the mat image, a first area including all the non-minimum mat values in the predetermined range, and a maximum area in the predetermined range. And a second area consisting of only the mat value of the second value.
【0053】請求項14に記載の画像生成方法において
は、マット画像に対して、所定の範囲の最小値でないマ
ット値すべてを包含する第1の領域と、所定の範囲の最
大値のマット値のみからなる第2の領域とを設定するよ
うになされている。In the image generation method according to the present invention, for the mat image, only the first area including all the non-minimum mat values in the predetermined range and the maximum mat value in the predetermined range are provided. Is set.
【0054】請求項15に記載の提供媒体においては、
マット画像に対して、所定の範囲の最小値でないマット
値すべてを包含する第1の領域と、所定の範囲の最大値
のマット値のみからなる第2の領域とを設定する処理
を、情報処理装置に行わせるための制御情報を提供する
ようになされている。[0054] In the providing medium according to claim 15,
A process of setting a first area including all non-minimum mat values in a predetermined range and a second area including only the maximum mat value in a predetermined range in a mat image is performed by an information processing. It is provided to provide control information to be performed by the device.
【0055】請求項16に記載の提供媒体においては、
マット画像における、所定の範囲の最小値でないマット
値すべてを包含する第1の領域と、所定の範囲の最大値
のマット値のみからなる第2の領域とを特定するための
特定情報とともに、マット画像を提供するようになされ
ている。In the providing medium according to claim 16,
The matte image includes identification information for identifying a first area including all non-minimum mat values in a predetermined range and a second area including only the maximum matte value in a predetermined range. Images have been made available.
【0056】[0056]
【発明の実施の形態】図1は、本発明を適用した画像処
理装置の一実施の形態の構成例を示している。この画像
処理装置は、マット画像にしたがって前景画像(第1の
画像)と背景画像(第2の画像)とを合成して合成画像
を生成する画像合成装置、およびその画像合成に用いら
れるマット画像を生成する画像生成装置のいずれとして
も機能するようになされている。FIG. 1 shows a configuration example of an embodiment of an image processing apparatus to which the present invention is applied. This image processing apparatus combines an foreground image (first image) and a background image (second image) in accordance with a mat image to generate a synthesized image, and a mat image used for the image synthesis. Function as any of the image generation apparatuses that generate the image data.
【0057】即ち、ROM(Read Only Memory)1は、
例えば、IPL(Initial ProgramLoading)のためのプ
ログラムなどを記憶している。CPU(Centoral Proce
ssing Unit)2は、例えば、外部記憶装置7に記憶され
たOS(Operating System)のプログラムを読み出して
実行し、そのOSの制御の下で、やはり、外部記憶装置
7に記憶されたアプリケーションプログラムとしての合
成処理プログラムや領域情報付きマット画像生成プログ
ラムを実行することで、後述するような画像合成やマッ
ト画像(領域情報付きマット画像)の生成を行い、これ
により、画像処理装置を、画像合成装置や画像生成装置
として機能させるようになされている。RAM(Random
Access Memory)3は、CPU2が実行するプログラム
や、CPU2の処理上必要なデータを一時記憶するよう
になされている。That is, the ROM (Read Only Memory) 1
For example, it stores a program for IPL (Initial Program Loading). CPU (Centoral Proce
The ssing unit 2 reads and executes an OS (Operating System) program stored in the external storage device 7, for example, and under the control of the OS, also as an application program stored in the external storage device 7. By executing the synthesizing processing program or the matte image generation program with area information, the image synthesis apparatus generates a matte image (matte image with area information) as described later. And an image generation device. RAM (Random
The Access Memory 3 temporarily stores a program to be executed by the CPU 2 and data necessary for processing by the CPU 2.
【0058】入力装置4(操作手段)は、例えば、キー
ボードやマウス、タブレットとペンの組み合わせなどで
なり、CPU2に対して、必要なコマンドやデータを入
力するとき等に操作される。出力装置5は、例えば、C
RT(Cathode Ray Tube)や液晶ディスプレイなどで構
成され、CPU2の制御にしたがい、必要な情報の表示
を行うようになされている。外部I/F(Interface)
6は、例えば、モデムや、TA(Terminal Adapter)、
ネットワークアダプタなどでなり、外部との通信を制御
するようになされている。The input device 4 (operation means) is composed of, for example, a keyboard, a mouse, a combination of a tablet and a pen, and is operated to input necessary commands and data to the CPU 2. The output device 5 is, for example, C
It is composed of an RT (Cathode Ray Tube), a liquid crystal display, or the like, and displays necessary information under the control of the CPU 2. External I / F (Interface)
6 is, for example, a modem, a TA (Terminal Adapter),
It is made up of a network adapter and controls communication with the outside.
【0059】外部記憶装置7は、例えば、HD(Hard D
isk)や、CD(Compact Disc)などで構成され、上述
したようにOSのプログラムや、合成処理プログラム、
領域情報付きマット画像生成プログラムを記憶している
他、合成処理プログラムによる画像合成の対象となる前
景画像および背景画像や、その合成に用いられるマット
画像等を記憶している。また、外部記憶装置7は、合成
処理プログラムによる画像合成によって得られる合成画
像や、領域情報付きマット画像生成プログラムによって
生成される領域情報付きマット画像等を記憶するように
もなされている。The external storage device 7 is, for example, an HD (Hard D)
isk), CD (Compact Disc), etc., and as described above, the OS program, the synthesis processing program,
In addition to storing a matte image generation program with area information, it stores a foreground image and a background image to be subjected to image synthesis by the synthesis processing program, a matte image used for the synthesis, and the like. In addition, the external storage device 7 is also configured to store a composite image obtained by image composition by a composition processing program, a mat image with region information generated by a mat image generation program with region information, and the like.
【0060】なお、以上のデータ処理装置を構成する各
ブロックは、バスを介して、相互に接続されている。The above-mentioned blocks constituting the data processing device are interconnected via a bus.
【0061】以上のように構成される画像処理装置で
は、装置の電源がオンにされると、CPU2において、
ROM1に記憶されたIPLのプログラムが実行され、
これにより、外部記憶装置7に記憶されたOSのプログ
ラムが読み出され、RAM3上に展開されて実行され
る。そして、例えば、入力装置4の操作に応じて、CP
U2は、OSの制御の下、外部記憶装置7に記憶された
合成処理プログラムや領域情報付きマット画像生成プロ
グラムを読み出し、RAM3上に展開して実行し、これ
により、画像合成や領域情報付きマット画像の生成を行
う。In the image processing apparatus configured as described above, when the power of the apparatus is turned on, the CPU 2
The IPL program stored in the ROM 1 is executed,
Thus, the OS program stored in the external storage device 7 is read, expanded on the RAM 3 and executed. Then, for example, in response to the operation of the input device 4, the CP
U2 reads out the synthesis processing program and the matte image generation program with area information stored in the external storage device 7 under the control of the OS, and develops and executes the program on the RAM 3 to thereby execute the image synthesis and the matte with area information. Generate an image.
【0062】即ち、画像合成が行われる場合には、外部
記憶装置7に記憶された前景画像、背景画像、およびマ
ット画像が読み出され、RAM3に記憶される。そし
て、そのRAM3に記憶された前景画像、背景画像、お
よびマット画像を用いて、各種の演算等が実行されるこ
とにより、前景画像と背景画像とをマット画像にしたが
って合成した合成画像が生成される。この合成画像は、
RAM3に記憶されるか、または、外部記憶装置7に供
給されて記憶される。あるいは、合成画像は、出力装置
5に供給されて表示され、または外部I/F6に供給さ
れて、例えば、インターネットその他の伝送媒体(図示
せず)を介して伝送されることにより、他の装置等に提
供される。That is, when the image synthesis is performed, the foreground image, the background image, and the mat image stored in the external storage device 7 are read out and stored in the RAM 3. Various operations and the like are performed using the foreground image, the background image, and the matte image stored in the RAM 3 to generate a composite image in which the foreground image and the background image are synthesized in accordance with the matte image. You. This composite image
It is stored in the RAM 3 or supplied to the external storage device 7 and stored. Alternatively, the composite image is supplied to the output device 5 to be displayed, or supplied to the external I / F 6, and is transmitted, for example, via the Internet or another transmission medium (not shown), so as to be transmitted to another device. Etc. are provided.
【0063】また、領域情報付きマット画像の生成が行
われる場合には、外部記憶装置7に記憶されたマット画
像が読み出され、RAM3に供給されて記憶される。そ
して、そのマット画像に対して、各種の演算等が実行さ
れることにより、領域情報付きマット画像が生成され
る。この領域情報付きマット画像は、例えば、RAM3
から外部記憶装置7に転送されて記憶され、あるいは、
外部I/F6に供給され、例えば、インターネットその
他の伝送媒体を介して伝送されることにより、他の装置
等に提供される。また、領域情報付きマット画像の生成
後、即座に、画像合成が行われる場合には、その領域情
報付きマット画像は、RAM3に記憶された状態とされ
る。When a mat image with area information is generated, the mat image stored in the external storage device 7 is read out, supplied to the RAM 3 and stored. Then, various operations and the like are performed on the mat image to generate a mat image with region information. This mat image with area information is stored in, for example, the RAM 3
Is transferred to and stored in the external storage device 7, or
The data is supplied to the external I / F 6 and transmitted to, for example, the Internet or another transmission medium to be provided to another device or the like. In addition, when the image synthesis is performed immediately after the generation of the area information-attached mat image, the area information-attached mat image is stored in the RAM 3.
【0064】次に、図2は、前景画像と背景画像とをマ
ット画像にしたがって合成する画像合成装置として機能
する場合の、図1のデータ処理装置の機能的構成例を示
している。なお、この図2の構成は、図1のCPU2に
おいて、合成処理プログラムが実行されることにより実
現される。Next, FIG. 2 shows an example of a functional configuration of the data processing device of FIG. 1 when functioning as an image synthesizing device for synthesizing a foreground image and a background image according to a matte image. Note that the configuration in FIG. 2 is realized by executing a synthesis processing program in the CPU 2 in FIG.
【0065】前景画像記憶部11または背景画像記憶部
12には、外部記憶装置7に記憶された前景画像または
背景画像がそれぞれ供給されるようになされており、前
景画像記憶部11または背景画像記憶部12は、その前
景画像または背景画像を記憶するようになされている。
また、ここでは、前景画像と背景画像とを合成した合成
画像が、例えば、背景画像に上書きする形で記憶される
ようになされており、従って、背景画像記憶部12は、
その合成画像を記憶するようにもなされている。The foreground image storage unit 11 or the background image storage unit 12 is supplied with the foreground image or the background image stored in the external storage device 7, respectively. The unit 12 is configured to store the foreground image or the background image.
Further, here, a synthesized image obtained by synthesizing the foreground image and the background image is stored so as to overwrite the background image, for example. Therefore, the background image storage unit 12
The composite image is also stored.
【0066】マット画像記憶部13には、外部記憶装置
7に記憶されたマット画像が供給されるようになされて
おり、マット画像記憶部13は、そのマット画像を記憶
するようになされている。なお、マット画像は、例え
ば、クロマキーを用いた方法その他によって生成するこ
とができる。The mat image storage unit 13 is supplied with a mat image stored in the external storage device 7, and the mat image storage unit 13 stores the mat image. The matte image can be generated by, for example, a method using a chroma key or the like.
【0067】領域設定部14(設定手段)(出力手段)
は、マット画像記憶部13に記憶されたマット画像に対
して、0でないマット値すべてを包含するバウンディン
グボックス(以下、適宜、第1のバウンディングボック
スという)(第1の領域)と、1のマット値のみからな
るバウンディングボックス(以下、適宜、第2のバウン
ディングボックスという)(第2の領域)とを設定する
ようになされている。即ち、領域設定部14は、例え
ば、図3に示すように、マット画像記憶部13に記憶さ
れたマット画像の半透明領域(図3において、薄い影を
付してある部分)に外接する矩形の領域を、第1のバウ
ンディングボックスとして設定するとともに、その完全
不透明領域に、2つ頂点が内接する矩形の領域を、第2
のバウンディングボックスとして設定する。Area setting section 14 (setting means) (output means)
Are a first bounding box (hereinafter, appropriately referred to as a first bounding box) including all non-zero mat values with respect to the mat image stored in the mat image storage unit 13 and a first mat. A bounding box consisting only of a value (hereinafter, appropriately referred to as a second bounding box) (second region) is set. That is, for example, as shown in FIG. 3, the region setting unit 14 circumscribes a semi-transparent region (a portion with a light shadow in FIG. 3) of the mat image stored in the mat image storage unit 13. Is set as the first bounding box, and a rectangular area whose two vertices are inscribed in the completely opaque area is set as the second bounding box.
Set as the bounding box of.
【0068】なお、図3は、前述の図11と同一のマッ
ト画像を示している。そして、図3においても、図11
における場合と同様の座標系をとり、第1のバウンディ
ングボックスの左下または右上の頂点の座標を、それぞ
れ、(Xmin1,Ymin1)または(Xmax1,Ymax1)と表
す。また、第2のバウンディングボックスの左下または
右上の頂点の座標を、それぞれ、(Xmin2,Ymin2)ま
たは(Xmax2,Ymax2)と表す。さらに、マット画像の
横または縦の画素数は、それぞれWまたはH画素である
とする。また、前景画像および背景画像の横または縦の
画素数も、それぞれWまたはH画素であるとする。さら
に、座標(画素)(x,y)のマット値は、配列変数
(2次元配列変数)matte[x,y]で表されるも
のとし、前景画像および背景画像の画素値は、R,G,
Bの3つの色成分が連続したパックトピクセル形式で表
されるものとする。また、前景画像または背景画像の画
素(x,y)の画素値を、それぞれ、構造体とされた配
列変数F[x,y]またはB[x,y]で表し、さら
に、前景画像の画素(x,y)のR,G,B成分は、F
[x,y].r,F[x,y].g,F[x,y].b
で、背景画像の画素(x,y)のR,G,B成分は、B
[x,y].r,B[x,y].g,B[x,y].b
で、それぞれ表されるものとする。ここで、x=0,
1,・・・,W−1であり、y=0,1,・・・,H−
1である。FIG. 3 shows the same mat image as that of FIG. 11 described above. In FIG. 3, FIG.
In the same coordinate system as in the case of, the coordinates of the lower left or upper right vertex of the first bounding box are expressed as (X min1 , Y min1 ) or (X max1 , Y max1 ), respectively. Also, the coordinates of the lower left or upper right vertex of the second bounding box are represented as (X min2 , Y min2 ) or (X max2 , Y max2 ), respectively. Further, it is assumed that the number of horizontal or vertical pixels of the mat image is W or H pixels, respectively. It is also assumed that the number of horizontal or vertical pixels of the foreground image and the background image is also W or H pixels, respectively. Furthermore, the mat value of the coordinates (pixel) (x, y) is represented by an array variable (two-dimensional array variable) matte [x, y], and the pixel values of the foreground image and the background image are R, G ,
It is assumed that the three color components B are represented in a continuous packed pixel format. The pixel value of the pixel (x, y) of the foreground image or the background image is represented by an array variable F [x, y] or B [x, y] as a structure, respectively. The R, G, B components of (x, y) are F
[X, y]. r, F [x, y]. g, F [x, y]. b
And the R, G, B components of the pixel (x, y) of the background image are B
[X, y]. r, B [x, y]. g, B [x, y]. b
, Respectively. Where x = 0,
, W-1 and y = 0, 1,..., H-
It is one.
【0069】領域設定部14は、第1および第2のバウ
ンディングボックスを設定すると、それぞれを特定する
ための領域情報(特定情報)を求め、マット画像ととも
に、レンダリング部15に供給するようになされてい
る。このように、領域設定部14からは、第1および第
2のバウンディングボックスの領域情報を含むマット画
像が出力されるが、これが、領域情報付きマット画像で
あり、従って、領域設定部14は、CPU2が、領域情
報付きマット画像生成プログラムを実行することで実現
される。領域情報付きマット画像は、レンダリング部1
5に供給する他、上述したように、外部記憶装置7に供
給して記憶させたり、また、外部I/F6を介して、他
の装置に提供すること等が可能である。After setting the first and second bounding boxes, the area setting unit 14 obtains area information (specific information) for specifying each of the bounding boxes, and supplies the area information (specific information) to the rendering unit 15 together with the matte image. I have. As described above, the area setting unit 14 outputs a matte image including the area information of the first and second bounding boxes. This is a matte image with area information. This is realized by the CPU 2 executing a mat image generation program with area information. The matte image with area information is rendered by the rendering unit 1
5, it can be supplied to and stored in the external storage device 7 as described above, or can be provided to another device via the external I / F 6.
【0070】レンダリング部15(処理手段)は、図3
に示した第1のバウンディングボックスの外部の領域
(以下、適宜、外部領域という)、第1のバウンディン
グボックスの領域のうちの第2のバウンディングボック
スでない領域(以下、適宜、中間領域という)、および
第2のバウンディングボックスの領域(以下、適宜、内
部領域という)の3つの領域それぞれに対応する前景画
像および背景画像について、画像合成のための合成処理
を施し、その結果得られる合成画像を、背景画像記憶部
12に、そこに記憶された背景画像に上書きする形で書
き込むようになされている。The rendering unit 15 (processing means)
, An area outside the first bounding box (hereinafter, appropriately referred to as an external area), an area of the first bounding box that is not the second bounding box (hereinafter, appropriately referred to as an intermediate area), and The foreground image and the background image corresponding to each of the three regions of the second bounding box region (hereinafter, appropriately referred to as an internal region) are subjected to a synthesis process for image synthesis, and the resultant synthesized image is set as a background image. The image is written in the image storage unit 12 so as to overwrite the background image stored therein.
【0071】次に、図4のフローチャートを参照して、
図2の画像合成装置の処理について説明する。Next, referring to the flowchart of FIG.
The processing of the image combining device in FIG. 2 will be described.
【0072】まず最初に、ステップS1において、外部
記憶装置7に記憶された前景画像、背景画像、またはマ
ット画像が読み出され、前景画像記憶部11、背景画像
記憶部12、またはマット画像記憶部13にそれぞれ供
給されて記憶され、ステップS2に進む。First, in step S1, the foreground image, the background image, or the matte image stored in the external storage device 7 is read, and the foreground image storage unit 11, the background image storage unit 12, or the matte image storage unit is read. 13 and stored therein, and then proceeds to step S2.
【0073】ステップS2では、領域設定部14におい
て、マット画像記憶部13に記憶されたマット画像が読
み出され、そのマット画像に対して、第1および第2の
バウンディングボックスが設定される。即ち、例えば、
領域設定部14は、マット画像を出力装置5に供給し、
グレイスケール画像として表示させる。ユーザは、その
グレイスケール画像を見ながら、入力装置4を操作する
ことより、第1および第2のバウンディングボックスを
指定し、領域設定部14は、この指定にしたがって、第
1および第2のバウンディングボックスを設定する。In step S2, the area setting section 14 reads out the matte image stored in the matte image storage section 13, and sets the first and second bounding boxes for the matte image. That is, for example,
The area setting unit 14 supplies the mat image to the output device 5,
Display as a grayscale image. The user specifies the first and second bounding boxes by operating the input device 4 while viewing the grayscale image, and the area setting unit 14 sets the first and second bounding boxes in accordance with the specification. Set the box.
【0074】具体的には、ユーザは、例えば、第1およ
び第2のバウンディングボックスの左下の頂点と右下の
頂点を指定する。あるいは、例えば、第1および第2の
バウンディングボックスの左下の頂点と、横および縦の
長さ、あるいは対角線の長さを指定する。領域設定部1
4では、このようなユーザの指定にしたがって、矩形の
第1および第2のバウンディングボックスが設定され
る。Specifically, the user specifies, for example, the lower left vertex and the lower right vertex of the first and second bounding boxes. Alternatively, for example, the lower left vertex of the first and second bounding boxes and the horizontal and vertical lengths or the diagonal length are specified. Area setting unit 1
In 4, the first and second rectangular bounding boxes are set according to the user's designation.
【0075】領域設定部14は、第1、第2のバウンデ
ィングボックスを設定すると、それを特定するための領
域情報として、例えば、図3に示したような、それぞれ
の左下の頂点(Xmin1,Ymin1),(Xmin2,Ymin2)
と、右上の頂点(Xmax1,Ymax1),(Xmax2,
Ymax2)を求め、マット画像とともに、レンダリング部
15に出力する。即ち、領域設定部14は、領域情報付
きマット画像を、レンダリング部15に供給する。When the first and second bounding boxes are set, the area setting unit 14 sets, as area information for specifying the first and second bounding boxes, for example, the respective lower left vertices (X min1 , X min1 , Y min1 ), (X min2 , Y min2 )
And the upper right vertex (X max1 , Y max1 ), (X max2 ,
Y max2 ) is obtained and output to the rendering unit 15 together with the matte image. That is, the area setting unit 14 supplies the matte image with the area information to the rendering unit 15.
【0076】レンダリング部15は、領域情報付きマッ
ト画像を受信すると、ステップS3において、y座標を
表す変数yを、Ymin1に初期化し、ステップS4に進
み、変数yが、Ymin2より小さいかどうかを判定する。
ステップS4において、変数yが、Ymin2より小さいと
判定された場合、即ち、変数yが、Ymin1以上Ymin2未
満である場合、ステップS5に進み、一行計算処理を行
う一行計算サブルーチンが、変数y、並びに第1のバウ
ンディングボックスの左右の境界のx座標Xmin1および
Xmax1の3つの変数の並びを引数として呼び出される。Upon receiving the area information-attached mat image, the rendering unit 15 initializes a variable y representing the y coordinate to Y min1 in step S3, and proceeds to step S4 to determine whether the variable y is smaller than Y min2 . Is determined.
If it is determined in step S4 that the variable y is smaller than Y min2 , that is, if the variable y is equal to or more than Y min1 and less than Y min2 , the process proceeds to step S5, and the one-line calculation subroutine for performing the one-line calculation process includes the variable y and a list of three variables of x coordinates X min1 and X max1 on the left and right borders of the first bounding box are called as arguments.
【0077】そして、ステップS5における一行計算処
理が終了すると、ステップS6に進み、変数yが1だけ
インクリメントされる。そして、ステップS4に戻り、
以下、ステップS4で、変数yがYmin2より小さくない
と判定されるまで、ステップS4乃至S6の処理が繰り
返される。When the one-line calculation process in step S5 is completed, the process proceeds to step S6, where the variable y is incremented by one. Then, returning to step S4,
Hereinafter, the processing of steps S4 to S6 is repeated until it is determined in step S4 that the variable y is not smaller than Y min2 .
【0078】即ち、y座標が、第1のバウンディングボ
ックスの左下の頂点のy座標であるYmin1未満のライン
(行)は、外部領域(図3)の画素だけで構成され、外
部領域には、透明領域(マット値が0の領域)しか含ま
れない。そして、ここでは、上述したように、背景画像
に上書きする形で合成画像を生成するので、そのような
透明領域のラインを構成する画素については、背景画像
記憶部12に記憶された背景画像の画素値をそのまま用
いることができ、特に処理を行う必要はない。That is, a line (row) whose y coordinate is smaller than Y min1 which is the y coordinate of the lower left vertex of the first bounding box is composed of only pixels in the external area (FIG. 3), , Only transparent areas (areas with a mat value of 0) are included. In this case, as described above, since the composite image is generated by overwriting the background image, the pixels constituting the line of such a transparent region are not included in the background image stored in the background image storage unit 12. The pixel value can be used as it is, and no special processing is required.
【0079】また、y座標が、第1のバウンディングボ
ックスの左下の頂点のy座標であるYmin1以上で、かつ
第2のバウンディングボックスの左下の頂点のy座標で
あるYmin2未満のラインを構成する画素のうち、そのx
座標が、第1のバウンディングボックスの左下の頂点の
x座標であるXmin1未満の画素、およびその右上の頂点
のx座標であるXmax1より大きい画素も、外部領域(図
3)の画素であり、やはり、そのような画素について
は、背景画像記憶部12に記憶された背景画像の画素値
をそのまま用いることができるため、特に処理を行う必
要はない。A line whose y coordinate is equal to or more than Y min1 which is the y coordinate of the lower left vertex of the first bounding box and less than Y min2 which is the y coordinate of the lower left vertex of the second bounding box is formed. X
Pixels whose coordinates are smaller than X min1 which is the x coordinate of the lower left vertex of the first bounding box, and pixels whose coordinate is larger than X max1 which is the x coordinate of the upper right vertex thereof are also pixels of the external region (FIG. 3). Again, for such a pixel, the pixel value of the background image stored in the background image storage unit 12 can be used as it is, so that no special processing is required.
【0080】さらに、y座標が、Ymin1以上Ymin2未満
のラインを構成する画素のうち、そのx座標が、第1の
バウンディングボックスの左下の頂点のx座標であるX
min1以上で、かつその右上の頂点のx座標であるXmax1
以下の画素は、中間領域(図3)の画素であり、中間領
域には、半透明領域(マット値が0より大きく、かつ1
より小さい領域)が含まれる可能性があるため、式
(1)の演算の対象とする必要がある。そこで、ステッ
プS5において、そのような画素(y座標がYmin1以上
Ymin2未満のラインを構成する画素のうち、x座標がX
min1以上Xmax1以下のもの)のみを対象にして、一行計
算処理が行われる。Further, among the pixels constituting the line whose y coordinate is not less than Y min1 and less than Y min2 , the x coordinate is X coordinate of the lower left vertex of the first bounding box.
X max1 that is the x coordinate of the upper right vertex that is not less than min1
The following pixels are pixels in the intermediate area (FIG. 3), and the intermediate area includes a translucent area (a matte value larger than 0 and 1).
(Smaller area) may be included, so it is necessary to calculate the equation (1). Therefore, in step S5, such a pixel (of the pixels constituting the line whose y coordinate is not less than Y min1 and less than Y min2 , the x coordinate is X
min1 or X max1 less) only intended for, line calculation process is performed.
【0081】ここで、図5のフローチャートは、図4の
ステップS5における一行計算処理の詳細を示してい
る。一行計算サブルーチンは、上述したように、3つの
変数の並びを引数として呼び出されるが、図5の実施の
形態では、その3つの変数の並びが、変数y,XL,X
Rに対応している。Here, the flowchart of FIG. 5 shows details of the one-line calculation process in step S5 of FIG. As described above, the one-line calculation subroutine is called with a sequence of three variables as arguments. In the embodiment of FIG. 5, the sequence of the three variables is represented by variables y, XL, and X.
It corresponds to R.
【0082】一行計算処理では、まず最初に、ステップ
S21において、x座標を表す変数xが、XLに初期化
され、ステップS22に進み、変数xが、XR以下であ
るかどうかが判定される。ステップS22において、変
数xが、XR以下であると判定された場合、ステップS
23に進み、レンダリング部15において、変数Mに、
マット画像記憶部13に記憶されたマット画像の、座標
(画素)(x,y)のマット値matte[x,y]が
セットされる。In the one-line calculation process, first, in step S21, a variable x representing the x coordinate is initialized to XL, and the flow advances to step S22 to determine whether the variable x is equal to or smaller than XR. If it is determined in step S22 that the variable x is equal to or smaller than XR, the process proceeds to step S22.
23, and in the rendering unit 15, the variable M
In the mat image stored in the mat image storage unit 13, a mat value matte [x, y] of coordinates (pixels) (x, y) is set.
【0083】そして、ステップS24に進み、レンダリ
ング部15において、マット値Mが0であるかどうかが
判定され、0でないと判定された場合、ステップS25
に進み、マット値Mが1であるかどうかが判定される。
ステップS25において、マット値Mが1であると判定
された場合、ステップS26に進み、レンダリング部1
5において、背景画像記憶部12に記憶された背景画像
の画素(x,y)の画素値B[x,y]に、前景画像記
憶部11に記憶された前景画像の画素(x,y)の画素
値F[x,y]がコピーされ、ステップS28に進む。
即ち、ステップS26では、前述の式(2)に示した演
算が行われ、ステップS28に進む。Then, the process proceeds to step S24, where the rendering unit 15 determines whether or not the mat value M is 0. If it is determined that the mat value M is not 0, the process proceeds to step S25.
To determine whether the mat value M is 1.
If it is determined in step S25 that the mat value M is 1, the process proceeds to step S26, where the rendering unit 1
At 5, the pixel value B [x, y] of the pixel (x, y) of the background image stored in the background image storage unit 12 is added to the pixel (x, y) of the foreground image stored in the foreground image storage unit 11. Is copied, and the process proceeds to step S28.
That is, in step S26, the calculation shown in the above equation (2) is performed, and the process proceeds to step S28.
【0084】また、ステップS25において、マット値
Mが1でないと判定された場合、ステップS27に進
み、レンダリング部15において、前景画像記憶部11
に記憶された前景画像の画素(x,y)と、背景画像記
憶部12に記憶された背景画像の画素(x,y)とを用
いて、前述の式(3)に示した演算が行われ、ステップ
S28に進む。If it is determined in step S25 that the mat value M is not 1, the process proceeds to step S27, where the rendering unit 15 causes the foreground image storage unit 11
Using the pixel (x, y) of the foreground image stored in the background image storage unit 12 and the pixel (x, y) of the background image stored in the background image storage unit 12, the calculation represented by the above-described equation (3) is performed. Then, the process proceeds to step S28.
【0085】一方、ステップS24において、マット値
Mが0であると判定された場合、ステップS28に進
み、変数xが1だけインクリメントされ、ステップS2
2に戻り、以下、同様の処理が繰り返される。On the other hand, if it is determined in step S24 that the mat value M is 0, the process proceeds to step S28, where the variable x is incremented by 1, and the process proceeds to step S2.
2, the same process is repeated.
【0086】そして、ステップS22において、変数x
が、XR以下でないと判定された場合、リターンする。Then, in step S22, the variable x
Is determined to be not less than or equal to XR.
【0087】図4に戻り、ステップS4において、変数
yがYmin2より小さくないと判定されると、ステップS
7に進み、レンダリング部15において、変数yが、Y
min2に初期化され、ステップS8に進み、変数yが、Y
max2以下であるかどうかが判定される。ステップS8に
おいて、変数yが、Ymax2以下であると判定された場
合、即ち、変数yが、Ymin2以上Ymax2以下である場
合、ステップS9に進み、図5に示した一行計算処理を
行う一行計算サブルーチンが、変数y、第1のバウンデ
ィングボックスの左の境界のx座標Xmin1、および第2
のバウンディングボックスの左の境界のx座標Xmin1−
1を引数として呼び出される。Referring back to FIG. 4, if it is determined in step S4 that the variable y is not smaller than Y min2, the process proceeds to step S4.
7, the rendering unit 15 sets the variable y to Y
The variable y is initialized to min2, and the process proceeds to step S8.
It is determined whether it is less than or equal to max2 . If it is determined in step S8 that the variable y is equal to or smaller than Ymax2 , that is, if the variable y is equal to or larger than Ymin2 and equal to or smaller than Ymax2 , the process proceeds to step S9 to perform the one-line calculation process illustrated in FIG. The one-line calculation subroutine calculates the variable y, the x coordinate X min1 of the left boundary of the first bounding box, and the second
X coordinate of the left boundary of the bounding box of X min1 −
Called with 1 as an argument.
【0088】そして、ステップS9における一行計算処
理が終了すると、ステップS10に進み、レンダリング
部15は、前景画像記憶部11に記憶された前景画像の
画素値F[Xmin2,y]乃至F[Xmax2,y]を、背景
画像記憶部12に記憶された背景画像の画素値B[X
min2,y]乃至B[Xmax2,y]にコピーし、ステップ
S11に進む。When the one-line calculation process in step S 9 is completed, the process proceeds to step S 10, where the rendering unit 15 determines the pixel values F [X min2 , y] to F [X] of the foreground image stored in the foreground image storage unit 11. max2 , y] is converted to the pixel value B [X of the background image stored in the background image storage unit 12.
min2 , y] to B [ Xmax2 , y], and then proceeds to step S11.
【0089】ステップS11では、図5に示した一行計
算処理を行う一行計算サブルーチンが、変数y、第2の
バウンディングボックスの右の境界のx座標Xmax2+
1、および第1のバウンディングボックスの右の境界の
x座標Xmax1を引数として呼び出される。In step S11, the one-line calculation subroutine for performing the one-line calculation process shown in FIG. 5 includes a variable y, an x coordinate X max2 + of the right boundary of the second bounding box.
1 and called with the x coordinate X max1 of the right boundary of the first bounding box as arguments.
【0090】そして、ステップS11における一行計算
処理が終了すると、ステップS12に進み、レンダリン
グ部15において、変数yが1だけインクリメントされ
る。そして、ステップS8に戻り、以下、ステップS8
で、変数yがYmax2以下でないと判定されるまで、ステ
ップS8乃至S12の処理が繰り返される。When the one-line calculation process in step S11 is completed, the process proceeds to step S12, where the rendering unit 15 increments the variable y by one. Then, the process returns to step S8, and thereafter, step S8
Then, the processing of steps S8 to S12 is repeated until it is determined that the variable y is not equal to or less than Ymax2 .
【0091】即ち、y座標が、第2のバウンディングボ
ックスの左下の頂点のy座標であるYmin2以上、かつ第
2のバウンディングボックスの右上の頂点のy座標であ
るYmax2以下のラインを構成する画素のうち、そのx座
標が、第1のバウンディングボックスの左下の頂点のx
座標であるXmin1未満の画素、および第1のバウンディ
ングボックスの右上の頂点のx座標であるXmax1より大
きい画素は、外部領域(図3)の画素であり、外部領域
には、透明領域しか含まれない。そして、ここでは、上
述したように、背景画像に上書きする形で合成画像を生
成するので、透明領域の画素については、背景画像記憶
部12に記憶された背景画像の画素値をそのまま用いる
ことができ、特に処理を行う必要はない。That is, a line whose y coordinate is not less than Y min2 which is the y coordinate of the lower left vertex of the second bounding box and not more than Y max2 which is the y coordinate of the upper right vertex of the second bounding box is formed. Among the pixels, the x coordinate is the x of the lower left vertex of the first bounding box.
Pixels smaller than X min1 which is coordinates and pixels larger than X max1 which is the x coordinate of the upper right vertex of the first bounding box are pixels in the external region (FIG. 3), and only the transparent region is included in the external region. Not included. Then, as described above, since the composite image is generated by overwriting the background image, the pixel value of the background image stored in the background image storage unit 12 can be used as it is for the pixels in the transparent area. Yes, no special processing is required.
【0092】また、y座標がYmin2以上Ymax2以下のラ
インを構成する画素のうち、そのx座標が、第1のバウ
ンディングボックスの左下の頂点のx座標であるXmin1
以上で、かつ第2のバウンディングボックスの左下の頂
点のx座標であるXmin2未満の画素、および第2のバウ
ンディングボックスの右上の頂点のx座標であるXma x2
より大きく、かつ第1のバウンディングボックスの右上
の頂点のx座標であるXmax1以下の画素は、中間領域
(図3)の画素であり、中間領域には、半透明領域が含
まれる可能性があるため、式(1)の演算の対象とする
必要がある。そこで、ステップS9およびS11におい
て、そのような画素のみを対象にして、一行計算処理が
行われる。Further, among the pixels forming the line whose y coordinate is not less than Y min2 and not more than Y max2 , the x coordinate is X min1 which is the x coordinate of the lower left vertex of the first bounding box.
Pixels smaller than X min2, which is the x coordinate of the lower left vertex of the second bounding box, and X max x2, which is the x coordinate of the upper right vertex of the second bounding box
Pixels that are larger and are smaller than or equal to X max1 that is the x coordinate of the upper right vertex of the first bounding box are pixels in the intermediate region (FIG. 3), and the intermediate region may include a translucent region. Therefore, it is necessary to be the target of the calculation of the expression (1). Therefore, in steps S9 and S11, one-line calculation processing is performed only on such pixels.
【0093】さらに、y座標がYmin2以上Ymax2以下の
ラインを構成する画素のうち、そのx座標が、第2のバ
ウンディングボックスの左下の頂点のx座標であるX
min2以上で、かつその右上の頂点のx座標であるXmax2
以下の画素は、内部領域(図3)の画素であり、内部領
域には、完全不透明領域(マット値が1の領域)しか含
まれない。そして、ここでは、上述したように、背景画
像に上書きする形で合成画像を生成するので、完全不透
明領域の画素については、前景画像記憶部11に記憶さ
れた前景画像の画素をコピーすれば済む。そこで、ステ
ップS10において、そのような画素については、前景
画像記憶部11に記憶された前景画像の画素値が、背景
画像記憶部12にコピーされる。Further, among the pixels constituting the line whose y coordinate is not less than Y min2 and not more than Y max2 , the x coordinate thereof is the X coordinate of the lower left vertex of the second bounding box.
X max2 that is the x coordinate of the vertex at the upper right that is not less than min2
The following pixels are pixels in an internal area (FIG. 3), and the internal area includes only a completely opaque area (an area having a mat value of 1). In this case, as described above, since the composite image is generated by overwriting the background image, the pixels of the foreground image stored in the foreground image storage unit 11 need only be copied for the pixels in the completely opaque area. . Thus, in step S10, for such a pixel, the pixel value of the foreground image stored in the foreground image storage unit 11 is copied to the background image storage unit 12.
【0094】その後、ステップS8において、変数y
が、Ymax2より小さくないと判定されると、ステップS
13に進み、レンダリング部15は、y座標を表す変数
yを、Ymax2+1に初期化し、ステップS14に進む。
ステップS14では、レンダリング部15において、変
数yが、Ymax1以下であるかどうかが判定される。ステ
ップS14において、変数yが、Ymax1より小さいと判
定された場合、即ち、変数yが、Ymax2以上Ymax1未満
である場合、ステップS15に進み、図5に示した一行
計算処理を行う一行計算サブルーチンが、変数y,X
min1,Xmax1を引数として呼び出される。Then, in step S8, the variable y
Is not smaller than Y max2 , step S
Proceeding to 13, the rendering unit 15 initializes the variable y representing the y coordinate to Y max2 +1 and proceeds to step S14.
In step S14, the rendering unit 15 determines whether the variable y is equal to or smaller than Y max1 . In step S14, when it is determined that the variable y is smaller than Y max1 , that is, when the variable y is equal to or larger than Y max2 and smaller than Y max1 , the process proceeds to step S15, where one line for performing the one-line calculation process shown in FIG. The calculation subroutine uses the variables y and X
min1, called the X max1 as an argument.
【0095】そして、ステップS15における一行計算
処理が終了すると、ステップS16に進み、変数yが1
だけインクリメントされる。そして、ステップS14に
戻り、以下、ステップS14で、変数yがYmax1以下で
ないと判定されるまで、ステップS14乃至S16の処
理が繰り返される。When the one-line calculation process in step S15 is completed, the process proceeds to step S16, where the variable y is set to 1
Is only incremented. Then, the process returns to step S14, and thereafter , the processing of steps S14 to S16 is repeated until it is determined in step S14 that the variable y is not equal to or less than Y max1 .
【0096】即ち、y座標が、Ymax2以上Ymax1以下の
ラインを構成する画素のうち、そのx座標が、Xmin1未
満の画素、およびXmax1より大きい画素は、外部領域
(図3)の画素であり、そのような画素については、背
景画像記憶部12に記憶された背景画像の画素値をその
まま用いることができるため、特に処理を行う必要はな
い。That is, of the pixels forming the line whose y coordinate is not less than Y max2 and not more than Y max1, the pixel whose x coordinate is smaller than X min1 and the pixel larger than X max1 are located in the outer region (FIG. 3). It is a pixel, and for such a pixel, the pixel value of the background image stored in the background image storage unit 12 can be used as it is.
【0097】また、y座標が、Ymax2以上Ymax1以下の
ラインを構成する画素のうち、そのx座標が、Xmin1以
上Xmax1以下の画素は、中間領域(図3)の画素であ
り、中間領域には、半透明領域が含まれる可能性がある
ため、式(1)の演算の対象とする必要がある。そこ
で、ステップS15において、そのような画素のみを対
象にして、一行計算処理が行われる。[0097] In addition, y coordinates, of the pixels constituting the Y max2 or Y max1 following line, the x-coordinate, X min1 or X max1 following pixel is the pixel of the intermediate region (Fig. 3), Since the intermediate area may include a translucent area, the intermediate area needs to be the target of the calculation of Expression (1). Therefore, in step S15, a one-line calculation process is performed on only such pixels.
【0098】そして、ステップS14において、変数y
がYmax1以下でないと判定されると、ステップS17に
進み、背景画像記憶部12に記憶された合成画像が、外
部記憶装置7に書き込まれ、処理を終了する。Then, in step S14, the variable y
If it is determined that is not less than or equal to Y max1, the process proceeds to step S17, where the composite image stored in the background image storage unit 12 is written to the external storage device 7, and the process ends.
【0099】即ち、y座標が、Ymax1より大きいライン
は、外部領域(図3)の画素だけで構成され、外部領域
には、透明領域しか含まれない。そして、ここでは、上
述したように、背景画像に上書きする形で合成画像を生
成するので、そのような透明領域のラインを構成する画
素については、背景画像記憶部12に記憶された背景画
像の画素値をそのまま用いることができ、特に処理を行
う必要はない。That is, a line whose y coordinate is larger than Y max1 is composed of only pixels in the outer region (FIG. 3), and the outer region includes only a transparent region. In this case, as described above, since the composite image is generated by overwriting the background image, the pixels constituting the line of such a transparent region are not included in the background image stored in the background image storage unit 12. The pixel value can be used as it is, and no special processing is required.
【0100】従って、y座標を表す変数yがYmax1以下
でなくなった時点で、背景画像記憶部12には、前景画
像と背景画像とを、マット画像にしたがって合成した合
成画像が記憶されており、ステップS17では、その合
成画像が、外部記憶装置7に書き込まれる(あるいは、
出力装置5に表示される)。Therefore, when the variable y representing the y coordinate is no longer less than Y max1 , the background image storage unit 12 stores a synthesized image obtained by synthesizing the foreground image and the background image according to the matte image. In step S17, the composite image is written in the external storage device 7 (or
Displayed on the output device 5).
【0101】以上のように、マット画像に対して、第1
および第2のバウンディングボックスを設定し、第1の
バウンディングボックスの外部の領域(外部領域)、第
1のバウンディングボックスの領域のうちの第2のバウ
ンディングボックスでない領域(中間領域)、および第
2のバウンディングボックス(内部領域)の3つの領域
それぞれに対応する前景画像および背景画像について、
画像合成のための処理を施すようにしたので、画像の合
成を、効率良く行うことができる。As described above, for the matte image, the first
And setting a second bounding box, a region outside the first bounding box (outer region), a region of the first bounding box that is not the second bounding box (intermediate region), and a second Regarding the foreground image and the background image corresponding to each of the three regions of the bounding box (inner region),
Since processing for image synthesis is performed, image synthesis can be performed efficiently.
【0102】即ち、従来においては、第1のバウンディ
ングボックス内の画素を、式(1)の演算の対象とする
必要があったのに対して、図2(図1)の画像処理装置
によれば、第1のバウンディングボックス内の画素のう
ちの、第2のバウンディングボックス内の画素を除いた
ものだけを、式(1)の演算の対象とすれば良く、第2
のバウンディングボックス内の画素については、コピー
を行うだけで済む。That is, conventionally, the pixel in the first bounding box had to be subjected to the operation of the equation (1), whereas the image processing apparatus of FIG. For example, of the pixels in the first bounding box, only the pixels in the second bounding box excluding the pixels in the second bounding box may be subjected to the calculation of the equation (1).
For the pixels in the bounding box, only copying is necessary.
【0103】なお、図4のステップS10における前景
画像の画素値の、背景画像記憶部12へのコピーは、例
えば、図1の画像処理装置において、メモリブロックコ
ピーを行うサブルーチンプログラムが用意されている場
合等には、そのサブルーチンをコールすることで行うこ
とが可能である。即ち、メモリブロックコピーは、一般
に、複数バイト単位で、データを効率良くコピー(一括
でコピー)することができ、前景画像の画素値を、1画
素単位で、背景画像記憶部12へのコピーするような場
合に比較して効率良くコピーを行うことが可能となる。For copying the pixel values of the foreground image to the background image storage unit 12 in step S10 in FIG. 4, for example, a subroutine program for performing a memory block copy is prepared in the image processing apparatus in FIG. In such cases, it can be performed by calling the subroutine. That is, in general, the memory block copy can efficiently copy (collectively copy) data in units of a plurality of bytes, and copy the pixel values of the foreground image to the background image storage unit 12 in units of one pixel. Copying can be performed more efficiently than in such a case.
【0104】次に、上述したように、図2の画像処理装
置においては、領域設定部14に、領域情報付きマット
画像を、外部に出力させることが可能であるが、図6
は、領域設定部14が出力する領域情報付きマット画像
のデータフォーマットを示している。なお、領域情報付
きマット画像には、前景画像記憶部11に記憶された前
景画像を含ませることができ、図6は、そのように前景
画像を含ませた場合の領域情報付きマット画像のデータ
フォーマットを示している。ここで、領域情報付きマッ
ト画像に、前景画像記憶部11に記憶された前景画像を
含ませるには、図2において点線で示すように、領域設
定部14に、前景画像記憶部11に記憶された前景画像
を読み出せるようにすれば良い。Next, as described above, in the image processing apparatus of FIG. 2, it is possible to cause the area setting section 14 to output a mat image with area information to the outside.
Indicates a data format of a mat image with area information output by the area setting unit 14. Note that the foreground image stored in the foreground image storage unit 11 can be included in the matte image with region information. FIG. 6 shows the data of the matte image with region information when such a foreground image is included. The format is shown. Here, in order to include the foreground image stored in the foreground image storage unit 11 in the matte image with area information, the area setting unit 14 stores the foreground image in the foreground image storage unit 11 as shown by a dotted line in FIG. The foreground image may be read.
【0105】図6において、第1行目(上から1行目)
のWまたはHは、前景画像およびマット画像の横または
縦の画素数をそれぞれ表している。また、第2行目の
(Xmi n1,Ymin1)または(Xmax1,Ymax1)は、第1
のバウンディングボックスの左下または右上の頂点をそ
れぞれ表しており、第3行目の(Xmin2,Ymin2)また
は(Xmax2,Ymax2)は、第2のバウンディングボック
スの左下または右上の頂点をそれぞれ表している。そし
て、第4行目以降には、前景画像を構成する画素(x,
y)のR,G,B成分Rx,y,Gx,y,Bx,yと、その画
素に対応するマット値Mx,yとが、前景画像の画素数分
だけ、即ち、W×H個だけ配列されている。In FIG. 6, the first line (the first line from the top)
Represents the number of horizontal or vertical pixels of the foreground image and the matte image, respectively. Further, in the second row (X mi n1, Y min1) or (X max1, Y max1), the first
Represents the lower left or upper right vertex of the bounding box of the second bounding box, respectively, and (X min2 , Y min2 ) or (X max2 , Y max2 ) on the third line represents the lower left or upper right vertex of the second bounding box, respectively. Represents. In the fourth and subsequent rows, pixels (x,
y), the R, G, B components R x, y , G x, y , B x, y and the mat values M x, y corresponding to the pixels are the same as the number of pixels of the foreground image, that is, W × H are arranged.
【0106】なお、外部記憶装置7(図1)には、図6
に示したような領域情報付きマット画像を生成して記憶
させておき、図4のステップS1においては、前景画像
記憶部11に、図6の領域情報付きマット画像を記憶さ
せるようにすることができる。この場合、ステップS2
では、前景画像記憶部11に記憶された領域情報付きマ
ット画像の中の座標(Xmin1,Ymin1),(Xmax1,Y
max1),(Xmin2,Ymi n2)、および(Xmax2,
Ymax2)を読み出すことで、第1および第2のバウンデ
ィングボックスが設定される。The external storage device 7 (FIG. 1) has
4 is generated and stored, and in step S1 of FIG. 4, the foreground image storage unit 11 may store the matte image with region information of FIG. it can. In this case, step S2
Now , the coordinates (X min1 , Y min1 ), (X max1 , Y min ) in the matte image with area information stored in the foreground image storage unit 11
max1), (X min2, Y mi n2), and (X max2,
By reading Y max2 ), the first and second bounding boxes are set.
【0107】また、図6の領域情報付きマット画像は、
前景画像を含んでいるが、領域情報付きマット画像は、
前景画像を含めずに構成することが可能である。この場
合、図4のステップS1においては、マット画像記憶部
13に、そのような前景画像を含まない領域情報付きマ
ット画像を記憶させるようにすることができ、ステップ
S2では、マット画像記憶部13に記憶された領域情報
付きマット画像の中の座標(Xmin1,Ymin1),(X
max1,Ymax1),(Xmin2,Ymin2)、および
(Xmax2,Ymax2)を読み出すことで、第1および第2
のバウンディングボックスが設定される。The matte image with area information shown in FIG.
Although the foreground image is included, the matte image with area information is
It is possible to configure without including the foreground image. In this case, in step S1 in FIG. 4, such a mat image with area information that does not include the foreground image can be stored in the mat image storage unit 13. In step S2, the mat image storage unit 13 (X min1 , Y min1 ) in the matte image with area information stored in
max1 , Ymax1 ), ( Xmin2 , Ymin2 ), and ( Xmax2 , Ymax2 ) to read the first and second
Is set.
【0108】次に、上述の場合においては、0でないマ
ット値すべてを包含する第1のバウンディングボックス
と、1のマット値のみからなる第2のバウンディングボ
ックスとを、ユーザからの頂点の入力に基づいて設定す
るようにしたが、第1および第2のバウンディングボッ
クスは、マット画像を構成するマット値に基づいて設定
することが可能である。さらに、上述の場合において
は、第1および第2のバウンディングボックスを矩形と
したことから、第1のバウンディングボックスには、0
のマット値が含まれることがあり、また、第2のバウン
ディングボックスには、1のマット値のすべてが含まれ
ないことがあったが、第1および第2のバウンディング
ボックスを任意の形とし、第1のバウンディングボック
スは、0のマット値を含まないように、また、第2のバ
ウンディングボックスは、すべての1のマット値を含む
ように構成することが可能である。即ち、図7に示すよ
うに、第1のバウンディングボックスは、半透明領域の
外周と一致するように、また、第2のバウンディングボ
ックスは、完全不透明領域の外周と一致するように、そ
れぞれ構成することが可能である。Next, in the above case, a first bounding box containing all non-zero mat values and a second bounding box consisting of only one mat value are determined based on the vertex input from the user. However, the first and second bounding boxes can be set based on the mat values forming the mat image. Further, in the above case, since the first and second bounding boxes are rectangular, the first bounding box contains 0
May be included, and the second bounding box may not include all of the matte values of 1. However, the first and second bounding boxes may have any shapes, The first bounding box can be configured not to include a matte value of zero, and the second bounding box can be configured to include all matte values of one. That is, as shown in FIG. 7, the first bounding box is configured to coincide with the outer periphery of the translucent region, and the second bounding box is configured to coincide with the outer periphery of the completely opaque region. It is possible.
【0109】この場合、図7に示すように、例えば、マ
ット画像(上述したように、横×縦がW×H画素で構成
される)の各行について、4つのx座標を導入し、これ
により、第1および第2のバウンディングボックスを規
定する。即ち、あるy座標で表される行(以下、適宜、
第y行という)について、半透明領域の左端のx座標、
完全不透明領域の左端のx座標、完全不透明領域の右端
のx座標、および半透明領域の右端のx座標を導入す
る。ここで、第y行における半透明領域の左端のx座
標、完全不透明領域の左端のx座標、完全不透明領域の
右端のx座標、または半透明領域の右端のx座標を、そ
れぞれ、Xmin1[y],Xmin2[y],Xma x2[y]、
またはXmax1[y]と表す。この場合、0≦x<Xmin1
[y]およびXmax1[y]<x≦Wの範囲が外部領域に
なり、Xmin1[y]≦x<Xmin2[y]およびX
max2[y]<x≦Xmax1[y]の範囲が中間領域にな
り、Xmin2[y]≦x≦Xmax2[y]の範囲が内部領域
になる。In this case, as shown in FIG. 7, for example, four x-coordinates are introduced for each row of the matte image (the horizontal and vertical are composed of W × H pixels as described above). , First and second bounding boxes. That is, a row represented by a certain y coordinate (hereinafter, appropriately,
X-coordinate of the left end of the translucent area,
The x coordinate of the left edge of the completely opaque area, the x coordinate of the right edge of the completely opaque area, and the x coordinate of the right edge of the translucent area are introduced. Here, the x coordinate of the left end of the translucent area, the x coordinate of the left end of the completely opaque area, the x coordinate of the right end of the completely opaque area, or the x coordinate of the right end of the translucent area in the y-th row are represented by X min1 [ y], X min2 [y] , X ma x2 [y],
Or, it is expressed as X max1 [y]. In this case, 0 ≦ x <X min1
The range of [y] and X max1 [y] <x ≦ W is the outer region, and X min1 [y] ≦ x <X min2 [y] and X
The range of max2 [y] <x ≦ Xmax1 [y] is the middle area, and the range of Xmin2 [y] ≦ x ≦ Xmax2 [y] is the inner area.
【0110】なお、第y行において、必ずしも、外部領
域、中間領域、および内部領域の3つの領域すべてが存
在するとは限らない。そこで、例えば、内部領域が存在
しない場合には、内部領域を規定するx座標X
min2[y]およびXmax2[y]に対して、内部領域が存
在するときに満たす関係(Xmin2[y]≦X
max2[y])を満たさない値、即ち、Xmin2[y]>X
max2[y]となるような値を設定することにより(例え
ば、Xmin2[y]=Xmax1[y]+1,Xmax2[y]=
Xmax1[y]とする)、内部領域が存在しないことを表
すこととする。In the y-th row, all three areas, that is, the external area, the intermediate area, and the internal area do not always exist. Therefore, for example, if there is no internal area, the x coordinate X defining the internal area
For min2 [y] and Xmax2 [y], the relationship that is satisfied when an internal region exists ( Xmin2 [y] ≦ X
max2 [y]), that is, X min2 [y]> X
By setting a value such that max2 [y] (for example, Xmin2 [y] = Xmax1 [y] + 1, Xmax2 [y] =
X max1 [y]) to indicate that no internal area exists.
【0111】次に、図8のフローチャートを参照して、
上述のように、第1および第2のバウンディングボック
スを設定して画像合成を行う場合の、図2の画像合成装
置の処理について説明する。Next, referring to the flowchart of FIG.
As described above, the processing of the image synthesizing apparatus in FIG. 2 in the case where the first and second bounding boxes are set to perform image synthesis will be described.
【0112】まず最初に、ステップS31において、図
4のステップS1における場合と同様に、外部記憶装置
7に記憶された前景画像、背景画像、またはマット画像
が読み出され、前景画像記憶部11、背景画像記憶部1
2、またはマット画像記憶部13にそれぞれ供給されて
記憶され、ステップS32に進む。First, in step S31, as in step S1 of FIG. 4, the foreground image, background image, or mat image stored in the external storage device 7 is read out, and the foreground image storage unit 11, Background image storage unit 1
2 or the matte image storage unit 13 is supplied and stored, respectively, and the process proceeds to step S32.
【0113】ステップS32では、領域設定部14にお
いて、マット画像記憶部13に記憶されたマット画像が
読み出され、そのマット画像に対して、第1および第2
のバウンディングボックスが設定される。即ち、ここで
は、領域設定部14は、マット画像記憶部13に記憶さ
れたマット画像の各行について、図7で説明したXmi n1
[y],Xmin2[y],Xmax2[y]、およびX
max1[y]を求めることで、第1および第2のバウンデ
ィングボックスを設定する。領域設定部14は、第1、
第2のバウンディングボックスを設定すると、それを特
定するための領域情報として、マット画像の各行につい
て設定されたXmin1[y],Xmin2[y],X
ma x2[y]、およびXmax1[y]を、マット画像ととも
に、レンダリング部15に出力する。即ち、領域設定部
14は、領域情報付きマット画像を、レンダリング部1
5に供給する。In step S32, the area setting section 14 reads out the matte image stored in the matte image storage section 13 and applies the first and second matte images to the matte image.
Is set. That is, here, the area setting unit 14, for each row of the stored mat image mat image storage unit 13, X mi n1 described in FIG. 7
[Y], X min2 [y], X max2 [y], and X
The first and second bounding boxes are set by finding max1 [y]. The area setting unit 14 includes:
When the second bounding box is set, X min1 [y], X min2 [y], X set for each row of the matte image are used as area information for specifying the second bounding box.
ma x2 [y], and X max1 the [y], together with the mat image, and outputs to the rendering unit 15. That is, the area setting unit 14 outputs the matte image with the area information to the rendering unit 1
5
【0114】ここで、この第1および第2のバウンディ
ングボックスを設定し、領域情報付きマット画像を生成
するステップS32の処理の詳細については、後述す
る。Here, the details of the processing in step S32 for setting the first and second bounding boxes and generating a mat image with area information will be described later.
【0115】レンダリング部15は、領域情報付きマッ
ト画像を受信すると、ステップS33において、y座標
を表す変数yを、0に初期化し、ステップS34に進
み、変数yが、マット画像の縦の画素数Hより小さいか
どうかを判定する。ステップS34において、変数y
が、Hより小さいと判定された場合、即ち、変数yが、
0以上H未満である場合、ステップS35に進み、図5
に示した一行計算処理を行う一行計算サブルーチンが、
変数y、並びに第y行における第1のバウンディングボ
ックスの左の境界のx座標Xmin1[y]、および第y行
における第2のバウンディングボックスの左の境界のx
座標Xmin2[y]−1の3つの変数の並びを引数として
呼び出される。When the rendering unit 15 receives the matte image with the area information, it initializes a variable y representing the y coordinate to 0 in step S33, and proceeds to step S34, where the variable y is set to the number of vertical pixels of the matte image. It is determined whether it is smaller than H. In step S34, the variable y
Is smaller than H, that is, when the variable y is
If it is not less than 0 and less than H, the process proceeds to step S35, and FIG.
The one-line calculation subroutine that performs the one-line calculation process shown in
The variable y, and the x coordinate X min1 [y] of the left boundary of the first bounding box in the y th row, and the x coordinate of the left boundary of the second bounding box in the y th row
It is called with an arrangement of three variables at the coordinate X min2 [y] -1.
【0116】そして、ステップS35における一行計算
処理が終了すると、ステップS36に進み、レンダリン
グ部15は、前景画像記憶部11に記憶された前景画像
の画素値F[Xmin2[y],y]乃至F[X
max2[y],y]を、背景画像記憶部12に記憶された
背景画像の画素値B[Xmin2[y],y]乃至B[X
max2[y],y]にコピーし、ステップS37に進む。When the one-line calculation process in step S35 is completed, the process proceeds to step S36, in which the rendering unit 15 determines the pixel values F [X min2 [y], y] through the foreground image stored in the foreground image storage unit 11. F [X
max2 [y], y] is converted from the pixel values B [X min2 [y], y] to B [X] of the background image stored in the background image storage unit 12.
max2 [y], y] and proceed to step S37.
【0117】ステップS37では、図5に示した一行計
算処理を行う一行計算サブルーチンが、変数y、第2の
バウンディングボックスの右の境界のx座標X
max2[y]+1、および第1のバウンディングボックス
の右の境界のx座標Xmax1[y]を引数として呼び出さ
れる。In step S37, the one-line calculation subroutine for performing the one-line calculation process shown in FIG. 5 includes a variable y and an x coordinate X on the right boundary of the second bounding box.
It is called with max2 [y] +1 and the x coordinate Xmax1 [y] of the right boundary of the first bounding box as arguments.
【0118】そして、ステップS37における一行計算
処理が終了すると、ステップS38に進み、レンダリン
グ部15において、変数yが1だけインクリメントされ
る。そして、ステップS34に戻り、以下、ステップS
34で、変数yがH未満でないと判定されるまで、ステ
ップS34乃至S38の処理が繰り返される。When the one-line calculation process in step S37 is completed, the process proceeds to step S38, where the rendering unit 15 increments the variable y by one. Then, the process returns to step S34, and thereafter, returns to step S34.
Until it is determined at 34 that the variable y is not less than H, the processing of steps S34 to S38 is repeated.
【0119】即ち、第y行のラインを構成する画素のう
ち、そのx座標が、第1のバウンディングボックスの左
側の境界のx座標であるXmin1[y]未満の画素、およ
び第1のバウンディングボックスの右側の境界のx座標
であるXmax1[y]より大きい画素は、外部領域(図
7)の画素であり、ここでは、外部領域には、透明領域
のみが含まれる。そして、上述したように、ここでは、
背景画像に上書きする形で合成画像を生成するので、透
明領域の画素については、背景画像記憶部12に記憶さ
れた背景画像の画素値をそのまま用いることができ、特
に処理を行う必要はない。That is, of the pixels constituting the line of the y-th row, the pixel whose x coordinate is smaller than X min1 [y] which is the x coordinate of the left boundary of the first bounding box, and the first bounding Pixels larger than X max1 [y], which is the x coordinate of the right boundary of the box, are pixels in the external region (FIG. 7), and here, the external region includes only a transparent region. And, as mentioned above,
Since the composite image is generated by overwriting the background image, the pixel values of the background image stored in the background image storage unit 12 can be used as they are for the pixels in the transparent area, and there is no need to perform any particular processing.
【0120】また、第y行のラインを構成する画素のう
ち、そのx座標が、第1のバウンディングボックスの左
側の境界のx座標であるXmin1[y]以上で、かつ第2
のバウンディングボックスの左側の境界のx座標である
Xmin2[y]未満の画素、および第2のバウンディング
ボックスの右側の境界のx座標であるXmax2[y]より
大きく、かつ第1のバウンディングボックスの右側の境
界のx座標であるXma x1[y]以下の画素は、中間領域
(図7)の画素であり、ここでは、中間領域は、半透明
領域のみを含むため、式(1)の演算の対象とする必要
がある。そこで、ステップS35およびS37におい
て、そのような画素のみを対象にして、一行計算処理が
行われる。Further, among the pixels forming the line of the y-th row, the x-coordinate is equal to or more than X min1 [y] which is the x-coordinate of the left boundary of the first bounding box, and
A pixel that is less than X min2 [y], which is the x coordinate of the left boundary of the bounding box, and is greater than X max2 [y], which is the x coordinate of the right boundary of the second bounding box, and the first bounding box the X ma x1 [y] following pixel is x-coordinate of the right boundary of a pixel of the intermediate region (7), wherein the intermediate region, to include only the translucent area, equation (1) Must be calculated. Therefore, in steps S35 and S37, one-line calculation processing is performed only on such pixels.
【0121】さらに、第y行のラインを構成する画素の
うち、そのx座標が、第2のバウンディングボックスの
左側の境界のx座標であるXmin2以上で、かつその右側
の境界のx座標であるXmax2以下の画素は、内部領域
(図7)の画素であり、内部領域には、完全不透明領域
しかふくまれない。そして、ここでは、上述したよう
に、背景画像に上書きする形で合成画像を生成するの
で、完全不透明領域の画素については、前景画像記憶部
11に記憶された前景画像の画素をコピーすれば済む。
そこで、ステップS36において、そのような画素につ
いては、前景画像記憶部11に記憶された前景画像の画
素値が、背景画像記憶部12にコピーされる。Further, among the pixels constituting the line of the y-th row, the x coordinate is equal to or more than X min2 which is the x coordinate of the left boundary of the second bounding box and the x coordinate of the right boundary thereof. Pixels below a certain X max2 are pixels in the internal area (FIG. 7), and the internal area includes only a completely opaque area. In this case, as described above, since the composite image is generated by overwriting the background image, the pixels of the foreground image stored in the foreground image storage unit 11 need only be copied for the pixels in the completely opaque area. .
Therefore, in step S36, for such a pixel, the pixel value of the foreground image stored in the foreground image storage unit 11 is copied to the background image storage unit 12.
【0122】その後、ステップS34において、変数y
が、H未満でないと判定されると、ステップS39に進
み、背景画像記憶部12に記憶された合成画像が、外部
記憶装置7に書き込まれ、処理を終了する。Thereafter, in step S34, the variable y
Is not less than H, the process proceeds to step S39, where the composite image stored in the background image storage unit 12 is written to the external storage device 7, and the process ends.
【0123】図8の実施の形態においても、第1のバウ
ンディングボックス内の画素のうちの、第2のバウンデ
ィングボックス内の画素を除いたものだけを、式(1)
の演算の対象とすれば良く、第2のバウンディングボッ
クス内の画素については、コピーを行うだけで済むの
で、画像の合成を、効率良く行うことができる。In the embodiment of FIG. 8 as well, only the pixels in the first bounding box excluding the pixels in the second bounding box are expressed by the formula (1).
And the pixels in the second bounding box need only be copied, so that the images can be efficiently synthesized.
【0124】次に、図9のフローチャートを参照して、
図8のステップS32の処理の詳細について説明する。Next, referring to the flowchart of FIG.
The details of the process in step S32 in FIG. 8 will be described.
【0125】図8のステップS32では、マット画像を
構成する各行(ライン)が走査され、その行を構成する
画素のマット値に基づいて、上述のx座標X
min1[y],Xmi n2[y],Xmax2[y]、およびX
max1[y]が設定される。In step S32 of FIG. 8, each row (line) constituting the mat image is scanned, and the above-mentioned x coordinate X is determined based on the mat value of the pixels constituting the row.
min1 [y], X mi n2 [y], X max2 [y], and X
max1 [y] is set.
【0126】即ち、ステップS41では、y座標を表す
変数yが、0に初期化され、ステップS42に進み、変
数yが、マット画像の縦の画素数Hより小さいかどうか
が判定される。ステップS42において、変数yがH未
満であると判定された場合、即ち、変数yが、0以上H
未満である場合、ステップS43に進み、x座標を表す
変数xが、0に初期化され、ステップS44に進む。That is, in step S41, the variable y representing the y coordinate is initialized to 0, and the flow advances to step S42 to determine whether or not the variable y is smaller than the number H of the vertical pixels of the matte image. In step S42, when it is determined that the variable y is less than H, that is, when the variable y is 0 or more and H
If it is less than the value, the process proceeds to step S43, a variable x representing the x coordinate is initialized to 0, and the process proceeds to step S44.
【0127】ステップS44では、変数xが、マット画
像の横の画素数W未満であるかどうかが判定される。ス
テップS44において、変数xが、マット画像の横の画
素数W未満であると判定された場合、即ち、変数xが、
0以上W未満である場合、ステップS45に進み、マッ
ト値matte[x,y](座標(x,y)のマット
値)が0に等しいかどうかが判定される。ステップS4
5において、マット値matte[x,y]が0に等し
いと判定された場合、ステップS46に進み、x座標が
1だけインクリメントされる。そして、ステップS44
に戻り、以下、ステップS44でx座標がW未満でない
と判定されるか、またはステップS45でmatte
[x,y]が0に等しくないと判定されるまで、ステッ
プS44乃至S46の処理が繰り返される。In step S44, it is determined whether the variable x is less than the number W of horizontal pixels of the mat image. In step S44, when it is determined that the variable x is less than the number of horizontal pixels W of the mat image, that is, when the variable x is
If it is 0 or more and less than W, the process proceeds to step S45, and it is determined whether or not the matte value matte [x, y] (matte value of coordinates (x, y)) is equal to 0. Step S4
If it is determined in 5 that the matte value matte [x, y] is equal to 0, the process proceeds to step S46, and the x coordinate is incremented by one. Then, step S44
Returning to step S44, it is determined that the x coordinate is not smaller than W, or
Until it is determined that [x, y] is not equal to 0, the processing of steps S44 to S46 is repeated.
【0128】そして、ステップS45において、mat
te[x,y]が0に等しくないと判定された場合、即
ち、第y行のマット値を、左から右方向に走査していっ
て、0でないマット値が最初に現れた場合、ステップS
47に進み、その0でないマット値を有する画素のx座
標が、第1のバウンディングボックスの左側の境界のx
座標を表す変数Xmin1[y]にセットされ、ステップS
48に進む。In step S45, mat
If it is determined that te [x, y] is not equal to 0, that is, if the matte value of the y-th row is scanned from left to right and a non-zero matte value first appears, step S
47, the x-coordinate of the pixel having the non-zero matte value is the x-coordinate of the left boundary of the first bounding box.
A variable X min1 [y] representing coordinates is set in step S
Go to 48.
【0129】ステップS48では、ステップS44にお
ける場合と同様に、x座標がW未満であるかどうかが判
定され、W未満であると判定された場合、ステップS4
9に進み、マット値matte[x,y]が、0より大
きく、かつ1より小さいかどうかが判定される。ステッ
プS49において、マット値matte[x,y]が、
0より大きく、かつ1より小さいと判定された場合、ス
テップS50に進み、x座標が1だけインクリメントさ
れる。そして、ステップS48に戻り、ステップS48
でx座標がW未満でないと判定されるか、またはステッ
プS49でマット値matte[x,y]が、0または
1のいずれかに等しいと判定されるまで、ステップS4
8乃至S50の処理が繰り返される。In step S48, as in step S44, it is determined whether or not the x coordinate is less than W, and if it is determined that it is less than W, the process proceeds to step S4.
Proceeding to 9, it is determined whether or not the matte value matte [x, y] is larger than 0 and smaller than 1. In step S49, the matte value matte [x, y] is
If it is determined that the value is larger than 0 and smaller than 1, the process proceeds to step S50, and the x coordinate is incremented by one. Then, the process returns to step S48, and step S48
Until it is determined that the x coordinate is not less than W, or until the matte value matte [x, y] is determined to be equal to either 0 or 1 in step S49, step S4.
8 to S50 are repeated.
【0130】そして、ステップS49において、マット
値matte[x,y]が、0または1のいずれかに等
しいと判定されると、ステップS51に進み、そのマッ
ト値matte[x,y]が、1に等しいかどうかが判
定される。ステップS51において、matte[x,
y]が1に等しいと判定された場合、即ち、第y行のマ
ット値を、左から右方向に走査していって、1のマット
値が最初に現れた場合、ステップS52に進み、その1
のマット値を有する画素のx座標が、第2のバウンディ
ングボックスの左側の境界のx座標を表す変数X
min2[y]にセットされ、ステップS53に進む。If it is determined in step S49 that the matte value matte [x, y] is equal to either 0 or 1, the process proceeds to step S51, where the matte value matte [x, y] is set to 1 Is determined to be equal to In step S51, matte [x,
If y] is determined to be equal to 1, that is, if the mat value of the y-th row is scanned from left to right and a mat value of 1 appears first, the process proceeds to step S52, and 1
Is a variable X representing the x coordinate of the left boundary of the second bounding box.
min2 [y], and the process proceeds to step S53.
【0131】ステップS53では、ステップS44にお
ける場合と同様に、変数xが、マット画像の横の画素数
W未満であるかどうかが判定される。ステップS53に
おいて、変数xが、マット画像の横の画素数W未満であ
ると判定された場合、ステップS54に進み、マット値
matte[x,y]が1に等しいかどうかが判定され
る。ステップS54において、マット値matte
[x,y]が1に等しいと判定された場合、ステップS
55に進み、x座標が1だけインクリメントされる。そ
して、ステップS53に戻り、以下、ステップS53で
x座標がW未満でないと判定されるか、またはステップ
S54でmatte[x,y]が1に等しくないと判定
されるまで、ステップS53乃至S55の処理が繰り返
される。In step S53, as in step S44, it is determined whether the variable x is less than the number W of horizontal pixels of the matte image. If it is determined in step S53 that the variable x is less than the number W of horizontal pixels of the matte image, the process proceeds to step S54, and it is determined whether the matte value matte [x, y] is equal to one. In step S54, the matte value matte
If [x, y] is determined to be equal to 1, step S
Proceeding to 55, the x coordinate is incremented by one. Then, the process returns to step S53. Thereafter, steps S53 to S55 are repeated until it is determined in step S53 that the x coordinate is not less than W, or it is determined in step S54 that matte [x, y] is not equal to 1. The process is repeated.
【0132】そして、ステップS54において、mat
te[x,y]が1に等しくないと判定された場合、即
ち、第y行のマット値を、左から右方向に走査していっ
て、1のマット値が現れ、その後、1でないマット値が
最初に現れた場合、ステップS56に進み、その1でな
いマット値を有する画素のx座標−1が、第2のバウン
ディングボックスの右側の境界のx座標を表す変数X
max2[y]にセットされ、ステップS57に進む。Then, in step S54, mat
If it is determined that te [x, y] is not equal to 1, that is, the mat value of the y-th row is scanned from left to right, a mat value of 1 appears, and then a mat value other than 1 If the value first appears, the process proceeds to step S56, in which the x coordinate -1 of the pixel having the non-matte value is set to a variable X representing the x coordinate of the right boundary of the second bounding box.
max2 [y] is set, and the process proceeds to step S57.
【0133】ステップS57では、ステップS44にお
ける場合と同様に、変数xが、マット画像の横の画素数
W未満であるかどうかが判定される。ステップS57に
おいて、変数xが、マット画像の横の画素数W未満であ
ると判定された場合、ステップS58に進み、マット値
matte[x,y]が0より大きいかどうかが判定さ
れる。ステップS58において、マット値matte
[x,y]が0より大きいと判定された場合、ステップ
S59に進み、x座標が1だけインクリメントされる。
そして、ステップS57に戻り、以下、ステップS57
でx座標がW未満でないと判定されるか、またはステッ
プS58でmatte[x,y]が0より大きくないと
判定されるまで、ステップS57乃至S59の処理が繰
り返される。In step S57, as in step S44, it is determined whether the variable x is less than the number W of horizontal pixels of the mat image. If it is determined in step S57 that the variable x is smaller than the number W of horizontal pixels of the mat image, the process proceeds to step S58, and it is determined whether the mat value mute [x, y] is larger than 0. In step S58, the mat value matte
If [x, y] is determined to be larger than 0, the process proceeds to step S59, and the x coordinate is incremented by 1.
Then, the process returns to step S57, and thereafter, returns to step S57.
Are determined to be not less than W, or the process of steps S57 to S59 is repeated until it is determined in step S58 that matte [x, y] is not greater than 0.
【0134】そして、ステップS58において、mat
te[x,y]が0より大きくないと判定された場合、
即ち、第y行のマット値を、左から右方向に走査してい
って、1のマット値が現れ、さらに、1でないマット値
が現れ、その後、0より大きくないマット値、つまり0
のマット値が最初に現れた場合、ステップS60に進
み、その0のマット値を有する画素のx座標−1が、第
1のバウンディングボックスの右側の境界のx座標を表
す変数Xmax1[y]にセットされ、ステップS61に進
む。Then, in step S58, mat
If it is determined that te [x, y] is not greater than 0,
That is, the mat value of the y-th row is scanned from left to right, a mat value of 1 appears, a mat value other than 1 appears, and thereafter, a mat value not larger than 0, that is, 0
If the matte value of the first bounding box first appears, the process proceeds to step S60, and the x coordinate -1 of the pixel having the matte value of 0 is a variable X max1 [y] representing the x coordinate of the right boundary of the first bounding box. Is set, and the process proceeds to step S61.
【0135】ステップ61では、ステップS44におけ
る場合と同様に、変数xが、マット画像の横の画素数W
未満であるかどうかが判定される。ステップS61にお
いて、変数xが、マット画像の横の画素数W未満である
と判定された場合、ステップS62に進み、マット値m
atte[x,y]が0に等しいかどうかが判定され
る。ステップS62において、マット値matte
[x,y]が0に等しいと判定された場合、ステップS
63に進み、x座標が1だけインクリメントされる。そ
して、ステップS61に戻り、以下、ステップS61で
x座標がW未満でないと判定されるか、またはステップ
S62でマット値matte[x,y]が0に等しくな
いと判定されるまで、ステップS61乃至S63の処理
が繰り返される。In step 61, as in step S44, the variable x is set to the number of horizontal pixels W of the matte image.
It is determined whether it is less than. In step S61, when it is determined that the variable x is less than the number W of horizontal pixels of the mat image, the process proceeds to step S62, where the mat value m
It is determined whether atte [x, y] is equal to zero. In step S62, the matte value matte
If [x, y] is determined to be equal to 0, step S
Proceeding to 63, the x coordinate is incremented by one. Then, the process returns to step S61, and thereafter, steps S61 to S61 are performed until it is determined in step S61 that the x coordinate is not less than W, or until it is determined in step S62 that the matte value matte [x, y] is not equal to 0. The process of S63 is repeated.
【0136】そして、ステップS62において、マット
値matte[x,y]が0に等しくないと判定される
と、ステップS57に戻り、以下、同様の処理が繰り返
される。即ち、これにより、第y行が、半透明領域を複
数回横切るような場合には、ステップS60において、
最後に横切った半透明領域の右側の境界のx座標−1
が、変数Xmax1[y]にセットされる。If it is determined in step S62 that the matte value matte [x, y] is not equal to 0, the process returns to step S57, and the same processing is repeated. That is, when the y-th row crosses the translucent region a plurality of times, in step S60,
X coordinate of the right boundary of the last translucent area -1
Is set to the variable X max1 [y].
【0137】また、ステップS61において、x座標が
W未満でないと判定された場合、即ち、第y行のマット
値を、左から右方向に走査していき、その右端の画素ま
で到達した場合、ステップS64に進み、y座標が1だ
けインクリメントされる。そして、ステップS42に戻
り、以下、同様の処理が繰り返される。In step S61, when it is determined that the x coordinate is not less than W, that is, when the mat value of the y-th row is scanned from left to right and reaches the rightmost pixel, Proceeding to step S64, the y coordinate is incremented by one. Then, the process returns to step S42, and thereafter, the same processing is repeated.
【0138】一方、ステップS44において、x座標が
W未満でないと判定された場合、即ち、第y行のマット
値を、左から右方向に走査していって、0でないマット
値を検出することができなかった場合(従って、第y行
のマット値がすべて0の場合)、ステップS65に進
み、第1のバウンディングボックスの左側の境界のx座
標を表す変数Xmin1[y]に、取り得ない値である、例
えばWがセットされ、ステップS66に進む。ステップ
S66では、第2のバウンディングボックスの左側の境
界のx座標を表す変数Xmin2[y]に、取り得ない値で
ある、例えばWがセットされ、ステップS67に進む。
ステップS67では、第2のバウンディングボックスの
右側の境界のx座標を表す変数Xmax2[y]に、変数X
min2[y]にWがセットされたときに取り得ない値であ
る、例えばW−1がセットされ、ステップS68に進
む。ステップS68では、第1のバウンディングボック
スの右側の境界のx座標を表す変数Xmax1[y]に、変
数Xmin1[y]にWがセットされたときに取り得ない値
である、例えばW−1がセットされ、ステップS64に
進み、以下、上述した場合と同様の処理が行われる。On the other hand, if it is determined in step S44 that the x coordinate is not less than W, that is, the mat value of the y-th row is scanned from left to right to detect a non-zero mat value. Cannot be obtained (therefore, when the matte value of the y-th row is all 0), the process proceeds to step S65, and the variable X min1 [y] representing the x coordinate of the left boundary of the first bounding box cannot be obtained. A value, for example, W is set, and the process proceeds to step S66. In step S66, an unacceptable value, for example, W, is set in a variable X min2 [y] representing the x coordinate of the left boundary of the second bounding box, and the process proceeds to step S67.
In step S67, the variable X max2 [y] representing the x coordinate of the right boundary of the second bounding box is set to the variable X
When W is set to min2 [y], a value that cannot be obtained, for example, W-1 is set, and the process proceeds to step S68. In step S68, the variable X max1 [y] representing the x coordinate of the right boundary of the first bounding box is a value that cannot be obtained when W is set to the variable X min1 [y], for example, W-1. Is set, the process proceeds to step S64, and thereafter, the same processing as in the case described above is performed.
【0139】また、ステップS48において、x座標が
W未満でないと判定された場合、即ち、第y行のマット
値を、左から右方向に走査していって、0でないマット
値が現れた後、その0でないマット値が、第y行の右端
まで連続する場合、ステップS66に進み、以下、上述
した場合と同様の処理が行われる。さらに、ステップS
S53において、x座標がW未満でないと判定された場
合、即ち、第y行のマット値を、左から右方向に走査し
ていって、1のマット値が現れた後、その1のマット値
が、第y行の右端まで連続する場合、ステップS67に
進み、以下、上述した場合と同様の処理が行われる。ま
た、ステップS57において、x座標がW未満でないと
判定された場合、即ち、第y行のマット値を、左から右
方向に走査していって、1のマット値が現れ、さらに、
1未満の0でないマット値が現れた後、その1未満の0
でないマット値が、第y行の右端まで連続する場合、ス
テップS68に進み、以下、上述した場合と同様の処理
が行われる。In step S48, when it is determined that the x coordinate is not less than W, that is, after scanning the mat value of the y-th row from left to right, and a non-zero mat value appears. If the non-zero mat value continues to the right end of the y-th row, the process proceeds to step S66, and the same processing as in the above-described case is performed. Further, step S
In S53, when it is determined that the x coordinate is not less than W, that is, the mat value of the y-th row is scanned from left to right, and after one mat value appears, Continues to the right end of the y-th row, the process proceeds to step S67, and thereafter, the same processing as in the above-described case is performed. When it is determined in step S57 that the x coordinate is not less than W, that is, the mat value of the y-th row is scanned from left to right, and a mat value of 1 appears.
After a non-zero matte value less than one appears, the less than one zero
If the mat value does not continue to the right end of the y-th row, the process proceeds to step S68, and the same processing as in the above-described case is performed.
【0140】一方、ステップS51において、matt
e[x,y]が1に等しくないと判定された場合、即
ち、第y行のマット値を、左から右方向に走査していっ
て、0より大きく、かつ1より小さいマット値が現れた
後に、1のマット値が現れず、0のマット値が現れた場
合、ステップS69に進み、ステップS60における場
合と同様に、その0のマット値を有する画素のx座標−
1が、第1のバウンディングボックスの右側の境界のx
座標を表す変数Xmax1[y]にセットされ、ステップS
70に進む。On the other hand, in step S51, matt
When it is determined that e [x, y] is not equal to 1, that is, the mat value in the y-th row is scanned from left to right, and a mat value larger than 0 and smaller than 1 appears. After that, if the matte value of 1 does not appear and the matte value of 0 appears, the process proceeds to step S69, and similarly to the case of step S60, the x-coordinate of the pixel having the matte value of 0 is obtained.
1 is x on the right border of the first bounding box
The variable X max1 [y] representing the coordinates is set in step S
Go to 70.
【0141】ステップS70では、ステップS44にお
ける場合と同様に、変数xが、マット画像の横の画素数
W未満であるかどうかが判定される。ステップS70に
おいて、変数xが、マット画像の横の画素数W未満であ
ると判定された場合、ステップS71に進み、マット値
matte[x,y]が0に等しいかどうかが判定され
る。ステップS71において、マット値matte
[x,y]が0に等しいと判定された場合、ステップS
72に進み、x座標が1だけインクリメントされる。そ
して、ステップS70に戻り、以下、ステップS70で
x座標がW未満でないと判定されるか、またはステップ
S71でマット値matte[x,y]が0に等しくな
いと判定されるまで、ステップS70乃至S72の処理
が繰り返される。In step S70, as in step S44, it is determined whether the variable x is less than the number W of horizontal pixels of the matte image. If it is determined in step S70 that the variable x is less than the number W of horizontal pixels of the matte image, the process proceeds to step S71, and it is determined whether or not the matte value matte [x, y] is equal to zero. In step S71, the matte value matte
If [x, y] is determined to be equal to 0, step S
Proceeding to 72, the x coordinate is incremented by one. Then, the process returns to step S70, and thereafter, steps S70 to S70 are performed until it is determined in step S70 that the x coordinate is not less than W, or until it is determined in step S71 that the matte value matte [x, y] is not equal to 0. The process of S72 is repeated.
【0142】そして、ステップS71において、マット
値matte[x,y]が0に等しくないと判定される
と、即ち、0でないマット値が現れると、ステップS4
8に戻り、以下、同様の処理が繰り返される。即ち、こ
れにより、ステップS52では、第y行を左から右に走
査していって、最初に現れる1のマット値のx座標が、
変数Xmin2[y]にセットされる。If it is determined in step S71 that the matte value matte [x, y] is not equal to 0, that is, if a matte value other than 0 appears, the process proceeds to step S4.
8, the same process is repeated. That is, thereby, in step S52, the y-th row is scanned from left to right, and the x coordinate of the first matte value that appears is
Set to the variable X min2 [y].
【0143】また、ステップS70において、x座標が
W未満でないと判定された場合、ステップS73に進
み、第2のバウンディングボックスの左側の境界のx座
標を表す変数Xmin2[y]に、第1のバウンディングボ
ックスとの関係で取り得ない値である、例えば、その右
側の境界のx座標を表す変数Xmax1[y]+1がセット
されるとともに、第2のバウンディングボックスの右側
の境界のx座標を表す変数Xmax2[y]に、第1のバウ
ンディングボックスとの関係で取り得ない値である、例
えば、その右側の境界のx座標を表す変数Xmax1[y]
がセットされる。そして、ステップS64に進み、以
下、上述の場合と同様の処理が繰り返される。If it is determined in step S70 that the x coordinate is not smaller than W, the flow advances to step S73 to set the variable X min2 [y] representing the x coordinate of the left boundary of the second bounding box to the first value. For example, a variable X max1 [y] +1 representing the x coordinate of the right boundary of the second bounding box is set, and the x coordinate of the right boundary of the second bounding box is set to a value that cannot be taken in relation to the bounding box of A variable X max2 [y] representing a value that cannot be taken in relation to the first bounding box, for example, a variable X max1 [y] representing an x coordinate of a right boundary thereof.
Is set. Then, the process proceeds to step S64, and thereafter, the same processing as the above case is repeated.
【0144】次に、図10は、領域設定部14におい
て、図9で説明した処理が行われることにより得られる
領域情報付きマット画像のデータフォーマットを示して
いる。なお、図10の実施の形態でも、図6における場
合と同様に、前景画像記憶部11に記憶された前景画像
を含む領域情報付きマット画像のデータフォーマットを
示している。FIG. 10 shows a data format of a mat image with area information obtained by performing the processing described with reference to FIG. The data format of the matte image with area information including the foreground image stored in the foreground image storage unit 11 is also shown in the embodiment of FIG. 10 as in the case of FIG.
【0145】図10において、第1行目(上から1行
目)のWまたはHは、前景画像およびマット画像の横ま
たは縦の画素数をそれぞれ表している。また、第2行目
からのH行におけるXmin1[y],Xmin2[y],X
max2[y]、またはXmax1[y]は、マット画像の第y
行のラインにおける第1のバウンディングボックスの左
側の境界、第2のバウンディングボックスの左側の境
界、第2のバウンディングボックスの右側の境界、第1
のバウンディングボックスの右側の境界のx座標を、そ
れぞれ表している。そして、その後のW×H行には、図
6の第4行目以降と同様に、前景画像を構成する画素
(x,y)のR,G,B成分Rx,y,Gx,y,Bx, yと、
対応するマット値Mx,yとが配列されている。In FIG. 10, W or H on the first row (first row from the top) indicates the number of horizontal or vertical pixels of the foreground image and the matte image, respectively. Further, X min1 [y], X min2 [y], X in the H row from the second row
max2 [y] or Xmax1 [y] is the y-th of the matte image.
The left border of the first bounding box, the left border of the second bounding box, the right border of the second bounding box, the first
Respectively represents the x coordinate of the right boundary of the bounding box. Then, in the subsequent W × H rows, the R, G, and B components R x, y , G x, y of the pixels (x, y) constituting the foreground image, as in the fourth and subsequent rows in FIG. , B x, y ,
The corresponding mat values M x, y are arranged.
【0146】なお、図6や図10に示した領域情報付き
マット画像は、例えば、そこに含まれる前景画像を用い
た画像合成を複数回行うようなときに、特に有用であ
る。The matte image with area information shown in FIG. 6 and FIG. 10 is particularly useful, for example, when image synthesis using the foreground image included in the matte image is performed a plurality of times.
【0147】また、本実施の形態では、第1および第2
のバウンディングボックスを、左下および右下の頂点で
規定される矩形や、各ラインごとに設定された4つのx
座標Xmin1[y],Xmin2[y],Xmax2[y]、およ
びXmax1[y]によって表すようにしたが、第1および
第2のバウンディングボックスの表現形式は、特に限定
されるものではなく、マット画像上の点(画素)が与え
られたときに、その点が、第1および第2のバウンディ
ングボックスの内側、外側のいずれに位置するのかを判
断することができるものであれば良い。即ち、第1およ
び第2のバウンディングボックスの表現形式としては、
例えば、4分木(quad-tree)その他を用いることも可
能である。Further, in the present embodiment, the first and second
Is bounded by a rectangle defined by the lower left and lower right vertices, and four x's set for each line.
Although the coordinates are represented by the coordinates X min1 [y], X min2 [y], X max2 [y], and X max1 [y], the expression form of the first and second bounding boxes is not particularly limited. Rather, if a point (pixel) on the matte image is given, it can be determined whether the point is located inside or outside the first and second bounding boxes. good. That is, as the expression format of the first and second bounding boxes,
For example, a quad-tree or the like can be used.
【0148】さらに、本実施の形態では、合成画像を、
背景画像に上書きする形で生成するようにしたが、合成
画像は、背景画像とは別に生成することも可能である。
但し、その場合、背景画像について、特に処理を行う必
要はないと説明した部分では、背景画像を、合成画像と
してコピーするようにする必要がある。Further, in the present embodiment, the composite image is
Although the image is generated by overwriting the background image, the composite image can be generated separately from the background image.
However, in this case, it is necessary to copy the background image as a composite image in a portion where it is not necessary to particularly perform the processing on the background image.
【0149】また、本実施の形態では、前景画像および
背景画像として、RGB成分を有するものを用いるよう
にしたが、前景画像および背景画像としては、RGB以
外の、例えば、YIQその他で画素値が表現されるもの
を用いることが可能である。Further, in this embodiment, as the foreground image and the background image, those having RGB components are used. However, as the foreground image and the background image, pixel values other than RGB, such as YIQ and the like, are used. It is possible to use what is expressed.
【0150】さらに、本実施の形態では、ユーザからの
2頂点の入力に基づき、その2頂点で規定される矩形の
第1および第2のバウンディングボックスを設定するよ
うにしたが、その他、例えば、ユーザには、3頂点以上
を入力してもらい、その3頂点以上で規定される、矩形
以外の形状の第1および第2のバウンディングボックス
を設定するようにすることも可能である。Further, in the present embodiment, the first and second rectangular bounding boxes defined by the two vertices are set based on the input of the two vertices from the user. It is also possible for the user to input three or more vertices, and to set the first and second bounding boxes of a shape other than a rectangle defined by the three or more vertices.
【0151】また、本実施の形態では、図3において、
半透明領域に外接する第1のバウンディングボックス、
および2頂点が完全透明領域に内接する第2のバウンデ
ィングボックスを設定するようにしたが、第1および第
2のバウンディングボックスの設定の仕方は、これに限
定されるものではない。即ち、第1のバウンディングボ
ックスは、半透明領域および完全不透明領域を包含する
ものであれば、半透明領域に外接していなくてもかまわ
ない。また、第2のバウンディングボックスは、完全不
透明領域の少なくとも一部のみを有するものであれば、
完全不透明領域に内接していなくてもかまわない。In this embodiment, in FIG.
A first bounding box circumscribing the translucent area,
And a second bounding box whose two vertices are inscribed in the completely transparent area is set, but the method of setting the first and second bounding boxes is not limited to this. That is, the first bounding box does not have to circumscribe the translucent area as long as it includes the translucent area and the completely opaque area. Also, if the second bounding box has at least a part of the completely opaque area,
It does not have to be inscribed in the completely opaque area.
【0152】さらに、本実施の形態では、CPU2に、
コンピュータプログラムを実行させることにより、画像
合成や領域情報付きマット画像の生成を行うようにした
が、これらの処理は、それ専用のハードウェアによって
行うことも可能である。Further, in the present embodiment, the CPU 2
Although the image synthesis and the generation of the matte image with the area information are performed by executing the computer program, these processes can also be performed by dedicated hardware.
【0153】また、本実施の形態では、CPU2に実行
させるアプリケーションプログラムを、外部記憶装置7
に記憶させて提供するようにしたが、アプリケーション
プログラムは、例えば、インターネットその他の伝送媒
体を介して伝送して提供することも可能である。In the present embodiment, an application program to be executed by the CPU 2 is stored in the external storage device 7.
Although the application program is stored and provided, the application program can be provided by being transmitted via, for example, the Internet or another transmission medium.
【0154】[0154]
【発明の効果】請求項1に記載の画像合成装置および請
求項8に記載の画像合成方法、並びに請求項9に記載の
提供媒体によれば、マット画像に対して、所定の範囲の
最小値でないマット値すべてを包含する第1の領域と、
所定の範囲の最大値のマット値のみからなる第2の領域
とが設定され、第1の領域の外部の領域、第1の領域の
うちの第2の領域でない領域、および第2の領域の3つ
の領域それぞれに対応する第1および第2の画像につい
て、画像合成のための合成処理が施される。従って、画
像の合成を、効率良く行うことが可能となる。According to the image synthesizing apparatus according to the first aspect, the image synthesizing method according to the eighth aspect, and the providing medium according to the ninth aspect, the minimum value of the predetermined range with respect to the mat image is provided. A first region containing all non-mat values,
A second area consisting only of the maximum matte value in the predetermined range is set, and the area outside the first area, the area other than the second area of the first area, and the second area The first and second images corresponding to each of the three regions are subjected to a synthesis process for image synthesis. Therefore, it is possible to efficiently combine images.
【0155】請求項10に記載の画像生成装置および請
求項14に記載の画像生成方法、並びに請求項15に記
載の提供媒体によれば、マット画像に対して、所定の範
囲の最小値でないマット値すべてを包含する第1の領域
と、所定の範囲の最大値のマット値のみからなる第2の
領域とが設定される。また、請求項16に記載の提供媒
体によれば、マット画像における、所定の範囲の最小値
でないマット値すべてを包含する第1の領域と、所定の
範囲の最大値のマット値のみからなる第2の領域とを特
定するための特定情報とともに、マット画像が提供され
る。従って、効率良く画像の合成を行うことができるマ
ット画像を提供することが可能となる。According to the image generating apparatus of the tenth aspect, the image generating method of the fourteenth aspect, and the providing medium of the fifteenth aspect, a mat having a non-minimum value within a predetermined range with respect to a matte image A first area including all the values and a second area including only the maximum mat value in a predetermined range are set. Further, according to the providing medium of the sixteenth aspect, in the mat image, the first area including all the non-minimum mat values in the predetermined range and the first area including only the maximum mat value in the predetermined range. A mat image is provided together with the identification information for identifying the second area. Therefore, it is possible to provide a mat image that can efficiently combine images.
【図1】本発明を適用した画像処理装置の一実施の形態
の構成例を示すブロック図である。FIG. 1 is a block diagram illustrating a configuration example of an embodiment of an image processing apparatus to which the present invention has been applied.
【図2】図1の画像処理装置の機能的構成例を示すブロ
ック図である。FIG. 2 is a block diagram illustrating a functional configuration example of the image processing apparatus in FIG. 1;
【図3】第1および第2のバウンディングボックスの設
定方法を説明するため図である。FIG. 3 is a diagram for explaining a method of setting first and second bounding boxes.
【図4】図2の画像処理装置の処理を説明するためのフ
ローチャートである。FIG. 4 is a flowchart illustrating a process of the image processing apparatus of FIG. 2;
【図5】図4のステップS5の処理のより詳細を説明す
るためのフローチャートである。FIG. 5 is a flowchart for explaining the processing of step S5 in FIG. 4 in more detail;
【図6】領域情報付きマット画像のフォーマットを示す
図である。FIG. 6 is a diagram showing a format of a mat image with area information.
【図7】第1および第2のバウンディングボックスの他
の設定方法を説明するための図である。FIG. 7 is a diagram for explaining another setting method of the first and second bounding boxes.
【図8】図2の画像処理装置の処理を説明するためのフ
ローチャートである。FIG. 8 is a flowchart for explaining processing of the image processing apparatus of FIG. 2;
【図9】図8のステップS32の処理のより詳細を説明
するためのフローチャートである。FIG. 9 is a flowchart for explaining the processing of step S32 in FIG. 8 in more detail;
【図10】領域情報付きマット画像のフォーマットを示
す図である。FIG. 10 is a diagram showing a format of a mat image with area information.
【図11】バウンディングボックスを使用した従来の画
像合成を説明するための図である。FIG. 11 is a diagram for explaining conventional image synthesis using a bounding box.
【図12】バウンディングボックスを用いた従来の画像
合成を説明するためのフローチャートである。FIG. 12 is a flowchart for explaining conventional image composition using a bounding box.
【図13】図12のステップS84の処理のより詳細を
説明するためのフローチャートである。FIG. 13 is a flowchart for explaining the process of step S84 in FIG. 12 in more detail;
1 ROM, 2 CPU, 3 RAM, 4 入力
装置(操作手段),5 出力装置, 6 外部I/F,
7 外部記憶装置, 11 前景画像記憶部, 12
背景画像記憶部, 13 マット画像記憶部, 14
領域設定部(設定手段)(出力手段), 15 レン
ダリング部(処理手段)1 ROM, 2 CPU, 3 RAM, 4 input device (operation means), 5 output device, 6 external I / F,
7 external storage device, 11 foreground image storage unit, 12
Background image storage, 13 matte image storage, 14
Area setting unit (setting means) (output means), 15 rendering unit (processing means)
───────────────────────────────────────────────────── フロントページの続き Fターム(参考) 5B057 CA01 CA08 CB01 CB08 CC03 CE08 5B080 DA07 DA08 FA03 FA17 5C023 AA16 BA02 BA13 CA03 CA08 DA02 DA03 DA08 5C076 AA01 AA12 ──────────────────────────────────────────────────の Continued on the front page F term (reference) 5B057 CA01 CA08 CB01 CB08 CC03 CE08 5B080 DA07 DA08 FA03 FA17 5C023 AA16 BA02 BA13 CA03 CA08 DA02 DA03 DA08 5C076 AA01 AA12
Claims (16)
囲の値によって、前記第1の画像の不透明度を表すマッ
ト値からなるマット画像にしたがって合成する画像合成
装置であって、 前記マット画像に対して、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを設
定する設定手段と、 前記第1の領域の外部の領域、前記第1の領域のうちの
前記第2の領域でない領域、および前記第2の領域の3
つの領域それぞれに対応する前記第1および第2の画像
について、画像合成のための合成処理を施す処理手段と
を備えることを特徴とする画像合成装置。1. An image synthesizing apparatus for synthesizing a first image and a second image according to a matte image composed of a matte value representing the opacity of the first image by a value in a predetermined range. A setting for setting, for the mat image, a first area including all mat values that are not the minimum value in the predetermined range and a second area including only the maximum mat value in the predetermined range. Means, a region outside the first region, a region of the first region that is not the second region, and three of the second region.
Processing means for performing synthesis processing for image synthesis on the first and second images corresponding to each of the two regions.
の領域に対応する前記第1および第2の画像について、
その第2の画像をコピーする処理を施すことを特徴とす
る請求項1に記載の画像合成装置。2. The image processing apparatus according to claim 1, wherein the processing unit is configured to perform processing on the first and second images corresponding to an area outside the first area.
The image synthesizing apparatus according to claim 1, wherein a process of copying the second image is performed.
の前記第2の領域でない領域に対応する前記第1および
第2の画像について、その第1および第2の画像を、前
記マット値にしたがって合成する処理を施すことを特徴
とする請求項1に記載の画像合成装置。3. The processing means according to claim 1, wherein said first and second images corresponding to an area of said first area other than said second area are converted to said matte image. 2. The image synthesizing apparatus according to claim 1, wherein the image synthesizing apparatus performs a synthesizing process according to the value.
する前記第1および第2の画像について、その第1の画
像をコピーする処理を施すことを特徴とする請求項1に
記載の画像合成装置。4. The apparatus according to claim 1, wherein the processing unit performs a process of copying the first image for the first and second images corresponding to the second area. Image synthesis device.
する前記第1の画像の連続する画素群を、一括でコピー
することを特徴とする請求項4に記載の画像合成装置。5. The image synthesizing apparatus according to claim 4, wherein said processing means copies a group of consecutive pixels of the first image corresponding to the second area at a time.
きに操作される操作手段をさらに備え、 前記設定手段は、前記操作手段の操作に対応して、前記
第1および第2の領域を設定することを特徴とする請求
項1に記載の画像合成装置。6. An operation unit operated when designating the first and second regions, wherein the setting unit is configured to operate the first and second regions in response to an operation of the operation unit. The image synthesizing apparatus according to claim 1, wherein
するマット値に基づいて、前記第1および第2の領域を
設定することを特徴とする請求項1に記載の画像合成装
置。7. The image synthesizing apparatus according to claim 1, wherein the setting unit sets the first and second areas based on a mat value constituting the mat image.
囲の値によって、前記第1の画像の不透明度を表すマッ
ト値からなるマット画像にしたがって合成する画像合成
方法であって、 前記マット画像に対して、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを設
定する設定ステップと、 前記第1の領域の外部の領域、前記第1の領域のうちの
前記第2の領域でない領域、および前記第2の領域の3
つの領域それぞれに対応する前記第1および第2の画像
について、画像合成のための合成処理を施す処理ステッ
プとを備えることを特徴とする画像合成方法。8. An image synthesizing method for synthesizing a first image and a second image according to a matte image composed of a matte value representing the opacity of the first image by a value in a predetermined range. A setting for setting, for the mat image, a first area including all mat values that are not the minimum value in the predetermined range and a second area including only the maximum mat value in the predetermined range. A step outside of the first region, a region of the first region that is not the second region, and 3 of the second region.
Performing a combining process for combining the first and second images corresponding to each of the two regions.
囲の値によって、前記第1の画像の不透明度を表すマッ
ト値からなるマット画像にしたがって合成する処理を、
情報処理装置に行わせるための制御情報を提供する提供
媒体であって、 前記マット画像に対して、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを設
定する設定ステップと、 前記第1の領域の外部の領域、前記第1の領域のうちの
前記第2の領域でない領域、および前記第2の領域の3
つの領域それぞれに対応する前記第1および第2の画像
について、画像合成のための合成処理を施す処理ステッ
プとを備える制御情報を提供することを特徴とする提供
媒体。9. A process of synthesizing a first image and a second image according to a matte image composed of a matte value representing the opacity of the first image with a value in a predetermined range,
A providing medium for providing control information to be performed by an information processing apparatus, wherein a first area including all non-minimum mat values of the predetermined range is provided for the mat image, A setting step of setting a second area consisting of only the maximum mat value of the first area; an area outside the first area; an area of the first area that is not the second area; 3 of 2 area
A control step of performing a synthesis process for image synthesis on the first and second images corresponding to each of the two regions.
ときに用いられる、所定の範囲の値によって、前記第1
の画像の不透明度を表すマット値からなるマット画像を
生成する画像生成装置であって、 前記マット画像に対して、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを設
定する設定手段と、 前記第1および第2の領域を特定するための特定情報
を、前記マット画像とともに出力する出力手段とを備え
ることを特徴とする画像生成装置。10. A method according to claim 1, wherein said first image and said second image are combined with each other by a value in a predetermined range.
An image generating apparatus that generates a matte image including matte values representing the opacity of the image of the image, wherein a first area including all matte values that are not the minimum value in the predetermined range with respect to the matte image, Setting means for setting a second area consisting only of the maximum mat value in the predetermined range; and output means for outputting identification information for identifying the first and second areas together with the mat image. An image generating apparatus comprising:
ときに操作される操作手段をさらに備え、 前記設定手段は、前記操作手段の操作に対応して、前記
第1および第2の領域を設定することを特徴とする請求
項10に記載の画像生成装置。11. An operation unit operated when designating the first and second regions, wherein the setting unit is configured to operate the first and second regions in response to an operation of the operation unit. The image generation apparatus according to claim 10, wherein:
成するマット値に基づいて、前記第1および第2の領域
を設定することを特徴とする請求項10に記載の画像生
成装置。12. The apparatus according to claim 10, wherein the setting unit sets the first and second areas based on a mat value forming the mat image.
記マット画像および第1の画像とともに出力することを
特徴とする請求項10に記載の画像生成装置。13. The apparatus according to claim 10, wherein said output means outputs said specific information together with said matte image and said first image.
ときに用いられる、所定の範囲の値によって、前記第1
の画像の不透明度を表すマット値からなるマット画像を
生成する画像生成方法であって、 前記マット画像に対して、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを設
定する設定ステップと、 前記第1および第2の領域を特定するための特定情報
を、前記マット画像とともに出力する出力ステップとを
備えることを特徴とする画像生成方法。14. The first image processing apparatus according to claim 1, wherein the first image and the second image are combined with each other by a value in a predetermined range.
An image generation method for generating a matte image including matte values representing the opacity of an image, wherein: a first area including all non-minimum matte values in the predetermined range with respect to the matte image; A setting step of setting a second area consisting only of the maximum mat value in the predetermined range; and an output step of outputting identification information for identifying the first and second areas together with the mat image. An image generation method comprising:
ときに用いられる、所定の範囲の値によって、前記第1
の画像の不透明度を表すマット値からなるマット画像を
生成する処理を、情報処理装置に行わせるための制御情
報を提供する提供媒体であって、 前記マット画像に対して、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを設
定する設定ステップと、 前記第1および第2の領域を特定するための特定情報
を、前記マット画像とともに出力する出力ステップとを
備える制御情報を提供することを特徴とする提供媒体。15. The first image processing apparatus according to claim 1, wherein the first image and the second image are combined with each other by a value in a predetermined range.
A providing medium for providing control information for causing an information processing apparatus to perform a process of generating a mat image including a mat value representing the opacity of the image, wherein the matte image has a predetermined range of A setting step of setting a first area including all non-minimum mat values and a second area including only the maximum mat value in the predetermined range; and specifying the first and second areas. An output step of outputting specific information for performing the operation together with the mat image.
ときに用いられる、所定の範囲の値によって、前記第1
の画像の不透明度を表すマット値からなるマット画像を
提供する提供媒体であって、 前記マット画像における、前記所定の範囲の最小値でな
いマット値すべてを包含する第1の領域と、前記所定の
範囲の最大値のマット値のみからなる第2の領域とを特
定するための特定情報とともに、前記マット画像を提供
することを特徴とする提供媒体。16. A method for synthesizing a first image and a second image, comprising the steps of:
A providing area for providing a matte image including a matte value representing the opacity of the image of the image, wherein a first area including all non-minimum matte values in the predetermined range in the matte image; A providing medium for providing the matte image together with identification information for identifying a second area consisting only of a maximum matte value of a range.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP10326455A JP2000151982A (en) | 1998-11-17 | 1998-11-17 | Image compositor, image compositing method image generating device, image generating method and served medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP10326455A JP2000151982A (en) | 1998-11-17 | 1998-11-17 | Image compositor, image compositing method image generating device, image generating method and served medium |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2000151982A true JP2000151982A (en) | 2000-05-30 |
Family
ID=18188013
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP10326455A Withdrawn JP2000151982A (en) | 1998-11-17 | 1998-11-17 | Image compositor, image compositing method image generating device, image generating method and served medium |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2000151982A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001202504A (en) * | 2000-01-21 | 2001-07-27 | Seiko Epson Corp | Medium with image processing program recorded thereon, device and method for image processing and printer |
JP2005189663A (en) * | 2003-12-26 | 2005-07-14 | Matsushita Electric Ind Co Ltd | Multi-layer image composing system |
JP2009032290A (en) * | 2008-10-27 | 2009-02-12 | Namco Bandai Games Inc | Program, information storage medium, and image generation system |
JP2009071737A (en) * | 2007-09-14 | 2009-04-02 | Ricoh Co Ltd | Image processor, image processing system, image processing method, program, and recording medium |
-
1998
- 1998-11-17 JP JP10326455A patent/JP2000151982A/en not_active Withdrawn
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001202504A (en) * | 2000-01-21 | 2001-07-27 | Seiko Epson Corp | Medium with image processing program recorded thereon, device and method for image processing and printer |
JP2005189663A (en) * | 2003-12-26 | 2005-07-14 | Matsushita Electric Ind Co Ltd | Multi-layer image composing system |
JP2009071737A (en) * | 2007-09-14 | 2009-04-02 | Ricoh Co Ltd | Image processor, image processing system, image processing method, program, and recording medium |
US8223397B2 (en) | 2007-09-14 | 2012-07-17 | Ricoh Company, Limited | Image processing apparatus, image processing method, and recording medium |
JP2009032290A (en) * | 2008-10-27 | 2009-02-12 | Namco Bandai Games Inc | Program, information storage medium, and image generation system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4532605A (en) | True zoom of a displayed image | |
KR960006526B1 (en) | Image processing apparatus and external storage unit | |
KR100349483B1 (en) | Image processing in which polygon is divided | |
JP2000149053A (en) | Image processor including blending processing and its method | |
CN101606179B (en) | Universal front end for masks, selections and paths | |
EP1031946A2 (en) | Recording medium,Image processing method and unit with integrated shaping model data | |
TW472214B (en) | Image processing apparatus, recording medium, and program | |
JP2000151982A (en) | Image compositor, image compositing method image generating device, image generating method and served medium | |
TW200529097A (en) | Image rendering with multi-level z-buffers | |
JPS6282472A (en) | Picture processing system | |
JP2000322601A (en) | Image generating system | |
JP4769230B2 (en) | Image processing apparatus, image processing method, and program | |
JP2000331175A (en) | Method and device for generating border line generating data, recording system, computer readable execution medium stored with data and entertainment system for adding outline to object according to data | |
JPH0816816A (en) | Computer graphics display method | |
JP3798561B2 (en) | Image display control device | |
JP2713677B2 (en) | Color image color change processing method and color image synthesis processing method | |
JP3652586B2 (en) | Image drawing system | |
JPH07131817A (en) | Method and device for image synthesis | |
JP3255549B2 (en) | Figure processing method | |
JP3453410B2 (en) | Image processing apparatus and method | |
JPH1032712A (en) | Picture processor | |
JPH0737083A (en) | Device and method for processing image | |
JP3585036B2 (en) | Image generation method | |
JPH08329280A (en) | Image composition device | |
JPH06274648A (en) | Image generator |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20060207 |