Take picture from Webcam (problem)
-
Curently i take a picture from webcam and load into the picture box by this way. take picture and save in to hard disk and load it again into picture box. is there any easy way to do this?
try
{
DeviceManager manager = new DeviceManagerClass();
Device d = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
d = info.Connect();
}
int i = 0;
Item item = d.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;
imagefile.SaveFile("d:\\" + i + ".jpeg");
pictureBox1.Image = Image.FromFile("d:\\" + i + ".jpeg");
i++;A S E L A
-
Curently i take a picture from webcam and load into the picture box by this way. take picture and save in to hard disk and load it again into picture box. is there any easy way to do this?
try
{
DeviceManager manager = new DeviceManagerClass();
Device d = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
d = info.Connect();
}
int i = 0;
Item item = d.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;
imagefile.SaveFile("d:\\" + i + ".jpeg");
pictureBox1.Image = Image.FromFile("d:\\" + i + ".jpeg");
i++;A S E L A
Well, no, because the file you have, is not a .NET bitmap or image object. If you can save from the ImageFile to a memory stream, you could use that as a point of conversion.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
Well, no, because the file you have, is not a .NET bitmap or image object. If you can save from the ImageFile to a memory stream, you could use that as a point of conversion.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp