当前位置: 首页>>代码示例>>C#>>正文


C# Joint.ScaleTo方法代码示例

本文整理汇总了C#中Microsoft.Kinect.Joint.ScaleTo方法的典型用法代码示例。如果您正苦于以下问题:C# Joint.ScaleTo方法的具体用法?C# Joint.ScaleTo怎么用?C# Joint.ScaleTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Kinect.Joint的用法示例。


在下文中一共展示了Joint.ScaleTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetPosition

        public void SetPosition(Joint joint)
        {
            Joint scaledJoint = joint.ScaleTo(1270 - 88, 750 - 38, 0.5f, 0.5f);

            Canvas.SetLeft(this, scaledJoint.Position.X);
            Canvas.SetTop(this, scaledJoint.Position.Y);
        }
开发者ID:papannetier,项目名称:Projet_Kinect_City_Map,代码行数:7,代码来源:HandCursor.xaml.cs

示例2: SetEllipsePosition

        static private void SetEllipsePosition(Ellipse ellipse, Joint joint)
        {
            var scaledJoint = joint.ScaleTo(1500, 900, k_xMaxJointScale, k_yMaxJointScale);

            Canvas.SetLeft(ellipse, scaledJoint.Position.X - (double)ellipse.GetValue(Canvas.WidthProperty) / 2);
            Canvas.SetTop(ellipse, scaledJoint.Position.Y - (double)ellipse.GetValue(Canvas.WidthProperty) / 2);
            Canvas.SetZIndex(ellipse, (int)Math.Floor(scaledJoint.Position.Z * 100));
            /*if (joint.ID == JointID.HandLeft || joint.ID == JointID.HandRight)
            {
                byte val = (byte)(Math.Floor((joint.Position.Z - 0.8) * 255 / 2));
                ellipse.Fill = new SolidColorBrush(System.Windows.Media.Color.FromRgb(val, val, val));
            }*/
        }
开发者ID:cattron313,项目名称:CS194W,代码行数:13,代码来源:Page8.xaml.cs

示例3: DrawPoint

        public static void DrawPoint(this Canvas canvas, Joint joint)
        {
            if (joint.TrackingState == TrackingState.NotTracked) return;

            joint = joint.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);

            Ellipse ellipse = new Ellipse
            {
                Width = 20,
                Height = 20,
                Fill = new SolidColorBrush(Colors.LightBlue)
            };

            Canvas.SetLeft(ellipse, joint.Position.X - ellipse.Width / 2);
            Canvas.SetTop(ellipse, joint.Position.Y - ellipse.Height / 2);

            canvas.Children.Add(ellipse);
        }
开发者ID:Pacummings,项目名称:KinectStreams,代码行数:18,代码来源:Extensions.cs

示例4: DrawPoint

        /// <summary>
        /// Draws an ellipse to the specified joint.
        /// </summary>
        /// <param name="canvas">The Canvas element to draw the ellipse.</param>
        /// <param name="joint">The joint represented by the ellipse.</param>
        /// <param name="color">The desired color for the ellipse.</param>
        /// <param name="radius">The desired length for the ellipse.</param>
        public static void DrawPoint(this Canvas canvas, Joint joint, Color color, double radius)
        {
            if (joint.TrackingState == JointTrackingState.NotTracked) return;

            joint = joint.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);

            Ellipse ellipse = new Ellipse
            {
                Tag = TAG,
                Width = radius,
                Height = radius,
                Fill = new SolidColorBrush(color)
            };

            Canvas.SetLeft(ellipse, joint.Position.X - ellipse.Width / 2);
            Canvas.SetTop(ellipse, joint.Position.Y - ellipse.Height / 2);

            canvas.Children.Add(ellipse);
        }
开发者ID:etrigger,项目名称:Vitruvius,代码行数:26,代码来源:CanvasExtensions.cs

示例5: DrawLine

        public static void DrawLine(this Canvas canvas, Joint first, Joint second)
        {
            if (first.TrackingState == TrackingState.NotTracked || second.TrackingState == TrackingState.NotTracked) return;

            first = first.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
            second = second.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);

            Line line = new Line
            {
                X1 = first.Position.X,
                Y1 = first.Position.Y,
                X2 = second.Position.X,
                Y2 = second.Position.Y,
                StrokeThickness = 8,
                Stroke = new SolidColorBrush(Colors.LightBlue)
            };

            canvas.Children.Add(line);
        }
开发者ID:Pacummings,项目名称:KinectStreams,代码行数:19,代码来源:Extensions.cs

示例6: JointLocation

        private JPoint JointLocation(Joint joint)
        {
            JPoint tmp;
            var scaledJoint = joint.ScaleTo(CanvasWidth, CanvasHeight /*, .3f, .3f*/);

            tmp.X = scaledJoint.Position.X;
            tmp.Y = CanvasWidth - scaledJoint.Position.Y;

            return tmp;
        }
