• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AllFramesReadyEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AllFramesReadyEventArgs的典型用法代码示例。如果您正苦于以下问题:C# AllFramesReadyEventArgs类的具体用法?C# AllFramesReadyEventArgs怎么用?C# AllFramesReadyEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AllFramesReadyEventArgs类属于命名空间,在下文中一共展示了AllFramesReadyEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: KinectAllFramesReady

        public void KinectAllFramesReady(object sender,AllFramesReadyEventArgs e)
        {
            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null && screenManager != null)
                {
                    //  take skeleton data and update avatar state
                    skeletonFrame.CopySkeletonDataTo(skeletonData);
                    float headX = skeletonData[0].Joints[JointType.Head].Position.X; //floats between -1 and 1
                    float headY = skeletonData[0].Joints[JointType.Head].Position.Y;

                    midViewPort.X = screenManager.GraphicsDevice.Viewport.Width / 2;
                    midViewPort.Y = screenManager.GraphicsDevice.Viewport.Height / 2;
                    //set the posistion of the head's rectangle to be in the center of the screen and move by the joint amount
                    //TODO: figure out if skeleton data stream has lower left origin, because XNA has upper left origin and we adjust for that.
                    head.SetRectPos((int)((headX * 100) + midViewPort.X), (int)((headY * 100) + midViewPort.Y));
                    //head.SetRectPos((int)((headX * 100)), (int)((headY * 100) ));
            //
            Console.WriteLine( "head: " + head.Rectangle.X + ", " + head.Rectangle.Y );
            Console.WriteLine("joint: " + headX + ", " + headY);

                }
                else
                {
                    // skeletonFrame is null because the request did not arrive in time
                }
            }
        }
开发者ID:khoshino,项目名称:Imagination-Labs,代码行数:28,代码来源:Skeleton-FunctionalPrototypeI_bkp.cs


示例2: kinect_AllFramesReady

        void kinect_AllFramesReady( object sender, AllFramesReadyEventArgs e )
        {
            // 赤外線画像を表示する
            using ( ColorImageFrame colorFrame = e.OpenColorImageFrame() ) {
                if ( colorFrame != null ) {
                    // 赤外線画像データを取得する
                    byte[] color = new byte[colorFrame.PixelDataLength];
                    colorFrame.CopyPixelDataTo( color );

                    // 赤外線画像を表示する(16bitのグレースケール)
                    imageInfrared.Source = BitmapSource.Create( colorFrame.Width, colorFrame.Height,
                        96, 96, PixelFormats.Gray16, null, color,
                        colorFrame.Width * colorFrame.BytesPerPixel );
                }
            }

            // 距離データを表示する
            using ( DepthImageFrame depthFrame = e.OpenDepthImageFrame() ) {
                if ( depthFrame != null ) {
                    // 可視画像に変換する
                    short[] depth = new short[depthFrame.PixelDataLength];
                    depthFrame.CopyPixelDataTo( depth );

                    for ( int i = 0; i < depth.Length; i++ ) {
                        depth[i] = (short)~depth[i];
                    }

                    imageDepth.Source = BitmapSource.Create( depthFrame.Width, depthFrame.Height,
                        96, 96, PixelFormats.Gray16, null, depth,
                        depthFrame.Width * depthFrame.BytesPerPixel );
                }
            }
        }
开发者ID:kaorun55,项目名称:KinectSDKv16Sample,代码行数:33,代码来源:MainWindow.xaml.cs


示例3: kinect_AllFramesReady

        void kinect_AllFramesReady( object sender, AllFramesReadyEventArgs e )
        {
            image1.Source = e.OpenColorImageFrame().ToBitmapSource();

            // スケルトンフレームを取得する
            SkeletonFrame skeletonFrame = e.OpenSkeletonFrame();
            if ( skeletonFrame != null ) {
                // スケルトンデータを取得する
                Skeleton[] skeletonData = new Skeleton[skeletonFrame.SkeletonArrayLength];
                skeletonFrame.CopySkeletonDataTo( skeletonData );

                // プレーヤーごとのスケルトンを描画する
                foreach ( var skeleton in skeletonData ) {
                    var head = skeleton.Joints[JointType.Head];
                    if ( head.TrackingState == JointTrackingState.Tracked ) {
                        ColorImagePoint point = kinect.MapSkeletonPointToColor( head.Position, kinect.ColorStream.Format );
                        var x = image2.Width / 2;
                        var y = image2.Height / 2;

                        image2.Margin = new Thickness( point.X - x, point.Y - y, 0, 0 );
                        image2.Visibility = System.Windows.Visibility.Visible;
                    }
                }
            }
        }
