コード例 #1
0
        private void InitSerializerAndPlayerSouce()
        {
            serializer = new DepthCodeMotionFrameSerializer();
            serializer.JpegCompression    = 60;
            serializer.UsersOnly          = false;
            serializer.DownSize640to320   = false;
            serializer.IncludeUserFrame   = true;
            serializer.CompressionQuality = InfoStrat.MotionFx.PointCloud.CompressionQuality.High;

            playerSource = new PointCloudPlayerSource(serializer);
            playerSource.MotionFrameAvailable += new EventHandler <MotionFrameAvailableEventArgs>(playerSource_MotionFrameAvailable);
            playerSource.StatusChanged        += new EventHandler(playerSource_StatusChanged);
            playerSource.PlaybackEnded        += new EventHandler(playerSource_PlaybackEnded);

            KinectSensor sensor = (from sensorToCheck in KinectSensor.KinectSensors where sensorToCheck.Status == KinectStatus.Connected select sensorToCheck).FirstOrDefault();

            if (sensor != null)
            {
                pointRecorder = new PointCloudStreamRecorder(serializer);
            }
            else
            {
                cbxKinect.IsEnabled = false;
                cbxKinect.IsChecked = false;
            }
        }
コード例 #2
0
        private void Cleanup()
        {
            if (pointCloudFrameViewer != null &&
                pointCloudFrameViewer.pointCloudImage != null)
            {
                pointCloudFrameViewer.pointCloudImage.Dispose();
            }

            if (playerSource != null)
            {
                playerSource.Dispose();
                playerSource = null;
            }
            if (pointRecorder != null)
            {
                pointRecorder.Dispose();
                pointRecorder = null;
            }

            if (sensorDevice != null)
            {
                sensorDevice.Dispose();
                sensorDevice = null;
            }
        }
コード例 #3
0
        private void InitSerializer()
        {
            serializer = new DepthCodeMotionFrameSerializer();
            serializer.JpegCompression    = 60;
            serializer.UsersOnly          = false;
            serializer.DownSize640to320   = false;
            serializer.IncludeUserFrame   = true;
            serializer.CompressionQuality = InfoStrat.MotionFx.PointCloud.CompressionQuality.High;

            playerSource = new PointCloudPlayerSource(serializer);
            playerSource.MotionFrameAvailable += new EventHandler <MotionFrameAvailableEventArgs>(playerSource_MotionFrameAvailable);

            playerSource.Load("Recording/", "frame*.mfx", "Recording/kinectaudio.wav");
        }
コード例 #4
0
        public ArtofKinectRecorderWindow()
        {
            InitializeComponent();

            frameQueue                = new WorkQueue <MotionFrame>();
            frameQueue.Callback       = ProcessFrame;
            frameQueue.MaxQueueLength = 5;

            InitSensor();
            InitSerializer();
            InitSoundCapture();
            CreateViews();
            lastFPSCheck = DateTime.Now;

            Application.Current.Exit += (s, e) =>
            {
                this.CurrentFrameViewer = null;
                pointCloudFrameViewer.pointCloudImage.Dispose();
                //pointCloudFrameViewer2.Deactivate();
                //pointCloudFrameViewer2.pointCloudImage.Dispose();
                if (playerSource != null)
                {
                    playerSource.Dispose();
                    playerSource = null;
                }

                if (soundRecording != null)
                {
                    soundRecording.Stop();
                    soundRecording.Dispose();
                    soundRecording = null;
                }
                if (sensorDevice != null)
                {
                    sensorDevice.Dispose();
                    sensorDevice = null;
                }
                if (frameQueue != null)
                {
                    frameQueue.Dispose();
                    frameQueue = null;
                }
            };
        }