Add some tests on different variations of Hough algorithm.
[master-thesis.git] / src / Tests_hough / test_hough_ellipses.m
diff --git a/src/Tests_hough/test_hough_ellipses.m b/src/Tests_hough/test_hough_ellipses.m
new file mode 100644 (file)
index 0000000..490b67d
--- /dev/null
@@ -0,0 +1,22 @@
+function test_hough_ellipses(images_path, image_name)
+    i = imread([images_path image_name]);
+    green = i(:,:,2);
+    green_filtered = imgaussfilt(double(green), 1.0);
+    edges = edge(green_filtered);
+
+    disp('Applying Houg...');
+    tic
+    [acc_votes, acc_radius1, acc_radius2, acc_alpha] = HTEllipse(edges, [20, 40]);
+    toc
+
+    disp('Finding ellipses...');
+    tic
+    ellipses = find_ellipses(acc_votes, acc_radius1, acc_radius2, acc_alpha);
+    toc
+    
+    show_figures(['Hough ellipses - ' image_name], {...
+        {green, 'original'},...
+        {green_filtered, 'original filtered with a gaussian, sigma=1'},...
+        {edges, 'edges (sobel)'},...
+        {expand_matrix(acc_votes), 'votes'}}, green, ellipses);
+end
\ No newline at end of file