91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

運用Matlab實現圖片透視效果的矯正,通過確定4個特征點,從而矯正透視現象。

資源截圖

代碼片段和文件信息

close?all
clc
clear;

im?=?imresize(imread(‘in6.jpg‘)0.5‘bicubic‘);
gray_img?=?double(rgb2gray(im));
%?level?=?graythresh(im);
%?gray_img?=?im2bw(imlevel/5*4);
%%?Corner?Detection
[c?r]?=?harris(gray_img0.05);
cornerRC?=?[r?c];
figure
imshow(im);
%?hold?on;
%?plot(rc‘r+‘);

%%?Edge?Detection?and?Line?Detection
BW?=?edge(rgb2gray(im)‘canny‘[0.010.5]);?%?extract?edges;
[H?theta?rho]?=?hough(BW);
%?imshow(mat2gray(H)*1.5);
P?=?houghpeaks(H10‘threshold‘ceil(0.2*max(H(:))));
%?Find?lines
lines?=?houghlines(BWthetarhoP‘FillGap‘60‘MinLength‘60);
%?lines?=?houghlines(BWthetarhoP);
max_len?=?0;
for?k?=?1:length(lines)
???xy?=?[lines(k).point1;?lines(k).point2];
%????plot(xy(:1)xy(:2)‘LineWidth‘2‘Color‘‘green‘);
%????%?Plot?beginnings?and?ends?of?lines
%????plot(xy(11)xy(12)‘x‘‘LineWidth‘2‘Color‘‘yellow‘);
%????plot(xy(21)xy(22)‘x‘‘LineWidth‘2‘Color‘‘red‘);
end

%%?Make?a?decision?to?find?good?points
threshold?=?0.99;
GP=[];?%?store?good?points
for?k?=?1:length(lines)
%????rTheta?=?[lines(k).rho;lines(k).theta];
???points?=?[lines(k).point1;lines(k).point2];
???for?i?=?1:length(cornerRC)
%???????r1?=?cornerRC(i1)*cos(rTheta(2))+?cornerRC(i2)*cos(rTheta(2));
%?????????r1?=?abs(sin(rTheta(2))*cornerRC(i2)+cos(rTheta(2))*cornerRC(i1)-abs(rTheta(1)));
????????r1?=?sqrt((cornerRC(i1)-points(11))^2+(cornerRC(i2)-points(12))^2);
????????r2?=?sqrt((cornerRC(i1)-points(21))^2+(cornerRC(i2)-points(22))^2);
????????len?=?sqrt((points(11)-points(21))^2+(points(12)-points(22))^2)
????????abs(r1-r2)
??????if?abs(r1-r2)/len>0.99
%???????if?abs(r1-rTheta(1))%???????if?r1%???????????plot(cornerRC(i1)cornerRC(i2)‘+‘‘LineWidth‘2‘Color‘‘blue‘);
??????????
??????????GP(i:)=[cornerRC(i1)cornerRC(i2)];
??????end
???end
end

%?find?good?point?manully
[ab]=ginput?
pa?=?a;
pb?=?b;
absx?=?abs(abs(a(1)-a(2))-abs(a(3)-a(4)));
absy?=?abs(abs(b(1)-b(3))-abs(b(2)-b(4)));
if?absx>absy
????pa(1)?=?pa(3);
????pa(2)?=?pa(4);
else
????pb(1)?=?pb(2);
????pb(3)?=?pb(4);
end

x?=?b;
y?=?a;
px?=?pb;
py?=?pa;

A=[x(1)?y(1)?1?0?0?0?-px(1)*x(1)?-px(1)*y(1)?;
???0?0?0?x(1)?y(1)?1?-py(1)*x(1)?-py(1)*y(1)?;
???x(2)?y(2)?1?0?0?0?-px(2)*x(2)?-px(2)*y(2)?;
???0?0?0?x(2)?y(2)?1?-py(2)*x(2)?-py(2)*y(2)?;
???x(3)?y(3)?1?0?0?0?-px(3)*x(3)?-px(3)*y(3)?;
???0?0?0?x(3)?y(3)?1?-py(3)*x(3)?-py(3)*y(3)?;
???x(4)?y(4)?1?0?0?0?-px(4)*x(4)?-px(4)*y(4)?;
???0?0?0?x(4)?y(4)?1?-py(4)*x(4)?-py(4)*y(4)?];

B?=?[px(1);py(1);px(2);py(2);px(3);py(3);px(4);py(4)];
h?=?A\B;
H?=?ones(33);
for?i?=1:3
????for?j?=?1:3
????????if(i==3&&j==3)
????????????H(ij)?=?1;
????????else
????????????H(ij)=h(3*(i-1)+j);
????????end
????end
end
Xn=[];
Yn=[];
[m?n]=size(rgb2gray(im));
?imgin=im;
for?i=1:m
????for?j=1:n?????
????????newxy?=?H*[i;j;1];
????????newxy?=?newxy/(H(31)*i+H(32)*j+H(33));
?????????Xn?=?round(newxy(1));???
????????if

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????94923??2010-12-10?13:29??DIP\building1.jpg

?????文件??????83532??2010-12-10?13:31??DIP\building2.jpg

?????文件??????80901??2010-12-10?13:28??DIP\castle.jpg

?????文件???????3369??2010-12-07?14:44??DIP\code\FindGP.m

?????文件???????1458??2010-12-06?22:42??DIP\code\harris.m

?????文件??????37249??2010-11-02?13:28??DIP\code\in.jpg

?????文件?????100180??2010-11-02?14:17??DIP\code\in2.jpg

?????文件??????27844??2010-11-11?23:08??DIP\code\in3.jpg

?????文件?????157479??2010-12-07?12:47??DIP\code\in4.jpg

?????文件??????41229??2010-12-07?14:08??DIP\code\in5.jpg

?????文件??????44708??2010-12-07?14:09??DIP\code\in6.jpg

?????文件?????128356??2010-12-07?14:10??DIP\code\in7.jpg

?????文件????????362??2010-12-10?13:47??DIP\code\read?me.txt

?????文件???????2834??2010-12-07?14:17??DIP\code\test1.m

?????文件???????2820??2010-12-07?13:07??DIP\code\test2.m

?????文件???????3206??2010-12-07?13:08??DIP\code\test3.m

????..A.SH.??????7680??2010-12-10?13:34??DIP\code\Thumbs.db

?????文件????2465280??2010-12-09?15:34??DIP\DIP.ppt

?????文件???????6733??2010-12-10?13:26??DIP\GP_ideal.jpg

?????文件??????21265??2010-12-10?13:26??DIP\GP_window.jpg

?????文件?????516948??2010-12-10?13:41??DIP\Perspective?Correction?final?report.docx

????..A.SH.?????20992??2010-12-10?13:34??DIP\Thumbs.db

?????文件??????68504??2010-12-10?13:31??DIP\window.jpg

?????目錄??????????0??2010-12-10?13:40??DIP\code

?????目錄??????????0??2010-12-10?13:48??DIP

-----------?---------??----------?-----??----

??????????????3917852????????????????????25


評論

共有 條評論