public MainWindow() { InitializeComponent(); this.IsSave = false; this.IsCalib = false; this.kinect = KinectSensor.GetDefault(); this.MaxofJoints = (byte)24; this.Dimension = (byte)7; //colorImage #region this.colorImageFormat = ColorImageFormat.Bgra; this.colorFrameDescription = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat); this.colorFrameReader = this.kinect.ColorFrameSource.OpenReader(); this.colorFrameReader.FrameArrived += ColorFrame_Arrived; this.colors = new byte[this.colorFrameDescription.Width * this.colorFrameDescription.Height * this.colorFrameDescription.BytesPerPixel]; this.imageWidth = this.colorFrameDescription.Width; this.imageHeigt = this.colorFrameDescription.Height; this.colorImg = new WriteableBitmap(this.colorFrameDescription.Width, this.colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null); this.calibImg = new WriteableBitmap(this.colorFrameDescription.Width, this.colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null); this.bitmapRect = new Int32Rect(0, 0, this.colorFrameDescription.Width, this.colorFrameDescription.Height); this.bitmapStride = this.colorFrameDescription.Width * (int)this.colorFrameDescription.BytesPerPixel; this.colorImage.Source = this.colorImg; this.calibrationImage.Source = this.calibImg; #endregion //骨格情報 #region this.bodyFrameReader = this.kinect.BodyFrameSource.OpenReader(); this.bodyFrameReader.FrameArrived += BodyFrame_Arrived; #endregion //震度情報 #region this.depthFrameReader = this.kinect.DepthFrameSource.OpenReader(); this.depthFrameReader.FrameArrived += DepthFrame_Arrived; this.depthFrameDescription = this.kinect.DepthFrameSource.FrameDescription; this.depthBuffer = new ushort[this.depthFrameDescription.LengthInPixels]; this.depthImageWidth = this.depthFrameDescription.Width; this.depthImageHeight = this.depthFrameDescription.Height; #endregion this.calib = new Calibration(); this.calibMode = Calibration._calibMode.zero; this.preIP = "127.0.0.1"; this.preCLientPort = 54000; this.preServerPort = 50000; this.Closed += MainWindow_Closed; //System.Threading.Timer timer = new System.Threading.Timer(new System.Threading.TimerCallback(this.Callback)); //timer.Change(0, 1000); }