資源簡(jiǎn)介
超適合新手,下載后只需改一下讀取圖像名稱即可運(yùn)行,不管是普通圖像或是遙感影像(注:多光譜影像請(qǐng)將各波段分別導(dǎo)出單獨(dú)讀?。?,都能無壓力運(yùn)行,省時(shí)省心。
代碼片段和文件信息
%兩幅影像的行列數(shù)必須一致才能運(yùn)行成功
%否則請(qǐng)用envi對(duì)影像重采樣,再導(dǎo)出成tif格式即可
%如果是多光譜影像請(qǐng)將各波段單獨(dú)進(jìn)行運(yùn)算
%讀入兩幅圖像
imgA=imread(‘讀取影像a.tif‘);
imgB=imread(‘讀取影像b.tif‘);
%精度轉(zhuǎn)換
imgA=double(imgA);
imgB=double(imgB);
%CC?=?XGXS(imgAimgB);
%fprintf(‘%8.5f\n‘CC);
%健壯性判斷
[imgArowimgAcol]=size(imgA);
[imgBrowimgBcol]=size(imgB);
%?[imgArowimgAcol];
%?[imgBrowimgBcol];
if?imgArow<1||imgAcol<1||imgBrow<1||imgBcol<1
????error(‘您的輸入有誤!維數(shù)不能小于1‘);
elseif?imgArow~=imgBrow||imgAcol~=imgBcol
????error(‘您輸入德矩陣維數(shù)不相等!‘);
end
%求兩幅圖像的均值差
imgA=imgA-mean2(imgA);
imgB=imgB-mean2(imgB);
%求求兩幅圖像的相關(guān)系數(shù)
CC=sum(sum(imgA.*imgB))./(sqrt(sum(sum(imgA.^2))).*sqrt(sum(sum(imgB.^2))));
fprintf(‘%8.5f\n‘CC);
?
????
????????tle>鏈皢瀵硅薄寮曠敤璁劇疆鍒板璞$殑瀹炰緥銆?/title>
????????ta?name=“viewport“
- 上一篇:matlab圖像分割
- 下一篇:用霍夫曼方法檢測(cè)圓、直線
評(píng)論
共有 條評(píng)論