我正在尝试使用3个摄像头来拍摄照片但是我无法生成所有3个照片。我有2个外部网络摄像头(微软Cinema网络摄像头)和1个内部笔记本电脑摄像头,我使用我以前的笔记本电脑,它工作正常但是当我尝试使用另一台笔记本电脑时,它无法工作。
我尝试了一些方法,比如测试每个相机,我发现尽管在另一台笔记本电脑上有3个,但我可以同时使用我的程序同时使用2个网络摄像头。
我无法让我的笔记本电脑相机工作。知道怎么样?
任何想法如何让这项工作?
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"); }
答案 0 :(得分:0)
_capture = new Capture(1);
如果您从0开始索引,那么您的索引是1?