Search This Blog

Sunday, July 4, 2010

Webcam using AForge.NET (Part II)


Now to use webcam and I will go with the USB camera. I know the name of the camera (from the tutorial Part I, pop up box) as “USB2.0 Camera” and it is index as number 4 (from 0). You need to draw a picture box and a button to start the camera in the design view like this


Double click on the “Start Camera” button and we go to the code side. I am posting the code with comments. This will probably help you if you read the code.


And it works !!!!!!!!!!!!!!!!!!!!!!!!!

 Ok, here is another video from a different site. I am not the author. But just a crash programming.

C# Tutorial - Getting Images from Webcam using Aforge from shivam on Vimeo.

Here is the link to the source of this video and author


Up coming tutorials will be on image processing. I will be posting as I am learning.




  1. Where is the cam_NewFrame function???

  2. This is perfect.. Keep up the good work!!!

  3. Where is the cam_NewFrame function???

    use this instead

    private void cam_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
    pictureBox1.Image = (Bitmap)eventArgs.Frame;

  4. do you know how to do motion detection in visual studio? also through webcam viewing .

  5. heres a link i think it can help you xiangs

  6. Nice tutorial!, Could you tell me please what changes are necessary in this code to stream video from an IP camera?

  7. Ive tried it.. but why the application was just suddenly closed when i started the camera? i dont know how to fix this, so please help me