EMGUCV多摄像头
本文关键字:摄像头 EMGUCV | 更新日期: 2023-09-27 18:15:58
我试图使用3个相机捕捉照片,但我无法生产所有3个。我有2个外部网络摄像头(微软电影网络摄像头)和1个内部笔记本电脑摄像头,我使用我以前的笔记本电脑,它工作完美,但当我试图使用另一台笔记本电脑时,它无法工作。
我尝试了一些方法,比如测试每个摄像头,我发现我只能使用我的程序同时使用2个摄像头,尽管另一台笔记本电脑上有3个摄像头。
我无法使我的笔记本电脑相机工作。知道怎么做吗?
知道如何得到这个工作吗?
namespace Camera { public partial class CameraOutput : Form { private Capture _capture, _capture2, _capture3; private bool captureInProgress; private bool saveToFile; private Font font = new Font("Calibri", 14); public CameraOutput() { InitializeComponent(); } private void ProcessFrame(Object sender, EventArgs arg) { Image<Bgr, Byte> ImageFrame = _capture.QueryFrame(); Image<Bgr, Byte> ImageFrame2 = _capture2.QueryFrame(); Image<Bgr, Byte> ImageFrame3 = _capture3.QueryFrame(); CamImageBox.Image = ImageFrame; CamImageBox2.Image = ImageFrame3; CamImageBox3.Image = ImageFrame2; //image_Form1 = Image.FromFile(@"C:'center90'center90(1).jpg"); if (saveToFile) { ImageFrame.Save(@"C:'Users'L31101'Desktop'Camera'Camera'bin'Debug'left'left.jpg"); ImageFrame3.Save(@"C:'Users'L31101'Desktop'Camera'Camera'bin'Debug'center'center.jpg"); ImageFrame2.Save(@"C:'Users'L31101'Desktop'Camera'Camera'bin'Debug'right'right.jpg"); //System.Drawing.Image img = ImageFrame3.ToBitmap(); //image_Form1 = img; CameraCoordinates form2 = new CameraCoordinates(ImageFrame3.ToBitmap(),ImageFrame.ToBitmap(),ImageFrame2.ToBitmap()); form2.Show(); saveToFile = !saveToFile; } } private void CameraOutput_Load(object sender, EventArgs e) { #region if capture is not created, create it now pictureBox1.Enabled = true; if (_capture == null) { try { _capture = new Capture(1); } catch (NullReferenceException excpt) { MessageBox.Show(excpt.Message); } } if (_capture2 == null) { try { _capture2 = new Capture(2); } catch (NullReferenceException excpt) { MessageBox.Show(excpt.Message); } } if (_capture3 == null) { try { _capture3 = new Capture(3); } catch (NullReferenceException excpt) { MessageBox.Show(excpt.Message); } } #endregion if (_capture != null) { if (pictureBox1.Enabled == false) { Application.Idle -= ProcessFrame; } else { Application.Idle += ProcessFrame; } captureInProgress = !captureInProgress; } if (_capture2 != null) { if (pictureBox1.Enabled == false) { Application.Idle -= ProcessFrame; } else { Application.Idle += ProcessFrame; } captureInProgress = !captureInProgress; } if (_capture3 != null) { if (pictureBox1.Enabled == false) { Application.Idle -= ProcessFrame; } else { Application.Idle += ProcessFrame; } captureInProgress = !captureInProgress; } } private void ReleaseData() { if (_capture != null) _capture.Dispose(); if (_capture2 != null) _capture.Dispose(); if (_capture3 != null) _capture.Dispose(); } Image image_Form1; public Image Image_Form1 { get { return image_Form1; } set { image_Form1 = value; } } private void pictureBox1_Click(object sender, EventArgs e) { saveToFile = !saveToFile; MessageBox.Show("Done"); }
_capture = new Capture(1);
你从1开始索引,你应该从0开始吗?