📄 hough变换过程.m
字号:
%见课本403,hough变换的全过程,涉及到hough,houghpeaks,houghlines三个函数的调用
close all;clear;clc;
a=imread('d:\test.bmp');
a=a(:,:,1);
f=edge(a,'prewitt');
[H,theta,rho]=hough(f,1);
imshow(theta,rho,H,[],'notruesize'),axis on, axis normal
[r,c]=houghpeaks(H,18);
hold on;
plot(theta(c),rho(r),'linestyle','none','marker','s','color','w');
lines=houghlines(f,theta,rho,r,c);
figure;imshow(f),hold on
for k=1:length(lines)
xy=[lines(k).point1;lines(k).point2]
plot(xy(:,2),xy(:,1),'LineWidth',4,'Color',[.6,.6,.6]);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -