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


C# Capture.GetCaptureProperty方法代码示例

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


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

示例1: write

        public void write() {
            int codec = Emgu.CV.CvInvoke.CV_FOURCC('P', 'I', 'M', '1');

            int fps = 25;
            if (list_timestamps.Count > 0)
            {
                String tempvideopath = Program.getConfiguration().Mediafolderpath + @"\" + list_timestamps[0].ToString() + ".mpg";
                Capture tempcapture = new Capture(tempvideopath);
                fps = (int)tempcapture.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_FPS);
                tempcapture.Dispose();
            }

            VideoWriter videowriter = new VideoWriter(videopath, codec, fps, 640, 480, true);
            

            for (int i = 0; i < list_timestamps.Count; i++)
            {
                videopath = Program.getConfiguration().Mediafolderpath + @"\" + list_timestamps[i].ToString() + ".mpg";
                try
                {
                    Capture joincapture = new Capture(videopath);
                    Image<Bgr, byte> frame = joincapture.QueryFrame();
                    for (int n = 1; n < 15; n++)
                        joincapture.QueryFrame();

                    while (frame != null)
                    {
                        videowriter.WriteFrame(frame);
                        frame = joincapture.QueryFrame();
                    }
                    joincapture.Dispose();

                    // Notify main frame to update its progressbar
                    ExportVideoProgressEventArgs e = new ExportVideoProgressEventArgs(i);
                    DoneAppendingRallyVideoEvent(this, e);
                }
                catch (NullReferenceException) { Console.WriteLine("unreadable video file"); }
            }
            videowriter.Dispose();
        
        }
开发者ID:beachscouter,项目名称:BeachScouter,代码行数:41,代码来源:ExportVideoThread.cs

示例2: Initialise

		public void Initialise(string filename)
		{
			Close();
			try
			{
				_Capture = new Capture(filename); //create a video player
				FCaptureFPS = _Capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS);
				Length = _Capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_COUNT) / FCaptureFPS;
				FCapturePeriod = (int)(1000.0d / FCaptureFPS);
			}
			catch
			{
				_Status = "Player open failed";
				return;
			}

			_Status = "Player open success";
			HasCapture = true;

			Image.FrameAttributesChanged = true;

			Filename = filename;
			CaptureThreadRun = true;
			CaptureThread = new Thread(fnCapture);
			CaptureThread.Start();
		}
开发者ID:phlegma,项目名称:VVVV.Nodes.EmguCV,代码行数:26,代码来源:VideoPlayerNode.cs

示例3: Main

    static void Main(string[] args)
    {
      navigationMatrix = new Matrix3D();
      navigationMatrix.Translate(new Vector3D(0, 100, 110));
      navigationMatrix.Scale(new Vector3D((double)1 / 5, (double)1 / 5, (double)1 / 5));

      displayProfile = new Bin[Bin.RANGEL, Bin.RANGEA, Bin.RANGEB];
      for (int l = 0; l < Bin.RANGEL; l++)
        for (int a = 0; a < Bin.RANGEA; a++)
          for (int b = 0; b < Bin.RANGEB; b++)
            displayProfile[l, a, b] = new Bin(l, a, b);

      PopulateProfile(displayProfile, navigationMatrix);

      String path = Environment.CurrentDirectory + PATH_TO_VIDEO;
      if (!System.IO.File.Exists(path))
        return;


      //Opens the movie file
      capture = new Capture(path);
      double fps = capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS);

      //Reads frame by frame
      Timer timer = new Timer(1000 / fps);
      timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
      timer.Start();

      Console.Read();
    }
开发者ID:hcilab-um,项目名称:STColorCorrection,代码行数:30,代码来源:Program.cs

示例4: frameProcessing

 private void frameProcessing()
 {
     _capture = new Capture(_file);
     totalFrameCount = _capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount);
     progressBar1.Maximum = (int)totalFrameCount;
     timer.Start();
     _capture.ImageGrabbed += ProcessFrame;
     if (timer.ElapsedMilliseconds == 1000) _capture.Stop();
 }
