Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Web Cam with Remoting
    primarykey
    data
    text
    <p>My project is about Remoting and i want to add a webcam component to it. Here it goes: I have 3 project in my solution... Client, Server, Remote.dll. In Remote.dll is a common class which has methods works in server machine. When i call these methods from Client it executes in server side. So now my question is i put the code of Webcam in remote.dll and it has an event called "video_NewFrame" which it works everytime when webcam catch an image. But i cant reach to the images from my Client side because when code drops to this event it executes infinitely and my timer in Client side doesnt work as well. I tried to assing image to my global variable but whenever code goes to client and comes to Remote.dll again my variable is null... How can i reach simultaneously captured images from my client? here is my code: (i use AForge framework for webcam)</p> <pre><code> private bool DeviceExist = true; private FilterInfoCollection videoDevices; private VideoCaptureDevice videoSource = null; public bool WebCamStart(int DeviceIndex) { if (DeviceExist) { videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); //string myDevice = videoDevices[0].Name; videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); CloseVideoSource(); videoSource.DesiredFrameSize = new Size(640, 480); //videoSource.DesiredFrameRate = 10; videoSource.Start(); return true; } else return false; } public Bitmap lastImg; private void video_NewFrame(object sender, NewFrameEventArgs eventArgs) { Bitmap img = (Bitmap)eventArgs.Frame.Clone(); //in executes infinitely when execution comes here and i cant reach from Cliend side... } public string getFPS() { return videoSource.FramesReceived.ToString(); } public void CloseVideoSource() { if (!(videoSource == null)) if (videoSource.IsRunning) { videoSource.SignalToStop(); videoSource.Stop(); videoSource = null; } } public string getCamList() { string result = "No Device Found"; try { videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); //comboBox1.Items.Clear(); if (videoDevices.Count == 0) throw new ApplicationException(); DeviceExist = true; foreach (FilterInfo device in videoDevices) { //comboBox1.Items.Add(device.Name); result = device.Name; return result; } //comboBox1.SelectedIndex = 0; //make dafault to first cam } catch (ApplicationException) { DeviceExist = false; //comboBox1.Items.Add("No capture device on your system"); return "No capture device on your system"; } return result; } </code></pre> <p>// and my client side...</p> <pre><code> private void timerWebCam_Tick(object sender, EventArgs e) { //lblFPS.Text ="Device Running... " + remObj.getFPS() + " FPS"; pictureBox1.Image = remObj.lastImg; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload