【问题标题】:"VideoCapture" does not contain a definiton for "GetCaptureProperty"“视频捕获”不包含“GetCapture 属性”的定义
【发布时间】:2022-01-30 00:04:57
【问题描述】:

我正在尝试遵循 youtube 教程,了解如何使用 Emgu.Cv (link to the video) 在图片框中上传视频,但我收到此错误:

Error   CS1061  'VideoCapture' does not contain a definition for 'GetCaptureProperty'
and no accessible extension method 'GetCaptureProperty' accepting a first argument of type 'VideoCapture' could be found (are you missing a using directive or an assembly reference?)
    AutomatischerKamaramann C:\Users\49157\Desktop\Fixed project\grp09\programm\AutomatischerKamaramann\AutomatischerKamaramann\UserControl2.cs 55  Active

我该如何解决?

这是我的代码:

namespace AutomatischerKamaramann {
    public partial class UserControl2 : UserControl {
        VideoCapture videocapture;
        bool IsPlaying = false;
        int TotalFrames;
        int CurrentFrameNo;
        Mat CurrentFrame;
        int FPS;
        
        public UserControl2() {
            InitializeComponent();
        }

        private void iconButton1_Click(object sender, EventArgs e)
        {
            {  // File path 
                string path = "";
                
                try {// Create open file dialog for opening input video 
           
                    OpenFileDialog fd = new OpenFileDialog(); 
                    //Set the title for file dialog
                    fd.Title = "Bitte wählen Sie eine Videodatei ";
                    // Set the filter
                    fd.Filter = "MP4 Video (*.mp4)|*.mp4|WMV Video (*.wmv)|Quick Movie File (*.mov)|*.mov|";
                    //display the file dialog 
                    DialogResult status = fd.ShowDialog();
                    //Verify the whether user selects file or not using DialogRresult constant value 
                    if (status == DialogResult.OK)
                    {
                        videocapture = new VideoCapture(fd.FileName);
                        TotalFrames = Convert.ToInt32(videocapture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount));
                        TotalFrames = Convert.ToInt32(videocapture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameCount));
                        FPS = Convert.ToInt32(videocapture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps));
                        IsPlaying = true;
                        CurrentFrame = new Mat();
                        CurrentFrameNo = 0;
                        trackBar1.Minimum = 0;
                        trackBar1.Maximum = TotalFrames - 1;
                        trackBar1.Value = 0;
                        Playvideo();

                        // Get the selected file path 
                        path = fd.FileName;
                        // set the selected imput file path to Textbox`"textbox1"
                        textBox1.Text = path;
                    }
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
    }
}

【问题讨论】:

    标签: c# emgucv


    【解决方案1】:

    VideoCapture.GetCaptureProperty(...) 不再存在。 相反,请尝试使用VideoCapture.Get(...) 方法一样,只是改名了。

    所以在你的情况下:

    TotalFrames = Convert.ToInt32(videocapture.Get(Emgu.CV.CvEnum.CapProp.FrameCount));
    FPS = Convert.ToInt32(videocapture.Get(Emgu.CV.CvEnum.CapProp.Fps));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多