dimanche 27 avril 2014

ASP.net - Capture suis image de webcam et économisez - Stack Overflow


Hello guys im trying to save a picture taken from my webcam. im actually using this code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class ImageConversions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CreatePhoto();
}

void CreatePhoto()
{
try
{

string strPhoto = Request.Form["imageData"]; //Get the image from flash file
byte[] photo = Convert.FromBase64String(strPhoto);



FileStream fs = new FileStream("C:\\Webcam.jpg", FileMode.OpenOrCreate, FileAccess.Write);
BinaryWriter br = new BinaryWriter(fs);
br.Write(photo);
br.Flush();
br.Close();
fs.Close();
}
catch (Exception Ex)
{

}
}
}

The application RUNS, i get to see the image , i click the capture button it gives no error till here BUT BUT BUT ... NO IMAGE IS SAVED EITHER i downloaded the sample from HERE : http://www.dotnetspider.com/resources/38150-Capture-save-images-from-Web-camera.aspx (check the attachemnt)




try this artical. it works pretty good. But i couldnt work with a custom message when webcam is not attached. it gives a auto generated error message


https://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download



Change Path.. I also had same problem.. Your C Drive Has security level high, Change path to "D:\Webcam.jpg" and it will work



Hello guys im trying to save a picture taken from my webcam. im actually using this code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class ImageConversions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
CreatePhoto();
}

void CreatePhoto()
{
try
{

string strPhoto = Request.Form["imageData"]; //Get the image from flash file
byte[] photo = Convert.FromBase64String(strPhoto);



FileStream fs = new FileStream("C:\\Webcam.jpg", FileMode.OpenOrCreate, FileAccess.Write);
BinaryWriter br = new BinaryWriter(fs);
br.Write(photo);
br.Flush();
br.Close();
fs.Close();
}
catch (Exception Ex)
{

}
}
}

The application RUNS, i get to see the image , i click the capture button it gives no error till here BUT BUT BUT ... NO IMAGE IS SAVED EITHER i downloaded the sample from HERE : http://www.dotnetspider.com/resources/38150-Capture-save-images-from-Web-camera.aspx (check the attachemnt)



try this artical. it works pretty good. But i couldnt work with a custom message when webcam is not attached. it gives a auto generated error message


https://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download


Change Path.. I also had same problem.. Your C Drive Has security level high, Change path to "D:\Webcam.jpg" and it will work


Related Posts:

0 commentaires:

Enregistrer un commentaire