資源簡介
基于matlab的圖像邊緣檢測,這里采用了邊緣提取效果比較清晰地hough算法。
代碼片段和文件信息
[filenamepathname]=uigetfile(‘銳化后的圖片.jpg‘);?%銳化后的圖片見附錄1;
i=imread([pathnamefilename]);
I=rgb2gray(i);
rotI=im2double(I);
imshow(rotI);
BW=edge(I‘sobel‘);
imshow(BW);
[HTR]=hough(BW);
imshow(H[]‘XData‘T‘YData‘R‘InitialMagnification‘‘fit‘);??xlabel(‘\theta‘)ylabel(‘\rho‘);
axis?onaxis?normalhold?on
P=houghpeaks(H5‘threshold‘ceil(0.3*max(H(:))));?
x=T(P(:2));y=R(P(:1));?
plot(xy‘s‘‘color‘‘white‘);?
lines=houghlines(BWT
評論
共有 條評論