开发者ID:xtephan,项目名称:Kinect-YMCA-detector,代码行数:10,代码来源:MainWindow.xaml.cs

示例7: ScalePosition

        private void ScalePosition(FrameworkElement element, Joint joint)
        {
            //convert the value to X/Y
            //Joint scaledJoint = joint.ScaleTo(1280, 720);

            //convert & scale (.3 = means 1/3 of joint distance)
            Joint scaledJoint = joint.ScaleTo(1366, 768, RHSensitivity[0], RHSensitivity[1]);
            Canvas.SetLeft(element, scaledJoint.Position.X-element.Width/2 + CursorDisplacement[0]);
            Canvas.SetTop(element, scaledJoint.Position.Y-element.Height/2 + CursorDisplacement[1]);
            textBox.RightPos = (int)scaledJoint.Position.X + " " + (int)scaledJoint.Position.Y + "\n";
            RHPos[0] = scaledJoint.Position.X;
            RHPos[1] = scaledJoint.Position.Y;
        }
开发者ID:kjlam,项目名称:Ginwoo2,代码行数:13,代码来源:KinectFunctions.cs

示例8: ScalePosition

        private void ScalePosition(FrameworkElement element, Joint joint)
        {
            //convert the value to X/Y
            //Joint scaledJoint = joint.ScaleTo(1280, 720);

            //convert & scale (.3 = means 1/3 of joint distance)
            Joint scaledJoint = joint.ScaleTo(1280, 720, .3f, .3f);

            Canvas.SetLeft(element, scaledJoint.Position.X);
            Canvas.SetTop(element, scaledJoint.Position.Y);
        }
开发者ID:samgooi4189,项目名称:Meme_Skeletal_Detection,代码行数:11,代码来源:MainWindow.xaml.cs

示例9: scaleCanvas

 // Faire correspondre les gestes aux canvas
 //
 public static Joint scaleCanvas(Joint joint)
 {
     return joint.ScaleTo(610, 523);
 }
开发者ID:FabienInspiron,项目名称:ProjetDevintInspiron,代码行数:6,代码来源:PositionRecognition.cs

示例10: setCursorPosition

        public void setCursorPosition(HandCursor hand, Joint joint)
        {
            Global.canGesture = false;
            Joint scaledJoint = joint.ScaleTo((int)Global.windowWidth, (int)Global.windowHeight, (float)0.3, (float)0.4);
            if ((scaledJoint.Position.X > radialX + 100 || scaledJoint.Position.X < radialX - 100) &&
                (Math.Abs(scaledJoint.Position.Y - radialY) < Math.Abs(scaledJoint.Position.X - radialX)))
            {
                cursorX = (double)Math.Max(radialX - ActualWidth / 2 + hand.ActualWidth / 2,
                    Math.Min(scaledJoint.Position.X, radialX + ActualWidth / 2 - hand.ActualWidth / 2));
                cursorY = radialY;
                if (cursorX > radialX && (lastHovering != "Right"))
                {
                    stopHovering(lastHovering);
                    lastHovering = "Right";
                    setZindex(lastHovering);
                    startHovering(RadialHighRight, lastHovering);
                }
                else if (cursorX < radialX && (lastHovering != "Left"))
                {
                    stopHovering(lastHovering);
                    lastHovering = "Left";
                    setZindex(lastHovering);
                    startHovering(RadialHighLeft, lastHovering);
                }

            }
            else if ((scaledJoint.Position.Y < radialY - 100 || scaledJoint.Position.Y > radialY + 100) &&
                     (Math.Abs(scaledJoint.Position.Y - radialY) > Math.Abs(scaledJoint.Position.X - radialX)))
            {
                cursorX = radialX;
                cursorY = (double)Math.Max(radialY - ActualHeight / 2 + hand.ActualHeight / 2,
                    Math.Min(scaledJoint.Position.Y, radialY + ActualHeight / 2 - hand.ActualHeight / 2));
                if (cursorY > radialY && (lastHovering != "Bottom"))
                {
                    stopHovering(lastHovering);
                    lastHovering = "Bottom";
                    setZindex(lastHovering);
                    startHovering(RadialHighBottom, lastHovering);
                }
                else if (cursorY < radialY && (lastHovering != "Top"))
                {
                    stopHovering(lastHovering);
                    lastHovering = "Top";
                    setZindex(lastHovering);
                    startHovering(RadialHighTop, lastHovering);
                }

            }
            else
            {
                cursorX = radialX;
                cursorY = radialY;
                stopHovering(lastHovering);
            }
            hand.setCursor(cursorX, cursorY);
        }
