?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously.
For complete code, paper reproduction, journal cooperation, paper tutoring and scientific research simulation cooperation, please send a private message.
Personal homepage: Matlab Research Studio
Personal credo: Investigate things to gain knowledge.
For more complete Matlab code and simulation customization content, click
Intelligent optimization algorithm Neural network prediction Radar communication Wireless sensor Power system
Signal processing Image processing Path planning Cellular automaton Drone
Content introduction
Image fusion is an important research direction in the field of computer vision, aiming to fuse multiple images into an image with more information and visual effects. This article will introduce an image fusion algorithm based on shear transformation and average brightness, and elaborate on its algorithm steps.
The goal of the image fusion algorithm is to reasonably fuse the useful information in multiple images to produce a better image. The steps of this algorithm mainly include: image preprocessing, shearing transformation, brightness adjustment and image synthesis.
First, image preprocessing is performed. This step is mainly to perform some basic processing on the image to be fused, such as resizing the image, removing noise, etc. The purpose of preprocessing is to improve the processing effect of subsequent steps.
Next is the shear transformation. The purpose of this step is to cut the images to be fused so that their edges align. Shear transformation can be achieved by finding common feature points between two images and performing corresponding transformations. The advantage of this is that it can reduce the distortion of the fused image and improve the fusion effect.
Then there is the brightness adjustment. After shear transformation, since there may be differences in the brightness of the images, the brightness of the images needs to be adjusted to make their brightness more consistent. Commonly used brightness adjustment methods include histogram equalization and grayscale stretching. Through brightness adjustment, you can make the fused image more natural and realistic.
The last step is image synthesis. After the previous steps, the shear transformed and brightness adjusted images can be fused. Commonly used image fusion methods include weighted average method and multi-resolution fusion method. The weighted average method is to weight and average the images to be fused according to a certain weight to obtain the final fused image. The multi-resolution fusion method decomposes the image into different resolution levels, then fuses each level, and finally reconstructs it. These methods can be selected according to actual needs to obtain the best fusion effect.
In summary, the image fusion algorithm based on shear transformation and average brightness is an effective image fusion method. By shearing, transforming, and brightness adjusting the image, and using appropriate image synthesis methods, a fused image with more information and visual effects can be obtained. This algorithm has broad application prospects in the field of computer vision and can be used in image enhancement, target detection, etc., and has important research and practical value.
Part of the code
addpath(genpath('ShearLab3D'))</code><code>?</code><code>% Read image</code><code>img1 = imread('c07_1.tif\ ');</code><code>img2 = imread('c07_2.tif');</code><code>?</code><code>% Adjust image size</code><code>figure (1);</code><code>img1 = imresize(img1,[512,512]);</code><code>imshow(img1);</code><code>title('Image1'); </code><code>figure(2);</code><code>img2 = imresize(img2,[512,512]);</code><code>imshow(img2);</code><code>title ('Image2');</code><code>oeffs_fused,shearletSystem);</code><code>?</code><code>% Display fused image</code><code>figure(3) ;</code><code>imshow(uint8(fused_image));</code><code>title('Fused Image');</code><code>?</code><code>% original Image</code><code>original1 = double(img1);</code><code>original2 = double(img2);</code><code>?</code><code>% Peak Signal-to- Noise Ratio (PSNR)</code><code>% psnr1 = psnr(fused_image, original1);</code><code>% psnr2 = psnr(fused_image, original2);</code><code>psnr1 = calculate_psnr( fused_image, original1);</code><code>psnr2 = calculate_psnr(fused_image, original2);</code><code>fprintf('PSNR for image 1: %f\\ ', psnr1);</code> code><code>fprintf('PSNR for image 2: %f\\ ', psnr2);</code><code>?</code><code>% Structural Similarity Index (SSIM)</code><code>ssim1 = ssim(fused_image, original1);</code><code>ssim2 = ssim(fused_image, original2);</code><code>fprintf('SSIM for image 1: %f\\ ', ssim1);</code><code>fprintf('SSIM for image 2: %f\\ ', ssim2);</code><code>?</code><code>% % Mean Squared Error (MSE)</code><code>% mse1 = immse(fused_image, original1);</code><code>% mse2 = immse(fused_image, original2);</code><code>% fprintf( 'MSE for image 1: %f\\ ', mse1);</code><code>% fprintf('MSE for image 2: %f\\ ', mse2);</code> <code>% </code><code>% % Mean Absolute Difference (MAD)</code><code>% mad1 = mean(abs(fused_image(:) - original1(:)));</code><code>% mad2 = mean(abs(fused_image(:) - original2(:)));</code><code>% fprintf('MAD for image 1: %f\\ ', mad1);</code><code>% fprintf('MAD for image 2: %f\\ ', mad2);</code><code>% </code><code>% % NCC</code><code>% ncc_value1 = NCC(fused_image, original1);</code><code>% ncc_value2 = NCC(fused_image, original2);</code><code>% fprintf('NCC for image 1: %f\ n', ncc_value1);</code><code>% fprintf('NCC for image 2: %f\\ ', ncc_value2);</code><code>% </code><code> % % MAE</code><code>% mae_value1 = MAE(fused_image, original1);</code><code>% mae_value2 = MAE(fused_image, original2);</code><code>% fprintf('MAE for image 1: %f\\ ', mae_value1);</code><code>% fprintf('MAE for image 2: %f\\ ', mae_value2);</code><code> ?</code><code>% Compute the standard deviation</code><code>sd_fused = std(double(fused_image(:)));</code><code>fprintf('SD of fused image: % f\\ ', sd_fused);</code><code>?</code><code>% Spatial Frequency</code><code>sf = mean(abs(diff(double(fused_image), 1, 1)), 'all') + mean(abs(diff(double(fused_image), 1, 2)), 'all');</code><code>fprintf('Spatial Frequency of fused image: %f\\ ', sf);</code><code>?</code><code>% Average Gradient</code><code>[gradX, gradY] = gradient(double(fused_image) );</code><code>ag = mean(sqrt(gradX.^2 + gradY.^2), 'all');</code><code>fprintf('Average Gradient of fused image: %f\\ ', ag);</code><code>?</code><code>% Information Entropy</code><code>ie = entropy(fused_image);</code><code> fprintf('Information Entropy of fused image: %f\\ ', ie);</code><code>?</code><code>% Mutual Information</code><code>mi1 = mi( double(original1), double(fused_image));</code><code>fprintf('Mutual Information of fused image and original image 1: %f\\ ', mi1);</code><code> mi2 = mi(double(original2), double(fused_image));</code><code>fprintf('Mutual Information of fused image and original image 2: %f\\ ', mi2);</code><code>?</code><code>?</code><code>?</code><code>% Additional functions</code><code>function ncc = NCC(img1, img2)</code><code> img1 = img1 - mean(img1(:));</code><code> img2 = img2 - mean(img2(:));</code><code> numerator = sum(sum(img1 . * img2));</code><code> denominator = sqrt(sum(sum(img1 .^ 2)) * sum(sum(img2 .^ 2)));</code><code> ncc = numerator / denominator;</code><code>end</code><code>?</code><code>function mae = MAE(target, reference)</code><code> error = target - reference;</code><code> mae = mean(abs(error(:)));</code><code>end</code><code>?</code><code>% Define the Mutual Information function</code> <code>function h = mi(A,B)</code><code> A = round((A - min(A(:))) / (max(A(:)) - min(A(:) )) * 255);</code><code> B = round((B - min(B(:))) / (max(B(:)) - min(B(:))) * 255); </code><code> jointHistogram = accumarray([A(:) B(:)] + 1, 1) / numel(A);</code><code> jointEntropy = - sum(jointHistogram(jointHistogram > 0) .* log2(jointHistogram(jointHistogram > 0)));</code><code> entropyA = entropy(uint8(A));</code><code> entropyB = entropy(uint8(B));</code><code> h = entropyA + entropyB - jointEntropy;</code><code>end</code><code>?</code><code>function psnr_val = calculate_psnr(img1, img2)</code><code> img1 = double(img1);</code><code> img2 = double(img2);</code><code> mse = mean((img1(:) - img2(:)).^2);</code><code> if mse == 0</code><code> psnr_val = Inf;</code><code> else</code><code> maxValue = double(max(img1(:))); </code><code> psnr_val = 20 * log10(maxValue/sqrt(mse));</code><code> end</code><code>end</code><code>?
Operation results
References
[1] Xu Lingzhang. Research on infrared and low-light image fusion algorithm based on TMS320DM6467 [D]. Yunnan Normal University, 2016.
[2] Yang Jinku. Research on image fusion algorithm based on two-dimensional empirical mode decomposition [D]. Northwestern Polytechnical University [2023-10-27]. DOI: CNKI: CDMD: 1.1017.803623.
[3] Wu Lulu. Research on video watermarking algorithm based on wavelet transform domain[D]. Jiangxi University of Science and Technology, 2013.