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

  • 大小: 3.09MB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發布日期: 2023-11-15
  • 語言: 其他
  • 標簽:

資源簡介

有時候圖像中拍的海報,視頻,文件等因為拍攝角度問題,結果在圖像中顯示為任意四邊形。該程序提供了一種將這個任意四邊形轉換為矩形的方法

資源截圖

代碼片段和文件信息

%函數功能:中心投影變換。輸入源圖,源圖中的任意四邊形的4個點的坐標(左上,右上,左下,右下),以及輸出圖像的大小(高,寬)
function?Imgback?=?m_PerspectiveTransformation(imgInpointLTpointRTpointLBpointRBoutHeithtoutWidth)
????[imgInHeightimgInWidthimgInDimension]?=?size(imgIn);
????%為了中心投影變換,需要將4個點轉化為三個向量,具體看參考文獻
????vector10?=?pointLB?-?pointLT;
????vector01?=?pointRT?-?pointLT;
????vector11?=?pointRB?-?pointLT;
????%把vector11表示成vector10和vector01的線性組合,以使三個向量共面
????A?=?[vector10‘??vector01‘];
????B?=?vector11‘?;
????S?=?A\B;
????a0?=?S(1);
????a1?=?S(2);
????
????
????%輸出矩形
????Imgback?=?uint8(zeros(outHeithtoutWidthimgInDimension));
????
????
????%利用循環操作來對每個像素點賦值
????for?heightLoop?=?1:outHeitht
????????for?widthLoop?=?1:outWidth
????????????%以下算法為參考文獻中的公式表示
????????????x0?=?heightLoop/outHeitht;
????????????x1?=?widthLoop/outWidth;
????????????FenMu?=?a0+a1-1+(1-a1)*x0+(1-a0)*x1;????????????%分母
????????????y0?=?a0*x0/FenMu;
????????????y1?=?a1*x1/FenMu;
????????????
????????????%根據得到的參數找到對應的源圖像中的坐標位置,并賦值
????????????coordInOri?=?y0*vector10?+?y1*vector01?+?pointLT;
????????????heightC?=?round(coordInOri(1));
????????????widthC?=?round(coordInOri(2));
????????????????if?(heightC?>?imgInHeight?||?heightC?<=?0?||?widthC?>imgInWidth?||?widthC?<=0?)
????????????????????disp([‘m_PerspectiveTransformation超出范圍‘?num2str(heightC)?num2str(widthC)]);
????????????????????pause();
????????????????????return;
????????????????end
????????????for?dimentionLoop?=?1:imgInDimension
????????????????%使用最近鄰域插值,使用高級插值方法效果會更好
????????????????Imgback(heightLoopwidthLoopdimentionLoop)?=?imgIn(heightCwidthCdimentionLoop);
????????????end
????????end
????end
????
????
%?????figure;?imshow(Imgback);?title(‘投影變換的結果‘);

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????3241588??2017-06-15?22:19??1.jpg
?????文件????????1921??2017-06-22?08:30??m_PerspectiveTransformation.m
?????文件?????????298??2017-06-22?15:55??Test_perspectivetransformation.m
?????文件?????????144??2017-07-07?20:01??說明.txt

評論

共有 條評論

相關資源