Program crashed after creating new EMGU.CV.Capture

asked 2013-12-29 08:39:03 -0500

itay gravatar image

I'm trying to create a simple program that load a video file and show him in a ImageBox.

I'm using EMGU and OpenCV(for a later algorithm) in order to do it.

First I've got all the possible errors from EMGU, like

Unable to load DLL 'opencv_core242'

The type initializer for 'Emgu.CV.CvInvoke' threw an exception.

After I'm fixed them, a really strange thing is happened.

After the definition of the Capture, sometimes the program crashed and sometimes not. It's not depend in the video, cause some video can be opened 1 time, but in the other time it can't.

This is my code(This is very basic code):

 public frmChild(String _url)
        {
            InitializeComponent();
            url = _url;



            if (_Capture != null)
                _Capture.Dispose();

            _Capture = new Capture(url);
         }
private void PlayButton_Click(object sender, EventArgs e)
        {

            if(Stopped || Paused)
                Application.Idle += ProcessFrame;

            Paused = false;
            Stopped = false;
        }

private void ProcessFrame(object sender, EventArgs arg)
        {
            imageBox1.Image = _Capture.QueryFrame();
        }

The program crashed in this line :

_Capture = new Capture(url);

This is the crash message:

image description

What should I do?

Thanks

edit retag flag offensive close merge delete