Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Take picture from Webcam (problem)

Take picture from Webcam (problem)

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    S K Y
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • S S K Y

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • C Christian Graus

        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

        S Offline
        S Offline
        S K Y
        wrote on last edited by
        #3

        that mean i need to save the image in a memory stream to use is back, am i correct? is there a way to convert in to Image?

        A S E L A

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups