示例#1
0
        private bool closeWriterSafely()
        {
            if ((writer != null) && (writer.IsOpened))
            {
                stream.OnNewImage -= NewImageGrabbed;
                stream             = null;

                Image <Bgr, byte> frame = null;
                while (imageBuffer.TryDequeue(out frame))
                {
                    //Empty the queue, saving any frames to the file
                    writer.Write(frame.Mat);
                }

                writer.Dispose();
                writer = null;
                return(true);
            }
            else
            {
                //Something may have happened, but this isn't a successful stop, so just try and clean up what we can.
                if (writer != null)
                {
                    writer.Dispose();
                }
                writer = null;
                if (stream != null)
                {
                    stream.OnNewImage -= NewImageGrabbed;
                }
                stream = null;
                return(false);
            }
        }
示例#2
0
        private void btRecord_Click(object sender, EventArgs e)
        {
            if (!isRecording)
            {
                btRecord.Text    = "Finish";
                isRecording      = true;
                lblTimer.Visible = true;

                ConfigRecorder();

                timer.Start();
                startRec = DateTime.Now;
            }
            else
            {
                btRecord.Text    = "Record";
                isRecording      = false;
                lblTimer.Visible = false;

                videoWriterRes.Dispose();

                timer.Stop();
                lblTimer.Text = "Duration: 00:00:00.000";
            }
        }
示例#3
0
文件: Main.cs 项目: bedssys/Bedssys
 private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
 {
     if (videorecord == 1)
     {
         if (videocounter > 100 && videoalert == 1)
         {
             if (label10.InvokeRequired)
             {
                 label10.Invoke(new MethodInvoker(delegate { label10.Text = "Save Video"; }));
             }
             videorecord   = 0;
             videoalert    = 0;
             timer.Enabled = false;
             if (writers != null)
             {
                 try
                 {
                     writers.Dispose();
                 }
                 catch { }
             }
         }
         else
         {
             Bitmap img;
             using (var bmpTemp = new Bitmap("display_sharp.jpg"))
             {
                 img = new Bitmap(bmpTemp);
                 Image <Bgr, Byte> imageCV = new Image <Bgr, byte>(img); //Image Class from Emgu.CV
                 Mat mat = imageCV.Mat;                                  //This is your Image converted to Mat
                 writers.Write(mat);
             }
             videocounter++;
         }
     }
     else
     {
         timer.Enabled = false;
         if (writers != null)
         {
             try
             {
                 writers.Dispose();
             }
             catch { }
         }
     }
 }
        static void Main(string[] args)
        {
            Capture                    file;
            Image <Bgr, Byte>          frame;                                     //Frame from video
            Image <Bgr, Byte>          frame2;                                    //Clone of frame - addresses null frame.Data
            Stack <Image <Bgr, Byte> > frames = new Stack <Image <Bgr, Byte> >(); //Contains frames

            file = new Capture("competition_1_1_xvid.avi");
            VideoWriter videoOutput = new VideoWriter("output.avi", 0, 30, 720, 480, true);

            while (1 == 1)
            {
                frame = file.QueryFrame();
                if (frame == null)
                {
                    break;                      //Break after last frame
                }
                frame2 = frame.Clone();
                frames.Push(frame2);
            }
            Console.WriteLine("Number of frames: {0}", frames.Count);

            while (frames.Count > 0)
            {
                videoOutput.WriteFrame(frames.Pop());
            }

            videoOutput.Dispose();
        }
