Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Instead of using the WebCam class, why not just use the <code>WebCamCapture</code> class directly (since you are not displaying this in a form) and handle the <code>ImageCapture</code> event directly. The event argument for the event contains the <code>Image</code>. You could, in the event handler save the image to disk. Alternately, if you want to use the sample and the <code>WebCam</code> class, and you have a form. Use a PictureBox but leave it hidden (set Visible to false) and then just copy the image from there and save to disk when you need to.</p> <p>Here is some sample code of using the WebCamCapture class instead of the WebCam class. It should be noted that this code is based on the sample code from the link provided in the question. I have kept the style of the sample so that code lines up.</p> <p>Edit: Adding example of using WebCamCapture instead of WebCam class. This code should be used to modify <code>Form1.cs</code> in the sample code.</p> <pre><code>// Instead of having WebCam as member variable, have WemCamCapture WebCamCapture webCam; // Change the mainWinForm_Load function private void mainWinForm_Load(object sender, EventArgs e) { webCam = new WebCamCapture(); webCam.FrameNumber = ((ulong)(0ul)); webCam.TimeToCapture_milliseconds = 30; webCam.ImageCaptured += webcam_ImageCaptured; } // Add the webcam Image Captured handler to the main form private void webcam_ImageCaptured(object source, WebcamEventArgs e) { Image imageCaptured = e.WebCamImage; // You can now stop the camera if you only want 1 image // webCam.Stop(); // Add code here to save image to disk } // Adjust the code in bntStart_Click // (yes I know there is a type there, but to make code lineup I am not fixing it) private void bntStart_Click(object sender, Event Args e) { webCam.Start(0); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload