【问题标题】:The type or namespace name 'Capture' could not be found EMGU找不到类型或命名空间名称“Capture” EMGU
【发布时间】:2018-04-24 01:42:30
【问题描述】:

我正在测试 EMGU 的学校作业,我正在关注 this 教程以基本了解 EMGU 的工作方式,但我遇到了问题。

这是我的代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.UI;

namespace FacialRecognition
{
    public partial class Form1 :Form
    {
        private Capture _capture;
        bool CapturingProcess = false;
        Image<Bgr, Byte> imgOrg;
        Image<Gray, Byte> imgProc;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try {
                _capture = new Capture(CaptureType.DShow);
            } catch(NullReferenceException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
        }

        void processFunction(object sender, EventArgs e)
        {
            imgOrg = _capture.QueryFrame();
            if(imgOrg == null) return;
            imgProc = imgOrg.InRange(new Bgr(50, 50, 50), new Bgr(255, 255, 255));
            imgProc = imgProc.SmoothGaussian(9);
            original.Image = imgOrg;
            processed.Image = imgProc;
        }
    }
}

但是,我得到了错误:

The type or namespace name 'Capture' could not be found (are you missing a using directive or an assembly reference?)

它提示using System.Text.RegularExpressions;,这很奇怪。

我猜我遗漏了一些东西,但我引用了所有 DLL 在教程中。以下是一些截图:

Solution Explorer(设置为Copy always

ReferencesEmgu.CV.World.NetStandard1_4.dllEmgu.CV.World.dll 发生冲突)

【问题讨论】:

  • 有解决方案吗?

标签: c# visual-studio emgucv


【解决方案1】:

在 EMGU 的新版本中,Capture 已重命名为 VideoCapture,请尝试

private VideoCapture _capture;

【讨论】:

    【解决方案2】:

    您可以考虑在 EMGU.CV NuGet 包 (http://www.emgu.com/wiki/index.php/Main_Page) 中使用 Emgu.CV.VideoCapture 而不是 Capture。因此,您的声明变为:

    private VideoCapture _capture;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-12
      • 2011-05-13
      • 2013-03-25
      • 2012-06-19
      • 2017-11-29
      • 2012-09-27
      • 2011-05-06
      相关资源
      最近更新 更多