开发者ID:kaorun55,项目名称:hanamegane,代码行数:25,代码来源:MainWindow.xaml.cs


示例4: sensor_AllFramesReady

        void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            //throw new NotImplementedException();
            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                // check for frame drop.
                if (skeletonFrame == null)
                {
                    return;
                }
                // copy the frame data in to the collection
                skeletonFrame.CopySkeletonDataTo(totalSkeleton);

                // get the first Tracked skeleton
                Skeleton firstSkeleton = (from trackskeleton in totalSkeleton
                                          where trackskeleton.TrackingState == SkeletonTrackingState.Tracked
                                          select trackskeleton).FirstOrDefault();

                // if the first skeleton returns null
                if (firstSkeleton == null)
                {
                    return;
                }
                this.myCanvas.Children.Clear();
                this.DrawSkeleton(firstSkeleton);
                recognitionEngine.Skeleton = firstSkeleton;
                recognitionEngine.StartRecognize();

            }
        }
开发者ID:h3nj3,项目名称:Kinect-Gesture-Recognizer,代码行数:30,代码来源:MainWindow.xaml.cs


示例5: GetCameraPoint

        void GetCameraPoint(Skeleton first, AllFramesReadyEventArgs e)
        {
            using (DepthImageFrame depth = e.OpenDepthImageFrame())
            {
                if (depth == null ||
                    _sensor == null)
                {
                    return;
                }

                DepthImagePoint headDepthPoint = this._sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(
                    first.Joints[JointType.Head].Position, DepthImageFormat.Resolution640x480Fps30);

                DepthImagePoint leftDepthPoint = this._sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(
                    first.Joints[JointType.HandLeft].Position, DepthImageFormat.Resolution640x480Fps30);

                DepthImagePoint rightDepthPoint = this._sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(
                    first.Joints[JointType.HandRight].Position, DepthImageFormat.Resolution640x480Fps30);

                ColorImagePoint headColorPoint = this._sensor.CoordinateMapper.MapDepthPointToColorPoint(
                    DepthImageFormat.Resolution640x480Fps30, headDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);

                ColorImagePoint leftColorPoint = this._sensor.CoordinateMapper.MapDepthPointToColorPoint(
                    DepthImageFormat.Resolution640x480Fps30, leftDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);

                ColorImagePoint rightColorPoint = this._sensor.CoordinateMapper.MapDepthPointToColorPoint(
                    DepthImageFormat.Resolution640x480Fps30, rightDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);

                CameraPosition(ellipseHead, headColorPoint);
                CameraPosition(ellipseLeft, leftColorPoint);
                CameraPosition(ellipseRight, rightColorPoint);
            }
        }
开发者ID:tkowalczyk,项目名称:KinectSkeletalApp,代码行数:33,代码来源:MainWindow.xaml.cs


示例6: KinectSensorOnAllFramesReady

        private void KinectSensorOnAllFramesReady(object sender, AllFramesReadyEventArgs allFramesReadyEventArgs)
        {
            using (var colorImageFrame = allFramesReadyEventArgs.OpenColorImageFrame())
            {
                if (colorImageFrame == null)
                {
                    return;
                }

                // Make a copy of the color frame for displaying.
                var haveNewFormat = this.currentColorImageFormat != colorImageFrame.Format;
                if (haveNewFormat)
                {
                    this.currentColorImageFormat = colorImageFrame.Format;
                    this.colorImageData = new byte[colorImageFrame.PixelDataLength];
                    this.colorImageWritableBitmap = new WriteableBitmap(
                        colorImageFrame.Width, colorImageFrame.Height, 96, 96, PixelFormats.Bgr32, null);
                    ColorImage.Source = this.colorImageWritableBitmap;
                }

                colorImageFrame.CopyPixelDataTo(this.colorImageData);
                this.colorImageWritableBitmap.WritePixels(
                    new Int32Rect(0, 0, colorImageFrame.Width, colorImageFrame.Height),
                    this.colorImageData,
                    colorImageFrame.Width * Bgr32BytesPerPixel,
                    0);

            }
        }
