Capture Images Using Web Camera in ASP.Net 4.5
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.
I was working on a project to develop a web conferencing application. I had no experience in this area but I accepted the project and began working on it.
My first effort was to determine how to integrate the webcam into my application. I searched and found it's very simple. I have been very busy doing this project.
Here is my first and small effort that clarifies my mind toward completion of this project.
You can also do this in the following way.
- Latest Flash Player
- Web Camera
You need to do
The following is what you need to do:
- Copy the "WebcamResources" into your new application.
- Add the following code 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" >
This code will place your Flash object in your web page for capturing the image from the webcam.
- Create one more page named "ImageConversions.aspx".
- Add the following code into the ImageConversion.aspx file for 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);
The code above will convert the bytes to an image and save the image in the C drive.
Thanks a lot; excellent !!!!!