/// <summary> /// Enables the input of the webcam /// </summary> public static bool EnableWebcam(string cameraUrl = null) { IVideoSource capture; try { if (cameraUrl == null) { capture = new VideoCaptureDevice( new FilterInfoCollection(FilterCategory.VideoInputDevice)[0].MonikerString); } else //assumes that it's a MJPEG stream, it's forms so whatever { capture = new MJPEGStream(cameraUrl); } source = new ProcessableVideoSource(capture); } catch (Exception e) { Console.WriteLine(e); MessageBox.Show(Messages.cameraNotFound); return(false); } processor = new FaceProcessor(source); processor.Start(); source.NewFrame += GetFrame; source.Start(); return(true); }
public void Start() { listener.Start(); Port = int.Parse(listener.LocalEndpoint.ToString().Split(':')[1]); Debug.WriteLine($"Server has started on port {Port}, waiting for a connection..."); if (!source.Stream.IsRunning) { source.Start(); } listen = true; listeningTask = Task.Run(() => Listen()); }
public void Start() { listener.Start(); Port = int.Parse(listener.LocalEndpoint.ToString().Split(':')[1]); Debug.WriteLine(string.Format("Server has started on port {0}, waiting for a connection...", Port)); source.NewFrame += SendNewFrameToClients; if (!source.Stream.IsRunning) { source.Start(); } listen = true; listeningTask = Task.Run(() => Listen()); }