资源简介
该代码主要是用于图像检索的,希望对大家有帮助!
代码片段和文件信息
function colorhist = CBIR_colorhist(rgb)
% EE6850 HW3 Content-based Image Retrieval
% CBIR_colorhist() --- color histogram calculation
% input:
% MxNx3 image data in RGB
% output:
% 1x256 colorhistogram <== (HxSxV = 16x4x4)
% as the MPEG-7 generic color histogram descriptor
% [Ref] Manjunath B.S.; Ohm J.-R.; Vasudevan V.V.; Yamada A. “Color and texture descriptors“
% IEEE Trans. CSVT Volume: 11 Issue: 6 Page(s): 703 -715 June 2001 (section III.B)
%
% 10-19-2001 xlx@ee.columbia.edu
% check input
if size(rgb3)~=3
error(‘3 components is needed for histogram‘);
end
% globals
H_BITS = 4;
S_BITS = 2;
V_BITS = 2;
% convert to hsv
hsv = uint8(255*rgb2hsv(rgb));
imgsize = size(hsv);
% get rid of irrelevant boundaries
i0=round(0.05*imgsize(1)); i1=round(0.95*imgsize(1));
j0=round(0.05*imgsize(2)); j1=round(0.95*imgsize(2));
hsv = hsv(i0:i1 j0:j1 :);
% histogram
for i = 1 : 2^H_BITS
for j = 1 : 2^S_BITS
for k = 1 : 2^V_BITS
colorhist(ijk) = sum(sum( ...
bitshift(hsv(::1)-(8-H_BITS))==i-1 &...
bitshift(hsv(::2)-(8-S_BITS))==j-1 &...
bitshift(hsv(::3)-(8-V_BITS))==k-1 ));
end
end
end
colorhist = reshape(colorhist 1 2^(H_BITS+S_BITS+V_BITS));
% normalize
colorhist = colorhist/sum(colorhist);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1386 2001-10-26 10:56 CBIRpca\CBIR_colorhist.m
文件 501 2001-10-26 12:59 CBIRpca\CBIR_cosinedist.m
文件 1914 2001-10-26 23:46 CBIRpca\CBIR_edgedirection.m
文件 1679 2001-10-27 03:24 CBIRpca\CBIR_edgehist.m
文件 847 2001-10-27 03:40 CBIRpca\CBIR_featurecalc.m
文件 760 2001-10-26 13:10 CBIRpca\CBIR_histintersection.m
文件 412 2001-10-27 02:23 CBIRpca\CBIR_L2dist.m
文件 2349 2001-10-28 04:04 CBIRpca\CBIR_Query.m
文件 2754 2001-10-28 03:18 CBIRpca\CBIR_Query_minmax.m
文件 86528 2007-07-03 20:51 CBIRpca\pca.doc
文件 2068 2007-07-02 21:41 CBIRpca\PCA.m
目录 0 2010-01-04 21:27 CBIRpca
----------- --------- ---------- ----- ----
101198 12
- 上一篇:老男孩运维第28期
- 下一篇:图像的插值处理源代码
评论
共有 条评论