Add some tests on different variations of Hough algorithm.
[master-thesis.git] / src / Tests_hough / test_hough_ellipses.m
1 function test_hough_ellipses(images_path, image_name)
2     i = imread([images_path image_name]);
3     green = i(:,:,2);
4     green_filtered = imgaussfilt(double(green), 1.0);
5     edges = edge(green_filtered);
6
7     disp('Applying Houg...');
8     tic
9     [acc_votes, acc_radius1, acc_radius2, acc_alpha] = HTEllipse(edges, [20, 40]);
10     toc
11
12     disp('Finding ellipses...');
13     tic
14     ellipses = find_ellipses(acc_votes, acc_radius1, acc_radius2, acc_alpha);
15     toc
16     
17     show_figures(['Hough ellipses - ' image_name], {...
18         {green, 'original'},...
19         {green_filtered, 'original filtered with a gaussian, sigma=1'},...
20         {edges, 'edges (sobel)'},...
21         {expand_matrix(acc_votes), 'votes'}}, green, ellipses);
22 end