您好我正在开发一个campera捕获应用程序。我目前正在使用EmguCV 2.0。我收到以下代码行的错误:
图片图片= 捕获 .QueryFrame();
我添加了所有EmguCV所需的引用,如Emgu.CV,Emgu.CV.UI,Emgu.CV.ML,Emgu.Util,但它仍然会出错:
错误1当前上下文中不存在名称'capture' C:\ Documents and Settings \ TLNA \ my documents \ visual studio 2010 \ Projects \ webcamcapture \ webcamcapture \ Form1.cs 27 38 webcamcapture
我从here获得了此代码。完整的程序代码如下: -
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.UI;
using Emgu.CV.Structure;
using Emgu.CV.ML;
namespace webcamcapture
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
Image<Bgr, Byte> image = capture.QueryFrame();
pictureBox1.Image = image.ToBitmap(pictureBox1.Width, pictureBox1.Height);
}
}
}
答案 0 :(得分:0)
看起来您忘记声明变量以进行捕获。
编辑:我自己从未使用过emgu,我无法提供太多帮助,但谷歌上的几分钟我偶然发现http://www.emgu.com/wiki/index.php/Tutorial#Examples可能会帮助您正确设置捕获对象。