diff --git a/chromakey/adventure_rose.png b/chromakey/adventure_rose.png new file mode 100644 index 0000000..40435c3 Binary files /dev/null and b/chromakey/adventure_rose.png differ diff --git a/chromakey/alpha.png b/chromakey/alpha.png deleted file mode 100644 index 1bf0d44..0000000 Binary files a/chromakey/alpha.png and /dev/null differ diff --git a/chromakey/background.png b/chromakey/background.png deleted file mode 100755 index 77c6ae3..0000000 Binary files a/chromakey/background.png and /dev/null differ diff --git a/chromakey/cineon_before.png b/chromakey/cineon_before.png new file mode 100644 index 0000000..09eec08 Binary files /dev/null and b/chromakey/cineon_before.png differ diff --git a/chromakey/edges.png b/chromakey/edges.png deleted file mode 100644 index a251780..0000000 Binary files a/chromakey/edges.png and /dev/null differ diff --git a/chromakey/final.png b/chromakey/final.png deleted file mode 100644 index 412e8d2..0000000 Binary files a/chromakey/final.png and /dev/null differ diff --git a/chromakey/intermediate.png b/chromakey/intermediate.png deleted file mode 100644 index 32eae74..0000000 Binary files a/chromakey/intermediate.png and /dev/null differ diff --git a/chromakey/prj_load.m b/chromakey/prj_load.m new file mode 100644 index 0000000..00cc32b --- /dev/null +++ b/chromakey/prj_load.m @@ -0,0 +1,66 @@ +## Copyright (C) 2020 Jens +## +## This program is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {} {@var{retval} =} prj_load (@var{input1}, @var{input2}) +## +## @seealso{} +## @end deftypefn + +## Author: Jens +## Created: 2020-10-04 + +function [im_rgb, ref_rgb] = prj_load(prj_name) +extensions = {'.png'}; +name_im = '' +for i=1:length(extensions), + ext = extensions{i} + name_cand = strcat(prj_name, ext) + if isfile(name_cand) + name_im = name_cand; + break; + + end; +end; + +if isempty(name_im) + error("File Not found") +end + +[im, m, a] = imread(name_im); +if length(a) == 0 + error("Alpha channel not found") +end + +# Get image dimensions +[w, h, nc] = size(im) + +# Get RGBA data +im_rgb = im2double(im); +im_a = im2double(a); + +# Find background sample area in alpha channel +# And create reference data +ref_sample_indices = find(im_a < 0.5); +zzz = reshape(im_rgb, w*h, nc); +ref = mean(zzz(ref_sample_indices, :)) +ref_rgb = toRef(ref, size(im_rgb)); + +function r = toRef(ref, d) + r = repmat(reshape(ref,1, 1, 3), d(1), d(2)); +endfunction + +endfunction