I am using EmguCV to query frames sequentially from a capture that I defined as following:
Capture cap;
private void Form1_Load(object sender, EventArgs e)
{
cap = new Capture();
cap.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 1280);
cap.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 720);
timer1.Interval = 20;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
Image<Bgr, byte> img = cap.QueryFrame();
pictureBox1.Image = img.Bitmap;
}
and then I make some operations like tracking objects, but it’s have very bad performance i mean every about 200 ms I get new frame when removing the lines 5,6 that set the width, height i get very good performance…
my question how can i get good performance…
Using a timer to acquire images from a web camera is not suggested as it does result in a slow performance. It is much better to acquire a frame when you’re program is doing very little i.e. not processing the frame. Look at the code example CameraCaptue for reference but your code should look something like this.
With this method you are not limited to how fast the timer goes but what your program is doing and how fast your camera can acquire frames at it’s resolution. Since it is quite a high res type (720p) I would expect 15 FPS unless you paid out for a higher frame rate type.
Hope this helps,
Cheers,
Chris