houghcirclescv

Detect circles in a grayscale image using the Hough transformation algorithm.

Syntax

houghcirclescv(handle, ratio, dist...)

houghcirclescv(handle, ratio, dist, param1, param2, min, max)

Inputs

handle
Handle of an image from the ComputerVision library.
Type: integer
ratio
Inverse ratio of the accumulator resolution to the image resolution.
Type: scalar
dist
Minimum distance between the centers of the detected circles.
Type: scalar
param1
Optional first method-specific parameter, defaults to 100.
Type: scalar
param2
Optional second method-specific parameter, defaults to 100.
Type: scalar
min
Optional minimum circle radius, defaults to 0.
Type: integer
max
Optional maximum circle radius, defaults to 0.
Type: integer

Example

Detect and show circles in an image using Hough transform:
src = imreadcv('bird3.jpg');
srcsize = imsizecv(src);
houghcirclescv(src, 1, srcsize(1)/16, 150,  20, 10, 30);
Figure 1. Source image


Figure 2. Hough transformation of source image


Detect and show circles:
%Read image
img = imreadcv('houghcirclescv_fig3.png',1);
figure(1);
imshowcv(img);
  
%Apply Hough transform on the image
houghcirclescv(img,3,2,200,300,10);

figure(2);
imshowcv(img);
Figure 3. Source image


Figure 4. Hough transformation of source image