資源簡介
使用matlab編寫圖校校正程序,該對傾斜圖像的校正有很好的效果。。。
代碼片段和文件信息
clear;
clc;
I??=?imread(‘C:\Program?Files\MATLAB71\toolbox\images\imdemos\gg.jpg‘);
I=rgb2gray(I);
BW?=?edge(I‘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(I)?hold?on
max_len?=?0;
longest_line_index=0;
for?k?=?1:length(lines)
???xy?=?[lines(k).po
評論
共有 條評論