C# ';Emgu.CV.Invoke';抛出异常
我是相对论新EmguCV,但我做了很多研究,阅读了一些教程,并通过这个网站寻找答案。所有其他有类似问题的人都被告知将未映射的dll添加到输出文件夹中。我已经这样做了,但仍然收到错误“Emgu.CV.Invoke”引发了异常C# ';Emgu.CV.Invoke';抛出异常,c#,emgucv,C#,Emgucv,我是相对论新EmguCV,但我做了很多研究,阅读了一些教程,并通过这个网站寻找答案。所有其他有类似问题的人都被告知将未映射的dll添加到输出文件夹中。我已经这样做了,但仍然收到错误“Emgu.CV.Invoke”引发了异常 using Emgu.CV; using Emgu.Util; using Emgu.CV.Structure; using AForge; using AForge.Video; using AForge.Video.DirectShow; using AForge.Vi
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.Structure;
using AForge;
using AForge.Video;
using AForge.Video.DirectShow;
using AForge.Video.VFW;
using System.Drawing.Imaging;
using System.IO;
namespace WindowsFormsApplication2
{
public partial class SandBox : Form
{
private bool DeviceExist = false;
public VideoCaptureDevice FinalVideoSource;
public FilterInfoCollection VideoCaptureDevices;
private Capture capture;
private VideoWriter captureOutput;
private void FinalVideoSource_NewFrame(object sender, AForge.Video.NewFrameEventArgseventArgs)
{
Bitmap image = (Bitmap)eventArgs.Frame.Clone();
image.RotateFlip(RotateFlipType.Rotate180FlipY);
pictureBox1.Image = image;
}
public SandBox()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = " ";
FPS.Text = " ";
try
{
VideoCaptureDevices = new FilterInfoCollection(AForge.Video.DirectShow.FilterCategory.VideoInputDevice);
DeviceExist = true;
foreach (AForge.Video.DirectShow.FilterInfo VideoCaptureDevice in VideoCaptureDevices)
{
comboBox1.Items.Add(VideoCaptureDevice.Name);
}
comboBox1.SelectedIndex = 0;
}
catch (ApplicationException)
{
DeviceExist = false;
comboBox1.Items.Add("No device on your system");
}
}
private void Start_Click(object sender, EventArgs e)
{
FinalVideoSource = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
FinalVideoSource.NewFrame += new NewFrameEventHandler(FinalVideoSource_NewFrame);
FinalVideoSource.Start();
label1.Text = "Device running...";
Start.Enabled = false;
Stop.Enabled = true;
timer1.Enabled = true;
capture = new Capture();
captureOutput = new VideoWriter("test.avi", 30, 1280, 720, true);
Image<Bgr, Byte> ImageFrame = capture.QueryFrame();
captureOutput.WriteFrame(ImageFrame);
}
}
使用Emgu.CV;
使用Emgu.Util;
使用Emgu.CV.Structure;
使用冲锋枪;
使用大屏幕视频;
使用forge.Video.DirectShow;
使用forge.Video.VFW;
使用系统、绘图、成像;
使用System.IO;
命名空间Windows窗体应用程序2
{
公共部分类沙盒:表单
{
私有布尔设备存在=错误;
公共视频捕获设备最终视频源;
公共过滤器视频采集设备;
私人捕获;
私人录像机捕获输出;
私有void FinalVideoSource_NewFrame(对象发送方,一个rge.Video.NewFrameEventArgseventArgs)
{
位图图像=(位图)eventArgs.Frame.Clone();
image.RotateFlip(RotateFlipType.Rotate180FlipY);
pictureBox1.图像=图像;
}
公共沙箱()
{
初始化组件();
}
私有void Form1\u加载(对象发送方、事件参数e)
{
标签1.Text=“”;
FPS.Text=“”;
尝试
{
VideoCaptureDevices=新的FilterInFocCollection(arge.Video.DirectShow.FilterCategory.VideoInputDevice);
DeviceExist=true;
foreach(VideoCaptureDevices中的forge.Video.DirectShow.FilterInfo VideoCaptureDevice)
{
comboBox1.Items.Add(VideoCaptureDevice.Name);
}
comboBox1.SelectedIndex=0;
}
捕获(ApplicationException)
{
DeviceExist=false;
comboBox1.Items.Add(“系统上没有设备”);
}
}
私有无效开始\单击(对象发送者,事件参数e)
{
FinalVideoSource=新的VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonitorString);
FinalVideoSource.NewFrame+=新的NewFrameEventHandler(FinalVideoSource_NewFrame);
FinalVideoSource.Start();
标签1.Text=“设备正在运行…”;
Start.Enabled=false;
Stop.Enabled=true;
timer1.Enabled=true;
捕获=新捕获();
captureOutput=新的录像机(“test.avi”,301280720,true);
Image ImageFrame=capture.QueryFrame();
captureOutput.WriteName(ImageFrame);
}
}
在第
capture=new capture()行中抛出错误
。我不知道这个项目有什么问题。我只是想澄清一下,我只是用EmguCV来录制视频,而不是在屏幕上显示。任何帮助都将不胜感激。Emgu.CvInvoke的类型初始值设定项引发了一个异常,它意味着Emgu.CV文件没有通过代码进行检测。这是由于系统依赖性。您需要要进入visual stdio中的“配置管理器”窗口并选择所需的平台,然后根据您的平台复制相应的dll文件(64个适用于x64的dll文件和32位适用于x86的dll文件可从emgu网站下载)。立即复制,不会出现类似emgu.cv.invoke的错误
请原谅我不是emgu用户,但您最好决定是使用RGE还是emgu。此外,在“开始”单击方法中,您似乎正在尝试打开(可能是相同的)设备先从emgu开始,然后再从emgu开始。这不起作用。你只能在程序中使用一次网络摄像头。好的,我来看看只使用emgu还是只使用emgu谢谢。