function [blurredIm] = blurrImage(im, sigma)
    
    % Build the 2D Gaussian filter:
    filterLength = 2 * round(3.0 * sigma) + 1;
    x = [1:filterLength] - round((filterLength+1)/2);
    sigmaSqr = sigma * sigma;
    gauss1D = exp(-x .^2 / (2.0*sigmaSqr));
    gauss1D = gauss1D / sum(gauss1D);
    filter = repmat(gauss1D, size(gauss1D,2), 1) .* repmat(gauss1D', 1, size(gauss1D,2));
    
    % Convolve the image with the gaussian kernel:
    blurredIm = conv2(im, filter, 'same');
