简体   繁体   中英

I write code for simple camera capture image.but application and camera not getting connected and one unhandle error is showing

I an new in emgu cv c#. I want to create a camera only for simple photocapture from my laptop camera and other camera device connected to my laptop.I dont want video capture only simple photo capture.with one start and one capture button.and will save in particular location.helped would be appreciable.

namespace camera
{
public partial class cameracaps : Form
{
    Capture capturecam=null;
    bool capturingprocess=false;
    Image<Bgr,Byte>imgOrg;
    Image<Gray,Byte>imgproc;



    public cameracaps()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        try
        {

            Capture cam = new Capture();

        }
        catch (NullReferenceException exception)
        {
            MessageBox.Show(exception.Message);
            return;
        }
        Application.Idle += new EventHandler(processFunction);
        capturingprocess=true;

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


    private void Button1_Click(object sender, EventArgs e)
    {
        if(capturingprocess==true)
        {
            Application.Idle-=processFunction;
            capturingprocess = false;
            Button1.Text="play";
        }
        else
        {
            Application.Idle+= processFunction;
            capturingprocess= true;
            Button1.Text="pause";


    }


}

}
}

showing..The type initializer for 'Emgu.CV.CvInvoke' threw an exception. error..indicating error in Capture cam = new Capture(); help me.

这几乎是我们在emgu cv中一直遇到的最大问题之一。首先将dll文件名opencv_core290.dll,open_cvhighgui290.dll复制到您的项目bin,尝试对dll文件使用依赖项跟踪器。从此链接安装依赖项- http://www.emgu.com/wiki/index.php/Download_And_Installation..If它不工作,那么你应该明白,应用越来越与camera.Then连接到我的电脑- >右键单击- >性财产>高级系统设置->系统属性->高级->环境变量->系统变量->路径->编辑->并粘贴C:\\ Emgu \\ emgucv-windows-universal-cuda 2.9.0.1922 \\ bin。然后按OK。重新启动系统,它将起作用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM