首页 > 代码库 > oil spill areas mark

oil spill areas mark

clear all;
datasub=imread(‘c:\Users\Administrator\Desktop\dark_spots.png‘);
[row,col] = size(datasub);
flag = zeros(row,col);
flag=datasub;
figure,imagesc(imadjust(flag)),colormap(gray),title(‘SAR暗斑目标图像‘);
se = ones(2);
BW = imdilate(flag,se);
BW = imerode(BW,se); %morphologic


L = bwlabel(BW,8);
flag = zeros(row,col);
% colormap(gray);
% imagesc(L)


cc = bwconncomp(BW);
stats = regionprops(cc, ‘Area‘);
idx = find([stats.Area] > 1111);%一平方公里以上的油膜我们感兴趣,ERS图像分辨率30米。
BW2 = ismember(labelmatrix(cc), idx);
BW3=~BW2;
[L,num] = bwlabel(BW3,8);
% figure,imshow(L);
% aa=im2bw(L,graythresh(L))
% cc=bwconncomp(aa)
% dd=labelmatrix(cc)
% % RGB8_2 = label2rgb(L, ‘spring‘, ‘c‘, ‘shuffle‘); 
map=colormap(‘Winter‘);
RGB8_2 = label2rgb(L,map);
imagesc(RGB8_2);
impixelinfo;
diama=[208,313,375,705];
diamb=[75,242,193,322];
toc=[255,0,0];
toima=color_mark(RGB8_2,diama,toc);
toimb=color_mark(toima,diamb,toc);
figure,imshow(toimb);
impixelinfo;

oil spill areas mark