0% found this document useful (0 votes)
3 views1 page

Digital Signal Processing Image Fusion

Uploaded by

Parth Lakhera
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Digital Signal Processing Image Fusion

Uploaded by

Parth Lakhera
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Digital Signal Processing Project

Name: Parth Lakhera Roll No: 2310110217

I1 = im2double(imread('[Link]'));
I2 = im2double(imread('[Link]'));
I3 = im2double(imread('[Link]'));

G1 = rgb2gray(I1);
G2 = rgb2gray(I2);
G3 = rgb2gray(I3);

avg_filter = fspecial('average', [5 5]);


B1 = imfilter(G1, avg_filter, 'replicate');
B2 = imfilter(G2, avg_filter, 'replicate');
B3 = imfilter(G3, avg_filter, 'replicate');

D1 = G1 - B1;
D2 = G2 - B2;
D3 = G3 - B3;

lap = fspecial('laplacian', 0.2);


gauss = fspecial('gaussian', [7 7], 2);

L1 = abs(imfilter(G1, lap, 'replicate'));


L2 = abs(imfilter(G2, lap, 'replicate'));
L3 = abs(imfilter(G3, lap, 'replicate'));

S1 = imfilter(L1 + abs(D1), gauss, 'replicate');


S2 = imfilter(L2 + abs(D2), gauss, 'replicate');
S3 = imfilter(L3 + abs(D3), gauss, 'replicate');

S1 = mat2gray(S1);
S2 = mat2gray(S2);
S3 = mat2gray(S3);

W = cat(3, S1, S2, S3);


Wsum = sum(W, 3) + eps;
Wn(:,:,1) = S1 ./ Wsum;
Wn(:,:,2) = S2 ./ Wsum;
Wn(:,:,3) = S3 ./ Wsum;

r = 8;
eps_val = 0.02^2;

Wg(:,:,1) = imguidedfilter(Wn(:,:,1), G1, 'NeighborhoodSize', [r r], 'DegreeOfSmoothing', eps_val);


Wg(:,:,2) = imguidedfilter(Wn(:,:,2), G2, 'NeighborhoodSize', [r r], 'DegreeOfSmoothing', eps_val);
Wg(:,:,3) = imguidedfilter(Wn(:,:,3), G3, 'NeighborhoodSize', [r r], 'DegreeOfSmoothing', eps_val);

Wsum = sum(Wg, 3) + eps;


Wg(:,:,1) = Wg(:,:,1) ./ Wsum;
Wg(:,:,2) = Wg(:,:,2) ./ Wsum;
Wg(:,:,3) = Wg(:,:,3) ./ Wsum;

F = Wg(:,:,1).*I1 + Wg(:,:,2).*I2 + Wg(:,:,3).*I3;

figure;
imshow(I1); title('Focus A');
figure;
imshow(I2); title('Focus B');
figure;
imshow(I3); title('Focus C');
figure;
imshow(F);
title('Fused Image (Natural Smooth)');

Published w ith MATLAB® R2024b

You might also like