Check my codes for the paper titled MUTICONTOURLET BASED ADAPTIVE FUSION OF INFRARED AND VISIBLE REMOTE SENSING IMAGESVol 7,N0.3,July 2010.Authors- Xia Cheng,Licheng Jiao,Fang Liu
    9 views (last 30 days)
  
       Show older comments
    
warning off;
clc;
clear all;
close all;
% Input Image
[filename, pathname] = uigetfile( '*.*', 'Load input image A');
I1= imread([pathname, filename]);
[filename, pathname] = uigetfile( '*.*', 'Load input image A');
I2= imread([pathname, filename]);
% Resizing Image
A1 = imresize(I1, [256 256]);
A2 = imresize(I2, [256 256]);
figure,imshow(A1);
title('Input Image 1');
figure,imshow(A2);
title('Input Image 2');
 i1=im2double(A1);
i2=im2double(A2);
% Prefiltering
L1 = medfilt2(i1,[3 3]);
L2 = medfilt2(i2,[3 3]);
figure,imshow(L1);
title('Prefiltered Image 1');
figure,imshow(L2);
title('Prefiltered Image 2');
% Decomposition
[b1]=GHM(L1);
[b2]=GHM(L2);
figure,imshow(b1);
title('GHM dec1');
figure,imshow(b2);
title('GHM dec2');
y1 = pdfbdec(b1, 'db1', 'haar', 4);
y2 = pdfbdec(b2, 'db1', 'haar', 4);
figure,imshow(y1{1,1})
title('PDFB dec1');
figure,imshow(y2{1,1})
title('PDFB dec2');
y11=y1{1,1};
y21=y2{1,1};
w=0.5;
SL=w*y11+(1-w)*y21;
figure,imshow(SL)
% Optimal Fusion Weight
e=0.01;
a=0;b=1;
w1=a+0.382*(b-a);
w2=a+b-w1;
% Determine Objective Function
T1=edge_association(y11,y21,SL,w1);
T2=edge_association(y11,y21,SL,w2);
if T1<T2
    a=w1;
     if abs(b-a)<e
         optw=(a+b)./2;
         return
     else
         w1=w2;
         w2=a+0.618*(b-a);
         T1=edge_association(y11,y21,SL,w1);
          T2=edge_association(y11,y21,SL,w2);
         goto(52)
     end
else
    b=w2;
     if abs(b-a)<e
         optw=(a+b)./2;
         return
     else
         w2=w1;
         w1=a+0.382*(b-a);
         T1=edge_association(y11,y21,SL,w1);
         T2=edge_association(y11,y21,SL,w2);
         goto(52)
     end
end
weight=optw;
% Fusion Rule of Low-Frequency Subbands
FL=weight*y11+(1-weight)*y21;
figure,imshow(FL)
% Fusion Rule of High-Frequency Directional Subbands
kernel=[1/16 1/16 1/16;1/16 1/2 1/16;1/16 1/16 1/16];
ELA1=sqrt(conv2((y1{1,2}{1,1}.^2),kernel,'same'));
ELB1=sqrt(conv2((y2{1,2}{1,1}.^2),kernel,'same'));
[r c]=size(ELA1);
for i=1:r
    for j=1:c
        if(ELA1(i,j)>=ELB1(i,j))
            D1(i,j)=y1{1,2}{1,1}(i,j);
        else
            D1(i,j)=y2{1,2}{1,1}(i,j);
        end
    end
end
ELA2=sqrt(conv2((y1{1,2}{1,2}.^2),kernel,'same'));
ELB2=sqrt(conv2((y2{1,2}{1,2}.^2),kernel,'same'));
[r c]=size(ELA2);
for i=1:r
    for j=1:c
        if(ELA2(i,j)>=ELB2(i,j))
            D2(i,j)=y1{1,2}{1,2}(i,j);
        else
            D2(i,j)=y2{1,2}{1,2}(i,j);
        end
    end
end
ELA3=sqrt(conv2((y1{1,2}{1,3}.^2),kernel,'same'));
ELB3=sqrt(conv2((y2{1,2}{1,3}.^2),kernel,'same'));
[r c]=size(ELA3);
for i=1:r
    for j=1:c
        if(ELA3(i,j)>=ELB3(i,j))
            D3(i,j)=y1{1,2}{1,3}(i,j);
        else
            D3(i,j)=y2{1,2}{1,3}(i,j);
        end
    end
end
ELA4=sqrt(conv2((y1{1,2}{1,4}.^2),kernel,'same'));
ELB4=sqrt(conv2((y2{1,2}{1,4}.^2),kernel,'same'));
[r c]=size(ELA4);
for i=1:r
    for j=1:c
        if(ELA4(i,j)>=ELB4(i,j))
            D4(i,j)=y1{1,2}{1,4}(i,j);
        else
            D4(i,j)=y2{1,2}{1,4}(i,j);
        end
    end
end
ELA5=sqrt(conv2((y1{1,2}{1,5}.^2),kernel,'same'));
ELB5=sqrt(conv2((y2{1,2}{1,5}.^2),kernel,'same'));
[r c]=size(ELA5);
for i=1:r
    for j=1:c
        if(ELA5(i,j)>=ELB5(i,j))
            D5(i,j)=y1{1,2}{1,5}(i,j);
        else
            D5(i,j)=y2{1,2}{1,5}(i,j);
        end
    end
end
ELA6=sqrt(conv2((y1{1,2}{1,6}.^2),kernel,'same'));
ELB6=sqrt(conv2((y2{1,2}{1,6}.^2),kernel,'same'));
[r c]=size(ELA6);
for i=1:r
    for j=1:c
        if(ELA6(i,j)>=ELB6(i,j))
            D6(i,j)=y1{1,2}{1,6}(i,j);
        else
            D6(i,j)=y2{1,2}{1,6}(i,j);
        end
    end
end
ELA7=sqrt(conv2((y1{1,2}{1,7}.^2),kernel,'same'));
ELB7=sqrt(conv2((y2{1,2}{1,7}.^2),kernel,'same'));
[r c]=size(ELA7);
for i=1:r
    for j=1:c
        if(ELA7(i,j)>=ELB7(i,j))
            D7(i,j)=y1{1,2}{1,7}(i,j);
        else
            D7(i,j)=y2{1,2}{1,7}(i,j);
        end
    end
end
ELA8=sqrt(conv2((y1{1,2}{1,8}.^2),kernel,'same'));
ELB8=sqrt(conv2((y2{1,2}{1,8}.^2),kernel,'same'));
[r c]=size(ELA8);
for i=1:r
    for j=1:c
        if(ELA8(i,j)>=ELB8(i,j))
            D8(i,j)=y1{1,2}{1,8}(i,j);
        else
            D8(i,j)=y2{1,2}{1,8}(i,j);
        end
    end
end
ELA9=sqrt(conv2((y1{1,2}{1,9}.^2),kernel,'same'));
ELB9=sqrt(conv2((y2{1,2}{1,9}.^2),kernel,'same'));
[r c]=size(ELA9);
for i=1:r
    for j=1:c
        if(ELA9(i,j)>=ELB9(i,j))
            D9(i,j)=y1{1,2}{1,9}(i,j);
        else
            D9(i,j)=y2{1,2}{1,9}(i,j);
        end
    end
end
ELA10=sqrt(conv2((y1{1,2}{1,10}.^2),kernel,'same'));
ELB10=sqrt(conv2((y2{1,2}{1,10}.^2),kernel,'same'));
[r c]=size(ELA10);
for i=1:r
    for j=1:c
        if(ELA10(i,j)>=ELB10(i,j))
            D10(i,j)=y1{1,2}{1,10}(i,j);
        else
            D10(i,j)=y2{1,2}{1,10}(i,j);
        end
    end
end
ELA11=sqrt(conv2((y1{1,2}{1,11}.^2),kernel,'same'));
ELB11=sqrt(conv2((y2{1,2}{1,11}.^2),kernel,'same'));
[r c]=size(ELA11);
for i=1:r
    for j=1:c
        if(ELA11(i,j)>=ELB11(i,j))
            D11(i,j)=y1{1,2}{1,11}(i,j);
        else
            D11(i,j)=y2{1,2}{1,11}(i,j);
        end
    end
end
ELA12=sqrt(conv2((y1{1,2}{1,12}.^2),kernel,'same'));
ELB12=sqrt(conv2((y2{1,2}{1,12}.^2),kernel,'same'));
[r c]=size(ELA12);
for i=1:r
    for j=1:c
        if(ELA12(i,j)>=ELB12(i,j))
            D12(i,j)=y1{1,2}{1,12}(i,j);
        else
            D12(i,j)=y2{1,2}{1,12}(i,j);
        end
    end
