?? initialise.asv
字號:
function [pop]=initialise(popsize,stringlength,a,b)
% popsize=20;stringlength=8;
pop=zeros(popsize,stringlength+2);
i=1;
% for i=1:popsize
while i<=popsize
pop1=round(rand(1,stringlength));
sum=0;
for k=1:stringlength
sum=sum+pop1(k)*2^(k-1);
end
x=sum;%解碼
% A=imread('pout.tif');
% load woman;
% A=imread('blood1.tif');
% my=imread('mysaturn.tif');
% A=wiener2(my,[5 5]);
% A=imnoise(a,'gaussian',0,0.05);
% A=imread('kids.tif');
a=imread('mytu.tif');
count=imhist(A);
[m,n]=size(A);
N=m*n;
L=256;
count=count/N;
u=0;
for j=1:L
u=u+count(j)*j;
end
w=0;ua=0;
for j=1:x
w=w+count(j);
ua=ua+count(j)*j;
end
if (w~=0)&(w~=1)
eval1=(u*w-ua)^2/(w*(1-w));
pop(i,1:stringlength)=pop1;
pop(i,stringlength+1)=x;
pop(i,stringlength+2)=eval1;
i=i+1;
else
i=i;
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -