Friday, August 22, 2014

Web Cam using AForge .NET

This blog explains how to get live feed from the webcam. By assuming that your already learned the "How to set up the Aforge.Net Visual studio 2010 setup tutorial" from my previous blog.

Now we jump to the coding part of webcam. So now we have window like this.


Place a button over the form by double clicking the Button link from the ToolBox.And then move the button to your desired location in the form


  

After that change the text over the button to "Start". To do this Right Click over the "button1" and then Click "Properties". 



The Properties window will appear then change the button text from "button1" to "Start".



Now we add the picture box over the form by double clicking the "Picture Box" from the "Tool Box".


Lets move to coding part.Double Click over the Start button this will generate the click event handler of the start button and take us to the code behind of the form.

In the code behind add these namespaces



Then we have find the list of video devices attached to our system using "FilterInfoCollection" class.Once the video device is detected we will grab the frame by using "VideoCaptureDevice" class.

For better understanding I commented each line of the code.




Code for the get_Frame method



Download the Source code from here: "Camera Capture"

Happy coding !!!
 


 


 


 


No comments:

Post a Comment