关于使用EmguCV出现 “无法加载 DLL“cvextern”: 找不到指定的程序” 的解决方法

1.按要求将Emgu.CV.UI,Emgu.CV.World,Emgu.CV.World,Emgu.CV.GL添加引用到项目。

2.然后将WinForm添加一个按钮和PictureBox,后台代码如下:

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.CV.ML;
using Emgu.CV.Util;
namespace EmguForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();
            dialog.Filter = "图片(*.jpg/*.png/*.gif/*.bmp)|*.jpg;*.png;*.gif;*.bmp";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var filename = dialog.FileName;
                Image<Bgr, Byte> img = new Image<Bgr, Byte>(filename);
                Image<Bgr, byte> dest = new Image<Bgr, byte>(CvInvoke.cvGetSize(img));
                CvInvoke.cvCopy(img, dest, IntPtr.Zero);
                pictureBox1.Image = dest.ToBitmap();
            }
        }
    }
}
3.运行报错误:“ 关于使用EmguCV出现 “无法加载 DLL“cvextern”: 找不到指定的程序” 的解决方法

4.通过网上查找原因尝试,结果方案如下,将Emgu安装文件下(64位)C:\Emgu\emgucv-windesktop 3.3.0.2824\bin\x64下的Dll复制到Winform项目Debug文件夹下即可正常运行加载图片。

5.问题原因:项目添加引用Emgu.CV.UI等的四个库对cvextern.dll存在依赖。

猜你喜欢

转载自blog.csdn.net/iandbeyond/article/details/79225842