开发者ID:shairhem,项目名称:Prototype2,代码行数:9,代码来源:Form2.cs

示例5: Main

        static void Main(string[] args)
        {
            /* One File
            string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string workingDir = @"E:\REDID\vids";//Path.Combine(desktop, "test", "Dancing_Resized");
            string videoName = "pos_030.avi";
            */

            string workingDir = @"C:\Users\Paolo\Desktop\crowd_results\New folder";
            string outDir = @"C:\Users\Paolo\Desktop\crowd_results";
            int maxFrames = 1000;
            string[] files = Directory.GetFiles(workingDir, "*.avi");
            foreach (string f in files)
            {
                string filename = Path.GetFileName(f);
                string outDirFile = Path.Combine(outDir, filename.Remove(filename.Length - 4));

                if (!Directory.Exists(outDirFile))
                    Directory.CreateDirectory(outDirFile);
                else
                {
                    Console.WriteLine("Directory already exists! OVERWRITE?");
                    if ( Console.ReadKey().Key == ConsoleKey.Y)
                    {
                        Directory.Delete(outDirFile, true);
                        CvInvoke.cvWaitKey(100);
                    }
                    else
                        Environment.Exit(1);
                }

                Capture cap = new Capture(f);
                string rootFile = Path.GetFileName(f);
                rootFile = rootFile.Remove(rootFile.Length - 4);
                int totFrames = (int)cap.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_COUNT);
                if (totFrames > maxFrames && maxFrames != 0)
                    totFrames = maxFrames;
                Console.WriteLine("FILE {0}: {1} frames", rootFile, totFrames);
                StreamWriter sw1 = new StreamWriter(Path.Combine(outDirFile, "imageList.txt"));
                for (int frameNumber = 1; frameNumber < totFrames; frameNumber++)
                {
                    IMG currentFrame = cap.QueryFrame();
                    if (currentFrame == null)
                        continue;

                    string fileOut = string.Format("{0}_{1}.jpg", rootFile, frameNumber.ToString("D8"));
                    currentFrame.Save(Path.Combine(outDirFile, fileOut));
                    sw1.Write(fileOut + '\n');
                    if (frameNumber % 100 == 0)
                        Console.WriteLine("Frame {0} written...", frameNumber);

                }
                sw1.Dispose();
            }
        }
开发者ID:paolorota,项目名称:CrowdGroupingFramework,代码行数:55,代码来源:Program.cs

示例6: CameraBL

        public CameraBL()
        {
            try
            {
                // check if all libraries were loaded
                if (DependencyCheck.Execute())
                {
                    // init grabber
                    this.grabber = new Capture();

                    // get current height and width
                    this.FrameWidth = grabber.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_WIDTH);
                    this.FrameHeight = grabber.GetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT);
                }
            }
            catch (NullReferenceException)
            {
                this.IsCameraAvailable = false;
            }
        }
开发者ID:cihanozhan,项目名称:JPEG.Encryption,代码行数:20,代码来源:CameraBL.cs

