function [C, D, A, W] = icasig_avg(fn, f)

mov = aviread(fn);

t = size(f,2);
I = [];
for i=1:t
    I1 = frame2im(mov(f(i)));
    I1 = rgb2gray(I1);
    figure; imshow(I1);
    p = size(I1,1);
    q = size(I1,2);
    I1 = reshape(I1, 1, p*q);
    I = [I; I1];
end

[icasig, A, W] = fastica(I);
[j,sign] = find_largest(A);
C = sign*icasig(j, :);

%mx = max(max(I));
%mn = min(min(I));

figure; show_vector4(C, p, q);

D =  mean(I,1);
D = uint8(D);
D = reshape(D, p, q);
figure; imshow(D);
