www.gusucode.com > 基于matlab程序hough变换检测圆源码 > 基于matlab程序hough变换检测圆源码/hough检测圆/DrawCircle.m

    function DrawCircle(x, y, r, nseg, s)
% Draw a circle on the current figure using ploylines
%
%  DrawCircle(x, y, r, nseg, S)
%  A simple function for drawing a circle on graph.
%
%  INPUT: (x, y, r, nseg, S)
%  x, y:    Center of the circle
%  r:       Radius of the circle
%  nseg:    Number of segments for the circle
%  S:       Colors, plot symbols and line types
%
%  OUTPUT: None
%
%  BUG REPORT:
%  Please send your bug reports, comments and suggestions to
%  pengtao@glue.umd.edu . Thanks.

%  Author:  Tao Peng
%           Department of Mechanical Engineering
%           University of Maryland, College Park, Maryland 20742, USA
%           pengtao@glue.umd.edu
%  Version: alpha       Revision: Jan. 10, 2006


theta = 0 : (2 * pi / nseg) : (2 * pi);
pline_x = r * cos(theta) + x;
pline_y = r * sin(theta) + y;

%plot(pline_x, pline_y, s);

 plot(pline_x, pline_y,'r','LineWidth',2)
 hold on
 plot(pline_x, pline_y,'r','LineWidth',4)