public KinectService() { MainWindow window = MainWindow.instance; engine = window.mainEngine; engine.service = this; engine.clientConnected = true; engine.SetAppStateToReady(); }
private void InitializeSensor(KinectSensor sensor) { if (null == sensor) { return; } // przygotowanie pol, wlasciwosci, itp. pod streaming z kamery sensor.ColorStream.Enable(ImageFormat); this.colorCameraPixels = new byte[sensor.ColorStream.FramePixelDataLength]; this.colorCameraBitmap = new WriteableBitmap(sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); ImKinectVideo.Source = this.colorCameraBitmap; sensor.ColorFrameReady += new EventHandler <ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady); mainEngine = new MainEngine(sensor, TBLog); mainEngine.Start(); }
private void InitializeSensor(KinectSensor sensor) { if (null == sensor) { return; } // przygotowanie pol, wlasciwosci, itp. pod streaming z kamery sensor.ColorStream.Enable(ImageFormat); this.colorCameraPixels = new byte[sensor.ColorStream.FramePixelDataLength]; this.colorCameraBitmap = new WriteableBitmap(sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); ImKinectVideo.Source = this.colorCameraBitmap; sensor.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady); mainEngine = new MainEngine(sensor, TBLog); mainEngine.Start(); }
public void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { // nie ma potrzeby odczytywac szkieletu gdy nie jest on potrzebny aplikacji if (mainEngine.GetAppState() == ApplicationState.Calibration || mainEngine.GetAppState() == ApplicationState.Working) { using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) { if (skeletonFrame != null) { lock (this) { skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength]; skeletonFrame.CopySkeletonDataTo(skeletons); if (skeletons.All(s => s.TrackingState == SkeletonTrackingState.NotTracked)) { return; } Skeleton firstTrackedSkeleton = skeletons.Where(s => s.TrackingState == SkeletonTrackingState.Tracked).FirstOrDefault(); if (firstTrackedSkeleton != null && firstTrackedSkeleton.Joints[JointType.HandRight].TrackingState == JointTrackingState.Tracked) { rightHand = firstTrackedSkeleton.Joints[JointType.HandRight]; rightHandCoord = new Point3D(rightHand.Position.X, rightHand.Position.Y, rightHand.Position.Z); if (mainEngine.GetAppState() == ApplicationState.Working) { MainEngine.MoveCursorTo(mainEngine.GetCalibrator().ScaleKinectPositionToScreen( rightHand.Position.X, rightHand.Position.Y, rightHand.Position.Z)); } //mainEngine.AddTextToLog("SkelControl: hand tracked " + rightHand.Position.X.ToString() // + " " + rightHand.Position.Y.ToString() + " " + rightHand.Position.Z.ToString()); } } } } } }
public ObjectManager(MainEngine engine) { this.mainEngine = engine; }
public SpeechRecognizer(MainEngine me) { mainEngine = me; }
public SkeletonController(MainEngine me) { mainEngine = me; }
public Calibrator(MainEngine me) { mainEngine = me; }