1 简介
合成孔径雷达(SAR)是一种高分辨的微波遥感相干成像雷达,在军事和国民经济等各个领域中都有着非常重要的作用。SAR遥感图像的分割是进行SAR遥感图像理解、解疑中基本且关键的技术之一。SAR遥感图像分割的目的就是把目标区域和背景区域分割开来,但由于SAR遥感图像中含有大量乘性相干斑噪声,且图像区域灰度分布不均匀,使得SAR遥感图像中目标物体边缘无法被精确定位,进而很难实现对SAR遥感图像精确且高效率的分割。如何快速而有效地实现SAR遥感图像的分割,是目前亟待解决的一个难题。随着SAR遥感图像研究的发展,水平集模型以其对曲线拓扑结构变化的良好适应能力和无需对噪声预处理的特性,受到国内外研究学者们的青睐。
2 完整代码
% This Matlab program demomstrates the level set algorithm in paper:
% "Active contours with selective local or global segmentation: a new variational approach and level set method"
% to appear in Image and Vision Computing, 2010.
clc;clear all;close all;
Img = imread('twocells.bmp');
Img = Img(:,:,1);
Img = double(Img);
% Img = 200*ones(100);
% Img(20:80,10:30)= 140;
% Img(20:80,40:70)= 180;
% Img(20:80,80:90)=50;
[row,col] = size(Img);
phi = ones(row,col);
phi(10:row-10,10:col-10) = -1;
u = - phi;
[c, h] = contour(u, [0 0], 'r');
title('Initial contour');
% hold off;
sigma = 1;
G = fspecial('gaussian', 5, sigma);
delt = 1;
Iter = 80;
mu = 25;%this parameter needs to be tuned according to the images
for n = 1:Iter
[ux, uy] = gradient(u);
c1 = sum(sum(Img.*(u<0)))/(sum(sum(u<0)));% we use the standard Heaviside function which yields similar results to regularized one.
c2 = sum(sum(Img.*(u>=0)))/(sum(sum(u>=0)));
spf = Img - (c1 + c2)/2;
spf = spf/(max(abs(spf(:))));
u = u + delt*(mu*spf.*sqrt(ux.^2 + uy.^2));
if mod(n,10)==0
imagesc(Img,[0 255]); colormap(gray);hold on;
[c, h] = contour(u, [0 0], 'r');
iterNum = [num2str(n), 'iterations'];
title(iterNum);
pause(0.02);
end
u = (u >= 0) - ( u< 0);% the selective step.
u = conv2(u, G, 'same');
end
imagesc(Img,[0 255]);colormap(gray);hold on;
[c, h] = contour(u, [0 0], 'b');
3 仿真结果
4 参考文献
[1]王翠杰. 基于水平集的SAR遥感图像分割的算法研究. Diss. 江苏科技大学.
部分理论引用网络文献,若有侵权联系博主删除。