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


C# DepthImageFormat类代码示例

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


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

示例1: CoordinateConverter

 public CoordinateConverter(IEnumerable<byte> kinectParams, ColorImageFormat cif, 
                     DepthImageFormat dif)
 {
     mapper = new CoordinateMapper(kinectParams);
       this.cif = cif;
       this.dif = dif;
 }
开发者ID:ushadow,项目名称:handinput,代码行数:7,代码来源:CoordinateConverter.cs

示例2: KinectHelper

        private KinectHelper(TransformSmoothParameters tsp, bool near = false, 
                             ColorImageFormat colorFormat = ColorImageFormat.RgbResolution1280x960Fps12, 
                             DepthImageFormat depthFormat = DepthImageFormat.Resolution640x480Fps30)
        {
            _kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected);

            if (_kinectSensor == null)
            {
                throw new Exception("No Kinect-Sensor found.");
            }
            if (near)
            {
                _kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                _kinectSensor.DepthStream.Range = DepthRange.Near;
                _kinectSensor.SkeletonStream.EnableTrackingInNearRange = true;
            }

            DepthImageFormat = depthFormat;
            ColorImageFormat = colorFormat;

            _kinectSensor.SkeletonStream.Enable(tsp);
            _kinectSensor.ColorStream.Enable(colorFormat);
            _kinectSensor.DepthStream.Enable(depthFormat);
            _kinectSensor.AllFramesReady += AllFramesReady;

            _kinectSensor.Start();
            _faceTracker = new FaceTracker(_kinectSensor);
        }
开发者ID:rechc,项目名称:KinectMiniApps,代码行数:28,代码来源:KinectHelper.cs

示例3: ProcessData

        public void ProcessData(KinectSensor kinectSensor, ColorImageFormat colorImageFormat,
                                 byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage,
                                 Skeleton[] skeletons, int skeletonFrameNumber)
        {
            if (skeletons == null)
            {
                return;
            }

            // Update the list of trackers and the trackers with the current frame information
            foreach (Skeleton skeleton in skeletons)
            {
                if (skeleton.TrackingState == SkeletonTrackingState.Tracked ||
                    skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
                {
                    // We want keep a record of any skeleton, tracked or untracked.
                    if (!this._trackedSkeletons.ContainsKey(skeleton.TrackingId))
                    {
                        this._trackedSkeletons.Add(skeleton.TrackingId, new SkeletonFaceTracker());
                    }

                    // Give each tracker the upated frame.
                    SkeletonFaceTracker skeletonFaceTracker;
                    if (this._trackedSkeletons.TryGetValue(skeleton.TrackingId, out skeletonFaceTracker))
                    {
                        skeletonFaceTracker.OnFrameReady(kinectSensor, colorImageFormat, colorImage, depthImageFormat,
                                                         depthImage, skeleton);
                        skeletonFaceTracker.LastTrackedFrame = skeletonFrameNumber;
                    }
                }
            }

            RemoveOldTrackers(skeletonFrameNumber);
        }
开发者ID:konni-arcadia,项目名称:kinect-data-transmitter,代码行数:34,代码来源:FaceTracker.cs

示例4: FaceTracker

        /// <summary>
        /// Initializes a new instance of the FaceTracker class from a reference of the Kinect device.
        /// <param name="sensor">Reference to kinect sensor instance</param>
        /// </summary>
        public FaceTracker(KinectSensor sensor)
        {
            if (sensor == null) {
            throw new ArgumentNullException("sensor");
              }

              if (!sensor.ColorStream.IsEnabled) {
            throw new InvalidOperationException("Color stream is not enabled yet.");
              }

              if (!sensor.DepthStream.IsEnabled) {
            throw new InvalidOperationException("Depth stream is not enabled yet.");
              }

              this.operationMode = OperationMode.Kinect;
              this.coordinateMapper = sensor.CoordinateMapper;
              this.initializationColorImageFormat = sensor.ColorStream.Format;
              this.initializationDepthImageFormat = sensor.DepthStream.Format;

              var newColorCameraConfig = new CameraConfig(
              (uint)sensor.ColorStream.FrameWidth,
              (uint)sensor.ColorStream.FrameHeight,
              sensor.ColorStream.NominalFocalLengthInPixels,
              FaceTrackingImageFormat.FTIMAGEFORMAT_UINT8_B8G8R8X8);
              var newDepthCameraConfig = new CameraConfig(
              (uint)sensor.DepthStream.FrameWidth,
              (uint)sensor.DepthStream.FrameHeight,
              sensor.DepthStream.NominalFocalLengthInPixels,
              FaceTrackingImageFormat.FTIMAGEFORMAT_UINT16_D13P3);
              this.Initialize(newColorCameraConfig, newDepthCameraConfig, IntPtr.Zero, IntPtr.Zero, this.DepthToColorCallback);
        }
开发者ID:ushadow,项目名称:handinput,代码行数:35,代码来源:FaceTracker.cs

示例5: DepthFrameClass

        public DepthFrameClass(KinectSensor sensor, DepthImageFormat depthFormat, float depthScale)
        {
            switch (depthFormat)
            {
                case DepthImageFormat.Resolution640x480Fps30:
                    this.FrameWidth = 640;
                    this.FrameHeight = 480;
                    break;
                case DepthImageFormat.Resolution320x240Fps30:
                    this.FrameWidth = 320;
                    this.FrameHeight = 240;
                    break;
                case DepthImageFormat.Resolution80x60Fps30:
                    this.FrameWidth = 80;
                    this.FrameHeight = 60;
                    break;
                default:
                    throw new FormatException();
            }

            this.kinectSensor = sensor;
            this.DepthScale = depthScale;

            this.AllocateMemory();
        }
开发者ID:YoshihisaMaruya,项目名称:TARP,代码行数:25,代码来源:DepthFrameClass.cs

示例6: KinectChooser

        /// <summary>
        /// Initializes a new instance of the KinectChooser class.
        /// </summary>
        /// <param name="game">The related game object.</param>
        /// <param name="colorFormat">The desired color image format.</param>
        /// <param name="depthFormat">The desired depth image format.</param>
        public KinectChooser(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
            : base(game)
        {
            this.colorImageFormat = colorFormat;
            this.depthImageFormat = depthFormat;

            this.nearMode = false;
            this.seatedMode = false;
            this.SimulateMouse = false;

            if (!Game1.SIMULATE_NO_KINECT)
            {
                KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
                this.DiscoverSensor();
            }

            this.statusMap.Add(KinectStatus.Undefined, "Not connected, or in use");
            this.statusMap.Add(KinectStatus.Connected, string.Empty);
            this.statusMap.Add(KinectStatus.DeviceNotGenuine, "Device Not Genuine");
            this.statusMap.Add(KinectStatus.DeviceNotSupported, "Device Not Supported");
            this.statusMap.Add(KinectStatus.Disconnected, "Required");
            this.statusMap.Add(KinectStatus.Error, "Error");
            this.statusMap.Add(KinectStatus.Initializing, "Initializing...");
            this.statusMap.Add(KinectStatus.InsufficientBandwidth, "Insufficient Bandwidth");
            this.statusMap.Add(KinectStatus.NotPowered, "Not Powered");
            this.statusMap.Add(KinectStatus.NotReady, "Not Ready");
        }
开发者ID:shadarath,项目名称:SpaceExplorer,代码行数:33,代码来源:KinectChooser.cs

示例7: KinectManager

        /*/////////////////////////////////////////
          * CONSTRUCTOR(S)/DESTRUCTOR(S)
          */
        ///////////////////////////////////////
        public KinectManager(ColorImageFormat p_colour_format,
                             DepthImageFormat p_depth_format,
                             KinectGame_WindowsXNA p_game)
        {
            // Initialise the Kinect selector...
            this.colour_image_format = p_colour_format;
            this.depth_image_format = p_depth_format;
            this.root_game = p_game;

            this.colour_stream = null;
            this.depth_stream = null;
            this.skeleton_stream = null;

            this.debug_video_stream_dimensions = new Vector2(200, 150);

            status_map = new Dictionary<KinectStatus, string>();
            KinectSensor.KinectSensors.StatusChanged += this.KinectSensorsStatusChanged; // handler function for changes in the Kinect system
            this.DiscoverSensor();

            this.status_map.Add(KinectStatus.Undefined, "UNKNOWN STATUS MESSAGE");
            this.status_map.Add(KinectStatus.Connected, "Connected.");//string.Empty);
            this.status_map.Add(KinectStatus.DeviceNotGenuine, "Detected device is not genuine!");
            this.status_map.Add(KinectStatus.DeviceNotSupported, "Detected device is not supported!");
            this.status_map.Add(KinectStatus.Disconnected, "Disconnected/Device required!");
            this.status_map.Add(KinectStatus.Error, "Error in Kinect sensor!");
            this.status_map.Add(KinectStatus.Initializing, "Initialising Kinect sensor...");
            this.status_map.Add(KinectStatus.InsufficientBandwidth, "Insufficient bandwidth for Kinect sensor!");
            this.status_map.Add(KinectStatus.NotPowered, "Detected device is not powered!");
            this.status_map.Add(KinectStatus.NotReady, "Detected device is not ready!");

            // Load the status message font:
            this.msg_font = this.root_game.Content.Load<SpriteFont>("Fonts/Segoe16");
            this.msg_label_pos = new Vector2(4.0f, 2.0f);
        }
开发者ID:nhunt93,项目名称:CS3013_GROUP_9_PROJECT,代码行数:38,代码来源:KinectManager.cs

示例8: VideoShot

        public VideoShot(ColorImageProcesser processer, MainWindow window, int videoNum,
            KinectSensor kinectDevice,
            int dWidht, int dHeight,
            int cWidth, int cHeight,
            DepthImageFormat dImageFormat, ColorImageFormat cImageFormat)
        {
            parentProcesser = processer;
            videoName = PadLeft(videoNum);
            _windowUI = window;
            _kinectDevice = kinectDevice;

            depthFrameWidth = dWidht;
            depthFrameHeight = dHeight;

            colorFrameWidth = cWidth;
            colorFrameHeight = cHeight;

            depthFrameStride = depthFrameWidth * BytesPerPixel;
            colorFrameStride = colorFrameWidth * BytesPerPixel;

            depthImageFormat = dImageFormat;
            colorImageFormat = cImageFormat;

            screenHeight = SystemParameters.PrimaryScreenHeight;
            screenWidth = SystemParameters.PrimaryScreenWidth;

            Start();
        }
开发者ID:BillHuangg,项目名称:CMKinectImageProcess,代码行数:28,代码来源:VideoShot.cs

示例9: Kinect

        public Kinect(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
            : base(game)
        {
            this.colorImageFormat = colorFormat;
            this.depthImageFormat = depthFormat;

            KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
            this.DiscoverSensor();
        }
开发者ID:kira333,项目名称:MyProjects,代码行数:9,代码来源:Kinect.cs

示例10: MapDepthPointToSketelonPoint

        /// <summary>
        /// Map PointDepth3D to PointSkeleton3D
        /// </summary>
        /// <param name="depthImageFormat"></param>
        /// <param name="pointDepth3D"></param>
        /// <returns></returns>
        public PointSkeleton3D MapDepthPointToSketelonPoint(DepthImageFormat depthImageFormat, PointDepth3D pointDepth3D)
        {
            DepthImagePoint point = new DepthImagePoint();
            point.X = pointDepth3D.X;
            point.Y = pointDepth3D.Y;
            point.Depth = pointDepth3D.Depth;

            return new PointSkeleton3D(mapper.MapDepthPointToSkeletonPoint(depthImageFormat, point));
        }
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:15,代码来源:CoordinateMapperPlus.cs

示例11: MapSkeletonPointToDepthPoint

        /// <summary>
        /// Map PointSkeleton3D to PointDepth3D
        /// </summary>
        /// <param name="pointSkleton3D"></param>
        /// <param name="depthImageFormat"></param>
        /// <returns></returns>
        public PointDepth3D MapSkeletonPointToDepthPoint(PointSkeleton3D pointSkleton3D,DepthImageFormat depthImageFormat)
        {
            SkeletonPoint point = new SkeletonPoint();
            point.X = pointSkleton3D.X;
            point.Y = pointSkleton3D.Y;
            point.Z = pointSkleton3D.Z;

            return new PointDepth3D(mapper.MapSkeletonPointToDepthPoint(point,depthImageFormat));
        }
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:15,代码来源:CoordinateMapperPlus.cs

示例12: MapDepthPointsToSketelonPoints

 /// <summary>
 /// Map PointDepth3D List to PointSkeleton3D List
 /// </summary>
 /// <param name="depthImageFormat"></param>
 /// <param name="pointDepth3D"></param>
 /// <returns></returns>
 public List<PointSkeleton3D> MapDepthPointsToSketelonPoints(DepthImageFormat depthImageFormat, List<PointDepth3D> pointDepth3D)
 {
     List<PointSkeleton3D> ret = new List<PointSkeleton3D>();
     foreach (var element in pointDepth3D)
     {
         ret.Add(MapDepthPointToSketelonPoint(depthImageFormat, element));
     }
     return ret;
 }
开发者ID:jiliyutou,项目名称:FingerTracking,代码行数:15,代码来源:CoordinateMapperPlus.cs

示例13: OnKinectChanged

        protected override void OnKinectChanged(KinectSensor oldKinectSensor, KinectSensor newKinectSensor)
        {
            if (oldKinectSensor != null) {
                oldKinectSensor.DepthFrameReady -= this.DepthImageReady;
                kinectDepthImage.Source = null;
                this.lastImageFormat = DepthImageFormat.Undefined;
            }

            if (newKinectSensor != null && newKinectSensor.Status == KinectStatus.Connected) {
                ResetFrameRateCounters();

                newKinectSensor.DepthFrameReady += this.DepthImageReady;
            }
        }
开发者ID:nuwud,项目名称:Robosapien,代码行数:14,代码来源:KinectDepthViewer.xaml.cs

示例14: GetDepthSize

        /// <summary>
        /// Get the depth image size from the depth image format.
        /// </summary>
        /// <param name="imageFormat">The depth image format.</param>
        /// <returns>The width and height of the depth image format.</returns>
        public static Size GetDepthSize(DepthImageFormat imageFormat)
        {
            switch (imageFormat)
            {
                case DepthImageFormat.Resolution320x240Fps30:
                    return new Size(320, 240);

                case DepthImageFormat.Resolution640x480Fps30:
                    return new Size(640, 480);

                case DepthImageFormat.Resolution80x60Fps30:
                    return new Size(80, 60);
                case DepthImageFormat.Undefined:
                    return new Size(0, 0);
            }

            throw new ArgumentOutOfRangeException("imageFormat");
        }
开发者ID:kit-cat,项目名称:ColorFaceFusion,代码行数:23,代码来源:FormatHelper.cs

示例15: KinectChooser

        /// <summary>
        /// Initializes a new instance of the KinectChooser class.
        /// </summary>
        /// <param name="game">The related game object.</param>
        /// <param name="colorFormat">The desired color image format.</param>
        /// <param name="depthFormat">The desired depth image format.</param>
        public KinectChooser(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
            : base(game)
        {
            this.colorImageFormat = colorFormat;
            this.depthImageFormat = depthFormat;

            KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
            this.DiscoverSensor();

            this.statusMap.Add(KinectStatus.Connected, string.Empty);
            this.statusMap.Add(KinectStatus.DeviceNotGenuine, "Device Not Genuine");
            this.statusMap.Add(KinectStatus.DeviceNotSupported, "Device Not Supported");
            this.statusMap.Add(KinectStatus.Disconnected, "Required");
            this.statusMap.Add(KinectStatus.Error, "Error");
            this.statusMap.Add(KinectStatus.Initializing, "Initializing...");
            this.statusMap.Add(KinectStatus.InsufficientBandwidth, "Insufficient Bandwidth");
            this.statusMap.Add(KinectStatus.NotPowered, "Not Powered");
            this.statusMap.Add(KinectStatus.NotReady, "Not Ready");
        }
开发者ID:KinAudio,项目名称:Master,代码行数:25,代码来源:KinectChooser.cs


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