示例7: CatchImages

        //filename: Catch image from video file
        //ms: Capture every ms. ms = 0 means capture all frames. (24 frames per second)
        public List<string> CatchImages(string fileName, int ms, string outputPath)
        {
            _log.Debug("Start to capture");
            if (string.IsNullOrWhiteSpace(fileName) || string.IsNullOrWhiteSpace(outputPath))
            {
                _log.Error("Cannot catch images from path: " + fileName + " and output to: " + outputPath);
            }
            //List<Image<Bgr, Byte>> imageList = new List<Image<Bgr, Byte>>();
            List<string> imagePath = new List<string>();
            Capture capture = new Capture(fileName);

            double frameCount = capture.GetCaptureProperty(CapProp.FrameCount);
            capture.Dispose();

            int index = 0;
            int fc = (int)frameCount;
            Mat mat = null;
            try
            {
                //TODO: Modified this to change period of capture image.
                while (index < 30/*fc*/)
                {
                    index++;
                    using (capture = new Capture(fileName))
                    {
                        capture.SetCaptureProperty(CapProp.PosFrames, (double)index);

                        using (mat = capture.QueryFrame())
                        {
                            string indexStr = index < 10 ? "0" + index : index.ToString();
                            string imgPath = outputPath + "\\" + indexStr;
                            if (!Directory.Exists(outputPath))
                            {
                                Directory.CreateDirectory(outputPath);
                            }
                            //long quality = 60;
                            //saveJpeg(imgPath, mat.Bitmap, quality);
                            string grayImgName = saveGrayAndThreshold(imgPath, mat.Bitmap);
                            if (!string.IsNullOrEmpty(grayImgName))
                            {
                                imagePath.Add(grayImgName);
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                _log.Error("Exception:", ex);
            }

            return imagePath;
        }
开发者ID:Lionel1204,项目名称:MyCode,代码行数:55,代码来源:CatchImgFromVideo.cs

示例8: SalmonCounter

        public SalmonCounter()
        {
            InitializeComponent();
            _capture = new Capture(videoOne);

            counter = new Counter(_capture.Width);

            bImage = new BlobImage();
            fgDetector = new ForegroundDetector(bImage);
            sTracker = new SalmonTracker(bImage, counter);

            watch = new Stopwatch();
            time = new TimeSpan();

            FPS = (int)_capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps);
            frameCount = (int)_capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount);
            pictureBox1.Width = _capture.Width;
            pictureBox1.Height = _capture.Height;

            show.Width = _capture.Width;
            show.Height = _capture.Height;

            //msec between frames
            msec = (int)(1000 / FPS);

            //set the event handler
            _capture.ImageGrabbed += grabImage;
            _capture.Start();
            watch.Start();
            _frame = new Mat();

            //Start foregroundSegmenter tread and salmon tracker thread
            backgroundSubtractorThread = new Thread(fgDetector.detect);
            backgroundSubtractorThread.Start();
            sTrackerThread = new Thread(sTracker.updateSalmons);
            sTrackerThread.Start();
        }
开发者ID:Ragnar87,项目名称:TrackingAndClassifying,代码行数:37,代码来源:Form1.cs

示例9: faceTrack

        public faceTrack()
        {
            InitializeComponent();

            CvInvoke.UseOpenCL = false;

            _cascadeClassifierFace = new CascadeClassifier(Application.StartupPath + "/haarcascade_frontalface_default.xml");
            _cascadeClassifierEye = new CascadeClassifier(Application.StartupPath + "/haarcascade_eye.xml");

            try
            {
                capturecam = new Capture(0);
                capturecam.SetCaptureProperty(CapProp.Fps, 30);
                capturecam.SetCaptureProperty(CapProp.FrameHeight, 240);
                capturecam.SetCaptureProperty(CapProp.FrameWidth, 320);
                capturecam.SetCaptureProperty(CapProp.AutoExposure, 1);

                trackBarUpdate(trackBarContrast, (int)capturecam.GetCaptureProperty(CapProp.Contrast));
                trackBarUpdate(trackBarBrightness, (int)capturecam.GetCaptureProperty(CapProp.Brightness));
                //trackBarUpdate(trackBarGain, (int)capturecam.GetCaptureProperty(CapProp.Gain));
                trackBarUpdate(trackBarZoom, (int)capturecam.GetCaptureProperty(CapProp.Zoom));

                textBoxTime.Text = "Time: ";
                textBoxCodec.Text = "Codec: ";
                textBoxFrameRate.Text = "Frame: ";

                capturecam.ImageGrabbed += ProcessFrame;
                //Application.Idle += ProcessFrame;

                //original.Image = capturecam.QueryFrame();
            }
            catch (NullReferenceException excpt)
            {
                MessageBox.Show(excpt.Message);
            }
        }
开发者ID:brunoChr,项目名称:visionEstia,代码行数:36,代码来源:faceTrack.cs

示例10: ClickCameraButton

        private void ClickCameraButton(object sender, EventArgs e)
        {
            ClearTimer();

            try
            {
                _capture = new Capture(0);
                double fps = _capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS);
                _cameraTimer.Interval = Convert.ToInt16(1);
                _cameraTimer.Tick += TickCameraTimer;
                _cameraTimer.Start();
            }
            catch (Exception)
            {
                MessageBox.Show("無法找到攝影機,請確定是否有連接");
            }
        }
开发者ID:WindAzure,项目名称:ImageProcessing,代码行数:17,代码来源:ImageProcessForm.cs

示例11: Form1

        public Form1()
        {
            InitializeComponent();

            markedPoints = new Dictionary<string, Point[]>();

            try
            {
                capture = new Capture("kinect_local_rgb_raw_synced.avi");
                capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.PosFrames, currentFrame);
                pictureBox.Image = capture.QueryFrame().Bitmap;

                frameCount = (int) capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount);
                
            } catch ( Exception e)
            {
                Console.WriteLine(e);
            }
        }
