using Microsoft.Kinect; using System; using System.Collections.Generic; //using System.Linq; //using System.Text; //using System.Threading.Tasks; //using System.Windows.Media.Imaging; //using System.Windows.Media; //using System.Windows; //using System.Windows.Shapes; //namespace Lib //{ // class ColorAndBodyImageStream : KinectStream // { // private BodyFrameReader reader; // public BodyFrameReader Reader // { // get { return reader; } // set { reader = value; } // } // private Body[] bodies; // public Body[] Bodies { // get { return bodies; } // private set { bodies = value; } // } // public ColorAndBodyImageStream() : base() // { // var frameDescription = KinectManager.Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra); // this.Bitmap = new WriteableBitmap(frameDescription.Width, frameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null); // reader = KinectManager.Sensor.BodyFrameSource.OpenReader(); // reader.FrameArrived += Reader_BodyFrameArrived; // // Initialiser le tableau des corps // this.bodies = new Body[KinectManager.Sensor.BodyFrameSource.BodyCount]; // } // private void DrawSkeleton(Body body) // { // foreach (JointType jointType in body.Joints.Keys) // { // Joint joint = body.Joints[jointType]; // if (joint.TrackingState == TrackingState.Tracked) // { // // Convertir les coordonnées du joint en coordonnées de l'écran // Point point = new Point(); // ColorSpacePoint colorPoint = KinectManager.Sensor.CoordinateMapper.MapCameraPointToColorSpace(joint.Position); // point.X = float.IsInfinity(colorPoint.X) ? 0 : colorPoint.X; // point.Y = float.IsInfinity(colorPoint.Y) ? 0 : colorPoint.Y; // // Dessiner le joint // DrawJoint(point); // } // } // // Dessinez les os ici si nécessaire // } // private void DrawJoint(Point point) // { // Ellipse ellipse = new Ellipse // { // Width = 10, // Height = 10, // Fill = new SolidColorBrush(Colors.Red) // }; // Canvas.SetLeft(ellipse, point.X - ellipse.Width / 2); // Canvas.SetTop(ellipse, point.Y - ellipse.Height / 2); // skeletonCanvas.Children.Add(ellipse); // } // private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e) // { // using (var bodyFrame = e.FrameReference.AcquireFrame()) // { // if (bodyFrame != null) // { // bodyFrame.GetAndRefreshBodyData(this.bodies); // skeletonCanvas.Children.Clear(); // Nettoyer le canvas avant de dessiner // foreach (var body in this.bodies) // { // if (body.IsTracked) // { // // Dessiner le squelette // DrawSkeleton(body); // } // } // } // } // } // } //}