开发者ID:kalwanis,项目名称:Kinect--Face-Tracking--and-LEDs,代码行数:29,代码来源:MainWindow.xaml.cs


示例7: sensor_AllFramesReady

        void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            using (ColorImageFrame frame = e.OpenColorImageFrame())
        
            {
            
               if (frame == null)
                {
                    return;
                }
                byte[] pixels = new byte[frame.PixelDataLength];
                int stride = frame.Width * 4;
                frame.CopyPixelDataTo(pixels);
                imagecolor.Source = BitmapSource.Create(frame.Width, frame.Height, 96, 96, PixelFormats.Bgr32, null, pixels, stride);

                Skeleton first = GetFirstSkeleton(e);
                if (first == null)
                {
                    return;
                }
                //set scaled position
                //ScalePosition(lShoulderEllipse, first.Joints[JointType.ShoulderLeft]);
                //ScalePosition(rShoulderEllipse, first.Joints[JointType.ShoulderRight]);
                //ScalePosition(lKneeEllipse, first.Joints[JointType.KneeLeft]);
                //ScalePosition(rKneeEllipse, first.Joints[JointType.KneeRight]);
                //ScalePosition(rHandEllipse, first.Joints[JointType.HandRight]);
                GetCameraPoint(first, e);

            }
        }
开发者ID:SaiKrishnaP,项目名称:Kinect-gestures,代码行数:30,代码来源:MainWindow.xaml.cs


示例8: GetTrackedSkeleton

        private Skeleton GetTrackedSkeleton(AllFramesReadyEventArgs e)
        {
            using (SkeletonFrame skeletonFrameData = e.OpenSkeletonFrame())
            {
                SkeletonDetected = false;

                if (skeletonFrameData == null)
                {
                    return null;
                }

                // Kinect SDK always returns 6 skeleton
                const int skeletonCount = 6;
                Skeleton[] allSkeletons = new Skeleton[skeletonCount];

                skeletonFrameData.CopySkeletonDataTo(allSkeletons);

                //Get the first tracked skeleton out of the 6
                Skeleton trackedSkeleton = null;

                foreach (Skeleton skeleton in allSkeletons)
                {
                    // if no skeleton is tracked, null will be returned.
                    if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                    {
                        trackedSkeleton = skeleton;
                        SkeletonDetected = true;
                        break;
                    }
                }

                return trackedSkeleton;
            }
        }
开发者ID:pvishal,项目名称:kinect-hands,代码行数:34,代码来源:JointTracker.cs


示例9: sensor_AllFramesReady

        void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
            {
                if (colorFrame != null)
                {
                    // Create byte array with pixel data
                    byte[] pixels = new byte[colorFrame.PixelDataLength];
                    colorFrame.CopyPixelDataTo(pixels);

                    // Bytes/row = 4 * with (for bgr32)
                    int stride = colorFrame.Width * 4;
                    // Display image
                    img_colorimage.Source = BitmapSource.Create(colorFrame.Width, colorFrame.Height, 96, 96, PixelFormats.Bgr32, null, pixels, stride);
                }
            }
            // Auto dispose

            using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
            {
                if (depthFrame != null)
                {
                    // Set colors based on depth
                    byte[] pixels = GenerateColoredBytes(depthFrame);

                    // Bytes/row = 4 * with (for bgr32)
                    int stride = depthFrame.Width * 4;
                    // Display image
                    img_depthimage.Source = BitmapSource.Create(depthFrame.Width, depthFrame.Height, 96, 96, PixelFormats.Bgr32, null, pixels, stride);
                }
            }
            // Auto dispose
        }
