Saturday 5 January 2013

ASP.Net | Capture images using web camera | Neha Sharma


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 ll 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

Which Game Engine you should choose | Neha Sharma

Unity3D and Unreal Engine are only 2 Game engine which executes an indispensable position in Game Industry. The choice of the engine must ...