一千零一夜的博客

以此博客,见证我的终生学习

Matlab 显著性检测模型性能度量CC
% created: Zoya Bylinskii, Aug 2014

% This finds the linear correlation coefficient between two different 
% saliency maps (also called Pearson's linear coefficient).
% score=1 or -1 means the maps are correlated
% score=0 means the maps are completely uncorrelated

function score = CC(saliencyMap1, saliencyMap2)
% saliencyMap1 and saliencyMap2 are 2 real-valued matrices

map1 = im2double(imresize(saliencyMap1, size(saliencyMap2)));
map2 = im2double(saliencyMap2);
% map1=saliencyMap1;
% map2=saliencyMap2;

% normalize both maps
map1 = (map1 - mean(map1(:))) / std(map1(:)); 
map2 = (map2 - mean(map2(:))) / std(map2(:)); 

score = corr2(map2, map1);
function r = corr2(varargin)

[a,b] = ParseInputs(varargin{:});

a = a - mean2(a);
b = b - mean2(b);
r = sum(sum(a.*b))/sqrt(sum(sum(a.*a))*sum(sum(b.*b)));

%--------------------------------------------------------
function [A,B] = ParseInputs(varargin)

narginchk(2,2);

A = varargin{1};
B = varargin{2};

validateattributes(A, {'logical' 'numeric'}, {'real','2d'}, mfilename, 'A', 1);
validateattributes(B, {'logical' 'numeric'}, {'real','2d'}, mfilename, 'B', 2);

if any(size(A)~=size(B))
    error(message('images:corr2:notSameSize'))
end

if (~isa(A,'double'))
    A = double(A);
end

if (~isa(B,'double'))
    B = double(B);
end




关键代码:

r = sum(sum(a.*b))/sqrt(sum(sum(a.*a))*sum(sum(b.*b)));

可以用公式表示,图a,b的相关性大小,越大越相关:



阅读更多
想对作者说点什么? 我来说一句

图像显著性检测的文章及代码

2013年03月11日 35.16MB 下载

显著性检测—HC(matlab版)

2017年12月14日 32.29MB 下载

没有更多推荐了,返回首页

不良信息举报

Matlab 显著性检测模型性能度量CC

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