开发者ID:Ben-Kaniobi,项目名称:Kinect_Experiments,代码行数:33,代码来源:MainWindow.xaml.cs


示例10: AllFramesReady

 private void AllFramesReady(object sender,AllFramesReadyEventArgs e)
 {
     using(ColorImageFrame colorImage=e.OpenColorImageFrame())
         using(SkeletonFrame skeletonFrame=e.OpenSkeletonFrame())
             if(colorImage!=null&&skeletonFrame!=null){
                 colorImage.CopyPixelDataTo(bitmappixels);
                 skeletonFrame.CopySkeletonDataTo(skeletons);
                 bitmap.WritePixels(updateRect,bitmappixels,bitmap.PixelWidth*sizeof(int),0);
                 using(DrawingContext drawingContext=drawingGroup.Open()){
                     drawingContext.DrawImage(bitmap,drawingRect);
                     //drawingContext.DrawGeometry(button1.IsHitting?Brushes.White:null,new Pen(Brushes.Blue,2.0),button1.Geometry);
                     //drawingContext.DrawGeometry(button2.IsHitting?Brushes.White:null,new Pen(Brushes.Blue,2.0),button2.Geometry);
                     foreach(Skeleton skel in skeletons){
                         if(skel.TrackingState==SkeletonTrackingState.Tracked){
                             foreach(Joint joint in skel.Joints){
                                 if(joint.TrackingState==JointTrackingState.Tracked){
                                     var depthPoint=sensor.MapSkeletonPointToDepth(joint.Position,DepthImageFormat.Resolution640x480Fps30);
                                     drawingContext.DrawEllipse(Brushes.Green,null,new Point(depthPoint.X,depthPoint.Y),15,15);
                                 }
                             }
                             drawingContext.DrawRectangle(Brushes.Red,null,new Rect(0.0,0.0,distance1.Distance,50.0));
                             drawingContext.DrawLine(new Pen(Brushes.Blue,10),volume1.MiddlePoint,volume1.RightHandLocation);
                             var mat=Matrix.Identity;
                             mat.RotateAt(volume1.Angle,volume1.MiddlePoint.X,volume1.MiddlePoint.Y);
                             drawingContext.DrawLine(new Pen(Brushes.Blue,10),volume1.MiddlePoint,mat.Transform(volume1.RightHandLocation));
                             drawingContext.DrawText(new FormattedText(volume1.Angle.ToString(),CultureInfo.CurrentCulture,FlowDirection.LeftToRight,new Typeface("MS Gothic"),150,Brushes.Blue),new Point());
                             break;
                         }
                     }
                 }
             }
     return;
 }
开发者ID:abcsharp,项目名称:KinectTestApp,代码行数:33,代码来源:MainWindow.xaml.cs


示例11: _sensor_AllFramesReady

        void _sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
            {
                if (colorFrame == null)
                {
                    return;
                }

                byte[] pixels = new byte[colorFrame.PixelDataLength];
                colorFrame.CopyPixelDataTo(pixels);

                int stride = colorFrame.Width * 4;

                imageRGB.Source =
                    BitmapSource.Create(colorFrame.Width,
                    colorFrame.Height,
                    96,
                    96,
                    PixelFormats.Bgr32,
                    null,
                    pixels,
                    stride);
            }
        }
开发者ID:tkowalczyk,项目名称:KinectTiltCamera,代码行数:25,代码来源:MainWindow.xaml.cs


