资源简介
用来计算Hough变换的函数,他可以帮助我们探讨基于hough变换的线检测
代码片段和文件信息
function [h theta rho] = hough(f dtheta drho)
%HOUGH Hough transform.
% [H THETA RHO] = HOUGH(F DTHETA DRHO) computes the Hough
% transform of the image F. DTHETA specifies the spacing (in
% degrees) of the Hough transform bins along the theta axis. DRHO
% specifies the spacing of the Hough transform bins along the rho
% axis. H is the Hough transform matrix. It is NRHO-by-NTHETA
% where NRHO = 2*ceil(norm(size(F))/DRHO) - 1 and NTHETA =
% 2*ceil(90/DTHETA). Note that if 90/DTHETA is not an integer the
% actual angle spacing will be 90 / ceil(90/DTHETA).
%
% THETA is an NTHETA-element vector containing the angle (in
% degrees) corresponding to each column of H. RHO is an
% NRHO-element vector containing the value of rho corresponding to
% each row of H.
%
% [H THETA RHO] = HOUGH(F) computes the Hough transform using
% DTHETA = 1 and DRHO = 1.
% Copyright 2002-2004 R. C. Gonzalez R. E. Woods & S. L. Eddins
% Digital Image Processing Using MATLAB Prentice-Hall 2004
% $Revision: 1.4 $ $Date: 2003/10/26 22:33:44 $
if nargin < 3
drho = 1;
end
if nargin < 2
dtheta = 1;
end
f = double(f);
[MN] = size(f);
theta = linspace(-90 0 ceil(90/dtheta) + 1);
theta = [theta -fliplr(theta(2:end - 1))];
ntheta = length(theta);
D = sqrt((M - 1)^
- 上一篇:高斯混合模型matlab实现
- 下一篇:基于HSV非均匀量化直方图的图像检索
评论
共有 条评论