开发者ID:tuandnvn,项目名称:ecat,代码行数:19,代码来源:Form1.cs

示例12: InitVideoCapture

 public void InitVideoCapture(string path)
 {
     try
     {
         m_FrameMat = new Mat();
         m_VideoCaptureFilename = path;
         m_VideoCaptureInterface = null;
         m_VideoCaptureInterface = new Capture(m_VideoCaptureFilename);
         m_VideoCaptureInterface.SetCaptureProperty(CapProp.FrameHeight, 640);
         m_VideoCaptureInterface.SetCaptureProperty(CapProp.FrameWidth, 360);
         m_VideoCaptureInterface.SetCaptureProperty(CapProp.Fps, 5);
         m_VideoCaptureInterface.ImageGrabbed += VideoCaptureInterface_ImageGrabbed;
         m_VideoCaptureFrameCount = (int)m_VideoCaptureInterface.GetCaptureProperty(CapProp.FrameCount);
         m_VideoCaptureInterface.Start();
     }
     catch (Exception e)
     {
     }
 }
开发者ID:gussmith23,项目名称:ThirdEyeVIDemo,代码行数:19,代码来源:ServerWork.cs

示例13: frameProcessing

 private void frameProcessing()
 {
     _capture = new Capture(_file);
     totalFrameCount = _capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount);
     _capture.ImageGrabbed += ProcessFrame;
 }
开发者ID:shairhem,项目名称:Prototype2,代码行数:6,代码来源:Form1.cs

示例14: SetFile

        public void SetFile(string filePath)
        {
            if (capture != null)
                capture.Dispose();

            capture = new Capture(filePath);

            nextFrame = capture.QueryFrame();
            if (nextFrame != null)
                isDirty = true;

            this.VideoSize = new Size2((int)capture.GetCaptureProperty( Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH),
                                       (int)capture.GetCaptureProperty( Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT));

            #if false
            Image<Bgr, byte> img = capture.QueryFrame();
            img = capture.QueryFrame();
            ImageViewer viewer = new ImageViewer();
            viewer.Image = img;
            viewer.ShowDialog();
            #endif
        }
开发者ID:fxbit,项目名称:FxGraphicsEngine,代码行数:22,代码来源:MediaPlayer.cs

示例15: SetupCapture

        private void SetupCapture(int Camera_Identifier)
        {
            //update the selected device
            CameraDevice = Camera_Identifier;


            //Dispose of Capture if it was created before
            if (_capture != null) _capture.Dispose();
            try
            {
                //Set up capture device
                _capture = new Capture(CameraDevice);
                _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS, Int16.Parse(fpstext.Text));
                if (resolution.SelectedIndex == 0)
                {
                    _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 480);
                    _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 640);
                }

                if (resolution.SelectedIndex == 1)
                {
                    _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 1000);
                    _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 2000);
                    
                }
                selectedWidth= _capture.Width;
                selectedHeight = _capture.Height;
                
                selectedfps = Convert.ToInt16(_capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS));
               // _capture.ImageGrabbed += ProcessFrame;
              
            }
            catch (NullReferenceException excpt)
            {MessageBox.Show(excpt.Message);}

        }
开发者ID:emote-project,项目名称:Scenario1,代码行数:36,代码来源:Form1.cs


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