Thilina's Blog

I might be wrong, but…

Chroma Keying MATLAB Implementation 4.0


Hopefully this will be my final article on chroma keying, in this article I will try to address the key disadvantages and faults identified in my previous posts by myself. In my previous chroma keying functions I only segmented a region which has the luminance level of [x, 255] or [0, x]. But on working with function I realised that some colour details in images also has segmented out as a background mask.

With this experience I modified my function to segment out a small colour band which is most likely acts as the background of the foreground image. What I have done is obtain the mean colour (say mR, mG, mB) and its maximum deviation (say sR, sG, sB) on user defined points on the foreground image and then segment the foreground image using the colour band obtained from the above result. Now the modified segemented colour band will be [mR-sR:mR+sR, mG-sG:mG+sG, mB-sB:mB+Sb] which will results in less colour distortion in the resulting image.

Continue reading

2011 January 10 Posted by | Chroma Keying, Image Processing, MATLAB | 2 Comments

Chroma Keying MATLAB Implementation 3.0


In my previous articles on chroma key implementation on MATLAB (Chroma Keying MATLAB Implementation 1.0 and 2.0), I explained how to key two images using a simple image segmentation method called ‘Image thresholding’ and to key an image and a video. In this article I’ll try to extend above to implement on MATLAB simulink.

There are two approaches to implement these on MATLAB, first is to implement chroma key using the MATLAB embedded function block and the second is to implement above functionality using basic simulink blocks.

Using MATLAB simulink embedded function

For the implementation arrange the Simulink blocks as below. Image from file block can be found in simulink video and image processing tool box under the source category and Video viewer under sink category. Matrix operation blocks can be found in Signal processing tool box and the Embedded MATLAB function can be found under Simulink user defined functions. And set its parameters as described below.

clip_image002

Continue reading

2010 December 29 Posted by | Chroma Keying, Image Processing, MATLAB, Technology | 9 Comments

Chroma Keying MATLAB Implementation 2.0


In my previous article on chroma key implementation on MATLAB (Chroma Keying MATLAB Implementation 1.0), I explained how to key two images using a simple image segmentation method called ‘Image thresholding’. In this article I’ll try to extend above result to key a foreground video with a background image. Please note that this implementation can be use to process a video after saving it or post processing manner.

During this implementation I used an *.avi video file ‘movie.avi’, which has the chroma keying properties; a video taken in front of a blue screen as my foreground video and ‘background.jpg’ as my background image.

clip_image002 clip_image004

Opening a movie to MATLAB workspace can done by using the command ‘mmreader ()’. The command creates a multimedia reader object on MATLAB workspace. You can read more on this command by typing ‘doc mmreader’ on MATLAB command prompt.

Continue reading

2010 December 16 Posted by | Chroma Keying, Image Processing, MATLAB, Technology | 9 Comments

Chroma Keying MATLAB Implementation 1.0


In my previous article I discussed the major concepts on chroma keying. In this article I will discuss a method for use chroma keying principles to key two images in to a single image. For the implementation we need two images which can use as background and foreground images. I select ‘background.jpg’ and ‘foreground.jpg’ as my background and foreground images for the keying operation. Note that the foreground is the image which you stay in front of that special reflecting screen.

    clip_image002 clip_image004

We can add those two images in to MATLAB workspace by using following commands.

imBg = imread(‘background.jpg’);

imFg = imread(‘foreground.jpg’);

As we can see the foreground major colour is blue, therefore we have to mask the corresponding blue colour from the image. In order to perform this operation, we need to create a mask with colour thresholds. The ‘key’ variable contains the corresponding RGB colours for the above colour filtering operation.

Continue reading

2010 December 3 Posted by | Chroma Keying, Image Processing, MATLAB, Technology | 21 Comments

Chroma Keying


When we watching TV programs and some movies some times we amazed by seeing the background of the presenter. Some times in front of a fantasy location or with various moving objects etc.

Technology behind this magic is called chroma keying. In chroma keying uses a special kind of back screen which reflects the light to the direction which to the screen. In the camera side as in the picture, around its opening green or blue colour LEDs were set as a light source. Selecting this blue or green colour is due to a special reason that is they are the less related colours to the human complexion. Most of the time this colours are selected as Green (0,255,0) and Blue (0,0,255)  in 8-bit RGB colour pallet.

Continue reading

2010 November 18 Posted by | Chroma Keying, Image Processing, MATLAB, Technology | 4 Comments

   

%d bloggers like this: