pit*_*ani 5 c# image exception emgucv
我已经编写了简单的程序来打开图像并在C#中使用EmguCV在VS 2010中显示图像,但是我得到以下异常:
'Emgu.CV.CvInvoke'的类型初始值设定项引发了异常.
在线 Image<Bgr, Byte> myimg = new Image<Bgr, Byte>(openfile.FileName);
这是我的代码..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.Structure;
namespace imgdisplay2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void imageBox1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog();
if (openfile.ShowDialog() == DialogResult.OK)
{
// imageBox1 =new Emgu.CV.UI.ImageBox() ;
Image<Bgr, Byte> myimg = new Image<Bgr, Byte>(openfile.FileName);
pictureBox1.Image = myimg.ToBitmap();
//imageBox1.Image =myimg ;
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
您应该按照 emgu 官方 wiki 中概述的建议解决 CVInvoke 异常: