Jacob Collins
Jacob Collins

Reputation: 21

The type or namespace name 'Capture' could not be found EMGU

I am testing out EMGU for a school assignment, and I am following this tutorial to get a basic understanding with the way EMGU works, but I have a problem.

Here is my code:

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

However, I get the error:

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

and it suggests using System.Text.RegularExpressions;, which is quite strange.

I'm guessing I am missing something, but I referenced all of the DLL's in the tutorial. Here are some screenshots:

Solution Explorer (They are set to Copy always)

References (Emgu.CV.World.NetStandard1_4.dll and Emgu.CV.World.dll were colliding)

Upvotes: 2

Views: 4794

Answers (2)

user889030
user889030

Reputation: 4764

Capture has been renamed to VideoCapture in new versions of EMGU , so try

private VideoCapture _capture;

Upvotes: 6

smondal
smondal

Reputation: 1

You might consider using Emgu.CV.VideoCapture in EMGU.CV NuGet package (http://www.emgu.com/wiki/index.php/Main_Page) instead of Capture. So, your declaration becomes:

private VideoCapture _capture;

Upvotes: 0

Related Questions