private void button2_Click(object sender, EventArgs e) { mpeg = new MJPEGStream(); AForge.Video.DirectShow.VideoCaptureDevice fcg = new AForge.Video.DirectShow.VideoCaptureDevice(); mpeg.Login = "******"; mpeg.Password = "******"; mpeg.Source = "http://192.168.1.111/GetData.cgi"; AsyncVideoSource asyncSource = new AsyncVideoSource(mpeg); mpeg.NewFrame += new NewFrameEventHandler(cam_NewFrame); mpeg.Start(); Timer ti = new Timer(); /* sec = 0; * * frame_count = 0; * //usbCam = new FilterInfoCollection(FilterCategory.VideoInputDevice); * //cam = new VideoCaptureDevice(usbCam[0].MonikerString); * VideoCaptureDeviceForm Video_Input = new VideoCaptureDeviceForm(); * Video_Input.ShowDialog(); * cam =new VideoCaptureDevice(Video_Input.VideoDeviceMoniker); * cam.NewFrame +=new NewFrameEventHandler(cam_NewFrame); * cam.Start();*/ ti.Interval = 1000; ti.Tick += new EventHandler(time); ti.Start(); }
private void Start_Click(object sender, EventArgs e) { if (urlTxtBox.Text.Any()) { jpegStream = new MJPEGStream(urlTxtBox.Text); asyncVS = new AsyncVideoSource(jpegStream); asyncVS.NewFrame += Device_NewFrameAsync; asyncVS.Start(); } else if (DeviceDropBox.Text.Equals("Video File")) { videoSource = new FileVideoSource(filePath); // set NewFrame event handler videoSource.NewFrame += Device_NewFrameAsync; videoSource.VideoSourceError += new VideoSourceErrorEventHandler(videoSource_Error); // start the video source videoSource.Start(); } else { //VideoCaptureDevice vcd = new VideoCaptureDevice(stream.Source); var selected = DeviceDropBox.SelectedIndex; device = new VideoCaptureDevice(videoDevices[selected].MonikerString); device.NewFrame += Device_NewFrameAsync; device.Start(); } }
public WebCamVideoSource(string moniker) : base(DeviceName) { Device = new VideoCaptureDevice(moniker ?? throw new ArgumentNullException(nameof(moniker))); _videoSource = new AsyncVideoSource(Device); var videoCapability = Device.VideoCapabilities[0]; FrameSize = videoCapability.FrameSize; MaxFrameRate = videoCapability.MaximumFrameRate; }
private void OpenVideoSource(VideoCaptureDevice source) { Variaveis.Principal().Cursor = System.Windows.Input.Cursors.Wait; CloseVideoSource(); asyncVideoSource = new AsyncVideoSource(source); asyncVideoSource.NewFrame += AsyncVideoSource_NewFrame; asyncVideoSource.Start(); videoSource = source; Variaveis.Principal().Cursor = System.Windows.Input.Cursors.Arrow; }
private void button5_Click(object sender, EventArgs e) { mpeg = new MJPEGStream(); AForge.Video.DirectShow.VideoCaptureDevice fcg = new AForge.Video.DirectShow.VideoCaptureDevice(); mpeg.Login = "******"; mpeg.Password = "******"; mpeg.Source = "http://192.168.1.8/GetData.cgi"; AsyncVideoSource asyncSource = new AsyncVideoSource(mpeg); mpeg.NewFrame += new NewFrameEventHandler(cam_NewFrame); mpeg.Start(); }
/// <summary> release everything. </summary> public static void Dispose() { try { asyncSource.Stop(); asyncSource = null; } catch { } asyncSource_NewFrame(null, new NewFrameEventArgs(null)); }
public static void Start(VideoCaptureDevice videoSource) { videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); //VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[Device].MonikerString); videoSource.DesiredFrameRate = 25; asyncSource = new AsyncVideoSource(videoSource, true); asyncSource.NewFrame += new NewFrameEventHandler(asyncSource_NewFrame); asyncSource.Start(); }
private void btnStop_Click(object sender, EventArgs e) { if (bw != null) { stopBackgroundWorker(); } if (avs != null) { avs.Stop(); avs = null; } }
private void BtnStart_Click(object sender, EventArgs e) { fileName = "Channel" + "_" + DateTime.Now.Ticks.ToString() + Constants.EXTENSION_JPEG; VideoCaptureDeviceForm captureDeviceForm = new VideoCaptureDeviceForm(); if (captureDeviceForm.ShowDialog(this) == DialogResult.OK) { videoSource = captureDeviceForm.VideoDevice; asyncVideoSource = new AsyncVideoSource(videoSource); asyncVideoSource.NewFrame += AsyncVideoSource_NewFrame; asyncVideoSource.Start(); } }
private AsyncVideoSource videoSource; // Implements IVideoSource #endregion #region Constructor public FileStreamCamera(string videoFilename, bool skipFramesIfBusy) { ClearROI(); this.videoFilename = videoFilename; videoSource = new AsyncVideoSource(new FileVideoSource(videoFilename)); videoSource.SkipFramesIfBusy = skipFramesIfBusy; if (videoSource != null) { videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame); videoSource.VideoSourceError += new VideoSourceErrorEventHandler(videoSource_VideoSourceError); videoSource.PlayingFinished += new PlayingFinishedEventHandler(videoSource_PlayingFinished); } }
private void button8_Click(object sender, EventArgs e) { AForge.Controls.VideoSourcePlayer playerControl = new VideoSourcePlayer(); // set new frame event handler if we need processing of new frames playerControl.NewFrame += new VideoSourcePlayer.NewFrameHandler(playerControl_NewFrame); // create nested video source, for example JPEGStream AForge.Video.JPEGStream stream = new JPEGStream("some url"); // create video source IVideoSource videoSource = new AsyncVideoSource(stream); // start playing it playerControl.VideoSource = videoSource; playerControl.Start( ); }
private void btnLoadVideo_Click(object sender, EventArgs e) { if (avs != null) { return; } openFileDialog.Filter = "MP4 | *.mp4"; if (openFileDialog.ShowDialog() != DialogResult.OK) { return; } avs = new AsyncVideoSource(new VideoFileSource(openFileDialog.FileName)); avs.NewFrame += Avs_NewFrame; avs.Start(); }
public LedWallInteract() { InitializeComponent(); convTimes = new List <TimeSpan>(); // Initialize hardware driver _ledWall = new LedWallHardwareDriver(LedsPerStrip, StripCount); rainbow = new Color[LedsPerStrip]; int steps = LedsPerStrip / gamut.Length; for (int i = 0; i < gamut.Length; i++) { Color[] iter = InterpolateColors(gamut[i], gamut[(i + 1) % gamut.Length], steps); Array.Copy(iter, 0, rainbow, i * steps, Math.Min(iter.Length, LedsPerStrip - (i * steps))); } bw = null; avs = null; }
public override void Cleanup() { videoSource = null; }