-
Notifications
You must be signed in to change notification settings - Fork 1
/
metricIQA.m
44 lines (39 loc) · 1.43 KB
/
metricIQA.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function res=metricIQA(fused,pristineModel,group)
% Dependencies:
% - To compute steerable pyramid coefficients: matlabPyrTools.
% Available: http://www.cns.nyu.edu/lcv/software.php
% - To compute MVG model: EmGm.
% Available: http://www.mathworks.com/matlabcentral/fileexchange/26184-em-algorithm-for-gaussian-mixture-model--em-gmm-
%
% Input:
% fused = fused image whose quality needs to be computed
% pristineModel = MVG NSS-feature model
% group (optional) = groups of NSS-features to be computed from the
% fused image, by default it computes all NSS-features. Note: the number of
% features must be the same as the pristine model's
%
% Output:
% res = quality of input fused image. Higher values indicate
% worse quality.
% Take default group of features
if nargin == 2
group = 'f+pp+pd+sp';
end
% Get the Covariance matrix and Mean vector of the pristine model
cov_prisparam = pristineModel.Sigma;
mu_prisparam = pristineModel.mu;
% compute image features
features = [];
scalenum = 3;
for itr_scale = 1:scalenum
feat = computeGoodallFeatures(fused,group);
features = [features; feat];
fused = imresize(fused,0.5);
end
% get model of fused image
[~,model,~] = mixGaussEm(features,1);
cov = model.Sigma;
mu = model.mu;
% calculate Mahalanobis distance
invcov_param = pinv((cov_prisparam + cov)/2);
res = sqrt((mu_prisparam - mu)'*invcov_param*(mu_prisparam - mu));