Reputation: 21
I am trying to follow a youtube tutorial on how I would be able to upload a video on a picture box using Emgu.Cv (link to the video) but I get this error :
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
How can I fix it?
This is my code:
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);
}
}
}
}
}
Upvotes: 2
Views: 1440
Reputation: 51
VideoCapture.GetCaptureProperty(...)
no longer exists.
Instead, try using VideoCapture.Get(...)
It's the same method, it just got renamed.
So in your case:
TotalFrames = Convert.ToInt32(videocapture.Get(Emgu.CV.CvEnum.CapProp.FrameCount));
FPS = Convert.ToInt32(videocapture.Get(Emgu.CV.CvEnum.CapProp.Fps));
Upvotes: 5