forked from WeiTan1992/CoF-MSMG-PCNN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0120211
commit 0e2a9ec
Showing
12 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,:); |