如何使用直接放映捕获多张图像

时间:2018-07-19 10:44:35

标签: c# windows

我正在使用网络摄像头c#(Windows应用程序)使用Direct Show dll  enter image description here

当我单击捕获按钮调用时:

capture.FrameEvent2 += new Capture.HeFrame(CaptureDone);



private void CaptureDone(System.Drawing.Bitmap e)
        {
            if (Captured == true)
            {
                capture.FrameEvent2 -= new Capture.HeFrame(CaptureDone); return;
            }
                Bitmap bitmap = null;
                bitmap = e;
                DateTime localDate = DateTime.Now;
                string a = localDate.ToString("ddMMMyyyy");
                ImageCount = ImageCount + 1;
                Image old = pictureBox1.Image;
                pictureBox1.Image = bitmap;
                StoreImage(pictureBox1.Image);
                string ImageName = "";
                ImageFormat imageFormat = null;
                //Please Change these to opdno
                string regno = txtOpdno.Text;
                string filePath = Application.StartupPath + "\\SonoImage\\" + regno + "";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                    ImageName = Convert.ToString(ImageCount) + "-" + Convert.ToString(a);
                    filePath = filePath + "\\" + ImageName + ".Jpeg";
                }
                else
                {
                    ImageName = Convert.ToString(ImageCount) + "-" + Convert.ToString(a);
                    filePath = filePath + "\\" + ImageName + ".Jpeg";
                }
                bitmap.Save(filePath, ImageFormat.Jpeg);
                Captured = true;
        }

一切正常,但突然创建了:

对象目前在其他地方使用 谁能回答我为什么会产生这种错误? 如何停止呢?

0 个答案:

没有答案