132 /* |
159 /* |
133 * Récupère le flux video et met à jour le rendu visuel de debug. |
160 * Récupère le flux video et met à jour le rendu visuel de debug. |
134 */ |
161 */ |
135 public void RefreshVideo(AllFramesReadyEventArgs e) |
162 public void RefreshVideo(AllFramesReadyEventArgs e) |
136 { |
163 { |
137 bool receivedData = false; |
164 if (refreshImage) |
138 ColorImageFrame colorImageFrameData; |
165 { |
139 using (colorImageFrameData = e.OpenColorImageFrame()) |
166 bool receivedData = false; |
140 { |
167 ColorImageFrame colorImageFrameData; |
141 //Si on ne reçoit pas de trames de la kinect. |
168 using (colorImageFrameData = e.OpenColorImageFrame()) |
142 if (colorImageFrameData == null) |
|
143 { |
169 { |
144 //L'image est supprimée. |
170 //Si on ne reçoit pas de trames de la kinect. |
145 DebugImage.Source = null; |
171 if (colorImageFrameData == null) |
|
172 { |
|
173 //L'image est supprimée. |
|
174 DebugImage.Source = null; |
|
175 } |
|
176 //Si le tableau stockant l'image en cours est nul. |
|
177 if (colorPixelData == null) |
|
178 //On alloue un nouveau tableau. |
|
179 colorPixelData = new byte[colorImageFrameData.PixelDataLength]; |
|
180 else |
|
181 { |
|
182 try |
|
183 { |
|
184 //Sinon on met à jour le tableau en copiant le contenu de la trame dans le tableau. |
|
185 colorImageFrameData.CopyPixelDataTo(colorPixelData); |
|
186 receivedData = true; |
|
187 } |
|
188 catch (Exception) { } |
|
189 } |
146 } |
190 } |
147 //Si le tableau stockant l'image en cours est nul. |
191 //Si on a des données dans le tableau et que la kinect est allumée. |
148 if (colorPixelData == null) |
192 if (receivedData && on) |
149 //On alloue un nouveau tableau. |
|
150 colorPixelData = new byte[colorImageFrameData.PixelDataLength]; |
|
151 else |
|
152 { |
193 { |
153 try |
194 //On met à jour l'image de la caméra. |
154 { |
195 DebugImage.Source = BitmapSource.Create(colorImageFrameData.Width, colorImageFrameData.Height, 96, 96, PixelFormats.Bgr32, null, colorPixelData, colorImageFrameData.Width * colorImageFrameData.BytesPerPixel); |
155 //Sinon on met à jour le tableau en copiant le contenu de la trame dans le tableau. |
196 DebugImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; |
156 colorImageFrameData.CopyPixelDataTo(colorPixelData); |
197 DebugImage.VerticalAlignment = System.Windows.VerticalAlignment.Center; |
157 receivedData = true; |
198 DebugImage.Stretch = Stretch.Fill; |
158 } |
199 //On annule l'image associée aux gestures. |
159 catch (Exception){} |
200 Gestures.Source = null; |
160 } |
201 } |
161 } |
|
162 //Si on a des données dans le tableau et que la kinect est allumée. |
|
163 if (receivedData && on) |
|
164 { |
|
165 //Exemples de modifications de l'affichage : |
|
166 //Zombies apocalypse. |
|
167 //Black & White movie. |
|
168 /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel) |
|
169 { |
|
170 byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]); |
|
171 gray = Math.Min(gray, colorPixelData[i + 2]); |
|
172 colorPixelData[i] = gray; |
|
173 colorPixelData[i + 1] = gray; |
|
174 |
|
175 colorPixelData[i] = colorPixelData[i + 1]; |
|
176 colorPixelData[i + 1] = colorPixelData[i]; |
|
177 colorPixelData[i + 2] = (byte)~colorPixelData[i + 2]; |
|
178 }*/ |
|
179 |
|
180 //On met à jour l'image de la caméra. |
|
181 DebugImage.Source = BitmapSource.Create(colorImageFrameData.Width, colorImageFrameData.Height, 96, 96, PixelFormats.Bgr32, null, colorPixelData, colorImageFrameData.Width * colorImageFrameData.BytesPerPixel); |
|
182 DebugImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; |
|
183 DebugImage.VerticalAlignment = System.Windows.VerticalAlignment.Center; |
|
184 DebugImage.Stretch = Stretch.Fill; |
|
185 } |
202 } |
186 } |
203 } |
187 |
204 |
188 /* |
205 /* |
189 * Affiche la distance de l'utilisateur dans le rendu visuel. |
206 * Affiche la distance de l'utilisateur dans le rendu visuel. |
190 * Sous forme de nombre en m et de rectangles changeant de couleur en fonction de la distance. |
207 * Sous forme de nombre en m et de rectangles changeant de couleur en fonction de la distance. |
191 */ |
208 */ |
192 public void showDistance(float distance) |
209 public void showDistance(float proximity) |
193 { |
210 { |
194 DistanceLbl.Content = "Distance : " + distance; |
211 DistanceLbl.Content = "Proximity : " + proximity + "%"; |
195 |
212 |
196 if (distance > 0 && distance < 1) |
213 if (proximity == 0) |
197 { |
214 { |
198 R1.Fill = System.Windows.Media.Brushes.Red; |
215 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
199 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
216 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
200 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
217 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
201 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
218 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
202 } |
219 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
203 else if (distance > 1 && distance < 2) |
220 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
204 { |
221 R6.Fill = System.Windows.Media.Brushes.DarkGray; |
205 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
222 R7.Fill = System.Windows.Media.Brushes.DarkGray; |
206 R2.Fill = System.Windows.Media.Brushes.Orange; |
223 R8.Fill = System.Windows.Media.Brushes.DarkGray; |
207 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
224 R9.Fill = System.Windows.Media.Brushes.DarkGray; |
208 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
225 R10.Fill = System.Windows.Media.Brushes.DarkGray; |
209 } |
226 } |
210 else if (distance > 2 && distance < 3) |
227 else if (proximity > 0 && proximity < 10) |
211 { |
228 { |
|
229 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
230 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
231 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
232 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
233 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
234 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
235 R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
236 R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
237 R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
238 R9.Fill = System.Windows.Media.Brushes.DarkGray; |
|
239 R10.Fill = System.Windows.Media.Brushes.Red; |
|
240 } |
|
241 else if (proximity > 10 && proximity < 20) |
|
242 { |
|
243 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
244 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
245 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
246 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
247 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
248 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
249 R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
250 R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
251 R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
252 R9.Fill = System.Windows.Media.Brushes.Red; |
|
253 R10.Fill = System.Windows.Media.Brushes.Red; |
|
254 } |
|
255 else if (proximity > 20 && proximity < 30) |
|
256 { |
|
257 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
258 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
259 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
260 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
261 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
262 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
263 R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
264 R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
265 R8.Fill = System.Windows.Media.Brushes.Red; |
|
266 R9.Fill = System.Windows.Media.Brushes.Red; |
|
267 R10.Fill = System.Windows.Media.Brushes.Red; |
|
268 } |
|
269 else if (proximity > 30 && proximity < 40) |
|
270 { |
|
271 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
272 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
273 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
274 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
275 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
276 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
277 R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
278 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
279 R8.Fill = System.Windows.Media.Brushes.Red; |
|
280 R9.Fill = System.Windows.Media.Brushes.Red; |
|
281 R10.Fill = System.Windows.Media.Brushes.Red; |
|
282 } |
|
283 else if (proximity > 40 && proximity < 50) |
|
284 { |
|
285 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
286 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
287 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
288 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
289 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
290 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
291 R6.Fill = System.Windows.Media.Brushes.Orange; |
|
292 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
293 R8.Fill = System.Windows.Media.Brushes.Red; |
|
294 R9.Fill = System.Windows.Media.Brushes.Red; |
|
295 R10.Fill = System.Windows.Media.Brushes.Red; |
|
296 } |
|
297 else if (proximity > 50 && proximity < 60) |
|
298 { |
|
299 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
300 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
301 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
302 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
303 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
304 R5.Fill = System.Windows.Media.Brushes.Orange; |
|
305 R6.Fill = System.Windows.Media.Brushes.Orange; |
|
306 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
307 R8.Fill = System.Windows.Media.Brushes.Red; |
|
308 R9.Fill = System.Windows.Media.Brushes.Red; |
|
309 R10.Fill = System.Windows.Media.Brushes.Red; |
|
310 } |
|
311 else if (proximity > 60 && proximity < 70) |
|
312 { |
|
313 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
314 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
315 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
316 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
317 R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
318 R5.Fill = System.Windows.Media.Brushes.Orange; |
|
319 R6.Fill = System.Windows.Media.Brushes.Orange; |
|
320 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
321 R8.Fill = System.Windows.Media.Brushes.Red; |
|
322 R9.Fill = System.Windows.Media.Brushes.Red; |
|
323 R10.Fill = System.Windows.Media.Brushes.Red; |
|
324 } |
|
325 else if (proximity > 70 && proximity < 80) |
|
326 { |
|
327 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
212 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
328 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
213 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
329 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
214 R3.Fill = System.Windows.Media.Brushes.Yellow; |
330 R3.Fill = System.Windows.Media.Brushes.Yellow; |
215 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
331 R4.Fill = System.Windows.Media.Brushes.Yellow; |
216 } |
332 R5.Fill = System.Windows.Media.Brushes.Orange; |
217 else if (distance > 3 && distance < 4) |
333 R6.Fill = System.Windows.Media.Brushes.Orange; |
218 { |
334 R7.Fill = System.Windows.Media.Brushes.Orange; |
219 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
335 R8.Fill = System.Windows.Media.Brushes.Red; |
220 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
336 R9.Fill = System.Windows.Media.Brushes.Red; |
221 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
337 R10.Fill = System.Windows.Media.Brushes.Red; |
222 R4.Fill = System.Windows.Media.Brushes.White; |
338 } |
223 } |
339 else if (proximity > 80 && proximity < 90) |
224 } |
340 { |
225 |
341 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
226 public void showProximity(UserPositionEventArgs e) |
342 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
227 { |
343 R2.Fill = System.Windows.Media.Brushes.Yellow; |
228 |
344 R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
345 R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
346 R5.Fill = System.Windows.Media.Brushes.Orange; |
|
347 R6.Fill = System.Windows.Media.Brushes.Orange; |
|
348 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
349 R8.Fill = System.Windows.Media.Brushes.Red; |
|
350 R9.Fill = System.Windows.Media.Brushes.Red; |
|
351 R10.Fill = System.Windows.Media.Brushes.Red; |
|
352 } |
|
353 else if (proximity > 90 && proximity < 100) |
|
354 { |
|
355 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
356 R1.Fill = System.Windows.Media.Brushes.Yellow; |
|
357 R2.Fill = System.Windows.Media.Brushes.Yellow; |
|
358 R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
359 R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
360 R5.Fill = System.Windows.Media.Brushes.Orange; |
|
361 R6.Fill = System.Windows.Media.Brushes.Orange; |
|
362 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
363 R8.Fill = System.Windows.Media.Brushes.Red; |
|
364 R9.Fill = System.Windows.Media.Brushes.Red; |
|
365 R10.Fill = System.Windows.Media.Brushes.Red; |
|
366 } |
|
367 else if (proximity == 100) |
|
368 { |
|
369 R0.Fill = System.Windows.Media.Brushes.Green; |
|
370 R1.Fill = System.Windows.Media.Brushes.Yellow; |
|
371 R2.Fill = System.Windows.Media.Brushes.Yellow; |
|
372 R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
373 R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
374 R5.Fill = System.Windows.Media.Brushes.Orange; |
|
375 R6.Fill = System.Windows.Media.Brushes.Orange; |
|
376 R7.Fill = System.Windows.Media.Brushes.Orange; |
|
377 R8.Fill = System.Windows.Media.Brushes.Red; |
|
378 R9.Fill = System.Windows.Media.Brushes.Red; |
|
379 R10.Fill = System.Windows.Media.Brushes.Red; |
|
380 } |
229 } |
381 } |
230 |
382 |
231 /* |
383 /* |
232 * Affiche la détection de la main droite via un label. |
384 * Affiche la détection de la main droite via un label. |
233 */ |
385 */ |
253 /* |
405 /* |
254 * Dessine les noeuds du squelette dans le rendu visuel. |
406 * Dessine les noeuds du squelette dans le rendu visuel. |
255 */ |
407 */ |
256 public void drawJoints(JointCollection joints, Skeleton first) |
408 public void drawJoints(JointCollection joints, Skeleton first) |
257 { |
409 { |
258 //On enlève tout élément du Canvas à part l'image, de manière à mettre à jour la position du squelette. |
410 if (refreshImage) |
259 DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
411 { |
260 |
412 //On enlève tout élément du Canvas à part l'image, de manière à mettre à jour la position du squelette. |
261 //Pour chaque noeud. |
413 DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
262 foreach (Joint joint in first.Joints) |
414 |
263 { |
415 //Pour chaque noeud. |
264 //On crée une ellipse de taille 20 et de largeur 20. |
416 foreach (Joint joint in first.Joints) |
265 Ellipse node = new Ellipse(); |
417 { |
266 node.Height = 20; |
418 //On crée une ellipse de taille 20 et de largeur 20. |
267 node.Width = 20; |
419 Ellipse node = new Ellipse(); |
268 |
420 node.Height = 20; |
269 //S'il s'agit d'un noeud de tête, on le colorie en rouge, sinon en bleu. |
421 node.Width = 20; |
270 if (joint.JointType == JointType.Head) |
422 |
271 node.Fill = System.Windows.Media.Brushes.Red; |
423 //S'il s'agit d'un noeud de tête, on le colorie en rouge, sinon en bleu. |
272 else if(joint.JointType == JointType.ShoulderCenter) |
424 if (joint.JointType == JointType.Head) |
273 node.Fill = System.Windows.Media.Brushes.Green; |
425 node.Fill = System.Windows.Media.Brushes.Red; |
274 else if(joint.JointType == JointType.HipCenter) |
426 else if (joint.JointType == JointType.ShoulderCenter) |
275 node.Fill = System.Windows.Media.Brushes.Green; |
427 node.Fill = System.Windows.Media.Brushes.Green; |
276 else if (joint.JointType == JointType.HandRight) |
428 else if (joint.JointType == JointType.HipCenter) |
277 node.Fill = System.Windows.Media.Brushes.Red; |
429 node.Fill = System.Windows.Media.Brushes.Green; |
278 else |
430 else if (joint.JointType == JointType.HandRight) |
279 node.Fill = System.Windows.Media.Brushes.Blue; |
431 node.Fill = System.Windows.Media.Brushes.Red; |
280 |
432 else |
281 //On met à la bonne échelle les coordonnées des positions des noeuds. |
433 node.Fill = System.Windows.Media.Brushes.Blue; |
282 Joint scaledJoint = Coding4Fun.Kinect.Wpf.SkeletalExtensions.ScaleTo(joint, 600, 400, 0.75f, 0.75f); |
434 |
283 |
435 //On met à la bonne échelle les coordonnées des positions des noeuds. |
284 //On positionne le noeud dans le Canvas, et on l'ajoute. |
436 Joint scaledJoint = Coding4Fun.Kinect.Wpf.SkeletalExtensions.ScaleTo(joint, 600, 400, 0.75f, 0.75f); |
285 Canvas.SetLeft(node, scaledJoint.Position.X); |
437 |
286 Canvas.SetTop(node, scaledJoint.Position.Y); |
438 //On positionne le noeud dans le Canvas, et on l'ajoute. |
287 DebugCanvas.Children.Add(node); |
439 Canvas.SetLeft(node, scaledJoint.Position.X); |
|
440 Canvas.SetTop(node, scaledJoint.Position.Y); |
|
441 DebugCanvas.Children.Add(node); |
|
442 } |
288 } |
443 } |
289 } |
444 } |
290 |
445 |
291 /* |
446 /* |
292 * Dessine un os, en ayant en paramètres deux noeuds. |
447 * Dessine un os, en ayant en paramètres deux noeuds. |
300 line.X2 = j2.Position.X; |
455 line.X2 = j2.Position.X; |
301 line.Y1 = j1.Position.Y; |
456 line.Y1 = j1.Position.Y; |
302 line.Y2 = j2.Position.Y; |
457 line.Y2 = j2.Position.Y; |
303 line.StrokeThickness = 8; |
458 line.StrokeThickness = 8; |
304 DebugCanvas.Children.Add(line); |
459 DebugCanvas.Children.Add(line); |
305 ExceptionLbl.Content = DebugCanvas.Children.Count; |
|
306 } |
460 } |
307 |
461 |
308 /* |
462 /* |
309 * Dessine le squelette (ensemble des os), en ayant en paramètres tous les noeuds. |
463 * Dessine le squelette (ensemble des os), en ayant en paramètres tous les noeuds. |
310 */ |
464 */ |
311 public void showSkeleton(Joint hipCenter, Joint spine, Joint shoulderCenter, Joint head, Joint shoulderLeft, Joint elbowLeft, Joint wristLeft, Joint handLeft, Joint shoulderRight, Joint elbowRight, Joint wristRight, Joint handRight, Joint hipLeft, Joint kneeLeft, Joint ankleLeft, Joint footLeft, Joint hipRight, Joint kneeRight, Joint ankleRight, Joint footRight) |
465 public void showSkeleton(Joint hipCenter, Joint spine, Joint shoulderCenter, Joint head, Joint shoulderLeft, Joint elbowLeft, Joint wristLeft, Joint handLeft, Joint shoulderRight, Joint elbowRight, Joint wristRight, Joint handRight, Joint hipLeft, Joint kneeLeft, Joint ankleLeft, Joint footLeft, Joint hipRight, Joint kneeRight, Joint ankleRight, Joint footRight) |
312 { |
466 { |
313 //On met les noeuds deux par deux en fonction de leur position dans le squelette. |
467 if (refreshImage) |
314 drawBone(head, shoulderCenter); |
468 { |
315 drawBone(shoulderCenter, shoulderLeft); |
469 //On met les noeuds deux par deux en fonction de leur position dans le squelette. |
316 drawBone(shoulderLeft, elbowLeft); |
470 drawBone(head, shoulderCenter); |
317 drawBone(elbowLeft, wristLeft); |
471 drawBone(shoulderCenter, shoulderLeft); |
318 drawBone(wristLeft, handLeft); |
472 drawBone(shoulderLeft, elbowLeft); |
319 drawBone(shoulderCenter, shoulderRight); |
473 drawBone(elbowLeft, wristLeft); |
320 drawBone(shoulderRight, elbowRight); |
474 drawBone(wristLeft, handLeft); |
321 drawBone(elbowRight, wristRight); |
475 drawBone(shoulderCenter, shoulderRight); |
322 drawBone(wristRight, handRight); |
476 drawBone(shoulderRight, elbowRight); |
323 drawBone(shoulderCenter, spine); |
477 drawBone(elbowRight, wristRight); |
324 drawBone(spine, hipCenter); |
478 drawBone(wristRight, handRight); |
325 drawBone(hipCenter, hipLeft); |
479 drawBone(shoulderCenter, spine); |
326 drawBone(hipLeft, kneeLeft); |
480 drawBone(spine, hipCenter); |
327 drawBone(kneeLeft, ankleLeft); |
481 drawBone(hipCenter, hipLeft); |
328 drawBone(ankleLeft, footLeft); |
482 drawBone(hipLeft, kneeLeft); |
329 drawBone(hipCenter, hipRight); |
483 drawBone(kneeLeft, ankleLeft); |
330 drawBone(hipRight, kneeRight); |
484 drawBone(ankleLeft, footLeft); |
331 drawBone(kneeRight, ankleRight); |
485 drawBone(hipCenter, hipRight); |
332 drawBone(ankleRight, footRight); |
486 drawBone(hipRight, kneeRight); |
333 } |
487 drawBone(kneeRight, ankleRight); |
334 |
488 drawBone(ankleRight, footRight); |
|
489 } |
|
490 } |
|
491 |
|
492 /* |
|
493 * Cache le squelette et le reste de l'interface à part l'image. |
|
494 */ |
335 public void hideSkeleton() |
495 public void hideSkeleton() |
336 { |
496 { |
|
497 //On vide le canvas mais en gardant l'image. |
337 if(DebugCanvas.Children.Count > 1) |
498 if(DebugCanvas.Children.Count > 1) |
338 DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
499 DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
|
500 //On colore en gris tous les indicateurs. |
|
501 R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
502 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
503 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
504 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
505 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
506 R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
507 R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
508 R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
509 R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
510 R9.Fill = System.Windows.Media.Brushes.DarkGray; |
|
511 R10.Fill = System.Windows.Media.Brushes.DarkGray; |
|
512 LeftHand.Background = System.Windows.Media.Brushes.DarkGray; |
|
513 RightHand.Background = System.Windows.Media.Brushes.DarkGray; |
339 } |
514 } |
340 |
515 |
341 /* |
516 /* |
342 * Affiche la position de la main gauche dans le rendu visuel. |
517 * Affiche la position de la main gauche dans le rendu visuel. |
343 */ |
518 */ |