Camera Capture in 7 lines of code: Difference between revisions

From EMGU
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
'''This example requires [[Version_History#Emgu.CV-1.5.0.0|Emgu CV 1.5.0.0]]'''
'''This example requires [[Version_History#Emgu.CV-1.5.0.0|Emgu CV 1.5.0.0]]'''


Excluding the using statements in the beginning, only 7 lines of code are required to perform a camera capture loop.
<source lang="csharp">
<source lang="csharp">
using Emgu.CV;
using Emgu.CV;

Revision as of 21:47, 11 February 2009

This example requires Emgu CV 1.5.0.0

Excluding the using statements in the beginning, only 7 lines of code are required to perform a camera capture loop.

using Emgu.CV;
using Emgu.CV.UI;
using Emgu.CV.Structure;
using System.Drawing;
using System.Windows.Forms;
...

ImageViewer viewer = new ImageViewer(); //create an image viewer
Capture capture = new Capture(); //create a camera captue
Application.Idle += new EventHandler(delegate(object sender, EventArgs e)
{  //run this until application closed (close button click on image viewer)
   viewer.Image = capture.QueryFrame(); //draw the image obtained from camera
});
viewer.ShowDialog(); //show the image viewer