Emgucv摄像头使用
1、引用
using Emgu.CV;
using Emgu.CV.CvEnum;
2、引用变量
private VideoCapture _capture = null;
private Mat _frame;
3、VideoCapture需要加载方法
private void ProcessFrame(object sender, EventArgs e)
{
if (_capture != null && _capture.Ptr != IntPtr.Zero)
{
_capture.Retrieve(_frame, 0);
imageBox1.Image = _frame;//imageBox1显示控件
}
}
4、开启摄像头
private void btnOpenCapture_Click(object sender, EventArgs e)
{
_capture = new VideoCapture();
_capture.ImageGrabbed += ProcessFrame;
_frame = new Mat();
if (_capture != null) _captur