Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiTan1992 authored May 22, 2020
1 parent 0120211 commit 0e2a9ec
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 0 deletions.
Binary file added 1_ms.mat
Binary file not shown.
Binary file added 1_pan.mat
Binary file not shown.
Binary file added 2_ms.mat
Binary file not shown.
Binary file added 2_pan.mat
Binary file not shown.
21 changes: 21 additions & 0 deletions CoF_GF_decomposition.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function [S,L,B] = CoF_GF_decomposition(PAN,I)

% GF
N = 4;
sigma = 10;
GaussianFilter = fspecial('gaussian',[2*N+1, 2*N+1],sigma);
Ig = imfilter(PAN,GaussianFilter,'conv');

% CoF
params.sigma_s=5; % 5
params.sigma_oc=10; % 10
Ic = CoOcurFilter(PAN,params);
S = PAN-Ic;
L = Ic-Ig;
B_uint8 = Ig;
B = im2double(B_uint8);
I = im2double(I);

eps = 0.1;
win_size = 11;
B = guided_filter(B,I,eps,win_size);
42 changes: 42 additions & 0 deletions PCNN_withParameters.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function R=PCNN_withParameters(matrix,Para)

link_arrange=Para.link_arrange;
np=Para.iterTimes;
alpha_L=Para.alpha_L;
alpha_Theta=Para.alpha_Theta ;
beta=Para.beta;
vL=Para.vL;
vTheta=Para.vTheta;
%=============================================================
[p,q]=size(matrix);
F_NA=abs(matrix);

L=zeros(p,q);
U=zeros(p,q);
Y=zeros(p,q);
Y0=zeros(p,q);
Theta=zeros(p,q);
% Compute the linking strength.
center_x=round(link_arrange/2);
center_y=round(link_arrange/2);
W=zeros(link_arrange,link_arrange);
for i=1:link_arrange
for j=1:link_arrange
if (i==center_x)&&(j==center_y)
W(i,j)=0;
else
W(i,j)=1./sqrt((i-center_x).^2+(j-center_y).^2);
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
F=F_NA;
for n=1:np
K=conv2(Y,W,'same');
L=exp(-alpha_L)*L+vL*K;
Theta=exp(-alpha_Theta)*Theta+vTheta*Y;
U=F.*(1+beta*L);
Y=im2double(U>Theta);
Y0=Y0+Y;
end
R=Y0;
20 changes: 20 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This package contains the code which is associated with the following paper:

Wei Tan, Pei Xiang Jiajia Zhang, Huixin Zhou, and Hanlin Qin,
"Remote Sensing Image Fusion via Boundary Measured Dual-Channel PCNN in Multi-Scale Morphological Gradient Domain", IEEE Access,vol. 8, pp. 42540-42549, 2020
doi: https://doi.org/10.1109/ACCESS.2020.2977299


Edited by Wei Tan, March 7, 2020.

This code is only used for research purposes.

Please refer to the above publication if you use this code.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The demo file is script.m

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 changes: 23 additions & 0 deletions fusion_CoF_MSMG_PCNN.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function cp=fusion_CoF_MSMG_PCNN(matrixA,matrixB)

%% Initialize parameter
Para.iterTimes=200;
Para.link_arrange=7;
Para.alpha_L=0.02;
Para.alpha_Theta=3;
Para.beta=3;
Para.vL=1;
Para.vTheta=20;
t = 11;

%%
MSMG_A=multiscale_morph(abs(matrixA),t);
MSMG_B=multiscale_morph(abs(matrixB),t);

%%
PCNN_timesA=PCNN_withParameters(MSMG_A,Para);
PCNN_timesB=PCNN_withParameters(MSMG_B,Para);
map=(PCNN_timesA>=PCNN_timesB);

%%
cp=map.*matrixA+~map.*matrixB;
9 changes: 9 additions & 0 deletions imtransfer.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function [I_MS,I_PAN] = imtransfer(cropped_im,cropped_pan)

MS = cropped_im(:,:,1:3);
I_MS = subsample(MS);
% I_MS = double(I_MS)/255;

PAN = cropped_pan;
I_PAN = subsample(PAN);
% I_PAN = double(I_PAN)/255;
22 changes: 22 additions & 0 deletions multiscale_morph.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function FM = multiscale_morph(img, num)
%========================================================================
%This is a function to compute the multiscale morphological focus-measure
%Input:
% img: the input image
% scale: the number of the scales
%Output:
% FM: Focus-measure
%========================================================================
img = double(img);
FM = double(zeros(size(img)));

for ii = 1 : num
scale = 2 * ii + 1;
se = strel('disk', scale);
% one scale focus-measure
g = imdilate(img, se) - imerode(img, se);
% the composite focus-measure
FM = FM + 1 / scale *(g);
end

return
39 changes: 39 additions & 0 deletions script.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
% ----------
% Author: Wei Tan
% E-mail: [email protected]
% Wei Tan, Pei Xiang, Jiajia Zhang, Huixin Zhou, and Hanlin Qin
% "Remote Sensing Image Fusion via Boundary Measured Dual-Channel PCNN in
% Multi-Scale Morphological Gradient Domain",
% IEEE Access, vol.8, pp.42540-42549, 2020
% doi: https://doi.org/10.1109/ACCESS.2020.2977299
% This code is only used for research.
% Please cite this publication if you use this code.

clear;clc;
close all;

path(path,'CoOccurFilter-master')

load 1_ms
load 1_pan

[MS,PAN] = imtransfer(cropped_im,cropped_gray);

M = imresize(MS,2,'bicubic');
M_hsv = rgb2hsv(M);
I = M_hsv(:,:,3);
I_uint8 = im2uint8(I);

[S,L,B] = CoF_GF_decomposition(PAN,I_uint8);

Fc = fusion_CoF_MSMG_PCNN(B,I);
S = im2double(S);
L = im2double(L);
Fi = Fc+S+L;
M_hsv(:,:,3) = Fi;
F_pr = hsv2rgb(M_hsv);
F = im2uint8(F_pr);

figure,imshow(MS);title('200*200 MS image')
figure,imshow(PAN);title('400*400 PAN image')
figure,imshow(F);title('Fused image')
6 changes: 6 additions & 0 deletions subsample.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function r = subsample(im)
% 下采样
% im-输入图像,r-输出图像

[m,n,z] = size(im);
r = im(2:2:m,2:2:n,:);

0 comments on commit 0e2a9ec

Please sign in to comment.