www.pudn.com > colorseg.zip > angitest.m, change:2003-03-14,size:2455b
ds = 10:50:300;
K=50000;
LAB_DIFF=8;
PERCENTAGE = 0.05;
PERCEPTUAL = 1; % 1 for regular, 0 for gaussian
disp(sprintf('angitest: perceptual = %d',PERCEPTUAL));
% [pyr,mks,conf,sigma,mu] = preprocess('images/easyim1.jpg', ds, K, LAB_DIFF, PERCENTAGE,PERCEPTUAL);
[mks,conf] = segment('images/easyim1.jpg', ds, K, LAB_DIFF,PERCENTAGE,PERCEPTUAL);
% -------------------------------------------------------------------------------
% ** OLD TESTING STUFF BELOW
%
% % we need a better test image!
% orig = imread('images/easyim1.jpg', 'JPG');
% im = double(orig)./255;
% [h,w,c]= size(im);
%
% % viewing distances 1-10m convert to inches
% ds=1:2:10;
% ds = ds.*100/2.54;
% %ds=[1 12 24 36];
% ds = 10:50:300;
%
% % perceptual filters!
% M=createPyramid(im, ds);
% showPyramid(M,ds);
%
% % grab the coarsest img and show me
% lowimg = M(:,:,:,end);
%
% % --- taken from showPyramid ---
% RGB_WHITE = [1 1 1]';
% figure;
% whiteXYZ = changeColorSpace(RGB_WHITE, cmatrix('rgb2xyz'));
% whiteXYZ = whiteXYZ./whiteXYZ(2)*100;
% load displayGamma;
% thisXYZ = lab2xyz(lowimg, whiteXYZ);
% imgLinearRGB = changeColorSpace(thisXYZ, cmatrix('xyz2rgb'));
% imgRGB = dac2rgb(imgLinearRGB,invGamma);
% imagesc(imgRGB./255);
%
% % IGNORE THIS CRAP
% % primary=zeros(2,4,3);
% % primary(1,1,:)=[1 1 1];
% % primary(1,2,:)=[1 0 0];
% % primary(1,3,:)=[0 1 0];
% % primary(1,4,:)=[0 0 1];
% % primary(2,1,:)=[0 0 0];
% % primary(2,2,:)=[1 1 0];
% % primary(2,3,:)=[0 1 1];
% % primary(2,4,:)=[1 0 1];
% % primaryXYZ = changeColorSpace(primary, cmatrix('rgb2xyz'));
% % primaryXYZ = primaryXYZ./primaryXYZ(1,1,2)*100;
% % primaryLAB = xyz2lab(primaryXYZ,whiteXYZ)
%
% [cmasks,mus,groups,mp] = kmeansClusters(lowimg, 10000);
% % 10000 --> 95 clusters
% % 1000 --> 36 clusters
%
% % merge
% [newc newg newmp newmu] = clusterMerge(lowimg,groups,mp,cmasks,mus(:,3:5));
% figure
% colors=colormap(bone(size(newc,3)+1));
% cmap = zeros(max(newg(:)),3);
% count=size(colors,1);
% cmapind=unique(newg(:));
% for ind=1:count
% cmap(cmapind(ind)+1,:) = colors(ind,:);
% end
% colormap(cmap);
% imagesc(newg);
% title('merged clusters')
%
% % core clusters
% [stds,means,confs,newc2]=formCoreClusters(lowimg,newc);
%
% numClusters=size(newc2,3);
% figure
% showme = zeros(h,w);
% for ind=1:numClusters
% indices=find(newc2(:,:,ind)~=0);
% showme(indices) = ind;
% end
% imagesc(showme)
% colormap(bone(numClusters+1))
% colorbar;
% title('core clusters')