function brightSpot = getBrightSpotOnSphere(chrome, chromeMask)
%Given an image of a chrome sphere (img), find the position of the center
%of the bright spot, assuming there is one.

chromeMask = im2double(chromeMask);
[M, N] = size(chromeMask);

K = length(chrome); % number of images for processing.
brightSpot = cell(1,K);
for k = 1:K
    meanX = 0; meanY = 0;   %initial value of X and Y coordinate.
    NBB = 0;     % number of bright sport pixel.
    chrome{k} = rgb2gray(chrome{k});
    chrome{k} = im2double(chrome{k});
    for i = 1:M
        for j = 1:N
            if(chromeMask(i,j) == 1)
                if chrome{k}(i,j) > 0.9
                    meanX = meanX + i;
                    meanY = meanY + j;
                    NBB = NBB + 1;
                end;
            end;
        end;
    end;
    brightSpot{k} = zeros(1,2);
    brightSpot{k}(1) = meanX/NBB;
    brightSpot{k}(2) = meanY/NBB;    
end;