开发者ID:kennydo,项目名称:Choreoh,代码行数:56,代码来源:RadialMenu.xaml.cs

示例11: TrackHand2SimulateMouseMove

        private void TrackHand2SimulateMouseMove(Joint hand)
        {
            if (hand.TrackingState != JointTrackingState.Tracked)
                return;

            //获得屏幕的宽度和高度
            int screenWidth = (int)SystemParameters.PrimaryScreenWidth;
            int screenHeight = (int)SystemParameters.PrimaryScreenHeight;

            //将部位“手”的骨骼坐标映射为屏幕坐标
            //float posX = joinCursorHand.ScaleTo(screenWidth, screenHeight).Position.X;
            //float posY = joinCursorHand.ScaleTo(screenWidth, screenHeight).Position.Y;

            //将部位“手”的骨骼坐标映射为屏幕坐标;手只需要在有限范围内移动即可覆盖整个屏幕区域
            float posX = hand.ScaleTo(screenWidth, screenHeight, 0.2f, 0.2f).Position.X;
            float posY = hand.ScaleTo(screenWidth, screenHeight, 0.2f, 0.2f).Position.Y;
                        
            Joint scaledCursorJoint = new Joint
            {
                TrackingState = JointTrackingState.Tracked,
                Position = new SkeletonPoint
                {
                    X = posX,
                    Y = posY,
                    Z = hand.Position.Z
                }
            };

            int x = Convert.ToInt32(scaledCursorJoint.Position.X);
            int y = Convert.ToInt32(scaledCursorJoint.Position.Y);

            //MouseToolkit.SetCursorPos(Convert.ToInt32(scaledCursorJoint.Position.X), 
            //    Convert.ToInt32(scaledCursorJoint.Position.Y));

            int mouseX = Convert.ToInt32(x * 65536 / screenWidth);
            int mouseY = Convert.ToInt32(y * 65536 / screenHeight);

            MouseToolkit.mouse_event(MouseToolkit.MouseEventFlag.Absolute | MouseToolkit.MouseEventFlag.Move,
                mouseX, mouseY, 0, 0);

        }
开发者ID:BilldBird,项目名称:Kinect_Fitness,代码行数:41,代码来源:MainWindow.xaml.cs

示例12: ScaleJoint

 private Joint ScaleJoint(Joint joint)
 {
     return joint.ScaleTo((int) this.ActualWidth, (int) this.ActualHeight, .4f, .4f);
 }
开发者ID:Reactive-Extensions,项目名称:StrangeLoop2013,代码行数:4,代码来源:MainWindow.UIHelpers.cs

示例13: ScalePosition

        /*Start of playlist functions
         * 
         */

        private void ScalePosition(FrameworkElement element, Joint joint)
        {
            //convert the value to X/Y
            //Joint scaledJoint = joint.ScaleTo(1280, 720); 

            //convert & scale (.3 = means 1/3 of joint distance)
            Joint scaledJoint = joint.ScaleTo(1280, 720, .3f, .3f);

            Canvas.SetLeft(element, scaledJoint.Position.X);
            Canvas.SetTop(element, scaledJoint.Position.Y);
            UIElement covered = null;
            covered = selectComponent(new Point(Canvas.GetLeft(element), Canvas.GetTop(element)));
            if (covered != null) focusElement(covered);
            else
            {
                focusedElement = null;
                focusedElementBorder.Visibility = Visibility.Hidden;
            }
        }
开发者ID:pajumed,项目名称:cs160-Pomegranit,代码行数:23,代码来源:MainWindow.xaml.cs

示例14: SetUiPosition

        private Point SetUiPosition(Joint joint)
        {
            if (ActualWidth > 0 && ActualHeight > 0)
            {
                Joint scaledJoint = joint.ScaleTo((int)ActualWidth, (int)ActualHeight, 1f, 1f);
                return new Point
                {
                    X = scaledJoint.Position.X, // - ui.ActualWidth / 2,
                    Y = scaledJoint.Position.Y // - ui.ActualHeight / 2
                };
            }

            return new Point();
        }
开发者ID:devinh,项目名称:KinectRCCar,代码行数:14,代码来源:SkeletonUserControl.xaml.cs

示例15: ScalePosition

 private void ScalePosition(FrameworkElement element, Joint joint)
 {
     //convert the value to X/Y
     Joint scaledJoint = joint.ScaleTo(SystemInformation.PrimaryMonitorSize.Width, SystemInformation.PrimaryMonitorSize.Width);
     Canvas.SetLeft(element, scaledJoint.Position.X);
     Canvas.SetTop(element, scaledJoint.Position.Y);
 }
开发者ID:SaiKrishnaP,项目名称:Kinect-gestures,代码行数:7,代码来源:MainWindow.xaml.cs


注:本文中的Microsoft.Kinect.Joint.ScaleTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。