Blogger Widgets

Search This Blog

Thursday, 21 June 2012

VOICE CONTROLLED OBJECT RECOGNITION AND PICKING ROBOT


                     This robot searches the object we told , move towards and pick it.Here Matlab is used for speech processing and Image processing. The color of object is used for identification.I'm using the arrangement inside the CD player for making a simple arm.
Front view of Robotic arrangement

Enlarged view of Robotic Arm arrangement
Block Diagram

                              PIC 16F877A micrcontroller is used for controlling the vehicle. Zigbee transceiver is used for interfacing the vehicle and the Laptop. Zigbee transciever got about 20m with accurate detection.And a wireless camera is used for taking videos from surrounding.RGB pixel values of object is used for identification.So fist we need to adjust the range of RGB pixel values in our program.

                       Here first we talk the object we needed to search using a microphone (here I talk bottle,box etc.. it must have about 10 cm hight.). That speech comes to the Matlab. Next speech processing takes place.For that first we need to create speech samples.It created by the matlab using the following program. it create . wav files

clc
fs = 8000;
Duration = 2;
disp('recording......');
pause(.1);
y = wavrecord(Duration*fs,fs);
disp('finished......');
plot(y);
wavwrite(y,'object1.wav');

Then data base of voice samples is created.After that the following program in matlab is run
clc;
Co_Re = zeros(1,20);
order = 12;
nfft = 512;
Fs = 8000;
y1 = wavread('n.wav');
psd_1 = pyulear(y1,order,nfft,Fs);
%plot(psd_1);
y2 = wavread('1.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
%figure,plot(psd_2);
Co_Re(1) = corr(psd_1,psd_2);

y2 = wavread('2.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(2) = corr(psd_1,psd_2);

y2 = wavread('3.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(3) = corr(psd_1,psd_2);

y2 = wavread('4.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(4) = corr(psd_1,psd_2);

y2 = wavread('5.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(5) = corr(psd_1,psd_2);

y2 = wavread('6.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(6) = corr(psd_1,psd_2);

y2 = wavread('7.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(7) = corr(psd_1,psd_2);

y2 = wavread('8.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(8) = corr(psd_1,psd_2);

y2 = wavread('9.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(9) = corr(psd_1,psd_2);

y2 = wavread('10.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(10) = corr(psd_1,psd_2);

y2 = wavread('11.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
%figure,plot(psd_2);
Co_Re(11) = corr(psd_1,psd_2);

y2 = wavread('12.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(12) = corr(psd_1,psd_2);

y2 = wavread('13.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(13) = corr(psd_1,psd_2);

y2 = wavread('14.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(14) = corr(psd_1,psd_2);

y2 = wavread('15.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(15) = corr(psd_1,psd_2);

y2 = wavread('16.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(16) = corr(psd_1,psd_2);

y2 = wavread('17.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(17) = corr(psd_1,psd_2);

y2 = wavread('18.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(18) = corr(psd_1,psd_2);

y2 = wavread('19.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(19) = corr(psd_1,psd_2);

y2 = wavread('20.wav');
psd_2 = pyulear(y2,order,nfft,Fs);
Co_Re(20) = corr(psd_1,psd_2);
%Co_Re
result = find(Co_Re==max(Co_Re))

main program is given below

clc
bin = zeros(640,480);
flag_red  = 0;
vid=videoinput('winvideo',1,'YUY2_640x480');
s=serial('com4');
set(s, 'BaudRate', 9600, 'StopBits', 1);
set(s, 'Terminator', '', 'Parity', 'none');
set(s, 'FlowControl', 'none');
    %s.timeOut=.01;
fopen(s);
preview(vid)
pause(5);
p = 1;
while(p<=9)
p = p+1    
fwrite(s,'R');
pause(.5);
q=getsnapshot(vid);
a=ycbcr2rgb(q);
%   ........................green.................
for i=1:480
    for j=1:640
       if (a(i,j,1)<=255&&a(i,j,1)>=230)&& (a(i,j,2)<=150&&a(i,j,2)>=80)&&(a(i,j,3)<=190&&a(i,j,3)>=85)
          bin(i,j)=1;
       else bin(i,j)=0; bin(i,j)=0;bin(i,j)=0;
       end
    end
end
 bin=bwareaopen(bin,200);
se=strel('disk',2);
bin=imclose(bin,se);
bin=imfill(bin,'holes');
imshow(bin);
[b,l]=bwboundaries(bin,'noholes');
if(max(l(:)))
  flag_red = 1;
  fwrite(s,'S');    % stop robot
  pause(1);
  fwrite(s,'F');    % move forward
    
while(1)
     if(fread(s,1)=='i')
         disp('ok')
         fwrite(s,'A');    % rotate motor
     break;
     end
end

break;
end
end
if flag_red == 1
disp('found  object1');
flag_object  = 0;
else
disp('no object1 found'); 
fwrite(s,'S');    % stop robit
end
stoppreview(vid);
fclose(s); 
           But the system has some problem in varying back ground and noisy environment.Now I'm trying to develop a better algorithm to overcome this problems
         

No comments:

Post a Comment

Blogger Widgets