📄 pp.m
字号:
% =====================================================================
% PP algorithm
% Start Date: 15/07/2006
% Last Changed: 21/08/2006
% Usage: Before runing the program, make sure experimental image exist
%
% Specification: The algorithm, proposed by Ji and Liao in 2006, incorporating
% both PSO algorithm and LBG to one iteration and using
% particle-pair to explore in the problem space
%
% Copyright (c) Ji and Liao in 2006
% All rights Reserved
%==========================================================================
warning off MATLAB:divideByZero
clear all;
psnr1=0;
k=2;
particle=[];
pbest_value=[];
t=[];
gbest_value_smallpop=[];
for i=1:k
[particlenext,pbestnext,t1,gbest_value]=PSOLBG1;
particle=[particle;particlenext];
pbest_value=[pbest_value;pbestnext];
gbest_value_smallpop=[gbest_value_smallpop;gbest_value];
t=[t,t1];
end
[gbest,psnr1,t2,gbest_value_pop3,tempz_cluster]=PSOLBG2(particle,pbest_value);
t=[t,t2];
timeconsumed=sum(t)/60 %time used in minute
psnr1 % the psnr value of last iteration
% evaluate the distortion below
GenTrainingVector;
num_cluster=256;
num_trainingvector=4096;
for j=1:num_trainingvector
[C(j),I(j)]=min(sum((repmat(trainingvector(j,:),num_cluster,1)-tempz_cluster).^2,2));
end
Distortion=sum(C)/4096
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -