资源简介
这是本人修改和撰写的一个程序,原创的。。里面有一个测试图,直接运行zuihoubanben.m就可以出结果,程序也比较容易读懂。如果要换自己的图,还是改参数就行了。本程序非常适合大小差不多的多椭圆检测。
代码片段和文件信息
function [accum varargout] = CircularHough_Grd(img radrange varargin)
%Detect circular shapes in a grayscale image. Resolve their center
%positions and radii.
%
% [accum circen cirrad dbg_LMmask] = CircularHough_Grd(
% img radrange grdthres fltr4LM_R multirad fltr4accum)
% Circular Hough transform based on the gradient field of an image.
% NOTE: Operates on grayscale images NOT B/W bitmaps.
% NO loops in the implementation of Circular Hough transform
% which means faster operation but at the same time larger
% memory consumption.
%
%%%%%%%% INPUT: (img radrange grdthres fltr4LM_R multirad fltr4accum)
%
% img: A 2-D grayscale image (NO B/W bitmap)
%
% radrange: The possible minimum and maximum radii of the circles
% to be searched in the format of
% [minimum_radius maximum_radius] (unit: pixels)
% **NOTE**: A smaller range saves computational time and
% memory.
%
% grdthres: (Optional default is 10 must be non-negative)
% The algorithm is based on the gradient field of the
% input image. A thresholding on the gradient magnitude
% is performed before the voting process of the Circular
% Hough transform to remove the ‘uniform intensity‘
% (sort-of) image background from the voting process.
% In other words pixels with gradient magnitudes smaller
% than ‘grdthres‘ are NOT considered in the computation.
% **NOTE**: The default parameter value is chosen for
% images with a maximum intensity close to 255. For cases
% with dramatically different maximum intensities e.g.
% 10-bit bitmaps in stead of the assumed 8-bit the default
% value can NOT be used. A value of 4% to 10% of the maximum
% intensity may work for general cases.
%
% fltr4LM_R: (Optional default is 8 minimum is 3)
% The radius of the filter used in the search of local
% maxima in the accumulation array. To detect circles whose
% shapes are less perfect the radius of the filter needs
% to be set larger.
%
% multirad: (Optional default is 0.5)
% In case of concentric circles multiple radii may be
% detected corresponding to a single center position. This
% argument sets the tolerance of picking up the likely
% radii values. It ranges from 0.1 to 1 where 0.1
% corresponds to the largest tolerance meaning more radii
% values will be detected and 1 corresponds to the smallest
% tolerance in which case only the “principal“ radius will
% be picked up.
%
% fltr4accum: (Optional. A default filter will be used if not given)
%
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1855826 2011-12-22 15:06 11.tif
文件 24934 2011-12-05 13:28 CircularHough_Grd.m
文件 899 2012-03-14 10:41 zuihoubanben.m
- 上一篇:matlab圆心、半径检测
- 下一篇:动物识别系统matlab
评论
共有 条评论