【发布时间】:2014-08-01 03:53:36
【问题描述】:
我正在尝试使用 3 个相机拍摄照片,但是我无法制作全部 3 个。我有 2 个外置网络摄像头(Microsoft Cinema Webcam)和 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"); }
【问题讨论】: