📄 cbir_histintersection.m
字号:
function dist = CBIR_histintersection(x1, x2)
% EE6850 HW3, Content-Based Image Retrieval
% CBIR_histintersection() --- intersection of two histograms
% input:
% feature vector x1 and x2 (1xN)
% output:
% 1 - their intersection
% [ref] section 4.3.1.1, John R. Smith,
% "Integrated Spatial and Feature Image Systems: Retrieval, Analysis and Compression",
% Ph.D. thesis, Columbia Univ. 1997
%
% 10-25-2001, xlx@ee.columbia.edu
if sum(x1(:)<0) | sum(x2(:)<0)
error('histogram must be non-negative');
end
if sum(size(x1)==size(x2))~=2
error('To calculate intersection, vector dimension must agree');
end
dist = sum(min([x1(:)'; x2(:)']));
denom = min([sum(x1(:)),sum(x2(:))])+1e-8;
dist = dist/denom;
dist = 1-dist;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -