-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCS585 HW[2].html
273 lines (256 loc) · 9.89 KB
/
CS585 HW[2].html
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<html>
<head>
<title>
CS585 Homework Template: HW[x] Student Name [xxx]
</title>
<style>
<!--
body {
font-family: 'Trebuchet MS', Verdana;
}
p {
font-family: 'Trebuchet MS', Times;
margin: 10px 10px 15px 20px;
}
h3 {
margin: 5px;
}
h2 {
margin: 10px;
}
h1 {
margin: 10px 0 0 20px;
}
div.main-body {
align: center;
margin: 30px;
}
hr {
margin: 20px 0;
}
table,th,td{
border:1px solid #212121
}
-->
</style>
</head>
<body>
<center>
<a href="http://www.bu.edu"><img border="0" src="http://www.cs.bu.edu/fac/betke/images/bu-logo.gif" width="119" height="120"></a>
</center>
<h1>CS 585 HW 2 Part 2</h1>
<p>
Yiwen Gu
<br>
Mahir Patel
<br>
Navoneel Ghosh
<br>
Sherry Courington
<br>
</p>
<p>
2021.2.17
</p>
<div class="main-body">
<hr>
<h2>
Overall Description
</h2>
<p>
We use computer vision techniques to recognize ASL alphabets in a video stream.
</p>
<hr>
<h2>
Method and Implementation
</h2>
<p>Our process starts with background subtraction to perform motion segmentation. We perform median blur with kernel size 3 to remove isolated white pixels from the background. After that we perform gaussian blur and dilation of image further. Performing this step ensures that the palm which would be invisible due to small movements and background subtraction is now filled. After thresholding that image, we merge it with skin detection algorithm so that other stationary objects detected as skin in the background are removed. The final preprocessing step is finding contours in the image and only keeping the one with the largest area. We assume that the user will keep their hands in front of their body so its area will be larger than their face. Finally, we perform multiscale template matching and display that in our UI.</p>
<hr>
<h2>Experiments</h2>
<p>
We created a confusion matrix from 97 frames of one of the videos of our gesture detection. </p>
<p>
<table>
<tbody>
<tr>
<td colspan="8">
<center>
<h3>Confusion Matrix</h3>
</center>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> Truth </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> "L" </td>
<td> "U" </td>
<td> "C" </td>
<td> "K" </td>
<td> Prediction Sum </td>
<td> Precision </td>
</tr>
<tr>
<td> </td>
<td> "L" </td>
<td> 14 </td>
<td> 0 </td>
<td> 0 </td>
<td> 0 </td>
<td> 14 </td>
<td> 100% </td>
</tr>
<tr>
<td> Prediction </td>
<td> "U" </td>
<td> 0 </td>
<td> 23 </td>
<td> 0 </td>
<td> 10 </td>
<td> 33 </td>
<td> 69.69% </td>
</tr>
<tr>
<td> </td>
<td> "C" </td>
<td> 3 </td>
<td> 6 </td>
<td> 21 </td>
<td> 6 </td>
<td> 36 </td>
<td> 58.33% </td>
</tr>
<tr>
<td> </td>
<td> "K" </td>
<td> 0 </td>
<td> 0 </td>
<td> 0 </td>
<td> 14 </td>
<td> 14 </td>
<td> 100% </td>
</tr>
<tr>
<td> </td>
<td> Truth Sum </td>
<td> 17 </td>
<td> 29 </td>
<td> 21 </td>
<td> 30 </td>
<td> 97 </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> Recall </td>
<td> 82.35% </td>
<td> 79.31% </td>
<td> 100% </td>
<td> 46.67% </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</p>
<br>
<p>
Accuracy = 74.23%
</p>
<hr>
<h2>Results</h2>
<p>
The figure below shows the matching results for the 4 templates, i.e. 'L', 'U', 'C', 'K', as well as two failed cases. Each panel is composed by three images. The left (biggest) one is the frame read from webcam with matched letter showed on its top left corner if found. The top right image is the masked input frames that is used for template matching. The bottom right image in each panel is the template if found.
</p>
<table class="tg">
<tbody>
<tr>
<th class="tg-0lax">L</th>
<th class="tg-0lax">U</th>
<th class="tg-0lax">C</th>
<th class="tg-0lax">K</th>
</tr>
<tr>
<td class="tg-0lax"><img src="images/L.png" style="width:90%;height: auto;"></td>
<td class="tg-0lax"><img src="images/U.png" style="width:90%;height: auto;"></td>
<td class="tg-0lax"><img src="images/C.png" style="width:90%;height: auto;"></td>
<td class="tg-0lax"><img src="images/K.png" style="width:90%;height: auto;"></td>
</tr>
<tr>
<th class="tg-0lax">Failed Case 1: face too close</th>
<th class="tg-0lax">Failed Case 2: no template found</th>
</tr>
<tr>
<td class="tg-0lax"><img src="images/failedCase1.png" style="width:90%;height: auto;"></td>
<td class="tg-0lax"><img src="images/failedCase2.png" style="width:90%;height: auto;"></td>
</tr>
</tbody>
</table>
<h4> The below is a video without side panels. </h4>
<p><iframe src="https://drive.google.com/file/d/1ru5tYk0ocVXxh-YlHVeRCf11NirX_Z-B/preview" width="480" height="270"></iframe></p>
<hr>
<h2>
Discussion
</h2>
<p>
<ul>
<strong>Strengths:
</strong>
<li>
Our results show that method we adopted is generally successful. We get an accuracy of 0.74
</li>
<li>
We scaled our input images progressively during the mathching. As a result, the algorithm will recognize a matched shape as long as the hand is view and not too small.</li>
<li>
We implemented multithreading and the we read frames from the webcam in a separate thread. As a result, our videos in the graphic display looks smoother.
</li>
</ul>
<ul>
<strong>Limitations:
</strong>
<li>
Our classifier works in normal lightening but if it is too bright or dark, errors will be introduced.
</li>
<li>
If the hand in the video is too small (smaller than the template resolution), the mathcing won't be detected.
</li>
</ul>
<ul>
<strong>Potential future work:
</strong>
<li>
Calculate the orientaion of the templates and objects detected, so that a certain amount of rotation can be allowed.
</li>
<li>
Include all the 26 alphabets and/or 10 digits to templates for matching so that we can spell anything.
</li>
</ul>
<ul>
<strong>Fun fact:
</strong>
<li>
We intentally chose our templates that says "L", "U", "C", "K". We wish all of you and ourselves good luck in the 2021.</li>
</ul>
</p>
<hr>
<h2>
Credits and Bibliography
</h2>
<p>
For multiple threading:
https://nrsyed.com/2018/07/05/multithreading-with-opencv-python-to-improve-video-processing-performance/ <br>
Opencv-python
https://opencv-python-tutroals.readthedocs.io/en/latest/
</p>
</div>
</body>
</html>