%EUSIPCO 2012
%Imperial College London 
%Andriy Gelman, Jon Onativia and Pier Luigi Dragotti 

function [connected_pixels, intra_pixels] = evaluate_uncovered_pixels(label, layer_val, disparity)

    layer = extract_layer(label, label, layer_val);
    layer(layer>0) = 1;
    layer_frame_1 = layer(:,:,1);
    layer_frame_2 = layer(:,:,2);
    
    %disparity compensate frame 1 onto frame 2
    layer_frame_1 = integer_shift(layer_frame_1, disparity );
    
    intra_pixels = layer_frame_2 - layer_frame_1;
    
    intra_pixels((intra_pixels)>0)=1;
    intra_pixels(intra_pixels<0) = 0;
    
    connected_pixels = layer_frame_2;
    connected_pixels(intra_pixels == 1) =0;
end