-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASLvid.m
71 lines (60 loc) · 2.18 KB
/
ASLvid.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
clc;
clear all;
close all;
%% Add training and test directories to path
addpath('./data');
% addpath('./data1');
zin=input('how many worDs you wish to speak: ');
for i=1:zin
%% Input Image
vid=videoinput('winvideo',1,'YUY2_640x480');
preview(vid);
pause(10);
img1 = getsnapshot(vid);
img1 = ycbcr2rgb(img1);
closepreview(vid)
%img1 = imread('B3.bmp');
%% Define variables
cAlpha = [{'A'},{'B'},{'C'},{'D'},{'E'},{'F'},{'G'},{'H'},{'I'},{'K'},{'L'},{'M'},{'N'},{'O'},{'P'},{'Q'},{'R'},{'S'},{'T'},{'U'},{'V'},{'W'},{'X'},{'Y'},{'ONE'},{'TWO'},{'THREE'},{'FOUR'},{'FIVE'},{'SIX'},{'SEVEN'},{'EIGHT'},{'NINE'},{'meet'},{'CLOSE'},{'MORE'},{'YOU'},{('OPEN')},{('BREAK')},{('GAMES')},{('WORK')},{('DOCTER')}];%No of alphabet used for data
% cAlpha =
% [{'A'},{'B'},{'C'},{'D'},{'G'},{'H'},{'O'},{'U'},{'V'},{'W'},{'Y'}];%No of alphabet used for data1
nTrainingSamples = 4;%No of training Images we are using.
nRows = 100;%No of rows for the images
nColumns = 100;%No of columns for the images
ImgMat = zeros(size(cAlpha,2),nTrainingSamples);%Initialize image matrix
%% Perform preprocessing of images and compare them
ll = 1;
l2 = 1;
for ii = 1:size(cAlpha,2)
for jj = 1:nTrainingSamples
sFilename = strcat(cAlpha(ii),int2str(jj),'.bmp');%Form filename
ColorImg = imread(char(sFilename));%RGB 24 bit image
[FinalImg prob] = preprocessing(img1,ColorImg,nRows,nColumns);%Find skin thresholded regions
ImgMat(l2,ll) = prob;%Store image as column matrix in ImgMat
ll = ll + 1;%Move on to next column
end
Imgmean(l2,1) = mean(ImgMat(l2,:));
ll = 1;
l2 = l2+1;
end
ImgMat;
Imgmean
[m n] = max(ImgMat);
[max count] = max(Imgmean);
ind_max = n(1);
ave_max=count
ImgMat=zeros(l2-1,ll-1);
%% Display Input and Matched Output
f = figure();
set(gca, 'fontsize', 10);
set(f,'name','Output')
subplot (1,3,1)
imshow(img1);
title('Input image','fontsize', 10)
subplot (1,3,3)
RecongImg = strcat(cAlpha(ave_max),'1.bmp');
imshow(char(RecongImg));
title(strcat('Recognise gesture is ,',cAlpha(ave_max)),'fontsize', 10);
spech = strcat('Recognise gesture is ',cAlpha(ave_max));
tts(spech);
end