function test_hough_gradient(images_path, image_name, use_edges_mask)
    i = imread([images_path image_name]);

    green = i(:,:,2);
    green_filtered = imgaussfilt(green, 1.0);

    edges = zeros(size(green));
    if use_edges_mask
        otsu = ~im2bw(green_filtered, graythresh(green_filtered));  
        se = strel('rectangle', [3 3]);
        edges = imdilate(otsu, se) - imerode(otsu, se);
    end

    s = [-1 0 1; -2 0 2; -1 0 1];
    x_edge = conv2(cast(green_filtered, 'double'), s , 'valid');
    y_edge = conv2(cast(green_filtered, 'double'), s', 'valid');

    magnitudes = sqrt(x_edge .^ 2 + y_edge .^ 2);

    if use_edges_mask
        magnitudes(~edges(2:end-1, 2:end-1)) = 0;
    end

    disp('Applying Houg...');
    tic
    [acc_votes, acc_radius] = HTCircleGradient(magnitudes, [25, 35]);
    toc

    disp('Finding ellipses...');
    tic
    ellipses = find_ellipses(acc_votes, acc_radius);
    toc

    name = ['Hough gradient - ' image_name];
    if use_edges_mask
        name = [name ' (with edges)'];
    end

    show_figures(name, {...
        {green_filtered, 'original filtered with a gaussian, sigma=1'},...
        {edges, 'edges (otsu -> dilate - erode)'},...
        {magnitudes, 'magnitudes'},...
        {expand_matrix(acc_votes), 'votes'}}, green, ellipses);
end

