Initial  approximation for 2 partition

Input: kk=2;weights (Subscript[w, 1]),⃛,(Subscript[w, m]) >0,dataGS={Graylevels,Pixels,RGB-triples};
Output: Initial approximation;
Submodules: WKMeansAdd[], SymDIRECT[]

IASymDIR[kk_,w_,dataGS_,Ind_:0]:=Module[{z0},
dom=Table[{0,1},{kk}];
cFunk0[var_]:=Compile[var,Evaluate[Sum[Min[Table[EuclideanDistance[Table[(Subscript[x, j]),{j,1+(s-1),1+s-1}],dataGS[[i,1]]],{s, 1,kk}]],{i,Length[dataGS]}]]];
FCompile=cFunk0[Table[{(Subscript[x, i]),_Real},{i,kk}]]; 
						(* Poziv SymDIRECT *)
Nf=0;
minSym=SymDIRECT[FCompile,dom,DMin->10^(-4),MaxIter->70,Eps->10^(-4)];
cenSym=Sort[minSym[[1]]];
sol2=WKMeansAdd[w,dataGS,cenSym,1,0]; (* Determining clusters size *)Print[Style["IA-SymDIRECT: ",16,Blue],"centers: ",cenSym,Table[Graphics[{GrayLevel[cenSym[[j]]],Disk[]},ImageSize->20],{j,Length[cenSym]}],"\nF(WF) = ",minSym[[2]],"; Nf = ",Nf,"; It = ",iter,"; {|pi_1|,|pi_2|}:",{Length[sol2[[1,1]]],Length[sol2[[1,2]]]}];
z0=Table[Mean[WeightedData[sol2[[1,j,All,4]],sol2[[1,j,All,1]]]],{j,Length[sol2[[1]]]}];
{z0}]