📄 cbir_cosinedist.m
字号:
function dist = CBIR_cosinedist(x1, x2)
% EE6850 HW3, Content-Based Image Retrieval
% CBIR_cosinedist() --- Cosine distance of a given feature vector pair
% input:
% feature vector x1 and x2 (1xN)
% output:
% their cosine distance (0~1)
% 10-24-2001, xlx@ee.columbia.edu
if sum(size(x1)==size(x2))~=2
error('To calculate cosine distance, matrix dimension must agree');
end
costheta = sum(x1(:).*x2(:))/...
sqrt( x1(:)'*x1(:) * x2(:)'*x2(:));
dist = acos(costheta)*2/pi;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -