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

image_thumb5

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.

image_thumb10

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 http://vimeo.com/7526663

 

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

 

~Prem

8 comments:

  1. Where is the cam_NewFrame function???

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

    ReplyDelete
  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;
    }

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

    ReplyDelete
  5. http://www.codeproject.com/Articles/10248/Motion-Detection-Algorithms heres a link i think it can help you xiangs

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

    ReplyDelete
  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

    ReplyDelete