为了更好的评估红外和可见光图像融合算法的性能,对融合算法进行定量评估,本篇博客在对目前已有的部分评估指标进行了整理及汇总,虽然是用于评估红外和可见光图像融合算法的性能,但部分评估指标对于其他诸如多曝光、多聚焦、医学图像融合也适用,共整理了17种评估方法的代码,分别是:
评估指标 | 缩写 |
---|---|
信息熵 | EN |
空间频率 | SF |
标准差 | SD |
峰值信噪比 | PSNR |
均方误差 | MSE |
互信息 | MI |
视觉保真度 | VIF |
平均梯度 | AG |
相关系数 | CC |
差异相关和 | SCD |
基于梯度的融合性能 | Qabf |
结构相似度测量 | SSIM |
多尺度结构相似度测量 | MS-SSIM |
基于噪声评估的融合性能 | Nabf |
像素特征互信息 | FMI_pixel |
离散余弦特征互信息 | FMI_dct |
小波特征互信息 | FMI_w |
性能评估指标主要分为四类,分别是基于信息论的评估指标,主要包括** EN、MI、FMI_pixel、FMI_w、FIM_dct、PSNR**、基于结构相似性的评估指标,主要包括SSIM、MS_SSIM、MSE、基于图像特征的评估指标, 主要包括SF、SD、AG,基于人类视觉感知的评估指标,主要包括VIF、以及基于源图像与生成图像的评估指标,主要包括CC、SCD、Qabf、Nabf。
接下来是评估算法主函数的介绍
clc
clear all
names = {'AEFusion', 'CNN', 'DenseFuse', 'FusionGAN', 'GTF', 'IFCNN', 'JSRSD', 'Latlrr', 'MaskFusion', 'PMGI', 'WLS'}; #用于保存对比算法的名称
rows = ['B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']; #用于保存测试指标对应的位置
easy = 0
row_name1 = 'row1';
row_data1 = 'row2';
for i = 1 : length(names)
method_name = cellstr(names(i))
row = rows(i)
row_name = strrep(row_name1, 'row', row);
row_data = strrep(row_data1, 'row', row);
fileFolder=fullfile('../Comparison/Test_ir'); #此处我将需要测试的图像放置在Test_ir文件夹中
dirOutput=dir(fullfile(fileFolder,'*.bmp')); #测试图像全部是bmp后缀
fileNames = {dirOutput.name};
[m, num] = size(fileNames);
ir_dir = '../Comparison/New_Test_ir/'; #用于评估算法性能的红外图像文件夹
vi_dir = '../Comparison/New_Test_vi/'; #用于评估算法性能的可见光图像文件夹
Fused_dir = '../Comparison/'; # 用于存放对比结果的文件夹,Comparison中主要包括所有对比算法,对比算法的文件夹以DenseFuse为例 ‘/DenseFuse/DenseFuse_Results’类似的存放
Fused_dir = char(strcat(Fused_dir, names(i), '\', names(i), '_Results', '\'));
EN_set = []; SF_set = [];SD_set = [];PSNR_set = [];
MSE_set = [];MI_set = [];VIF_set = []; AG_set = [];
CC_set = [];SCD_set = []; Qabf_set = [];
SSIM_set = []; MS_SSIM_set = [];
Nabf_set = [];FMI_pixel_set = [];
FMI_dct_set = []; FMI_w_set = [];
disp(method_name)
for i = 1:num
disp('---------------------------Analysis---------------------------');
fileName_source_ir = strcat(ir_dir, fileNames{i});
fileName_source_vi = strcat(vi_dir, fileNames{i});
fileName_Fusion = strcat(Fused_dir, fileNames{i});
ir_image = imread(fileName_source_ir);
vi_image = imread(fileName_source_vi);
fused_image = imread(fileName_Fusion);
[m, n] = size(fused_image);
% fused_image = fused_image(7:m-6, 7:n-6);
ir_size = size(ir_image);
vi_size = size(vi_image);
fusion_size = size(fused_image);
if length(ir_size) < 3 & length(vi_size) < 3
disp(fileNames{i})
[EN, SF,SD,PSNR,MSE, MI, VIF, AG, CC, SCD, Qabf, Nabf, SSIM, MS_SSIM, FMI_pixel, FMI_dct, FMI_w] = analysis_Reference(fused_image,ir_image,vi_image, easy);
EN_set = [EN_set, EN];SF_set = [SF_set,SF];SD_set = [SD_set, SD];PSNR_set = [PSNR_set, PSNR];
MSE_set = [MSE_set, MSE];MI_set = [MI_set, MI]; VIF_set = [VIF_set, VIF];
AG_set = [AG_set, AG]; CC_set = [CC_set, CC];SCD_set = [SCD_set, SCD];
Qabf_set = [Qabf_set, Qabf]; Nabf_set = [Nabf_set, Nabf];
SSIM_set = [SSIM_set, SSIM]; MS_SSIM_set = [MS_SSIM_set, MS_SSIM];
FMI_pixel_set = [FMI_pixel_set, FMI_pixel]; FMI_dct_set = [FMI_dct_set,FMI_dct];
FMI_w_set = [FMI_w_set, FMI_w];
else
disp('unsucessful! ')
disp( fileName_Fusion)
end
disp('Done');
end
# easy == 1 主要是由于在运行程序过程中有的评估指标耗时较长,easy == 1 时对于耗时较长的指标不进行测试
if easy == 1
xlswrite('评估指标.xlsx', method_name,'EN',row_name)
xlswrite('评估指标.xlsx', method_name,'SF',row_name)
xlswrite('评估指标.xlsx', method_name,'SD',row_name)
xlswrite('评估指标.xlsx', method_name,'PSNR',row_name)
xlswrite('评估指标.xlsx', method_name,'MSE',row_name)
xlswrite('评估指标.xlsx', method_name,'MI',row_name)
xlswrite('评估指标.xlsx', method_name,'VIF',row_name)
xlswrite('评估指标.xlsx', method_name,'AG',row_name)
xlswrite('评估指标.xlsx', method_name,'CC',row_name)
xlswrite('评估指标.xlsx', method_name,'SCD',row_name)
xlswrite('评估指标.xlsx', method_name,'Qabf',row_name)
xlswrite('评估指标.xlsx',SF_set','SF',row_data)
xlswrite('评估指标.xlsx',SD_set','SD',row_data)
xlswrite('评估指标.xlsx',PSNR_set','PSNR',row_data)
xlswrite('评估指标.xlsx',MSE_set','MSE',row_data)
xlswrite('评估指标.xlsx',MI_set','MI',row_data)
xlswrite('评估指标.xlsx',VIF_set','VIF',row_data)
xlswrite('评估指标.xlsx',AG_set','AG',row_data)
xlswrite('评估指标.xlsx',CC_set','CC',row_data)
xlswrite('评估指标.xlsx',EN_set','EN',row_data)
xlswrite('评估指标.xlsx',SCD_set','SCD',row_data)
xlswrite('评估指标.xlsx',Qabf_set','Qabf',row_data)
else
xlswrite('评估指标.xlsx', method_name,'Nabf',row_name)
xlswrite('评估指标.xlsx', method_name,'SSIM',row_name)
xlswrite('评估指标.xlsx', method_name,'MS_SSIM',row_name)
xlswrite('评估指标.xlsx', method_name,'FMI_pixel',row_name)
xlswrite('评估指标.xlsx', method_name,'FMI_dct',row_name)
xlswrite('评估指标.xlsx', method_name,'FMI_w',row_name)
xlswrite('评估指标.xlsx',Nabf_set','Nabf',row_data)
xlswrite('评估指标.xlsx',SSIM_set','SSIM',row_data)
xlswrite('评估指标.xlsx',MS_SSIM_set','MS_SSIM',row_data)
xlswrite('评估指标.xlsx',FMI_pixel_set','FMI_pixel',row_data)
xlswrite('评估指标.xlsx',FMI_dct_set','FMI_dct',row_data)
xlswrite('评估指标.xlsx',FMI_w_set','FMI_w',row_data)
end
end
除main函数之外的程序列表包括:
所有测试代码整合在:https://download.csdn.net/download/fovever_/12543640
由于博主个人水平有限,或许有不足之处,欢迎大家指正和交流。