SUNY Geneseo Department of Mathematics
Friday, April 15
Math 230 02
Spring 2016
Prof. Doug Baldwin
chromakey( subject, background, low, f )
% "low" = lowest intensity to be considered white
% high level step 1: look for subject pixels with RGB in certain range
% track background pixels w/ mask matrix
% mask has 1 (aka true) on white background pixels
% Still need to figure out how to combine the 4 tests below into one mask
mask = subject > low
red > (1-f)*green & red < (1+f)*green
green > (1-f)*blue & green < (1+f)*blue
red > (1-f)*blue & red < (1+f)*blue
% high level step 2: replace found pixels in subj with same pixels f/ bkgnd
% C is composite image
C = mask .* background + (1-mask) .* subject
% Or...
C = subject
C( mask ) = background( mask )
% In either case...
return C