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


C# AllFramesReadyEventArgs.OpenColorImageFrame方法代码示例

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


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

示例1: 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

示例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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: _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

示例8: 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

示例9: _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

示例10: AllFramesReady

 private void AllFramesReady(object sender,AllFramesReadyEventArgs e)
 {
     if(secondBuffer!=null){
         using(ColorImageFrame colorImage=e.OpenColorImageFrame())
             using(SkeletonFrame skeletonFrame=e.OpenSkeletonFrame())
                 if(colorImage!=null&&skeletonFrame!=null){
                     skeletonFrame.CopySkeletonDataTo(skeletons);
                     //colorImage.CopyPixelDataTo(bitmappixels);
                     //bitmap.WritePixels(updateRect,bitmappixels,bitmap.PixelWidth*sizeof(int),0);
                     using(DrawingContext drawingContext=drawingGroup.Open()){
                         //drawingContext.DrawImage(bitmap,drawingRect);
                         drawingContext.DrawRectangle(Brushes.Black,null,drawingRect);
                         var redPen=new Pen(Brushes.Red,5.0);
                         drawingContext.DrawGeometry(button.IsHitting?Brushes.White:null,redPen,button.Geometry);
                         drawingContext.DrawGeometry(muteButton.IsHitting?Brushes.White:null,redPen,muteButton.Geometry);
                         //drawingContext.DrawGeometry(boostButton.IsHitting?Brushes.White:null,redPen,boostButton.Geometry);
                         drawingContext.DrawGeometry(gateButton.IsHitting?Brushes.White:null,redPen,gateButton.Geometry);
                         drawingContext.DrawText(new FormattedText(secondBuffer.Status.Playing?"■":"▶",CultureInfo.CurrentCulture,FlowDirection.LeftToRight,new Typeface("メイリオ"),44,Brushes.Red),new Point(0,0));
                         foreach(Skeleton skel in skeletons){
                             if(skel.TrackingState==SkeletonTrackingState.Tracked){
                                 foreach(Joint joint in skel.Joints){
                                     if(joint.TrackingState==JointTrackingState.Tracked){
                                         var depthPoint=sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(joint.Position,DepthImageFormat.Resolution640x480Fps30);
                                         drawingContext.DrawEllipse(Brushes.Green,null,new Point(depthPoint.X,depthPoint.Y),10,10);
                                     }
                                 }
                                 if(mode==1){
                                     drawingContext.DrawLine(new Pen(Brushes.DarkBlue,20),distance.Joint1Location,distance.Joint2Location);
                                     var volume=-10000+(distance.Distance<=250?distance.Distance:250)*35;
                                     if(timer.IsEnabled) prevvolume=volume;
                                     else secondBuffer.Volume=volume;
                                 }else if(mode==2){
                                     var pen=new Pen(new SolidColorBrush(Color.FromArgb(0x7F,0,0,0x8B)),12.5);
                                     drawingContext.DrawLine(pen,volume.MiddlePoint,volume.RightHandLocation);
                                     var mat=Matrix.Identity;
                                     mat.RotateAt(volume.Angle,volume.MiddlePoint.X,volume.MiddlePoint.Y);
                                     drawingContext.DrawLine(pen,volume.MiddlePoint,mat.Transform(volume.RightHandLocation));
                                     settings[0].Gain=15/180*(-volume.Angle);
                                     settings[1].Gain=10/180*(-volume.Angle);
                                     settings[2].Gain=15/180*(volume.Angle);
                                     settings[3].Gain=15/180*(volume.Angle);
                                     settings[4].Gain=15/180*(volume.Angle);
                                     for(int i=0;i<settings.Length;i++){
                                         var effectInst=(ParamEqEffect)secondBuffer.GetEffects(i);
                                         effectInst.AllParameters=settings[i];
                                     }
                                 }
                                 drawingContext.DrawText(new FormattedText("ControlMode:"+(mode==0?"None":mode==1?"Volume":"Filter"),CultureInfo.CurrentCulture,FlowDirection.LeftToRight,new Typeface("メイリオ"),40,Brushes.White),new Point(0,400));
                                 if(muteButton.IsHitting){
                                     secondBuffer.Volume=-10000;
                                 }
                                 break;
                             }
                         }
                     }
                 }
     }
     return;
 }
