EmguCV"' Emgu.CV.CvInvoke'的类型初始值设定项提出异常"

时间:2015-05-17 19:11:51

标签: c# opencv exception emgucv

使用EmguCV时遇到问题。每当我尝试创建SIFT或SURF检测器时,我都会得到异常"' Emgu.CV.CvInvoke'的类型初始值设定项。抛出异常"。 我已经安装了:安装MSVCRT,将OpenCV和Emgu dll复制到执行目录,添加到解决方案OpenCV和Emgu dll,添加到解决方案Emgu.CV,Emgu.CV.GPU,Emgu.CV.ML,Emgu.CV .UI,Emgu.Util引用。 不幸的是我仍然有例外。我试图建立SURFFeature示例,它运作得很好。这实际上意味着我犯了一些错误,但我无法找到它......请帮助......

以下是代码:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Features2D;
using Emgu.CV.Structure;
using Emgu.CV.UI;
using Emgu.CV.Util;
using Emgu.CV.GPU;

namespace blablabla
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Bitmap waveform_to_file = new Bitmap(2, 2);

                //Emgu.CV.Features2D.SIFTDetector detector = new Emgu.CV.Features2D.SIFTDetector();//(0, 3, 0.04, 10, 1.6);//(400, true, 3, 4);//
                SURFDetector surfCPU = new SURFDetector(500, false);//I got exception on these lines

                Emgu.CV.Util.VectorOfKeyPoint keypoints = new Emgu.CV.Util.VectorOfKeyPoint();

                Emgu.CV.Image<Emgu.CV.Structure.Gray, Byte> waveform_to_file_gray = new Emgu.CV.Image<Emgu.CV.Structure.Gray, byte>(waveform_to_file);

                Emgu.CV.Features2D.ImageFeature<float>[] modKeyPointsArray = surfCPU/*detector*/.DetectFeatures(waveform_to_file_gray, null);

                List<Emgu.CV.Features2D.ImageFeature<float>> modKeyPointsList = new List<Emgu.CV.Features2D.ImageFeature<float>>();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
    }
}

解决方案资源管理器:

http://ifotos.pl/zobacz/4JPG_wwaerwh.jpg

仓/调试:

http://ifotos.pl/zobacz/3JPG_wwaereh.jpg

0 个答案:

没有答案