Exemplo n.º 1
0
 protected virtual void OnFrameFetched(FrameFetchedEventArgs e)
 {
     if(FrameFetched != null)
     {
         FrameFetched(this, e);
     }
 }
 static void i_FrameFetched(object sender, FrameFetchedEventArgs e)
 {
     Console.WriteLine("Image was Fetched");
     Cam.Stop();
     //Environment.Exit(0);
 }
Exemplo n.º 3
0
        private SocketData FetchImageFromNetwork(SocketData d /*frame is passed*/) //converts frame into usable frame
        {


            #region declarations
            Image<Bgr, Byte> return_image;
            #endregion

            #region Convert to usable image + place in return_image using Peter's DLLs.

            // Contact Peter Zientara about this piece of code.

            if (d == null ) return null;

            int size = stream_width * stream_height * 3;
            byte[] rgb_data = new byte[size];
            unsafe
            {
                IntPtr byteArray = Marshal.AllocHGlobal(d.data.Length);
                Marshal.Copy(d.data, 0, byteArray, d.data.Length);
                IntPtr rgb_data_ptr;
                rgb_data_ptr = convertYUVtoRGB(byteArray, stream_width, stream_height);
                Marshal.FreeHGlobal(byteArray);
                Marshal.Copy(rgb_data_ptr, rgb_data, 0, size);
            }
            Image<Bgr, Byte> converted_image = new Image<Bgr, Byte>(stream_width, stream_height);
            Buffer.BlockCopy(rgb_data, 0, converted_image.Data, 0, size);
            //CvInvoke.cvShowImage("frame", image);
            //CvInvoke.cvWaitKey(1);

            return_image = converted_image;

            #endregion

            FrameFetchedEventArgs argsNetwork = new FrameFetchedEventArgs();

            argsNetwork.Frame = return_image;

            FrameFetched?.Invoke(this, argsNetwork);

            return null;

            
        }
Exemplo n.º 4
-1
 public WebcamFetcher(float width, float height)
 {
     args = new FrameFetchedEventArgs();
     camera = 0;
     cap = new Capture(camera);
     width = 648.0f;
     height = 1152.0f;
     cap.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, height);
     cap.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, width);
 }