【CBIR】【Color】颜色关联图Color Correlograms

来源:互联网 发布:软件测试大纲模板 编辑:程序博客网 时间:2024/04/28 11:02

颜色关联图Color Correlograms


function CC_output = Color_Correlograms(img)%img is simple channel[rows,cols] = size(img);H = fspecial('average',3);imgBlur = imfilter(img,H,'replicate');M = 64;%量化为N等份% Ndis = 256/M;%量化距离% reduceColors = ((imgBlur-Ndis/2)/Ndis)+1;imgBlur = double(imgBlur);minpix = min(min(imgBlur));maxpix = max(max(imgBlur));reduceColors = round((imgBlur-minpix)/(maxpix-minpix)*(M-1))+1;d = 8;%距离总数CC_output = uint16(zeros(M,M,d));for r = 1:rows    for c = 1:cols        ci = reduceColors(r,c);        for kr = -d:d            if (r+kr)>0&&(r+kr)<(rows+1)            for kc = -d:d                if (c+kc)>0&&(c+kc)<(cols+1)                    if(kr==0&&kc==0)                        a = 1;                    else                        cj = reduceColors(r+kr,c+kc);                        index = max(abs(kr),abs(kc));%                         if index~=0                            CC_output(ci,cj,index) = CC_output(ci,cj,index)+1;%                         end                    end                end                            end            end        end    endendCC_output = CC_output/2;                    


0 0