当前上下文中不存在名称捕获错误

发布于 2024-09-05 13:10:01 字数 1385 浏览 3 评论 0原文

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


Imageimage = 捕获.QueryFrame();


我已经添加了 EmguCV 的所有必需引用,例如 Emgu.CV、Emgu.CV.UI、Emgu.CV.ML、Emgu.Util,但仍然给出错误:

Error 1 The name '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);
        }

       

        
    }
    }

Hi I am developing a campera capture application. I am currently using EmguCV 2.0. I get an error with the following line of code :


Image<Bgr, Byte> image = capture.QueryFrame();


I have added all the required references of EmguCV like Emgu.CV,Emgu.CV.UI, Emgu.CV.ML, Emgu.Util, but still it gives a error saying :

Error 1 The name 'capture' does not exist in the current context C:\Documents and Settings\TLNA\my documents\visual studio 2010\Projects\webcamcapture\webcamcapture\Form1.cs 27 38 webcamcapture


I got this code from here. The full program code is given below:-


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

       

        
    }
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏至、离别 2024-09-12 13:10:01

看起来您忘记声明一个用于捕获的变量。

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

Looks like you forgot to declare a variable for capture.

Edit: never having used emgu myself, i cant help much, but a couple mins on google and i stumbled across http://www.emgu.com/wiki/index.php/Tutorial#Examples which might help you set up the capture object properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文