示例12: kinect_AllFramesReady

        void kinect_AllFramesReady( object sender, AllFramesReadyEventArgs e )
        {
            using ( var colorFrame = e.OpenColorImageFrame() ) {
                if ( colorFrame != null ) {
                    var pixel = new byte[colorFrame.PixelDataLength];
                    colorFrame.CopyPixelDataTo( pixel );

                    ImageRgb.Source = BitmapSource.Create( colorFrame.Width, colorFrame.Height, 96, 96,
                        PixelFormats.Bgr32, null, pixel, colorFrame.Width * 4 );
                }
            }

            using ( var depthFrame = e.OpenDepthImageFrame() ) {
                if ( depthFrame != null ) {
                    // Depth情報を入れる
                    // GetRawPixelData()はインタラクションライブラリ内で実装された拡張メソッド
                    stream.ProcessDepth( depthFrame.GetRawPixelData(), depthFrame.Timestamp );
                }
            }

            using ( var skeletonFrame = e.OpenSkeletonFrame() ) {
                if ( skeletonFrame != null ) {
                    var skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    skeletonFrame.CopySkeletonDataTo( skeletons );

                    // スケルトン情報を入れる
                    stream.ProcessSkeleton( skeletons, kinect.AccelerometerGetCurrentReading(), skeletonFrame.Timestamp );
                }
            }
        }
开发者ID:penyatree,项目名称:KinectSDKv17Sample,代码行数:30,代码来源:MainWindow.xaml.cs


示例13: RuntimeDepthFrameReady

		void RuntimeDepthFrameReady(AllFramesReadyEventArgs e)
		{
			using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
			{
				if (depthFrame == null)
				{
					return; 
				}

                //turn raw data into array of distances
				var depthArray = depthFrame.ToDepthArray();

                //get image
				DepthImage.Image = depthFrame.ToBitmap();

                //get midpoint
				MidPointDistanceViaGetDistanceText.Text = depthFrame.GetDistance(depthFrame.Width/2, depthFrame.Height/2).ToString();

				//image
				DepthImageWithMinDistance.Image = depthArray.ToBitmap(depthFrame.Width, depthFrame.Height, _minDistance, Color.FromArgb(255, 255, 0, 0));

				if (_saveDepthFrame)
				{
					_saveDepthFrame = false;
					depthFrame.ToBitmap().Save(DateTime.Now.ToString("yyyyMMddHHmmss") + "_depth.jpg", ImageFormat.Jpeg);
				}

			}

		}
开发者ID:Cocotus,项目名称:kinect,代码行数:30,代码来源:Form1.cs


示例14: _sensor_AllFramesReady

        void _sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            //throw new NotImplementedException();
            using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
            {

                if (colorFrame == null)
                {
                    return;
                }

                byte[] pixels = new byte[colorFrame.PixelDataLength];

                //copy data out into our byte array
                colorFrame.CopyPixelDataTo(pixels);

                int stride = colorFrame.Width * 4;

                image2.Source = BitmapSource.Create(colorFrame.Width, colorFrame.Height, 96, 96, PixelFormats.Bgr32, null, pixels, stride);
                if (playerDepth > 500)
                {
                ScaleTransform scaly = new ScaleTransform(.5, .5);
                image3.RenderTransform = scaly;
                }

            }
            using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
            {
                if (depthFrame == null)
                {
                    return;
                }

            }
        }
开发者ID:Sprawl63,项目名称:KinectProject1,代码行数:35,代码来源:MainWindow.xaml.cs


示例15: mySensor_AllFramesReady

        void mySensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            ColorImageFrame c = e.OpenColorImageFrame();
            DepthImageFrame d = e.OpenDepthImageFrame();
            bool myRenderFlag = (bool)ChkRender.IsChecked;
            if (c == null || d == null) return;
            c.CopyPixelDataTo(myColorArray);
            d.CopyPixelDataTo(myArray);

            for(int x = 0; x < 640; x++)
            {
                for (int y = 0; y < 480; y++)
                {
                    short depthVal = myArray[y * 640 + x];
                    depthVal = (short)(depthVal >> DepthImageFrame.PlayerIndexBitmaskWidth);
                    depthVal = (short)(depthVal << DepthImageFrame.PlayerIndexBitmaskWidth);
                    depthVal /= 255;
                    if(myRenderFlag==true)
                        myColorArray[(y * 640 + x) * 4 + 1] = (byte)depthVal;// (byte)(myColorArray[(y * 640 + x) * 4 + 1] / 2 + (byte)depthVal / 2);
                    myColorArray[(y * 640 + x) * 4 + 3] = 255;
                }
            }

            myBitmap.WritePixels(
                        new Int32Rect(0, 0, myBitmap.PixelWidth, myBitmap.PixelHeight),
                        myColorArray,
                        myBitmap.PixelWidth * 4,
                        0);

            c.Dispose();
            d.Dispose();
        }
