C#_ use emgu3.0 to operate the local camera __c#

Source: Internet
Author: User
C#_ uses EMGUCV 3.0 to operate the local camera

First we want to download emgu3.0, install package, [download Address]http://www.emgu.com/wiki/index.php/download_and_installation

After the installation is complete, according to the platform of the application you want to develop, select the four DLL files in the x86 or x64 copy in the bin directory of the installation directory: Cvextern.dll + msvcp120.dll + msvcr120.dll + opencv_ Ffmpeg310_64.dll/opencv_ffmpeg310.dll to the Bin/debug directory of the application's development directory, add references to all DLL files in the installation directory bin directory, including: Cvextern.dll + Emgu.CV.Contrib.dll + Emgu.CV.Cuda.dll + Emgu.CV.dll + Emgu.CV.ML.dll + Emgu.CV.OCR.dll + Emgu.CV.Shape.dll + Emgu.CV.Stit Ching.dll + Emgu.CV.Superres.dll + Emgu.CV.UI.dll + Emgu.CV.UI.GL.dll + Emgu.CV.VideoStab.dll + Emgu.Util.dll + msvcp120.d ll + msvc120.dll+ Opencv_ffmpeg300_64.dll; it is best to copy all the above files to the debug directory.

After doing the above preparation, we have to do an operation. Add the Imagebox control, which is in the Emgu.CV.UI.dll file and is not provided by the. NET Platform. To add a control, open the Toolbox panel, right-click a blank area of the Toolbox, select Add tab and name Emgu.ui.

Find the Emgu.CV.UI.dll file and drag it into the new tab we just created, and our tab will have a few more controls.

Go to Design view and add Imagebox to the form

Official Add Control Tutorial link (English):< link > Http://www.emgu.com/wiki/index.php/Add_ImageBox_Control

When you finish adding controls, you can start writing code.

Using EMGU.CV;
Using System;

Using System.Windows.Forms; namespace Recognizeface {public partial class Form1:form {public Form1 () {Initial
        Izecomponent ();
        Private Capture cap;

        private bool isprocess = false; void Button1_Click (object sender, EventArgs e) {if (cap!= null) {if
                    Process) {application.idle-= new EventHandler (Processfram); Button1.
                Text = "stop!";
                    else {application.idle + = new EventHandler (Processfram); Button1.
                Text = "start!";
            } isprocess =!isprocess;
                else {try {cap = new Emgu.CV.Capture (); catch (NullReferenceException expt) {
                    MessageBox.Show (EXPT.
                message); }} private void Processfram (object sender, EventArgs arg) {ImageBox1. Image = Cap.
        Queryframe ();
 }
    }
}

The code is simple, primarily a configuration issue. The code does not elaborate.

Exception: If an exception occurs at run time: the type initializer for "Emgu.CV.CvInvoke" throws an exception. "As far as I know now, it may be because there is no Cvextern.dll + msvcp120.dll + msvcr120.dll + opencv_ffmpeg310_64.dll/opencv_ffmpeg310.dll These four DLL files are added to the debug directory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.