\qquad
除此之外,我们发现,侧扫声图上从左到右是按照声波返回时间长短来计算的,因此侧扫声图横向的指标实际上是和斜距成正比的。这里斜距就定义为从侧扫声呐头到地形某处的直线距离(一般忽略微观地形起伏)。因此我们就会发现,要使横向反映的是横距而非斜距,就要进行斜距校正。一般来说,可以使用以下公式实现
X
=
L
2
−
H
2
X=\sqrt{L^2-H^2}
X=L2−H2
\qquad
其中,L就是斜距,H是侧扫声呐到海底的高度,其获取方法见本章前文。
%功能描述:通过滑窗平均的方法对图像进行均值明度统一,从而抵消水体吸收的干扰。
%输入:E0,XTF原始归一化强度方阵
%输出:滑窗行向量(代表着E0在横坐标上的增益)
%使用示例:
% A=Amplify_get1(E);
% A2=repmat(A,range,1);
% E=E.*A2;
%公式推导:浙江大学王杰英论文
%验证时间:2022年4月2日15:44:56
function Amplify_C=Amplify_get1(E0) %E0 is selected aera with smooth surface
n=3;%滑窗数,不要修改
[length,width]=size(E0);%要求E0宽度是4倍数像素
window_length=fix(width./(n-1));
seperate_length=fix(window_length./2);
Amplify_C=0.*ones(1,width);%初始化
threshold=0.05; %明度低于此不计入
M_acc=[0 0 0 0];
M_dark=[0 0 0 0];
point_num_origin=window_length*length;%每块窗口点的个数
for k=1:4
acc_count=0;
dark_count=0;%黑色点计数
%求M1,M2,M3和M
for i=(k-1)*seperate_length+1:k*seperate_length
for j=1:length
if(E0(j,i)>threshold)
acc_count=acc_count+E0(j,i);
else
dark_count=dark_count+1;
end
end
end
M_acc(k)=acc_count;
M_dark(k)=dark_count;
end
point_num_perwindow=[point_num_origin-M_dark(1)-M_dark(2) ...
point_num_origin-M_dark(2)-M_dark(3) ...
point_num_origin-M_dark(3)-M_dark(4)];%每个窗口可用点的个数
acc_count_perwindow=[M_acc(1)+M_acc(2) M_acc(2)+M_acc(3) M_acc(3)+M_acc(4)];
M_ave=acc_count_perwindow./point_num_perwindow;
M_total=sum(acc_count_perwindow)/sum(point_num_perwindow);
%整图求和得到C,公式见论文
for i=1:width
%求和
if(i<=1*seperate_length)
Amplify_C(i)=M_total./M_ave(1);
elseif(i<=2*seperate_length)
Amplify_C(i)=(M_total./M_ave(2))*(i/seperate_length-1)+...
(2-i/seperate_length)*(M_total./M_ave(1));
elseif(i<=3*seperate_length)
Amplify_C(i)=(M_total./M_ave(3))*(i/seperate_length-2)+...
(3-i/seperate_length)*(M_total./M_ave(2));
else
Amplify_C(i)=M_total./M_ave(3);
end
end
end
%功能描述:对图像进行斜距校正和插值
%输入:E1,增益补偿后的E,和H,海底线对象的像素数目,也即像素高度
%输出:斜距校正后的E
%使用示例:见test_slant
% H=277-5;防止溢出,需要减去5
% E_slant_correct=Slant_correct(E,H);
% figure('name','斜距校正的图像');
% imshow(E_slant_correct);
%公式推导:浙江大学王杰英论文
%验证时间:2022年4月3日15:36:09
function E_slant_correct=Slant_correct(E1,H)%E1是增益补偿之后的矩阵,H单位是像素,是海底线对应的像素高度
[length,width]=size(E1);
lst=H:width;%初始化
for i=H:width
lst(i-H+1)=sqrt(i.^2-H.^2)+1;
end
disp(lst);
[p_,lst_len]=size(lst);
E2_width=fix(lst(lst_len));
E2=0.*ones(length,E2_width);
for i=1:length
for j=1: lst_len
E2(i,fix(lst(j)))=E1(i,j-1+H);
end
end
figure('name','初步补偿图像')
imshow(E2);
%缝隙消除
[E2_length,E2_width]=size(E2);
for i=2:E2_length-1
for j=2:E2_width-1
if(E2(i,j)==0)
acc=0;
count=0;
if(E2(i-1,j-1)~=0)
acc=acc+E2(i-1,j-1);
count=count+1;
end
if(E2(i-1,j)~=0)
acc=acc+E2(i-1,j);
count=count+1;
end
if(E2(i-1,j+1)~=0)
acc=acc+E2(i-1,j+1);
count=count+1;
end
if(E2(i,j-1)~=0)
acc=acc+E2(i,j-1);
count=count+1;
end
if(E2(i+1,j+1)~=0)
acc=acc+E2(i+1,j+1);
count=count+1;
end
if(E2(i,j+1)~=0)
acc=acc+E2(i,j+1);
count=count+1;
end
if(E2(i+1,j-1)~=0)
acc=acc+E2(i+1,j-1);
count=count+1;
end
if(E2(i+1,j)~=0)
acc=acc+E2(i+1,j);
count=count+1;
end
%临近点计算
%赋值
if(count~=0)
E2(i,j)=acc/count;
end
end
end
end
E_slant_correct=E2;
%%
figure('name','斜距校正的图像');
imshow(E_slant_correct);
end