开发者ID:kinectNao,项目名称:bluenao,代码行数:32,代码来源:MainWindow.xaml.cs


示例16: Kinect_AllFramesReady

        void Kinect_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            _skeletonData.ToList().ForEach(s =>
                {
                    if (s.TrackingState == SkeletonTrackingState.Tracked)
                    {
                        var rightHand = s.Joints.First(x => x.JointType == JointType.HandRight);
                        var leftHand = s.Joints.First(x => x.JointType == JointType.HandLeft);
                        var r = rightHand.ScaleTo(571, 500);
                        var l = leftHand.ScaleTo(571, 500);

                        _hub.Invoke("MoveShape",
                            new { hand = "right", x = r.Position.X, y = r.Position.Y},
                            new { hand = "left", x = l.Position.X, y = l.Position.Y }
                            );

                        Log(string.Format("Right X: {0} Right Y: {1}, Left X: {2}, Left Y: {3}",
                            r.Position.X,
                            r.Position.Y,
                            l.Position.X,
                            l.Position.Y));
                    }
                });

            Array.Clear(_skeletonData, 0, _skeletonData.Length);
        }
开发者ID:Microsoft-Web,项目名称:DEMO-Presentations,代码行数:26,代码来源:Program.cs


示例17: sensor_AllFramesReady

        void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            if (closing)
            {
                return;
            }

            //Get a skeleton
            Skeleton first =  GetFirstSkeleton(e);

            if (first == null)
            {
                return; 
            }

            //set scaled position
            //ScalePosition(head, first.Joints[JointType.Head]);
            //ScalePosition(leftHand, first.Joints[JointType.HandLeft]);
            //ScalePosition(rightHand, first.Joints[JointType.HandRight]);
            //ScalePosition(rightShoulder, first.Joints[JointType.ShoulderRight]);
            //ScalePosition(leftShoulder, first.Joints[JointType.ShoulderLeft]);

            GetCameraPoint(first, e); 

        }
开发者ID:nathalia,项目名称:PSG,代码行数:25,代码来源:MainWindow.xaml.cs


示例18: GetCameraPoint

        void GetCameraPoint(Skeleton first, AllFramesReadyEventArgs e)
        {
            using (DepthImageFrame depth = e.OpenDepthImageFrame())
            {
                if (depth == null ||
                    kinectSensorChooser1.Kinect == null)
                {
                    return;
                }

                //Map a joint location to a point on the depth map
                //left hand
                DepthImagePoint leftDepthPoint =
                    depth.MapFromSkeletonPoint(first.Joints[JointType.HandLeft].Position);

                //Map a depth point to a point on the color image
                //left hand
                ColorImagePoint leftColorPoint =
                    depth.MapToColorImagePoint(leftDepthPoint.X, leftDepthPoint.Y,
                    ColorImageFormat.RgbResolution640x480Fps30);

                CameraPosition(arrow, leftColorPoint);
                SwipeCheck(leftColorPoint.X);
            }
        }
开发者ID:paigedr,项目名称:swipenserve,代码行数:25,代码来源:MainWindow.xaml.cs