示例#5
0
        private void Recordbutton_Click(object sender, EventArgs e)
        {
            if (Recordbutton.Text == "¼ÖÆ")
            {
                if (MessageBox.Show("¿ªÊ¼Â¼ÖÆÂð£¿", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    flag = true;
                    //vw = new VideoWriter("E:\\1.avi", -1, 25,(int)CvInvoke.cvGetCaptureProperty(capture, Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH), (int)CvInvoke.cvGetCaptureProperty(capture, Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT), true);

                    char [] codec = { 'D', 'I', 'V', 'X' };

                    vw = new VideoWriter("2.avi", VideoWriter.Fourcc(codec[0], codec[1], codec[2], codec[3]),
                                         25,
                                         new Size(_capture0.Width, _capture0.Height),
                                         true);
                    Application.Idle += new EventHandler(ProcessFrame);
                    Recordbutton.Text = "ÔÝÍ£";
                }
            }
            else
            {
                if (MessageBox.Show("ֹͣ¼ÖÆÂð£¿", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    flag = false;
                    vw.Dispose();
                    Application.Idle -= new EventHandler(ProcessFrame);
                    Recordbutton.Text = "¼ÖÆ";
                }
            }
        }
示例#6
0
        /// <summary>
        /// Records a video using Emgu through the webcam and uploads it
        /// </summary>
        /// <param name="seconds">how many seconds to record for</param>
        /// <returns>url to the video file</returns>
        private string UploadVideoCapture(int seconds)
        {
            string path = FileHelper.GetTemporaryFilePath("MicrosoftTutorial.mp4");

            VideoWriter writer = new VideoWriter(path, VideoWriter.Fourcc('M', 'P', '4', 'V'), 10, new Size(640, 480), true);

            // keep track of time during recording
            DateTime start = DateTime.Now;
            DateTime future;

            Capture capture = new Capture();

            do
            {
                future = DateTime.Now;

                // write the frame
                writer.Write(capture.QueryFrame());
            } while (DateTime.Compare(start.AddSeconds(seconds), future) > 0);

            // close the webcam connection
            writer.Dispose();
            capture.Dispose();

            string url = HTTPHelper.Upload(path);

            FileHelper.DeleteFile(path);

            return(url);
        }
        public void CreateVideo(int lastStep, int snapTime)
        {
            if (!Directory.Exists(outputPath))
            {
                Directory.CreateDirectory(outputPath);
            }
            var a = new VideoWriter(outputPath + videoName, Emgu.CV.CvInvoke.CV_FOURCC('M', 'J', 'P', 'G'), 30, width, height, true);

            for (var i = 0; i <= lastStep; i++)
            {
                if ((i + 1) % 100 == 0)
                {
                    GC.Collect();
                }
                if ((i + 1) % 50 == 0)
                {
                    System.Console.WriteLine("making movie: " + i);
                }

                if ((i + 1) % snapTime != 0)
                {
                    continue;
                }
                var addPic = new Bitmap(Image.FromFile(inputPath + i + ".jpg"));
                a.WriteFrame(new Image <Rgb, byte>(addPic));
                addPic.Dispose();
                Thread.Sleep(20);
            }

            a.Dispose();
        }
示例#8
0
        static void Main()
        {
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";runtimes/win10-x64/"); //only needed if projects are directly referenced

            //var reader = new CameraCapture(0); //capture from camera
            var reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome.mp4"));

            reader.Open();

            var writer = new VideoWriter(@"output.avi", reader.FrameSize, /*reader.FrameRate does not work Cameras*/ 30); //TODO: bug: FPS does not work for cameras

            writer.Open();

            Bgr <byte>[,] frame = null;
            do
            {
                reader.ReadTo(ref frame);
                if (frame == null)
                {
                    break;
                }

                using (var uFrame = frame.Lock())
                { writer.Write(uFrame); }

                frame.Show(autoSize: true);
            }while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            reader.Dispose();
            writer.Dispose();

            ImageUI.CloseAll();
        }
 private void StopActivity()
 {
     IsActive = false;
     InternalVideoWriter?.Release();
     InternalVideoWriter?.Dispose();
     InternalVideoWriter = null;
 }
示例#10
0
        private void Record(int num)
        {
            if (num == 0)
            {
                nameVideo = String.Format("{0}{1}{2}", directorioK1V, DateTime.Now.ToString("MMddyyyyHmmss"), ".avi");

                using (VideoWriter vi = new VideoWriter(nameVideo, 0, 30, 640, 480, true))
                {
                    for (int i = 0; i < videoColor1.Count(); i++)
                    {
                        vi.WriteFrame <Bgr, Byte>(videoColor1[i]);
                    }
                    vi.Dispose();
                }

                nameVideo = string.Empty;
                videoColor1.Clear();
            }
            else
            {
                nameVideo = String.Format("{0}{1}{2}", directorioK2V, DateTime.Now.ToString("MMddyyyyHmmss"), ".avi");

                using (VideoWriter vi = new VideoWriter(nameVideo, 0, 30, 640, 480, true))
                {
                    for (int i = 0; i < videoColor2.Count(); i++)
                    {
                        vi.WriteFrame <Bgr, Byte>(videoColor2[i]);
                    }
                    vi.Dispose();
                }

                nameVideo = string.Empty;
                videoColor2.Clear();
            }
        } //fin Record()
示例#11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="angle"></param>
        /// <param name="outpath"></param>
        /// <param name="mode360"></param>
        public static void saveFisheyeMovie2equirectangular(string path, int angle, string outpath, bool mode360)
        {
            var video = new VideoCapture(path);
            var size  = new Size();
            var len   = video.FrameHeight > video.FrameWidth ? video.FrameHeight : video.FrameWidth;

            size.Height = len;
            size.Width  = mode360 ? len * 2 : len;
            var writer = new VideoWriter(outpath, FourCC.H264, video.Fps, size);
            var matrix = findCorrespondingFisheyePointMatrix(len, angle);

            while (video.IsOpened())
            {
                var frame = new Mat();
                if (video.Read(frame))
                {
                    //var f = fisheye2equirectangular(frame, angle, mode360);
                    var f = fisheye2equirectangular(frame, len, mode360, matrix);
                    // 変換して書き込み
                    writer.Write(frame);
                }
                else
                {
                    break;
                }
                frame.Dispose();
            }
            video.Dispose();
            writer.Dispose();
        }
示例#12
0
        public void Combine(int origin1_start, int origin1_count)
        {
            if (mode != 2)
            {
                return;
            }
            cap1.SetCaptureProperty(CapProp.PosFrames, origin1_start);

            Mat mat = new Mat();

            writer = new VideoWriter(filename_dest, -1, (int)fps1, new Size(cap1.Width, cap1.Height), true);
            //第一个文件
            if (!writer.IsOpened)
            {
                return;
            }

            for (int i = 0; i < origin1_count; i++)
            {
                mat = cap1.QueryFrame();
                if (mat.IsEmpty)
                {
                    break;
                }
                writer.Write(mat);

                mat.Dispose();
            }


            writer.Dispose();
        }
示例#13
0
        private static async Task RecordVideo(string videoname, int seconds)
        {
            VideoWriter writer = null;

            try
            {
                await Task.Delay(seconds * 1000);

                writer = new VideoWriter(videoname, VideoWriter.FourCC('M', 'J', 'P', 'G'), _fps, new Size(CAPTUREWIDTH, CAPTUREHEIGHT), true);

                lock (frameLoker)
                {
                    LogUtil.Log($"start write buffer", LogLevel.Info);

                    foreach (var buffer in matBuffer)
                    {
                        writer.Write(buffer);
                    }
                }

                LogUtil.Log($"{videoname} Record {seconds} seconds finished", LogLevel.Info);
            }
            catch (Exception e)
            {
                LogUtil.LogException(e);
            }

            finally
            {
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
        }
示例#14
0
        public VideoGenerator(ImageDetails imgdet1, ImageDetails imgdet2, VectorOfPointF points1, VectorOfPointF points2, int fpsUser, float alphaUser, string path)
        {
            this.destinationPath = path;
            sizeOfVid            = GetSizeOfImages(imgdet1, imgdet2);
            float      alpha = 0.0f;
            MorphImage m;

            try
            {
                videoWriter = new VideoWriter(fileName: destinationPath, fps: fpsUser, size: sizeOfVid, isColor: true);
                while (alpha < 1.0f)
                {
                    m = new MorphImage(imgdet1, imgdet2, points1, points2, alpha);
                    Image <Bgr, byte> morphedImage = m.GetMorphedImageI();
                    videoWriter.Write(morphedImage.Mat);
                    alpha += alphaUser;
                    morphedImage.Dispose();
                }
                if (videoWriter.IsOpened)
                {
                    videoWriter.Dispose();
                }
                MessageBox.Show($"Completed");
            }
            catch (Exception)
            {
                MessageBox.Show("The program has run out of memory. Try to use fewer images, a larger alpha value (0.05 - 0.1) or a lower FPS count (25)");
            }
        }
        private void writeVideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (capture == null)
            {
                return;
            }
            int               fourcc          = Convert.ToInt32(capture.GetCaptureProperty(CapProp.FourCC));
            int               weidht          = Convert.ToInt32(capture.GetCaptureProperty(CapProp.FrameWidth));
            int               height          = Convert.ToInt32(capture.GetCaptureProperty(CapProp.FrameHeight));
            string            destinationPath = @"C:\Video\out.mp4";
            VideoWriter       writer          = new VideoWriter(destinationPath, fourcc, fps, new Size(weidht, height), true);
            Image <Bgr, byte> logo            = new Image <Bgr, byte>("C:\\Pictures\\3.jpg");
            Mat               m = new Mat();

            while (frameN < 500)
            {
                capture.Read(m);
                //add logo part
                Image <Bgr, byte> img = m.ToImage <Bgr, byte>();
                img.ROI = new Rectangle(0, 0, logo.Width, logo.Height);
                logo.CopyTo(img);
                img.ROI = Rectangle.Empty;
                //
                writer.Write(img.Mat);
                frameN++;
            }
            if (writer.IsOpened)
            {
                writer.Dispose();
            }
            MessageBox.Show("Complited.");
        }
示例#16
0
 private void VideoRecordStopButton_Click(object sender, EventArgs e)
 {
     if (StartMonitoringControl)
     {
         if (VideoRecordingControl)
         {
             Application.Idle -= ProcessFrameVideoRecord;
             Application.Idle += ProcessFrame;
             if (vw.IsOpened)
             {
                 vw.Dispose();
             }
             MetroFramework.MetroMessageBox.Show(this, "\n\nVideo Recorded", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
             VideoRecordInfoLabel.Text = "";
             VideoRecordingControl     = false;
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(this, "\n\nVideo Recording Must Be Started Before", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MetroFramework.MetroMessageBox.Show(this, "\n\nBefore The Image Should Be Taken", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        /// <summary>
        /// 将该文件夹下的图片导出成视频
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var         files     = Directory.GetFiles(rootPath, "*.jpg");
                int         count     = files.Count();
                int         fps       = 12; //帧频
                int         i         = 0;
                string      picname   = files[0];
                Bitmap      map       = new Bitmap(picname);
                int         frameW    = map.Width;
                int         frameH    = map.Height;
                string      videoname = "./video/out.mp4";
                VideoWriter writer    = new VideoWriter(videoname, VideoWriter.Fourcc('X', 'V', 'I', 'D'), fps, new System.Drawing.Size(frameW, frameH), true);
                map.Dispose();
                while (i < count)
                {
                    picname = files[i];
                    var img = CvInvoke.Imread(picname, ImreadModes.Color);
                    writer.Write(img);
                    i++;
                }
                writer.Dispose();

                MessageBox.Show("导出视频成功!", "VideoPost", MessageBoxButton.OK);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
示例#18
0
        static void Main()
        {
            //var reader = new CameraCapture(0); //capture from camera
            var reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome.mp4"));

            reader.Open();

            var writer = new VideoWriter(@"output.avi", reader.FrameSize, /*reader.FrameRate does not work Cameras*/ 30); //TODO: bug: FPS does not work for cameras

            writer.Open();

            Bgr <byte>[,] frame = null;
            do
            {
                reader.ReadTo(ref frame);
                if (frame == null)
                {
                    break;
                }

                using (var uFrame = frame.Lock())
                { writer.Write(uFrame); }

                frame.Show(scaleForm: true);
            }while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            reader.Dispose();
            writer.Dispose();

            UI.CloseAll();
        }
示例#19
0
        public void readWriteVideo(String filePath, String name, String outputFolder)
        {
            String       outputVideo = outputFolder + "\\" + name.Split('.')[0] + ".avi";
            double       TotalFrame;
            double       Fps;
            int          FrameNo = 0;
            VideoCapture capture = new VideoCapture(filePath);

            TotalFrame = capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount);
            Fps        = capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps);
            int fourcc = Convert.ToInt32(capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FourCC));
            int Width  = Convert.ToInt32(capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth));
            int Height = Convert.ToInt32(capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight));


            //VideoWriter writer = new VideoWriter(outputVideo, VideoWriter.Fourcc('X', '2', '6', '4'), Fps, new Size(Width, Height), true);
            VideoWriter writer = new VideoWriter(outputVideo, VideoWriter.Fourcc('M', 'P', '4', 'V'), Fps, new Size(640, 360), true);
            Mat         m      = new Mat();

            while (FrameNo < TotalFrame)
            {
                capture.Read(m);
                Image <Bgr, byte> frmImage = m.ToImage <Bgr, byte>().Resize(416, 416, Inter.Cubic);
                writer.Write(frmImage.Mat);
                FrameNo++;
            }
            if (writer.IsOpened)
            {
                writer.Dispose();
            }

            Console.WriteLine("Success:  " + outputVideo);
            capture.Stop();
            capture.Dispose();
        }
示例#20
0
 public void Close()
 {
     if (_VideoWriter != null)
     {
         _VideoWriter.Dispose();
         _VideoWriter = null;
     }
 }
示例#21
0
        /// <summary>
        /// 开始或停止录制视频
        /// </summary>
        private void StartEndRecording()
        {
            //开始录制
            if (mStartEndRecording)
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Title            = "选择视频保存位置";
                saveFileDialog.FileName         = "录制视频" + DateTime.Now.ToString("yy-MM-dd");
                saveFileDialog.Filter           = "AVI|*.avi|WMV|*.wmv";
                saveFileDialog.RestoreDirectory = true;

                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    //先关闭本地视频
                    if (!mOpenCloseLocal)
                    {
                        OpenCloseLocalVideo();
                    }
                    //摄像头已关闭,则重新打开摄像头
                    if (mOpenCloseCamera)
                    {
                        int cameraIndex = int.Parse(CbbCameraIndex.Text);
                        OpenCloseCamera(cameraIndex);
                        if (!mIsCameraReady)
                        {
                            return;
                        }
                    }

                    mVideoPath   = saveFileDialog.FileName;
                    mVideoWriter = new VideoWriter(mVideoPath, 25, new Size(mCapture.Width, mCapture.Height), true);

                    BtnRecording.Text     = "停止录制";
                    BtnOpenCamera.Enabled = false;
                    mStartEndRecording    = false;
                }
            }
            //停止录制
            else
            {
                mVideoWriter.Dispose();
                mVideoWriter = null;

                BtnRecording.Text     = "开始录制";
                BtnOpenCamera.Enabled = true;
                mStartEndRecording    = true;

                if (!mIsForceStopRecording)
                {
                    DialogResult result = MessageBox.Show("录制完成,是否打开目录?", "提示", MessageBoxButtons.OKCancel);
                    if (result == DialogResult.OK && mVideoPath != string.Empty)
                    {
                        string folder = mVideoPath.Substring(0, mVideoPath.LastIndexOf("\\"));
                        System.Diagnostics.Process.Start(folder);
                    }
                }
            }
        }
示例#22
0
 private void DisableRecordingAndSaveVideo()
 {
     if (debugMode)
     {
         return;
     }
     camera.ImageGrabbed -= AddFrameToVideo;
     videoWriter.Dispose();
     IsRecordingRadioButton.Invoke(new MethodInvoker(delegate() { IsRecordingRadioButton.Checked = false; }));
 }
示例#23
0
        public override void Stop()
        {
            if (_videoWriter != null)
            {
                _videoWriter.Dispose();
                _videoWriter = null;
            }

            base.Stop();
        }
        public override void Close()
        {
            if (!IsRunning)
            {
                return;
            }

            base.Close();
            FVideoWriter.Dispose();
        }
示例#25
0
        private void WebCameraEvent(object sender, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.C:
            {
                using (var capture = new VideoCapture())
                {
                    var frameNum = 0;

                    var width  = Convert.ToInt32(capture.GetCaptureProperty(CapProp.FrameWidth));
                    var height = Convert.ToInt32(capture.GetCaptureProperty(CapProp.FrameHeight));

                    string newNameMp4 = Name + ".mp4";
                    Size   size       = new Size(width, height);

                    var videoWriter = new VideoWriter(newNameMp4, 10, size, true);

                    var mat = new Mat();    //working with pictures
                    while (frameNum < 100)
                    {
                        capture.Read(mat);
                        videoWriter.Write(mat);
                        frameNum++;
                    }

                    if (videoWriter.IsOpened)
                    {
                        videoWriter.Dispose();
                    }
                    //Close();
                }

                break;
            }

            case Keys.P:
            {
                var    capture    = new VideoCapture();
                string newNameJpg = Name + ".jpg";

                capture.QueryFrame().Bitmap.Save(newNameJpg);
                Close();

                break;
            }

            case Keys.Escape:
            {
                Close();

                break;
            }
            }
        }
