MohamedX17
Newbie level 1
- Joined
- Feb 10, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 9
I am not sure whether this is the right section or not
Recently I've started to self study Image processing using matlab for more precision I am trying to do chroma keying the two pictures in the attachment and here is my code
There is a problem in the matrix re-sizing so any idea how to fix that and Thanks in advance.
Recently I've started to self study Image processing using matlab for more precision I am trying to do chroma keying the two pictures in the attachment and here is my code
Code:
clc
clear
close all
rgb = imread('ninjagreen.jpg');
rgb=double(rgb)/255;
inds=((rgb(:,:,2)<=.58));
rgb(:,:,1)=rgb(:,:,1).*inds;
rgb(:,:,2)=rgb(:,:,2).*inds;
rgb(:,:,3)=rgb(:,:,3).*inds;
image(rgb)
red=rgb(:,:,1);
green=rgb(:,:,2);
blue=rgb(:,:,3);
redin=find(red~=0);
greenin=find(green~=0);
bluein=find(blue~=0);
forest=imread('forest.jpg');
forest=double(forest)/255;
forest_R=forest(:,:,1);
forest_G=forest(:,:,2);
forest_B=forest(:,:,3);
forest_R(redin)=red(redin);
forest_G(greenin)=green(greenin);
forest_B(bluein)=blue(bluein);
forest(:,:,1)=forest_R;
forest(:,:,2)=forest_G;
forest(:,:,3)=forest_B;
image(forest)