示例19: CalibrationAllFramesReady

        bool working = false; // Skip frames if we're still processing stuff.

        public void CalibrationAllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            if (working) return;
            working = true;

            using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
            {
                if (colorFrame == null)
                {
                    working = false;
                    return;
                }

                using (DepthImageFrame depthFrame = e.OpenDepthImageFrame())
                {
                    if (depthFrame == null)
                    {
                        working = false;
                        return;
                    }

                    //byte[] pixels = new byte[colorFrame.PixelDataLength];
                    //colorFrame.CopyPixelDataTo(pixels);
                    //int stride = colorFrame.Width * 4;
                    //debugImage.Source = BitmapSource.Create(colorFrame.Width, colorFrame.Height, 96, 96, PixelFormats.Bgr32, null, pixels, stride);
                    //debugImage.Visibility = Visibility.Visible;

                    //int code_num = find_code(colorFrame, depthFrame);
                    int code_num = find_touch(colorFrame, depthFrame);
                    if (code_num >= 0)
                    {
                        // Make the next code visible.
                        if (code_num < 4)
                        {
                            codes[code_num].Visibility = Visibility.Hidden;
                            codes[code_num + 1].Visibility = Visibility.Visible;
                            next_code_num++;
                            Thread.Sleep(3000);
                        }
                        else
                        {
                            Thread.Sleep(3000);
                            // We are done. Calculate the coefficients.
                            sensor.AllFramesReady -= this.CalibrationAllFramesReady;
                            codes[4].Visibility = Visibility.Hidden;
                            kinectController.calibration_coefficients = get_calibration_coeffs();
                            
                            Point center_top_left = code_points[0];
                            Point center_bot_right = code_points[4];
                            kinectController.Calibrate((int)(center_top_left.X + 1.25*code_size.X), (int)(center_top_left.Y + 0.7*code_size.Y), (int)(center_bot_right.X - 1.25*code_size.X), (int)(center_bot_right.Y - 0.8*code_size.Y));
                            sensor.AllFramesReady += kinectController.SensorAllFramesReady;
                            CalibrationDidComplete();
                        }
                    }
                }
            }

            working = false;
        }
开发者ID:ZeyuW,项目名称:eecs481maze,代码行数:61,代码来源:CalibrationController.cs


示例20: Kinect_AllFramesReady

        void Kinect_AllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            using (var Frame = e.OpenColorImageFrame())
            {
                if (Frame != null)
                {
                    Frame.CopyPixelDataTo(Pixels);
                    Bitmap.WritePixels(
                        new Int32Rect(0, 0, Bitmap.PixelWidth, Bitmap.PixelHeight),
                        Pixels, Bitmap.PixelWidth * sizeof(int), 0);
                }
            }

            using (var Frame = e.OpenSkeletonFrame())
            {
                if (Frame != null)
                {
                    var skeletons = new Skeleton[Frame.SkeletonArrayLength];
                    Frame.CopySkeletonDataTo(skeletons);
                    var skel = (from s in skeletons where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault();
                    if (skel != null)
                    {
                        var left_hand = skel.Joints[JointType.HandLeft];
                        var rite_hand = skel.Joints[JointType.HandRight];
                        var shoulderRight = skel.Joints[JointType.ShoulderRight];
                        var fleft = skel.Joints[JointType.FootLeft];
                        var frite = skel.Joints[JointType.FootRight];

                        Joint head = skel.Joints[JointType.Head];

                        Point mousePos = new Point((rite_hand.Position.X * 1300 + 683), (rite_hand.Position.Y * -1300 + 768));

                        //двойное нажатие левой кнопкой мыши
                        if (distance(head.Position, left_hand.Position) < 0.06f) {
                            NatiteMethods.sendMouseDoubleClick(mousePos);

                        // правая кнопка мыши
                        } else if(distance(left_hand.Position, rite_hand.Position) < 0.03f) {
                            NatiteMethods.mouseLeftButtonDown(mousePos);

                        // перетаскивание
                        } else if(distance(shoulderRight.Position, left_hand.Position) < 0.03f) {
                            NatiteMethods.sendMouseRightclick(mousePos);
                        }
                        if (fleft.Position.Y <= fleft.Position.Y + 0.5f) {

                            // Get the virtual key code for the character we want to press
                            //int key = 87;
                            //uint vkKey = NatiteMethods.VkKeyScan((char) key);

                            //NatiteMethods.keybd_event(vkKey, 0, 0, 0);
                            //NatiteMethods.keybd_event(vkKey, 0, 2, 0);
                        }

                        NatiteMethods.SetCursorPos((int) mousePos.X, (int) mousePos.Y);
                    }
                }
            }
        }
开发者ID:JastAir,项目名称:Kinect,代码行数:59,代码来源:MainWindow.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AllJoynMessageInfo类代码示例发布时间:2022-05-24
下一篇:
C# All类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap