-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathhoughcircle.m
41 lines (32 loc) · 917 Bytes
/
houghcircle.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% houghcircle - takes an edge map image, and performs the Hough transform
% for finding circles in the image.
%
% Usage:
% h = houghcircle(edgeim, rmin, rmax)
%
% Arguments:
% edgeim - the edge map image to be transformed
% rmin, rmax - the minimum and maximum radius values
% of circles to search for
% Output:
% h - the Hough transform
%
% Author:
% Libor Masek
% School of Computer Science & Software Engineering
% The University of Western Australia
% November 2003
function h = houghcircle(edgeim, rmin, rmax)
[rows,cols] = size(edgeim);
nradii = rmax-rmin+1;
h = zeros(rows,cols,nradii);
[y,x] = find(edgeim~=0);
%for each edge point, draw circles of different radii
for index=1:size(y)
cx = x(index);
cy = y(index);
for n=1:nradii
h(:,:,n) = addcircle(h(:,:,n),[cx,cy],n+rmin);
end
end