您好,欢迎访问三七文档
当前位置:首页 > 机械/制造/汽车 > 汽车理论 > Ica盲源分离Matlab程序
Ica盲源分离Matlab程序closeall;clearall;i4=imread('1.jpg');i5=imread('2.jpg');i6=imread('2.png');i1=rgb2gray(i4);i2=rgb2gray(i5);i3=rgb2gray(i6);s1=reshape(i1,[1,256*256]);s2=reshape(i2,[1,256*256]);s3=reshape(i3,[1,256*256]);s=[s1;s2;s3];sig=double(s);aorig=rand(size(sig,1));mixedsig=aorig*sig;ms1=reshape(mixedsig(1,:),[256,256]);ms2=reshape(mixedsig(2,:),[256,256]);ms3=reshape(mixedsig(3,:),[256,256]);figure;subplot(331),imshow(i1),subplot(332),imshow(i2),subplot(333),imshow(i3);subplot(334),imshow(uint8(ms1)),subplot(335),imshow(uint8(ms2)),subplot(336),imshow(uint8(ms3));%mixedsig=zeros(size(mixedsig));meanValue=mean(mixedsig')';mixedsig=mixedsig-meanValue*ones(1,size(mixedsig,2));covarianceMatrix=cov(mixedsig',1);[E,D]=eig(covarianceMatrix);eigenvalues=flipud(sort(diag(D)));whiteningMatrix=inv(sqrt(D))*E';dewhiteningMatrix=E*sqrt(D);whitesig=whiteningMatrix*mixedsig;X=whitesig;[vectorSize,numSamples]=size(X);B=zeros(vectorSize);numOFIC=vectorSize;forr=1:numOFICi=1;maxNumIterations=100;w=rand(vectorSize,1)-.5;w=w/norm(w);whilei=maxNumIterations+1w=w-B*B'*w;w=w/norm(w);w=(X*((X'*w).^3))/numSamples-3*w;w=w/norm(w);i=i+1;endA(:,r)=dewhiteningMatrix*w;W(r,:)=w'*whiteningMatrix;B(:,r)=w;endicasig=W*mixedsig+(W*meanValue)*ones(1,numSamples);icasig=abs(50*icasig);a=reshape(icasig(1,:),[256,256]);b=reshape(icasig(2,:),[256,256]);c=reshape(icasig(3,:),[256,256]);subplot(337),imshow(uint8(a)),subplot(338),imshow(uint8(b)),subplot(339),imshow(uint8(c))
本文标题:Ica盲源分离Matlab程序
链接地址:https://www.777doc.com/doc-7098594 .html