Question

I am working On Emgu cv on windows 7 32 bit os and, System.TypeInitializationException Error occurs, i tried every solution; When i run the Examples coming with Emgu it's Ok but when i create my own project the error occurs.

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.Structure;
using Emgu.Util;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
        {
        private Capture cap;
        private bool capinpro;

        public Form1()
        {
            InitializeComponent();
        }


    private void processframe(object o, EventArgs e)
    {

        Image<Bgr, byte> img = cap.QueryFrame();
        imageBox1.Image = img;
    }



    private void button1_Click(object sender, EventArgs e)
    {
        if(cap!=null)
        {

            try
            {
        if (capinpro)
        {   
            Application.Idle += processframe;       
            //i have also tried cap.start();
        }
        else
        {
             Application.Idle -= processframe;
        }


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }




        }
        else
        {
         cap= new Capure();   
        }
    }


}

}

Was it helpful?

Solution

Emgu library was requiring more dll Files, so I pasted all the dlls from the bin folder of Emgu to the path of my EXE file and the problem was solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top