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.
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.
· For Image From File blocks, Constant blocks and Transpose block, set signal output data type as ‘uint8’. The values for the constants may differ with your back-screen colour, for my images I use [130 170 118] RGB as the filtering margin.
· For Matrix Concatenate block, set parameters as below.
- · Finally for the Embedded MATLAB function block, add the code as below.
It is the same code I used in my previous articles, but I removed the code lines which I used to select chroma majoring colour and only used the operation on blue backgrounds. Input images are as below
The resulting images will be as below.
For the Chroma keying on Video you can just replace the Image From file blocks from From Multimedia flie blocks in Image Processing tool box or From Video Device in Image Acquisition tool box. Resulting video is as below, you can also note how much slow is the process.
Using MATLAB simulink basic function
For the implementation arrange the Simulink blocks as below.
In here I mapped the above code to appropriate Simulink building blocks. Results are same as above and For the Chroma keying on Video you can just replace the Image From file blocks from From Multimedia flie blocks in Image Processing tool box or From Video Device in Image Acquisition tool box. Resulting video is as below; you can also note how much slow the process is.
9 Comments »
I am Thilina Sameera from Sri Lanka. I completed my undergraduate studies on Electronic and Telecommunication Engineering in University of Moratuwa and currently doing my post graduate studies on Computer Vision and Processor Design at the Department of Electronic and Telecommunication Engineering, University of Moratuwa. I am working as a Biomedical Research Engineer at “Premium International – University of Moratuwa, Research and Development Laboratory for Biomedical Technologies” at the Department of Electronic and Telecommunication Engineering, University of Moratuwa.
Ask from Thilina
Top Posts & Pages
- 291,146 hits
Top Of Blogs
My Networked Blogs
Site infoThilina's Blog
Blog at WordPress.com.