示例#1
0
        /// <summary>
        /// Captures an image using webcam. (Based on metricam library)
        /// </summary>
        /// <returns>Image object as captured</returns>
        static Image CaptureImage()
        {
            WebCam camera = new WebCam();

            camera.Connect();
            Image image = camera.GetBitmap();

            camera.Disconnect();
            return(image);
        }
示例#2
0
        protected void RenderWebcam()
        {
            IntPtr ip = IntPtr.Zero;

            ip = webcam.GetBitmap();
            if (ip != IntPtr.Zero)
            {
                Bitmap bmp = webcam.IPToBmp(ip);
                pictureBox1.Image = bmp;
                freeframe.processFrame(instanceID, ref bmp);
                label1.Text       = freeframe.elapsedTime.ToString() + " msec/frame";
                pictureBox2.Image = bmp;
                System.Runtime.InteropServices.Marshal.FreeCoTaskMem(ip);
                ip = IntPtr.Zero;
                pictureBox1.Refresh();
            }
        }