- added function to get background sample from alpha markings

git-svn-id: http://moon:8086/svn/matlab/trunk@146 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
2020-10-04 16:08:41 +00:00
parent 0fbe711264
commit 9805599b00
6 changed files with 18 additions and 17 deletions
+10 -16
View File
@@ -23,25 +23,23 @@
## Author: Jens <jens@orion>
## Created: 2020-10-03
function chromakey (img_name)
im = im2double(imread(img_name));
im_rgb = imresize(im, 1);
se = strel('square',3)
# chromakey('adventure_rose', 20, 10)
# chromakey('cineon_before', 200, 100)
#ref = [0.3 0.4 0.65]; # cineon_before
ref = [0.2 0.6 0.95]; # adventure_rose
ref_rgb = toRef(ref, size(im_rgb));
function chromakey (prj_name, k_e_matte, k_e_edge)
k_ds_matte = 1.0;
k_e_matte = 20.0
k_e_edge = 10.0
[im_rgb, ref_rgb] = prj_load(prj_name);
close all;
figure;
matte = supermatte(im_rgb, ref_rgb, k_e_matte);
[matte, dev, conf] = supermatte(im_rgb, ref_rgb, k_e_matte);
imshow(matte); title("matte")
figure;
imshow(dev); title("dev")
figure;
imshow(conf); title("conf")
figure;
intermediate = im_rgb.*matte;
@@ -60,10 +58,6 @@ imwrite(edges, 'edges.png','png');
imwrite(final, 'final.png','png','alpha', matte);
imwrite(matte, 'alpha.png','png');
function r = toRef(ref, d)
r = repmat(reshape(ref,1, 1, 3), d(1), d(2));
endfunction
function mask = mask_clip_above(mask_in, thresh)
k = mask_in < thresh;
mask = k .* mask_in + kn;