从网络摄像头流式传输时,我在使用AForge Library检测动作时遇到错误

时间:2014-12-27 15:12:39

标签: c# webcam aforge

我已经声明了这些:

// Motion Detection
AForge.Vision.Motion.MotionDetector motionDetector;
float detection;

在Form的加载事件中我做到了这一点:

motionDetector = new AForge.Vision.Motion.MotionDetector(new AForge.Vision.Motion.TwoFramesDifferenceDetector(), new AForge.Vision.Motion.MotionBorderHighlighting());
detection = 0;

我有以下代码:

void finalVideo_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
        Bitmap Streaming = new Bitmap((Bitmap)eventArgs.Frame.Clone(), webCam1.Size);
        Bitmap Frame = new Bitmap((Bitmap)eventArgs.Frame.Clone(), webCam1.Size);

        lock (Lock)
        {
            lock (Lock)
            {
                AddTimeStamp(Streaming);
            }

            lock (Lock) 
            {
                // Showing images in the pictureBox
                webCam1.Image = Streaming; 
            }
        }

        // Recording video
        if (writer != null)
        {
            if (RecordVideo.Checked)
            {
                try
                {
                    // create frame image
                    AddTimeStamp(Frame);

                    if(motionDetection.Checked)
                    {
                        // Detecting Motion
                        detection = motionDetector.ProcessFrame(Frame); [[[Getting Error Here]]]
                    }

                    // add frames to the video 
                    writer.AddFrame(Frame);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
    }

我收到此错误:

  

类型'AForge.Imaging.UnmanagedImage'在未引用的程序集中定义。您必须添加对程序集'AForge.Imaging,Version = 2.2.5.0,Culture = neutral,PublicKeyToken = ba8ddea9676ca48b'的引用。

我已经添加了对AForge.Imaging的引用,但我仍然收到此错误。请帮忙

0 个答案:

没有答案