示例#26
0
 void OnDestroy()
 {
     CvInvoke.DestroyAllWindows();
     if (writer != null)
     {
         writer.Dispose();
     }
     if (webcam != null)
     {
         webcam.Stop();
     }
 }
 private void StopRecording()
 {
     recordVideo.Text = "Start Recording";
     if (_recording)
     {
         if (_vw.IsOpened)
         {
             _vw.Dispose();
         }
         _recording = false;
     }
 }
示例#28
0
 private void OnClosing(object sender, CancelEventArgs e)
 {
     if (!isCloseRequested)
     {
         if (captureOutput != null)
         {
             captureOutput.Dispose();
             captureOutput = null;
         }
         isCloseRequested = true;
         e.Cancel         = true;
     }
 }
示例#29
0
        private void btnConnectClick(object sender, RoutedEventArgs e)
        {
            if (btnConnect.Content.ToString() == "Connect")
            {
                if (KinectSensor.KinectSensors.Count > 0)
                {
                    this.btnConnect.Content = "Stop";
                    kSensor = KinectSensor.KinectSensors[0];
                    if (kSensor.Status == KinectStatus.Connected)
                    {
                        this.connectStatus.Content = kSensor.Status.ToString();
                    }

                    KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged;
                }
                try
                {
                    kSensor.Start();

                    kSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                    kSensor.ColorFrameReady += KSensor_ColorFrameReady;
                }
                catch
                {
                    this.connectStatus.Content = "Cannot connect Kinect";
                }
            }
            else
            {
                if (kSensor != null && kSensor.IsRunning)
                {
                    if (videoWriter != null)
                    {
                        videoWriter.Dispose();
                    }

                    kSensor.Stop();

                    kSensor.ColorStream.Disable();
                    kSensor.SkeletonStream.Disable();
                    kSensor.Dispose();

                    kSensor                    = null;
                    btnRecord.Content          = "Record";
                    this.btnConnect.Content    = "Connect";
                    this.connectStatus.Content = "Disconnect";
                    this.frameStatus.Content   = "Disconnect";
                    this.count                 = 0;
                }
            }
        }
示例#30
0
        private void DisposeCaptureResources()
        {
            if (capture != null)
            {
                capture.Release();
                capture.Dispose();
            }

            if (outputVideo != null)
            {
                outputVideo.Release();
                outputVideo.Dispose();
            }
        }