作业帮 > 综合 > 作业

跪求Hough变换检测直线的MATLAB源代码

来源:学生作业帮 编辑:灵鹊做题网作业帮 分类:综合作业 时间:2024/06/06 20:01:38
跪求Hough变换检测直线的MATLAB源代码
如题,要能直接运行,
跪求Hough变换检测直线的MATLAB源代码
直接运行:
RGB = imread('gantrycrane.png');
I = rgb2gray(RGB); % convert to intensity
BW = edge(I,'canny'); % extract edges
[H,T,R] = hough(BW,'RhoResolution',0.5,'ThetaResolution',0.5);
% display the original image
subplot(2,1,1);
imshow(RGB);
title('gantrycrane.png');
% display the hough matrix
subplot(2,1,2);
imshow(imadjust(mat2gray(H)),'XData',T,'YData',R,...
'InitialMagnification','fit');
title('Hough transform of gantrycrane.png');
xlabel('\theta'),ylabel('\rho');
axis on,axis normal,hold on;
colormap(hot);