0
你好当我运行这段代码到C#与emgucv看直播摄像机在PictureBox它告诉我一个错误 在这一部分:流摄像机IP emgucv
Mat frame = new Mat();
_capture.Retrieve(frame, 0);
captureImageBox.Image = frame;
的错误中提到
无法转换在emgu.cv.imag一种emgu.cv.mat ...
什么行代码,做我需要改变才能正确运行它....
规格
- 的Visual Studio 2015年
emgucv V3.1 64
public partial class Form1 : Form { private Capture _capture = null; private bool _captureInProgress; public Form1() { InitializeComponent(); CvInvoke.UseOpenCL = false; try { _capture = new Capture("http://webcam.st-malo.com/axis-cgi/mjpg/video.cgi?"); _capture.ImageGrabbed += ProcessFrame; } catch (NullReferenceException excpt) { MessageBox.Show(excpt.Message); } } private void ProcessFrame(object sender, EventArgs arg) { Mat frame = new Mat(); _capture.Retrieve(frame, 0); captureImageBox.Image = frame; } private void captureButton_Click(object sender, EventArgs e) { if (_capture != null) { if (_captureInProgress) { //stop the capture captureButton.Text = "Start Capture"; _capture.Pause(); } else { //start the capture captureButton.Text = "Stop"; _capture.Start(); } _captureInProgress = !_captureInProgress; } }
}
您需要使用'ToImage'将这个'Mat'转换为'image'数据类型(http://www.emgu.com/wiki/files/3.1.0/document/html/8e55d304- 16CB-c8a1-BB1B-702cb567a069.htm) – Ash