大家好 初来乍到 最近在研究opencv 刚刚起步 遇到了一些问题 特来求助
我把系统变量等都配置好之后,在工程中也添加了引用
程序如下: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;//PS:调用的Emgu dll
using Emgu.CV.Structure;
using Emgu.Util;
using System.Threading;namespace WindowsFormsApplication13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Capture capture;
private bool captureinprocess;//判断摄像头的状态 private void button1_Click(object sender, EventArgs e)
{
if (capture != null)//摄像头不为空
{
if (captureinprocess)
{
Application.Idle -= new EventHandler(processfram);
button1.Text = "Stop!";
}
else
{
Application.Idle += new EventHandler(processfram);
button1.Text = "Start!";
}
captureinprocess = !captureinprocess;
}
else//摄像头为空则通过Capture()方法调用
{
try
{
capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
} private void processfram(object sender, EventArgs arg)
{
Image<Bgr, Byte> frame = capture.QueryFrame();
imageBox1.Image = frame;
}
}
}
报错的地方为imageBox1.Image = frame;
错与原因如下
错误 1 无法将类型“Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>”隐式转换为“System.Drawing.Image” C:\Users\Admin\Documents\Visual Studio 2008\Projects\WindowsFormsApplication13\WindowsFormsApplication13\Form1.cs 57 31 WindowsFormsApplication13这该咋整呢?辛苦各位大大~~~
我把系统变量等都配置好之后,在工程中也添加了引用
程序如下: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;//PS:调用的Emgu dll
using Emgu.CV.Structure;
using Emgu.Util;
using System.Threading;namespace WindowsFormsApplication13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Capture capture;
private bool captureinprocess;//判断摄像头的状态 private void button1_Click(object sender, EventArgs e)
{
if (capture != null)//摄像头不为空
{
if (captureinprocess)
{
Application.Idle -= new EventHandler(processfram);
button1.Text = "Stop!";
}
else
{
Application.Idle += new EventHandler(processfram);
button1.Text = "Start!";
}
captureinprocess = !captureinprocess;
}
else//摄像头为空则通过Capture()方法调用
{
try
{
capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
} private void processfram(object sender, EventArgs arg)
{
Image<Bgr, Byte> frame = capture.QueryFrame();
imageBox1.Image = frame;
}
}
}
报错的地方为imageBox1.Image = frame;
错与原因如下
错误 1 无法将类型“Emgu.CV.Image<Emgu.CV.Structure.Bgr,byte>”隐式转换为“System.Drawing.Image” C:\Users\Admin\Documents\Visual Studio 2008\Projects\WindowsFormsApplication13\WindowsFormsApplication13\Form1.cs 57 31 WindowsFormsApplication13这该咋整呢?辛苦各位大大~~~
解决方案 »
- 关闭程序时没有反应
- C#中父类和子类对象之间强制装换的问题
- GetHashCode()函数的功能到底是什么,谁能说清楚一点,这个函数到底有多大用处
- 请教!如何C#生成的DLL调用非托管DLL?
- Graphics.DrawLine画的操作如何刷新到PICTURE?
- 小菜请教Hashtable的问题,请大虾指教
- goto语句的 菜 问题
- 注销时,如何清楚Cookies????
- c#winform 调用matlab生成的.dll文件好慢啊,好像就是死掉了
- C# 在win7 64位操作系统不能调用语音引擎?
- 为什么绑顶不了Window的Top、Left、Width、Height等特征?代码错在哪里?
- c# RadioButton 遍历
=>
imageBox1.Image = frame.ToImage();