跪求Hough变换检测直线的MATLAB源代码如题,要能直接运行,

发布时间:2021-02-26 09:31:29

跪求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);
以上问题属网友观点,不代表本站立场,仅供参考!