我为简单的相机捕获图像编写代码,但是应用程序和相机未连接,并且显示一个未处理错误
本文关键字:相机 显示 连接 未处理 错误 一个 简单 图像 代码 应用程序 | 更新日期: 2023-09-27 18:34:25
I an new in emgu cv c#.我只想创建一个相机,仅用于从我的笔记本电脑相机和连接到笔记本电脑的其他相机设备进行简单的照片捕获。我不希望视频捕获只有简单的照片捕获,只需一个开始和一个捕获按钮,并且将保存在特定位置。
namespace camera
{
public partial class cameracaps : Form
{
Capture capturecam=null;
bool capturingprocess=false;
Image<Bgr,Byte>imgOrg;
Image<Gray,Byte>imgproc;
public cameracaps()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
Capture cam = new Capture();
}
catch (NullReferenceException exception)
{
MessageBox.Show(exception.Message);
return;
}
Application.Idle += new EventHandler(processFunction);
capturingprocess=true;
}
void processFunction(object sender,EventArgs e)
{
imgOrg=capturecam.QueryFrame();
if(imgOrg ==null)return;
imgproc=imgOrg.InRange(new Bgr(50,50,50),new Bgr(250,250,250));
imgproc = imgproc.SmoothGaussian(9);
original.Image=imgOrg;
processed.Image=imgproc;
}
private void Button1_Click(object sender, EventArgs e)
{
if(capturingprocess==true)
{
Application.Idle-=processFunction;
capturingprocess = false;
Button1.Text="play";
}
else
{
Application.Idle+= processFunction;
capturingprocess= true;
Button1.Text="pause";
}
}
}
}
展示。。"Emgu.CV.CvInvoke"的类型初始值设定项引发了异常。错误。。指示
Capture cam = new Capture();
中的错误帮帮我。
这是我们
在emgu cv中几乎一直面临的最大问题之一.首先将dll文件名opencv_core290.dll,open_cvhighgui290.dll复制到您的项目bin中,尝试对dll文件使用依赖跟踪器。从此链接安装依赖项 - http://www.emgu.com/wiki/index.php/Download_And_Installation..If 它不起作用,那么您应该了解应用程序正在与相机连接。然后转到我的电脑->右键单击->属性->高级系统设置->系统属性->高级>环境变量->系统变量->路径->编辑->并粘贴C:''Emgu''emgucv-windows-universal-cuda 2.9.0.1922''bin.并按确定.重新启动系统,它将工作。