一、程序概况
MATLAB APP HANDLE SLC
程序APP下载:
链接:https://pan.baidu.com/s/1XwIW7MY6DF37Ilu4j2eAuw
提取码:CWNU
注:
下载方式:百度网盘;此APP属于wep app,若电脑没有matlab runtime,请自行下载;
压缩包内包含自定义函数、app项目文件以及打包文件;
MATLAB APP designer学习:
若是对MATLAB APP designer感兴趣,这里强烈推荐这位在B站的外国UP,完结20个专集,从入门到进阶都有,非常适合新手,传送门:
https://www.bilibili.com/video/BV1Kz4y1R7X2?p=9&vd_source=1861080cbedb7db7f4b12c242abf7138
Sentinel-1 SLC单视复数数据读取以及配准学习
由于该程序只能进行粗配准,无法对SAR影像进行精确配准,现只用于APP designer 学习以及初学者使用,若有读者对SAR影像精确配准感兴趣,请参考以下论文,里面对精确配准有详细的操作步骤:
《 基于相关匹配和最大谱图像配…的InSAR复图像配准方法_汪鲁才.pdf》
二、主要步骤显示
以人机交互式读取访问SLC 单视复数数据的基本信息(行列数、数据类型、访问指针),
读取行列号大小时需要耐心等待,比较慢。 以裁剪进行分析。
利用MATLAB的imshowpair函数显示主辅影像的差异(其中主影像为2019年的SLC一景影像,辅影像为2020年SLC一景影像),绿色表示主影像,红色表示辅影像。利用边线查找法,实现两幅影像的第一次粗配准,将影像进行左右上下平移操作,并显示粗配准之后的差异结果。
获取第一次粗配准之后的配准精度,配准指标为均方根误差以及百分比误差,并显辅影像相对于主影像的移动距离。
利用MATLAB内置函数求取特征点,计算转换矩阵,实现对影像的第二次粗配准。
三、程序配准核心代码
部分函数为自定义函数,若是需要使用,请自行去主页下载。
function Button_10Pushed(app, event)
global uint8_image uint8_image2 end_x_value end_y_value start_x_value ...
start_y_value data2 shift_image master_image meapde rmse_frontde;
master_image=uint8_image; %主图像
Secondary_image=uint8_image2; %辅图像
%以主图像的的第20行作为y控制行
control_y=master_image(20,:);
%以主图像的的第20列作为x控制列
control_x=master_image(:,20);
cxk=floor((end_x_value-start_x_value)/3);
cyk=floor((end_y_value-start_y_value)/3);
%取辅图像的前~行作为搜索行
search_martix_y=Secondary_image(1:cxk,:);
%取辅图像的前~列作为搜索列
search_martix_x=Secondary_image(:,1:cyk);
gama_y=zeros(cxk,1);
gama_x=zeros(1,cyk);
%开始搜索相关性
for i=1:cxk
gama_y(i)=abs(sum(control_y-search_martix_y(i,:)));
end
%indices_y即为图像在y方向上的位移
indices_y=find(gama_y==min(gama_y));
%开始搜索相关性
for j=1:cyk
%gama_x(i)=abs(sum(control_x-search_martix_x(:,j)));
end
%indices_x即为图像在x方向上的位移
indices_x=find(gama_x==min(gama_x));
shift_image=uint8(abs(data2(start_x_value+indices_y:end_x_value+indices_y,start_y_value+indices_x:end_y_value+indices_x)));
imshowpair(shift_image,master_image,'Parent',app.UIAxes4);
if ~isempty(indices_x)
indices_x=indices_x(1);
else
indices_x=indices_x;
end
if ~isempty(indices_y)
indices_y=indices_y(1);
else
indices_y=indices_y;
end
app.EditField_13.Value=strcat(num2str(indices_x),'/个像元');
app.EditField_14.Value=strcat(num2str(indices_y),'/个像元');
rmse_front = sqrt(mean((master_image-Secondary_image).^2));
rmse_end=sqrt(mean((master_image-shift_image).^2));
nvg=length(rmse_front);
rmse_frontde=sum(rmse_front)/nvg;
rmse_endde=sum(rmse_end)/nvg;
app.EditField_11.Value=strcat('前:',num2str(rmse_frontde));
app.EditField_15.Value=strcat('后:',num2str(rmse_endde));
meap = mean(abs((master_image - Secondary_image)./master_image))*100;
cvg=length(meap);
meapde=sum(meap)/cvg;
meap_end=mean(abs((master_image - shift_image)./master_image))*100;
meap_endde=sum( meap_end)/cvg;
app.EditField_12.Value=strcat('前:',num2str(meapde));
app.EditField_16.Value=strcat('后:',num2str(meap_endde));
end
function Button_2Pushed(app, event)
global master_image shift_image window_1 window_2 matirx tform;
window_1=master_image;
window_2=shift_image;
points_left=detectSURFFeatures(window_1);
points_right=detectSURFFeatures(window_2);
[features_left,vector_points_left]=extractFeatures(window_1,points_left);
[features_right,vector_points_right]=extractFeatures(window_1,points_right);
indexPairs=matchFeatures(features_left,features_right);
matchedPoints_left=vector_points_left(indexPairs(:,1),:);
matchedPoints_right=vector_points_right(indexPairs(:,2),:);
showMatchedFeatures(window_1,window_2,matchedPoints_left,matchedPoints_right,'Parent',app.UIAxes3);
[tform,~,~]=estimateGeometricTransform(matchedPoints_right,matchedPoints_left,'similarity');
matirx=tform.T;
end