0

嗨,我正在开发一个露营捕捉应用程序。我目前正在使用 EmguCV 2.0。我收到以下代码行错误:


Image<Bgr, Byte> image = capture .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


我从这里得到了这个代码。完整的程序代码如下:-


    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);
        }

       

        
    }
    }
4

1 回答 1

0

看起来您忘记声明要捕获的变量。

编辑:我自己从来没有使用过 emgu,我帮不上什么忙,但是在谷歌上几分钟,我偶然发现了http://www.emgu.com/wiki/index.php/Tutorial#Examples这可能会帮助你设置捕获正确地反对。

于 2010-06-12T06:01:29.343 回答