private Point GetDisplayPosition(Joint joint) { float depthX, depthY; KinectHandler.Get().GetDepthCoordsFromSkeleton(joint.Position, out depthX, out depthY); depthX = depthX * 320; //convert to 320, 240 space depthY = depthY * 240; //convert to 320, 240 space int colorX, colorY; KinectHandler.Get().GetVideoCoordsFromDepth(ImageResolution.Resolution640x480, (int)depthX, (int)depthY, out colorX, out colorY); // map back to skeleton.Width & skeleton.Height return(new Point((int)(skeletonCanvas.Width * colorX / 640.0), (int)(skeletonCanvas.Height * colorY / 480))); }
public NewSignRecord(Sign s, List <Sequence> examples) { this.InitializeComponent(); this.Cursor = Cursors.None; #if KINECT KinectHandler.Get().AddVideoListener(NUIVideoFrameReady); skeletonDrawer = new SkeletonDrawer(SkeletonImage); skeletonDrawer.StartDrawing(); CursorController.Get().StartListening(); #endif this.s = s; this.examples = examples; this.currentCount = -1; lblTrainExampleNum.Content = "Number of Training Examples: " + examples.Count; }
/// <summary> /// Record a sequence, wait until silence is observed (user stands still) then /// output the extracted features to OnFinishedHandler /// </summary> /// <param name="onFinishedHandler">The function to call with the output as a parameter</param> /// <param name="onLowEntropyHandler">The function to call when partial silence is observed</param> /// <param name="onHighEntropyHandler">The function to call when the user is moving</param> public void RecordSequence(Action <Sequence> onFinishedHandler, Action <int> onLowEntropyHandler, Action onHighEntropyHandler) { // Start Recording frameHistory.Clear(); frames.Clear(); lowEntropyFrameCount = 0; onRecordingFinishedEventHandler = onFinishedHandler; onLowEntropyEventHandler = onLowEntropyHandler; onHighEntropyEventHandler = onHighEntropyHandler; KinectHandler.Get().SkeletonReady += SkeletonFrameReady; KinectHandler.Get().AddDepthListener(DepthReady); KinectHandler.Get().AddVideoListener(VideoReady); recordVideo = false; }
/// <summary> /// Stop recording the sequence /// </summary> public void CancelRecording() { KinectHandler.Get().SkeletonReady -= SkeletonFrameReady; KinectHandler.Get().RemoveDepthListener(DepthReady); KinectHandler.Get().RemoveVideoListener(VideoReady); }
/// <summary> /// Stop the drawing of the skeleton /// </summary> public void StopDrawing() { KinectHandler.Get().SkeletonDataReady -= DrawSkeleton; }