if any(strcmp(O1, { '00000','10000','11000' } )) I used this also but still my .wav file is not playing properly??

1 次查看(过去 30 天)
The .wav file which i inserted in if loop(Sound 2.wav) is not working. I have attached my code also also given below. So please check the program n tell me where I am doing a mistake. I have also attached IEEE paper which i followed to calculate standard deviation of an image. Thank you for your support.
clc; clear all;
i0f=imread('IIMG_002 (1).jpg'); i1f=rgb2gray(i0f); %i1f=i0f; figure(1); imshow(i1f); Bf = imresize(i1f, [200 200]); i2f=wiener2(i1f);
figure(2); imshow(i2f);
[LLf,LH,HL,HH] = dwt2(i2f,'db1'); af=mat2gray(LLf); figure(3); imshow(af); [z,n]= size (LLf);
theta=pi/8;
sigma_x=4;
sigma_y=4;
f=0.1;
l=5;
k=5;
for x=-4:4
for y=-4:4
x_theta=x*cos(theta)+y*sin(theta);
y_theta=-x*sin(theta)+y*cos(theta);
gbf(x+l,y+k)=(cos(0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi*f*x_theta))-i.*(sin(0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi*f*x_theta));
end
end
y1f=real(gbf);
y2f=imag(gbf);
figure(4);
y3f=conv2(af,y1f,'same');
y31f=uint8(y3f);
imshow(y31f);
%%%%%%%%%%% Palm print %%%%%%%%%%%%%%%
ip= imread('IMG_002 (1).jpg'); i1p=rgb2gray(ip); [rr cc]=size(i1p); figure(5); imshow(i1p); Bp= imresize(i1p, [200 200]);
i2p=wiener2(i1p);
figure(6); imshow(i2p); [LLp,LH,HL,HH] = dwt2(i2p,'db1'); ap=mat2gray(LLp);
figure(7); imshow(ap); [o,h]= size (LLp);
theta=pi/8;
sigma_x=4;
sigma_y=4;
f=0.1;
l=5;
k=5;
for x=-4:4
for y=-4:4
x_theta=x*cos(theta)+y*sin(theta);
y_theta=-x*sin(theta)+y*cos(theta);
gbp(x+l,y+k)=(cos(0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi*f*x_theta))-i.*(sin(0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi*f*x_theta));
end
end
y1p=real(gbp);
y2p=imag(gbp);
y3p=conv2(ap,y1p,'same');
y31p=uint8(y3p);
figure(8);
imshow(y31p);
%%%%%%%%% Normailization %%%%%%%%%%%%%%%%%%%
y32p=mat2gray(y31p);
y32f=imresize(y31f,[rr/2 cc/2]);
y33f=mat2gray(y32f);
%%%%%%%%% fusion %%%%%%%%%%%%%%%%%%%%%%%%%%%%
yo=[y33f y32p;y32p y33f];
yo1=imresize(yo, [500 500]);
figure(9);
imshow(yo1);
%%%%%%%% Standard deviation %%%%%%%%%
t=1; r=1; s=100; f=1; v=100; u=0; h=0; i=1; for e=1:5 for w=1:5
d=std2(yo1(r:s, f:v));
d2(i)=d;
i=i+1;
for q=1:100;
for c=1:100
d1(q+u,c+h)=d;
end
end
u=u+100;
t=t+1;
r=r+100;
s=s+100;
end
u=0;
h=h+100;
r=1;
s=100;
f=f+100;
v=v+100;
end
figure(10);
imshow(d1);
%d2 is the array of std values!!!
% I=[d2(:)]; % T=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % % % I=I'; % % net=newff(I,T,5); % net.trainfcn='trainc'; %%%name of network training function % net.trainparam.epochs=2200; % net.trainparam.goal=0.001; % net.trainparam.lr=0.0005; % net=train(net,I,T); % save net;
load C:\Users\Ashoka\Documents\MATLAB\workspace\6prsn_2error.mat %I1=input('enter ur ip:'); I1=[d2(:)]; I1=I1'; O=sim(net,I1'); O1= O' [m,n]=size(O1);
for i=1:m for j=1:n if O1(i,j)>0.78
O1(i,j)=1;
else
O1(i,j)=0;
end
end
end
O1
% if([O1==0 0 0 0 0]||[O1==1 0 0 0 0]||[O1==1 1 0 0 0]||[O1==1 1 1 0 0]||[O1==1 1 1 1 0]||[O1==1 1 1 1 1]) %if(O1==[00000 10000 11000 11100 11110 11111])
% if(strcmp(O1,'00000') strcmp(O1,'10000') strcmp(O1,'11000'))then %%Because the input string could be more than one character, use strcmp rather than == to test for equality. if any(strcmp(O1, { '00000','10000','11000' } ))
[x,fs]=wavread('G:\project\Sound Forge\Sound 2.wav');
wavplay(x,fs);
else
[x,fs]=wavread('G:\project\Sound Forge\Sound 1.wav');
wavplay(x,fs);
end;

回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by