end
ELA13=sqrt(conv2((y1{1,2}{1,13}.^2),kernel,'same'));
ELB13=sqrt(conv2((y2{1,2}{1,13}.^2),kernel,'same'));
[r c]=size(ELA13);
for i=1:r
    for j=1:c
        if(ELA13(i,j)>=ELB13(i,j))
            D13(i,j)=y1{1,2}{1,13}(i,j);
        else
            D13(i,j)=y2{1,2}{1,13}(i,j);
        end
    end
end
ELA14=sqrt(conv2((y1{1,2}{1,14}.^2),kernel,'same'));
ELB14=sqrt(conv2((y2{1,2}{1,14}.^2),kernel,'same'));
[r c]=size(ELA14);
for i=1:r
    for j=1:c
        if(ELA14(i,j)>=ELB14(i,j))
            D14(i,j)=y1{1,2}{1,14}(i,j);
        else
            D14(i,j)=y2{1,2}{1,14}(i,j);
        end
    end
end
ELA15=sqrt(conv2((y1{1,2}{1,15}.^2),kernel,'same'));
ELB15=sqrt(conv2((y2{1,2}{1,15}.^2),kernel,'same'));
[r c]=size(ELA15);
for i=1:r
    for j=1:c
        if(ELA15(i,j)>=ELB15(i,j))
            D15(i,j)=y1{1,2}{1,15}(i,j);
        else
            D15(i,j)=y2{1,2}{1,15}(i,j);
        end
    end
end
ELA16=sqrt(conv2((y1{1,2}{1,16}.^2),kernel,'same'));
ELB16=sqrt(conv2((y2{1,2}{1,16}.^2),kernel,'same'));
[r c]=size(ELA16);
for i=1:r
    for j=1:c
        if(ELA16(i,j)>=ELB16(i,j))
            D16(i,j)=y1{1,2}{1,16}(i,j);
        else
            D16(i,j)=y2{1,2}{1,16}(i,j);
        end
    end
end
t111={D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16};
tt={FL,t111};
% Reconstruction
x = pdfbrec(tt, 'db1', 'haar');
figure,imshow(x);
F=IGHM(x);
figure,imshow(F);
title('Reconstructed Image');
% Postfiltering
F = medfilt2(F,[3 3]);
figure,imshow(F);
title('Fused Image');
4 Comments
  John D'Errico
      
      
 on 15 Mar 2011
				So you expect people to read the paper, figure out what you want to do, then verify that this complete mess of code does what it should do? Yeah, right. We will jump right to it.
  Walter Roberson
      
      
 on 14 Nov 2011
				The paper is available (amongst other places) at http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5427044
The above code calls upon the undefined function "edge_association". The paper itself does not refer to edge association at all, and seldom even refers to edges.
Answers (2)
  Jan
      
      
 on 14 Nov 2011
        Starting a program with this header is suspicious:
warning off;
clc;
clear all;
close all;
- Disable all warnings? There should be a smarter way to get rid of warnings.
 - About the clear all see good programming practice.
 - I do not see a reason to close other GUIs.
 
Later I see some variables with an index in the name, e.g. ELA5, ELB5. It is much neater to use a cell array instead.
I think, these are poor programming techniques. I did not check, if the program creates correct results. But for reading and maintenance the code has a low quality only.
2 Comments
  rajesh veerabadran
 on 27 Dec 2011
				Respected Sir 
I doimg my M.TECH in bsa university.I need some updation on this above project.For updation what algorithm we can use.
  Jan
      
      
 on 27 Dec 2011
				What do you mean by "updation"? Do you want to modify the above code? Then my advice is: Do not do this. The quality of the code is so low that deleting and re-writing it from the scratch will be an improvement already.
Please consider the comments by Walter, John and Andreas.
  rajesh veerabadran
 on 29 Dec 2011
        JAN SIMPSON SIR,
I want to use markov random principle in multicontourlet based image fusion.Is it possible to implement mrf in above source code.
1 Comment
  Walter Roberson
      
      
 on 29 Dec 2011
				No, the code posted here relies on an undefined function "edge_association" whose purpose cannot be determined by reference to the paper the code is supposedly an implementation of. The code must, until proven otherwise, be treated as having been written for some other purpose than multicontourlet based image fusion.
See Also
Categories
				Find more on Data Distribution Plots in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!