function [ w ] = computeW( source_img, target_img, past_mask, alpha_mask )
%COMPUTEW Automatically compute value for w [0,1]

    addpath(genpath('./color_distance'));
    
    past_mask = past_mask(:,:,1);
    alpha_mask = alpha_mask(:,:,1);
    red_s = source_img(:,:,1);
    green_s = source_img(:,:,2);
    blue_s = source_img(:,:,3);
    rs = mean(red_s(past_mask>0 & alpha_mask<0.8));
    gs = mean(green_s(past_mask>0 & alpha_mask<0.8));
    bs = mean(blue_s(past_mask>0 & alpha_mask<0.8));
    
    red_t = target_img(:,:,1);
    green_t = target_img(:,:,2);
    blue_t = target_img(:,:,3);
    rt = mean(red_t(past_mask>0 & alpha_mask<0.8));
    gt = mean(green_t(past_mask>0 & alpha_mask<0.8));
    bt = mean(blue_t(past_mask>0 & alpha_mask<0.8));

    w = COL_DIST([rs gs bs]*255,[rt gt bt]*255);
    
end

