% Emulates the picture taking process of a picture of the scene from a camera with matrix P:
function [im] = takePicture(scene,P,width,height,sigma)
    
    photos      = scene{2};
    photoCoords = scene{3};
    
    im = zeros(height*width,1);
    
    for k =size(photos,2):-1:1
        % Blurr the photo in the plane:
        photo = blurrImage(photos{k}, sigma);
        coord = photoCoords{k};
        
        % Compute the image formation matrix:
        F = getImgFormationMatrix(P,width,height,size(photo,2),size(photo,1),coord(1),coord(2),coord(3));
        
        % Compute the region of the image where the photo is projected:
        picProj = F * ones(size(photo,1)*size(photo,2),1);
        inPicture = (picProj~=0);
        
        % Compute the projection of the photo in the image:
        pic = F * photo(:);
        
        % Overlapp the current picture to the image:
        im(inPicture) = pic(inPicture);
    end
    
    im = reshape(im,height,width);