开发者ID:abcsharp,项目名称:KinectDJ,代码行数:59,代码来源:MainWindow.xaml.cs

示例11: 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

示例12: 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

示例13: kinect_AllFramesReady

 private void kinect_AllFramesReady(object sender, AllFramesReadyEventArgs e)
 {
     byte[] imagem = ObterImagemSensorRGB(e.OpenColorImageFrame());
     if (chkEscalaCinza.IsChecked.HasValue && chkEscalaCinza.IsChecked.Value)
         ReconhecerDistancia(e.OpenDepthImageFrame(), imagem, 2000);
     if (imagem != null)
         imagemCamera.Source = BitmapSource.Create(kinect.ColorStream.FrameWidth, kinect.ColorStream.FrameHeight, 96, 96, PixelFormats.Bgr32, null, imagem, kinect.ColorStream.FrameBytesPerPixel * kinect.ColorStream.FrameWidth);
 }
开发者ID:gilgaljunior,项目名称:CrieAplicacoesInterativascomoMicrosoftKinect,代码行数:8,代码来源:MainWindow.xaml.cs

示例14: 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);

                /*
                double length = Point.Subtract(faceTrackingViewer.ppLeft, faceTrackingViewer.ppRight).Length;
                tB.Text = length.ToString();
                if (length > 19)
                {
                    elp.Fill = Brushes.Red;
                }
                else
                {
                    elp.Fill = Brushes.Green;
                }
                */

                double mouthWidth = faceTrackingViewer.mouthWidth;
                double noseWidth = faceTrackingViewer.noseWidth;

                double threshold = noseWidth * modifyValue;

                tBMouthDistance.Text = mouthWidth.ToString();
                tbThreshold.Text = threshold.ToString();

                if (mouthWidth > threshold)
                {
                    elp.Fill = Brushes.Red;
                }
                else
                {
                    elp.Fill = Brushes.Green;
                }
            }
        }
开发者ID:TangoChen,项目名称:KinectSmileTracking,代码行数:58,代码来源:MainWindow.xaml.cs

示例15: ManageAllFrame

        /// <summary>
        /// Manage frames of kinect sensor according to the services activated
        /// </summary>
        /// <param name="e"></param>
        private void ManageAllFrame(AllFramesReadyEventArgs e)
        {
            if (!IsRunning)
            {
                return;
            }

            // SkeletonTracking Frame Manager
            using (SkeletonFrame SFrame = e.OpenSkeletonFrame())
            {
                try
                {
                    ManageSkeletonFrame(SFrame);
                }
                catch (Exception ex)
                {
                    // Just log the error
                    Console.Error.WriteLine("Error with skeleton frame : " + ex.Message + " _ " + ex.StackTrace);
                }
            }

            // Color Frame Manager
            if (PropertiesPluginKinect.Instance.EnableColorFrameService)
            {
                using (ColorImageFrame CFrame = e.OpenColorImageFrame())
                {
                    try
                    {
                        ManageColorFrame(CFrame);
                    }
                    catch (Exception ex)
                    {
                        // Just log the error
                        Console.Error.WriteLine("Error with color frame : " + ex.Message + " _ " + ex.StackTrace);
                    }
                }
            }

            // Depth Frame Manager
            if (PropertiesPluginKinect.Instance.EnableDepthFrameService ||
                PropertiesPluginKinect.Instance.KinectPointingModeEnabled ||
                PropertiesPluginKinect.Instance.EnableGestureGrip)
            {
                using (DepthImageFrame DFrame = e.OpenDepthImageFrame())
                {
                    try
                    {
                        ManageDepthFrame(DFrame);
                    }
                    catch (Exception ex)
                    {
                        // Just log the error
                        Console.Error.WriteLine("Error with depth frame : " + ex.Message + " _ " + ex.StackTrace);
                    }

                }
            }
        }
开发者ID:intuilab,项目名称:KinectIA,代码行数:62,代码来源:KinectFrameManager.cs


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