PCQI code doesn't showing any output neither any error

1 次查看(过去 30 天)
I need to take output from a "PCQI: A Patch-Structure Representation Method for Quality Assessment of Contrast Changed Images" code. But whenever i run this, it doesnt show anything at all. Not even an error. How can i solve this?
Demo.m
clc;
clear;
im1=imread('ref.png');
im2=imread('contrast_changed.png');
im1=double(rgb2gray(im1));
im2=double(rgb2gray(im2));
[mpcqi, pcqi_map] = PCQI(im1, im2);
PCQI.m (default value for window = fspecial('gaussian', 11, 1.5); L = 256)
function [mpcqi, pcqi_map]= PCQI(img1, img2, window, L)
if (nargin < 2 || nargin > 4)
mpcqi = -Inf;
pcqi_map = -Inf;
return;
end
if (size(img1) ~= size(img2))
mpcqi = -Inf;
pcqi_map = -Inf;
return;
end
[M N] = size(img1);
if (nargin == 2)
if ((M < 11) || (N < 11))
mpcqi = -Inf;
pcqi_map = -Inf;
return
end
window = fspecial('gaussian', 11, 1.5);
L = 256;
end
if (nargin == 3)
[H W] = size(window);
if ((H*W) < 4 || (H > M) || (W > N))
mpcqi = -Inf;
pcqi_map = -Inf;
return
end
L = 255;
end
if (nargin == 4)
[H W] = size(window);
if ((H*W) < 4 || (H > M) || (W > N))
mpcqi = -Inf;
pcqi_map = -Inf;
return
end
end
window = window/sum(sum(window));
mu1 = filter2(window, img1, 'valid');
mu2 = filter2(window, img2, 'valid');
mu1_sq = mu1.*mu1;
mu2_sq = mu2.*mu2;
mu1_mu2 = mu1.*mu2;
sigma1_sq = filter2(window, img1.*img1, 'valid') - mu1_sq;
sigma2_sq = filter2(window, img2.*img2, 'valid') - mu2_sq;
sigma12 = filter2(window, img1.*img2, 'valid') - mu1_mu2;
sigma1_sq = max(0, sigma1_sq);
sigma2_sq = max(0, sigma2_sq);
C=3;
pcqi_map = (4/pi) *atan((sigma12 + C )./(sigma1_sq + C ));
pcqi_map = pcqi_map .*((sigma12 + C) ./(sqrt(sigma1_sq).*sqrt(sigma2_sq) + C));
pcqi_map = pcqi_map .*exp(-abs(mu1-mu2)/L);
mpcqi = mean2(pcqi_map);
return

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dictionaries 的更多信息

产品


版本

R2015b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by