发表期刊:IEEE TRANSACTIONS ON AEROSPACE AND ELECTRONIC SYSTEMS VOL. 52, NO. 1 FEBRUARY 2016
Impact factor:1.975 Not SCI
文章引用:Deng H, Sun X, Liu M, et al. Infrared small-target detection using multiscale gray difference weighted image entropy[J]. IEEE Transactions on Aerospace & Electronic Systems, 2016, 52(1):60-72.
clear all;
close all;
clc;
img=imread('E:\A 研究生学习\我的论文~\image\6.jpg');
n=size(size(img));
if n(1,2)==2;
im_gray=img;
else im_gray=rgb2gray(img);
end
imtool(im_gray);
[M,N]=size(im_gray);
f=im_gray;
Lmax=9;
kmax=(Lmax+1)/2;
%% 自己写的程序计算D(x,y) 不对 不知道为啥啊
% for k=1:kmax-1
% for i=kmax:M-kmax
% for j=kmax:N-*kmax
% OMGkmax=f(i-kmax+1:i+kmax-1,j-kmax+1:j+kmax-1);
% OMGk=f(i-k+1:i+k-1,j-k+1:j+k-1);
% D(i,j,k)=(mean(mean(OMGk))-mean(mean(OMGkmax))).^2;
% end
% end
% Df=zeros( size(D(:,:,1),1),size(D(:,:,1),2));
% Df=max(D(:,:,1),D(:,:,k));
% end
%% 利用matlab自带程序计算D(x,y)
N=Lmax;
for k=1:kmax-1; %k为半径
k1=2*k+1;
Nmax=ordfilt2(f,(N*N+1)/2,ones(N));
Nk=ordfilt2(f,(k1*k1+1)/2,ones(k1));
D(:,:,k)=(Nmax-Nk).^2;
Df=zeros(size(D(:,:,1),1),size(D(:,:,1),2));
Df=max(D(:,:,1),D(:,:,k));
end
figure;
imshow(Df);
title('Multiscale gray difference');
%% 自带程序计算熵
E=entropyfilt(im_gray); %系统的局部熵函数
%% 写的程序计算熵
% [m n]=size(im_gray);
% w=3; %模板半径
% imgn=zeros(m,n);
% for i=1+w:m-w
% for j=1+w:n-w
%
% Hist=zeros(1,256);
% for p=i-w:i+w
% for q=j-w:j+w
% Hist(img(p,q)+1)=Hist(img(p,q)+1)+1; %统计局部直方图
% end
% end
% Hist=Hist/sum(Hist);
% for k=1:256
% if Hist(k)~=0
% imgn(i,j)=imgn(i,j)+Hist(k)*log(1/Hist(k)); %局部熵
% end
% end
% end
% end
% E=imgn;
%% 最终
final= E.* double(Df);
figure;
imshow(final,[]);
title('NWIE')
%% 三维灰度图
figure; %final
img_1=imresize(Df,1); %图像放缩
[m,n]=size(img_1);
[x,y]=meshgrid(1:1:n,1:1:m);
for i=1:m
for j=1:n
H(i,j)=img_1(i,j);
end
end
mesh(double(x),double(y),double(H));
set(gca,'XLim',[0,320],'YLim',[0,240]);
xlabel('x');
ylabel('y');
title(' 3D--Multiscale gray difference ');
%
figure; %final
img_2=imresize(E,1); %图像放缩
[m,n]=size(img_2);
[x,y]=meshgrid(1:1:n,1:1:m);
for i=1:m
for j=1:n
G(i,j)=img_2(i,j);
end
end
mesh(double(x),double(y),double(G));
set(gca,'XLim',[0,320],'YLim',[0,240]);
xlabel('x');
ylabel('y');
title('3D--local entropy');
figure; %final
img_3=imresize(final,1); %图像放缩
[m,n]=size(img_3);
[x,y]=meshgrid(1:1:n,1:1:m);
for i=1:m
for j=1:n
G(i,j)=img_3(i,j);
end
end
mesh(double(x),double(y),double(G));
set(gca,'XLim',[0,320],'YLim',[0,240]);
xlabel('x');
ylabel('y');
title(' final NWIE');
实验结果:原图:
原文配图: