Upload
phungtuong
View
215
Download
0
Embed Size (px)
Citation preview
Chroma Key Implimentation using MATLAB
Kyurim Rhee
2009-05-20
I. Introduction
Chroma key is a method of superimposing a selected foreground image onto a desired background image via use of image processing. A common use of such process is a weather man superimposed over a weather map or a cartoon foreground image superimposed onto another background image. In filming movies where it is difficult for filming crews to set up a scene, actors can act in a setup with only the foreground setups with chroma key screens in the background. The filmed foreground images can then be pulled and superimposed onto the background image to create the final images.
II. MATLAB implimentation
To demonstrate chroma keying in MATLAB, a color image with blue background was selected. A separte backgournd image was also selected. The color foreground image with blue background was then separated into red, green and blue components as shown on fig.1. col.1. The intensity components of the separated red, green and blue images were examined using a histogram shown on fig.1. col.2. A mask for each color was created by analyzing the histogram for the range at which the background pixels exsisted, shown in figure1 col.3. The mask for each red, green and blue images were then mutiplied to create a final mask shown on Fig1. col.1. row.3. This mask and the inverse of the mask was multiplied by the foreground image and the background image, respectively to create the chroma keyed images shown on fig.2. row.3. Adding the chroma keyed foreground image and chroma keyed background image creates the final image shown on fig.3.
Figure 1
Original Image
RG
B
0 100 200
0
200
400
600
800
Chroma Key
Histogram
gray
scal
e
Mask
Fina
l Mas
k
Red
0 100 200
0
200
400
600
800
Mas
k us
ing
Red
Com
pone
nt
Gre
en
0 100 200
0
200
400
600
800
Mas
k us
ing
Gre
en C
ompo
nent
Blu
e
0 100 200
0
200
400
600
800
1000
Mas
k us
ing
Blu
e C
ompo
nent
Figure 2
ForeGround
Orig
inal
For
egro
und
Imag
e
BackGround
Orig
inal
Bac
kgro
und
Imag
e
Fore
grou
nd M
ask
Bac
kgro
und
Mas
k
Chr
oma
Key
ed F
oreg
roun
d
Chr
oma
Key
ed B
ackg
roun
d
Chroma Keyed Final Image