-
大小: 6KB文件類型: .rar金幣: 2下載: 0 次發布日期: 2021-05-21
- 語言: Matlab
- 標簽: hough變換??matlab??houghlines??houghpeaks??
資源簡介
hough變換matlab程序的houghlines和houghpeaks源代碼。

代碼片段和文件信息
function?lines?=?houghlines(varargin)
%HOUGHLINES?Extract?line?segments?based?on?Hough?transform.
%???LINES?=?HOUGHLINES(BW?THETA?RHO?PEAKS)?extracts?line?segments
%???in?the?image?BW?associated?with?particular?bins?in?a?Hough?
%???transform.??THETA?and?RHO?are?vectors?returned?by?function?HOUGH.
%???Matrix?PEAKS?which?is?returned?by?function?HOUGHPEAKS
%???contains?the?row?and?column?coordinates?of?the?Hough?transform?
%???bins?to?use?in?searching?for?line?segments.?HOUGHLINES?returns
%???LINES?structure?array?whose?length?equals?the?number?of?merged
%???line?segments?found.?Each?element?of?the?structure?array?has
%???these?fields:?
%
%??????point1??End-point?of?the?line?segment;?two-element?vector
%??????point2??End-point?of?the?line?segment;?two-element?vector
%??????theta???Angle?(in?degrees)?of?the?Hough?transform?bin
%??????rho?????Rho-axis?position?of?the?Hough?transform?bin
%
%???The?end-point?vectors?contain?[X?Y]?coordinates.
%
%???LINES?=?HOUGHLINES(...PARAM1VAL1PARAM2VAL2)?sets?various
%???parameters.?Parameter?names?can?be?abbreviated?and?case?
%???does?not?matter.?Each?string?parameter?is?followed?by?a?value?
%???as?indicated?below:
%
%???‘FillGap‘???Positive?real?scalar.
%???????????????When?HOUGHLINES?finds?two?line?segments?associated
%???????????????with?the?same?Hough?transform?bin?that?are?separated
%???????????????by?less?than?‘FillGap‘?distance?HOUGHLINES?merges
%???????????????them?into?a?single?line?segment.
%
%???????????????Default:?20
%
%???‘MinLength‘?Positive?real?scalar.
%???????????????Merged?line?segments?shorter?than?‘MinLength‘
%???????????????are?discarded.
%
%???????????????Default:?40
%
%???Class?Support
%???-------------
%???BW?can?be?logical?or?numeric?and?it?must?be?real?2-D?and?nonsparse.
%
%???Example
%???-------
%???Search?for?line?segments?corresponding?to?five?peaks?in?the?Hough?
%???transform?of?the?rotated?circuit.tif?image.?Additionally?highlight
%???the?longest?segment.
%
%??????I??=?imread(‘circuit.tif‘);
%??????rotI?=?imrotate(I33‘crop‘);
%??????BW?=?edge(rotI‘canny‘);
%??????[HTR]?=?hough(BW);
%??????imshow(H[]‘XData‘T‘YData‘R‘InitialMagnification‘‘fit‘);
%??????xlabel(‘\theta‘)?ylabel(‘\rho‘);
%??????axis?on?axis?normal?hold?on;
%??????P??=?houghpeaks(H5‘threshold‘ceil(0.3*max(H(:))));
%??????x?=?T(P(:2));?y?=?R(P(:1));
%??????plot(xy‘s‘‘color‘‘white‘);
%
%??????%?Find?lines?and?plot?them
%??????lines?=?houghlines(BWTRP‘FillGap‘5‘MinLength‘7);
%??????figure?imshow(rotI)?hold?on
%??????max_len?=?0;
%??????for?k?=?1:length(lines)
%????????xy?=?[lines(k).point1;?lines(k).point2];
%????????plot(xy(:1)xy(:2)‘LineWidth‘2‘Color‘‘green‘);
%
%????????%?plot?beginnings?and?ends?of?lines
%????????plot(xy(11)xy(12)‘x‘‘LineWidth‘2‘Color‘‘yellow‘);
%????????plot(xy(21)xy(22)‘x‘‘LineWidth‘2‘Color‘‘red‘);
%
%????????%?determine?the?endpoints?of?the?longest?line?segment?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????8265??2008-09-28?15:30??houghlines.m
?????文件???????6571??2008-09-26?14:48??houghpeaks.m
-----------?---------??----------?-----??----
????????????????14836????????????????????2
- 上一篇:高斯混合模型GMM 及高斯混合回歸MATLAB程序
- 下一篇:l1-Magic工具箱
評論
共有 條評論