gpt4 book ai didi

c# - 'Emgu.CV.CvInvoke' 的类型初始值设定项抛出异常

转载 作者:太空狗 更新时间:2023-10-29 23:17:08 25 4
gpt4 key购买 nike

我已经编写了简单的程序来使用 EmguCV 在 C# 中的 VS 2010 中打开图像并显示图像,但出现以下异常:

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

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)
{
}
}
}

最佳答案

关于c# - 'Emgu.CV.CvInvoke' 的类型初始值设定项抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9142609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com