Capture images using web camera


Hello Friends....I am Nikunj R Satasiya.I was working for a project to develop a web conferencing application as per I consider I was null in this point of area but I accepted the project and get started to work over that. My first effort was :  how to integrate web cam in to my application I searched and found it’s very simple I have been very busy while doing this project, Here is my first and small effort which makes my mind clear for the completion of this project.
You can also do this by following way :

Requirements:
  1.  Latest Flash Player
  2. Web Camera  
You need to do :
  1. Copy the “WebcamResources” in to your new application.

  2. Add the following code in to your Default.aspx page:
<object width="450" height="200"
  param name="movie1" value="WebcamResources/save_picture.swf"
  embed src="WebcamResources/save_picture.swf" width="450" height="200" >
</object>

This code 2 place your flash object in to your web page, used to capture image from web cam.

  3.     Take on more page there with name ImageConversions.aspx.

      4.  Add the following code into the ImageConversions.aspx. at the page load event:

string str_Photo = Request.Form["image_Data"]; //Get the image from flash file
byte[] photo = Convert.FromBase64String(str_Photo);
FileStream f_s = new FileStream("C:\\capture.jpg", FileMode.OpenOrCreate, FileAccess.Write);
BinaryWriter b_r = new BinaryWriter(f_s);
b_r.Write(photo);
b_r.Flush();
b_r.Close();
f_s.Close(); 

Above code ll convert the byte to an image and ll save the image in c drive.
Enjoy!

Download Link : Download source code here
Previous
Next Post »
Thanks for your comment